Commit Graph
10 Commits
Author SHA1 Message Date
480584de63 chore: project setup and tooling cleanup (#26)
* add project setup

* add tools to eslint

* remove contributing.md

* update claude md

* chore: simplify CI to single Node.js version (22)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* use node 20

* adjust formatting

* fix linting

* format

* fix layout

* fix: align CI node version to .nvmrc (22), remove redundant gotcha

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: arkon <arkon.85@hotmail.com>
2026-02-27 13:16:23 +01:00
arkonandClaude Opus 4.6 868d4f1196 perf: fix memory leaks — strip task outputs from SSE broadcasts, use light state everywhere
- TaskTracker.getTaskTreeLight(): strips large `output` strings from tasks
  in SSE broadcasts (was serializing 5-10MB every 500ms with many subagents)
- session:created broadcasts now use toLightDetailedState() (consistent with
  session:updated which already did)
- GET /api/sessions/:id returns light state (no 2-3MB terminal+text buffers)
- Ralph wizard polls /terminal?tail=2048 instead of full session endpoint

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 06:50:59 +01:00
arkonandClaude Opus 4.5 8f0bbf33d6 chore: bump version to 0.1477
Location: Ko Samui

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 07:24:32 +01:00
arkon 7dfd97df58 chore: bump version to 0.1434 2026-01-30 11:30:51 +01:00
arkonandClaude Opus 4.5 add8f8c84b fix: memory leak prevention and resource cleanup improvements
SSE Client Management:
- Add periodic health check (30s) to detect dead SSE connections
- Clean up clients with destroyed/non-writable sockets
- Clear all SSE clients on server stop

Session Lifecycle:
- Add _isStopped flag to prevent new timers after session stops
- Check flag in auto-compact/clear callbacks to avoid timer races
- Check flag in line buffer flush timer creation

Server Shutdown:
- Add _isStopping flag to prevent timer creation during shutdown
- Skip batch timer creation in terminal/output/task/state handlers
- Clear SSE health check timer on stop

Ralph Tracker:
- Call clearDebounceTimers() in clear() method (was missing)
- Add MAX_COMPLETION_PHRASE_ENTRIES (50) to trim phrase map
- Add MAX_LINE_BUFFER_SIZE (64KB) to prevent unbounded growth
- Trim line buffer when exceeding max size

Task Tracker:
- Add timestamp to pending tool uses for age-based cleanup
- Add PENDING_TOOL_USE_MAX_AGE_MS (1 hour) expiry
- Add MAX_PENDING_TOOL_USES (100) limit
- Clean up old entries on new tool use

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 00:08:32 +01:00
arkonandClaude Opus 4.5 d8803e3318 refactor: remove unused imports, variables, and constants
- inner-loop-tracker.ts: Comment out unused COMPLETION_SIGNAL_PATTERN, use _id
- session.ts: Remove unused execSync import and timeout constants
- task-tracker.ts: Use _context for unused parameter
- server.ts: Remove unused FastifyRequest import

All files now pass --noUnusedLocals --noUnusedParameters check.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 06:51:41 +01:00
arkonandClaude Opus 4.5 8cfc02785f docs: add comprehensive JSDoc comments to core modules
Add detailed JSDoc documentation to:
- inner-loop-tracker.ts: Ralph Wiggum loop detection and todo tracking
- respawn-controller.ts: Autonomous session cycling state machine
- task-tracker.ts: Background task detection and hierarchy

Includes:
- @fileoverview module descriptions
- Detailed class and method documentation
- @param, @returns, @fires annotations
- Code examples in class docs
- Configuration constant descriptions
- Pre-compiled regex pattern documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 03:46:11 +01:00
arkonandClaude Opus 4.5 cebc7cfe25 perf: pre-compile regex patterns in task-tracker
- Move launch and completion detection patterns to module-level constants
- Use iterator directly instead of Array.from for deduplication check
- Reduces regex compilation overhead on every terminal output

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 11:53:11 +01:00
arkonandClaude Opus 4.5 7979e77924 perf: optimize for long-running Claude sessions
Critical fixes (unbounded growth):
- Add 64KB line buffer limit with 100ms periodic flush in session.ts
- Add task tracker cleanup (max 100 completed tasks)
- Add scheduled runs auto-cleanup after 1 hour
- Fix session leaks in scheduled run iterations

High priority (performance):
- Add SSE event batching (50ms output, 100ms task updates)
- Parallelize screen stats with Promise.all()
- Add 1MB buffer limit to respawn controller

Medium priority (frontend):
- Make xterm scrollback configurable (default 5000)
- Debounce renderSessionTabs() at 100ms

New feature:
- Add CPU and memory usage display in frontend header
- New /api/system/stats endpoint

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 06:51:25 +01:00
arkonandClaude Opus 4.5 ad99fe5922 feat: add auto-clear, timed respawn, and enable on existing sessions
- Add token tracking to Session class (input/output tokens)
- Add auto-clear feature that sends /clear when token threshold reached
- Add API endpoint to enable respawn on existing running sessions
- Add timed duration setting for respawn (auto-stops after N minutes)
- Add TaskTracker class for background task detection and tree display
- Update UI with duration input, auto-clear settings, and "Enable on Current" button
- Add respawn timer display in banner when timed run is active
- Add token count display in respawn banner

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 00:38:11 +01:00