Commit Graph

99 Commits

Author SHA1 Message Date
Eyejoker
c76126bd58 refactor: replace Memento MCP with local memory 2026-03-31 23:22:50 +09:00
Eyejoker
2070e0391f refactor: remove register_group legacy surface 2026-03-31 21:59:01 +09:00
Eyejoker
b9538e54bc feat: add room-level assignment write path 2026-03-31 21:21:57 +09:00
Eyejoker
8360812e1d fix: align ContentBlock media_type with SDK 0.2.87 literal union type 2026-03-31 05:01:21 +09:00
Eyejoker
2753849343 chore: update Claude Agent SDK 0.2.87, Codex SDK 0.117.0 2026-03-31 04:47:42 +09:00
Eyejoker
0112f5a2d6 feat: migrate runtime from Node.js to Bun
- Replace better-sqlite3 with bun:sqlite (native, no native addon build)
- Change all spawn('node') to spawn('bun') for agent processes
- Update package.json scripts: node→bun, tsx→bun, npm→bun
- Add bun-types for tsc compatibility
- Add bun:sqlite→better-sqlite3 shim for vitest (tests run on Node.js)
- Update Dockerfile: install bun alongside Node.js (CLIs need Node)
- Update setup/platform.ts: getNodePath() resolves bun binary
- Remove better-sqlite3 from production dependencies (devDep only for tests)
2026-03-30 23:58:54 +09:00
Eyejoker
787c05a561 fix: /compact masked by room role header in both runners
prependRoomRoleHeader was called BEFORE /compact detection, turning
"/compact" into "[PAIRED ROOM: owner]\n/compact" which failed the
exact match check. Now session commands are detected first.
2026-03-29 21:14:04 +09:00
Eyejoker
16d20fe627 feat: paired review system overhaul — unified service, configurable agents, silent output removal
- Remove UNIFIED_MODE legacy: single service manages all 3 Discord bots
- Add OWNER_AGENT_TYPE / REVIEWER_AGENT_TYPE env vars for configurable agent selection
- Fix Discord channel routing: reviewer output goes through correct bot (discord/discord-review)
- Fix channel name assignment: explicit names prevent agentTypeFilter collision
- Remove silent output suppression system: harness-level protections replace prompt workarounds
- Add reviewer approval detection: DONE marker on first line stops ping-pong
- Include user's original message in reviewer prompt for context
- Fix round_trip_count auto-reset on new user message
- Fix session ID conflict: reviewer doesn't reuse owner's session
- Fix pending progress text flush in runner on close sentinel
- Promote buffered intermediate text to final result when result event has no text
- Remove legacy files: .env.codex.example, .env.codex-review.example, migrate-unify.cjs
- Update CLAUDE.md: server-side build deployment, unified architecture docs
2026-03-29 20:50:32 +09:00
Eyejoker
05c06fc467 feat: graceful agent abort on SIGTERM via AbortController
When /stop sends SIGTERM, the runner now calls AbortController.abort()
on the Claude SDK query, allowing graceful cleanup of in-flight API
requests before the process exits. Falls back to SIGKILL after 5s.
2026-03-29 18:47:26 +09:00
Eyejoker
dad6f50937 feat: enforce paired reviewer gate verdicts 2026-03-29 06:03:45 +09:00
Eyejoker
eee09e8b7c fix: clean reviewer snapshots and scope git guard 2026-03-28 21:34:06 +09:00
Eyejoker
e7f49d77da feat: add paired review workspace flow 2026-03-28 21:14:25 +09:00
Eyejoker
79a8a2639e feat: add structured room role metadata 2026-03-28 19:30:32 +09:00
Eyejoker
fe6314108c feat: add structured silent output contract 2026-03-28 05:56:58 +09:00
Eyejoker
7b63ba859d fix: deduplicate CI watchers and remove task ID from watcher prompts
Prevent duplicate CI completion notifications in paired rooms by checking
for existing active watchers with the same channel+provider+metadata before
creating a new one. Remove Task ID from watcher prompt construction to
avoid router secret redaction (task- IDs contain sk- pattern), passing
EJCLAW_RUNTIME_TASK_ID via env var instead and making cancel_task
auto-resolve when task_id is omitted.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-26 20:57:59 +09:00
Eyejoker
f51f282eb1 chore: update agent-runner package-lock.json
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-25 22:31:57 +09:00
Eyejoker
33fcf9c788 feat: add host-driven GitHub Actions CI watcher (Level 3)
Replace LLM-per-tick polling with direct `gh api` calls for GitHub
Actions watchers. New `ci_provider` discriminator column routes tasks
to either the host-driven path (zero LLM tokens) or the existing
generic LLM path. GitHub watchers poll at 15s intervals (min 10s)
via `checkGitHubActionsRun()` in the scheduler, with completion
messages sent directly to chat on terminal state.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-25 22:31:42 +09:00
Eyejoker
24d93d5c78 fix: fail fast on missing host IPC dir for task runtimes 2026-03-25 21:40:34 +09:00
Eyejoker
5620301024 fix: pass EJCLAW_HOST_IPC_DIR to MCP server env for both runners
Watcher tasks get task-scoped IPC dirs (data/ipc/{group}/tasks/{taskId}/),
but the MCP server used HOST_IPC_DIR to write IPC files. Without
EJCLAW_HOST_IPC_DIR, it fell back to the task-scoped path, writing
cancel_task/send_message files to nested dirs the IPC watcher never scans.

This caused 11 zombie watchers stuck in infinite loops — self-cancel
calls silently failed with ~4000 stranded IPC files accumulating.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-25 21:05:22 +09:00
Eyejoker
5ea3439c5f refactor: extract shared utilities, protocol constants, and retry loop
Phase 3: provider-retry.ts — shared Claude rotation loop (SSOT)
  - retryClaudeWithRotation extracted from message-agent-executor + task-scheduler
  - ~200 lines of duplicated retry logic removed

Phase 4: types.ts — AgentOutputPhase + VisiblePhase unified
Phase 5: types.ts — AgentConfig extended with claudeThinking/claudeThinkingBudget

Utilities (utils.ts):
  - getErrorMessage: 14 occurrences of instanceof Error pattern → 1 function
  - readJsonFile/writeJsonFile: 19 occurrences of JSON+fs pattern → 2 functions
  - fetchWithTimeout: 3 occurrences of AbortController pattern → 1 function
  - formatElapsedKorean: deduplicated from task-watch-status + message-turn-controller

Protocol (agent-protocol.ts):
  - OUTPUT_START/END_MARKER centralized (runners keep local copies with SSOT reference)
  - IMAGE_TAG_RE, IPC constants documented

Runner: show "대화 요약 중..." progress message during auto-compact

Net: -137 lines, 354/354 tests passing
2026-03-25 04:59:49 +09:00
Eyejoker
b9f98fcc19 feat: log token count on auto-compact trigger
Log pre_tokens and trigger type from compact_boundary message
in both main query loop and /compact slash command path.
2026-03-25 04:01:48 +09:00
Eyejoker
0724914a43 merge: integrate remote token rotation + memory pipeline
Merge remote main (token rotation, usage API, dashboard fixes)
with local memory pipeline changes. Smart quote encoding fixed.
Test alignment pending.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 03:53:15 +09:00
Eyejoker
3467e245d5 feat: auto memory pipeline — host-driven Memento recall/reflect
Add automatic memory integration so EJClaw host directly calls Memento
MCP for recall at session start and reflect on compact, removing
reliance on agent voluntary tool use.

Stage 1: New sessions get room memory briefing injected into system
prompt (CLAUDE.md / AGENTS.md) via host-side MCP client.

Stage 2: PreCompact hook automatically calls reflect + remember to
persist session summaries as room-memory fragments.

Also restores missing source files (token-rotation, codex-token-rotation,
claude-usage exports) to fix full build from source.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 03:48:36 +09:00
Eyejoker
2161b555ec fix: dedup intermediate/final, filter long descriptions, update SDKs
- Track lastIntermediateText to prevent duplicate Discord delivery
  when same text arrives as both intermediate and final
- Filter task_progress descriptions >80 chars (AI summaries)
- Mark completed subagents with  instead of removing
- Update claude-agent-sdk 0.2.76→0.2.81, codex 0.115→0.116
2026-03-23 20:16:54 +09:00
Eyejoker
21a6be84b4 feat: multi-agent progress tracking with per-subagent display
Track each subagent separately via agentId from SDK task events.
Single subagent shows detailed view with activity sub-lines,
multiple subagents show compact one-line-each format.
2026-03-23 19:46:08 +09:00
Eyejoker
8c98ad9faf fix: intermediate text as standalone messages, preserve progress
Add 'intermediate' phase for assistant text between tool calls.
These are sent as separate Discord messages without finalizing
or disrupting the active progress message.
2026-03-23 19:29:16 +09:00
Eyejoker
720086808a fix: intermediate text as separate messages, not progress heading
Intermediate assistant text (e.g., "서브에이전트 4개 병렬로 띄웠어요")
is now emitted as regular messages (no phase), not progress heading
updates. Progress heading is only set by task_started (🔄) events.
2026-03-23 19:26:20 +09:00
Eyejoker
be9dfa64b0 fix: deduplicate progress at runner level, not host revert
Buffer intermediate assistant text in the runner. When result arrives
with matching text, discard the buffered progress instead of emitting
it. This prevents the duplicate from ever reaching Discord, eliminating
the flash-then-revert behavior.
2026-03-23 19:22:14 +09:00
Eyejoker
83df0e7dc1 fix: use task_started description as immediate heading, dedupe final
- Show subagent description from task_started immediately (no 30s wait)
- Remove AI summary (agentProgressSummaries) — task_started is sufficient
- Revert progress heading to previous when final text matches current
- Track previousProgressText in direct-update path
2026-03-23 19:20:23 +09:00
Eyejoker
a8a1c9b45a fix: throttle progress edits via 5s ticker, prevent Discord rate limit
- Remove per-tool-activity sync calls (was flooding Discord with edits)
- Ticker-only sync at 5s intervals for time + tool activity updates
- Summary updates heading directly when progress message exists
- Prevent duplicate progress message creation with progressCreating flag
2026-03-23 19:13:51 +09:00
Eyejoker
5112af6741 fix: progress ticker on tool-activity, last-line └, summary+description both shown
- Ensure progressTicker runs during tool-activity updates for time refresh
- Last activity line uses └ instead of ├
- Summary (📋) and description shown together when both present
- Description indented as sub-item under summary
2026-03-23 18:52:17 +09:00
Eyejoker
6268ee64ed fix: prevent bot ping-pong in implicit continuation window
Exclude is_bot_message from implicit continuation trigger check.
Previously, bot A's response would trigger bot B's continuation
window, causing infinite back-and-forth responses.

Also: tool activity sub-lines use description over summary,
and max activities reduced to 2.
2026-03-23 18:44:43 +09:00
Eyejoker
ac11cb7df1 feat: show tool activity sub-lines in progress messages
Display subagent tool descriptions as sub-lines under the main
progress text, updating in-place via Discord message edit.
Shows up to 5 recent tool activities (e.g., "Reading index.ts").
2026-03-23 18:31:20 +09:00
Eyejoker
0438d9113b fix: clean up progress tracking, fix subagent summary field handling
- Use system/task_progress subtype (not top-level type) for subagent events
- Extract intermediate assistant text between tool calls as progress
- Only show SDK-generated summaries for subagent progress (skip noisy per-tool updates)
- Truncate progress messages to Discord 2000 char limit
- Remove verbose debug logging from production
2026-03-23 17:59:49 +09:00
Eyejoker
7908115ea8 feat: enable subagent progress summaries in Claude runner
- Set agentProgressSummaries: true in SDK query options
- Handle task_progress and task_started events from subagents
- Subagent progress summaries streamed as progress phase to Discord
2026-03-23 17:09:42 +09:00
Eyejoker
77e79505eb feat: auto-suspend tasks on quota errors, add Claude progress tracking
- Auto-suspend tasks after 3 consecutive quota/auth errors with
  retry-after date parsing and Discord notification
- Add tool_progress and tool_use_summary streaming from Claude Agent SDK
- Prefix progress messages with invisible marker so bots ignore them
- Fix misleading provider label in codex service logs
2026-03-23 17:03:17 +09:00
Eyejoker
42d721a9ec fix claude turn teardown and start CI watchers immediately 2026-03-23 08:55:48 +09:00
Eyejoker
d28b6151a8 chore: rebrand runtime and docs to EJClaw 2026-03-23 08:09:15 +09:00
Eyejoker
02408aae8e refactor: make runners single-turn 2026-03-23 04:51:54 +09:00
Eyejoker
767ab20d76 Restrict Codex task scheduling to CI watchers 2026-03-20 04:09:36 +09:00
Eyejoker
6eb72ad499 Merge origin/main into chore/nanoclaw-recursive-room 2026-03-20 03:48:29 +09:00
Eyejoker
a293a701f4 fix: restore regressions from discord-only refactor 2026-03-20 03:41:53 +09:00
Eyejoker
bb0628e8f4 refactor: remove legacy container and non-discord remnants 2026-03-20 01:07:46 +09:00
Eyejoker
41afcb91cf feat: integrate Memento MCP for shared memory across agents
- Add MEMENTO_MCP_SSE_URL/ACCESS_KEY/REMOTE_PATH to readEnvFile
- Merge .env vars into cleanEnv for runner process inheritance
- Claude Code runner: add memento-mcp via mcp-remote in mcpServers
- Codex runner: inject memento-mcp section into config.toml
- Various improvements: CI watch, task scheduler, DB, IPC auth
2026-03-20 00:12:43 +09:00
Eyejoker
193119945a Add self-stopping CI watch tasks 2026-03-19 14:14:39 +09:00
Eyejoker
f2ad1331a9 Rebrand NanoClaw to EJClaw 2026-03-19 03:31:41 +09:00
Eyejoker
779d57c392 Stabilize paired-room orchestration and Codex app-server flow 2026-03-19 02:57:14 +09:00
Eyejoker
b710d4a33d chore: update claude-agent-sdk to 0.2.76, read dashboard config from .env
- Bump @anthropic-ai/claude-agent-sdk 0.2.68 → 0.2.76
- Read STATUS_CHANNEL_ID and USAGE_DASHBOARD from .env file
2026-03-16 05:54:17 +09:00
Eyejoker
e2d6476cdf refactor: rename container/ to runners/
No longer using Docker containers — agents run as direct host
processes. The directory name now reflects the actual purpose.

Updated all references across source code, docs, and skills.
2026-03-15 19:29:23 +09:00