@enderfga/claw-orchestrator 4.7.0 → 4.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +5 -5
  2. package/configs/autoloop-coder-prompt.md +4 -4
  3. package/configs/autoloop-planner-prompt.md +10 -10
  4. package/configs/autoloop-reviewer-prompt.md +3 -4
  5. package/dist/src/autoloop/dispatcher.d.ts +59 -10
  6. package/dist/src/autoloop/dispatcher.js +261 -40
  7. package/dist/src/autoloop/dispatcher.js.map +1 -1
  8. package/dist/src/autoloop/planner-tools.d.ts +4 -3
  9. package/dist/src/autoloop/planner-tools.js +35 -2
  10. package/dist/src/autoloop/planner-tools.js.map +1 -1
  11. package/dist/src/autoloop/types.d.ts +2 -0
  12. package/dist/src/autoloop/types.js.map +1 -1
  13. package/dist/src/dashboard/index.html +185 -94
  14. package/dist/src/embedded-server.js +67 -9
  15. package/dist/src/embedded-server.js.map +1 -1
  16. package/dist/src/index.js +84 -52
  17. package/dist/src/index.js.map +1 -1
  18. package/dist/src/persistent-agy-session.js +4 -1
  19. package/dist/src/persistent-agy-session.js.map +1 -1
  20. package/dist/src/persistent-codex-session.js +3 -0
  21. package/dist/src/persistent-codex-session.js.map +1 -1
  22. package/dist/src/persistent-cursor-session.js +7 -2
  23. package/dist/src/persistent-cursor-session.js.map +1 -1
  24. package/dist/src/persistent-custom-session.js +13 -0
  25. package/dist/src/persistent-custom-session.js.map +1 -1
  26. package/dist/src/persistent-gemini-session.d.ts +4 -0
  27. package/dist/src/persistent-gemini-session.js +55 -2
  28. package/dist/src/persistent-gemini-session.js.map +1 -1
  29. package/dist/src/persistent-opencode-session.js +35 -1
  30. package/dist/src/persistent-opencode-session.js.map +1 -1
  31. package/dist/src/persistent-session.js +6 -1
  32. package/dist/src/persistent-session.js.map +1 -1
  33. package/dist/src/session-manager.d.ts +44 -5
  34. package/dist/src/session-manager.js +190 -18
  35. package/dist/src/session-manager.js.map +1 -1
  36. package/dist/src/types.d.ts +3 -2
  37. package/package.json +1 -1
  38. package/skills/SKILL.md +11 -10
  39. package/skills/references/autoloop.md +50 -6
  40. package/skills/references/claude-cli-tracking.md +2 -1
  41. package/skills/references/multi-engine.md +12 -9
  42. package/skills/references/tools.md +38 -19
@@ -28,7 +28,7 @@ SessionManager
28
28
 
29
29
  ### Claude Code (`engine: 'claude'`)
30
30
 
31
- Default engine. Long-running subprocess with streaming JSON I/O. Tested with Claude Code CLI **2.1.206**.
31
+ Default engine. Long-running subprocess with streaming JSON I/O. Tested with Claude Code CLI **2.1.207**.
32
32
 
33
33
  - Persistent multi-turn conversations
34
34
  - Real-time streaming (text, tool_use, tool_result, system events)
@@ -54,7 +54,7 @@ await manager.startSession({
54
54
 
55
55
  ### OpenAI Codex (`engine: 'codex'`)
56
56
 
57
- Wraps the `codex exec` subcommand. Each `send()` spawns a new process. Tested with `codex` CLI **0.143.0**.
57
+ Wraps the `codex exec` subcommand. Each `send()` spawns a new process. Tested with `codex` CLI **0.144.1**.
58
58
 
59
59
  - Non-interactive execution via `codex exec --sandbox workspace-write --json` (replaces the deprecated `--full-auto` flag from earlier Codex versions)
60
60
  - Real per-turn `usage` from the `turn.completed` JSON event (input, output, cached, reasoning tokens)
@@ -63,6 +63,7 @@ Wraps the `codex exec` subcommand. Each `send()` spawns a new process. Tested wi
63
63
  - `codexProfile` → `--profile <name>` (named config profile from `~/.codex/config.toml`)
64
64
  - Per-session continuity: the `thread_id` from the first turn's `thread.started` event is captured and reused via `codex exec resume <id>` for subsequent sends, so the model sees prior turns
65
65
  - One-shot execution per message (no persistent subprocess between sends)
66
+ - Captures the real Codex thread ID and persists it, so later sends and process-level session resume use `codex exec resume <thread_id>`
66
67
  - Working directory passed via `-C` flag
67
68
  - Default model: `gpt-5.5`
68
69
  - Requires `codex` CLI >= 0.119 (for `exec resume`): `npm install -g @openai/codex`
@@ -113,7 +114,7 @@ Wraps the `gemini` CLI with `--output-format stream-json`. Each `send()` spawns
113
114
  - One-shot execution per message (no persistent subprocess)
114
115
  - Working directory carries accumulated changes across sends
115
116
  - Real token counts from stream-json `result` events (not estimated)
116
- - Permission modes: `bypassPermissions` → `--yolo`, `default` → `--sandbox`
117
+ - Permission modes: `bypassPermissions` → `--yolo`, `default` → `--sandbox`; `sandboxMode: 'read-only'` → `--approval-mode plan` (takes precedence)
117
118
  - Always passes `--skip-trust` to bypass the "trusted folders" gate introduced
118
119
  in Gemini CLI 0.43 (otherwise headless runs in worktrees / arbitrary cwds
119
120
  abort before producing output)
@@ -132,7 +133,7 @@ await manager.startSession({
132
133
 
133
134
  Wraps Google's **Antigravity CLI** (`agy`) — the successor to Gemini CLI (consumer
134
135
  Gemini CLI tiers stopped serving 2026-06-18). Each `send()` spawns a new process
135
- in print mode. Verified against `agy` **1.0.16**.
136
+ in print mode. Verified against `agy` **1.1.1**.
136
137
 
137
138
  - One-shot execution per message (no persistent subprocess)
138
139
  - **Plain-text output** — agy has no structured/stream-json mode, so stdout is
@@ -143,9 +144,10 @@ in print mode. Verified against `agy` **1.0.16**.
143
144
  externally via `resumeSessionId` (bare UUID only); read it back from
144
145
  `getStats().agyConversationId`
145
146
  - Permission modes: `bypassPermissions` → `--dangerously-skip-permissions`,
146
- `default` → `--sandbox` (terminal-restricted). Other modes run agy's own
147
- approval flow, which blocks in headless print mode — use `bypassPermissions`
148
- for autonomous work
147
+ `default` → `--sandbox` (terminal-restricted), and
148
+ `sandboxMode: 'read-only'` → `--mode plan` (takes precedence). Other modes
149
+ run agy's own approval flow, which blocks in headless print mode — use
150
+ `bypassPermissions` for autonomous write-enabled work
149
151
  - agy enforces its own print timeout (default 5m); the engine derives
150
152
  `--print-timeout` from the send timeout so the wrapper timer decides
151
153
  - Unknown `--model` slugs do **not** error — agy silently falls back to its
@@ -169,12 +171,12 @@ await manager.startSession({
169
171
 
170
172
  ### Cursor Agent (`engine: 'cursor'`)
171
173
 
172
- Wraps the Cursor Agent CLI (`agent`) with `--print --force --output-format stream-json`. Each `send()` spawns a new process.
174
+ Wraps the Cursor Agent CLI (`agent`) with `--print --output-format stream-json`. Write-enabled sessions use `--force`; `sandboxMode: 'read-only'` uses `--mode plan`. Each `send()` spawns a new process.
173
175
 
174
176
  - One-shot execution per message (no persistent subprocess)
175
177
  - Working directory via `--workspace` flag
176
178
  - Real token counts from stream-json `result` events (camelCase: `inputTokens`, `outputTokens`, `cacheReadTokens`)
177
- - `--force` enables auto-approval of all file changes
179
+ - `--force` enables auto-approval of file changes; `sandboxMode: 'read-only'` replaces it with `--mode plan`
178
180
  - `--trust` auto-trusts the workspace without prompting
179
181
  - Cursor uses its own model routing (e.g., `sonnet-4`, `gpt-5`, `auto`)
180
182
  - Requires Cursor Agent CLI: `curl https://cursor.com/install -fsSL | bash`
@@ -200,6 +202,7 @@ Wraps the [sst/opencode](https://github.com/sst/opencode) CLI with `run --format
200
202
  - Real token counts from `step_finish.part.tokens.{input,output,cache.read}`
201
203
  - The wrapper closes the subprocess's stdin immediately after spawn (opencode otherwise reads stdin and blocks on EOF, hanging the call)
202
204
  - Provider-agnostic: opencode's `--model` expects `provider/model` form (e.g. `anthropic/claude-sonnet-4`). The wrapper passes `--model` through only when the value contains a `/`; otherwise opencode's own default applies
205
+ - `sandboxMode: 'read-only'` selects OpenCode's built-in `plan` agent via `--agent plan`
203
206
  - Requires opencode installed: `brew install sst/tap/opencode` or `npm install -g opencode-ai`. Auth via `opencode auth login` **or** any provider env var (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY`, etc.) — opencode picks up either path
204
207
  - Binary: `opencode` (set `OPENCODE_BIN` env var to override)
205
208
 
@@ -15,6 +15,7 @@ Start a persistent coding session with full CLI flag support.
15
15
  | `engine` | `'claude'` \| `'codex'` \| `'codex-app'` \| `'gemini'` \| `'agy'` \| `'cursor'` \| `'opencode'` \| `'custom'` | Engine to use (default: `claude`). `agy` wraps Google Antigravity CLI. `opencode` wraps sst/opencode (pass model as `provider/model`). Use `custom` with `customEngine` for any CLI. |
16
16
  | `model` | string | Model alias or full name |
17
17
  | `permissionMode` | string | `acceptEdits`, `bypassPermissions`, `plan`, `auto`, `manual`, `dontAsk` (`default` = legacy alias for `manual`) |
18
+ | `sandboxMode` | `'read-only'` \| `'workspace-write'` \| `'danger-full-access'` | Sandbox policy. Codex supports all values. `read-only` is enforced on every other built-in engine too: Claude → plan mode; Gemini → `--approval-mode plan` + an admin policy denying `exit_plan_mode`; OpenCode → a generated `clawo-readonly` agent denying `edit`/`bash`; Antigravity/Cursor → plan mode. A `custom` engine must map it via `permissionModes`, or the session refuses to start. Persisted across session resume. |
18
19
  | `effort` | string | `low`, `medium`, `high`, `max`, `auto` |
19
20
  | `allowedTools` | string[] | Tools to auto-approve |
20
21
  | `disallowedTools` | string[] | Tools to deny |
@@ -537,57 +538,75 @@ Three-agent autonomous iteration loop (Planner / Coder / Reviewer) over a git wo
537
538
 
538
539
  ### `autoloop_start`
539
540
 
540
- Start an autoloop run. Planner is created persistent; Coder + Reviewer are spawned by the Planner once `plan.md` is ready.
541
+ Start a chat-mode autoloop. Planner starts immediately; Coder + Reviewer start only after the Planner receives plan approval and emits `spawn_subagents`.
541
542
 
542
543
  | Parameter | Type | Required | Description |
543
544
  |-----------|------|----------|-------------|
544
- | `cwd` | string | yes | Workspace (must be a git repo) |
545
- | `goal` | string | yes | High-level user goal in natural language |
546
- | `model` | string | | Planner model (default Opus) |
547
- | `coderModel` | string | | Coder subagent model |
548
- | `reviewerModel` | string | | Reviewer subagent model |
549
- | `maxIters` | number | | Cap on Coder/Reviewer rounds (default 50) |
550
- | `pushChannels` | string[] | | Notification channels (`wechat`, `whatsapp`, `email`) |
545
+ | `run_id` | string | yes | Stable run identifier |
546
+ | `workspace` | string | yes | Git workspace path |
547
+ | `planner_engine` | EngineType | | Planner engine (default `claude`) |
548
+ | `planner_model` | string | | Planner model (Claude default `opus`; other engines use their own default when omitted) |
549
+ | `planner_custom_engine` | object | | Trusted `CustomEngineConfig` when Planner engine is `custom`. **Local callers only** — see below |
550
+ | `coder_engine` | EngineType | | Default Coder engine (default `claude`) |
551
+ | `coder_model` | string | | Default Coder model (Claude default `sonnet`) |
552
+ | `coder_custom_engine` | object | | Trusted config when Coder may use `custom`. **Local callers only** |
553
+ | `reviewer_engine` | EngineType | | Default Reviewer engine (default `claude`) |
554
+ | `reviewer_model` | string | | Default Reviewer model (Claude default `sonnet`) |
555
+ | `reviewer_custom_engine` | object | | Trusted config when Reviewer may use `custom`. **Local callers only** |
556
+ | `send_timeout_ms` | number | | Per-message timeout (default 600000) |
557
+
558
+ > **Custom engines are local-only.** A `CustomEngineConfig` names an executable to
559
+ > spawn plus its argv and env, so it may only be supplied by a caller that already
560
+ > runs on the host (this MCP tool, or the `SessionManager` API). The HTTP API
561
+ > (`POST /autoloop/new`, `POST /autoloop/<id>/resume`) rejects a `*_custom_engine`
562
+ > body field with a 400 — the embedded server is often reverse-tunnelled and its
563
+ > token is a monitoring credential, not permission to choose what binary runs.
564
+ > Built-in engines are fully selectable over HTTP.
565
+
566
+ Custom configs are not persisted or accepted from Planner output. See [`multi-engine.md`](./multi-engine.md) for their shape.
551
567
 
552
568
  ### `autoloop_chat`
553
569
 
554
- Send a message into the Planner conversation (e.g. answer a clarifying question, refine the plan, kick off the subloop).
570
+ Send a message into the Planner conversation.
555
571
 
556
572
  | Parameter | Type | Required |
557
573
  |-----------|------|----------|
558
- | `id` | string | yes |
559
- | `message` | string | yes |
574
+ | `run_id` | string | yes |
575
+ | `text` | string | yes |
560
576
 
561
577
  ### `autoloop_status`
562
578
 
563
- Get current state, phase, recent inbox messages, and ledger summary.
579
+ Get the current state and push log.
564
580
 
565
581
  | Parameter | Type | Required |
566
582
  |-----------|------|----------|
567
- | `id` | string | yes |
583
+ | `run_id` | string | yes |
568
584
 
569
585
  ### `autoloop_list`
570
586
 
571
- List active and recent autoloop runs (in-memory + on-disk registry, deduped by run_id).
587
+ List active Autoloop runs in this manager process.
572
588
 
573
589
  (no params)
574
590
 
575
591
  ### `autoloop_reset_agent`
576
592
 
577
- Reset one of the subagent sessions (Coder or Reviewer) without losing Planner state — useful when a subagent loops on a stale belief.
593
+ Reset one role session while retaining the role's current engine/model selection.
578
594
 
579
595
  | Parameter | Type | Required | Description |
580
596
  |-----------|------|----------|-------------|
581
- | `id` | string | yes | Run id |
582
- | `agent` | `'coder'` \| `'reviewer'` | yes | Which subagent to reset |
597
+ | `run_id` | string | yes | Run id |
598
+ | `agent` | `'planner'` \| `'coder'` \| `'reviewer'` | yes | Role to reset; Planner requires `force: true` |
599
+ | `force` | boolean | | Allow Planner reset |
600
+ | `eager_restart` | boolean | | Start the replacement session immediately |
583
601
 
584
602
  ### `autoloop_stop`
585
603
 
586
- Terminate the run. All sessions are stopped and ledger state is finalised.
604
+ Terminate the run and stop all role sessions.
587
605
 
588
606
  | Parameter | Type | Required |
589
607
  |-----------|------|----------|
590
- | `id` | string | yes |
608
+ | `run_id` | string | yes |
609
+ | `reason` | string | |
591
610
 
592
611
  ---
593
612