@mutmutco/opencode-mmi 2.55.0 → 2.57.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.
@@ -0,0 +1,62 @@
1
+ # Native Fugu API Engine
2
+
3
+ Overlord servants run through the Sakana Fugu API using the OpenAI-compatible chat-completions surface.
4
+
5
+ Defaults:
6
+
7
+ - Base URL: `https://api.sakana.ai/v1`
8
+ - Normal model: `fugu`
9
+ - Ultra model: `fugu-ultra`
10
+ - API key: `SAKANA_API_KEY`, or `MMI_OVERLORD_LLM_API_KEY`
11
+ - Request timeout: `MMI_OVERLORD_LLM_TIMEOUT_MS`, clamped between 5 seconds and 10 minutes, defaulting to 90 seconds
12
+
13
+ Optional overrides:
14
+
15
+ - `MMI_OVERLORD_LLM_BASE_URL`
16
+ - `MMI_OVERLORD_LLM_MODEL`
17
+ - `MMI_OVERLORD_LLM_ULTRA_MODEL`
18
+
19
+ ## Preflight
20
+
21
+ Before launching servants, probe `GET /models` with the configured key and base URL.
22
+
23
+ Startup is blocked unless the probe proves both configured models are available.
24
+
25
+ Do not print the API key.
26
+
27
+ ## Conversation State
28
+
29
+ Each servant owns one stored conversation:
30
+
31
+ - one system message with the servant identity and Overlord constraints
32
+ - the startup assignment as a user message
33
+ - every captured assistant response
34
+ - future redirects appended as user messages
35
+
36
+ The run registry records the model, request id when available, and conversation length.
37
+
38
+ ## Redirects
39
+
40
+ `mmi-cli overlord send <target> <message>` calls `/chat/completions` for the target servant or each servant in `all`.
41
+
42
+ The command returns only after the API response is captured or a bounded failure is recorded.
43
+
44
+ If a request times out, errors, or returns no assistant text:
45
+
46
+ - mark the servant `blocked`
47
+ - mark the message `failed`
48
+ - write the failure to the ledger
49
+
50
+ ## Ledger
51
+
52
+ Append one ledger event for startup and one per redirect response.
53
+
54
+ Include only operational metadata:
55
+
56
+ - servant slot id
57
+ - model
58
+ - request id
59
+ - response text
60
+ - error text
61
+
62
+ Never include API keys or provider secrets.
@@ -4,9 +4,9 @@ An ACK creates a lease, not permanent proof.
4
4
 
5
5
  Readiness requires:
6
6
 
7
- - Current readable handle.
8
- - Current writable handle.
9
- - Proven submit mode.
7
+ - Current Fugu API conversation state.
8
+ - Configured model for the servant role.
9
+ - Stored system/user/assistant messages.
10
10
  - Matching run id and run token.
11
11
  - Recent useful signal or bounded liveness response.
12
12
 
@@ -15,13 +15,13 @@ Stale ACK-only readiness is forbidden.
15
15
  Awaiting-human:
16
16
 
17
17
  - Servants remain leased.
18
- - Controller heartbeat stays active.
18
+ - Run registry remains current.
19
19
  - Status rehydrates state and checks liveness.
20
- - If background liveness is unsupported, mark `suspended-awaiting-human` and require a rehydrate pass before work resumes.
20
+ - If background liveness is unsupported, preserve conversation state and require a rehydrate pass before work resumes.
21
21
 
22
- Lost servant:
22
+ Blocked servant:
23
23
 
24
- - Mark the slot lost/unresponsive.
25
- - Preserve bounded journal.
26
- - Attempt recovery only when handles can be proven.
24
+ - Mark the slot `blocked`.
25
+ - Preserve bounded journal and conversation state.
26
+ - Attempt recovery only when the API key, model, and conversation can be proven.
27
27
  - Otherwise spawn a replacement in the same role slot with a compact handoff.
@@ -10,7 +10,8 @@ Detect:
10
10
 
11
11
  Rules:
12
12
 
13
- - PowerShell/pwsh: use PowerShell syntax and native Windows paths.
13
+ - Windows `pwsh`: use modern PowerShell syntax and native Windows paths.
14
+ - Legacy Windows PowerShell (`powershell.exe`) is not an acceptable host shell for Overlord; use `pwsh`.
14
15
  - cmd: use cmd syntax and native Windows paths.
15
16
  - Windows Git Bash: distinguish shell paths from native Windows consumer-process paths.
16
17
  - macOS zsh/bash: use POSIX syntax and macOS paths.
@@ -6,22 +6,15 @@ Minimum fields:
6
6
 
7
7
  - `runId`
8
8
  - `runToken`
9
- - `repo`
10
9
  - `worktree`
11
- - `branch`
12
- - `human`
13
- - `surface`
14
- - `hostPlatform`
15
- - `shellAdapter`
10
+ - `engine`
11
+ - `provider`
16
12
  - `state`
17
13
  - `createdAt`
18
14
  - `updatedAt`
19
- - `controllerPid`
20
- - `controllerFingerprint`
21
- - `lastControllerHeartbeatAt`
22
15
  - `statePath`
23
16
  - `journalDir`
24
- - `todoSnapshot`
17
+ - `ledgerPath`
25
18
  - `servants[]`
26
19
  - `messages[]`
27
20
  - `ownedResources[]`
@@ -33,15 +26,17 @@ Servant fields:
33
26
  - `role`
34
27
  - `model`
35
28
  - `profile`
36
- - `state`
37
- - `pid`
38
- - `runToken`
39
- - `fingerprint`
29
+ - `state` (includes `blocked` when an API request fails or returns no assistant text)
40
30
  - `composerSubmitMode`
31
+ - `llmModel`
32
+ - `llmRequestId`
33
+ - `llmMessages`
41
34
  - `lastAckAt`
42
35
  - `lastLivenessCheckAt`
43
36
  - `lastUsefulSignalAt`
44
37
  - `journalPath`
38
+ - `eventJournalPath`
39
+ - `scopeToken` (optional non-secret attribution token bound to run id, servant slot, profile, and assignment scope)
45
40
  - `assignment`
46
41
  - `handoff`
47
42
 
@@ -51,7 +46,14 @@ Message fields:
51
46
  - `target`
52
47
  - `text`
53
48
  - `createdAt`
54
- - `deliveredAt`
49
+ - `state` (`queued` | `started` | `completed` | `partial` | `failed`)
50
+ - `queuedAt`
51
+ - `startedAt`
52
+ - `completedAt`
53
+ - `failedAt`
54
+ - `responseText`
55
+ - `failureReason`
56
+ - `servantResults[]`
55
57
 
56
58
  Owned resource fields:
57
59
 
@@ -1,44 +1,47 @@
1
- # Terminal Leash
1
+ # Session Leash
2
2
 
3
- The Overlord must own every servant terminal through a durable controller, PTY leash, and registry.
3
+ The Overlord must own every servant conversation through a durable registry, model metadata, request ids when available, and a bounded message lifecycle.
4
+
5
+ The native Fugu API is the supported Overlord engine.
4
6
 
5
7
  Startup phases shown to humans:
6
8
 
7
- - Loading controller and PTYs.
8
- - Checking Fugu setup.
9
+ - Loading the run registry.
10
+ - Checking the Fugu API key and base URL.
11
+ - Checking `/models` for `fugu` and `fugu-ultra`.
9
12
  - Starting one Ultra and normal Fugus.
13
+ - Recording model, request, and conversation state.
10
14
  - Loading servant instructions.
11
- - Waiting for ACKs.
15
+ - Waiting for API-backed ACKs.
12
16
  - Ready.
13
17
 
14
- Do not show raw `TERM=dumb`, ANSI redraws, title-setting failures, or TUI noise unless startup fails or debug output is requested.
15
-
16
- Approval profiles:
18
+ Do not show raw provider response bodies, stack traces, or retry noise unless startup fails or debug output is requested.
17
19
 
18
- - Consultation: `codex-fugu --no-alt-screen -a never -s read-only -c 'sandbox_permissions=["disk-full-read-access"]'`
19
- - Implementation: `codex-fugu --no-alt-screen -a never -s workspace-write -c 'sandbox_permissions=["disk-full-read-access"]' -C <owned-worktree>`
20
- - Full-trust repair: only with explicit human approval and narrow blast radius.
20
+ Servant access model:
21
21
 
22
- `-a never` is required for servant launches. If routine consultation or bounded implementation asks the human for command approval, the profile is wrong; stop launch, report setup guidance, and do not hand-wave the prompt away.
22
+ - Servants are API conversations, not shell sessions.
23
+ - Servants do not receive direct tools, stage/dev servers, browsers, Playwright, PR rights, or release rights.
24
+ - The Overlord performs tool use, checks, edits, and PR operations in the host session after judging servant advice.
25
+ - Full-trust repair is never delegated to servants.
23
26
 
24
27
  Before launch:
25
28
 
26
- - Verify local help/status exposes approval, sandbox, config override, no-alt-screen, and cwd flags.
27
- - Accept either an API-key environment variable or local Codex auth evidence; guide setup when neither exists.
28
- - Verify the Fugu model catalog exposes `fugu-ultra`.
29
+ - Verify `SAKANA_API_KEY` or `MMI_OVERLORD_LLM_API_KEY` is available.
30
+ - Verify the configured base URL, defaulting to `https://api.sakana.ai/v1`.
31
+ - Verify `GET /models` exposes `fugu` and `fugu-ultra`, or the configured model overrides.
29
32
  - Fail closed when semantics are missing or unknown.
30
33
 
31
- Submit probe:
34
+ Conversation probe:
32
35
 
33
- - Prefer initial-prompt launch through the PTY leash.
34
- - Require the servant to emit `ACK <name> ready`.
35
- - Record `composerSubmitMode` and `lastAckAt`.
36
- - Fail startup if no mode is proven.
36
+ - Prefer initial-prompt launch through `/chat/completions`.
37
+ - Require the servant to emit useful assistant text for its startup assignment.
38
+ - Record `llmModel`, `llmRequestId` when available, `llmMessages`, `lastEventAt`, `lastAckAt`, and `composerSubmitMode=surface-api`.
39
+ - Fail startup if no assistant text is captured.
37
40
 
38
- Redirects after startup use `mmi-cli overlord send <target> <message>`; the controller drains the durable mailbox into live servant PTYs. Do not bypass the mailbox with ad-hoc keystrokes unless diagnosing the leash itself.
41
+ Redirects after startup use `mmi-cli overlord send <target> <message>`; the CLI appends to the servant conversation and records completion or bounded failure. Do not bypass the mailbox with ad-hoc provider calls unless diagnosing the leash itself.
39
42
 
40
43
  Stop safety:
41
44
 
42
45
  - Stop only recorded resources with matching run id, run token, and fingerprint.
43
- - Refuse generic `WindowsTerminal`, `pwsh`, `powershell`, `opencode`, `codex`, and `codex-fugu` names without exact ownership.
46
+ - Refuse generic process, shell, terminal, or provider names without exact ownership.
44
47
  - Refuse window-title-only ownership.
@@ -182,24 +182,20 @@ Rejected → stop (nothing released).
182
182
 
183
183
  ## Step 4 — GitHub Release + start prod deploy (non-blocking)
184
184
 
185
- For `tenant-container` repos, publish the GitHub Release, dispatch the central tenant deploy, and dispatch
186
- the release-scoped wiki refresh (release events never leave the releasing repo, so the keeper must be
187
- dispatched centrally — #759):
185
+ For `tenant-container` repos, publish the GitHub Release and dispatch the central tenant deploy. Repo-owned
186
+ wiki publication is a separate explicit step only when the release task asks for it or the user authorizes it.
188
187
  ```bash
189
188
  gh release create "vX.Y.0" --target main --generate-notes --latest
190
189
  gh workflow run tenant-deploy.yml --repo mutmutco/MMI-Hub \
191
190
  -f slug={slug} -f repo={owner}/{repo} -f ref=main -f stage=main
192
- gh workflow run cursor-agents.yml --repo mutmutco/MMI-Hub \
193
- -f agent=wiki-keeper -f only_repo={owner}/{repo} # wiki-keeper, scoped to the released repo
194
191
  gh run watch "$(gh run list --workflow tenant-deploy.yml --limit 1 --json databaseId -q '.[0].databaseId')" \
195
192
  --exit-status # the central prod-deploy run — run this in the BACKGROUND (Bash run_in_background)
196
193
  ```
197
194
 
198
195
  For `hub-serverless` (MMI-Hub), publish the GitHub Release but do **not** dispatch `tenant-deploy.yml` or
199
- `cursor-agents.yml`: the release event auto-fires `deploy.yml` for prod, `publish.yml` for the plugin/CLI
200
- package, and `cursor-agents.yml` for the Hub-scoped wiki refresh. A missing `DEPLOY#main` registry row for
201
- MMI-Hub is expected, not a tenant stack repair task. Watch/report the release-triggered `deploy.yml` and
202
- `publish.yml` runs instead.
196
+ repo wiki publication: the release event auto-fires `deploy.yml` for prod and `publish.yml` for the
197
+ plugin/CLI package. A missing `DEPLOY#main` registry row for MMI-Hub is expected, not a tenant stack repair
198
+ task. Watch/report the release-triggered `deploy.yml` and `publish.yml` runs instead.
203
199
 
204
200
  For other direct-track repos, the train dispatches nothing centrally: a `registry-publish` repo's release
205
201
  event fires its own `publish.yml` (npm / plugin marketplace); a `solo-container` repo deploys via its own
@@ -62,7 +62,7 @@ All stage artifacts (build output, screenshots, Playwright traces, local DB file
62
62
  — never tracked.
63
63
 
64
64
  A local stage is bound to the worktree that started it. Concurrent worktrees on one machine each keep
65
- their own stage on separate ports — you do not need to stop one before starting another. Saga continuity
65
+ their own stage on separate ports — you do not need to stop one before starting another. For `jervaise`, saga continuity
66
66
  keys on branch; use a distinct North Star slug per parallel grind or feature. Stage JSON/state records
67
67
  the starting `cwd` plus git branch/commit when available.
68
68
 
@@ -1,25 +0,0 @@
1
- # Codex/Fugu Preflight
2
-
3
- Before servant launch:
4
-
5
- - Detect `codex`.
6
- - Detect `codex-fugu`.
7
- - Check `codex --version`.
8
- - Check `codex-fugu --status`.
9
- - Detect stale deployed target after Codex update.
10
- - Detect missing API key by name only, unless local Codex auth evidence exists; never print values.
11
- - Detect missing `fugu-ultra`.
12
- - Detect native Windows Codex receiving Git Bash `/c/Users/...` paths.
13
- - Verify `--model fugu-ultra` launches the Ultra route.
14
-
15
- If Fugu is missing, stale, or misconfigured:
16
-
17
- - Print human-readable setup/update steps.
18
- - Preserve repair backup paths.
19
- - Do not launch partial servants.
20
- - Treat PowerShell-discoverable `.ps1`/`.cmd` wrappers as valid on Windows; Node subprocess probes may need the shell adapter to resolve them.
21
-
22
- Terminal compatibility warnings:
23
-
24
- - Treat `TERM=dumb` as a compatibility warning, not proof of Fugu failure.
25
- - Translate internal warnings into human-facing startup phases.