Commit Graph

712 Commits

Author SHA1 Message Date
Eyejoker
30f19f994b refactor: split setup service rendering and verify probes 2026-03-31 06:54:49 +09:00
Eyejoker
4ac2b9066b fix: auto-retry Codex turn once on interrupted status
When the Codex SDK returns 'interrupted' (API-side timeout/disconnect),
retry the turn once before reporting failure. Prevents unnecessary
"요청을 완료하지 못했습니다" messages for transient issues.
2026-03-31 06:48:07 +09:00
Eyejoker
4003988ff4 refactor: make service defs the setup SSOT 2026-03-31 06:20:15 +09:00
Eyejoker
4bfd3f363f refactor: extract pure builders for SSOT tests 2026-03-31 06:12:20 +09:00
Eyejoker
650ed16a7b fix: strengthen arbiter ESCALATE guidance to prevent echo loops
Arbiter was repeating PROCEED when owner needed user input (e.g.,
"PR 만들까요?"), causing infinite owner↔arbiter loops. Added
specific ESCALATE triggers: user-directed questions, repeated
NEEDS_CONTEXT after prior PROCEED.
2026-03-31 06:03:11 +09:00
Eyejoker
4fcec1ef47 refactor: extract runtime PATH env builder for SSOT 2026-03-31 05:52:19 +09:00
Eyejoker
a81e5aea63 style: format pending paired turn helpers 2026-03-31 05:43:54 +09:00
Eyejoker
43f8341c17 refactor: extract pending paired turn helpers 2026-03-31 05:43:17 +09:00
Eyejoker
4fc7a88e86 chore: make deploy fast-forward only 2026-03-31 05:30:33 +09:00
Eyejoker
189c8795a1 fix: wire stack restart to TypeScript entrypoint 2026-03-31 05:25:50 +09:00
Eyejoker
648457d717 chore: remove nanoclaw legacy skills and scripts
Remove 9 inherited skills (Qodo, update-ejclaw, add-* addons,
update-skills) and restart-ejclaw-stack.sh that came from the
nanoclaw fork and are no longer used.
2026-03-31 05:16:48 +09:00
Eyejoker
060818c914 chore: simplify package scripts (remove duplicates, logical ordering) 2026-03-31 05:07:32 +09:00
Eyejoker
fc21804bf1 chore: add build:all and deploy scripts, remove hardcoded server details from docs 2026-03-31 05:05:33 +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
196c453ccf fix: skip enqueueMessageCheck when task is already completed (ESCALATE/done) 2026-03-31 04:59:27 +09:00
Eyejoker
636c54702a fix: prevent ESCALATE → new task loop (only create tasks on human messages) 2026-03-31 04:58:26 +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
9311cb9ebc docs: update README — role-based description, version badge, architecture diagram with direct channel 2026-03-31 04:45:46 +09:00
Eyejoker
3283522be5 feat: enrich finalize prompts and raise round-trip default 2026-03-31 04:40:56 +09:00
Eyejoker
c2351a4bb9 docs: update README for v0.1.0 (owner arbiter, auto notify, loop protection, Discord-independent comm) 2026-03-31 04:32:49 +09:00
Eyejoker
d0416489c5 fix: escalate finalize blockers without reviewer bounce 2026-03-31 04:32:10 +09:00
Eyejoker
a604a63f87 chore: reset version to 0.1.0 (EJClaw independent versioning) 2026-03-31 04:31:20 +09:00
Eyejoker
7085711a7f feat: auto-notify user on paired task completion with @mention
- done →  작업 완료
- escalated → ⚠️ 자동 해결 불가
- arbiter_escalated → ⚠️ 중재자: 사람 개입 필요
- stopped → no notification (user initiated)
2026-03-31 04:29:24 +09:00
Eyejoker
60408cc1fa fix: arbiter session collision — separate session folder + always fresh session
- resolveSessionFolder now always returns unique folder for arbiter
  (prevents sharing session with owner when both use same agent type)
- Arbiter sessionId forced to undefined to prevent resume attempts
2026-03-31 04:26:48 +09:00
Eyejoker
56c85c357a fix: prevent agents from tagging user during paired review loop 2026-03-31 04:21:22 +09:00
Eyejoker
af550a2aab fix: prevent infinite loops in paired review (merge_ready oscillation, arbiter re-invocation)
- Owner finalize with concerns now checks deadlock threshold before
  looping back — prevents merge_ready ↔ active infinite oscillation
- Arbiter verdict resets round_trip to threshold-1 instead of 0,
  giving agents one round before re-triggering arbiter
2026-03-31 04:13:26 +09:00
Eyejoker
e1b9501e87 feat: add completion_reason to paired_tasks (done/escalated/stopped/arbiter_escalated)
- owner can summon arbiter via BLOCKED/NEEDS_CONTEXT verdict
- completion_reason tracks why task ended: done (success), escalated
  (reviewer gave up), stopped (/stop), arbiter_escalated
2026-03-31 04:10:33 +09:00
Eyejoker
b02c509eb8 feat: owner can also summon arbiter via BLOCKED/NEEDS_CONTEXT verdict 2026-03-31 04:05:26 +09:00
Eyejoker
33cb7c6580 test: add logger debug mock for provider retry 2026-03-31 04:00:39 +09:00
Eyejoker
61c9b8c2e9 fix: reviewer auto-trigger now receives owner turn outputs instead of static prompt 2026-03-31 03:55:45 +09:00
Eyejoker
efb5710aad feat: Discord-independent inter-agent communication via paired_turn_outputs
- New paired_turn_outputs table stores agent output directly in DB
- Owner/reviewer prompts assembled from DB instead of Discord messages
- Arbiter context includes human messages + turn outputs
- Falls back to Discord messages for pre-migration tasks
- 50k char storage limit with truncation warning
2026-03-31 03:38:53 +09:00
Eyejoker
dddf18428e fix: /stop leaves stale paired task, sawOutput guard, progress text overwrite
- /stop now resets the active paired task to completed so the next
  user message routes to the owner instead of the stuck reviewer
- Owner completion with sawOutput=false (e.g. interrupted by /stop)
  no longer auto-triggers the reviewer — treated as interrupted
- Clear pendingProgressText when intermediate updates arrive on an
  existing progress message, preventing flushPendingProgress from
  overwriting latestProgressText with stale buffered content
2026-03-31 02:54:04 +09:00
Eyejoker
33575c84f1 fix: remove hardcoded server IP from README, simplify deploy command 2026-03-31 02:20:45 +09:00
Eyejoker
862881ac91 fix: show actual memory usage (exclude cache) + add build:container script
- Dashboard memory: use /proc/meminfo MemAvailable instead of os.freemem()
  to exclude Linux buffer/cache from reported usage
- Add build:container npm script for reviewer Docker image rebuild
- Update deploy commands in CLAUDE.md and README.md to include build:container
2026-03-31 02:17:44 +09:00
Eyejoker
0fb7ba6b57 chore: rename MAGI to Tribunal, add gstack prompt attribution 2026-03-31 01:54:22 +09:00
Eyejoker
e9f9340ece chore: update README for MAGI/MoA/Bun + show model names in MoA dashboard 2026-03-31 01:51:44 +09:00
Eyejoker
da27d30079 feat: MoA supports Anthropic Messages format (MOA_{NAME}_API_FORMAT=anthropic)
Kimi coding plan and GLM both use Anthropic-compatible API, not OpenAI.
queryModel now dispatches to /v1/messages or /chat/completions based on
apiFormat config per reference model.
2026-03-31 01:49:34 +09:00
Eyejoker
a89ab757b6 feat: restore Kimi usage dashboard (api.kimi.com/coding/v1/usages)
Recovered kimi-usage.ts from bot session logs — original was deleted
during March 27 fallback cleanup. Shows 5h/7d usage bars in dashboard
alongside Claude and Codex, using sk-kimi-* coding plan API key.
2026-03-31 01:46:19 +09:00
Eyejoker
68901e5da9 feat: global failover + dashboard model config section
- Failover is now global (account-level, not per-channel)
- Dashboard shows role model config (Owner/Reviewer/Arbiter + MoA refs)
- Dashboard shows failover status when active
- Auto-clear failover on successful Claude rotation
- Remove per-channel lease writes from failover path
2026-03-31 00:38:29 +09:00
Eyejoker
f98dd27712 refactor: MoA uses lightweight API references + SDK arbiter as aggregator
Instead of spawning separate processes or using OpenRouter, MoA now:
- Queries external API models (Kimi, GLM) in parallel for opinions
- Injects opinions into the SDK arbiter's prompt
- The existing subscription-based arbiter aggregates all perspectives

No extra SDK processes, no OpenRouter dependency. Per-model config via
MOA_REF_MODELS + MOA_{NAME}_MODEL/BASE_URL/API_KEY env vars.
2026-03-31 00:26:24 +09:00
Eyejoker
f4b04d6c4d feat: add Mixture of Agents (MoA) for arbiter verdicts
When MOA_ENABLED=true, arbiter queries multiple LLM models in parallel
via OpenAI-compatible API, then an aggregator model synthesizes the
final verdict from all opinions. Falls back to single-agent arbiter
when MoA is disabled.

Config: MOA_BASE_URL, MOA_API_KEY, MOA_REFERENCE_MODELS, MOA_AGGREGATOR_MODEL
2026-03-31 00:20:41 +09:00
Eyejoker
35ba7cb5ba chore: replace all node/npm/tsx references with bun across codebase
- Source: setup/service.ts, runners.ts, agent-runner.ts error messages
- Scripts: restart-stack.sh, run-migrations.ts → bun
- Bootstrap: setup.sh check_node→check_bun, npm install→bun install
- Docs: CLAUDE.md, README.md, all SKILL.md files
- Tests: service.test.ts, restart-stack.test.ts expectations updated
2026-03-31 00:10:23 +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
3e2954ebcf refactor: extract resolveEffectiveAgentType/resolveSessionFolder as SSOT, deduplicate CONTAINER_IMAGE 2026-03-30 23:44:49 +09:00
Eyejoker
e649432a40 feat: add per-role model selection via .env (OWNER/REVIEWER/ARBITER_MODEL, _EFFORT, _FALLBACK_ENABLED) 2026-03-30 23:40:36 +09:00
Eyejoker
4a5edaceb6 refactor: remove SERVICE_AGENT_TYPE legacy constant
SERVICE_AGENT_TYPE was always 'claude-code' in the unified service,
making it a misleading constant. Each group already has its own
agentType field.

- Removed SERVICE_AGENT_TYPE from config.ts
- Session functions now accept agentType parameter (default: 'claude-code')
- Task scheduler uses task-level agent_type for token rotation decisions
- All fallback defaults changed to 'claude-code' literal
- Logging uses 'unified' instead of the misleading type
2026-03-30 23:10:48 +09:00
Eyejoker
5562e30ce1 refactor: use resolveActiveRole() as SSOT for all status→role mapping
Eliminated duplicate task status checks in message-agent-executor.ts
and message-runtime.ts. All status→role decisions now flow through
the single resolveActiveRole() function.
2026-03-30 23:03:00 +09:00
Eyejoker
d3df67e08c chore: remove dead code (pairedCursorKey, unused ARBITER_AGENT_TYPE import) 2026-03-30 22:59:18 +09:00
Eyejoker
14d70f345a refactor: extract resolveActiveRole() as single source of status→role mapping
resolveCursorKey and resolveChannel both duplicated the same
taskStatus→role switch. Now resolveActiveRole() is the single
mapping, and both functions derive from it.
2026-03-30 22:58:00 +09:00
Eyejoker
a91776b067 refactor: centralize channel selection with resolveChannel()
Replace all manual channel selection (useReviewerChannel,
useArbiterChannel, isReviewerWorkItem, isArbiterWorkItem, 3-way
ternary chains) with a single resolveChannel(taskStatus) function
that maps task status to the correct Discord bot channel.
2026-03-30 22:56:40 +09:00