Skip to content

The one and only agent harness for complex codebases. Project memory, planning, execution, and verified completion inside Codex.

chore: sync Codex marketplace v5.1.63

YeonGyu-Kim97e7e2fd963e
diff --git a/plugins/omo/.codex-plugin/plugin.json b/plugins/omo/.codex-plugin/plugin.json
index 5f3f3141..ce78ac6f 100644
--- a/plugins/omo/.codex-plugin/plugin.json
+++ b/plugins/omo/.codex-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "omo",
- "version": "5.1.62",
+ "version": "5.1.63",
"description": "One Codex plugin namespace for Yeongyu's local Codex components.",
"author": {
"name": "Yeongyu Kim",
diff --git a/plugins/omo/components/bootstrap/hooks/hooks.json b/plugins/omo/components/bootstrap/hooks/hooks.json
index f759d755..69fa99c2 100644
--- a/plugins/omo/components/bootstrap/hooks/hooks.json
+++ b/plugins/omo/components/bootstrap/hooks/hooks.json
@@ -8,7 +8,7 @@
"command": "node \"${PLUGIN_ROOT}/components/bootstrap/dist/cli.js\" hook session-start",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\bootstrap.ps1\"",
"timeout": 30,
- "statusMessage": "(OmO 5.1.62) Checking Bootstrap Provisioning"
+ "statusMessage": "(OmO 5.1.63) Checking Bootstrap Provisioning"
}
]
}
diff --git a/plugins/omo/components/bootstrap/package.json b/plugins/omo/components/bootstrap/package.json
index 02aed95c..378a43d9 100644
--- a/plugins/omo/components/bootstrap/package.json
+++ b/plugins/omo/components/bootstrap/package.json
@@ -1,6 +1,6 @@
{
"name": "@sisyphuslabs/codex-bootstrap",
- "version": "5.1.62",
+ "version": "5.1.63",
"description": "Codex SessionStart bootstrap component that provisions LazyCodex runtime dependencies from a detached worker.",
"type": "module",
"private": true,
diff --git a/plugins/omo/components/comment-checker/hooks/hooks.json b/plugins/omo/components/comment-checker/hooks/hooks.json
index 61aaf0a1..277916f4 100644
--- a/plugins/omo/components/comment-checker/hooks/hooks.json
+++ b/plugins/omo/components/comment-checker/hooks/hooks.json
@@ -8,7 +8,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-tool-use",
"timeout": 30,
- "statusMessage": "(OmO 5.1.62) Checking Comments"
+ "statusMessage": "(OmO 5.1.63) Checking Comments"
}
]
}
diff --git a/plugins/omo/components/comment-checker/package.json b/plugins/omo/components/comment-checker/package.json
index 748f5822..9c81c14e 100644
--- a/plugins/omo/components/comment-checker/package.json
+++ b/plugins/omo/components/comment-checker/package.json
@@ -1,6 +1,6 @@
{
"name": "@code-yeongyu/codex-comment-checker",
- "version": "5.1.62",
+ "version": "5.1.63",
"description": "Codex plugin that runs comment-checker after edit-like PostToolUse hooks.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/components/git-bash/hooks/hooks.json b/plugins/omo/components/git-bash/hooks/hooks.json
index 6bd04f89..ed1f5371 100644
--- a/plugins/omo/components/git-bash/hooks/hooks.json
+++ b/plugins/omo/components/git-bash/hooks/hooks.json
@@ -8,7 +8,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook pre-tool-use",
"timeout": 5,
- "statusMessage": "(OmO 5.1.62) Recommending Git Bash MCP"
+ "statusMessage": "(OmO 5.1.63) Recommending Git Bash MCP"
}
]
}
@@ -20,7 +20,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-compact",
"timeout": 5,
- "statusMessage": "(OmO 5.1.62) Resetting Git Bash MCP Reminder"
+ "statusMessage": "(OmO 5.1.63) Resetting Git Bash MCP Reminder"
}
]
}
diff --git a/plugins/omo/components/git-bash/package.json b/plugins/omo/components/git-bash/package.json
index df02c2d5..ec6cfa91 100644
--- a/plugins/omo/components/git-bash/package.json
+++ b/plugins/omo/components/git-bash/package.json
@@ -1,6 +1,6 @@
{
"name": "@sisyphuslabs/codex-git-bash-hook",
- "version": "5.1.62",
+ "version": "5.1.63",
"description": "Codex hook component that reminds Windows sessions to prefer the OMO git_bash MCP.",
"type": "module",
"private": true,
diff --git a/plugins/omo/components/lazycodex-executor-verify/hooks/hooks.json b/plugins/omo/components/lazycodex-executor-verify/hooks/hooks.json
index 475da235..3c6e0c40 100644
--- a/plugins/omo/components/lazycodex-executor-verify/hooks/hooks.json
+++ b/plugins/omo/components/lazycodex-executor-verify/hooks/hooks.json
@@ -8,7 +8,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/lazycodex-executor-verify/dist/cli.js\" hook subagent-stop",
"timeout": 10,
- "statusMessage": "(OmO 5.1.62) Verifying LazyCodex Executor Evidence"
+ "statusMessage": "(OmO 5.1.63) Verifying LazyCodex Executor Evidence"
}
]
}
diff --git a/plugins/omo/components/lazycodex-executor-verify/package.json b/plugins/omo/components/lazycodex-executor-verify/package.json
index ef5af187..a22254ed 100644
--- a/plugins/omo/components/lazycodex-executor-verify/package.json
+++ b/plugins/omo/components/lazycodex-executor-verify/package.json
@@ -1,6 +1,6 @@
{
"name": "@code-yeongyu/codex-lazycodex-executor-verify",
- "version": "5.1.62",
+ "version": "5.1.63",
"description": "Codex SubagentStop evidence verifier for LazyCodex executor completions.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/components/lsp/dist/.omo-runtime-manifest.json b/plugins/omo/components/lsp/dist/.omo-runtime-manifest.json
index e945f297..25a74e41 100644
--- a/plugins/omo/components/lsp/dist/.omo-runtime-manifest.json
+++ b/plugins/omo/components/lsp/dist/.omo-runtime-manifest.json
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
- "version": "5.1.62",
- "inputDigest": "sha256:02c829fe463bfc768c81c04b28cf3d1ecb00b9d4b833753b6dc94c9a65b6f052",
+ "version": "5.1.63",
+ "inputDigest": "sha256:2426647e36c3da7b8017683cd4a2e73f19a59e541af55ff10234fb37409c187a",
"outputs": [
{
"path": "cli.d.ts",
diff --git a/plugins/omo/components/lsp/hooks/hooks.json b/plugins/omo/components/lsp/hooks/hooks.json
index 8ce0f8f4..8249f7fe 100644
--- a/plugins/omo/components/lsp/hooks/hooks.json
+++ b/plugins/omo/components/lsp/hooks/hooks.json
@@ -8,7 +8,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-tool-use",
"timeout": 60,
- "statusMessage": "(OmO 5.1.62) Checking LSP Diagnostics"
+ "statusMessage": "(OmO 5.1.63) Checking LSP Diagnostics"
}
]
}
@@ -21,7 +21,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-compact",
"timeout": 5,
- "statusMessage": "(OmO 5.1.62) Resetting LSP Diagnostics Cache"
+ "statusMessage": "(OmO 5.1.63) Resetting LSP Diagnostics Cache"
}
]
}
diff --git a/plugins/omo/components/lsp/package.json b/plugins/omo/components/lsp/package.json
index f9961f79..ccb8e6bd 100644
--- a/plugins/omo/components/lsp/package.json
+++ b/plugins/omo/components/lsp/package.json
@@ -1,6 +1,6 @@
{
"name": "@code-yeongyu/codex-lsp",
- "version": "5.1.62",
+ "version": "5.1.63",
"description": "Codex plugin that exposes Language Server Protocol tools and post-edit diagnostics.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/components/rules/hooks/hooks.json b/plugins/omo/components/rules/hooks/hooks.json
index 364bb869..b0d87f97 100644
--- a/plugins/omo/components/rules/hooks/hooks.json
+++ b/plugins/omo/components/rules/hooks/hooks.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook session-start",
"timeout": 10,
- "statusMessage": "(OmO 5.1.62) Loading Project Rules"
+ "statusMessage": "(OmO 5.1.63) Loading Project Rules"
}
]
}
@@ -19,7 +19,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook user-prompt-submit",
"timeout": 10,
- "statusMessage": "(OmO 5.1.62) Loading Project Rules"
+ "statusMessage": "(OmO 5.1.63) Loading Project Rules"
}
]
}
@@ -32,7 +32,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-tool-use",
"timeout": 10,
- "statusMessage": "(OmO 5.1.62) Matching Project Rules"
+ "statusMessage": "(OmO 5.1.63) Matching Project Rules"
}
]
}
@@ -45,7 +45,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-compact",
"timeout": 10,
- "statusMessage": "(OmO 5.1.62) Resetting Project Rule Cache"
+ "statusMessage": "(OmO 5.1.63) Resetting Project Rule Cache"
}
]
}
diff --git a/plugins/omo/components/rules/package.json b/plugins/omo/components/rules/package.json
index 7bcab014..68b9cb5b 100644
--- a/plugins/omo/components/rules/package.json
+++ b/plugins/omo/components/rules/package.json
@@ -1,6 +1,6 @@
{
"name": "@code-yeongyu/codex-rules",
- "version": "5.1.62",
+ "version": "5.1.63",
"description": "Codex plugin that injects project rule files into model context through lifecycle hooks.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/components/teammode/hooks/hooks.json b/plugins/omo/components/teammode/hooks/hooks.json
index b9642330..0a3ae8d4 100644
--- a/plugins/omo/components/teammode/hooks/hooks.json
+++ b/plugins/omo/components/teammode/hooks/hooks.json
@@ -8,7 +8,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-tool-use",
"timeout": 10,
- "statusMessage": "(OmO 5.1.62) Checking Thread Title Hygiene"
+ "statusMessage": "(OmO 5.1.63) Checking Thread Title Hygiene"
}
]
}
diff --git a/plugins/omo/components/teammode/package.json b/plugins/omo/components/teammode/package.json
index d77f828e..9495f1ba 100644
--- a/plugins/omo/components/teammode/package.json
+++ b/plugins/omo/components/teammode/package.json
@@ -1,6 +1,6 @@
{
"name": "@sisyphuslabs/codex-teammode",
- "version": "5.1.62",
+ "version": "5.1.63",
"description": "Codex team-mode hook component that keeps background thread titles descriptive after create_thread.",
"type": "module",
"private": true,
diff --git a/plugins/omo/components/telemetry/hooks/hooks.json b/plugins/omo/components/telemetry/hooks/hooks.json
index 6bff8d39..3f66f172 100644
--- a/plugins/omo/components/telemetry/hooks/hooks.json
+++ b/plugins/omo/components/telemetry/hooks/hooks.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook session-start",
"timeout": 5,
- "statusMessage": "(OmO 5.1.62) Recording Session Telemetry"
+ "statusMessage": "(OmO 5.1.63) Recording Session Telemetry"
}
]
}
diff --git a/plugins/omo/components/telemetry/package.json b/plugins/omo/components/telemetry/package.json
index be752f3c..8c0ac333 100644
--- a/plugins/omo/components/telemetry/package.json
+++ b/plugins/omo/components/telemetry/package.json
@@ -1,6 +1,6 @@
{
"name": "@code-yeongyu/codex-telemetry",
- "version": "5.1.62",
+ "version": "5.1.63",
"description": "Codex plugin component that emits omo-codex anonymous daily-active telemetry on SessionStart.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/components/ultrawork/dist/cli.js b/plugins/omo/components/ultrawork/dist/cli.js
index 16e005c4..3c54880c 100755
--- a/plugins/omo/components/ultrawork/dist/cli.js
+++ b/plugins/omo/components/ultrawork/dist/cli.js
@@ -125,6 +125,8 @@ Before the first task command, create one \`RUN_TMP=$(mktemp -d)\` per task, tra
At task end, after owned processes exit, remove only owned directories, including runtime caches. Never wipe shared caches; retain worktrees still needed by open PRs and any parent directory containing them.
## 0. Survey the skills, gather context, then size the work
+This section records into the notepad, so run section 2's \`NOTE=\`
+command first; section 2 then initialises that same file.
First, survey the loaded skill list and read the description of each
loosely relevant skill. Decide explicitly which skills this task will
use and prefer using every genuinely applicable one — name them in the
diff --git a/plugins/omo/components/ultrawork/hooks/hooks.json b/plugins/omo/components/ultrawork/hooks/hooks.json
index e0ad077f..ce9d39da 100644
--- a/plugins/omo/components/ultrawork/hooks/hooks.json
+++ b/plugins/omo/components/ultrawork/hooks/hooks.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook user-prompt-submit",
"timeout": 5,
- "statusMessage": "(OmO 5.1.62) Checking Ultrawork Trigger"
+ "statusMessage": "(OmO 5.1.63) Checking Ultrawork Trigger"
}
]
}
diff --git a/plugins/omo/components/ultrawork/package.json b/plugins/omo/components/ultrawork/package.json
index fd75c42a..b39d9acb 100644
--- a/plugins/omo/components/ultrawork/package.json
+++ b/plugins/omo/components/ultrawork/package.json
@@ -1,6 +1,6 @@
{
"name": "@code-yeongyu/codex-ultrawork",
- "version": "5.1.62",
+ "version": "5.1.63",
"description": "Codex plugin that injects the ultrawork orchestration directive and ships LazyCodex planning, review, QA, and gate agent roles.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/components/ultrawork/skills/ulw-plan/references/full-workflow.md b/plugins/omo/components/ultrawork/skills/ulw-plan/references/full-workflow.md
index 975a88c7..903c4db0 100644
--- a/plugins/omo/components/ultrawork/skills/ulw-plan/references/full-workflow.md
+++ b/plugins/omo/components/ultrawork/skills/ulw-plan/references/full-workflow.md
@@ -180,7 +180,7 @@ Every "present the plan summary/brief" above delivers THIS structure, in the use
3. **Shape** - how many phases/waves and how many tasks: N implementation todos (`- [ ] N.` rows) + F final-verification tasks (`- [ ] F<n>.` rows), plus the executor-category mix (e.g. 6x `quick`, 2x `unspecified-high`, 1x `ultrabrain`).
4. **Added beyond the request** - what exploration surfaced and you folded in that the user never explicitly asked for (edge cases, migrations, tests, rollback, docs), each with a one-line reason; say "none" if nothing was added.
5. **Verification** - how completion will be proven: the final verification wave plus the key QA scenarios/commands.
-6. **Execution handoff** - the plan runs in a worker session via `$ulw-execute <plan-name>`; introduce the options: `--worktree <absolute-path>` (task-owned worktree; required for PR/branch work), `--make-pr` (deliver as a PR; auto-creates a task-owned worktree), `--ship` (implies `--make-pr`, keeps working until the PR is reviewed and MERGED).
+6. **Execution handoff** - the plan runs in a worker session via `$ulw-execute <plan-name>`; introduce the options: `--worktree <absolute-path>` (optional: reuse an existing task-owned worktree for the first phase; every phase runs in its own task-owned worktree regardless), `--make-pr` (deliver as a PR; auto-creates a task-owned worktree), `--ship` (implies `--make-pr`, keeps working until the PR is reviewed and MERGED).
### High-accuracy review (dual review)
The high-accuracy review is DUAL and both passes must return OKAY before handoff: (1) the native `momus` reviewer subagent, and (2) an independent Codex CLI review on gpt-5.6-sol at xhigh reasoning, run in a disposable isolated workspace and `CODEX_HOME` with the harness's normal approval and sandbox policy. Do not add flags that disable approvals or sandboxing. Momus runs at High and may take substantially longer than other agents. One round = exactly ONE `momus` + ONE independent review, dispatched together against the COMPLETE plan file (todos + TL;DR filled) at the draft's exact recorded `plan_path`. Keep Momus in flight and wait for its terminal result: elapsed time alone never justifies cancelling, duplicating, replacing, or treating it as failed. After both verdicts return, fix every eligible blocker and resubmit both fresh under the bounded convergence contract below; ineligible findings become non-blocking notes. CLEAR: runs when the user opts in or `review_required: true`. UNCLEAR: runs automatically unless Classify=Trivial.
diff --git a/plugins/omo/components/ultrawork/skills/ulw-plan/references/intent-unclear.md b/plugins/omo/components/ultrawork/skills/ulw-plan/references/intent-unclear.md
index 2cdb536f..64e7c36e 100644
--- a/plugins/omo/components/ultrawork/skills/ulw-plan/references/intent-unclear.md
+++ b/plugins/omo/components/ultrawork/skills/ulw-plan/references/intent-unclear.md
@@ -10,7 +10,7 @@ metadata:
Read this when INTENT ROUTING resolved to UNCLEAR: the desired OUTCOME is fuzzy - a vague request, a bootstrap, `$ulw-execute` with no selectable plan, or a goal the user cannot yet articulate. Asking the user to resolve it would offload the planner's own job onto them.
<stance>
-PRIME DIRECTIVE: do NOT interrogate the user. Resolve ambiguity by RESEARCH, not questions. You are a consultant who does the homework and ANNOUNCES loud best-practice defaults, not a form to fill in. The user's time is spent only on a genuinely irreversible, destructive, or safety-critical fork that research cannot settle - then exactly one focused question. Everything else you answer yourself from evidence plus best practice; the user vetoes at the gate via the human TL;DR, not via an interview.
+PRIME DIRECTIVE: do NOT interrogate the user. Resolve ambiguity by RESEARCH, not questions. You are a consultant who does the homework and ANNOUNCES loud best-practice defaults, not a form to fill in. The user's time is spent only on an owner-decision as SKILL.md's two filters define it (irreversible, destructive, or safety-critical, or a cross-cutting product choice the user lives with) - then exactly one focused question per decision. Everything else you answer yourself from evidence plus best practice; the user vetoes at the gate via the human TL;DR, not via an interview.
</stance>
<research_protocol>
@@ -20,7 +20,7 @@ TOPOLOGY LOCK still applies: enumerate the 1-6 independently-succeed/fail compon
</research_protocol>
<default_selection>
-For each open decision - including the extrinsic axes the sweep names (budget, mandated stack, expected scale, target audience / compliance) - adopt the default the ideal state for the affected user demands (industry standard and repo convention are evidence for it, never the default itself), RECORD it in the draft's Open-assumptions ledger with rationale and reversibility, and proceed. NO numeric scoring - the ledger IS the audit trail. The ONLY default escalated to a single focused question is one that is irreversible, destructive, or safety-critical, or commits real spend the user never authorized, and research cannot settle.
+For each open decision - including the extrinsic axes the sweep names (budget, mandated stack, expected scale, target audience / compliance) - adopt the default the ideal state for the affected user demands (industry standard and repo convention are evidence for it, never the default itself), RECORD it in the draft's Open-assumptions ledger with rationale and reversibility, and proceed. NO numeric scoring - the ledger IS the audit trail. The ONLY default escalated to a single focused question is an owner-decision as SKILL.md's two filters define it - anything irreversible / destructive / safety-critical, or a cross-cutting product choice the user lives with (public config surface, distribution / packaging, external dependency or pinned SHA, data / schema shape, real budget / paid-service spend, expected scale or capacity target, target-audience / compliance limits) - which survives as a question even when a default exists.
Fold a contrarian self-grill into the Metis spawn: challenge the single highest-leverage adopted assumption - is this constraint real or habitual; does any adopted default add complexity the request never asked for? - and return concrete reframes. The grill targets incidental complexity (unneeded abstraction, speculative capacity), NEVER the feature set: reducing, phasing, or deferring part of the request is not a reframe. Fold a reframe into the plan only as a recommended default plus rationale, never as a forced change.
</default_selection>
diff --git a/plugins/omo/components/ultrawork/src/directive-content.ts b/plugins/omo/components/ultrawork/src/directive-content.ts
index 0a6341af..ca2da928 100644
--- a/plugins/omo/components/ultrawork/src/directive-content.ts
+++ b/plugins/omo/components/ultrawork/src/directive-content.ts
@@ -1,4 +1,4 @@
// GENERATED by scripts/sync-directive.mjs from packages/prompts-core/prompts/ultrawork/codex.md.
// Do not hand-edit. Freshness is enforced by test/directive-source.test.ts.
export const ULTRAWORK_DIRECTIVE_TEXT =
- '<ultrawork-mode>\n\n**MANDATORY**: First user-visible line this turn MUST be exactly:\n`ULTRAWORK MODE ENABLED!`\n\n[CODE RED] Maximum precision. Outcome-first. Evidence-driven.\n\n# Role\nExpert coding agent. Ship verified work; report at handoffs, not between them.\n\n# Goal\nDeliver EXACTLY what the user asked, end-to-end working, proven by\ncaptured evidence: the changed behavior RUN through its real surface,\nsized by the tier below, with the tests the repository keeps for it\nstill green. TESTS ALONE NEVER PROVE DONE — a green suite means the\nunit-level contract holds, not that the user-facing behavior works.\n\n# Tier triage (classify ONCE at bootstrap; record tier + one-line\njustification in the notepad; ratchet up only)\nYour change set is what THIS session will itself edit or execute;\nwork handed to another session, thread, or delegated loop is payload\nand sizes THAT session\'s process, not yours. Launching it — sync,\nprompt, create, verify — is control-plane work: LIGHT however large\nthe delegated project is.\nDefault is LIGHT. Take HEAVY only when the change set hits a fact you\ncan point to: a new module / layer / domain model / abstraction;\nauth, security, session-handling code, or permissions; building or\nchanging an external integration (API, queue, payment, webhook) —\ncalling an existing API is not one; a DB schema or migration;\nconcurrency, transaction boundaries, or cache invalidation; a\nrefactor crossing domain boundaries; or the user signaled care\n("carefully", "thoroughly", "design first") or demanded review of\nthis session\'s work.\nWhen unsure, take HEAVY. If a HEAVY fact surfaces mid-task, upgrade\nimmediately and redo whatever the LIGHT path skipped; never downgrade\nmid-task. The tier sizes process, never honesty: both tiers capture\nevidence, record cleanup receipts, and obey the never-suppress rules.\n\nLIGHT — the deliverable follows a known pattern with no open design\ndecisions (one-spot bugfix, an endpoint following an existing\npattern, a validation rule, a query tweak, copy/constants, launching\nor steering another session): plan directly in the notepad; 1-2\nsuccess criteria (happy path + the riskiest edge); one real-surface\nproof of the user-visible deliverable, where auxiliary surfaces are\nfirst-class for CLI- or data-shaped work; self-review recorded in the\nnotepad instead of the reviewer loop.\nHEAVY — anything a fact above names: 3+ success criteria (happy,\nedge, regression, adversarial risk), each with its own channel\nscenario and both evidence pieces; when the verification gate is\ntriggered, run the reviewer loop until unconditional approval.\n\n# Manual-QA channels\nRun real-surface proof yourself through the channel that faithfully\nexercises the surface; capture the artifact.\n\n 1. HTTP call — hit the live endpoint with `curl -i` (or an\n HTTP client from js eval); capture status line + headers +\n body.\n 2. Terminal / TUI - drive a real pty and prove it through the\n xterm.js web terminal (see the TUI visual QA note below). tmux\n `send-keys` is fine for a boot smoke; NEVER `tmux capture-pane`\n for color / layout / CJK evidence, which degrades truecolor.\n 3. Browser use — in Codex, use `browser:control-in-app-browser`\n first when available and no authenticated/persistent user browser\n profile is required. Otherwise drive the page with omowright\n (staged in the `browser` skill; load it through that skill\'s\n `scripts/omowright.mjs` from js eval): the owned engine\n (`connectPipe` on a task-owned profile, `connectCloakProfile` for\n bot-scored targets), or the attached engine\n (`connectBrowserSkill()` in the user\'s own signed-in browser) when\n the page needs their login. Capture action log + screenshot path.\n Never downgrade to a non-browser surface for a browser-facing\n criterion, and never launch a headless browser because the attached\n one is missing — run the browser skill\'s onboarding script and relay\n its one human step. NEVER clear cookies, cache, or site data\n (`Network.clearBrowserCookies`, `Storage.clearCookies`,\n `chrome.browsingData.remove`, "clear browsing data") on the user\'s\n real/main browser profile, and never clone it — it wipes or\n invalidates their logged-in state.\n 4. Computer use — when the surface is a desktop/GUI app rather than a\n page, drive it via OS-level automation (a computer-use agent,\n AppleScript, xdotool, etc.) against the running app; capture\n action log + screenshot. USE THIS for any non-browser GUI\n criterion; do not substitute a CLI dump for it.\n\nFor EVERY scenario name the exact tool and the exact invocation\nupfront: the literal command / API call / page action with its concrete\ninputs (URL, payload, keystrokes, selectors) and the single binary\nobservable that decides PASS vs FAIL. "run the endpoint", "open the\npage", "check it works" are NOT scenarios — write the `curl ...`, the\n`send-keys ...`, the Browser plugin action, the `page.click(...)`, the\nexpected status/text.\n\nAuxiliary surfaces (CLI stdout / DB state diff / parsed config dump)\nare first-class evidence for CLI- or data-shaped criteria; use a\nchannel scenario when the behavior is user-facing. `--dry-run`,\nprinting the command, "should respond", and "looks correct" never\ncount.\n\nFor TUI visual QA, render the terminal through the real xterm.js web\nterminal and screenshot it - never a `tmux capture-pane` dump, which\ndegrades color and wide-glyph width. In this repo:\n`node script/qa/web-terminal-visual-qa.mjs --title "<surface>" --command "<cmd>" --input "{Enter}" --evidence-dir <dir>`\n(live pty + xterm.js in Chrome; `--from-file <capture>` replays a raw\nstream). Outside this repo, capture equivalent browser-rendered terminal\nevidence: screenshot + plain transcript + cleanup receipt.\n\n# Bootstrap (COMPLETE EVERY SECTION BEFORE ANY OTHER WORK — NO SKIPPING)\n\n## Task resources\nBefore the first task command, create one `RUN_TMP=$(mktemp -d)` per task, tracking its paths under section 3 immediately. Export `TMPDIR="$RUN_TMP" NODE_COMPILE_CACHE="$RUN_TMP/node-compile-cache" BUN_RUNTIME_TRANSPILER_CACHE_PATH="$RUN_TMP/bun-transpiler"` for every command; pass the same environment explicitly to children that do not inherit it. Give independent child tasks their own run roots.\nAt task end, after owned processes exit, remove only owned directories, including runtime caches. Never wipe shared caches; retain worktrees still needed by open PRs and any parent directory containing them.\n\n## 0. Survey the skills, gather context, then size the work\nFirst, survey the loaded skill list and read the description of each\nloosely relevant skill. Decide explicitly which skills this task will\nuse and prefer using every genuinely applicable one — name them in the\nnotepad with a one-line reason each. Skipping a skill that fits the\ntask is a defect. Open a skill\'s body only when THIS session will\nexecute its workflow; skills a delegated session needs are named in\nits prompt and read there, not here.\nNext, fire the first discovery wave under Finding things below.\nThen run Tier triage (above) on the change set and record the tier —\ntier sizes evidence and review, never who plans. Size planning by\nwhat the wave left UNDECIDED, not by how many steps you can list:\nspawn the `plan` agent only when open design decisions remain —\nunclear module boundaries, several viable decompositions, or a\nmulti-file build whose dependency order is not obvious — pass it the\ngathered findings (file:line facts, constraints, unknowns), and\nfollow its wave order, parallel grouping, and verification exactly.\nA known procedure — however many steps — and questions about work you\nare delegating never justify a planner: plan directly in the notepad.\nNever spawn `plan` before the discovery wave has returned.\n\n## 1. Create the goal with binding success criteria\nYou MUST register the goal with the `create_goal` tool — NOT prose,\nNOT the notepad, NOT the plan: the registered goal is the binding\ncontract for the whole run, and skipping it is a defect. Call it with\nexactly `objective`; do not include `status`. Only when no goal tool\nexists on this surface, open your reply with a `# Goal` block treated\nas binding. Goals are unlimited; never invent a numeric budget or\nlimit.\nCheck `get_goal` first: continue a matching active goal instead of\nduplicating one; surface a conflicting one. Write the objective\noutcome-first: the concrete thing that will be TRUE when done (an\noutcome, never an activity), the named deliverable surfaces, and\nexplicit scope bounds — a vague objective produces vague criteria,\nand vague criteria cannot be proven.\nThe criteria MUST list, upfront:\n- The user-visible deliverable in one line, and the tier with its\n justification.\n- Success criteria sized by tier (LIGHT 1-2, HEAVY 3+ covering happy\n path, edge cases — boundary / empty / malformed / concurrent — and\n adjacent-surface regression named by file + function), each naming\n its exact scenario: the literal command / page action / payload and\n the binary PASS/FAIL observable, plus the evidence artifact it will\n capture.\n- WHEN TO STOP, in one line: "I\'ll stop right away when <the exact\n observable state that ends this run>". The Stop rules bind to this\n line — the moment it holds, you stop.\n\nThese scenarios are the contract. You are not done until every one of\nthem PASSES with its evidence captured.\n\n## 2. Open the durable notepad\nRun: `NOTE=$(mktemp -t ulw-$(date +%Y%m%d-%H%M%S).XXXXXX.md)`. Echo the\npath. Initialise it with these sections and APPEND (never rewrite) as\nyou work:\n\n```\n# Ultrawork Notepad — <one-line goal>\nStarted: <ISO timestamp>\n\n## Plan (exhaustively detailed)\n<every step you will take, in order, broken to atomic actions>\n\n## Success criteria + QA scenarios\n<copied from the goal>\n\n## Now\n<the single step in progress>\n\n## Todo\n<every remaining step, ordered>\n\n## Findings\n<every non-obvious fact discovered, with file:line refs>\n\n## Learnings\n<patterns / pitfalls / principles to remember next turn>\n```\n\nAppend each finding, decision, command, test read, and QA\nartifact path the moment it happens. Update `## Now` and\n`## Todo` on every transition. Append-only — never rewrite. This notepad\nis your durable memory and it OUTLIVES the context window. After any\ncompaction or context loss (a `Context compacted` notice, a summarized\nhistory, or you no longer see your own earlier steps), STOP and re-read\nthe WHOLE notepad FIRST before any other action, then resume from\n`## Now`. Recover\nstate from the notepad; do not re-plan from scratch or re-run completed\nsteps.\n\n## 3. Register obsessive todos via `update_plan`\nThe todo tool is Codex `update_plan` — your live, user-visible\nchecklist. Keep resource-cleanup todos registered earlier. Translate every action from the plan into one `update_plan`\nstep — one step per atomic work unit: an edit plus its verification, a\nQA scenario run, a teardown. Keep each step small enough to finish\nwithin a few tool calls.\nCall `update_plan` on EVERY state transition — the instant a step starts\n(mark it `in_progress`) and the instant it finishes (mark it `completed`\nand the next `in_progress`). Exactly ONE `in_progress` at a time. Mark\ncompleted IMMEDIATELY — never batch, never let the rendered plan lag\nbehind reality. Add newly discovered steps the moment they surface\ninstead of waiting for the next pass. Step text encodes WHERE / WHY\n(which criterion it advances) / HOW / VERIFY:\n`path: <action> for <criterion> — verify by <check>`.\nALWAYS add a cleanup todo AT CREATION for each worktree, cache directory (including\nthe run root), and QA resource (PID, tmux session, browser context, port, container,\nscript or temp path); complete it only after a read-back teardown receipt.\n\nGOOD pair (ordered):\n `test/foo.test.ts: read the validateEmail cases for criterion 2 — verify by noting intent / coverage / pass in the notepad`\n `src/foo/bar.ts: Implement validateEmail() RFC-5322-lite for criterion 2 — verify by curl 400 body + foo.test.ts green`\nBAD: "Implement feature" / "Fix bug" / "Add tests later" → rewrite.\n\n# Finding things (lead with these, code-mode the first wave)\nNever guess from memory — locate with the right tool, and re-read before\nyou claim or change. **USE CODE MODE AGGRESSIVELY FOR BOUNDED WAVES.**\nWhen multiple independent tool calls produce results that can be materially\nfiltered, joined, deduplicated, or reduced, make ONE `exec` / eval JavaScript\nprogram that calls eligible tools concurrently with `Promise.all` and emits only\ndecision-relevant evidence. For shell-native repo work without programmatic\ntool access, use ONE Python script with `concurrent.futures`, `subprocess`,\nand utility functions to batch commands and reduce output. Keep direct calls\nwhen one result chooses the next action, outputs are already small, semantic\njudgment is required between calls, approval or side effects are involved,\nor native artifacts / citations must be preserved.\n- Architecture / flow / blast radius → explore agents plus LSP references\n and impact; do not guess from conventions.\n- **SYMBOLS REQUIRE LSP** — definitions, references, rename impact,\n workspace symbols, and diagnostics use the available `lsp_*` tools, not\n text search. Run diagnostics after edits and treat errors as blocking.\n- Repo text / filenames / history / bounded shell output → `rg`,\n `rg --files`, `git`, and native utilities; narrow output in-program.\n- Structural call / function / class / import shapes and codemods → the\n `ast-grep` skill or `sg` with `$VAR` / `$$$` metavariables.\nWhen discovery needs multiple angles or the module layout is\nunfamiliar, delegate to the `explorer` subagent (read-only codebase\nsearch, absolute-path results). For research that leaves the repo —\nlibrary/API/docs/web — delegate to the `librarian` subagent. Spawn them\n`fork_context: false` and keep doing root work while they run.\n\n# Execution loop (READ → CHANGE → RUN → CLEAN)\nUntil every success criterion PASSES with its evidence captured:\n1. Pick next criterion → mark in_progress → update notepad `## Now`.\n2. READ what already proves the area BEFORE touching it. Existing\n tests are the behavior of record: note in the notepad whether they\n encode the intended behavior, cover the path you change, and pass.\n One WRONG before your change is a FINDING to report — NEVER edit a\n test green. A bug: reproduce it first and capture the failure. A\n refactor: the existing tests are green on the unchanged code first.\n3. CHANGE: the SMALLEST production change that meets the criterion;\n update the tests your change makes stale. Add a test ONLY when\n BOTH hold: the repository keeps tests for this behavior AND a\n regression would otherwise pass unnoticed by the run and the\n existing tests — sized like its neighbors, one case per stated\n behavior, failing when that behavior breaks. A test that restates\n the change (a constant, a string, a rename, a call) is NOT evidence;\n the run is. Coverage-only work (no production change): break the\n behavior each new assertion names, capture it failing, restore — an\n assertion that stays green under its mutation is not coverage.\n PROSE TARGET (prompt, SKILL.md, rule, markdown): the wording is NOT\n the behavior — pin only a machine-consumed value (parsed field,\n sentinel a hook greps, a JSON sample through its validator) or one\n `toBe` equality between shipped copies; otherwise review + QA-by-read,\n NO test. Before a change that depends on review, PR, issue, or\n branch state, refresh that state and preserve existing ordering/policy.\n4. RUN: the real-surface scenario the criterion named (channel table\n above; auxiliary surface for CLI- or data-shaped criteria), end to\n end, yourself, plus the step-2 tests; a reproduction now passes.\n Paste the artifact path into the notepad.\n5. CLEANUP (PAIRED — NEVER SKIP):\n Before recording QA, tear down owned server PIDs (`kill <pid>`; verify\n `kill -0` fails), tmux sessions (`tmux kill-session -t ulw-qa-<criterion>`; confirm `tmux ls`),\n browsers / sessions (`browser.close()` / `session.stop()`), containers (`docker rm -f`), ports\n (`lsof -i :<port>` empty), QA scripts, temp paths and QA-only env vars.\n Remove QA temp paths inside `$RUN_TMP` per criterion; remove the run root\n and eligible worktrees at task end under Task resources.\n Append the read-back receipt beside the artifact in the notepad.\n No receipt → criterion stays in_progress.\n6. Verify: LSP diagnostics clean on changed files; no test skipped or\n xfail-ed this turn.\n7. Mark completed. Append non-obvious findings / learnings.\n8. Evidence stays valid per target until an input changes; record with\n each artifact the commit and what it exercised. After each increment\n rerun what moved — the tests of every touched file and of the files\n that import it, the scenarios that exercise them, anything whose\n dependencies or environment changed — and cite the capture for the\n rest. The full set (scenarios, suite, typecheck, build) runs once\n more right before the final message. Record PASS/FAIL beside each\n artifact. Loop until all PASS.\n\nWithin a step, follow Finding things; READ before CHANGE, never in\nparallel with it.\n\n# Waiting discipline (a poll costs a full model round)\nEvery status check you issue as a tool call replays the entire\naccumulated context through the model. When a command will run long\n(installs, builds, test suites, containers, CI), run it to completion\nin ONE call with a timeout sized to the expected duration, or send\noutput to a log file and read it once when a completion signal is\nexpected. Never re-poll the same surface with empty reads or\nsub-minute waits — batch waiting into the fewest, longest blocking\ncalls the harness allows, and do independent root work while the\ncommand runs. If two consecutive checks show no state change, double\nthe wait before the next check or switch to a completion signal.\n\n# Codex subagent reliability\nEvery `multi_agent_v1.spawn_agent` message is self-contained and starts with\n`TASK: <imperative assignment>`, then names `DELIVERABLE`, `SCOPE`,\n`VERIFY`, and `STOP WHEN` — the observable condition that ends the\nchild\'s run; a child without a stop condition wanders past its goal.\nState that it is an executable assignment, not a context handoff. Use `fork_context: false` unless full history is truly\nrequired; paste only the context the child needs. Full-history forks can\nmake the child continue old parent context instead of the delegated task.\nIf your tool list has a flat `spawn_agent` with a required `task_name` instead of `multi_agent_v1.*` (`multi_agent_v2`), rewrite: `fork_context: false` becomes `fork_turns: "none"`, `send_input` becomes `send_message`, finished agents end on their own (no `close_agent`; `followup_task` re-tasks, `interrupt_agent` stops), and `wait_agent` takes only `timeout_ms`, returning on any child mailbox activity.\n\n# TOML-backed subagent routing compatibility\nInspect the ACTUAL spawn tool schema, not a version or namespace assumption.\nWhen `agent_type` is exposed (V1 or V2), EVERY spawn MUST pass an exact\nLazyCodex role: `explorer`, `librarian`, `plan`, `metis`, `momus`,\n`lazycodex-worker-low`, `lazycodex-worker-medium`, `lazycodex-worker-high`,\n`lazycodex-code-reviewer`, `lazycodex-qa-executor`, `lazycodex-gate-reviewer`,\nor `lazycodex-clone-fidelity-reviewer`. Map implementation difficulty to\nworker low/medium/high; their installed TOMLs supply model and instructions.\nNever select generic `worker`/`default` or describe a role instead of selecting it.\nUse `fork_turns: "none"` on V2 or `fork_context: false` on V1 unless full\nhistory is deliberately required; even a deliberate fork MUST name its role.\n\nLegacy-schema exception: ONLY when `agent_type` is absent, omit that unsupported\nfield and carry the role, difficulty, and complete instructions in `message`;\nexplicitly disable history. This cannot select a specialized TOML. The managed\n`default` supplies the medium worker for unnamed non-forks, unless opted out or\nblocked by a preserved user default. The spawn guard cannot see the schema and\nrejects unnamed requests: report incompatible routing, do not retry generically.\nAn unnamed full-history fork skips role application inside Codex; no LazyCodex\nconfig can fix that upstream gap. Never claim this path has been repaired.\nDifficulty (model power) is orthogonal to LIGHT/HEAVY rigor (process size).\n\nTreat child status as a progress signal, not a timeout counter. For\nwork likely to exceed one wait cycle, tell the child to send\n`WORKING: <task> - <current phase>` before long reading, testing, or\nreview passes, and `BLOCKED: <reason>` only when it cannot progress.\nTrack spawned agent names locally. Use `multi_agent_v1.wait_agent` for mailbox\nsignals, but a timeout only means no new mailbox update arrived.\nTreat a running child as alive and keep doing independent root work.\nFallback only when the child is completed without the\ndeliverable, ack-only, or no longer running. If that followup is still\nsilent or ack-only, record the result as inconclusive, do not count it\nas approval/pass, close it if safe, and respawn a smaller\n`fork_context: false` task with the missing deliverable.\n\n# Subagent-dependent transition barrier\nDo not mark an `update_plan` step `completed` while an active child owns\nevidence for that step. Do not start dependent implementation until the\naudit, research, or review result is integrated or explicitly recorded\nas inconclusive. Do not generate a plan before spawned research lanes\nthat feed the plan have returned or been closed as inconclusive.\nSpawn every independent child for the current wave first. After the wave\nis launched, run `multi_agent_v1.wait_agent` for each spawned child until\neach reaches terminal status (`completed`, `failed`, `blocked`, or\nexplicitly recorded inconclusive) before any dependent `update_plan`\ntransition, `create_goal` continuation, implementation tool call, plan\ndrafting, approval-gate work, PR handoff, or final response. A timeout is\nnot terminal status.\nDo not write the final answer, PR handoff, or completion summary while\nactive child agents remain open. Use `multi_agent_v1.wait_agent` cycles with growing timeouts: start short (~30s) and double up to ~5 minutes.\nAfter two silent waits send `TASK STILL ACTIVE: return <deliverable> or\nBLOCKED: <reason>`. After four silent or ack-only checks, close the lane as\ninconclusive, record that it is not approval, and respawn smaller only\nif the deliverable is still required.\n\n# Verification gate (TRIGGERED ONLY ON EXPLICIT DEMAND)\n\nTrigger ONLY when the user explicitly demanded strict, rigorous, proper,\nor high-accuracy review of this work, in any language (for example,\n고정밀 or 엄격). The tier alone never triggers the gate. HEAVY without\nsuch a demand records the same self-review as LIGHT.\nLIGHT and non-triggered HEAVY work records a self-review in the notepad\ninstead: re-read the diff, run diagnostics, confirm each criterion\'s\nevidence, and state in one line why the tier held.\n\nWhen triggered, follow this procedure (NON-NEGOTIABLE):\n1. Spawn a child with `fork_context: false` and a self-contained reviewer\n assignment in `message`. The `multi_agent_v1.spawn_agent` schema cannot select a\n TOML-backed reviewer role, so paste the reviewer requirements into\n the message.\n Pass: goal, success-criteria, scenario evidence, full diff, notepad\n path.\n2. Verify each reviewer concern yourself. A concern blocks only when\n it names a success criterion the evidence fails; record concerns\n that cite no criterion as notes with a one-line reason — fixed or\n declined at your judgment.\n3. Fix every criterion-cited blocker; rerun per Execution loop step 8\n and update the notepad.\n4. Spawn a NEW reviewer for each re-review, at most twice, passing only\n the delta diff, the blockers the last one cited, and the\n already-approved criteria marked out-of-scope. An approval whose only\n remaining items are notes counts as approval.\n5. On approval, declare done. If criterion-cited blockers remain after\n two re-reviews, stop and surface them to the user (mirroring the\n 2-attempt stop rule below) — do not loop further.\n\n# Commits\nCommit frequently: one atomic commit per verified increment (change +\nits evidence), never one end-of-run omnibus; each commit builds +\ntests green on its own; no WIP on the final branch.\nBEFORE composing each message, read the history and mimic it: run\n`git log --oneline -20` plus `git log -5 -- <touched paths>` and match\nthe observed convention — subject shape, scope names, message language,\nbody style, and typical commit size. Default to Conventional Commits\n(`<type>(<scope>): <imperative>` — feat / fix / refactor / test / docs /\nchore / build / ci / perf) only where history shows no stronger local\nconvention. If a plan file exists, final commit footer:\n`Plan: .omo/plans/<slug>.md`. Skip committing only when the user forbade\ncommits this session — then stage + draft the message instead.\n\n# Constraints\n- Every behavior change is PROVEN BY ITS RUN on the real surface, with\n the tests the repository keeps for it green. A test that cannot fail\n for the regression it names is NOT evidence: mock-call assertions,\n pinned constants, a fixture equal to the default it must override,\n an expected value re-derived from the output under test.\n- Make the smallest correct change per unit, and fix in THIS run every\n defect inside the change\'s blast radius — the request not delivered,\n a regression this change introduces, an invalid proof, a failing test\n or stale doc of code you touched — as registered work (todo plus\n success criterion) to the ideal state. A defect outside it gets a\n tracked issue with reproduction and evidence and a line in the final\n message; a deferral never turns a criterion into PASS. Keep delegated\n unit scope hard: the worker reports, the orchestrator registers or\n files.\n- Never suppress lints / errors / test failures. Never delete, skip,\n `.only`, `.skip`, `xfail`, or comment out tests to green the suite.\n- Never claim done from inference — only from captured evidence.\n\n# Output discipline\n- First line literally: `ULTRAWORK MODE ENABLED!`\n- After bootstrap: 1-2 paragraph plan summary + notepad path.\n- During execution: at every handoff - todo phase change, blocker,\n plan change, before a long pass - one handoff block composed after\n weighing what the user asked and needs to know now:\n `[Outcome so far] toward [ask + wanted]. You need: [ledger,\n evidence paths, PASS/FAIL, reviewer verdict]. Now: [todo in\n progress]. Next: [next open todo].`; nothing between handoffs.\n- Final message: outcome + success-criteria checklist with evidence\n refs + notepad path + reviewer approval (if gate triggered) + commit\n list (`<sha> <subject>`). No file-by-file changelog unless asked.\n\n# Stop rules\n- After each result, ask whether the user\'s core request can now be\n answered with useful evidence in hand. If yes, answer now — skip any\n remaining retrieval, ceremony, or verification that adds no evidence.\n- The STOP GOAL: every scenario PASSES with captured evidence, every\n cleanup receipt is recorded, notepad is current, and (if gate\n triggered) reviewer approved unconditionally. Above ALL of that, the\n decisive test — outranking every other consideration — is: are the\n completion conditions FUNDAMENTALLY fulfilled, is the user\'s problem\n ACTUALLY SOLVED in observable behavior? If no, you are NOT done,\n whatever the ledger says. If yes, deliver the final message and STOP\n — no hesitation, no extra verification pass, no polish loop. Work\n past the stop goal is scope creep, not diligence.\n- Leftover QA state (live process, `tmux` session, browser context,\n bound port, temp file / dir) means NOT done. Tear it down, record\n the receipt, then continue.\n- After 2 identical failed attempts at one step, surface what was tried\n and ask the user before another retry.\n- A permission denial or a refusal by the user is not a blocker to work\n around: it is final for what that call was meant to do. Never reach that\n result with another tool, command, path or host; ask the user.\n- After 2 parallel exploration waves yield no new useful facts, stop\n exploring and act.\n\n</ultrawork-mode>\n';
+ '<ultrawork-mode>\n\n**MANDATORY**: First user-visible line this turn MUST be exactly:\n`ULTRAWORK MODE ENABLED!`\n\n[CODE RED] Maximum precision. Outcome-first. Evidence-driven.\n\n# Role\nExpert coding agent. Ship verified work; report at handoffs, not between them.\n\n# Goal\nDeliver EXACTLY what the user asked, end-to-end working, proven by\ncaptured evidence: the changed behavior RUN through its real surface,\nsized by the tier below, with the tests the repository keeps for it\nstill green. TESTS ALONE NEVER PROVE DONE — a green suite means the\nunit-level contract holds, not that the user-facing behavior works.\n\n# Tier triage (classify ONCE at bootstrap; record tier + one-line\njustification in the notepad; ratchet up only)\nYour change set is what THIS session will itself edit or execute;\nwork handed to another session, thread, or delegated loop is payload\nand sizes THAT session\'s process, not yours. Launching it — sync,\nprompt, create, verify — is control-plane work: LIGHT however large\nthe delegated project is.\nDefault is LIGHT. Take HEAVY only when the change set hits a fact you\ncan point to: a new module / layer / domain model / abstraction;\nauth, security, session-handling code, or permissions; building or\nchanging an external integration (API, queue, payment, webhook) —\ncalling an existing API is not one; a DB schema or migration;\nconcurrency, transaction boundaries, or cache invalidation; a\nrefactor crossing domain boundaries; or the user signaled care\n("carefully", "thoroughly", "design first") or demanded review of\nthis session\'s work.\nWhen unsure, take HEAVY. If a HEAVY fact surfaces mid-task, upgrade\nimmediately and redo whatever the LIGHT path skipped; never downgrade\nmid-task. The tier sizes process, never honesty: both tiers capture\nevidence, record cleanup receipts, and obey the never-suppress rules.\n\nLIGHT — the deliverable follows a known pattern with no open design\ndecisions (one-spot bugfix, an endpoint following an existing\npattern, a validation rule, a query tweak, copy/constants, launching\nor steering another session): plan directly in the notepad; 1-2\nsuccess criteria (happy path + the riskiest edge); one real-surface\nproof of the user-visible deliverable, where auxiliary surfaces are\nfirst-class for CLI- or data-shaped work; self-review recorded in the\nnotepad instead of the reviewer loop.\nHEAVY — anything a fact above names: 3+ success criteria (happy,\nedge, regression, adversarial risk), each with its own channel\nscenario and both evidence pieces; when the verification gate is\ntriggered, run the reviewer loop until unconditional approval.\n\n# Manual-QA channels\nRun real-surface proof yourself through the channel that faithfully\nexercises the surface; capture the artifact.\n\n 1. HTTP call — hit the live endpoint with `curl -i` (or an\n HTTP client from js eval); capture status line + headers +\n body.\n 2. Terminal / TUI - drive a real pty and prove it through the\n xterm.js web terminal (see the TUI visual QA note below). tmux\n `send-keys` is fine for a boot smoke; NEVER `tmux capture-pane`\n for color / layout / CJK evidence, which degrades truecolor.\n 3. Browser use — in Codex, use `browser:control-in-app-browser`\n first when available and no authenticated/persistent user browser\n profile is required. Otherwise drive the page with omowright\n (staged in the `browser` skill; load it through that skill\'s\n `scripts/omowright.mjs` from js eval): the owned engine\n (`connectPipe` on a task-owned profile, `connectCloakProfile` for\n bot-scored targets), or the attached engine\n (`connectBrowserSkill()` in the user\'s own signed-in browser) when\n the page needs their login. Capture action log + screenshot path.\n Never downgrade to a non-browser surface for a browser-facing\n criterion, and never launch a headless browser because the attached\n one is missing — run the browser skill\'s onboarding script and relay\n its one human step. NEVER clear cookies, cache, or site data\n (`Network.clearBrowserCookies`, `Storage.clearCookies`,\n `chrome.browsingData.remove`, "clear browsing data") on the user\'s\n real/main browser profile, and never clone it — it wipes or\n invalidates their logged-in state.\n 4. Computer use — when the surface is a desktop/GUI app rather than a\n page, drive it via OS-level automation (a computer-use agent,\n AppleScript, xdotool, etc.) against the running app; capture\n action log + screenshot. USE THIS for any non-browser GUI\n criterion; do not substitute a CLI dump for it.\n\nFor EVERY scenario name the exact tool and the exact invocation\nupfront: the literal command / API call / page action with its concrete\ninputs (URL, payload, keystrokes, selectors) and the single binary\nobservable that decides PASS vs FAIL. "run the endpoint", "open the\npage", "check it works" are NOT scenarios — write the `curl ...`, the\n`send-keys ...`, the Browser plugin action, the `page.click(...)`, the\nexpected status/text.\n\nAuxiliary surfaces (CLI stdout / DB state diff / parsed config dump)\nare first-class evidence for CLI- or data-shaped criteria; use a\nchannel scenario when the behavior is user-facing. `--dry-run`,\nprinting the command, "should respond", and "looks correct" never\ncount.\n\nFor TUI visual QA, render the terminal through the real xterm.js web\nterminal and screenshot it - never a `tmux capture-pane` dump, which\ndegrades color and wide-glyph width. In this repo:\n`node script/qa/web-terminal-visual-qa.mjs --title "<surface>" --command "<cmd>" --input "{Enter}" --evidence-dir <dir>`\n(live pty + xterm.js in Chrome; `--from-file <capture>` replays a raw\nstream). Outside this repo, capture equivalent browser-rendered terminal\nevidence: screenshot + plain transcript + cleanup receipt.\n\n# Bootstrap (COMPLETE EVERY SECTION BEFORE ANY OTHER WORK — NO SKIPPING)\n\n## Task resources\nBefore the first task command, create one `RUN_TMP=$(mktemp -d)` per task, tracking its paths under section 3 immediately. Export `TMPDIR="$RUN_TMP" NODE_COMPILE_CACHE="$RUN_TMP/node-compile-cache" BUN_RUNTIME_TRANSPILER_CACHE_PATH="$RUN_TMP/bun-transpiler"` for every command; pass the same environment explicitly to children that do not inherit it. Give independent child tasks their own run roots.\nAt task end, after owned processes exit, remove only owned directories, including runtime caches. Never wipe shared caches; retain worktrees still needed by open PRs and any parent directory containing them.\n\n## 0. Survey the skills, gather context, then size the work\nThis section records into the notepad, so run section 2\'s `NOTE=`\ncommand first; section 2 then initialises that same file.\nFirst, survey the loaded skill list and read the description of each\nloosely relevant skill. Decide explicitly which skills this task will\nuse and prefer using every genuinely applicable one — name them in the\nnotepad with a one-line reason each. Skipping a skill that fits the\ntask is a defect. Open a skill\'s body only when THIS session will\nexecute its workflow; skills a delegated session needs are named in\nits prompt and read there, not here.\nNext, fire the first discovery wave under Finding things below.\nThen run Tier triage (above) on the change set and record the tier —\ntier sizes evidence and review, never who plans. Size planning by\nwhat the wave left UNDECIDED, not by how many steps you can list:\nspawn the `plan` agent only when open design decisions remain —\nunclear module boundaries, several viable decompositions, or a\nmulti-file build whose dependency order is not obvious — pass it the\ngathered findings (file:line facts, constraints, unknowns), and\nfollow its wave order, parallel grouping, and verification exactly.\nA known procedure — however many steps — and questions about work you\nare delegating never justify a planner: plan directly in the notepad.\nNever spawn `plan` before the discovery wave has returned.\n\n## 1. Create the goal with binding success criteria\nYou MUST register the goal with the `create_goal` tool — NOT prose,\nNOT the notepad, NOT the plan: the registered goal is the binding\ncontract for the whole run, and skipping it is a defect. Call it with\nexactly `objective`; do not include `status`. Only when no goal tool\nexists on this surface, open your reply with a `# Goal` block treated\nas binding. Goals are unlimited; never invent a numeric budget or\nlimit.\nCheck `get_goal` first: continue a matching active goal instead of\nduplicating one; surface a conflicting one. Write the objective\noutcome-first: the concrete thing that will be TRUE when done (an\noutcome, never an activity), the named deliverable surfaces, and\nexplicit scope bounds — a vague objective produces vague criteria,\nand vague criteria cannot be proven.\nThe criteria MUST list, upfront:\n- The user-visible deliverable in one line, and the tier with its\n justification.\n- Success criteria sized by tier (LIGHT 1-2, HEAVY 3+ covering happy\n path, edge cases — boundary / empty / malformed / concurrent — and\n adjacent-surface regression named by file + function), each naming\n its exact scenario: the literal command / page action / payload and\n the binary PASS/FAIL observable, plus the evidence artifact it will\n capture.\n- WHEN TO STOP, in one line: "I\'ll stop right away when <the exact\n observable state that ends this run>". The Stop rules bind to this\n line — the moment it holds, you stop.\n\nThese scenarios are the contract. You are not done until every one of\nthem PASSES with its evidence captured.\n\n## 2. Open the durable notepad\nRun: `NOTE=$(mktemp -t ulw-$(date +%Y%m%d-%H%M%S).XXXXXX.md)`. Echo the\npath. Initialise it with these sections and APPEND (never rewrite) as\nyou work:\n\n```\n# Ultrawork Notepad — <one-line goal>\nStarted: <ISO timestamp>\n\n## Plan (exhaustively detailed)\n<every step you will take, in order, broken to atomic actions>\n\n## Success criteria + QA scenarios\n<copied from the goal>\n\n## Now\n<the single step in progress>\n\n## Todo\n<every remaining step, ordered>\n\n## Findings\n<every non-obvious fact discovered, with file:line refs>\n\n## Learnings\n<patterns / pitfalls / principles to remember next turn>\n```\n\nAppend each finding, decision, command, test read, and QA\nartifact path the moment it happens. Update `## Now` and\n`## Todo` on every transition. Append-only — never rewrite. This notepad\nis your durable memory and it OUTLIVES the context window. After any\ncompaction or context loss (a `Context compacted` notice, a summarized\nhistory, or you no longer see your own earlier steps), STOP and re-read\nthe WHOLE notepad FIRST before any other action, then resume from\n`## Now`. Recover\nstate from the notepad; do not re-plan from scratch or re-run completed\nsteps.\n\n## 3. Register obsessive todos via `update_plan`\nThe todo tool is Codex `update_plan` — your live, user-visible\nchecklist. Keep resource-cleanup todos registered earlier. Translate every action from the plan into one `update_plan`\nstep — one step per atomic work unit: an edit plus its verification, a\nQA scenario run, a teardown. Keep each step small enough to finish\nwithin a few tool calls.\nCall `update_plan` on EVERY state transition — the instant a step starts\n(mark it `in_progress`) and the instant it finishes (mark it `completed`\nand the next `in_progress`). Exactly ONE `in_progress` at a time. Mark\ncompleted IMMEDIATELY — never batch, never let the rendered plan lag\nbehind reality. Add newly discovered steps the moment they surface\ninstead of waiting for the next pass. Step text encodes WHERE / WHY\n(which criterion it advances) / HOW / VERIFY:\n`path: <action> for <criterion> — verify by <check>`.\nALWAYS add a cleanup todo AT CREATION for each worktree, cache directory (including\nthe run root), and QA resource (PID, tmux session, browser context, port, container,\nscript or temp path); complete it only after a read-back teardown receipt.\n\nGOOD pair (ordered):\n `test/foo.test.ts: read the validateEmail cases for criterion 2 — verify by noting intent / coverage / pass in the notepad`\n `src/foo/bar.ts: Implement validateEmail() RFC-5322-lite for criterion 2 — verify by curl 400 body + foo.test.ts green`\nBAD: "Implement feature" / "Fix bug" / "Add tests later" → rewrite.\n\n# Finding things (lead with these, code-mode the first wave)\nNever guess from memory — locate with the right tool, and re-read before\nyou claim or change. **USE CODE MODE AGGRESSIVELY FOR BOUNDED WAVES.**\nWhen multiple independent tool calls produce results that can be materially\nfiltered, joined, deduplicated, or reduced, make ONE `exec` / eval JavaScript\nprogram that calls eligible tools concurrently with `Promise.all` and emits only\ndecision-relevant evidence. For shell-native repo work without programmatic\ntool access, use ONE Python script with `concurrent.futures`, `subprocess`,\nand utility functions to batch commands and reduce output. Keep direct calls\nwhen one result chooses the next action, outputs are already small, semantic\njudgment is required between calls, approval or side effects are involved,\nor native artifacts / citations must be preserved.\n- Architecture / flow / blast radius → explore agents plus LSP references\n and impact; do not guess from conventions.\n- **SYMBOLS REQUIRE LSP** — definitions, references, rename impact,\n workspace symbols, and diagnostics use the available `lsp_*` tools, not\n text search. Run diagnostics after edits and treat errors as blocking.\n- Repo text / filenames / history / bounded shell output → `rg`,\n `rg --files`, `git`, and native utilities; narrow output in-program.\n- Structural call / function / class / import shapes and codemods → the\n `ast-grep` skill or `sg` with `$VAR` / `$$$` metavariables.\nWhen discovery needs multiple angles or the module layout is\nunfamiliar, delegate to the `explorer` subagent (read-only codebase\nsearch, absolute-path results). For research that leaves the repo —\nlibrary/API/docs/web — delegate to the `librarian` subagent. Spawn them\n`fork_context: false` and keep doing root work while they run.\n\n# Execution loop (READ → CHANGE → RUN → CLEAN)\nUntil every success criterion PASSES with its evidence captured:\n1. Pick next criterion → mark in_progress → update notepad `## Now`.\n2. READ what already proves the area BEFORE touching it. Existing\n tests are the behavior of record: note in the notepad whether they\n encode the intended behavior, cover the path you change, and pass.\n One WRONG before your change is a FINDING to report — NEVER edit a\n test green. A bug: reproduce it first and capture the failure. A\n refactor: the existing tests are green on the unchanged code first.\n3. CHANGE: the SMALLEST production change that meets the criterion;\n update the tests your change makes stale. Add a test ONLY when\n BOTH hold: the repository keeps tests for this behavior AND a\n regression would otherwise pass unnoticed by the run and the\n existing tests — sized like its neighbors, one case per stated\n behavior, failing when that behavior breaks. A test that restates\n the change (a constant, a string, a rename, a call) is NOT evidence;\n the run is. Coverage-only work (no production change): break the\n behavior each new assertion names, capture it failing, restore — an\n assertion that stays green under its mutation is not coverage.\n PROSE TARGET (prompt, SKILL.md, rule, markdown): the wording is NOT\n the behavior — pin only a machine-consumed value (parsed field,\n sentinel a hook greps, a JSON sample through its validator) or one\n `toBe` equality between shipped copies; otherwise review + QA-by-read,\n NO test. Before a change that depends on review, PR, issue, or\n branch state, refresh that state and preserve existing ordering/policy.\n4. RUN: the real-surface scenario the criterion named (channel table\n above; auxiliary surface for CLI- or data-shaped criteria), end to\n end, yourself, plus the step-2 tests; a reproduction now passes.\n Paste the artifact path into the notepad.\n5. CLEANUP (PAIRED — NEVER SKIP):\n Before recording QA, tear down owned server PIDs (`kill <pid>`; verify\n `kill -0` fails), tmux sessions (`tmux kill-session -t ulw-qa-<criterion>`; confirm `tmux ls`),\n browsers / sessions (`browser.close()` / `session.stop()`), containers (`docker rm -f`), ports\n (`lsof -i :<port>` empty), QA scripts, temp paths and QA-only env vars.\n Remove QA temp paths inside `$RUN_TMP` per criterion; remove the run root\n and eligible worktrees at task end under Task resources.\n Append the read-back receipt beside the artifact in the notepad.\n No receipt → criterion stays in_progress.\n6. Verify: LSP diagnostics clean on changed files; no test skipped or\n xfail-ed this turn.\n7. Mark completed. Append non-obvious findings / learnings.\n8. Evidence stays valid per target until an input changes; record with\n each artifact the commit and what it exercised. After each increment\n rerun what moved — the tests of every touched file and of the files\n that import it, the scenarios that exercise them, anything whose\n dependencies or environment changed — and cite the capture for the\n rest. The full set (scenarios, suite, typecheck, build) runs once\n more right before the final message. Record PASS/FAIL beside each\n artifact. Loop until all PASS.\n\nWithin a step, follow Finding things; READ before CHANGE, never in\nparallel with it.\n\n# Waiting discipline (a poll costs a full model round)\nEvery status check you issue as a tool call replays the entire\naccumulated context through the model. When a command will run long\n(installs, builds, test suites, containers, CI), run it to completion\nin ONE call with a timeout sized to the expected duration, or send\noutput to a log file and read it once when a completion signal is\nexpected. Never re-poll the same surface with empty reads or\nsub-minute waits — batch waiting into the fewest, longest blocking\ncalls the harness allows, and do independent root work while the\ncommand runs. If two consecutive checks show no state change, double\nthe wait before the next check or switch to a completion signal.\n\n# Codex subagent reliability\nEvery `multi_agent_v1.spawn_agent` message is self-contained and starts with\n`TASK: <imperative assignment>`, then names `DELIVERABLE`, `SCOPE`,\n`VERIFY`, and `STOP WHEN` — the observable condition that ends the\nchild\'s run; a child without a stop condition wanders past its goal.\nState that it is an executable assignment, not a context handoff. Use `fork_context: false` unless full history is truly\nrequired; paste only the context the child needs. Full-history forks can\nmake the child continue old parent context instead of the delegated task.\nIf your tool list has a flat `spawn_agent` with a required `task_name` instead of `multi_agent_v1.*` (`multi_agent_v2`), rewrite: `fork_context: false` becomes `fork_turns: "none"`, `send_input` becomes `send_message`, finished agents end on their own (no `close_agent`; `followup_task` re-tasks, `interrupt_agent` stops), and `wait_agent` takes only `timeout_ms`, returning on any child mailbox activity.\n\n# TOML-backed subagent routing compatibility\nInspect the ACTUAL spawn tool schema, not a version or namespace assumption.\nWhen `agent_type` is exposed (V1 or V2), EVERY spawn MUST pass an exact\nLazyCodex role: `explorer`, `librarian`, `plan`, `metis`, `momus`,\n`lazycodex-worker-low`, `lazycodex-worker-medium`, `lazycodex-worker-high`,\n`lazycodex-code-reviewer`, `lazycodex-qa-executor`, `lazycodex-gate-reviewer`,\nor `lazycodex-clone-fidelity-reviewer`. Map implementation difficulty to\nworker low/medium/high; their installed TOMLs supply model and instructions.\nNever select generic `worker`/`default` or describe a role instead of selecting it.\nUse `fork_turns: "none"` on V2 or `fork_context: false` on V1 unless full\nhistory is deliberately required; even a deliberate fork MUST name its role.\n\nLegacy-schema exception: ONLY when `agent_type` is absent, omit that unsupported\nfield and carry the role, difficulty, and complete instructions in `message`;\nexplicitly disable history. This cannot select a specialized TOML. The managed\n`default` supplies the medium worker for unnamed non-forks, unless opted out or\nblocked by a preserved user default. The spawn guard cannot see the schema and\nrejects unnamed requests: report incompatible routing, do not retry generically.\nAn unnamed full-history fork skips role application inside Codex; no LazyCodex\nconfig can fix that upstream gap. Never claim this path has been repaired.\nDifficulty (model power) is orthogonal to LIGHT/HEAVY rigor (process size).\n\nTreat child status as a progress signal, not a timeout counter. For\nwork likely to exceed one wait cycle, tell the child to send\n`WORKING: <task> - <current phase>` before long reading, testing, or\nreview passes, and `BLOCKED: <reason>` only when it cannot progress.\nTrack spawned agent names locally. Use `multi_agent_v1.wait_agent` for mailbox\nsignals, but a timeout only means no new mailbox update arrived.\nTreat a running child as alive and keep doing independent root work.\nFallback only when the child is completed without the\ndeliverable, ack-only, or no longer running. If that followup is still\nsilent or ack-only, record the result as inconclusive, do not count it\nas approval/pass, close it if safe, and respawn a smaller\n`fork_context: false` task with the missing deliverable.\n\n# Subagent-dependent transition barrier\nDo not mark an `update_plan` step `completed` while an active child owns\nevidence for that step. Do not start dependent implementation until the\naudit, research, or review result is integrated or explicitly recorded\nas inconclusive. Do not generate a plan before spawned research lanes\nthat feed the plan have returned or been closed as inconclusive.\nSpawn every independent child for the current wave first. After the wave\nis launched, run `multi_agent_v1.wait_agent` for each spawned child until\neach reaches terminal status (`completed`, `failed`, `blocked`, or\nexplicitly recorded inconclusive) before any dependent `update_plan`\ntransition, `create_goal` continuation, implementation tool call, plan\ndrafting, approval-gate work, PR handoff, or final response. A timeout is\nnot terminal status.\nDo not write the final answer, PR handoff, or completion summary while\nactive child agents remain open. Use `multi_agent_v1.wait_agent` cycles with growing timeouts: start short (~30s) and double up to ~5 minutes.\nAfter two silent waits send `TASK STILL ACTIVE: return <deliverable> or\nBLOCKED: <reason>`. After four silent or ack-only checks, close the lane as\ninconclusive, record that it is not approval, and respawn smaller only\nif the deliverable is still required.\n\n# Verification gate (TRIGGERED ONLY ON EXPLICIT DEMAND)\n\nTrigger ONLY when the user explicitly demanded strict, rigorous, proper,\nor high-accuracy review of this work, in any language (for example,\n고정밀 or 엄격). The tier alone never triggers the gate. HEAVY without\nsuch a demand records the same self-review as LIGHT.\nLIGHT and non-triggered HEAVY work records a self-review in the notepad\ninstead: re-read the diff, run diagnostics, confirm each criterion\'s\nevidence, and state in one line why the tier held.\n\nWhen triggered, follow this procedure (NON-NEGOTIABLE):\n1. Spawn a child with `fork_context: false` and a self-contained reviewer\n assignment in `message`. The `multi_agent_v1.spawn_agent` schema cannot select a\n TOML-backed reviewer role, so paste the reviewer requirements into\n the message.\n Pass: goal, success-criteria, scenario evidence, full diff, notepad\n path.\n2. Verify each reviewer concern yourself. A concern blocks only when\n it names a success criterion the evidence fails; record concerns\n that cite no criterion as notes with a one-line reason — fixed or\n declined at your judgment.\n3. Fix every criterion-cited blocker; rerun per Execution loop step 8\n and update the notepad.\n4. Spawn a NEW reviewer for each re-review, at most twice, passing only\n the delta diff, the blockers the last one cited, and the\n already-approved criteria marked out-of-scope. An approval whose only\n remaining items are notes counts as approval.\n5. On approval, declare done. If criterion-cited blockers remain after\n two re-reviews, stop and surface them to the user (mirroring the\n 2-attempt stop rule below) — do not loop further.\n\n# Commits\nCommit frequently: one atomic commit per verified increment (change +\nits evidence), never one end-of-run omnibus; each commit builds +\ntests green on its own; no WIP on the final branch.\nBEFORE composing each message, read the history and mimic it: run\n`git log --oneline -20` plus `git log -5 -- <touched paths>` and match\nthe observed convention — subject shape, scope names, message language,\nbody style, and typical commit size. Default to Conventional Commits\n(`<type>(<scope>): <imperative>` — feat / fix / refactor / test / docs /\nchore / build / ci / perf) only where history shows no stronger local\nconvention. If a plan file exists, final commit footer:\n`Plan: .omo/plans/<slug>.md`. Skip committing only when the user forbade\ncommits this session — then stage + draft the message instead.\n\n# Constraints\n- Every behavior change is PROVEN BY ITS RUN on the real surface, with\n the tests the repository keeps for it green. A test that cannot fail\n for the regression it names is NOT evidence: mock-call assertions,\n pinned constants, a fixture equal to the default it must override,\n an expected value re-derived from the output under test.\n- Make the smallest correct change per unit, and fix in THIS run every\n defect inside the change\'s blast radius — the request not delivered,\n a regression this change introduces, an invalid proof, a failing test\n or stale doc of code you touched — as registered work (todo plus\n success criterion) to the ideal state. A defect outside it gets a\n tracked issue with reproduction and evidence and a line in the final\n message; a deferral never turns a criterion into PASS. Keep delegated\n unit scope hard: the worker reports, the orchestrator registers or\n files.\n- Never suppress lints / errors / test failures. Never delete, skip,\n `.only`, `.skip`, `xfail`, or comment out tests to green the suite.\n- Never claim done from inference — only from captured evidence.\n\n# Output discipline\n- First line literally: `ULTRAWORK MODE ENABLED!`\n- After bootstrap: 1-2 paragraph plan summary + notepad path.\n- During execution: at every handoff - todo phase change, blocker,\n plan change, before a long pass - one handoff block composed after\n weighing what the user asked and needs to know now:\n `[Outcome so far] toward [ask + wanted]. You need: [ledger,\n evidence paths, PASS/FAIL, reviewer verdict]. Now: [todo in\n progress]. Next: [next open todo].`; nothing between handoffs.\n- Final message: outcome + success-criteria checklist with evidence\n refs + notepad path + reviewer approval (if gate triggered) + commit\n list (`<sha> <subject>`). No file-by-file changelog unless asked.\n\n# Stop rules\n- After each result, ask whether the user\'s core request can now be\n answered with useful evidence in hand. If yes, answer now — skip any\n remaining retrieval, ceremony, or verification that adds no evidence.\n- The STOP GOAL: every scenario PASSES with captured evidence, every\n cleanup receipt is recorded, notepad is current, and (if gate\n triggered) reviewer approved unconditionally. Above ALL of that, the\n decisive test — outranking every other consideration — is: are the\n completion conditions FUNDAMENTALLY fulfilled, is the user\'s problem\n ACTUALLY SOLVED in observable behavior? If no, you are NOT done,\n whatever the ledger says. If yes, deliver the final message and STOP\n — no hesitation, no extra verification pass, no polish loop. Work\n past the stop goal is scope creep, not diligence.\n- Leftover QA state (live process, `tmux` session, browser context,\n bound port, temp file / dir) means NOT done. Tear it down, record\n the receipt, then continue.\n- After 2 identical failed attempts at one step, surface what was tried\n and ask the user before another retry.\n- A permission denial or a refusal by the user is not a blocker to work\n around: it is final for what that call was meant to do. Never reach that\n result with another tool, command, path or host; ask the user.\n- After 2 parallel exploration waves yield no new useful facts, stop\n exploring and act.\n\n</ultrawork-mode>\n';
diff --git a/plugins/omo/components/ulw-execute-continuation/directive.md b/plugins/omo/components/ulw-execute-continuation/directive.md
index f84cf0e5..32e76131 100644
--- a/plugins/omo/components/ulw-execute-continuation/directive.md
+++ b/plugins/omo/components/ulw-execute-continuation/directive.md
@@ -40,7 +40,7 @@ You are mid-flight on a Prometheus work plan; this turn is an automatic continua
# Final gate
-Before completion, run your own manual QA on the real surface and a self-review against every acceptance criterion; spawn ONE gate reviewer only when the user demanded strict/rigorous/high-accuracy review; run a `debugging` runtime audit only when a failure was observed. Record the observable evidence under `{{LEDGER_PATH}}`; when a reviewer is spawned, it is allowed at most once per sub-task. Do not create a PR, PR handoff, branch handoff, merge, or final completion answer until this gate passes. For PR/branch work, stay in the task-owned worktree: create/update the PR, wait for CI/review/Cubic gates, merge by default unless explicitly opted out, then clean up. After the gate and lifecycle pass, mark the Boulder work completed before the final answer. Redact secrets, tokens, credentials, auth headers, cookies, env dumps, logs, and PII. Honor the delivery mode recorded in the goal/ledger at session start: `--make-pr` hands off with the PR URL after the PR opens (merge only on explicit user ask); `--ship` keeps working until the PR is MERGED - CI and review gates fixed and addressed - then removes the worktree and syncs `.omo/` state back.
+Before completion, run your own manual QA on the real surface and a self-review against every acceptance criterion; spawn ONE gate reviewer only when the user demanded strict/rigorous/high-accuracy review; run a `debugging` runtime audit only when a failure was observed. Record the observable evidence under `{{LEDGER_PATH}}`; when a reviewer is spawned, it is allowed at most once per sub-task. Do not create a PR, PR handoff, branch handoff, merge, or final completion answer until this gate passes. For PR/branch work, stay in the task-owned worktree: create/update the PR and wait for CI/review/Cubic gates; under `--ship` merge per the repository's merge policy, under `--make-pr` hand off with the PR URL and merge only if the user asks, then clean up after that merge or handoff. After the gate and lifecycle pass, mark the Boulder work completed before the final answer. Redact secrets, tokens, credentials, auth headers, cookies, env dumps, logs, and PII. Honor the delivery mode recorded in the goal/ledger at session start: `--make-pr` hands off with the PR URL after the PR opens (merge only on explicit user ask); `--ship` keeps working until the PR is MERGED - CI and review gates fixed and addressed - then removes the worktree and syncs `.omo/` state back.
# Stop conditions for THIS turn
diff --git a/plugins/omo/components/ulw-execute-continuation/hooks/hooks.json b/plugins/omo/components/ulw-execute-continuation/hooks/hooks.json
index 83f70665..4e78181b 100644
--- a/plugins/omo/components/ulw-execute-continuation/hooks/hooks.json
+++ b/plugins/omo/components/ulw-execute-continuation/hooks/hooks.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/ulw-execute-continuation/dist/cli.js\" hook stop",
"timeout": 10,
- "statusMessage": "(OmO 5.1.62) Checking Ulw-Execute Continuation"
+ "statusMessage": "(OmO 5.1.63) Checking Ulw-Execute Continuation"
}
]
}
diff --git a/plugins/omo/components/ulw-execute-continuation/package.json b/plugins/omo/components/ulw-execute-continuation/package.json
index 0974c783..439403cc 100644
--- a/plugins/omo/components/ulw-execute-continuation/package.json
+++ b/plugins/omo/components/ulw-execute-continuation/package.json
@@ -1,6 +1,6 @@
{
"name": "@code-yeongyu/codex-ulw-execute-continuation",
- "version": "5.1.62",
+ "version": "5.1.63",
"description": "Codex Stop hook continuation injector for omo-codex ulw-execute plans.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/components/ulw-loop/directive.md b/plugins/omo/components/ulw-loop/directive.md
index 02ef1037..d13d08a4 100644
--- a/plugins/omo/components/ulw-loop/directive.md
+++ b/plugins/omo/components/ulw-loop/directive.md
@@ -112,6 +112,8 @@ Before the first task command, create one `RUN_TMP=$(mktemp -d)` per task, track
At task end, after owned processes exit, remove only owned directories, including runtime caches. Never wipe shared caches; retain worktrees still needed by open PRs and any parent directory containing them.
## 0. Survey the skills, gather context, then size the work
+This section records into the notepad, so run section 2's `NOTE=`
+command first; section 2 then initialises that same file.
First, survey the loaded skill list and read the description of each
loosely relevant skill. Decide explicitly which skills this task will
use and prefer using every genuinely applicable one — name them in the
diff --git a/plugins/omo/components/ulw-loop/hooks/hooks.json b/plugins/omo/components/ulw-loop/hooks/hooks.json
index 711c72f6..6cf8dffa 100644
--- a/plugins/omo/components/ulw-loop/hooks/hooks.json
+++ b/plugins/omo/components/ulw-loop/hooks/hooks.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook user-prompt-submit --with-ultrawork",
"timeout": 10,
- "statusMessage": "(OmO 5.1.62) Checking Ulw-Loop Steering"
+ "statusMessage": "(OmO 5.1.63) Checking Ulw-Loop Steering"
}
]
}
@@ -20,7 +20,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-tool-use-spawn",
"timeout": 5,
- "statusMessage": "(OmO 5.1.62) Recording Spawn Admission"
+ "statusMessage": "(OmO 5.1.63) Recording Spawn Admission"
}
]
}
@@ -33,7 +33,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook pre-tool-use",
"timeout": 5,
- "statusMessage": "(OmO 5.1.62) Enforcing Unlimited Ulw-Loop Budget"
+ "statusMessage": "(OmO 5.1.63) Enforcing Unlimited Ulw-Loop Budget"
}
]
},
@@ -44,7 +44,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook pre-tool-use-spawn",
"timeout": 5,
- "statusMessage": "(OmO 5.1.62) Guarding Ulw-Loop Spawns"
+ "statusMessage": "(OmO 5.1.63) Guarding Ulw-Loop Spawns"
}
]
}
@@ -56,7 +56,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook stop",
"timeout": 10,
- "statusMessage": "(OmO 5.1.62) Checking Ulw-Loop Resume"
+ "statusMessage": "(OmO 5.1.63) Checking Ulw-Loop Resume"
}
]
}
diff --git a/plugins/omo/components/ulw-loop/package.json b/plugins/omo/components/ulw-loop/package.json
index 187fab06..c6318bfd 100644
--- a/plugins/omo/components/ulw-loop/package.json
+++ b/plugins/omo/components/ulw-loop/package.json
@@ -1,6 +1,6 @@
{
"name": "@code-yeongyu/codex-ulw-loop",
- "version": "5.1.62",
+ "version": "5.1.63",
"description": "Codex plugin: durable repo-native multi-goal orchestration with embedded success criteria and observable evidence audit.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/components/ulw-loop/skills/ulw-loop/SKILL.md b/plugins/omo/components/ulw-loop/skills/ulw-loop/SKILL.md
index e1d19fa7..4a17c9f8 100644
--- a/plugins/omo/components/ulw-loop/skills/ulw-loop/SKILL.md
+++ b/plugins/omo/components/ulw-loop/skills/ulw-loop/SKILL.md
@@ -45,7 +45,7 @@ Stand up a team when BOTH hold:
1. **The units' scopes overlap in a way you cannot cleanly cut.** They touch the same module, contract, or migration, so one unit's discovery changes what another should do. Fire-and-forget workers cannot exchange that mid-flight; teammates can, because the lead relays it.
2. **Running them at the same time actually finishes sooner.** The units are each substantial and none is merely waiting on another's output. Two units where the second only consumes the first's result are a sequence, not a team.
-When the units are genuinely independent — separate files, no shared contract — spawn parallel background `task` workers instead and avoid the team coordination overhead entirely. When the work is one cohesive unit, do it yourself. Overlap alone is not enough: near-identical units that would collide on the same lines are faster done in sequence by one worker.
+When the units are genuinely independent — separate files, no shared contract — spawn parallel background `task` workers instead and avoid the team coordination overhead entirely. When the work is one cohesive unit, keep it in this session - delegating only the code edits, test writes, fixes, and QA executions the rule above requires. Overlap alone is not enough: near-identical units that would collide on the same lines are faster done in sequence by one worker.
Under team mode, isolate and land per unit:
diff --git a/plugins/omo/components/ulw-loop/skills/ulw-loop/references/define-goal.md b/plugins/omo/components/ulw-loop/skills/ulw-loop/references/define-goal.md
index 688a9a07..1cd6e2c7 100644
--- a/plugins/omo/components/ulw-loop/skills/ulw-loop/references/define-goal.md
+++ b/plugins/omo/components/ulw-loop/skills/ulw-loop/references/define-goal.md
@@ -87,7 +87,7 @@ Repaired: "Resolve every open change-requesting review comment on PR 123 touchin
| an active goal conflicting with this intent | Stop and surface the conflict; the user decides whether to finish it, complete it, or branch. |
2. Goals are unlimited. Never invent a numeric budget, token limit, or deadline the user did not state — that ban covers run quotas; the `assumed:` work constraints from Objective anatomy #4 are different and required.
-3. In a ulw-loop run, the loop CLI owns per-goal state (`.omo/ulw-loop/goals.json`): `create_goal` registers the aggregate objective from the printed handoff, and this reference shapes both that objective and every goal's `successCriteria` at `create-goals` time.
+3. In a ulw-loop run, the loop SDK owns per-goal state (`.omo/ulw-loop/<session-id>/goals.json`): `create_goal` registers the aggregate objective from the handoff create-goals returns, and this reference shapes both that objective and every goal's `successCriteria` at `create-goals` time.
## Completion honesty
diff --git a/plugins/omo/components/ulw-loop/skills/ulw-loop/references/full-workflow.md b/plugins/omo/components/ulw-loop/skills/ulw-loop/references/full-workflow.md
index b6ea1dea..7882c423 100644
--- a/plugins/omo/components/ulw-loop/skills/ulw-loop/references/full-workflow.md
+++ b/plugins/omo/components/ulw-loop/skills/ulw-loop/references/full-workflow.md
@@ -10,7 +10,7 @@ Expert goal orchestration agent. You conduct; right-sized subagents play. Plan d
Use GPT-5.x style: outcome-first, evidence-bound, atomic decisions, no nested branching prose.
## Goal
-Deliver every goal in `.omo/ulw-loop/goals.json` end-to-end.
+Deliver every goal in `.omo/ulw-loop/<session-id>/goals.json` end-to-end.
Prove EVERY success criterion with captured observable evidence from a real-usage scenario you ran (HTTP / tmux / browser / computer-use below).
TESTS ALONE NEVER PROVE DONE. A green test suite is supporting evidence, not completion proof.
Audit each pass, fail, block, steering change, and checkpoint in `.omo/ulw-loop/<session-id>/ledger.jsonl`.
@@ -24,8 +24,8 @@ Run each criterion's real-surface proof yourself through the channel that faithf
4. **Computer use** — for desktop/GUI apps, drive the running app via OS automation (computer-use, AppleScript, xdotool, etc.); capture action log + screenshot.
For TUI visual QA (mandatory when a PR or review must inspect the terminal screen),
-run `node script/qa/web-terminal-visual-qa.mjs --command "<cmd>" --input "{Enter}"
---evidence-dir <dir>` (live pty + xterm.js in Chrome; `--from-file` replays a raw
+run `node script/qa/web-terminal-visual-qa.mjs --title "<surface>" --command "<cmd>"
+--input "{Enter}" --evidence-dir <dir>` (live pty + xterm.js in Chrome; `--from-file` replays a raw
stream) and record `terminal.png`, `terminal.txt`, and `metadata.json`.
Auxiliary surfaces (CLI stdout / DB state diff / parsed config dump) are first-class evidence for CLI- or data-shaped criteria; use a channel scenario when the behavior is user-facing. `--dry-run`, printing the command, "should respond", and "looks correct" never count.
@@ -62,9 +62,9 @@ Codex subagent reliability:
- Fallback only when the child is completed without the deliverable, ack-only after `followup_task`, explicitly `BLOCKED:`, or no longer running. Then send `TASK STILL ACTIVE: return <deliverable> or BLOCKED: <reason>` via `followup_task` when it can still recover the lane; otherwise record inconclusive, do not count it as pass/review approval, stop it if safe, and respawn a smaller `fork_turns: "none"` task with the missing deliverable.
## Artifacts
-- `.omo/ulw-loop/brief.md`: original brief and durable constraints.
-- `.omo/ulw-loop/goals.json`: goals with embedded `successCriteria` per goal.
-- `.omo/ulw-loop/ledger.jsonl`: append-only audit trail.
+- `.omo/ulw-loop/<session-id>/brief.md`: original brief and durable constraints.
+- `.omo/ulw-loop/<session-id>/goals.json`: goals with embedded `successCriteria` per goal.
+- `.omo/ulw-loop/<session-id>/ledger.jsonl`: append-only audit trail.
- Read artifacts before resuming, steering, or checkpointing.
- After compaction or context loss, re-read brief + goals + ledger FIRST, then `omo-agent-toolkit ulw-loop status --json`. Recover from artifacts; never re-plan from scratch or repeat completed work.
- Never invent state outside `.omo/ulw-loop` artifacts or `omo-agent-toolkit ulw-loop status --json`.
@@ -152,7 +152,7 @@ Loop per goal. Cap at 5 cycles per goal. Cap identical same-criterion failures a
| get_goal result | action |
|-----------------|--------|
-| no active goal | You MUST call `create_goal` — goal registration goes through the tool, never prose — with objective only from `instruction.json.objective`; do not copy lifecycle fields such as `status`. |
+| no active goal | You MUST call `create_goal` — goal registration goes through the tool, never prose — with objective only from the handoff's rendered `create_goal` payload; do not copy lifecycle fields such as `status`. |
| same aggregate objective active | Continue the current ulw-loop story. |
| different goal active | STOP. Checkpoint blocked and surface the conflict. |
4. If retrying failed work, run `omo-agent-toolkit ulw-loop complete-goals --retry-failed --json`.
@@ -190,11 +190,11 @@ omo-agent-toolkit ulw-loop status --json
# Read nextActions and currentAttemptDir.
omo-agent-toolkit ulw-loop record-evidence --goal-id <g> --criterion-id <c> --status pass --evidence "..."
# Repeat record-evidence once per criterion.
-# Then use the harness update_goal tool with status complete.
omo-agent-toolkit ulw-loop checkpoint --goal-id <g> --print-template --json
# Fill the printed template: replace every placeholder and use real artifact paths under currentAttemptDir.
# codex-goal-json.goal.objective must equal the plan's codexObjective verbatim.
omo-agent-toolkit ulw-loop checkpoint --goal-id <g> --status complete --evidence "..." --codex-goal-json <path> --quality-gate-json <path>
+# Only after that gated checkpoint succeeds, use the harness update_goal tool with status complete.
omo-agent-toolkit ulw-loop complete-goals
```
@@ -206,7 +206,7 @@ Trigger only for the final aggregate goal after every criterion in every goal is
2. FREEZE first — no more edits or rebases. At the frozen HEAD, re-run Manual-QA for any PASS criterion whose stamped tree differs from `git rev-parse --short "HEAD^{tree}"`, so every criterion is proven on the frozen tree; each artifact exists and is non-empty.
3a. Spawn lazycodex-code-reviewer and lazycodex-qa-executor in parallel (`fork_context: false` on v1; `fork_turns: "none"` on v2) with brief, goals, desired outcome, diff, evidence; wait for BOTH and confirm their report artifacts exist on disk.
3b. Only then spawn lazycodex-gate-reviewer with those artifact paths.
-3c. The gate's approval binds to the frozen tree and full commit SHA and covers its three lanes — code quality, hands-on QA, and goal verification. Immediately append one durable `.omo/ulw-loop/ledger.jsonl` record per passing lane with the lane name, full SHA, verdict, and report artifact/source. Before reuse after continuation or compaction, re-read the ledger and require the exact lane/SHA pair; memory or an unstamped report is not coverage. A later rebase or amend that keeps the tree identical still has a new SHA and needs fresh lane stamps; changed content needs fresh review of the delta.
+3c. The gate's approval binds to the frozen tree and full commit SHA and covers its three lanes — code quality, hands-on QA, and goal verification. Immediately append one durable `.omo/ulw-loop/<session-id>/ledger.jsonl` record per passing lane with the lane name, full SHA, verdict, and report artifact/source. Before reuse after continuation or compaction, re-read the ledger and require the exact lane/SHA pair; memory or an unstamped report is not coverage. A later rebase or amend that keeps the tree identical still has a new SHA and needs fresh lane stamps; changed content needs fresh review of the delta.
4. Treat timeout, missing deliverable, ack-only, `BLOCKED:`, or inconclusive review as a blocker. Any fix restarts the freeze at the new HEAD: re-run ONLY the proofs it invalidated and stamp the fresh output — never regenerate all evidence or relabel stale output to HEAD — re-review the delta at most TWICE; then record-review-blockers (step 5) and surface to the user.
5. If review remains blocked, run `omo-agent-toolkit ulw-loop record-review-blockers --goal-id <id> --title "<...>" --objective "<...>" --evidence "<review findings>" --codex-goal-json <snapshot> --json`.
6. If clean, checkpoint final completion:
@@ -251,7 +251,7 @@ Structured prompt directives accepted: `OMO_ULW_LOOP_STEER: { ... }`, `omo.ulw-l
3. Evidence is bound to the tree it was captured at; changed tracked content invalidates it — re-run the QA at the current HEAD and re-record (an identical tree after rebase/amend stays valid). NEVER mark PASS from memory, and NEVER relabel, pin, refresh, or regenerate prior output to a moved HEAD.
4. NEVER bypass the criteria gate: non-final aggregate completion requires all essential criteria; final aggregate completion requires all criteria across the whole plan.
5. Baseline build/lint/typecheck/test commands are necessary evidence, NOT SUFFICIENT completion proof. Criteria coverage with observable evidence is the gate.
-6. Treat `.omo/ulw-loop/ledger.jsonl` as the durable audit trail; checkpoint after every success or failure.
+6. Treat `.omo/ulw-loop/<session-id>/ledger.jsonl` as the durable audit trail; checkpoint after every success or failure.
7. Per-story Codex goal mode is opt-in only with `--codex-goal-mode per-story`; default is aggregate.
8. Structured steering directives mutate state through validation; normal prose does not.
9. Evidence MUST be observable from the real surface per the Manual-QA channel table — never a printed command, `--dry-run`, or "looks correct".
diff --git a/plugins/omo/dist/cli-node/index.js b/plugins/omo/dist/cli-node/index.js
index 5c0c5b18..14e24963 100755
--- a/plugins/omo/dist/cli-node/index.js
+++ b/plugins/omo/dist/cli-node/index.js
@@ -2133,7 +2133,7 @@ var package_default;
var init_package = __esm(() => {
package_default = {
name: "oh-my-opencode",
- version: "5.1.62",
+ version: "5.1.63",
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
main: "./dist/index.js",
types: "dist/index.d.ts",
@@ -2385,18 +2385,18 @@ var init_package = __esm(() => {
typescript: "^7.0.2"
},
optionalDependencies: {
- "oh-my-opencode-darwin-arm64": "5.1.62",
- "oh-my-opencode-darwin-x64": "5.1.62",
- "oh-my-opencode-darwin-x64-baseline": "5.1.62",
- "oh-my-opencode-linux-arm64": "5.1.62",
- "oh-my-opencode-linux-arm64-musl": "5.1.62",
- "oh-my-opencode-linux-x64": "5.1.62",
- "oh-my-opencode-linux-x64-baseline": "5.1.62",
- "oh-my-opencode-linux-x64-musl": "5.1.62",
- "oh-my-opencode-linux-x64-musl-baseline": "5.1.62",
- "oh-my-opencode-windows-arm64": "5.1.62",
- "oh-my-opencode-windows-x64": "5.1.62",
- "oh-my-opencode-windows-x64-baseline": "5.1.62"
+ "oh-my-opencode-darwin-arm64": "5.1.63",
+ "oh-my-opencode-darwin-x64": "5.1.63",
+ "oh-my-opencode-darwin-x64-baseline": "5.1.63",
+ "oh-my-opencode-linux-arm64": "5.1.63",
+ "oh-my-opencode-linux-arm64-musl": "5.1.63",
+ "oh-my-opencode-linux-x64": "5.1.63",
+ "oh-my-opencode-linux-x64-baseline": "5.1.63",
+ "oh-my-opencode-linux-x64-musl": "5.1.63",
+ "oh-my-opencode-linux-x64-musl-baseline": "5.1.63",
+ "oh-my-opencode-windows-arm64": "5.1.63",
+ "oh-my-opencode-windows-x64": "5.1.63",
+ "oh-my-opencode-windows-x64-baseline": "5.1.63"
},
overrides: {
hono: "^4.13.8",
@@ -7340,7 +7340,34 @@ var init_which = __esm(() => {
});
// packages/utils/src/runtime/file.ts
-var init_file = () => {};
+import { access, readFile, unlink, writeFile } from "node:fs/promises";
+function createNodeFile(path) {
+ return {
+ text() {
+ return readFile(path, "utf8");
+ },
+ async arrayBuffer() {
+ const buffer = await readFile(path);
+ return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
+ },
+ exists() {
+ return access(path).then(() => true, () => false);
+ },
+ delete() {
+ return unlink(path);
+ }
+ };
+}
+function bunFile(path) {
+ const bun = runtime3.Bun;
+ if (bun)
+ return bun.file(path);
+ return createNodeFile(path);
+}
+var runtime3;
+var init_file = __esm(() => {
+ runtime3 = globalThis;
+});
// packages/utils/src/runtime/git-bash.ts
import { execFileSync } from "node:child_process";
@@ -12284,7 +12311,9 @@ var init_zip_extractor = __esm(() => {
});
// packages/omo-opencode/src/shared/bun-file-shim.ts
-var init_bun_file_shim = () => {};
+var init_bun_file_shim = __esm(() => {
+ init_runtime();
+});
// packages/omo-opencode/src/shared/binary-downloader.ts
import { chmodSync, existsSync as existsSync9, mkdirSync as mkdirSync4, unlinkSync as unlinkSync3 } from "node:fs";
@@ -92789,7 +92818,7 @@ var package_default2;
var init_package2 = __esm(() => {
package_default2 = {
name: "@oh-my-opencode/omo-codex",
- version: "5.1.62",
+ version: "5.1.63",
type: "module",
private: true,
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
@@ -93405,7 +93434,7 @@ var init_check_for_update = __esm(() => {
});
// packages/omo-opencode/src/hooks/auto-update-checker/checker/sync-package-json.ts
-import * as crypto from "node:crypto";
+import * as crypto2 from "node:crypto";
import * as fs8 from "node:fs";
import * as path11 from "node:path";
function safeUnlink(filePath) {
@@ -93429,7 +93458,7 @@ function getPackageNameFromIntent(pluginInfo) {
return ACCEPTED_PACKAGE_NAMES2.find((packageName) => pluginInfo.entry === packageName || pluginInfo.entry.startsWith(`${packageName}@`)) ?? PACKAGE_NAME3;
}
function writeCachePackageJson(cachePackageJsonPath, pkgJson) {
- const tmpPath = `${cachePackageJsonPath}.${crypto.randomUUID()}`;
+ const tmpPath = `${cachePackageJsonPath}.${crypto2.randomUUID()}`;
try {
fs8.mkdirSync(path11.dirname(cachePackageJsonPath), { recursive: true });
fs8.writeFileSync(tmpPath, JSON.stringify(pkgJson, null, 2));
@@ -94350,7 +94379,7 @@ import { existsSync as existsSync27 } from "node:fs";
import { homedir as homedir7 } from "node:os";
// packages/omo-codex/src/install/codex-cache-bins.ts
-import { chmod, lstat as lstat4, mkdir, readFile as readFile3, readdir as readdir2, readlink as readlink3, rm as rm3, stat as stat2, symlink, writeFile } from "node:fs/promises";
+import { chmod, lstat as lstat4, mkdir, readFile as readFile4, readdir as readdir2, readlink as readlink3, rm as rm3, stat as stat2, symlink, writeFile as writeFile2 } from "node:fs/promises";
import { basename as basename4, isAbsolute as isAbsolute2, join as join26, relative, resolve as resolve6, sep } from "node:path";
// packages/omo-codex/src/install/codex-cache-command-shim.ts
@@ -94394,7 +94423,7 @@ function windowsCommandShim(targetPath) {
}
// packages/omo-codex/src/install/codex-cache-dangling-bins.ts
-import { lstat as lstat2, readFile, readdir, readlink, rm, stat } from "node:fs/promises";
+import { lstat as lstat2, readFile as readFile2, readdir, readlink, rm, stat } from "node:fs/promises";
import { dirname as dirname10, isAbsolute, join as join23, resolve as resolve5 } from "node:path";
// packages/omo-codex/src/install/codex-cache-fs.ts
@@ -94456,7 +94485,7 @@ async function removeDanglingGeneratedCommandShim(linkPath) {
const linkStat = await lstat2(linkPath);
if (!linkStat.isFile())
return;
- const content = await readFile(linkPath, "utf8");
+ const content = await readFile2(linkPath, "utf8");
if (!content.includes(COMMAND_SHIM_MARKER))
return;
const target = extractCommandShimTarget(content);
@@ -94504,7 +94533,7 @@ function hasOmoCodexPluginPrefix(parts, endExclusive) {
}
// packages/omo-codex/src/install/codex-cache-legacy-bins.ts
-import { lstat as lstat3, readFile as readFile2, readlink as readlink2, rm as rm2 } from "node:fs/promises";
+import { lstat as lstat3, readFile as readFile3, readlink as readlink2, rm as rm2 } from "node:fs/promises";
import { join as join24 } from "node:path";
var LEGACY_CODEX_COMPONENT_BINS = [
{ name: "omo", component: "ulw-loop" },
@@ -94539,7 +94568,7 @@ async function removeLegacyCodexComponentBin(linkPath, component, platform) {
}
if (!stat.isFile())
return;
- const content = await readFile2(linkPath, "utf8");
+ const content = await readFile3(linkPath, "utf8");
if (content.includes(COMMAND_SHIM_MARKER))
await rm2(linkPath, { force: true });
} catch (error) {
@@ -94776,7 +94805,7 @@ async function collectPackageBins(directory, root, links) {
}
}
async function appendPackageBinLinks(packageJsonPath, packageRoot, root, links) {
- const packageJson = JSON.parse(await readFile3(packageJsonPath, "utf8"));
+ const packageJson = JSON.parse(await readFile4(packageJsonPath, "utf8"));
if (!isPlainRecord4(packageJson))
return;
const packageName = packageJson.name;
@@ -94828,13 +94857,13 @@ async function replaceSymlink(linkPath, targetPath) {
async function replaceCommandShim(linkPath, targetPath) {
if (await existingNonShim(linkPath))
throw new Error(`${linkPath} already exists and is not a command shim`);
- await writeFile(linkPath, windowsCommandShim(targetPath));
+ await writeFile2(linkPath, windowsCommandShim(targetPath));
}
async function replaceRuntimeWrapper(linkPath, content) {
if (await existingNonRuntimeWrapper(linkPath))
throw new Error(`${linkPath} already exists and is not a generated OMO runtime wrapper`);
await rm3(linkPath, { force: true });
- await writeFile(linkPath, content);
+ await writeFile2(linkPath, content);
}
async function removeGeneratedRuntimeWrapper(path) {
try {
@@ -94852,7 +94881,7 @@ async function removeGeneratedRuntimeWrapper(path) {
}
async function readGeneratedWrapperContent(path) {
try {
- return await readFile3(path, "utf8");
+ return await readFile4(path, "utf8");
} catch (error) {
if (isNodeErrorWithCode(error) && (error.code === "ENOENT" || error.code === "EISDIR"))
return "";
@@ -94866,7 +94895,7 @@ async function existingNonRuntimeWrapper(path) {
return false;
if (!stat.isFile())
return true;
- const content = await readFile3(path, "utf8");
+ const content = await readFile4(path, "utf8");
return !content.includes(RUNTIME_WRAPPER_MARKER);
} catch (error) {
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
@@ -94879,7 +94908,7 @@ async function existingNonShim(path) {
const stat = await lstat4(path);
if (!stat.isFile())
return true;
- const content = await readFile3(path, "utf8");
+ const content = await readFile4(path, "utf8");
if (content.includes(COMMAND_SHIM_MARKER))
return false;
throw new Error(`${path} already exists and is not a generated command shim`);
@@ -94903,11 +94932,11 @@ async function existingNonSymlink(path) {
}
}
// packages/omo-codex/src/install/codex-cache-install.ts
-import { cp as cp3, mkdir as mkdir3, readFile as readFile8, readdir as readdir5, rename as rename2, rm as rm5 } from "node:fs/promises";
+import { cp as cp3, mkdir as mkdir3, readFile as readFile9, readdir as readdir5, rename as rename2, rm as rm5 } from "node:fs/promises";
import { basename as basename5, dirname as dirname13, join as join33, sep as sep6 } from "node:path";
// packages/omo-codex/src/install/codex-cache-bundled-mcps.ts
-import { cp, mkdir as mkdir2, readFile as readFile4, stat as stat3 } from "node:fs/promises";
+import { cp, mkdir as mkdir2, readFile as readFile5, stat as stat3 } from "node:fs/promises";
import { dirname as dirname11, join as join27, resolve as resolve7 } from "node:path";
var BUNDLED_MCP_RUNTIMES = [
{
@@ -94949,7 +94978,7 @@ async function copyBundledMcpRuntimeDist(pluginRoot, sourceRoot, runtime) {
async function readSourceMcpArgs(path) {
let parsed;
try {
- parsed = JSON.parse(await readFile4(path, "utf8"));
+ parsed = JSON.parse(await readFile5(path, "utf8"));
} catch (error) {
if (error instanceof Error)
return new Set;
@@ -94980,7 +95009,7 @@ async function isDirectory(path) {
// packages/omo-codex/src/install/codex-cache-local-dependencies.ts
import { realpathSync as realpathSync7 } from "node:fs";
-import { readFile as readFile5, readdir as readdir3, writeFile as writeFile2 } from "node:fs/promises";
+import { readFile as readFile6, readdir as readdir3, writeFile as writeFile3 } from "node:fs/promises";
import { dirname as dirname12, isAbsolute as isAbsolute4, join as join29, relative as relative3, resolve as resolve9, sep as sep2 } from "node:path";
// packages/omo-codex/src/install/codex-cache-paths.ts
@@ -95046,7 +95075,7 @@ async function rewriteCachedPackageLocalFileDependencies(pluginRoot, sourceRoot)
const packageLock = await readPackageLock(pluginRoot);
let rewroteAnyPackageJson = false;
for (const packageJsonPath of packageJsonPaths) {
- const raw = await readFile5(packageJsonPath, "utf8");
+ const raw = await readFile6(packageJsonPath, "utf8");
const parsed = JSON.parse(raw);
if (!isPlainRecord4(parsed))
continue;
@@ -95081,20 +95110,20 @@ async function rewriteCachedPackageLocalFileDependencies(pluginRoot, sourceRoot)
}
}
if (changed) {
- await writeFile2(packageJsonPath, `${JSON.stringify(parsed, null, "\t")}
+ await writeFile3(packageJsonPath, `${JSON.stringify(parsed, null, "\t")}
`);
rewroteAnyPackageJson = true;
}
}
if (packageLock.changed)
- await writeFile2(packageLock.path, `${JSON.stringify(packageLock.value, null, "\t")}
+ await writeFile3(packageLock.path, `${JSON.stringify(packageLock.value, null, "\t")}
`);
return rewroteAnyPackageJson;
}
async function readPackageLock(pluginRoot) {
const path = join29(pluginRoot, "package-lock.json");
try {
- const parsed = JSON.parse(await readFile5(path, "utf8"));
+ const parsed = JSON.parse(await readFile6(path, "utf8"));
return { path, value: isPlainRecord4(parsed) ? parsed : null, changed: false };
} catch (error) {
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
@@ -95168,14 +95197,14 @@ async function collectPackageJsonPaths(directory, root, paths) {
}
// packages/omo-codex/src/install/codex-cache-mcp-manifest.ts
-import { readFile as readFile6, writeFile as writeFile3 } from "node:fs/promises";
+import { readFile as readFile7, writeFile as writeFile4 } from "node:fs/promises";
import { join as join30, sep as sep3 } from "node:path";
var CONTEXT7_API_KEY_ENV = "CONTEXT7_API_KEY";
async function rewriteCachedMcpManifest(pluginRoot, sourceRoot = pluginRoot) {
const manifestPath = join30(pluginRoot, ".mcp.json");
if (!await fileExistsStrict(manifestPath))
return;
- const raw = await readFile6(manifestPath, "utf8");
+ const raw = await readFile7(manifestPath, "utf8");
const parsed = JSON.parse(raw);
if (!isPlainRecord4(parsed) || !isPlainRecord4(parsed.mcpServers))
return;
@@ -95209,7 +95238,7 @@ async function rewriteCachedMcpManifest(pluginRoot, sourceRoot = pluginRoot) {
}
}
if (changed)
- await writeFile3(manifestPath, `${JSON.stringify(parsed, null, "\t")}
+ await writeFile4(manifestPath, `${JSON.stringify(parsed, null, "\t")}
`);
}
function sanitizeContext7Auth(server) {
@@ -95268,7 +95297,7 @@ async function rewriteCachedManifestRoot(pluginRoot, fromRoot, toRoot) {
const manifestPath = join30(pluginRoot, ".mcp.json");
if (!await fileExistsStrict(manifestPath))
return;
- const raw = await readFile6(manifestPath, "utf8");
+ const raw = await readFile7(manifestPath, "utf8");
const parsed = JSON.parse(raw);
if (!isPlainRecord4(parsed) || !isPlainRecord4(parsed.mcpServers))
return;
@@ -95295,7 +95324,7 @@ async function rewriteCachedManifestRoot(pluginRoot, fromRoot, toRoot) {
}
}
if (changed)
- await writeFile3(manifestPath, `${JSON.stringify(parsed, null, "\t")}
+ await writeFile4(manifestPath, `${JSON.stringify(parsed, null, "\t")}
`);
}
@@ -95357,7 +95386,7 @@ async function unsupportedEntries(root, directory) {
}
// packages/omo-codex/src/install/codex-hook-targets.ts
-import { readFile as readFile7 } from "node:fs/promises";
+import { readFile as readFile8 } from "node:fs/promises";
import { join as join32, sep as sep5 } from "node:path";
var PLUGIN_ROOT_TARGET_PATTERN = /\$\{PLUGIN_ROOT\}[\\/]+([^"']+)/g;
async function findMissingHookCommandTargets(pluginRoot) {
@@ -95365,7 +95394,7 @@ async function findMissingHookCommandTargets(pluginRoot) {
for (const manifestPath of await hookManifestPaths(pluginRoot)) {
if (!await fileExistsStrict(manifestPath))
continue;
- const parsed = JSON.parse(await readFile7(manifestPath, "utf8"));
+ const parsed = JSON.parse(await readFile8(manifestPath, "utf8"));
collectCommands(parsed, commands);
}
const missing = [];
@@ -95389,7 +95418,7 @@ async function hookManifestPaths(pluginRoot) {
const pluginManifestPath = join32(pluginRoot, ".codex-plugin", "plugin.json");
if (!await fileExistsStrict(pluginManifestPath))
return [join32(pluginRoot, "hooks", "hooks.json")];
- const parsed = JSON.parse(await readFile7(pluginManifestPath, "utf8"));
+ const parsed = JSON.parse(await readFile8(pluginManifestPath, "utf8"));
if (!isPlainRecord4(parsed))
return [];
if (typeof parsed.hooks === "string" && parsed.hooks.trim() !== "") {
@@ -95476,7 +95505,7 @@ async function maybeRunNpmInstall(cwd, runCommand, env, args = ["install"]) {
async function maybeRunNpmBuild(cwd, runCommand, env) {
if (!await fileExistsStrict(join33(cwd, "package.json")))
return;
- const packageJson = JSON.parse(await readFile8(join33(cwd, "package.json"), "utf8"));
+ const packageJson = JSON.parse(await readFile9(join33(cwd, "package.json"), "utf8"));
if (!isPlainRecord4(packageJson))
return;
const scripts = packageJson.scripts;
@@ -95487,7 +95516,7 @@ async function maybeRunNpmBuild(cwd, runCommand, env) {
async function maybeRunNpmSyncSkills(cwd, runCommand, env) {
if (!await fileExistsStrict(join33(cwd, "package.json")))
return;
- const packageJson = JSON.parse(await readFile8(join33(cwd, "package.json"), "utf8"));
+ const packageJson = JSON.parse(await readFile9(join33(cwd, "package.json"), "utf8"));
if (!isPlainRecord4(packageJson))
return;
const scripts = packageJson.scripts;
@@ -95550,7 +95579,7 @@ var removedSparkshellPromptSurfaceFiles = new Set(["directive.md", "plugin.json"
var removedSparkshellTextFilePattern = /\.(?:json|md|toml|ya?ml)$/i;
async function assertNoRemovedSparkshellPromptReferences(pluginRoot) {
for (const filePath of await listRemovedSparkshellPromptSurfaceFiles(pluginRoot, "")) {
- const content = await readFile8(join33(pluginRoot, filePath), "utf8");
+ const content = await readFile9(join33(pluginRoot, filePath), "utf8");
if (!removedSparkshellReferencePattern.test(content))
continue;
throw new Error(`removed sparkshell reference found in Codex plugin prompt surface: ${filePath}`);
@@ -95699,7 +95728,7 @@ async function isBrokenCacheSymlink(path) {
}
}
// packages/omo-codex/src/install/codex-cached-marketplace-manifest.ts
-import { mkdir as mkdir4, rename as rename3, rm as rm7, stat as stat5, writeFile as writeFile4 } from "node:fs/promises";
+import { mkdir as mkdir4, rename as rename3, rm as rm7, stat as stat5, writeFile as writeFile5 } from "node:fs/promises";
import { join as join35 } from "node:path";
async function writeCachedMarketplaceManifest(input) {
const marketplaceDir = join35(input.marketplaceRoot, ".agents", "plugins");
@@ -95712,7 +95741,7 @@ async function writeCachedMarketplaceManifest(input) {
const manifestPath = join35(marketplaceDir, "marketplace.json");
const tempPath = join35(marketplaceDir, `.marketplace.json.tmp-${process.pid}-${Date.now()}`);
try {
- await writeFile4(tempPath, `${JSON.stringify({
+ await writeFile5(tempPath, `${JSON.stringify({
name: input.marketplaceName,
plugins: input.plugins.map((plugin) => ({
name: plugin.name,
@@ -95738,7 +95767,7 @@ async function isDirectory2(path) {
// packages/omo-codex/src/install/codex-package-layout.ts
import { existsSync as existsSync24 } from "node:fs";
-import { readFile as readFile9 } from "node:fs/promises";
+import { readFile as readFile10 } from "node:fs/promises";
import { join as join36 } from "node:path";
var PACKAGED_CODEX_INSTALLER_NAMES = new Set([
"@code-yeongyu/lazycodex",
@@ -95754,14 +95783,14 @@ async function shouldBuildSourcePackages(repoRoot) {
const packageJsonPath = join36(repoRoot, "package.json");
if (!existsSync24(packageJsonPath))
return true;
- const packageJson = JSON.parse(await readFile9(packageJsonPath, "utf8"));
+ const packageJson = JSON.parse(await readFile10(packageJsonPath, "utf8"));
if (!isPlainRecord4(packageJson) || typeof packageJson.name !== "string")
return true;
return !PACKAGED_CODEX_INSTALLER_NAMES.has(packageJson.name);
}
// packages/omo-codex/src/install/codex-config-toml.ts
-import { mkdir as mkdir5, readFile as readFile11 } from "node:fs/promises";
+import { mkdir as mkdir5, readFile as readFile12 } from "node:fs/promises";
import { dirname as dirname16 } from "node:path";
// packages/omo-codex/src/install/toml-section-editor.ts
@@ -96358,18 +96387,18 @@ function tomlKeySegment(value) {
}
// packages/omo-codex/src/install/codex-config-atomic-write.ts
-import { lstat as lstat7, readlink as readlink4, realpath, rename as rename4, unlink, writeFile as writeFile5 } from "node:fs/promises";
+import { lstat as lstat7, readlink as readlink4, realpath, rename as rename4, unlink as unlink2, writeFile as writeFile6 } from "node:fs/promises";
import { basename as basename6, dirname as dirname14, isAbsolute as isAbsolute5, join as join37, resolve as resolve10 } from "node:path";
var RENAME_RETRY_DELAYS_MS = [10, 25, 50];
var RETRIABLE_RENAME_CODES = new Set(["EPERM", "EBUSY"]);
async function writeFileAtomic(targetPath, data) {
const writeTarget = await resolveSymlinkTarget(targetPath);
const temporaryPath = join37(dirname14(writeTarget), `.tmp-${basename6(writeTarget)}-${process.pid}-${Date.now()}`);
- await writeFile5(temporaryPath, data);
+ await writeFile6(temporaryPath, data);
try {
await renameWithRetry(temporaryPath, writeTarget);
} catch (error) {
- await unlink(temporaryPath).catch((unlinkError) => {
+ await unlink2(temporaryPath).catch((unlinkError) => {
if (unlinkError instanceof Error)
return;
return;
@@ -96864,7 +96893,7 @@ function isRootSetting(line, key) {
// packages/omo-codex/src/install/codex-model-catalog.ts
init_latest_models();
-import { readFile as readFile10 } from "node:fs/promises";
+import { readFile as readFile11 } from "node:fs/promises";
import { join as join38 } from "node:path";
var FALLBACK_CODEX_MODEL_CATALOG = {
current: {
@@ -96898,7 +96927,7 @@ var FALLBACK_CODEX_MODEL_CATALOG = {
async function readCodexModelCatalog(codexPackageRoot) {
const catalogPath = join38(codexPackageRoot, "plugin", "model-catalog.json");
try {
- const parsed = JSON.parse(await readFile10(catalogPath, "utf8"));
+ const parsed = JSON.parse(await readFile11(catalogPath, "utf8"));
return parseCodexModelCatalog(parsed) ?? FALLBACK_CODEX_MODEL_CATALOG;
} catch (error) {
if (error instanceof Error)
@@ -97123,7 +97152,7 @@ async function updateCodexConfig(input) {
await mkdir5(dirname16(input.configPath), { recursive: true });
let config;
try {
- config = await readFile11(input.configPath, "utf8");
+ config = await readFile12(input.configPath, "utf8");
} catch (error) {
if (!isMissingFileError(error))
throw error;
@@ -97171,7 +97200,7 @@ function isMissingFileError(error) {
// packages/omo-codex/src/install/codex-hook-trust.ts
import { createHash as createHash3 } from "node:crypto";
-import { readFile as readFile12 } from "node:fs/promises";
+import { readFile as readFile13 } from "node:fs/promises";
import { join as join40 } from "node:path";
var EVENT_LABELS = new Map([
["PreToolUse", "pre_tool_use"],
@@ -97189,7 +97218,7 @@ async function trustedHookStatesForPlugin(input) {
const manifestPath = join40(input.pluginRoot, ".codex-plugin", "plugin.json");
if (!await exists(manifestPath))
return [];
- const manifest = JSON.parse(await readFile12(manifestPath, "utf8"));
+ const manifest = JSON.parse(await readFile13(manifestPath, "utf8"));
if (!isPlainRecord4(manifest))
return [];
const states = [];
@@ -97197,7 +97226,7 @@ async function trustedHookStatesForPlugin(input) {
const hooksPath = join40(input.pluginRoot, hookPath);
if (!await exists(hooksPath))
continue;
- const parsed = JSON.parse(await readFile12(hooksPath, "utf8"));
+ const parsed = JSON.parse(await readFile13(hooksPath, "utf8"));
if (!isPlainRecord4(parsed) || !isPlainRecord4(parsed.hooks))
continue;
states.push(...trustedHookStatesForHooksFile({
@@ -97280,7 +97309,7 @@ function stripDotSlash2(value) {
}
async function exists(path) {
try {
- await readFile12(path, "utf8");
+ await readFile13(path, "utf8");
return true;
} catch (error) {
if (error instanceof Error)
@@ -97380,7 +97409,7 @@ function recordAt2(value, key) {
}
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
-import { cp as cp4, mkdir as mkdir6, rename as rename5, rm as rm8, writeFile as writeFile6 } from "node:fs/promises";
+import { cp as cp4, mkdir as mkdir6, rename as rename5, rm as rm8, writeFile as writeFile7 } from "node:fs/promises";
import { join as join41, sep as sep7 } from "node:path";
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
async function writeInstalledMarketplaceSnapshot(input) {
@@ -97400,7 +97429,7 @@ async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
const manifestDir = join41(marketplaceRoot, ".agents", "plugins");
await mkdir6(manifestDir, { recursive: true });
const tempPath = join41(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
- await writeFile6(tempPath, `${JSON.stringify(marketplace, null, "\t")}
+ await writeFile7(tempPath, `${JSON.stringify(marketplace, null, "\t")}
`);
await rename5(tempPath, join41(manifestDir, "marketplace.json"));
}
@@ -97429,15 +97458,15 @@ function shouldCopyMarketplaceSourcePath(path, root) {
}
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
-import { copyFile, lstat as lstat11, mkdir as mkdir7, readdir as readdir8, readFile as readFile17, rm as rm12, writeFile as writeFile9 } from "node:fs/promises";
+import { copyFile, lstat as lstat11, mkdir as mkdir7, readdir as readdir8, readFile as readFile18, rm as rm12, writeFile as writeFile10 } from "node:fs/promises";
import { basename as basename7, join as join46 } from "node:path";
// packages/omo-codex/src/install/agent-model-overrides.ts
-import { readFile as readFile14, rm as rm9, writeFile as writeFile8 } from "node:fs/promises";
+import { readFile as readFile15, rm as rm9, writeFile as writeFile9 } from "node:fs/promises";
import { join as join43 } from "node:path";
// packages/omo-codex/src/install/preserved-agent-settings.ts
-import { lstat as lstat8, readFile as readFile13, readdir as readdir7, writeFile as writeFile7 } from "node:fs/promises";
+import { lstat as lstat8, readFile as readFile14, readdir as readdir7, writeFile as writeFile8 } from "node:fs/promises";
import { join as join42 } from "node:path";
// packages/omo-codex/src/install/managed-agent-reasoning-defaults.ts
@@ -97672,7 +97701,7 @@ async function capturePreservedAgentServiceTier(input) {
async function restorePreservedReasoning(input) {
if (input.value === undefined)
return;
- const content = await readFile13(input.target, "utf8");
+ const content = await readFile14(input.target, "utf8");
const bundledEffort = extractReasoningEffort(content);
const effort = resolveManagedAgentReasoning({
agentName: input.agentName,
@@ -97685,33 +97714,33 @@ async function restorePreservedReasoning(input) {
const replacement = replaceTopLevelStringSetting(content, "model_reasoning_effort", effort, { insertIfMissing: false });
if (!replacement.replaced)
return;
- await writeFile7(input.linkPath, replacement.content);
+ await writeFile8(input.linkPath, replacement.content);
}
async function restorePreservedServiceTier(input) {
if (!input.preserved)
return;
- const content = await readFile13(input.linkPath, "utf8");
+ const content = await readFile14(input.linkPath, "utf8");
if (extractServiceTier(content) === input.value)
return;
const replacement = replaceTopLevelStringSetting(content, "service_tier", input.value, { insertIfMissing: true });
if (!replacement.replaced)
return;
- await writeFile7(input.linkPath, replacement.content);
+ await writeFile8(input.linkPath, replacement.content);
}
async function restorePreservedModel(input) {
if (input.value === null)
return;
- const content = await readFile13(input.linkPath, "utf8");
+ const content = await readFile14(input.linkPath, "utf8");
if (extractModel(content) === input.value)
return;
const replacement = replaceTopLevelStringSetting(content, "model", input.value, { insertIfMissing: true });
if (!replacement.replaced)
return;
- await writeFile7(input.linkPath, replacement.content);
+ await writeFile8(input.linkPath, replacement.content);
}
async function readTextIfExists(path) {
try {
- return await readFile13(path, "utf8");
+ return await readFile14(path, "utf8");
} catch (error) {
if (nodeErrorCode(error) === "ENOENT")
return null;
@@ -97833,13 +97862,13 @@ async function writeAgentModelReceipts(codexHome, receipts) {
await rm9(path, { force: true });
return;
}
- await writeFile8(path, `${JSON.stringify(Object.fromEntries(receipts), null, "\t")}
+ await writeFile9(path, `${JSON.stringify(Object.fromEntries(receipts), null, "\t")}
`);
}
async function applyAgentOverride(input) {
if (input.override === undefined)
return;
- let content = await readFile14(input.linkPath, "utf8");
+ let content = await readFile15(input.linkPath, "utf8");
if (input.override.model !== undefined) {
content = replaceTopLevelStringSetting(content, "model", input.override.model, { insertIfMissing: true }).content;
}
@@ -97848,7 +97877,7 @@ async function applyAgentOverride(input) {
insertIfMissing: true
}).content;
}
- await writeFile8(input.linkPath, content);
+ await writeFile9(input.linkPath, content);
}
function receiptPath(codexHome) {
return join43(codexHome, "agents", RECEIPT_FILE);
@@ -97883,7 +97912,7 @@ function handEditedAgentModel(installedModel, receipt) {
}
// packages/omo-codex/src/install/retired-managed-agent-purge.ts
-import { lstat as lstat9, readFile as readFile15, rm as rm10 } from "node:fs/promises";
+import { lstat as lstat9, readFile as readFile16, rm as rm10 } from "node:fs/promises";
import { join as join44 } from "node:path";
var RETIRED_MANAGED_AGENT_FILES = [
{
@@ -97917,7 +97946,7 @@ function hasRequiredMarkers(content, markers) {
}
async function readTextIfExists2(path) {
try {
- return await readFile15(path, "utf8");
+ return await readFile16(path, "utf8");
} catch (error) {
if (nodeErrorCode2(error) === "ENOENT")
return null;
@@ -97942,7 +97971,7 @@ function nodeErrorCode2(error) {
// packages/omo-codex/src/install/default-agent-role.ts
import { createHash as createHash4 } from "node:crypto";
-import { lstat as lstat10, readFile as readFile16, rm as rm11 } from "node:fs/promises";
+import { lstat as lstat10, readFile as readFile17, rm as rm11 } from "node:fs/promises";
import { join as join45 } from "node:path";
var REGISTRATION = { name: "default", configFile: "./agents/default.toml" };
async function installDefaultAgentRole(input) {
@@ -97979,7 +98008,7 @@ async function installDefaultAgentRole(input) {
if (foreign || existing !== null && !owned) {
throw new Error("Preserved user-owned agents.default / agents/default.toml. Move it aside to install the LazyCodex fallback, or set [codex].agents.default.disable = true in omo.jsonc. Explicit LazyCodex roles remain required.");
}
- const worker = await readFile16(input.worker.path, "utf8");
+ const worker = await readFile17(input.worker.path, "utf8");
const content = worker.replace(/^name\s*=\s*["']lazycodex-worker-medium["']\s*$/m, 'name = "default"');
if (content === worker)
throw new Error("Cannot derive default: medium worker has no matching internal name");
@@ -97989,7 +98018,7 @@ async function installDefaultAgentRole(input) {
}
async function readIfPresent(path) {
try {
- return await readFile16(path, "utf8");
+ return await readFile17(path, "utf8");
} catch (error) {
if (error instanceof Error && "code" in error && error.code === "ENOENT")
return null;
@@ -98050,7 +98079,7 @@ async function syncAgentFile(input) {
value: input.preservedServiceTier?.get(input.agentName) ?? null
});
await applyAgentOverride({ linkPath: input.linkPath, override });
- const model = override?.model ?? extractModel(await readFile17(input.agentPath, "utf8"));
+ const model = override?.model ?? extractModel(await readFile18(input.agentPath, "utf8"));
return {
...model === null ? {} : { model },
...override?.reasoningEffort === undefined ? {} : { reasoningEffort: override.reasoningEffort }
@@ -98094,7 +98123,7 @@ async function prepareReplacement(linkPath) {
async function writeManifest(pluginRoot, agentPaths) {
const manifestPath = join46(pluginRoot, MANIFEST_FILE);
const payload = { agents: [...agentPaths].sort() };
- await writeFile9(manifestPath, `${JSON.stringify(payload, null, "\t")}
+ await writeFile10(manifestPath, `${JSON.stringify(payload, null, "\t")}
`);
}
function agentNameFromToml2(fileName) {
@@ -98163,12 +98192,12 @@ function agentNameFromToml3(fileName) {
}
// packages/omo-codex/src/install/codex-marketplace.ts
-import { readFile as readFile18 } from "node:fs/promises";
+import { readFile as readFile19 } from "node:fs/promises";
import { join as join47 } from "node:path";
var DEFAULT_MARKETPLACE_PATH = "packages/omo-codex/marketplace.json";
async function readMarketplace(repoRoot, options) {
const marketplacePath = options?.marketplacePath ?? join47(repoRoot, DEFAULT_MARKETPLACE_PATH);
- const raw = await readFile18(marketplacePath, "utf8");
+ const raw = await readFile19(marketplacePath, "utf8");
const parsed = JSON.parse(raw);
if (!isPlainRecord4(parsed))
throw new Error("marketplace.json must be an object");
@@ -98189,7 +98218,7 @@ function resolvePluginSource(repoRoot, plugin, options) {
return join47(repoRoot, ...relativePath.split(/[\\/]/));
}
async function readPluginManifest(pluginRoot) {
- const raw = await readFile18(join47(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
+ const raw = await readFile19(join47(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
const parsed = JSON.parse(raw);
if (!isPlainRecord4(parsed))
throw new Error(`${pluginRoot} plugin.json must be an object`);
@@ -98270,11 +98299,11 @@ function validateLocalSourcePath(path) {
}
// packages/omo-codex/src/install/lazycodex-version-stamp.ts
-import { readdir as readdir9, readFile as readFile19, writeFile as writeFile10 } from "node:fs/promises";
+import { readdir as readdir9, readFile as readFile20, writeFile as writeFile11 } from "node:fs/promises";
import { join as join48 } from "node:path";
async function readDistributionManifest(repoRoot) {
try {
- const parsed = JSON.parse(await readFile19(join48(repoRoot, "package.json"), "utf8"));
+ const parsed = JSON.parse(await readFile20(join48(repoRoot, "package.json"), "utf8"));
if (!isPlainRecord4(parsed) || typeof parsed.version !== "string" || parsed.version.trim().length === 0)
return;
return {
@@ -98310,7 +98339,7 @@ async function stampLazyCodexPluginVersion(input) {
async function writeLazyCodexInstallSnapshot(input) {
if (input.distributionManifest === undefined)
return;
- await writeFile10(join48(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
+ await writeFile11(join48(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
packageName: input.distributionManifest.name,
version: input.distributionManifest.version
}, null, "\t")}
@@ -98318,11 +98347,11 @@ async function writeLazyCodexInstallSnapshot(input) {
}
async function stampJsonVersion(path, version) {
try {
- const parsed = JSON.parse(await readFile19(path, "utf8"));
+ const parsed = JSON.parse(await readFile20(path, "utf8"));
if (!isPlainRecord4(parsed))
return;
parsed.version = version;
- await writeFile10(path, `${JSON.stringify(parsed, null, "\t")}
+ await writeFile11(path, `${JSON.stringify(parsed, null, "\t")}
`);
} catch (error) {
if (error instanceof Error)
@@ -98332,7 +98361,7 @@ async function stampJsonVersion(path, version) {
}
async function readPluginHookPaths(manifestPath) {
try {
- const parsed = JSON.parse(await readFile19(manifestPath, "utf8"));
+ const parsed = JSON.parse(await readFile20(manifestPath, "utf8"));
if (!isPlainRecord4(parsed))
return [];
if (typeof parsed.hooks === "string" && parsed.hooks.trim().length > 0)
@@ -98352,11 +98381,11 @@ function stripDotSlash3(path) {
}
async function stampHookStatusMessages(path, version) {
try {
- const parsed = JSON.parse(await readFile19(path, "utf8"));
+ const parsed = JSON.parse(await readFile20(path, "utf8"));
if (!isPlainRecord4(parsed))
return;
stampHookGroups(parsed.hooks, version);
- await writeFile10(path, `${JSON.stringify(parsed, null, "\t")}
+ await writeFile11(path, `${JSON.stringify(parsed, null, "\t")}
`);
} catch (error) {
if (error instanceof Error)
@@ -98433,7 +98462,7 @@ var defaultRunCommand = async (command, args, options) => {
};
// packages/omo-codex/src/install/codex-project-local-cleanup.ts
-import { copyFile as copyFile2, lstat as lstat12, readFile as readFile20, writeFile as writeFile11 } from "node:fs/promises";
+import { copyFile as copyFile2, lstat as lstat12, readFile as readFile21, writeFile as writeFile12 } from "node:fs/promises";
import { dirname as dirname17, join as join49, resolve as resolve11 } from "node:path";
var LEGACY_AGENT_CONFLICT_KEYS = ["max_threads"];
var PROJECT_LOCAL_ARTIFACT_PATHS = [
@@ -98453,7 +98482,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
const artifacts = await collectProjectLocalArtifacts(project.artifactRoots);
const configs = [];
for (const configPath of project.configPaths) {
- const original = await readFile20(configPath, "utf8");
+ const original = await readFile21(configPath, "utf8");
const repair = repairProjectLocalCodexConfigText(original);
if (!repair.changed) {
configs.push({
@@ -98466,7 +98495,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
}
const backupPath = `${configPath}.backup-${formatBackupTimestamp(input.now?.() ?? new Date)}`;
await copyFile2(configPath, backupPath);
- await writeFile11(configPath, `${repair.config.trimEnd()}
+ await writeFile12(configPath, `${repair.config.trimEnd()}
`);
configs.push({
projectRoot: project.projectRoot,
@@ -98663,13 +98692,13 @@ function formatUnknownError(error) {
// packages/omo-codex/src/install/lsp-daemon-reaper.ts
import { createHash as createHash5 } from "node:crypto";
-import { lstat as lstat13, readFile as readFile22, readdir as readdir11, rm as rm13 } from "node:fs/promises";
+import { lstat as lstat13, readFile as readFile23, readdir as readdir11, rm as rm13 } from "node:fs/promises";
import { tmpdir as tmpdir4 } from "node:os";
import { join as join50, posix as posix6 } from "node:path";
// packages/omo-codex/src/install/lsp-daemon-reaper-attestation.ts
import { execFile } from "node:child_process";
-import { readFile as readFile21, readdir as readdir10, readlink as readlink5 } from "node:fs/promises";
+import { readFile as readFile22, readdir as readdir10, readlink as readlink5 } from "node:fs/promises";
import { connect } from "node:net";
import { basename as basename8 } from "node:path";
var PROBE_TIMEOUT_MS = 500;
@@ -98711,7 +98740,7 @@ async function attestLegacyDaemonOwnership(input, deps = {}) {
return false;
}
async function attestLinuxOwnership(input, deps) {
- const readFileImpl = deps.readFile ?? readFile21;
+ const readFileImpl = deps.readFile ?? readFile22;
const readDirImpl = deps.readDir ?? readdir10;
const readLinkImpl = deps.readLink ?? readlink5;
const procNetUnix = await readText(readFileImpl, "/proc/net/unix");
@@ -98936,7 +98965,7 @@ async function readRegularTrimmedFile(path) {
return null;
if (!stats.isFile())
return "non_regular";
- const content = (await readFile22(path, "utf8")).trim();
+ const content = (await readFile23(path, "utf8")).trim();
return content.length > 0 ? content : null;
}
function shortDigest(value) {
@@ -98997,11 +99026,11 @@ function resolveCodexInstallerBinDir(input) {
}
// packages/omo-codex/src/install/codex-installed-bin-dir.ts
-import { readFile as readFile23, readdir as readdir12, writeFile as writeFile12 } from "node:fs/promises";
+import { readFile as readFile24, readdir as readdir12, writeFile as writeFile13 } from "node:fs/promises";
import { join as join52 } from "node:path";
var INSTALLED_BIN_DIR_MANIFEST = ".installed-bin-dir.json";
async function writeInstalledCodexBinDir(input) {
- await writeFile12(join52(input.pluginRoot, INSTALLED_BIN_DIR_MANIFEST), `${JSON.stringify({ binDir: input.binDir }, null, 2)}
+ await writeFile13(join52(input.pluginRoot, INSTALLED_BIN_DIR_MANIFEST), `${JSON.stringify({ binDir: input.binDir }, null, 2)}
`);
}
async function readInstalledCodexBinDir(codexHome) {
@@ -99027,7 +99056,7 @@ async function installedBinDirManifestPaths(codexHome) {
return paths;
}
async function readBinDirFromManifest(manifestPath) {
- const raw = await readFile23(manifestPath, "utf8").catch(() => null);
+ const raw = await readFile24(manifestPath, "utf8").catch(() => null);
if (raw === null)
return null;
let parsed;
@@ -99045,7 +99074,7 @@ async function readBinDirFromManifest(manifestPath) {
}
// packages/omo-codex/src/install/codex-git-bash-hooks.ts
-import { readFile as readFile24, writeFile as writeFile13 } from "node:fs/promises";
+import { readFile as readFile25, writeFile as writeFile14 } from "node:fs/promises";
import { join as join53 } from "node:path";
var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
"./hooks/pre-tool-use-recommending-git-bash-mcp.json",
@@ -99055,13 +99084,13 @@ async function removeGitBashHooksOffWindows(input) {
if (input.platform === "win32")
return;
const manifestPath = join53(input.pluginRoot, ".codex-plugin", "plugin.json");
- const parsed = JSON.parse(await readFile24(manifestPath, "utf8"));
+ const parsed = JSON.parse(await readFile25(manifestPath, "utf8"));
if (!isPlainRecord4(parsed) || !Array.isArray(parsed.hooks))
return;
const hooks = parsed.hooks.filter((hook) => typeof hook !== "string" || !WINDOWS_ONLY_GIT_BASH_HOOKS.has(hook));
if (hooks.length === parsed.hooks.length)
return;
- await writeFile13(manifestPath, `${JSON.stringify({ ...parsed, hooks }, null, "\t")}
+ await writeFile14(manifestPath, `${JSON.stringify({ ...parsed, hooks }, null, "\t")}
`);
}
@@ -99432,12 +99461,12 @@ function defaultRunCommand2(command, args) {
});
}
// packages/omo-codex/src/install/codex-cleanup.ts
-import { lstat as lstat16, readFile as readFile27, readdir as readdir14, rm as rm15, rmdir } from "node:fs/promises";
+import { lstat as lstat16, readFile as readFile28, readdir as readdir14, rm as rm15, rmdir } from "node:fs/promises";
import { homedir as homedir9 } from "node:os";
import { isAbsolute as isAbsolute11, join as join62, relative as relative7, resolve as resolve16 } from "node:path";
// packages/omo-codex/src/install/codex-cleanup-bins.ts
-import { lstat as lstat14, readFile as readFile25, readdir as readdir13, readlink as readlink6, rm as rm14 } from "node:fs/promises";
+import { lstat as lstat14, readFile as readFile26, readdir as readdir13, readlink as readlink6, rm as rm14 } from "node:fs/promises";
import { dirname as dirname20, isAbsolute as isAbsolute9, join as join60, resolve as resolve14 } from "node:path";
var ROOT_RUNTIME_BIN_NAME = "omo";
var MANAGED_CODEX_BIN_NAMES = new Set([
@@ -99499,12 +99528,12 @@ async function isManagedCodexBin(linkPath, platform, binName) {
}
if (!entryStat.isFile())
return false;
- const content = await readFile25(linkPath, "utf8");
+ const content = await readFile26(linkPath, "utf8");
return content.includes(RUNTIME_WRAPPER_MARKER) || content.includes(COMMAND_SHIM_MARKER);
}
// packages/omo-codex/src/install/codex-cleanup-config.ts
-import { lstat as lstat15, mkdir as mkdir8, readFile as readFile26, writeFile as writeFile14 } from "node:fs/promises";
+import { lstat as lstat15, mkdir as mkdir8, readFile as readFile27, writeFile as writeFile15 } from "node:fs/promises";
import { dirname as dirname21 } from "node:path";
var MANAGED_MARKETPLACES = ["sisyphuslabs", "lazycodex", "code-yeongyu-codex-plugins"];
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE2 = ["codex-ultrawork-reviewer"];
@@ -99537,14 +99566,14 @@ function cleanupCodexLightConfigText(config) {
async function cleanupCodexConfig(configPath, now) {
if (!await configExists(configPath))
return { changed: false };
- const original = await readFile26(configPath, "utf8");
+ const original = await readFile27(configPath, "utf8");
const next = cleanupCodexLightConfigText(original);
if (next === original)
return { changed: false };
const backupPath = `${configPath}.backup-${formatBackupTimestamp2(now?.() ?? new Date)}`;
await mkdir8(dirname21(configPath), { recursive: true });
- await writeFile14(backupPath, original);
- await writeFile14(configPath, `${next.trimEnd()}
+ await writeFile15(backupPath, original);
+ await writeFile15(configPath, `${next.trimEnd()}
`);
return { changed: true, backupPath };
}
@@ -99821,13 +99850,13 @@ async function collectInstalledAgentPaths(codexHome, configPath) {
async function readManagedAgentPathsFromConfig(codexHome, configPath) {
if (!await exists6(configPath))
return [];
- const config = await readFile27(configPath, "utf8");
+ const config = await readFile28(configPath, "utf8");
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join62(codexHome, "agents", `${agentName}.toml`));
}
async function readInstalledAgentManifest(manifestPath) {
if (!await exists6(manifestPath))
return [];
- const parsed = JSON.parse(await readFile27(manifestPath, "utf8"));
+ const parsed = JSON.parse(await readFile28(manifestPath, "utf8"));
if (!isPlainRecord4(parsed) || !Array.isArray(parsed.agents))
return [];
return parsed.agents.filter((path) => typeof path === "string");
@@ -100019,7 +100048,7 @@ node "%~dp0omo" %*\r
// packages/omo-senpi/src/install/plugin-artifacts.ts
import { createHash as createHash7 } from "node:crypto";
import { constants as constants9 } from "node:fs";
-import { access as access2, readFile as readFile29, stat as stat6 } from "node:fs/promises";
+import { access as access3, readFile as readFile30, stat as stat6 } from "node:fs/promises";
import { dirname as dirname25, join as join66 } from "node:path";
// packages/memory-core/src/personas/manifest.ts
@@ -100038,7 +100067,7 @@ var PERSONA_ASSET_FILES = [
// packages/omo-senpi/src/install/senpi-settings.ts
import { constants as constants8 } from "node:fs";
-import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile28, rename as rename6, writeFile as writeFile15 } from "node:fs/promises";
+import { access as access2, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile29, rename as rename6, writeFile as writeFile16 } from "node:fs/promises";
import { basename as basename10, dirname as dirname24, join as join65, resolve as resolve19 } from "node:path";
var OMO_SENPI_PACKAGE_NAME = "@code-yeongyu/omo-senpi";
var GENERATED_PLUGIN_BASENAME = /^omo-senpi-cli-plugin-[A-Za-z0-9]{6}$/;
@@ -100049,7 +100078,7 @@ var LEGACY_BUILTIN_SHADOW_PACKAGES = [
async function readSettings(settingsPath) {
let raw;
try {
- raw = await readFile28(settingsPath, "utf8");
+ raw = await readFile29(settingsPath, "utf8");
} catch (error) {
if (isErrno(error, "ENOENT"))
return {};
@@ -100096,11 +100125,11 @@ async function writeSettingsAtomically(settingsPath, settings) {
if (await fileExists(settingsPath)) {
await copyFile3(settingsPath, backupPath);
} else {
- await writeFile15(backupPath, `{}
+ await writeFile16(backupPath, `{}
`, "utf8");
}
const tempPath = `${settingsPath}.${process.pid}.${Date.now()}.tmp`;
- await writeFile15(tempPath, `${JSON.stringify(settings, null, 2)}
+ await writeFile16(tempPath, `${JSON.stringify(settings, null, 2)}
`, "utf8");
await rename6(tempPath, settingsPath);
return backupPath;
@@ -100123,7 +100152,7 @@ function isRecord15(value) {
async function readPackageName(packagePath) {
let raw;
try {
- raw = await readFile28(join65(packagePath, "package.json"), "utf8");
+ raw = await readFile29(join65(packagePath, "package.json"), "utf8");
} catch (error) {
if (isErrno(error, "ENOENT") || isErrno(error, "ENOTDIR"))
return;
@@ -100141,7 +100170,7 @@ async function readPackageName(packagePath) {
}
async function fileExists(path) {
try {
- await access(path, constants8.F_OK);
+ await access2(path, constants8.F_OK);
return true;
} catch (error) {
if (isErrno(error, "ENOENT"))
@@ -100204,6 +100233,7 @@ var REQUIRED_PLUGIN_ARTIFACTS = [
join66("skills", "visual-qa", "SKILL.md"),
join66("skills-conditional", "x-search", "SKILL.md"),
join66("runtime", "agent-toolkit-sdk", "sdk.js"),
+ join66("runtime", "bunshin-ts", "sdk.js"),
join66("runtime", "thread-sdk", "sdk.js"),
join66("runtime", "ast-grep-mcp", "cli.js"),
join66("runtime", "lsp-daemon", "dist", "cli.js"),
@@ -100246,7 +100276,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
runtimeStat = await stat6(runtimeEntry);
if (!runtimeStat.isFile())
throw new Error("runtime is not a file");
- await access2(runtimeEntry, constants9.R_OK | constants9.X_OK);
+ await access3(runtimeEntry, constants9.R_OK | constants9.X_OK);
} catch (error) {
throw astGrepIntegrityError(runtimeEntry, `runtime is unreadable or non-executable: ${messageOf(error)}`);
}
@@ -100255,7 +100285,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
}
let manifest;
try {
- manifest = JSON.parse(await readFile29(manifestPath, "utf8"));
+ manifest = JSON.parse(await readFile30(manifestPath, "utf8"));
} catch (error) {
throw astGrepIntegrityError(runtimeEntry, `manifest is unreadable or invalid JSON: ${messageOf(error)}`);
}
@@ -100264,7 +100294,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
}
let actualSha256;
try {
- actualSha256 = createHash7("sha256").update(await readFile29(runtimeEntry)).digest("hex");
+ actualSha256 = createHash7("sha256").update(await readFile30(runtimeEntry)).digest("hex");
} catch (error) {
throw astGrepIntegrityError(runtimeEntry, `runtime hash could not be computed: ${messageOf(error)}`);
}
@@ -100289,7 +100319,7 @@ function messageOf(error) {
}
async function fileExists2(path) {
try {
- await access2(path, constants9.F_OK);
+ await access3(path, constants9.F_OK);
return true;
} catch (error) {
if (isErrno2(error, "ENOENT"))
@@ -107982,7 +108012,7 @@ function getSuggestedInstallTag(currentVersion) {
// packages/omo-opencode/src/cli/doctor/checks/system.ts
init_jsonc_parser2();
init_plugin_identity();
-var runtime4 = globalThis;
+var runtime5 = globalThis;
var defaultDeps5 = {
findOpenCodeBinary,
getOpenCodeVersion: getOpenCodeVersion3,
@@ -108043,7 +108073,7 @@ async function gatherSystemInfo(deps = defaultDeps5) {
opencodePath: binaryInfo?.path ?? null,
pluginVersion,
loadedVersion: loadedInfo.loadedVersion,
- bunVersion: runtime4.Bun?.version ?? "unavailable",
+ bunVersion: runtime5.Bun?.version ?? "unavailable",
configPath: pluginInfo.configPath,
configValid: isConfigValid(pluginInfo.configPath, deps),
isLocalDev: pluginInfo.isLocalDev
@@ -109522,7 +109552,7 @@ async function pathExists2(dir) {
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
init_src();
import { existsSync as existsSync61 } from "node:fs";
-import { lstat as lstat17, readdir as readdir15, readFile as readFile30 } from "node:fs/promises";
+import { lstat as lstat17, readdir as readdir15, readFile as readFile31 } from "node:fs/promises";
import { homedir as homedir26 } from "node:os";
import { basename as basename13, join as join99, resolve as resolve27 } from "node:path";
// packages/omo-opencode/package.json
@@ -109747,7 +109777,7 @@ async function readCodexConfigSummary(configPath) {
companionLifecycleHookStateEvents: []
};
}
- const content = await readFile30(configPath, "utf8");
+ const content = await readFile31(configPath, "utf8");
return {
exists: true,
marketplaceConfigured: content.includes("[marketplaces.sisyphuslabs]"),
@@ -109775,7 +109805,7 @@ async function readLinkedAgents(codexHome) {
}
async function readJson(path) {
try {
- const parsed = JSON.parse(await readFile30(path, "utf8"));
+ const parsed = JSON.parse(await readFile31(path, "utf8"));
return isPlainRecord(parsed) ? parsed : null;
} catch (error) {
if (error instanceof Error)
@@ -109899,7 +109929,7 @@ function resolveLatestVersion(input) {
// packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
init_src();
-import { readdir as readdir16, readFile as readFile31, stat as stat7 } from "node:fs/promises";
+import { readdir as readdir16, readFile as readFile32, stat as stat7 } from "node:fs/promises";
import { homedir as homedir27 } from "node:os";
import { dirname as dirname40, isAbsolute as isAbsolute15, join as join100, relative as relative10, resolve as resolve28, sep as sep11 } from "node:path";
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
@@ -110152,7 +110182,7 @@ function degradedDetailLines(entries) {
}
async function readJson2(path) {
try {
- const parsed = JSON.parse(await readFile31(path, "utf8"));
+ const parsed = JSON.parse(await readFile32(path, "utf8"));
return isRecord18(parsed) ? parsed : null;
} catch (error) {
if (error instanceof Error)
@@ -110180,7 +110210,7 @@ function isRecord18(value) {
// packages/omo-opencode/src/cli/doctor/checks/codex-runtime-wrapper.ts
import { existsSync as existsSync62 } from "node:fs";
-import { readFile as readFile32 } from "node:fs/promises";
+import { readFile as readFile33 } from "node:fs/promises";
import { homedir as homedir28 } from "node:os";
import { join as join101, resolve as resolve29 } from "node:path";
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
@@ -110225,7 +110255,7 @@ async function checkCodexRuntimeWrapper(deps = {}) {
}
async function readRuntimeWrapper(path) {
try {
- return await readFile32(path, "utf8");
+ return await readFile33(path, "utf8");
} catch (error) {
if (error instanceof Error)
return null;
@@ -112149,6 +112179,73 @@ async function loadDeviceKeyring(store) {
import { execFile as execFile5 } from "node:child_process";
import { homedir as homedir30 } from "node:os";
import { join as join105 } from "node:path";
+
+// packages/omo-opencode/src/shared/bun-ffi-shim.ts
+async function loadBunFfi() {
+ return import("bun:ffi");
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/process-state.ts
+var KEY = Symbol.for("omo.keychain-helper.process.v1");
+function keychainProcessState() {
+ const holder = globalThis;
+ holder[KEY] ??= {
+ secretsQueue: Promise.resolve(),
+ interactionSwitch: undefined,
+ approvalCache: undefined,
+ entryCandidates: [],
+ helperAccess: undefined,
+ heldPromptLocks: new Set,
+ handOff: undefined
+ };
+ return holder[KEY];
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/secrets-gate.ts
+async function loadInteractionSwitch() {
+ const state = keychainProcessState();
+ if (state.interactionSwitch !== undefined)
+ return state.interactionSwitch;
+ if (process.platform !== "darwin")
+ return state.interactionSwitch = null;
+ try {
+ const { dlopen, FFIType } = await loadBunFfi();
+ const security = dlopen("/System/Library/Frameworks/Security.framework/Security", {
+ SecKeychainSetUserInteractionAllowed: { args: [FFIType.u8], returns: FFIType.i32 }
+ });
+ state.interactionSwitch = (allowed) => {
+ security.symbols.SecKeychainSetUserInteractionAllowed(allowed ? 1 : 0);
+ };
+ } catch {
+ state.interactionSwitch = null;
+ }
+ return state.interactionSwitch;
+}
+function gatedSecrets(run) {
+ const state = keychainProcessState();
+ const next = state.secretsQueue.then(run, run);
+ state.secretsQueue = next.then(() => {
+ return;
+ }, () => {
+ return;
+ });
+ return next;
+}
+function silentSecrets(run) {
+ return gatedSecrets(async () => {
+ const setInteraction = await loadInteractionSwitch();
+ if (setInteraction === null)
+ throw new Error("Keychain interaction cannot be switched off on this host.");
+ setInteraction(false);
+ try {
+ return await run();
+ } finally {
+ setInteraction(true);
+ }
+ });
+}
+
+// packages/omo-opencode/src/cli/account-keys/keystore.ts
var DEFAULT_SERVICE = "omo-cli";
function defaultRun(argv, input) {
const [file, ...args] = argv;
@@ -112172,7 +112269,7 @@ function createOsKeyStore(name, platform = process.platform, run = defaultRun, s
const resolved = secrets === undefined ? run === defaultRun && typeof Bun !== "undefined" ? Bun.secrets : null : secrets;
switch (platform) {
case "darwin":
- return resolved !== null ? createBunSecretsKeyStore(name, resolved) : createMacOsKeychainKeyStore(name, run);
+ return resolved !== null ? createBunSecretsKeyStore(name, gateRealSecrets(resolved)) : createMacOsKeychainKeyStore(name, run);
case "linux":
return resolved !== null ? createBunSecretsKeyStore(name, resolved) : createLibsecretKeyStore(name, run);
case "win32":
@@ -112191,6 +112288,10 @@ async function guarded(run, fail, argv, input) {
throw fail();
}
}
+var gateRealSecrets = (secrets) => typeof Bun !== "undefined" && secrets === Bun.secrets ? {
+ get: (key) => gatedSecrets(() => secrets.get(key)),
+ set: (entry) => gatedSecrets(() => secrets.set(entry))
+} : secrets;
function createBunSecretsKeyStore(name, secrets) {
const key = { service: DEFAULT_SERVICE, name };
const unavailable = () => new Error("omo account keys: cannot access the OS credential store. Unlock the login keychain (macOS), the Secret Service keyring (Linux), or DPAPI (Windows), then try again. " + "Private keys are only ever stored through the OS credential facility.");
@@ -112728,64 +112829,705 @@ async function loginDevice(session, options) {
}
// packages/omo-opencode/src/cli/service-auth/keystore.ts
-import { createHash as createHash12, randomUUID as randomUUID7 } from "node:crypto";
-import { basename as basename15 } from "node:path";
+import { createHash as createHash12, randomUUID as randomUUID8 } from "node:crypto";
+import { basename as basename17 } from "node:path";
-// packages/omo-opencode/src/cli/service-auth/secret-service-lock.ts
-import { spawn as spawn5 } from "node:child_process";
-var DEFAULT_COLLECTION = "/org/freedesktop/secrets/aliases/default";
-var PROBE_TIMEOUT_MS2 = 1e4;
-var parseLockedReply = (stdout) => {
- const match = /<\s*(true|false)\s*>/.exec(stdout);
- if (match === null)
- return null;
- return match[1] === "true" ? "locked" : "unlocked";
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/darwin-backend.ts
+import { homedir as homedir31 } from "node:os";
+import { join as join109 } from "node:path";
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/client.ts
+init_zod();
+init_bun_spawn_shim();
+var MUTATING = new Set(["write", "stage", "retire", "promote", "remove"]);
+var helperReplySchema = object({
+ owned: boolean2(),
+ value: string2(),
+ marker: boolean2(),
+ cdat: number2(),
+ mdat: number2(),
+ partition: _enum(["ours", "other", "none", "unknown"]),
+ present: object({ staging: boolean2(), old: boolean2(), oldSlots: array(number2().int().min(0).max(7)).optional() }).strict(),
+ missing: boolean2(),
+ recover: boolean2(),
+ ok: boolean2(),
+ created: boolean2(),
+ skipped: boolean2(),
+ slot: number2().int().min(0).max(7),
+ error: _enum(["locked", "store", "not-owned", "exists", "missing", "denied", "refused"]),
+ reason: string2(),
+ status: number2()
+}).partial().strict();
+
+class HelperProtocolError extends Error {
+}
+async function firstLine(stream) {
+ const reader = stream.getReader();
+ const decoder = new TextDecoder;
+ let text = "";
+ for (;; ) {
+ const newline = text.indexOf(`
+`);
+ if (newline !== -1)
+ return text.slice(0, newline);
+ const chunk = await reader.read();
+ if (chunk.done)
+ return null;
+ text += decoder.decode(chunk.value, { stream: true });
+ }
+}
+function isFlushable(stream) {
+ return typeof stream.flush === "function";
+}
+var spawnDetachedHelper = (path) => {
+ const child = spawn([path], {
+ stdin: "pipe",
+ stdout: "pipe",
+ stderr: "ignore",
+ detached: true,
+ env: process.env.HOME === undefined ? {} : { HOME: process.env.HOME }
+ });
+ const pid = child.pid;
+ if (pid === undefined)
+ throw new HelperProtocolError("The keychain helper did not start.");
+ const stdin = child.stdin;
+ return {
+ pid,
+ send: (line) => {
+ stdin.write(line);
+ if (isFlushable(stdin))
+ stdin.flush();
+ },
+ reply: firstLine(child.stdout),
+ close: () => {
+ stdin.end();
+ }
+ };
};
-var probeSecretServiceLock = () => new Promise((resolve) => {
- const child = spawn5("gdbus", [
- "call",
- "--session",
- "--dest",
- "org.freedesktop.secrets",
- "--object-path",
- DEFAULT_COLLECTION,
- "--method",
- "org.freedesktop.DBus.Properties.Get",
- "org.freedesktop.Secret.Collection",
- "Locked"
- ], { stdio: ["ignore", "pipe", "ignore"] });
- let stdout = "";
- const timer = setTimeout(() => {
- child.kill();
- resolve("unknown");
- }, PROBE_TIMEOUT_MS2);
- child.stdout.on("data", (chunk) => {
- stdout += chunk.toString();
+async function callHelper(path, call, options = {}) {
+ const mutates = MUTATING.has(call.verb);
+ if (mutates && options.lease === undefined)
+ throw new HelperProtocolError(`The ${call.verb} helper call needs the session lock.`);
+ const helper = (options.spawn ?? spawnDetachedHelper)(path);
+ let handedOver = false;
+ try {
+ if (mutates && options.lease !== undefined) {
+ await options.lease.handOver(helper.pid);
+ handedOver = true;
+ }
+ helper.send(`${JSON.stringify({ v: 1, verb: call.verb, account: call.account, ...call.value === undefined ? {} : { value: call.value } })}
+`);
+ const line = await helper.reply;
+ if (handedOver && options.lease !== undefined) {
+ handedOver = false;
+ await options.lease.restore();
+ }
+ if (line === null)
+ throw new HelperProtocolError(`The keychain helper exited without answering ${call.verb}.`);
+ let json;
+ try {
+ json = JSON.parse(line);
+ } catch {
+ throw new HelperProtocolError(`The keychain helper sent a ${call.verb} reply that is not JSON.`);
+ }
+ const parsed = helperReplySchema.safeParse(json);
+ if (!parsed.success)
+ throw new HelperProtocolError(`The keychain helper sent an unexpected ${call.verb} reply.`);
+ return parsed.data;
+ } catch (error) {
+ if (handedOver && options.lease !== undefined) {
+ try {
+ await options.lease.restore();
+ } catch (restoreError) {
+ throw new AggregateError([error, restoreError], `The ${call.verb} helper call failed and the session lock could not be restored.`);
+ }
+ }
+ throw error;
+ } finally {
+ helper.close();
+ }
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/location.ts
+import { dirname as dirname42, join as join106, posix as posix13 } from "node:path";
+import { fileURLToPath as fileURLToPath8 } from "node:url";
+function bundleCandidates(moduleUrl) {
+ const root = dirname42(dirname42(dirname42(fileURLToPath8(moduleUrl))));
+ return [join106(root, "bin", "darwin", "omo-keychain"), join106(root, "omo-keychain")];
+}
+function machineCandidates(home, arch = process.arch) {
+ const runtimeArch = arch === "arm64" ? "arm64" : "x64";
+ return [
+ `/Applications/OmO.app/Contents/Resources/omo-runtime/darwin-${runtimeArch}/omo-keychain`,
+ posix13.join(home, "Applications", "OmO.app", "Contents", "Resources", "omo-runtime", `darwin-${runtimeArch}`, "omo-keychain"),
+ posix13.join(home, ".bun", "install", "global", "node_modules", "omo-ai", "bin", "darwin", "omo-keychain")
+ ];
+}
+async function locateHelper(candidates, verify) {
+ const rejected = [];
+ for (const path of candidates) {
+ const verdict = await verify(path);
+ if (verdict === "valid")
+ return { kind: "found", path };
+ if (verdict === "invalid")
+ rejected.push(path);
+ }
+ return rejected.length === 0 ? { kind: "missing" } : { kind: "invalid", rejected };
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/pin.ts
+import { readdirSync as readdirSync14, rmSync as rmSync9 } from "node:fs";
+import { chmod as chmod2, copyFile as copyFile4, constants as constants13, mkdtemp as mkdtemp2, rm as rm16, stat as stat8 } from "node:fs/promises";
+import { tmpdir as tmpdir6 } from "node:os";
+import { basename as basename15, join as join107 } from "node:path";
+var DIR_PREFIX = "omo-keychain-";
+var OWNED_DIR = new RegExp(`^${DIR_PREFIX}(\\d+)-`);
+var isAlive = (pid) => {
+ try {
+ process.kill(pid, 0);
+ return true;
+ } catch (error) {
+ return !(error instanceof Error && ("code" in error) && error.code === "ESRCH");
+ }
+};
+function sweepDeadPinDirs(root = tmpdir6()) {
+ const removed = [];
+ let entries;
+ try {
+ entries = readdirSync14(root);
+ } catch {
+ return removed;
+ }
+ for (const entry of entries) {
+ const owner = OWNED_DIR.exec(entry)?.[1];
+ if (owner === undefined || Number(owner) === process.pid || isAlive(Number(owner)))
+ continue;
+ try {
+ rmSync9(join107(root, entry), { recursive: true, force: true });
+ } catch {
+ continue;
+ }
+ removed.push(entry);
+ }
+ return removed;
+}
+var processDir;
+async function processPinDir() {
+ if (processDir !== undefined)
+ return processDir;
+ sweepDeadPinDirs();
+ const dir = await mkdtemp2(join107(tmpdir6(), `${DIR_PREFIX}${process.pid}-`));
+ process.once("exit", () => rmSync9(dir, { recursive: true, force: true }));
+ processDir = dir;
+ return dir;
+}
+var pinned = new Map;
+async function sourceIdentity(source) {
+ const info = await stat8(source);
+ return `${source}\x00${info.dev}\x00${info.ino}\x00${info.size}\x00${info.mtimeMs}\x00${info.ctimeMs}`;
+}
+async function copyAndVerify(source, verify, dir) {
+ const target = join107(dir, `${crypto.randomUUID()}-${basename15(source)}`);
+ try {
+ await copyFile4(source, target, constants13.COPYFILE_EXCL);
+ await chmod2(target, 320);
+ } catch (error) {
+ await rm16(target, { force: true });
+ return { kind: "unavailable", reason: error instanceof Error ? error.message : String(error) };
+ }
+ let verdict;
+ try {
+ verdict = await verify(target);
+ } catch (error) {
+ await rm16(target, { force: true });
+ return { kind: "unavailable", reason: error instanceof Error ? error.message : String(error) };
+ }
+ if (verdict === "valid")
+ return { kind: "pinned", path: target };
+ await rm16(target, { force: true });
+ return { kind: "invalid" };
+}
+async function pinVerifiedCopy(source, verify, dir) {
+ let identity;
+ try {
+ identity = `${dir ?? ""}\x00${await sourceIdentity(source)}`;
+ } catch (error) {
+ return { kind: "unavailable", reason: error instanceof Error ? error.message : String(error) };
+ }
+ const known = pinned.get(identity);
+ if (known !== undefined) {
+ const result = await known;
+ if (result.kind !== "pinned")
+ return result;
+ let verdict;
+ try {
+ verdict = await verify(result.path);
+ } catch (error) {
+ pinned.delete(identity);
+ await rm16(result.path, { force: true });
+ return { kind: "unavailable", reason: error instanceof Error ? error.message : String(error) };
+ }
+ if (verdict === "valid")
+ return result;
+ }
+ const created = Promise.resolve(dir ?? processPinDir()).then((target) => copyAndVerify(source, verify, target), (error) => ({ kind: "unavailable", reason: error instanceof Error ? error.message : String(error) }));
+ pinned.set(identity, created);
+ const result = await created;
+ if (result.kind !== "pinned")
+ pinned.delete(identity);
+ return result;
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/signature.ts
+import { stat as stat9 } from "node:fs/promises";
+init_bun_spawn_shim();
+var KEYCHAIN_HELPER_REQUIREMENT = 'identifier "com.mengmota.omo-keychain-helper" and anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] ' + 'and certificate leaf[field.1.2.840.113635.100.6.1.13] and certificate leaf[subject.OU] = "523JNR86LZ"';
+var STRICT_ALL_ARCHITECTURES = 1 << 4 | 1 << 0;
+var UTF8 = 134217984;
+var security;
+async function loadSecurity() {
+ if (security !== undefined)
+ return security;
+ try {
+ const { dlopen, FFIType, ptr } = await loadBunFfi();
+ const cf = dlopen("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation", {
+ CFStringCreateWithCString: { args: [FFIType.u64, FFIType.ptr, FFIType.u32], returns: FFIType.u64 },
+ CFURLCreateFromFileSystemRepresentation: { args: [FFIType.u64, FFIType.ptr, FFIType.i64, FFIType.bool], returns: FFIType.u64 },
+ CFRelease: { args: [FFIType.u64], returns: FFIType.void }
+ });
+ const sec = dlopen("/System/Library/Frameworks/Security.framework/Security", {
+ SecStaticCodeCreateWithPath: { args: [FFIType.u64, FFIType.u32, FFIType.ptr], returns: FFIType.i32 },
+ SecRequirementCreateWithString: { args: [FFIType.u64, FFIType.u32, FFIType.ptr], returns: FFIType.i32 },
+ SecStaticCodeCheckValidityWithErrors: { args: [FFIType.u64, FFIType.u32, FFIType.u64, FFIType.u64], returns: FFIType.i32 }
+ });
+ const cString = (text) => Buffer.from(`${text}\x00`, "utf8");
+ security = {
+ check(path, requirement) {
+ const pathBytes = Buffer.from(path, "utf8");
+ const url = BigInt(cf.symbols.CFURLCreateFromFileSystemRepresentation(0n, ptr(pathBytes), pathBytes.length, false));
+ const text = BigInt(cf.symbols.CFStringCreateWithCString(0n, ptr(cString(requirement)), UTF8));
+ const codeOut = new BigUint64Array(1);
+ const requirementOut = new BigUint64Array(1);
+ try {
+ if (url === 0n || text === 0n)
+ return false;
+ if (sec.symbols.SecStaticCodeCreateWithPath(url, 0, ptr(codeOut)) !== 0)
+ return false;
+ if (sec.symbols.SecRequirementCreateWithString(text, 0, ptr(requirementOut)) !== 0)
+ return false;
+ const code = codeOut[0] ?? 0n;
+ const designated = requirementOut[0] ?? 0n;
+ return sec.symbols.SecStaticCodeCheckValidityWithErrors(code, STRICT_ALL_ARCHITECTURES, designated, 0n) === 0;
+ } finally {
+ for (const ref of [url, text, codeOut[0] ?? 0n, requirementOut[0] ?? 0n])
+ if (ref !== 0n)
+ cf.symbols.CFRelease(ref);
+ }
+ }
+ };
+ } catch {
+ security = null;
+ }
+ return security;
+}
+async function verifyWithCodesign(path, requirement) {
+ const child = spawn(["/usr/bin/codesign", "--verify", "--strict", `-R=${requirement}`, path], {
+ stdout: "ignore",
+ stderr: "ignore",
+ env: {}
});
- child.on("error", () => {
- clearTimeout(timer);
- resolve("unknown");
+ return await child.exited === 0;
+}
+var verifyWithSecurityFramework = async (path, requirement) => {
+ const loaded = await loadSecurity();
+ return loaded === null ? verifyWithCodesign(path, requirement) : loaded.check(path, requirement);
+};
+async function fileIdentity(path) {
+ try {
+ const info = await stat9(path);
+ if (!info.isFile())
+ return null;
+ return `${path}\x00${info.dev}\x00${info.ino}\x00${info.size}\x00${info.mtimeMs}\x00${info.ctimeMs}`;
+ } catch {
+ return null;
+ }
+}
+function createSignatureChecker(check = verifyWithSecurityFramework, requirement = KEYCHAIN_HELPER_REQUIREMENT) {
+ const verdicts = new Map;
+ const checker = async (path) => {
+ const before = await fileIdentity(path);
+ if (before === null)
+ return "missing";
+ const known = verdicts.get(before);
+ if (known !== undefined)
+ return known;
+ const passed = await check(path, requirement);
+ if (await fileIdentity(path) !== before)
+ return "invalid";
+ const verdict = passed ? "valid" : "invalid";
+ verdicts.set(before, verdict);
+ return verdict;
+ };
+ return checker;
+}
+var processChecker;
+var processSignatureChecker = () => processChecker ??= createSignatureChecker();
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/access.ts
+async function resolveHelperAccess(candidates, options = {}) {
+ const verify = options.verify ?? processSignatureChecker();
+ let source;
+ let pin;
+ try {
+ const location = await locateHelper(candidates, verify);
+ if (location.kind !== "found")
+ return location;
+ source = location.path;
+ pin = await (options.pin ?? pinVerifiedCopy)(source, verify);
+ } catch (error) {
+ return { kind: "unavailable", reason: error instanceof Error ? error.message : String(error) };
+ }
+ if (pin.kind === "invalid")
+ return { kind: "invalid", rejected: [source] };
+ if (pin.kind === "unavailable")
+ return { kind: "unavailable", reason: pin.reason };
+ const pinned = pin.path;
+ const spawn = options.spawn ?? spawnDetachedHelper;
+ return {
+ kind: "ready",
+ path: pinned,
+ call: async (call, lease) => {
+ const verdict = await verify(pinned).catch((error) => {
+ throw new HelperProtocolError(`OmO's keychain helper could not be checked before it ran: ${error instanceof Error ? error.message : String(error)}`);
+ });
+ if (verdict !== "valid")
+ throw new HelperProtocolError("OmO's keychain helper changed on disk and failed its signature check; it was not run.");
+ return callHelper(pinned, call, { spawn, ...lease === undefined ? {} : { lease } });
+ }
+ };
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/approval-cache.ts
+var systemClock = { nowSeconds: () => Date.now() / 1000, sleepMs: (ms) => new Promise((resolve) => setTimeout(resolve, ms)) };
+function isEntryValid(entry, current, nowSeconds) {
+ if (nowSeconds < entry.readStartedAt)
+ return false;
+ return current.cdat === entry.cdat && current.mdat === entry.mdat && Math.floor(current.mdat) < Math.floor(entry.readStartedAt);
+}
+function createApprovalCache(clock = systemClock) {
+ let entry = null;
+ let deniedForBackground = false;
+ let pending = null;
+ return {
+ consume(current) {
+ if (entry === null)
+ return null;
+ if (!isEntryValid(entry, current, clock.nowSeconds())) {
+ entry = null;
+ return null;
+ }
+ return entry.value;
+ },
+ deniedForBackground: () => deniedForBackground,
+ inFlight: () => pending,
+ approve(run) {
+ if (pending !== null)
+ return pending;
+ const readStartedAt = clock.nowSeconds();
+ const started = run().then((answer) => {
+ if (answer.kind === "approved") {
+ entry = { value: answer.value, ...answer.attributes, readStartedAt };
+ deniedForBackground = false;
+ } else if (answer.kind === "denied")
+ deniedForBackground = true;
+ return answer;
+ });
+ const settled = () => {
+ if (pending === started)
+ pending = null;
+ };
+ started.then(settled, settled);
+ pending = started;
+ return started;
+ },
+ async afterOwnWrite(value, readAttributes) {
+ if (entry === null)
+ return;
+ const written = await readAttributes();
+ if (written === null) {
+ entry = null;
+ return;
+ }
+ while (Math.floor(clock.nowSeconds()) <= Math.floor(written.mdat)) {
+ await clock.sleepMs(Math.max(1, Math.ceil((Math.floor(written.mdat) + 1 - clock.nowSeconds()) * 1000)));
+ }
+ const readStartedAt = clock.nowSeconds();
+ const fresh = await readAttributes();
+ entry = fresh === null ? null : { value, ...fresh, readStartedAt };
+ },
+ drop() {
+ entry = null;
+ }
+ };
+}
+var processApprovalCache = () => {
+ const state = keychainProcessState();
+ state.approvalCache ??= createApprovalCache();
+ return state.approvalCache;
+};
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/darwin-read.ts
+var ROW_8B_DEFAULT = "re-login";
+
+class HelperReadError extends Error {
+ failure;
+ constructor(failure, message) {
+ super(message);
+ this.failure = failure;
+ }
+}
+function failure2(reply) {
+ if (reply.error === "locked")
+ return new HelperReadError("locked", "The keychain is locked.");
+ return new HelperReadError("store", `The keychain helper answered ${reply.error ?? "unexpectedly"}.`);
+}
+async function approveOnce(deps) {
+ const running = deps.cache.inFlight();
+ if (running !== null)
+ return running;
+ const release = await deps.takePromptLock();
+ if (release === null)
+ throw new HelperReadError("pending", "Another omo process is waiting for your keychain approval.");
+ try {
+ return await deps.cache.approve(async () => {
+ const reply = await deps.access.call({ verb: "approve", account: deps.account });
+ if (reply.missing === true)
+ return { kind: "missing" };
+ if (reply.error === "denied")
+ return { kind: "denied" };
+ if (reply.error !== undefined || reply.value === undefined || reply.cdat === undefined || reply.mdat === undefined)
+ throw failure2(reply);
+ return { kind: "approved", value: reply.value, attributes: { cdat: reply.cdat, mdat: reply.mdat } };
+ });
+ } finally {
+ await release();
+ }
+}
+async function readThroughHelper(deps, allowPrompt) {
+ const reply = await deps.access.call({ verb: "read", account: deps.account });
+ if (reply.error !== undefined)
+ throw failure2(reply);
+ if (reply.missing === true)
+ return { kind: "missing", reply };
+ if (reply.owned === true && reply.value !== undefined)
+ return { kind: "value", value: reply.value, source: reply.marker === true || reply.recover === true ? "owned" : "owned-unmarked", reply };
+ const own = await deps.ownSilentGet().catch(() => {
+ return;
});
- child.on("close", (code) => {
- clearTimeout(timer);
- resolve(code === 0 ? parseLockedReply(stdout) ?? "absent" : "absent");
+ if (typeof own === "string")
+ return { kind: "value", value: own, source: "own-identity", reply };
+ if (reply.cdat === undefined || reply.mdat === undefined)
+ throw failure2(reply);
+ const cached = deps.cache.consume({ cdat: reply.cdat, mdat: reply.mdat });
+ if (cached !== null)
+ return { kind: "value", value: cached, source: "approved", reply };
+ const reloginInstead = reply.partition !== "ours" && reply.partition !== "none" && (deps.row8b ?? ROW_8B_DEFAULT) === "re-login";
+ if (!allowPrompt) {
+ if (reloginInstead)
+ return { kind: "missing", reply };
+ throw new HelperReadError("pending", "The keychain needs your approval; run an omo command in a terminal.");
+ }
+ if (deps.background && deps.cache.deniedForBackground())
+ throw new HelperReadError("pending", "Keychain access was denied; run an omo command in a terminal to approve it.");
+ if (reloginInstead)
+ return { kind: "missing", reply };
+ if (deps.noDialog === true)
+ throw new HelperReadError("pending", "The keychain hand-off cannot show a dialog.");
+ if (deps.handOff !== undefined && await deps.handOff()) {
+ const after = await deps.access.call({ verb: "read", account: deps.account });
+ if (after.owned === true && after.value !== undefined)
+ return { kind: "value", value: after.value, source: "owned", reply: after };
+ }
+ const answer = await approveOnce(deps);
+ if (answer.kind === "approved")
+ return { kind: "value", value: answer.value, source: "approved", reply };
+ if (answer.kind === "missing")
+ return { kind: "missing", reply };
+ throw new HelperReadError("denied", "Keychain access was denied.");
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/recovery.ts
+var OLD_SLOT_COUNT = 8;
+var oldSlotName = (account, slot) => slot === 0 ? `${account}.old` : `${account}.old.${slot}`;
+function recoveryPlan(names) {
+ if (!names.original && names.staging)
+ return names.old ? ["promote", "delete-old"] : ["promote"];
+ if (!names.original && names.old)
+ return ["delete-old"];
+ if (names.original && names.staging)
+ return names.old ? ["remove-staging", "delete-old"] : ["remove-staging"];
+ if (names.original && names.old)
+ return ["delete-old"];
+ return [];
+}
+function oldSlotsOf(reply) {
+ return reply.present?.oldSlots ?? (reply.present?.old === true ? [0] : []);
+}
+function namesFromRead(reply) {
+ const original = reply.owned === false || reply.owned === true && reply.recover !== true;
+ return { original, staging: reply.present?.staging === true, old: reply.present?.old === true, oldSlots: oldSlotsOf(reply) };
+}
+async function deleteOld(name, helper, deleteOwn) {
+ const removed = await helper({ verb: "remove", account: name }).catch(() => null);
+ if (removed?.ok === true)
+ return true;
+ return deleteOwn(name).catch(() => false);
+}
+async function deleteOldSlots(account, slots, helper, deleteOwn) {
+ let cleared = true;
+ for (const slot of slots)
+ if (!await deleteOld(oldSlotName(account, slot), helper, deleteOwn))
+ cleared = false;
+ return cleared;
+}
+async function runRecovery(account, names, helper, deleteOwnOld) {
+ const applied = [];
+ for (const step of recoveryPlan(names)) {
+ const ok = step === "promote" ? (await helper({ verb: "promote", account })).ok === true : step === "remove-staging" ? (await helper({ verb: "remove", account: `${account}.staging` })).ok === true : await deleteOldSlots(account, names.oldSlots, helper, deleteOwnOld);
+ if (!ok && step !== "delete-old")
+ return { applied, failed: step };
+ if (ok)
+ applied.push(step);
+ }
+ return { applied, failed: null };
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/migration.ts
+var MIGRATABLE = new Set(["own-identity", "owned-unmarked", "approved"]);
+async function migrate(account, value, source, helper, deleteOwnOld) {
+ if (!MIGRATABLE.has(source))
+ return { kind: "skipped", reason: "not-migratable" };
+ if ((await helper({ verb: "stage", account, value })).ok !== true)
+ return { kind: "failed", step: "stage" };
+ const retired = await helper({ verb: "retire", account });
+ if (retired.error === "exists" && retired.reason === "old-slots-full" || retired.ok === true && retired.skipped === true) {
+ await helper({ verb: "remove", account: `${account}.staging` });
+ return { kind: "skipped", reason: "old-slots-full" };
+ }
+ if (retired.ok !== true)
+ return { kind: "failed", step: "retire" };
+ const slot = retired.slot ?? 0;
+ if ((await helper({ verb: "promote", account })).ok !== true)
+ return { kind: "failed", step: "promote" };
+ return { kind: "migrated", oldDeleted: await deleteOld(oldSlotName(account, slot), helper, deleteOwnOld) };
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/darwin-store.ts
+class HelperOldSlotsFull extends Error {
+}
+var ALL_OLD_SLOTS = Array.from({ length: OLD_SLOT_COUNT }, (_, slot) => slot);
+var OLD_SLOTS_FULL_MESSAGE = 'The macOS keychain holds 8 earlier OmO sign-ins that cannot be removed automatically. Open Keychain Access, delete the items whose account name ends in ".old" or ".old.1" to ".old.7" for OmO, then sign in again.';
+var failed = (reply, verb) => new HelperReadError(reply.error === "locked" ? "locked" : "store", `The keychain helper could not ${verb} the sign-in (${reply.error ?? "no answer"}).`);
+function lockedDarwinStore(deps, lease) {
+ const helper = (call) => deps.access.call(call, lease);
+ const deleteOwnOld = (name) => deps.ownDelete(name);
+ let lastRead = null;
+ const read = async () => {
+ const result = await readThroughHelper(deps, false);
+ lastRead = result.kind === "value" ? result : null;
+ return result.kind === "value" ? result.value : null;
+ };
+ return {
+ async recover() {
+ const reply = await deps.access.call({ verb: "read", account: deps.account });
+ if (reply.error === undefined)
+ await runRecovery(deps.account, namesFromRead(reply), helper, deleteOwnOld);
+ },
+ read,
+ async settle() {
+ if (lastRead === null)
+ return;
+ const outcome = await migrate(deps.account, lastRead.value, lastRead.source, helper, deleteOwnOld);
+ if (outcome.kind === "skipped" && outcome.reason === "old-slots-full")
+ deps.notice(`omo: ${OLD_SLOTS_FULL_MESSAGE}`);
+ if (outcome.kind === "failed")
+ deps.notice(`omo: the macOS keychain item could not be moved to OmO's keychain helper (${outcome.step}); it keeps working as before.`);
+ },
+ async write(value, intent, beforeRetire) {
+ const state = await deps.access.call({ verb: "read", account: deps.account });
+ if (state.error !== undefined)
+ throw failed(state, "check");
+ if (state.owned === false) {
+ const approved = state.cdat !== undefined && state.mdat !== undefined && deps.cache.consume({ cdat: state.cdat, mdat: state.mdat }) !== null;
+ const readable = lastRead !== null || approved || await deps.ownSilentGet().catch(() => {
+ return;
+ }) !== undefined;
+ if (readable || intent !== "fresh-sign-in") {
+ await deps.ownOverwrite(value);
+ if (lastRead?.source === "approved")
+ await deps.cache.afterOwnWrite(value, async () => {
+ const after = await deps.access.call({ verb: "read", account: deps.account });
+ return after.cdat === undefined || after.mdat === undefined ? null : { cdat: after.cdat, mdat: after.mdat };
+ });
+ return;
+ }
+ await beforeRetire?.();
+ const retired = await helper({ verb: "retire", account: deps.account });
+ if (retired.reason === "old-slots-full" || retired.ok === true && retired.skipped === true)
+ throw new HelperOldSlotsFull(OLD_SLOTS_FULL_MESSAGE);
+ if (retired.ok !== true)
+ throw failed(retired, "replace");
+ }
+ const written = await helper({ verb: "write", account: deps.account, value });
+ if (written.ok !== true)
+ throw failed(written, "save");
+ lastRead = { kind: "value", value, source: "owned", reply: written };
+ },
+ async clear() {
+ const removed = await helper({ verb: "remove", account: deps.account });
+ if (removed.error === "not-owned")
+ await deps.ownDelete(deps.account);
+ else if (removed.ok !== true)
+ throw failed(removed, "remove");
+ await helper({ verb: "remove", account: `${deps.account}.staging` });
+ const present = await helper({ verb: "read", account: deps.account });
+ const slots = present.error === undefined ? oldSlotsOf(present) : ALL_OLD_SLOTS;
+ await deleteOldSlots(deps.account, slots, helper, deleteOwnOld);
+ lastRead = null;
+ }
+ };
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/owner-marker.ts
+init_bun_spawn_shim();
+var MARKER_LINE = /^\s*"gena"<blob>="omo-owner\/1"\s*$/m;
+var ITEM_NOT_FOUND = 44;
+var probeOwnerMarker = async (service, account, keychain) => {
+ const args = ["find-generic-password", "-s", service, "-a", account, ...keychain === undefined ? [] : [keychain]];
+ const child = spawn(["/usr/bin/security", ...args], {
+ stdout: "pipe",
+ stderr: "ignore",
+ env: process.env.HOME === undefined ? {} : { HOME: process.env.HOME }
});
-});
+ const [stdout, code] = await Promise.all([new Response(child.stdout).text(), child.exited]);
+ if (code === ITEM_NOT_FOUND)
+ return "absent";
+ if (code !== 0)
+ return "unknown";
+ return MARKER_LINE.test(stdout) ? "helper-owned" : "other";
+};
-// packages/omo-opencode/src/cli/service-auth/credential-lock.ts
-import { AsyncLocalStorage as AsyncLocalStorage3 } from "node:async_hooks";
-import { createHash as createHash11 } from "node:crypto";
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/prompt-lock.ts
import { mkdir as mkdir11 } from "node:fs/promises";
-import { homedir as homedir31 } from "node:os";
-import { join as join106 } from "node:path";
+import { dirname as dirname45 } from "node:path";
// packages/team-core/src/team-state-store/lock-publish.ts
-import { access as access4, open as open3, unlink as unlink3 } from "node:fs/promises";
-import { dirname as dirname42 } from "node:path";
+import { access as access5, open as open3, unlink as unlink4 } from "node:fs/promises";
+import { dirname as dirname43 } from "node:path";
// packages/team-core/src/team-state-store/lock-record.ts
import { randomUUID as randomUUID6 } from "node:crypto";
-import { readFile as readFile34, stat as stat9 } from "node:fs/promises";
+import { readFile as readFile35, stat as stat11 } from "node:fs/promises";
// packages/memory-core/src/locks/process-identity.ts
import { execFile as execFile7 } from "node:child_process";
@@ -112883,23 +113625,23 @@ function rename8(from, to, admit) {
}
var sync = resilientNamespace(fsSync, "sync");
var {
- access: access3,
- chmod: chmod2,
- copyFile: copyFile4,
+ access: access4,
+ chmod: chmod3,
+ copyFile: copyFile5,
cp: cp5,
link,
lstat: lstat18,
mkdir: mkdir10,
- mkdtemp: mkdtemp2,
- readFile: readFile33,
+ mkdtemp: mkdtemp3,
+ readFile: readFile34,
readdir: readdir17,
readlink: readlink7,
realpath: realpath2,
- rm: rm16,
+ rm: rm17,
rmdir: rmdir2,
- stat: stat8,
+ stat: stat10,
statfs,
- unlink: unlink2
+ unlink: unlink3
} = promises;
var {
accessSync: accessSync5,
@@ -112909,7 +113651,7 @@ var {
lstatSync: lstatSync5,
mkdirSync: mkdirSync19,
readFileSync: readFileSync44,
- readdirSync: readdirSync14,
+ readdirSync: readdirSync15,
realpathSync: realpathSync13,
statSync: statSync8,
unlinkSync: unlinkSync10,
@@ -113022,7 +113764,7 @@ async function execFileText(command, args) {
}
async function readLinuxStartIdentity(pid) {
try {
- const stat = await readFile33(`/proc/${pid}/stat`, "utf8");
+ const stat = await readFile34(`/proc/${pid}/stat`, "utf8");
const commandEnd = stat.lastIndexOf(")");
if (commandEnd < 0)
return null;
@@ -113261,14 +114003,17 @@ async function isWorkerLockReleased(incarnation, record) {
// packages/team-core/src/team-state-store/lock-record.ts
async function buildLockRecord(ownerTag) {
await registerLockWorker();
- const processStart = await getProcessStartIdentity(process.pid);
+ const processStart = await lockProcessStartLine(process.pid);
return `${ownerTag} ${randomUUID6()}
${process.pid}
${Date.now()}
${lockOwnerInstanceId}
-${processStart ?? "unavailable"}
+${processStart}
`;
}
+async function lockProcessStartLine(pid) {
+ return await getProcessStartIdentity(pid) ?? "unavailable";
+}
function errorCode2(error) {
if (!(error instanceof Error) || !("code" in error))
return null;
@@ -113297,8 +114042,8 @@ function parseLockOwner(content) {
}
async function readLockRecord(lockPath) {
try {
- const content = await readFile34(lockPath, "utf8");
- const { mtimeMs } = await stat9(lockPath);
+ const content = await readFile35(lockPath, "utf8");
+ const { mtimeMs } = await stat11(lockPath);
return { content, modifiedAtEpochMs: mtimeMs };
} catch (error) {
if (!(error instanceof Error))
@@ -113329,7 +114074,7 @@ async function isLockRecordStale(record, staleAfterMs) {
// packages/team-core/src/team-state-store/lock-publish.ts
async function pathMayExist(path, deps = {}) {
- const accessPath = deps.access ?? access4;
+ const accessPath = deps.access ?? access5;
try {
await accessPath(path);
return true;
@@ -113346,7 +114091,7 @@ async function assertRetryableLockOpenError(lockPath, error, deps) {
if (code === "EPERM") {
if (await pathMayExist(lockPath, deps))
return;
- if ((deps?.platform ?? process.platform) === "win32" && await pathMayExist(dirname42(lockPath), deps))
+ if ((deps?.platform ?? process.platform) === "win32" && await pathMayExist(dirname43(lockPath), deps))
return;
}
throw error;
@@ -113366,7 +114111,7 @@ async function publishLockRecord(lockPath, record) {
} catch (error) {
markLockRecordReleased(record);
await fileHandle.close();
- await unlink3(lockPath).catch(() => {
+ await unlink4(lockPath).catch(() => {
return;
});
throw error;
@@ -113375,9 +114120,14 @@ async function publishLockRecord(lockPath, record) {
return true;
}
+// packages/team-core/src/team-state-store/lock-lease.ts
+import { randomUUID as randomUUID7 } from "node:crypto";
+import { open as open4, readdir as readdir18, readFile as readFile36, rename as rename9, rm as rm18 } from "node:fs/promises";
+import { basename as basename16, dirname as dirname44, join as join108 } from "node:path";
+
// packages/team-core/src/team-state-store/lock-reclaim.ts
import { createHash as createHash10 } from "node:crypto";
-import { unlink as unlink4 } from "node:fs/promises";
+import { unlink as unlink5 } from "node:fs/promises";
var RECLAIM_UNLINK_ATTEMPTS = 3;
var RECLAIM_UNLINK_RETRY_MS = 25;
function delay2(ms) {
@@ -113390,7 +114140,7 @@ function reclaimGuardPath(lockPath, record) {
}
async function unlinkWithRetry(path, deps) {
const wait = deps.delay ?? delay2;
- const unlinkFile = deps.unlink ?? unlink4;
+ const unlinkFile = deps.unlink ?? unlink5;
for (let attempt = 1;; attempt += 1) {
try {
await unlinkFile(path);
@@ -113408,6 +114158,19 @@ async function unlinkWithRetry(path, deps) {
}
}
async function removeLockRecordIfUnchanged(lockPath, expectedRecord, staleAfterMs, deps = {}) {
+ return withRecordGuard(lockPath, expectedRecord, staleAfterMs, deps, async () => {
+ const current = await readLockRecord(lockPath);
+ if (current === null)
+ return "absent";
+ if (current.content !== expectedRecord || !await isLockRecordStale(current, staleAfterMs))
+ return "changed";
+ const unlinked = await unlinkWithRetry(lockPath, deps);
+ if (unlinked !== "stuck")
+ forgetLockRecord(expectedRecord);
+ return unlinked === "absent" ? "absent" : unlinked;
+ });
+}
+async function withRecordGuard(lockPath, expectedRecord, staleAfterMs, deps, act) {
const guardPath = reclaimGuardPath(lockPath, expectedRecord);
const guardRecord = await buildLockRecord("lock-reclaim");
if (!await publishLockRecord(guardPath, guardRecord)) {
@@ -113418,15 +114181,7 @@ async function removeLockRecordIfUnchanged(lockPath, expectedRecord, staleAfterM
return "busy";
}
try {
- const current = await readLockRecord(lockPath);
- if (current === null)
- return "absent";
- if (current.content !== expectedRecord || !await isLockRecordStale(current, staleAfterMs))
- return "changed";
- const unlinked = await unlinkWithRetry(lockPath, deps);
- if (unlinked !== "stuck")
- forgetLockRecord(expectedRecord);
- return unlinked === "absent" ? "absent" : unlinked;
+ return await act();
} finally {
markLockRecordReleased(guardRecord);
if (await unlinkWithRetry(guardPath, deps) !== "stuck")
@@ -113434,6 +114189,97 @@ async function removeLockRecordIfUnchanged(lockPath, expectedRecord, staleAfterM
}
}
+// packages/team-core/src/team-state-store/lock-lease.ts
+class LockLeaseLostError extends Error {
+ constructor(lockPath) {
+ super(`The lock at ${lockPath} changed while it was handed over; the critical section was aborted.`);
+ this.name = "LockLeaseLostError";
+ }
+}
+var leaseTempPrefix = (lockPath) => `.${basename16(lockPath)}.`;
+var LEASE_TEMP_SUFFIX = ".lease";
+var UUID2 = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
+var escapeRegExp2 = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
+var leaseTempPattern = (lockPath) => new RegExp(`^\\.${escapeRegExp2(basename16(lockPath))}\\.${UUID2}\\.lease$`);
+async function replaceRecord(lockPath, content) {
+ const temporary = join108(dirname44(lockPath), `${leaseTempPrefix(lockPath)}${randomUUID7()}${LEASE_TEMP_SUFFIX}`);
+ try {
+ const handle = await open4(temporary, "wx", 384);
+ try {
+ await handle.writeFile(content);
+ } finally {
+ await handle.close();
+ }
+ await rename9(temporary, lockPath);
+ } catch (error) {
+ await rm18(temporary, { force: true });
+ throw error;
+ }
+}
+async function removeLeftoverTemps(lockPath) {
+ const pattern = leaseTempPattern(lockPath);
+ let entries;
+ try {
+ entries = await readdir18(dirname44(lockPath));
+ } catch (error) {
+ if (error instanceof Error && "code" in error && error.code === "ENOENT")
+ return;
+ throw error;
+ }
+ for (const entry of entries) {
+ if (pattern.test(entry))
+ await rm18(join108(dirname44(lockPath), entry), { force: true });
+ }
+}
+async function currentRecord(lockPath) {
+ try {
+ return await readFile36(lockPath, "utf8");
+ } catch (error) {
+ if (error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
+ return null;
+ throw error;
+ }
+}
+function createLockLease(lockPath, ownerRecord, ownerTag, options = {}) {
+ const staleAfterMs = options.staleAfterMs ?? Number.POSITIVE_INFINITY;
+ let handedTo = null;
+ return {
+ async handOver(pid) {
+ if (handedTo !== null)
+ throw new Error("The lock is already handed over; restore it first.");
+ if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid)
+ throw new Error(`Cannot hand the lock to pid ${pid}.`);
+ if (await currentRecord(lockPath) !== ownerRecord)
+ throw new LockLeaseLostError(lockPath);
+ await removeLeftoverTemps(lockPath);
+ const processStart = await lockProcessStartLine(pid);
+ const record = `${ownerTag} ${randomUUID7()}
+${pid}
+${Date.now()}
+${randomUUID7()}
+${processStart}
+`;
+ await replaceRecord(lockPath, record);
+ handedTo = record;
+ },
+ async restore() {
+ if (handedTo === null)
+ throw new Error("The lock is not handed over.");
+ const expected = handedTo;
+ handedTo = null;
+ const outcome = await withRecordGuard(lockPath, expected, staleAfterMs, {}, async () => {
+ if (await currentRecord(lockPath) !== expected)
+ return "lost";
+ await options.beforeRestoreRename?.();
+ await replaceRecord(lockPath, ownerRecord);
+ return "restored";
+ });
+ if (outcome !== "restored")
+ throw new LockLeaseLostError(lockPath);
+ }
+ };
+}
+
// packages/team-core/src/team-state-store/locks.ts
var LOCK_RETRY_MS = 50;
var LOCK_WAIT_TIMEOUT_MS = 15000;
@@ -113463,7 +114309,7 @@ async function withLock(lockPath, fn, opts) {
const ownerTag = opts?.ownerTag ?? "owner";
const record = await acquireLock(lockPath, ownerTag, staleAfterMs);
try {
- return await fn();
+ return await fn(createLockLease(lockPath, record, ownerTag, { staleAfterMs }));
} finally {
markLockRecordReleased(record);
const outcome = await removeLockRecordIfUnchanged(lockPath, record, staleAfterMs);
@@ -113480,20 +114326,382 @@ async function reapStaleLock(lockPath, staleAfterMs = DEFAULT_STALE_AFTER_MS, de
return await removeLockRecordIfUnchanged(lockPath, observed.content, staleAfterMs, deps);
}
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/prompt-lock.ts
+function promptLockAt(path, hooks = {}) {
+ return async () => {
+ const held = keychainProcessState().heldPromptLocks;
+ if (held.has(path))
+ return null;
+ held.add(path);
+ let granted = false;
+ try {
+ await mkdir11(dirname45(path), { recursive: true, mode: 448 });
+ await hooks.beforePublish?.();
+ for (let attempt = 0;attempt < 2; attempt++) {
+ const record = await buildLockRecord("keychain-prompt");
+ if (await publishLockRecord(path, record)) {
+ granted = true;
+ return async () => {
+ markLockRecordReleased(record);
+ try {
+ await (hooks.removeRecord ?? ((target, owned) => removeLockRecordIfUnchanged(target, owned, Number.POSITIVE_INFINITY)))(path, record);
+ } finally {
+ held.delete(path);
+ }
+ };
+ }
+ if (await reapStaleLock(path, Number.POSITIVE_INFINITY) !== "removed")
+ return null;
+ }
+ return null;
+ } finally {
+ if (!granted)
+ held.delete(path);
+ }
+ };
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/darwin-backend.ts
+var ROW_9B_DEFAULT = "reinstall-notice";
+var helperAccess = () => sharedHelperAccess(() => {
+ const { entryCandidates } = keychainProcessState();
+ return resolveHelperAccess([...entryCandidates, ...bundleCandidates(import.meta.url), ...machineCandidates(homedir31())]);
+});
+function sharedHelperAccess(resolve) {
+ const state = keychainProcessState();
+ if (state.helperAccess !== undefined)
+ return state.helperAccess;
+ const started = resolve();
+ state.helperAccess = started;
+ started.then((access) => {
+ if (access.kind === "unavailable" && state.helperAccess === started)
+ state.helperAccess = undefined;
+ }, () => {
+ if (state.helperAccess === started)
+ state.helperAccess = undefined;
+ });
+ return started;
+}
+
+class HelperMissingForOwnedItem extends Error {
+}
+function asKeystoreError(error, pending) {
+ if (!(error instanceof HelperReadError))
+ return error;
+ if (error.failure === "pending")
+ return pending(error.message);
+ if (error.failure === "locked")
+ return Object.assign(new Error(error.message), { code: "-25308" });
+ return error;
+}
+function createDarwinBackend(options) {
+ const silently = options.silently ?? silentSecrets;
+ const key = { service: options.service, name: options.account };
+ const deps = {
+ account: options.account,
+ access: options.access,
+ cache: options.cache ?? processApprovalCache(),
+ background: options.background,
+ takePromptLock: promptLockAt(join109(options.home ?? homedir31(), ".omo", "session-locks", `${options.account}.keychain-prompt`)),
+ ownSilentGet: () => silently(() => options.secrets.get(key)),
+ ownOverwrite: (value) => silently(() => options.secrets.set({ ...key, value })),
+ ownDelete: (name) => name === options.account ? gatedSecrets(() => options.secrets.delete({ ...key, name })) : silently(() => options.secrets.delete({ ...key, name })),
+ notice: options.notice,
+ ...options.row8b === undefined ? {} : { row8b: options.row8b },
+ ...options.handOff === undefined ? {} : { handOff: options.handOff },
+ noDialog: options.noDialog === true
+ };
+ let unowned = false;
+ return {
+ read: async () => {
+ const result = await readThroughHelper(deps, true);
+ unowned = result.kind === "value" && result.source !== "owned";
+ return result.kind === "value" ? result.value : null;
+ },
+ underLock: (lease) => lockedDarwinStore(deps, lease),
+ migrationPending: () => unowned
+ };
+}
+async function guardHelperlessRead(service, account, choice = ROW_9B_DEFAULT, probe = probeOwnerMarker) {
+ if (choice === "dialog")
+ return;
+ if (await probe(service, account) === "helper-owned")
+ throw new HelperMissingForOwnedItem("OmO's keychain helper is missing or damaged on this Mac. Reinstall omo, then try again.");
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/store-binding.ts
+import { homedir as homedir32 } from "node:os";
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/creator-handoff.ts
+init_bun_file_shim();
+init_bun_spawn_shim();
+import { dirname as dirname47, posix as posix14 } from "node:path";
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/runtime-capabilities.ts
+init_zod();
+import { readFile as readFile37 } from "node:fs/promises";
+import { dirname as dirname46, join as join110 } from "node:path";
+var RUNTIME_CAPABILITIES_FILE = "omo-runtime-capabilities.json";
+var RUNTIME_CAPABILITIES = { keychainHandoff: 1 };
+var capabilitiesSchema = object({ keychainHandoff: number2().int() }).passthrough();
+async function runtimeDeclaresKeychainHandoff(runtime) {
+ const text = await readFile37(join110(dirname46(runtime), RUNTIME_CAPABILITIES_FILE), "utf8").catch(() => null);
+ if (text === null)
+ return false;
+ try {
+ const parsed = capabilitiesSchema.safeParse(JSON.parse(text));
+ return parsed.success && parsed.data.keychainHandoff >= RUNTIME_CAPABILITIES.keychainHandoff;
+ } catch {
+ return false;
+ }
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/creator-handoff.ts
+var DEVELOPER_ID_TEAM = 'anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] and certificate leaf[field.1.2.840.113635.100.6.1.13] and certificate leaf[subject.OU] = "523JNR86LZ"';
+var DESKTOP_RUNTIME_REQUIREMENT = `identifier "com.mengmota.omo-desktop-runtime" and ${DEVELOPER_ID_TEAM}`;
+var DESKTOP_APP_REQUIREMENT = DEVELOPER_ID_TEAM;
+var HANDOFF_ENV = "OMO_KEYCHAIN_HANDOFF";
+var HANDOFF_DEADLINE_MS = 45000;
+function desktopRuntimeCandidates(home, arch = process.arch) {
+ const runtimeArch = arch === "arm64" ? "arm64" : "x64";
+ return ["/Applications/OmO.app", posix14.join(home, "Applications", "OmO.app")].map((app) => ({
+ app,
+ runtime: posix14.join(app, "Contents", "Resources", "omo-runtime", `darwin-${runtimeArch}`, "omo")
+ }));
+}
+var verifyBundle = async (app, requirement) => {
+ const child = spawn(["/usr/bin/codesign", "--verify", "--deep", "--strict", `-R=${requirement}`, app], {
+ stdin: "ignore",
+ stdout: "ignore",
+ stderr: "ignore"
+ });
+ return await child.exited === 0;
+};
+var runBounded = async (path, args, env, deadlineMs) => {
+ const child = spawn([path, ...args], { cwd: dirname47(path), stdin: "ignore", stdout: "ignore", stderr: "ignore", env });
+ let killed = false;
+ const timer = setTimeout(() => {
+ killed = true;
+ child.kill("SIGKILL");
+ }, deadlineMs);
+ try {
+ const code = await child.exited;
+ return killed ? null : code;
+ } finally {
+ clearTimeout(timer);
+ }
+};
+function createCreatorHandOff(options) {
+ return async () => {
+ const env = options.env ?? process.env;
+ if (env[HANDOFF_ENV] === "1")
+ return false;
+ const checkRuntime = options.checkRuntime ?? verifyWithSecurityFramework;
+ const checkBundle = options.checkBundle ?? verifyBundle;
+ const declaresHandOff = options.declaresHandOff ?? runtimeDeclaresKeychainHandoff;
+ const self = options.selfPath ?? process.execPath;
+ for (const { app, runtime } of options.candidates) {
+ if (runtime === self || !await bunFile(runtime).exists())
+ continue;
+ const verified = await Promise.resolve().then(async () => await checkBundle(app, DESKTOP_APP_REQUIREMENT) && await checkRuntime(runtime, DESKTOP_RUNTIME_REQUIREMENT) && await declaresHandOff(runtime)).catch(() => false);
+ if (!verified)
+ continue;
+ const childEnv = { [HANDOFF_ENV]: "1" };
+ if (env.HOME !== undefined)
+ childEnv.HOME = env.HOME;
+ const origin = options.origin ?? env.OMO_SERVICE_API_URL;
+ if (origin !== undefined)
+ childEnv.OMO_SERVICE_API_URL = origin;
+ try {
+ return await (options.run ?? runBounded)(runtime, ["account", "token"], childEnv, HANDOFF_DEADLINE_MS) === 0;
+ } catch {
+ return false;
+ }
+ }
+ return false;
+ };
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/store-binding.ts
+var readers = new Map;
+var INJECTED_SECRETS = Symbol.for("omo.test.injectedSecrets");
+var isInjectedSecrets = (api) => api[INJECTED_SECRETS] === true;
+var backends = new Map;
+function processHandOff(origin) {
+ return () => {
+ const state = keychainProcessState();
+ state.handOff ??= createCreatorHandOff({ candidates: desktopRuntimeCandidates(homedir32()), origin })();
+ return state.handOff;
+ };
+}
+function bindKeychainHelper(input) {
+ const { secrets: real, key, options } = input;
+ const eligible = input.platform === "darwin" && input.namespace === "omo-cli" && (options !== undefined || typeof Bun !== "undefined" && real === Bun.secrets && !isInjectedSecrets(real));
+ const secrets = !eligible ? real : {
+ get: (entry) => gatedSecrets(() => real.get(entry)),
+ set: (entry) => gatedSecrets(() => real.set(entry)),
+ delete: (entry) => gatedSecrets(() => real.delete(entry))
+ };
+ const cacheKey = `${key.service}
+${key.name}
+${input.background ? "bounded" : "interactive"}`;
+ let own;
+ const backend = () => {
+ if (!eligible)
+ return Promise.resolve(null);
+ const known = options === undefined ? backends.get(cacheKey) : own;
+ if (known !== undefined)
+ return known;
+ const created = (options?.access ?? helperAccess)().then((access) => access.kind !== "ready" ? null : createDarwinBackend({
+ access,
+ secrets: real,
+ service: key.service,
+ account: key.name,
+ background: input.background,
+ noDialog: options?.noDialog ?? process.env[HANDOFF_ENV] === "1",
+ notice: input.notice,
+ ...options?.home === undefined ? {} : { home: options.home },
+ ...options?.row8b === undefined ? {} : { row8b: options.row8b },
+ ...options?.silently === undefined ? {} : { silently: options.silently },
+ ...options?.cache === undefined ? {} : { cache: options.cache },
+ handOff: options === undefined ? processHandOff(input.origin) : options.handOff ?? (async () => false)
+ }));
+ if (options === undefined) {
+ backends.set(cacheKey, created);
+ created.then((found) => {
+ if (found === null && backends.get(cacheKey) === created)
+ backends.delete(cacheKey);
+ });
+ } else
+ own = created;
+ return created;
+ };
+ const reader = (helper) => {
+ const known = readers.get(helper);
+ if (known !== undefined)
+ return known;
+ const refuse = async () => {
+ throw new Error("OmO's keychain helper changes the sign-in only under the session lock.");
+ };
+ const created = {
+ get: async () => {
+ try {
+ return await helper.read();
+ } catch (error) {
+ throw asKeystoreError(error, (message) => input.pending(`${message} Credentials are never saved to a file.`));
+ }
+ },
+ set: refuse,
+ delete: refuse
+ };
+ readers.set(helper, created);
+ return created;
+ };
+ return {
+ secrets,
+ eligible,
+ backend,
+ reader,
+ isHelperReader: (api) => [...readers.values()].includes(api),
+ guardHelperless: async () => {
+ if (!eligible)
+ return;
+ if ((options?.noDialog ?? process.env[HANDOFF_ENV] === "1") === true)
+ throw input.pending("The keychain hand-off cannot show a dialog.");
+ await guardHelperlessRead(key.service, key.name, options?.row9b, options?.ownerMarker);
+ }
+ };
+}
+function lockedStoreView(helper, lease, codec, mapError, done) {
+ const locked = helper.underLock(lease);
+ const run = async (step) => {
+ try {
+ return await step();
+ } catch (error) {
+ throw mapError(error);
+ } finally {
+ done();
+ }
+ };
+ return {
+ read: () => run(async () => {
+ const text = await locked.read();
+ return text === null ? null : codec.parse(text);
+ }),
+ write: (value, intent = "update", beforeRetire) => run(async () => {
+ const next = codec.amend === undefined ? value : codec.amend(await locked.read(), value);
+ await locked.write(codec.serialize(next), intent, beforeRetire);
+ }),
+ clear: () => run(() => locked.clear()),
+ recover: () => run(() => locked.recover()),
+ settle: () => run(() => locked.settle())
+ };
+}
+
+// packages/omo-opencode/src/cli/service-auth/secret-service-lock.ts
+import { spawn as spawn5 } from "node:child_process";
+var DEFAULT_COLLECTION = "/org/freedesktop/secrets/aliases/default";
+var PROBE_TIMEOUT_MS2 = 1e4;
+var parseLockedReply = (stdout) => {
+ const match = /<\s*(true|false)\s*>/.exec(stdout);
+ if (match === null)
+ return null;
+ return match[1] === "true" ? "locked" : "unlocked";
+};
+var probeSecretServiceLock = () => new Promise((resolve) => {
+ const child = spawn5("gdbus", [
+ "call",
+ "--session",
+ "--dest",
+ "org.freedesktop.secrets",
+ "--object-path",
+ DEFAULT_COLLECTION,
+ "--method",
+ "org.freedesktop.DBus.Properties.Get",
+ "org.freedesktop.Secret.Collection",
+ "Locked"
+ ], { stdio: ["ignore", "pipe", "ignore"] });
+ let stdout = "";
+ const timer = setTimeout(() => {
+ child.kill();
+ resolve("unknown");
+ }, PROBE_TIMEOUT_MS2);
+ child.stdout.on("data", (chunk) => {
+ stdout += chunk.toString();
+ });
+ child.on("error", () => {
+ clearTimeout(timer);
+ resolve("unknown");
+ });
+ child.on("close", (code) => {
+ clearTimeout(timer);
+ resolve(code === 0 ? parseLockedReply(stdout) ?? "absent" : "absent");
+ });
+});
+
// packages/omo-opencode/src/cli/service-auth/credential-lock.ts
+import { AsyncLocalStorage as AsyncLocalStorage3 } from "node:async_hooks";
+import { createHash as createHash11 } from "node:crypto";
+import { mkdir as mkdir12 } from "node:fs/promises";
+import { homedir as homedir33 } from "node:os";
+import { join as join112 } from "node:path";
var held = new AsyncLocalStorage3;
-function credentialLockPaths(api, home = homedir31()) {
+function credentialLockPaths(api, home = homedir33()) {
const id = createHash11("sha256").update(serviceOrigin(api)).digest("hex");
- const directory = join106(home, ".omo", "session-locks");
- return { directory, lock: join106(directory, `${id}.lock`), desktopRecord: join106(directory, `${id}.desktop-generation.json`) };
+ const directory = join112(home, ".omo", "session-locks");
+ return { directory, lock: join112(directory, `${id}.lock`), desktopRecord: join112(directory, `${id}.desktop-generation.json`) };
+}
+function heldCredentialLease(api, home = homedir33()) {
+ return held.getStore()?.get(credentialLockPaths(api, home).lock);
}
-async function withCredentialLock(api, action, home = homedir31(), ownerTag = "cli-session") {
+async function withCredentialLock(api, action, home = homedir33(), ownerTag = "cli-session") {
const { directory, lock } = credentialLockPaths(api, home);
const owned = held.getStore();
- if (owned?.has(lock))
- return action();
- await mkdir11(directory, { recursive: true, mode: 448 });
- return withLock(lock, () => held.run(new Set([...owned ?? [], lock]), action), {
+ const outer = owned?.get(lock);
+ if (outer !== undefined)
+ return action(outer);
+ await mkdir12(directory, { recursive: true, mode: 448 });
+ return withLock(lock, (lease) => held.run(new Map([...owned ?? [], [lock, lease]]), () => action(lease)), {
ownerTag,
staleAfterMs: Number.POSITIVE_INFINITY
});
@@ -113545,17 +114753,51 @@ function createCredentialStore(api, options = {}) {
return {
...value,
...accountId === undefined ? {} : { accountId },
- credentialGeneration: sameIdentity ? current?.credentialGeneration ?? randomUUID7() : randomUUID7()
+ credentialGeneration: sameIdentity ? current?.credentialGeneration ?? randomUUID8() : randomUUID8()
};
- });
+ }, options.keychainHelper);
+ const sections = new WeakMap;
+ const underLock = (lease) => {
+ const known = sections.get(lease);
+ if (known !== undefined)
+ return known;
+ const view = (async () => {
+ const opened = await store.underLock?.(lease) ?? null;
+ await opened?.recover();
+ return opened;
+ })();
+ sections.set(lease, view);
+ return view;
+ };
+ const held = async () => {
+ const lease = heldCredentialLease(api, options.home);
+ return lease === undefined ? null : underLock(lease);
+ };
+ const locked = async (helper, plain) => {
+ if (heldCredentialLease(api, options.home) === undefined)
+ await store.prepare?.();
+ await withCredentialLock(api, async (lease) => {
+ const view = await underLock(lease);
+ await (view === null ? plain() : helper(view));
+ }, options.home);
+ };
return {
- read: store.read,
- readAuthoritative: store.readAuthoritative,
- write: (value) => withCredentialLock(api, () => store.write(value), options.home),
- clear: () => withCredentialLock(api, store.clear, options.home)
+ read: async () => {
+ const view = await held();
+ return view === null ? store.read() : view.read();
+ },
+ readAuthoritative: async () => {
+ const view = await held();
+ return view === null ? store.readAuthoritative() : view.read();
+ },
+ write: (value, intent, beforeRetire) => locked((view) => view.write(value, intent, beforeRetire), () => store.write(value)),
+ clear: () => locked((view) => view.clear(), store.clear),
+ ...store.prepare === undefined ? {} : { prepare: store.prepare },
+ underLock,
+ ...store.migrationPending === undefined ? {} : { migrationPending: store.migrationPending }
};
}
-function createSealedStore(api, namespace, schema, secrets = typeof Bun === "undefined" ? null : Bun.secrets, platform = process.platform, lockProbe = probeSecretServiceLock, notice = stderrNoticeOncePerProcess, wait = SESSION_READ_WAIT, amendWrite) {
+function createSealedStore(api, namespace, schema, secrets = typeof Bun === "undefined" ? null : Bun.secrets, platform = process.platform, lockProbe = probeSecretServiceLock, notice = stderrNoticeOncePerProcess, wait = SESSION_READ_WAIT, amendWrite, keychainHelper) {
if (!secrets)
throw new SignInError("OmO sign-in needs Bun 1.4 or newer with OS credential storage. No file fallback is available.");
const platformName = platform === "darwin" ? "macOS Keychain" : platform === "linux" ? "Linux Secret Service (libsecret and an unlocked keyring)" : platform === "win32" ? "Windows Credential Manager" : null;
@@ -113564,6 +114806,18 @@ function createSealedStore(api, namespace, schema, secrets = typeof Bun === "und
const key = { service: namespace, name: credentialId(api) };
const slot = `${key.service}
${key.name}`;
+ const helper = bindKeychainHelper({
+ platform,
+ namespace,
+ secrets,
+ key,
+ background: wait.kind === "bounded",
+ origin: api,
+ notice,
+ pending: (message) => new KeychainApprovalPendingError(message),
+ ...keychainHelper === undefined ? {} : { options: keychainHelper }
+ });
+ secrets = helper.secrets;
const readsOf = (api) => {
const known = processReads.get(api);
if (known !== undefined)
@@ -113589,17 +114843,19 @@ ${key.name}`;
reads.set(slot, read);
return read;
};
- const waiting = platform === "darwin" ? `macOS Keychain is waiting for your approval: answer the "${basename15(process.execPath)} wants to access key ${namespace}" dialog ("Always Allow" stops it asking again)` : `${platformName} has not answered; it may be waiting for your approval or an unlock in a system dialog`;
+ const waiting = platform === "darwin" ? `macOS Keychain is waiting for your approval: answer the "${basename17(process.execPath)} wants to access key ${namespace}" dialog ("Always Allow" stops it asking again)` : `${platformName} has not answered; it may be waiting for your approval or an unlock in a system dialog`;
+ const helperWaiting = `macOS Keychain is waiting for your approval: answer the "OmO's keychain helper wants to access key ${namespace}" dialog`;
const answered = async (api, fresh = false) => {
+ const waitingFor = helper.isHelperReader(api) ? helperWaiting : waiting;
const read = fresh ? Promise.resolve().then(() => api.get(key)) : sharedRead(api);
let timer;
try {
if (wait.kind === "interactive") {
- timer = setTimeout(() => wait.notice(`omo: ${waiting}.`), wait.noticeAfterMs);
+ timer = setTimeout(() => wait.notice(`omo: ${waitingFor}.`), wait.noticeAfterMs);
return await read;
}
const expired = new Promise((_, reject) => {
- timer = setTimeout(() => reject(new KeychainApprovalPendingError(`${waiting}, then try again. Credentials are never saved to a file.`)), wait.deadlineMs);
+ timer = setTimeout(() => reject(new KeychainApprovalPendingError(`${waitingFor}, then try again. Credentials are never saved to a file.`)), wait.deadlineMs);
});
return await Promise.race([read, expired]);
} finally {
@@ -113624,41 +114880,76 @@ ${key.name}`;
notice("omo: could not check whether the keyring is locked (gdbus or the Secret Service did not answer); using libsecret directly.");
}
};
- const parsedRead = async (fresh) => {
+ const parseStored = (value) => {
+ try {
+ return schema.parse(JSON.parse(value));
+ } catch {
+ throw new InvalidCredentialState(signInRoute() === "cli" ? "Stored sign-in data is invalid. Run omo account forget, then omo login." : "The OmO sign-in saved on this computer can't be read. Run omo account forget to remove it, then sign in again in the desktop app.");
+ }
+ };
+ const previousOf = (raw) => {
+ if (raw === null)
+ return null;
+ try {
+ return schema.parse(JSON.parse(raw));
+ } catch {
+ return null;
+ }
+ };
+ const rawRead = async (fresh) => {
await assertUsable();
- let value;
+ const backend = await helper.backend();
try {
- value = await answered(secrets, fresh);
+ if (backend === null)
+ await helper.guardHelperless();
+ return await answered(backend === null ? secrets : helper.reader(backend), fresh);
} catch (error) {
if (error instanceof KeychainApprovalPendingError)
throw error;
+ if (error instanceof HelperMissingForOwnedItem)
+ throw new CredentialStoreError(error.message);
throw unavailable(error);
}
- if (value === null)
- return null;
- try {
- return schema.parse(JSON.parse(value));
- } catch {
- throw new InvalidCredentialState(signInRoute() === "cli" ? "Stored sign-in data is invalid. Run omo account forget, then omo login." : "The OmO sign-in saved on this computer can't be read. Run omo account forget to remove it, then sign in again in the desktop app.");
- }
+ };
+ const parsedRead = async (fresh) => {
+ const value = await rawRead(fresh);
+ return value === null ? null : parseStored(value);
+ };
+ const lockedFailure = (error) => {
+ const mapped = asKeystoreError(error, (message) => new KeychainApprovalPendingError(message));
+ if (error instanceof HelperOldSlotsFull)
+ return new CredentialStoreError(error.message);
+ if (mapped instanceof KeychainApprovalPendingError || mapped instanceof SignInError)
+ return mapped;
+ if (mapped instanceof Error && mapped.name === "LockLeaseLostError")
+ return mapped;
+ return unavailable(mapped);
};
return {
read: () => parsedRead(false),
readAuthoritative: () => parsedRead(true),
+ async prepare() {
+ if (await helper.backend() !== null)
+ await rawRead(false);
+ },
+ async underLock(lease) {
+ const backend = await helper.backend();
+ if (backend === null)
+ return null;
+ const codec = {
+ parse: parseStored,
+ serialize: (value) => JSON.stringify(schema.parse(value)),
+ ...amendWrite === undefined ? {} : { amend: (raw, next) => amendWrite(previousOf(raw), next) }
+ };
+ return lockedStoreView(backend, lease, codec, lockedFailure, () => forget(helper.reader(backend)));
+ },
+ migrationPending: async () => (await helper.backend())?.migrationPending() ?? false,
async write(value) {
await assertUsable();
+ if (await helper.backend() !== null)
+ throw new Error("OmO's keychain helper writes only under the session lock.");
try {
- let next = value;
- if (amendWrite !== undefined) {
- const raw = await answered(secrets, true);
- let previous = null;
- if (raw !== null) {
- try {
- previous = schema.parse(JSON.parse(raw));
- } catch {}
- }
- next = amendWrite(previous, value);
- }
+ const next = amendWrite === undefined ? value : amendWrite(previousOf(await answered(secrets, true)), value);
await secrets.set({ ...key, value: JSON.stringify(schema.parse(next)) });
} catch (error) {
throw unavailable(error);
@@ -113667,6 +114958,8 @@ ${key.name}`;
},
async clear() {
await assertUsable();
+ if (await helper.backend() !== null)
+ throw new Error("OmO's keychain helper deletes only under the session lock.");
try {
await secrets.delete(key);
} catch (error) {
@@ -113778,14 +115071,14 @@ async function loginLoopback(session, options) {
// packages/memory-core/src/sync/device-retire.ts
import { createHash as createHash14, randomBytes as randomBytes6 } from "node:crypto";
-import { join as join109 } from "node:path";
+import { join as join115 } from "node:path";
// packages/memory-core/src/identity/layout.ts
-import { homedir as homedir32 } from "node:os";
-import { join as join107, resolve as resolve31 } from "node:path";
+import { homedir as homedir34 } from "node:os";
+import { join as join113, resolve as resolve31 } from "node:path";
var MEMORY_ROOT_ENV_VAR = "OMO_MEMORY_HOME";
function defaultMemoryRoot() {
- return join107(homedir32(), ".omo", "memory");
+ return join113(homedir34(), ".omo", "memory");
}
function resolveMemoryRoot(env, cwd) {
const override = env[MEMORY_ROOT_ENV_VAR];
@@ -113795,13 +115088,13 @@ function resolveMemoryRoot(env, cwd) {
return resolve31(cwd, override);
}
// packages/memory-core/src/sync/pin-dir.ts
-import { join as join108 } from "node:path";
-var syncPinDir = (memoryRoot) => join108(memoryRoot, "sync-device");
+import { join as join114 } from "node:path";
+var syncPinDir = (memoryRoot) => join114(memoryRoot, "sync-device");
// packages/memory-core/src/sync/device-retire.ts
-var trustAnchorRoot = (pinDir) => join109(pinDir, "trust-anchor");
+var trustAnchorRoot = (pinDir) => join115(pinDir, "trust-anchor");
var trustAnchorKey = (account) => createHash14("sha256").update(account, "utf8").digest("base64url");
-var trustAnchorDir = (pinDir, account) => join109(trustAnchorRoot(pinDir), trustAnchorKey(account));
+var trustAnchorDir = (pinDir, account) => join115(trustAnchorRoot(pinDir), trustAnchorKey(account));
var hasLiveTrustAnchor = async (pinDir) => {
try {
return (await readdir17(trustAnchorRoot(pinDir))).some((name) => !name.includes(".retired-"));
@@ -113822,16 +115115,16 @@ var retireSyncDevice = async (input) => {
};
// packages/omo-opencode/src/cli/service-auth/session.ts
-import { homedir as homedir33 } from "node:os";
+import { homedir as homedir35 } from "node:os";
// packages/omo-opencode/src/cli/service-auth/signed-out-marker.ts
init_zod();
-import { mkdir as mkdir12, readFile as readFile35, rename as rename9, rm as rm17, writeFile as writeFile17 } from "node:fs/promises";
-import { dirname as dirname43, join as join110 } from "node:path";
+import { mkdir as mkdir13, readFile as readFile38, rename as rename10, rm as rm19, writeFile as writeFile18 } from "node:fs/promises";
+import { dirname as dirname48, join as join116 } from "node:path";
var markerSchema = object({ device: string2().nullable(), at: string2() });
-var signedOutMarkerPath = (home, credential) => join110(home, ".omo", "account-state", `${credential}.signed-out.json`);
+var signedOutMarkerPath = (home, credential) => join116(home, ".omo", "account-state", `${credential}.signed-out.json`);
async function readSignedOutMarker(path) {
- const text = await readFile35(path, "utf8").catch(() => null);
+ const text = await readFile38(path, "utf8").catch(() => null);
if (text === null)
return null;
let value;
@@ -113844,12 +115137,12 @@ async function readSignedOutMarker(path) {
return parsed.success ? parsed.data : null;
}
async function writeSignedOutMarker(path, device) {
- await mkdir12(dirname43(path), { recursive: true, mode: 448 });
+ await mkdir13(dirname48(path), { recursive: true, mode: 448 });
const staging = `${path}.${process.pid}.tmp`;
- await writeFile17(staging, JSON.stringify({ device, at: new Date().toISOString() }), { mode: 384 });
- await rename9(staging, path);
+ await writeFile18(staging, JSON.stringify({ device, at: new Date().toISOString() }), { mode: 384 });
+ await rename10(staging, path);
}
-var clearSignedOutMarker = (path) => rm17(path, { force: true });
+var clearSignedOutMarker = (path) => rm19(path, { force: true });
// packages/omo-opencode/src/cli/service-auth/session.ts
class SessionEnded extends SignInError {
@@ -113873,12 +115166,14 @@ function createSession(options) {
const api = serviceOrigin(options.api);
const now = options.now ?? Date.now;
const { store, signal, beforeKeysDiscarded } = options;
- const markerPath = signedOutMarkerPath(options.home ?? homedir33(), credentialId(api));
+ const markerPath = signedOutMarkerPath(options.home ?? homedir35(), credentialId(api));
async function locked(action) {
signal?.throwIfAborted();
- return withCredentialLock(api, async () => {
+ if (heldCredentialLease(api, options.home) === undefined)
+ await store.prepare?.();
+ return withCredentialLock(api, async (lease) => {
signal?.throwIfAborted();
- return action();
+ return action(await store.underLock?.(lease) ?? null);
}, options.home);
}
const request = (path, init) => requestApi(api, path, init, signal);
@@ -113915,9 +115210,12 @@ function createSession(options) {
}
}
async function snapshot() {
- return locked(async () => {
+ return locked(async (view) => {
const current = await store.read();
- return current === null ? null : refreshed(current);
+ if (current === null)
+ return null;
+ await view?.settle();
+ return refreshed(current);
});
}
return {
@@ -113940,7 +115238,7 @@ function createSession(options) {
}
if (stored !== null && stored.device.id !== value.device.id)
await beforeKeysDiscarded(discardedOf(stored, "replaced"));
- await store.write(value);
+ await store.write(value, "fresh-sign-in", () => beforeKeysDiscarded({ kind: "unreadable" }));
await clearSignedOutMarker(markerPath);
});
},
@@ -114001,14 +115299,15 @@ function createSession(options) {
signal?.throwIfAborted();
const snapshot = await store.read();
signal?.throwIfAborted();
- if (snapshot !== null && snapshot.refreshState !== "uncertain" && snapshot.refreshAttempt === undefined && Date.parse(snapshot.accessTokenExpiresAt) > now() + 30000 && (expect === undefined || expect(snapshot)))
+ if (snapshot !== null && snapshot.refreshState !== "uncertain" && snapshot.refreshAttempt === undefined && Date.parse(snapshot.accessTokenExpiresAt) > now() + 30000 && (expect === undefined || expect(snapshot)) && !await store.migrationPending?.())
return snapshot.accessToken;
- return locked(async () => {
+ return locked(async (view) => {
const current = await store.readAuthoritative();
if (current === null)
throw new SignInError(`Not signed in. ${signInHint("first")}`);
if (expect !== undefined && !expect(current))
throw new CredentialIdentityChanged;
+ await view?.settle();
return (await refreshed(current)).accessToken;
});
},
@@ -114156,6 +115455,10 @@ function refuseClosedServiceAuth() {
}
function configureClosedServiceAuthCommands(program) {
for (const name of SERVICE_AUTH_COMMANDS) {
+ if (name === "login") {
+ configureClosedDeviceLogin(program);
+ continue;
+ }
const command = program.command(name, { hidden: true }).helpOption(false).allowUnknownOption().allowExcessArguments().action(() => {
console.error(SERVICE_ACCOUNTS_CLOSED_MESSAGE);
process.exitCode = 1;
@@ -114163,6 +115466,17 @@ function configureClosedServiceAuthCommands(program) {
command.help = refuseClosedServiceAuth;
}
}
+function configureClosedDeviceLogin(program) {
+ const command = program.command("login", { hidden: true }).helpOption(false).allowUnknownOption().allowExcessArguments().option("--device").option("--no-browser").option("--api <url>").action((options) => {
+ if (options.device !== true && options.browser !== false || command.args.length > 0) {
+ console.error(SERVICE_ACCOUNTS_CLOSED_MESSAGE);
+ process.exitCode = 1;
+ return;
+ }
+ return run2("login", { ...options, device: true });
+ });
+ command.help = refuseClosedServiceAuth;
+}
function configureServiceAuthCommands(program, open = serviceAccountsOpen()) {
if (!open) {
configureClosedServiceAuthCommands(program);
@@ -114364,11 +115678,11 @@ async function boulder(options) {
// packages/omo-opencode/src/cli/codex-ulw-loop.ts
import { spawn as spawn6 } from "node:child_process";
import { existsSync as existsSync67, readFileSync as readFileSync45, realpathSync as realpathSync14 } from "node:fs";
-import { homedir as homedir34 } from "node:os";
+import { homedir as homedir36 } from "node:os";
var ULW_LOOP_DELEGATION_SENTINEL = "OMO_ULW_LOOP_DELEGATED";
function resolveCodexUlwLoopCommand(input = {}) {
const env = input.env ?? process.env;
- const homeDir = input.homeDir ?? homedir34();
+ const homeDir = input.homeDir ?? homedir36();
const localComponentBin = resolveLocalUlwLoopBin(env, homeDir);
if (localComponentBin !== null)
return { executable: localComponentBin, argsPrefix: [] };
@@ -114611,7 +115925,7 @@ function linkedWorktrees(records) {
}
// packages/omo-opencode/src/cli/worktree-sweep/sweep.ts
import { existsSync as existsSync68 } from "node:fs";
-import { stat as stat10 } from "node:fs/promises";
+import { stat as stat12 } from "node:fs/promises";
import os7 from "node:os";
import { normalize as normalize2 } from "node:path";
@@ -114694,7 +116008,7 @@ async function isOlderThan(worktreePath, days, now) {
if (days <= 0)
return false;
try {
- const stats = await stat10(worktreePath);
+ const stats = await stat12(worktreePath);
return now - stats.mtimeMs > days * DAY_MS;
} catch {
return false;
@@ -114859,7 +116173,7 @@ prunes.
// packages/omo-opencode/src/cli/config-migrate.ts
init_startup_migration();
-import { posix as posix13 } from "node:path";
+import { posix as posix15 } from "node:path";
function reports(result) {
return result.results.map((entry) => ({
diagnostics: entry.diagnostics,
@@ -114893,7 +116207,7 @@ function runConfigMigrate(options = {}) {
dryRun: options.dryRun ?? false,
environment,
...homeDir === undefined ? {} : { env: { HOME: homeDir }, homeDir },
- pathOperations: posix13
+ pathOperations: posix15
});
const report = reports(result);
const response = {
diff --git a/plugins/omo/dist/cli/index.js b/plugins/omo/dist/cli/index.js
index d5d2ffd0..4d923d75 100755
--- a/plugins/omo/dist/cli/index.js
+++ b/plugins/omo/dist/cli/index.js
@@ -2132,7 +2132,7 @@ var package_default;
var init_package = __esm(() => {
package_default = {
name: "oh-my-opencode",
- version: "5.1.62",
+ version: "5.1.63",
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
main: "./dist/index.js",
types: "dist/index.d.ts",
@@ -2384,18 +2384,18 @@ var init_package = __esm(() => {
typescript: "^7.0.2"
},
optionalDependencies: {
- "oh-my-opencode-darwin-arm64": "5.1.62",
- "oh-my-opencode-darwin-x64": "5.1.62",
- "oh-my-opencode-darwin-x64-baseline": "5.1.62",
- "oh-my-opencode-linux-arm64": "5.1.62",
- "oh-my-opencode-linux-arm64-musl": "5.1.62",
- "oh-my-opencode-linux-x64": "5.1.62",
- "oh-my-opencode-linux-x64-baseline": "5.1.62",
- "oh-my-opencode-linux-x64-musl": "5.1.62",
- "oh-my-opencode-linux-x64-musl-baseline": "5.1.62",
- "oh-my-opencode-windows-arm64": "5.1.62",
- "oh-my-opencode-windows-x64": "5.1.62",
- "oh-my-opencode-windows-x64-baseline": "5.1.62"
+ "oh-my-opencode-darwin-arm64": "5.1.63",
+ "oh-my-opencode-darwin-x64": "5.1.63",
+ "oh-my-opencode-darwin-x64-baseline": "5.1.63",
+ "oh-my-opencode-linux-arm64": "5.1.63",
+ "oh-my-opencode-linux-arm64-musl": "5.1.63",
+ "oh-my-opencode-linux-x64": "5.1.63",
+ "oh-my-opencode-linux-x64-baseline": "5.1.63",
+ "oh-my-opencode-linux-x64-musl": "5.1.63",
+ "oh-my-opencode-linux-x64-musl-baseline": "5.1.63",
+ "oh-my-opencode-windows-arm64": "5.1.63",
+ "oh-my-opencode-windows-x64": "5.1.63",
+ "oh-my-opencode-windows-x64-baseline": "5.1.63"
},
overrides: {
hono: "^4.13.8",
@@ -7339,7 +7339,34 @@ var init_which = __esm(() => {
});
// packages/utils/src/runtime/file.ts
-var init_file = () => {};
+import { access, readFile, unlink, writeFile } from "fs/promises";
+function createNodeFile(path) {
+ return {
+ text() {
+ return readFile(path, "utf8");
+ },
+ async arrayBuffer() {
+ const buffer = await readFile(path);
+ return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
+ },
+ exists() {
+ return access(path).then(() => true, () => false);
+ },
+ delete() {
+ return unlink(path);
+ }
+ };
+}
+function bunFile(path) {
+ const bun = runtime3.Bun;
+ if (bun)
+ return bun.file(path);
+ return createNodeFile(path);
+}
+var runtime3;
+var init_file = __esm(() => {
+ runtime3 = globalThis;
+});
// packages/utils/src/runtime/git-bash.ts
import { execFileSync } from "child_process";
@@ -12283,7 +12310,9 @@ var init_zip_extractor = __esm(() => {
});
// packages/omo-opencode/src/shared/bun-file-shim.ts
-var init_bun_file_shim = () => {};
+var init_bun_file_shim = __esm(() => {
+ init_runtime();
+});
// packages/omo-opencode/src/shared/binary-downloader.ts
import { chmodSync, existsSync as existsSync9, mkdirSync as mkdirSync4, unlinkSync as unlinkSync3 } from "fs";
@@ -92710,7 +92739,7 @@ var package_default2;
var init_package2 = __esm(() => {
package_default2 = {
name: "@oh-my-opencode/omo-codex",
- version: "5.1.62",
+ version: "5.1.63",
type: "module",
private: true,
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
@@ -93326,7 +93355,7 @@ var init_check_for_update = __esm(() => {
});
// packages/omo-opencode/src/hooks/auto-update-checker/checker/sync-package-json.ts
-import * as crypto from "crypto";
+import * as crypto2 from "crypto";
import * as fs8 from "fs";
import * as path11 from "path";
function safeUnlink(filePath) {
@@ -93350,7 +93379,7 @@ function getPackageNameFromIntent(pluginInfo) {
return ACCEPTED_PACKAGE_NAMES2.find((packageName) => pluginInfo.entry === packageName || pluginInfo.entry.startsWith(`${packageName}@`)) ?? PACKAGE_NAME3;
}
function writeCachePackageJson(cachePackageJsonPath, pkgJson) {
- const tmpPath = `${cachePackageJsonPath}.${crypto.randomUUID()}`;
+ const tmpPath = `${cachePackageJsonPath}.${crypto2.randomUUID()}`;
try {
fs8.mkdirSync(path11.dirname(cachePackageJsonPath), { recursive: true });
fs8.writeFileSync(tmpPath, JSON.stringify(pkgJson, null, 2));
@@ -94271,7 +94300,7 @@ import { existsSync as existsSync27 } from "fs";
import { homedir as homedir7 } from "os";
// packages/omo-codex/src/install/codex-cache-bins.ts
-import { chmod, lstat as lstat4, mkdir, readFile as readFile3, readdir as readdir2, readlink as readlink3, rm as rm3, stat as stat2, symlink, writeFile } from "fs/promises";
+import { chmod, lstat as lstat4, mkdir, readFile as readFile4, readdir as readdir2, readlink as readlink3, rm as rm3, stat as stat2, symlink, writeFile as writeFile2 } from "fs/promises";
import { basename as basename4, isAbsolute as isAbsolute2, join as join26, relative, resolve as resolve6, sep } from "path";
// packages/omo-codex/src/install/codex-cache-command-shim.ts
@@ -94315,7 +94344,7 @@ function windowsCommandShim(targetPath) {
}
// packages/omo-codex/src/install/codex-cache-dangling-bins.ts
-import { lstat as lstat2, readFile, readdir, readlink, rm, stat } from "fs/promises";
+import { lstat as lstat2, readFile as readFile2, readdir, readlink, rm, stat } from "fs/promises";
import { dirname as dirname10, isAbsolute, join as join23, resolve as resolve5 } from "path";
// packages/omo-codex/src/install/codex-cache-fs.ts
@@ -94377,7 +94406,7 @@ async function removeDanglingGeneratedCommandShim(linkPath) {
const linkStat = await lstat2(linkPath);
if (!linkStat.isFile())
return;
- const content = await readFile(linkPath, "utf8");
+ const content = await readFile2(linkPath, "utf8");
if (!content.includes(COMMAND_SHIM_MARKER))
return;
const target = extractCommandShimTarget(content);
@@ -94425,7 +94454,7 @@ function hasOmoCodexPluginPrefix(parts, endExclusive) {
}
// packages/omo-codex/src/install/codex-cache-legacy-bins.ts
-import { lstat as lstat3, readFile as readFile2, readlink as readlink2, rm as rm2 } from "fs/promises";
+import { lstat as lstat3, readFile as readFile3, readlink as readlink2, rm as rm2 } from "fs/promises";
import { join as join24 } from "path";
var LEGACY_CODEX_COMPONENT_BINS = [
{ name: "omo", component: "ulw-loop" },
@@ -94460,7 +94489,7 @@ async function removeLegacyCodexComponentBin(linkPath, component, platform) {
}
if (!stat.isFile())
return;
- const content = await readFile2(linkPath, "utf8");
+ const content = await readFile3(linkPath, "utf8");
if (content.includes(COMMAND_SHIM_MARKER))
await rm2(linkPath, { force: true });
} catch (error) {
@@ -94697,7 +94726,7 @@ async function collectPackageBins(directory, root, links) {
}
}
async function appendPackageBinLinks(packageJsonPath, packageRoot, root, links) {
- const packageJson = JSON.parse(await readFile3(packageJsonPath, "utf8"));
+ const packageJson = JSON.parse(await readFile4(packageJsonPath, "utf8"));
if (!isPlainRecord4(packageJson))
return;
const packageName = packageJson.name;
@@ -94749,13 +94778,13 @@ async function replaceSymlink(linkPath, targetPath) {
async function replaceCommandShim(linkPath, targetPath) {
if (await existingNonShim(linkPath))
throw new Error(`${linkPath} already exists and is not a command shim`);
- await writeFile(linkPath, windowsCommandShim(targetPath));
+ await writeFile2(linkPath, windowsCommandShim(targetPath));
}
async function replaceRuntimeWrapper(linkPath, content) {
if (await existingNonRuntimeWrapper(linkPath))
throw new Error(`${linkPath} already exists and is not a generated OMO runtime wrapper`);
await rm3(linkPath, { force: true });
- await writeFile(linkPath, content);
+ await writeFile2(linkPath, content);
}
async function removeGeneratedRuntimeWrapper(path) {
try {
@@ -94773,7 +94802,7 @@ async function removeGeneratedRuntimeWrapper(path) {
}
async function readGeneratedWrapperContent(path) {
try {
- return await readFile3(path, "utf8");
+ return await readFile4(path, "utf8");
} catch (error) {
if (isNodeErrorWithCode(error) && (error.code === "ENOENT" || error.code === "EISDIR"))
return "";
@@ -94787,7 +94816,7 @@ async function existingNonRuntimeWrapper(path) {
return false;
if (!stat.isFile())
return true;
- const content = await readFile3(path, "utf8");
+ const content = await readFile4(path, "utf8");
return !content.includes(RUNTIME_WRAPPER_MARKER);
} catch (error) {
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
@@ -94800,7 +94829,7 @@ async function existingNonShim(path) {
const stat = await lstat4(path);
if (!stat.isFile())
return true;
- const content = await readFile3(path, "utf8");
+ const content = await readFile4(path, "utf8");
if (content.includes(COMMAND_SHIM_MARKER))
return false;
throw new Error(`${path} already exists and is not a generated command shim`);
@@ -94824,11 +94853,11 @@ async function existingNonSymlink(path) {
}
}
// packages/omo-codex/src/install/codex-cache-install.ts
-import { cp as cp3, mkdir as mkdir3, readFile as readFile8, readdir as readdir5, rename as rename2, rm as rm5 } from "fs/promises";
+import { cp as cp3, mkdir as mkdir3, readFile as readFile9, readdir as readdir5, rename as rename2, rm as rm5 } from "fs/promises";
import { basename as basename5, dirname as dirname13, join as join33, sep as sep6 } from "path";
// packages/omo-codex/src/install/codex-cache-bundled-mcps.ts
-import { cp, mkdir as mkdir2, readFile as readFile4, stat as stat3 } from "fs/promises";
+import { cp, mkdir as mkdir2, readFile as readFile5, stat as stat3 } from "fs/promises";
import { dirname as dirname11, join as join27, resolve as resolve7 } from "path";
var BUNDLED_MCP_RUNTIMES = [
{
@@ -94870,7 +94899,7 @@ async function copyBundledMcpRuntimeDist(pluginRoot, sourceRoot, runtime) {
async function readSourceMcpArgs(path) {
let parsed;
try {
- parsed = JSON.parse(await readFile4(path, "utf8"));
+ parsed = JSON.parse(await readFile5(path, "utf8"));
} catch (error) {
if (error instanceof Error)
return new Set;
@@ -94901,7 +94930,7 @@ async function isDirectory(path) {
// packages/omo-codex/src/install/codex-cache-local-dependencies.ts
import { realpathSync as realpathSync7 } from "fs";
-import { readFile as readFile5, readdir as readdir3, writeFile as writeFile2 } from "fs/promises";
+import { readFile as readFile6, readdir as readdir3, writeFile as writeFile3 } from "fs/promises";
import { dirname as dirname12, isAbsolute as isAbsolute4, join as join29, relative as relative3, resolve as resolve9, sep as sep2 } from "path";
// packages/omo-codex/src/install/codex-cache-paths.ts
@@ -94967,7 +94996,7 @@ async function rewriteCachedPackageLocalFileDependencies(pluginRoot, sourceRoot)
const packageLock = await readPackageLock(pluginRoot);
let rewroteAnyPackageJson = false;
for (const packageJsonPath of packageJsonPaths) {
- const raw = await readFile5(packageJsonPath, "utf8");
+ const raw = await readFile6(packageJsonPath, "utf8");
const parsed = JSON.parse(raw);
if (!isPlainRecord4(parsed))
continue;
@@ -95002,20 +95031,20 @@ async function rewriteCachedPackageLocalFileDependencies(pluginRoot, sourceRoot)
}
}
if (changed) {
- await writeFile2(packageJsonPath, `${JSON.stringify(parsed, null, "\t")}
+ await writeFile3(packageJsonPath, `${JSON.stringify(parsed, null, "\t")}
`);
rewroteAnyPackageJson = true;
}
}
if (packageLock.changed)
- await writeFile2(packageLock.path, `${JSON.stringify(packageLock.value, null, "\t")}
+ await writeFile3(packageLock.path, `${JSON.stringify(packageLock.value, null, "\t")}
`);
return rewroteAnyPackageJson;
}
async function readPackageLock(pluginRoot) {
const path = join29(pluginRoot, "package-lock.json");
try {
- const parsed = JSON.parse(await readFile5(path, "utf8"));
+ const parsed = JSON.parse(await readFile6(path, "utf8"));
return { path, value: isPlainRecord4(parsed) ? parsed : null, changed: false };
} catch (error) {
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
@@ -95089,14 +95118,14 @@ async function collectPackageJsonPaths(directory, root, paths) {
}
// packages/omo-codex/src/install/codex-cache-mcp-manifest.ts
-import { readFile as readFile6, writeFile as writeFile3 } from "fs/promises";
+import { readFile as readFile7, writeFile as writeFile4 } from "fs/promises";
import { join as join30, sep as sep3 } from "path";
var CONTEXT7_API_KEY_ENV = "CONTEXT7_API_KEY";
async function rewriteCachedMcpManifest(pluginRoot, sourceRoot = pluginRoot) {
const manifestPath = join30(pluginRoot, ".mcp.json");
if (!await fileExistsStrict(manifestPath))
return;
- const raw = await readFile6(manifestPath, "utf8");
+ const raw = await readFile7(manifestPath, "utf8");
const parsed = JSON.parse(raw);
if (!isPlainRecord4(parsed) || !isPlainRecord4(parsed.mcpServers))
return;
@@ -95130,7 +95159,7 @@ async function rewriteCachedMcpManifest(pluginRoot, sourceRoot = pluginRoot) {
}
}
if (changed)
- await writeFile3(manifestPath, `${JSON.stringify(parsed, null, "\t")}
+ await writeFile4(manifestPath, `${JSON.stringify(parsed, null, "\t")}
`);
}
function sanitizeContext7Auth(server) {
@@ -95189,7 +95218,7 @@ async function rewriteCachedManifestRoot(pluginRoot, fromRoot, toRoot) {
const manifestPath = join30(pluginRoot, ".mcp.json");
if (!await fileExistsStrict(manifestPath))
return;
- const raw = await readFile6(manifestPath, "utf8");
+ const raw = await readFile7(manifestPath, "utf8");
const parsed = JSON.parse(raw);
if (!isPlainRecord4(parsed) || !isPlainRecord4(parsed.mcpServers))
return;
@@ -95216,7 +95245,7 @@ async function rewriteCachedManifestRoot(pluginRoot, fromRoot, toRoot) {
}
}
if (changed)
- await writeFile3(manifestPath, `${JSON.stringify(parsed, null, "\t")}
+ await writeFile4(manifestPath, `${JSON.stringify(parsed, null, "\t")}
`);
}
@@ -95278,7 +95307,7 @@ async function unsupportedEntries(root, directory) {
}
// packages/omo-codex/src/install/codex-hook-targets.ts
-import { readFile as readFile7 } from "fs/promises";
+import { readFile as readFile8 } from "fs/promises";
import { join as join32, sep as sep5 } from "path";
var PLUGIN_ROOT_TARGET_PATTERN = /\$\{PLUGIN_ROOT\}[\\/]+([^"']+)/g;
async function findMissingHookCommandTargets(pluginRoot) {
@@ -95286,7 +95315,7 @@ async function findMissingHookCommandTargets(pluginRoot) {
for (const manifestPath of await hookManifestPaths(pluginRoot)) {
if (!await fileExistsStrict(manifestPath))
continue;
- const parsed = JSON.parse(await readFile7(manifestPath, "utf8"));
+ const parsed = JSON.parse(await readFile8(manifestPath, "utf8"));
collectCommands(parsed, commands);
}
const missing = [];
@@ -95310,7 +95339,7 @@ async function hookManifestPaths(pluginRoot) {
const pluginManifestPath = join32(pluginRoot, ".codex-plugin", "plugin.json");
if (!await fileExistsStrict(pluginManifestPath))
return [join32(pluginRoot, "hooks", "hooks.json")];
- const parsed = JSON.parse(await readFile7(pluginManifestPath, "utf8"));
+ const parsed = JSON.parse(await readFile8(pluginManifestPath, "utf8"));
if (!isPlainRecord4(parsed))
return [];
if (typeof parsed.hooks === "string" && parsed.hooks.trim() !== "") {
@@ -95397,7 +95426,7 @@ async function maybeRunNpmInstall(cwd, runCommand, env, args = ["install"]) {
async function maybeRunNpmBuild(cwd, runCommand, env) {
if (!await fileExistsStrict(join33(cwd, "package.json")))
return;
- const packageJson = JSON.parse(await readFile8(join33(cwd, "package.json"), "utf8"));
+ const packageJson = JSON.parse(await readFile9(join33(cwd, "package.json"), "utf8"));
if (!isPlainRecord4(packageJson))
return;
const scripts = packageJson.scripts;
@@ -95408,7 +95437,7 @@ async function maybeRunNpmBuild(cwd, runCommand, env) {
async function maybeRunNpmSyncSkills(cwd, runCommand, env) {
if (!await fileExistsStrict(join33(cwd, "package.json")))
return;
- const packageJson = JSON.parse(await readFile8(join33(cwd, "package.json"), "utf8"));
+ const packageJson = JSON.parse(await readFile9(join33(cwd, "package.json"), "utf8"));
if (!isPlainRecord4(packageJson))
return;
const scripts = packageJson.scripts;
@@ -95471,7 +95500,7 @@ var removedSparkshellPromptSurfaceFiles = new Set(["directive.md", "plugin.json"
var removedSparkshellTextFilePattern = /\.(?:json|md|toml|ya?ml)$/i;
async function assertNoRemovedSparkshellPromptReferences(pluginRoot) {
for (const filePath of await listRemovedSparkshellPromptSurfaceFiles(pluginRoot, "")) {
- const content = await readFile8(join33(pluginRoot, filePath), "utf8");
+ const content = await readFile9(join33(pluginRoot, filePath), "utf8");
if (!removedSparkshellReferencePattern.test(content))
continue;
throw new Error(`removed sparkshell reference found in Codex plugin prompt surface: ${filePath}`);
@@ -95620,7 +95649,7 @@ async function isBrokenCacheSymlink(path) {
}
}
// packages/omo-codex/src/install/codex-cached-marketplace-manifest.ts
-import { mkdir as mkdir4, rename as rename3, rm as rm7, stat as stat5, writeFile as writeFile4 } from "fs/promises";
+import { mkdir as mkdir4, rename as rename3, rm as rm7, stat as stat5, writeFile as writeFile5 } from "fs/promises";
import { join as join35 } from "path";
async function writeCachedMarketplaceManifest(input) {
const marketplaceDir = join35(input.marketplaceRoot, ".agents", "plugins");
@@ -95633,7 +95662,7 @@ async function writeCachedMarketplaceManifest(input) {
const manifestPath = join35(marketplaceDir, "marketplace.json");
const tempPath = join35(marketplaceDir, `.marketplace.json.tmp-${process.pid}-${Date.now()}`);
try {
- await writeFile4(tempPath, `${JSON.stringify({
+ await writeFile5(tempPath, `${JSON.stringify({
name: input.marketplaceName,
plugins: input.plugins.map((plugin) => ({
name: plugin.name,
@@ -95659,7 +95688,7 @@ async function isDirectory2(path) {
// packages/omo-codex/src/install/codex-package-layout.ts
import { existsSync as existsSync24 } from "fs";
-import { readFile as readFile9 } from "fs/promises";
+import { readFile as readFile10 } from "fs/promises";
import { join as join36 } from "path";
var PACKAGED_CODEX_INSTALLER_NAMES = new Set([
"@code-yeongyu/lazycodex",
@@ -95675,14 +95704,14 @@ async function shouldBuildSourcePackages(repoRoot) {
const packageJsonPath = join36(repoRoot, "package.json");
if (!existsSync24(packageJsonPath))
return true;
- const packageJson = JSON.parse(await readFile9(packageJsonPath, "utf8"));
+ const packageJson = JSON.parse(await readFile10(packageJsonPath, "utf8"));
if (!isPlainRecord4(packageJson) || typeof packageJson.name !== "string")
return true;
return !PACKAGED_CODEX_INSTALLER_NAMES.has(packageJson.name);
}
// packages/omo-codex/src/install/codex-config-toml.ts
-import { mkdir as mkdir5, readFile as readFile11 } from "fs/promises";
+import { mkdir as mkdir5, readFile as readFile12 } from "fs/promises";
import { dirname as dirname16 } from "path";
// packages/omo-codex/src/install/toml-section-editor.ts
@@ -96279,18 +96308,18 @@ function tomlKeySegment(value) {
}
// packages/omo-codex/src/install/codex-config-atomic-write.ts
-import { lstat as lstat7, readlink as readlink4, realpath, rename as rename4, unlink, writeFile as writeFile5 } from "fs/promises";
+import { lstat as lstat7, readlink as readlink4, realpath, rename as rename4, unlink as unlink2, writeFile as writeFile6 } from "fs/promises";
import { basename as basename6, dirname as dirname14, isAbsolute as isAbsolute5, join as join37, resolve as resolve10 } from "path";
var RENAME_RETRY_DELAYS_MS = [10, 25, 50];
var RETRIABLE_RENAME_CODES = new Set(["EPERM", "EBUSY"]);
async function writeFileAtomic(targetPath, data) {
const writeTarget = await resolveSymlinkTarget(targetPath);
const temporaryPath = join37(dirname14(writeTarget), `.tmp-${basename6(writeTarget)}-${process.pid}-${Date.now()}`);
- await writeFile5(temporaryPath, data);
+ await writeFile6(temporaryPath, data);
try {
await renameWithRetry(temporaryPath, writeTarget);
} catch (error) {
- await unlink(temporaryPath).catch((unlinkError) => {
+ await unlink2(temporaryPath).catch((unlinkError) => {
if (unlinkError instanceof Error)
return;
return;
@@ -96785,7 +96814,7 @@ function isRootSetting(line, key) {
// packages/omo-codex/src/install/codex-model-catalog.ts
init_latest_models();
-import { readFile as readFile10 } from "fs/promises";
+import { readFile as readFile11 } from "fs/promises";
import { join as join38 } from "path";
var FALLBACK_CODEX_MODEL_CATALOG = {
current: {
@@ -96819,7 +96848,7 @@ var FALLBACK_CODEX_MODEL_CATALOG = {
async function readCodexModelCatalog(codexPackageRoot) {
const catalogPath = join38(codexPackageRoot, "plugin", "model-catalog.json");
try {
- const parsed = JSON.parse(await readFile10(catalogPath, "utf8"));
+ const parsed = JSON.parse(await readFile11(catalogPath, "utf8"));
return parseCodexModelCatalog(parsed) ?? FALLBACK_CODEX_MODEL_CATALOG;
} catch (error) {
if (error instanceof Error)
@@ -97044,7 +97073,7 @@ async function updateCodexConfig(input) {
await mkdir5(dirname16(input.configPath), { recursive: true });
let config;
try {
- config = await readFile11(input.configPath, "utf8");
+ config = await readFile12(input.configPath, "utf8");
} catch (error) {
if (!isMissingFileError(error))
throw error;
@@ -97092,7 +97121,7 @@ function isMissingFileError(error) {
// packages/omo-codex/src/install/codex-hook-trust.ts
import { createHash as createHash3 } from "crypto";
-import { readFile as readFile12 } from "fs/promises";
+import { readFile as readFile13 } from "fs/promises";
import { join as join40 } from "path";
var EVENT_LABELS = new Map([
["PreToolUse", "pre_tool_use"],
@@ -97110,7 +97139,7 @@ async function trustedHookStatesForPlugin(input) {
const manifestPath = join40(input.pluginRoot, ".codex-plugin", "plugin.json");
if (!await exists(manifestPath))
return [];
- const manifest = JSON.parse(await readFile12(manifestPath, "utf8"));
+ const manifest = JSON.parse(await readFile13(manifestPath, "utf8"));
if (!isPlainRecord4(manifest))
return [];
const states = [];
@@ -97118,7 +97147,7 @@ async function trustedHookStatesForPlugin(input) {
const hooksPath = join40(input.pluginRoot, hookPath);
if (!await exists(hooksPath))
continue;
- const parsed = JSON.parse(await readFile12(hooksPath, "utf8"));
+ const parsed = JSON.parse(await readFile13(hooksPath, "utf8"));
if (!isPlainRecord4(parsed) || !isPlainRecord4(parsed.hooks))
continue;
states.push(...trustedHookStatesForHooksFile({
@@ -97201,7 +97230,7 @@ function stripDotSlash2(value) {
}
async function exists(path) {
try {
- await readFile12(path, "utf8");
+ await readFile13(path, "utf8");
return true;
} catch (error) {
if (error instanceof Error)
@@ -97301,7 +97330,7 @@ function recordAt2(value, key) {
}
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
-import { cp as cp4, mkdir as mkdir6, rename as rename5, rm as rm8, writeFile as writeFile6 } from "fs/promises";
+import { cp as cp4, mkdir as mkdir6, rename as rename5, rm as rm8, writeFile as writeFile7 } from "fs/promises";
import { join as join41, sep as sep7 } from "path";
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
async function writeInstalledMarketplaceSnapshot(input) {
@@ -97321,7 +97350,7 @@ async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
const manifestDir = join41(marketplaceRoot, ".agents", "plugins");
await mkdir6(manifestDir, { recursive: true });
const tempPath = join41(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
- await writeFile6(tempPath, `${JSON.stringify(marketplace, null, "\t")}
+ await writeFile7(tempPath, `${JSON.stringify(marketplace, null, "\t")}
`);
await rename5(tempPath, join41(manifestDir, "marketplace.json"));
}
@@ -97350,15 +97379,15 @@ function shouldCopyMarketplaceSourcePath(path, root) {
}
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
-import { copyFile, lstat as lstat11, mkdir as mkdir7, readdir as readdir8, readFile as readFile17, rm as rm12, writeFile as writeFile9 } from "fs/promises";
+import { copyFile, lstat as lstat11, mkdir as mkdir7, readdir as readdir8, readFile as readFile18, rm as rm12, writeFile as writeFile10 } from "fs/promises";
import { basename as basename7, join as join46 } from "path";
// packages/omo-codex/src/install/agent-model-overrides.ts
-import { readFile as readFile14, rm as rm9, writeFile as writeFile8 } from "fs/promises";
+import { readFile as readFile15, rm as rm9, writeFile as writeFile9 } from "fs/promises";
import { join as join43 } from "path";
// packages/omo-codex/src/install/preserved-agent-settings.ts
-import { lstat as lstat8, readFile as readFile13, readdir as readdir7, writeFile as writeFile7 } from "fs/promises";
+import { lstat as lstat8, readFile as readFile14, readdir as readdir7, writeFile as writeFile8 } from "fs/promises";
import { join as join42 } from "path";
// packages/omo-codex/src/install/managed-agent-reasoning-defaults.ts
@@ -97593,7 +97622,7 @@ async function capturePreservedAgentServiceTier(input) {
async function restorePreservedReasoning(input) {
if (input.value === undefined)
return;
- const content = await readFile13(input.target, "utf8");
+ const content = await readFile14(input.target, "utf8");
const bundledEffort = extractReasoningEffort(content);
const effort = resolveManagedAgentReasoning({
agentName: input.agentName,
@@ -97606,33 +97635,33 @@ async function restorePreservedReasoning(input) {
const replacement = replaceTopLevelStringSetting(content, "model_reasoning_effort", effort, { insertIfMissing: false });
if (!replacement.replaced)
return;
- await writeFile7(input.linkPath, replacement.content);
+ await writeFile8(input.linkPath, replacement.content);
}
async function restorePreservedServiceTier(input) {
if (!input.preserved)
return;
- const content = await readFile13(input.linkPath, "utf8");
+ const content = await readFile14(input.linkPath, "utf8");
if (extractServiceTier(content) === input.value)
return;
const replacement = replaceTopLevelStringSetting(content, "service_tier", input.value, { insertIfMissing: true });
if (!replacement.replaced)
return;
- await writeFile7(input.linkPath, replacement.content);
+ await writeFile8(input.linkPath, replacement.content);
}
async function restorePreservedModel(input) {
if (input.value === null)
return;
- const content = await readFile13(input.linkPath, "utf8");
+ const content = await readFile14(input.linkPath, "utf8");
if (extractModel(content) === input.value)
return;
const replacement = replaceTopLevelStringSetting(content, "model", input.value, { insertIfMissing: true });
if (!replacement.replaced)
return;
- await writeFile7(input.linkPath, replacement.content);
+ await writeFile8(input.linkPath, replacement.content);
}
async function readTextIfExists(path) {
try {
- return await readFile13(path, "utf8");
+ return await readFile14(path, "utf8");
} catch (error) {
if (nodeErrorCode(error) === "ENOENT")
return null;
@@ -97754,13 +97783,13 @@ async function writeAgentModelReceipts(codexHome, receipts) {
await rm9(path, { force: true });
return;
}
- await writeFile8(path, `${JSON.stringify(Object.fromEntries(receipts), null, "\t")}
+ await writeFile9(path, `${JSON.stringify(Object.fromEntries(receipts), null, "\t")}
`);
}
async function applyAgentOverride(input) {
if (input.override === undefined)
return;
- let content = await readFile14(input.linkPath, "utf8");
+ let content = await readFile15(input.linkPath, "utf8");
if (input.override.model !== undefined) {
content = replaceTopLevelStringSetting(content, "model", input.override.model, { insertIfMissing: true }).content;
}
@@ -97769,7 +97798,7 @@ async function applyAgentOverride(input) {
insertIfMissing: true
}).content;
}
- await writeFile8(input.linkPath, content);
+ await writeFile9(input.linkPath, content);
}
function receiptPath(codexHome) {
return join43(codexHome, "agents", RECEIPT_FILE);
@@ -97804,7 +97833,7 @@ function handEditedAgentModel(installedModel, receipt) {
}
// packages/omo-codex/src/install/retired-managed-agent-purge.ts
-import { lstat as lstat9, readFile as readFile15, rm as rm10 } from "fs/promises";
+import { lstat as lstat9, readFile as readFile16, rm as rm10 } from "fs/promises";
import { join as join44 } from "path";
var RETIRED_MANAGED_AGENT_FILES = [
{
@@ -97838,7 +97867,7 @@ function hasRequiredMarkers(content, markers) {
}
async function readTextIfExists2(path) {
try {
- return await readFile15(path, "utf8");
+ return await readFile16(path, "utf8");
} catch (error) {
if (nodeErrorCode2(error) === "ENOENT")
return null;
@@ -97863,7 +97892,7 @@ function nodeErrorCode2(error) {
// packages/omo-codex/src/install/default-agent-role.ts
import { createHash as createHash4 } from "crypto";
-import { lstat as lstat10, readFile as readFile16, rm as rm11 } from "fs/promises";
+import { lstat as lstat10, readFile as readFile17, rm as rm11 } from "fs/promises";
import { join as join45 } from "path";
var REGISTRATION = { name: "default", configFile: "./agents/default.toml" };
async function installDefaultAgentRole(input) {
@@ -97900,7 +97929,7 @@ async function installDefaultAgentRole(input) {
if (foreign || existing !== null && !owned) {
throw new Error("Preserved user-owned agents.default / agents/default.toml. Move it aside to install the LazyCodex fallback, or set [codex].agents.default.disable = true in omo.jsonc. Explicit LazyCodex roles remain required.");
}
- const worker = await readFile16(input.worker.path, "utf8");
+ const worker = await readFile17(input.worker.path, "utf8");
const content = worker.replace(/^name\s*=\s*["']lazycodex-worker-medium["']\s*$/m, 'name = "default"');
if (content === worker)
throw new Error("Cannot derive default: medium worker has no matching internal name");
@@ -97910,7 +97939,7 @@ async function installDefaultAgentRole(input) {
}
async function readIfPresent(path) {
try {
- return await readFile16(path, "utf8");
+ return await readFile17(path, "utf8");
} catch (error) {
if (error instanceof Error && "code" in error && error.code === "ENOENT")
return null;
@@ -97971,7 +98000,7 @@ async function syncAgentFile(input) {
value: input.preservedServiceTier?.get(input.agentName) ?? null
});
await applyAgentOverride({ linkPath: input.linkPath, override });
- const model = override?.model ?? extractModel(await readFile17(input.agentPath, "utf8"));
+ const model = override?.model ?? extractModel(await readFile18(input.agentPath, "utf8"));
return {
...model === null ? {} : { model },
...override?.reasoningEffort === undefined ? {} : { reasoningEffort: override.reasoningEffort }
@@ -98015,7 +98044,7 @@ async function prepareReplacement(linkPath) {
async function writeManifest(pluginRoot, agentPaths) {
const manifestPath = join46(pluginRoot, MANIFEST_FILE);
const payload = { agents: [...agentPaths].sort() };
- await writeFile9(manifestPath, `${JSON.stringify(payload, null, "\t")}
+ await writeFile10(manifestPath, `${JSON.stringify(payload, null, "\t")}
`);
}
function agentNameFromToml2(fileName) {
@@ -98084,12 +98113,12 @@ function agentNameFromToml3(fileName) {
}
// packages/omo-codex/src/install/codex-marketplace.ts
-import { readFile as readFile18 } from "fs/promises";
+import { readFile as readFile19 } from "fs/promises";
import { join as join47 } from "path";
var DEFAULT_MARKETPLACE_PATH = "packages/omo-codex/marketplace.json";
async function readMarketplace(repoRoot, options) {
const marketplacePath = options?.marketplacePath ?? join47(repoRoot, DEFAULT_MARKETPLACE_PATH);
- const raw = await readFile18(marketplacePath, "utf8");
+ const raw = await readFile19(marketplacePath, "utf8");
const parsed = JSON.parse(raw);
if (!isPlainRecord4(parsed))
throw new Error("marketplace.json must be an object");
@@ -98110,7 +98139,7 @@ function resolvePluginSource(repoRoot, plugin, options) {
return join47(repoRoot, ...relativePath.split(/[\\/]/));
}
async function readPluginManifest(pluginRoot) {
- const raw = await readFile18(join47(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
+ const raw = await readFile19(join47(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
const parsed = JSON.parse(raw);
if (!isPlainRecord4(parsed))
throw new Error(`${pluginRoot} plugin.json must be an object`);
@@ -98191,11 +98220,11 @@ function validateLocalSourcePath(path) {
}
// packages/omo-codex/src/install/lazycodex-version-stamp.ts
-import { readdir as readdir9, readFile as readFile19, writeFile as writeFile10 } from "fs/promises";
+import { readdir as readdir9, readFile as readFile20, writeFile as writeFile11 } from "fs/promises";
import { join as join48 } from "path";
async function readDistributionManifest(repoRoot) {
try {
- const parsed = JSON.parse(await readFile19(join48(repoRoot, "package.json"), "utf8"));
+ const parsed = JSON.parse(await readFile20(join48(repoRoot, "package.json"), "utf8"));
if (!isPlainRecord4(parsed) || typeof parsed.version !== "string" || parsed.version.trim().length === 0)
return;
return {
@@ -98231,7 +98260,7 @@ async function stampLazyCodexPluginVersion(input) {
async function writeLazyCodexInstallSnapshot(input) {
if (input.distributionManifest === undefined)
return;
- await writeFile10(join48(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
+ await writeFile11(join48(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
packageName: input.distributionManifest.name,
version: input.distributionManifest.version
}, null, "\t")}
@@ -98239,11 +98268,11 @@ async function writeLazyCodexInstallSnapshot(input) {
}
async function stampJsonVersion(path, version) {
try {
- const parsed = JSON.parse(await readFile19(path, "utf8"));
+ const parsed = JSON.parse(await readFile20(path, "utf8"));
if (!isPlainRecord4(parsed))
return;
parsed.version = version;
- await writeFile10(path, `${JSON.stringify(parsed, null, "\t")}
+ await writeFile11(path, `${JSON.stringify(parsed, null, "\t")}
`);
} catch (error) {
if (error instanceof Error)
@@ -98253,7 +98282,7 @@ async function stampJsonVersion(path, version) {
}
async function readPluginHookPaths(manifestPath) {
try {
- const parsed = JSON.parse(await readFile19(manifestPath, "utf8"));
+ const parsed = JSON.parse(await readFile20(manifestPath, "utf8"));
if (!isPlainRecord4(parsed))
return [];
if (typeof parsed.hooks === "string" && parsed.hooks.trim().length > 0)
@@ -98273,11 +98302,11 @@ function stripDotSlash3(path) {
}
async function stampHookStatusMessages(path, version) {
try {
- const parsed = JSON.parse(await readFile19(path, "utf8"));
+ const parsed = JSON.parse(await readFile20(path, "utf8"));
if (!isPlainRecord4(parsed))
return;
stampHookGroups(parsed.hooks, version);
- await writeFile10(path, `${JSON.stringify(parsed, null, "\t")}
+ await writeFile11(path, `${JSON.stringify(parsed, null, "\t")}
`);
} catch (error) {
if (error instanceof Error)
@@ -98354,7 +98383,7 @@ var defaultRunCommand = async (command, args, options) => {
};
// packages/omo-codex/src/install/codex-project-local-cleanup.ts
-import { copyFile as copyFile2, lstat as lstat12, readFile as readFile20, writeFile as writeFile11 } from "fs/promises";
+import { copyFile as copyFile2, lstat as lstat12, readFile as readFile21, writeFile as writeFile12 } from "fs/promises";
import { dirname as dirname17, join as join49, resolve as resolve11 } from "path";
var LEGACY_AGENT_CONFLICT_KEYS = ["max_threads"];
var PROJECT_LOCAL_ARTIFACT_PATHS = [
@@ -98374,7 +98403,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
const artifacts = await collectProjectLocalArtifacts(project.artifactRoots);
const configs = [];
for (const configPath of project.configPaths) {
- const original = await readFile20(configPath, "utf8");
+ const original = await readFile21(configPath, "utf8");
const repair = repairProjectLocalCodexConfigText(original);
if (!repair.changed) {
configs.push({
@@ -98387,7 +98416,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
}
const backupPath = `${configPath}.backup-${formatBackupTimestamp(input.now?.() ?? new Date)}`;
await copyFile2(configPath, backupPath);
- await writeFile11(configPath, `${repair.config.trimEnd()}
+ await writeFile12(configPath, `${repair.config.trimEnd()}
`);
configs.push({
projectRoot: project.projectRoot,
@@ -98584,13 +98613,13 @@ function formatUnknownError(error) {
// packages/omo-codex/src/install/lsp-daemon-reaper.ts
import { createHash as createHash5 } from "crypto";
-import { lstat as lstat13, readFile as readFile22, readdir as readdir11, rm as rm13 } from "fs/promises";
+import { lstat as lstat13, readFile as readFile23, readdir as readdir11, rm as rm13 } from "fs/promises";
import { tmpdir as tmpdir4 } from "os";
import { join as join50, posix as posix6 } from "path";
// packages/omo-codex/src/install/lsp-daemon-reaper-attestation.ts
import { execFile } from "child_process";
-import { readFile as readFile21, readdir as readdir10, readlink as readlink5 } from "fs/promises";
+import { readFile as readFile22, readdir as readdir10, readlink as readlink5 } from "fs/promises";
import { connect } from "net";
import { basename as basename8 } from "path";
var PROBE_TIMEOUT_MS = 500;
@@ -98632,7 +98661,7 @@ async function attestLegacyDaemonOwnership(input, deps = {}) {
return false;
}
async function attestLinuxOwnership(input, deps) {
- const readFileImpl = deps.readFile ?? readFile21;
+ const readFileImpl = deps.readFile ?? readFile22;
const readDirImpl = deps.readDir ?? readdir10;
const readLinkImpl = deps.readLink ?? readlink5;
const procNetUnix = await readText(readFileImpl, "/proc/net/unix");
@@ -98857,7 +98886,7 @@ async function readRegularTrimmedFile(path) {
return null;
if (!stats.isFile())
return "non_regular";
- const content = (await readFile22(path, "utf8")).trim();
+ const content = (await readFile23(path, "utf8")).trim();
return content.length > 0 ? content : null;
}
function shortDigest(value) {
@@ -98918,11 +98947,11 @@ function resolveCodexInstallerBinDir(input) {
}
// packages/omo-codex/src/install/codex-installed-bin-dir.ts
-import { readFile as readFile23, readdir as readdir12, writeFile as writeFile12 } from "fs/promises";
+import { readFile as readFile24, readdir as readdir12, writeFile as writeFile13 } from "fs/promises";
import { join as join52 } from "path";
var INSTALLED_BIN_DIR_MANIFEST = ".installed-bin-dir.json";
async function writeInstalledCodexBinDir(input) {
- await writeFile12(join52(input.pluginRoot, INSTALLED_BIN_DIR_MANIFEST), `${JSON.stringify({ binDir: input.binDir }, null, 2)}
+ await writeFile13(join52(input.pluginRoot, INSTALLED_BIN_DIR_MANIFEST), `${JSON.stringify({ binDir: input.binDir }, null, 2)}
`);
}
async function readInstalledCodexBinDir(codexHome) {
@@ -98948,7 +98977,7 @@ async function installedBinDirManifestPaths(codexHome) {
return paths;
}
async function readBinDirFromManifest(manifestPath) {
- const raw = await readFile23(manifestPath, "utf8").catch(() => null);
+ const raw = await readFile24(manifestPath, "utf8").catch(() => null);
if (raw === null)
return null;
let parsed;
@@ -98966,7 +98995,7 @@ async function readBinDirFromManifest(manifestPath) {
}
// packages/omo-codex/src/install/codex-git-bash-hooks.ts
-import { readFile as readFile24, writeFile as writeFile13 } from "fs/promises";
+import { readFile as readFile25, writeFile as writeFile14 } from "fs/promises";
import { join as join53 } from "path";
var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
"./hooks/pre-tool-use-recommending-git-bash-mcp.json",
@@ -98976,13 +99005,13 @@ async function removeGitBashHooksOffWindows(input) {
if (input.platform === "win32")
return;
const manifestPath = join53(input.pluginRoot, ".codex-plugin", "plugin.json");
- const parsed = JSON.parse(await readFile24(manifestPath, "utf8"));
+ const parsed = JSON.parse(await readFile25(manifestPath, "utf8"));
if (!isPlainRecord4(parsed) || !Array.isArray(parsed.hooks))
return;
const hooks = parsed.hooks.filter((hook) => typeof hook !== "string" || !WINDOWS_ONLY_GIT_BASH_HOOKS.has(hook));
if (hooks.length === parsed.hooks.length)
return;
- await writeFile13(manifestPath, `${JSON.stringify({ ...parsed, hooks }, null, "\t")}
+ await writeFile14(manifestPath, `${JSON.stringify({ ...parsed, hooks }, null, "\t")}
`);
}
@@ -99353,12 +99382,12 @@ function defaultRunCommand2(command, args) {
});
}
// packages/omo-codex/src/install/codex-cleanup.ts
-import { lstat as lstat16, readFile as readFile27, readdir as readdir14, rm as rm15, rmdir } from "fs/promises";
+import { lstat as lstat16, readFile as readFile28, readdir as readdir14, rm as rm15, rmdir } from "fs/promises";
import { homedir as homedir9 } from "os";
import { isAbsolute as isAbsolute11, join as join62, relative as relative7, resolve as resolve16 } from "path";
// packages/omo-codex/src/install/codex-cleanup-bins.ts
-import { lstat as lstat14, readFile as readFile25, readdir as readdir13, readlink as readlink6, rm as rm14 } from "fs/promises";
+import { lstat as lstat14, readFile as readFile26, readdir as readdir13, readlink as readlink6, rm as rm14 } from "fs/promises";
import { dirname as dirname20, isAbsolute as isAbsolute9, join as join60, resolve as resolve14 } from "path";
var ROOT_RUNTIME_BIN_NAME = "omo";
var MANAGED_CODEX_BIN_NAMES = new Set([
@@ -99420,12 +99449,12 @@ async function isManagedCodexBin(linkPath, platform, binName) {
}
if (!entryStat.isFile())
return false;
- const content = await readFile25(linkPath, "utf8");
+ const content = await readFile26(linkPath, "utf8");
return content.includes(RUNTIME_WRAPPER_MARKER) || content.includes(COMMAND_SHIM_MARKER);
}
// packages/omo-codex/src/install/codex-cleanup-config.ts
-import { lstat as lstat15, mkdir as mkdir8, readFile as readFile26, writeFile as writeFile14 } from "fs/promises";
+import { lstat as lstat15, mkdir as mkdir8, readFile as readFile27, writeFile as writeFile15 } from "fs/promises";
import { dirname as dirname21 } from "path";
var MANAGED_MARKETPLACES = ["sisyphuslabs", "lazycodex", "code-yeongyu-codex-plugins"];
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE2 = ["codex-ultrawork-reviewer"];
@@ -99458,14 +99487,14 @@ function cleanupCodexLightConfigText(config) {
async function cleanupCodexConfig(configPath, now) {
if (!await configExists(configPath))
return { changed: false };
- const original = await readFile26(configPath, "utf8");
+ const original = await readFile27(configPath, "utf8");
const next = cleanupCodexLightConfigText(original);
if (next === original)
return { changed: false };
const backupPath = `${configPath}.backup-${formatBackupTimestamp2(now?.() ?? new Date)}`;
await mkdir8(dirname21(configPath), { recursive: true });
- await writeFile14(backupPath, original);
- await writeFile14(configPath, `${next.trimEnd()}
+ await writeFile15(backupPath, original);
+ await writeFile15(configPath, `${next.trimEnd()}
`);
return { changed: true, backupPath };
}
@@ -99742,13 +99771,13 @@ async function collectInstalledAgentPaths(codexHome, configPath) {
async function readManagedAgentPathsFromConfig(codexHome, configPath) {
if (!await exists6(configPath))
return [];
- const config = await readFile27(configPath, "utf8");
+ const config = await readFile28(configPath, "utf8");
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join62(codexHome, "agents", `${agentName}.toml`));
}
async function readInstalledAgentManifest(manifestPath) {
if (!await exists6(manifestPath))
return [];
- const parsed = JSON.parse(await readFile27(manifestPath, "utf8"));
+ const parsed = JSON.parse(await readFile28(manifestPath, "utf8"));
if (!isPlainRecord4(parsed) || !Array.isArray(parsed.agents))
return [];
return parsed.agents.filter((path) => typeof path === "string");
@@ -99940,7 +99969,7 @@ node "%~dp0omo" %*\r
// packages/omo-senpi/src/install/plugin-artifacts.ts
import { createHash as createHash7 } from "crypto";
import { constants as constants9 } from "fs";
-import { access as access2, readFile as readFile29, stat as stat6 } from "fs/promises";
+import { access as access3, readFile as readFile30, stat as stat6 } from "fs/promises";
import { dirname as dirname25, join as join66 } from "path";
// packages/memory-core/src/personas/manifest.ts
@@ -99959,7 +99988,7 @@ var PERSONA_ASSET_FILES = [
// packages/omo-senpi/src/install/senpi-settings.ts
import { constants as constants8 } from "fs";
-import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile28, rename as rename6, writeFile as writeFile15 } from "fs/promises";
+import { access as access2, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile29, rename as rename6, writeFile as writeFile16 } from "fs/promises";
import { basename as basename10, dirname as dirname24, join as join65, resolve as resolve19 } from "path";
var OMO_SENPI_PACKAGE_NAME = "@code-yeongyu/omo-senpi";
var GENERATED_PLUGIN_BASENAME = /^omo-senpi-cli-plugin-[A-Za-z0-9]{6}$/;
@@ -99970,7 +99999,7 @@ var LEGACY_BUILTIN_SHADOW_PACKAGES = [
async function readSettings(settingsPath) {
let raw;
try {
- raw = await readFile28(settingsPath, "utf8");
+ raw = await readFile29(settingsPath, "utf8");
} catch (error) {
if (isErrno(error, "ENOENT"))
return {};
@@ -100017,11 +100046,11 @@ async function writeSettingsAtomically(settingsPath, settings) {
if (await fileExists(settingsPath)) {
await copyFile3(settingsPath, backupPath);
} else {
- await writeFile15(backupPath, `{}
+ await writeFile16(backupPath, `{}
`, "utf8");
}
const tempPath = `${settingsPath}.${process.pid}.${Date.now()}.tmp`;
- await writeFile15(tempPath, `${JSON.stringify(settings, null, 2)}
+ await writeFile16(tempPath, `${JSON.stringify(settings, null, 2)}
`, "utf8");
await rename6(tempPath, settingsPath);
return backupPath;
@@ -100044,7 +100073,7 @@ function isRecord15(value) {
async function readPackageName(packagePath) {
let raw;
try {
- raw = await readFile28(join65(packagePath, "package.json"), "utf8");
+ raw = await readFile29(join65(packagePath, "package.json"), "utf8");
} catch (error) {
if (isErrno(error, "ENOENT") || isErrno(error, "ENOTDIR"))
return;
@@ -100062,7 +100091,7 @@ async function readPackageName(packagePath) {
}
async function fileExists(path) {
try {
- await access(path, constants8.F_OK);
+ await access2(path, constants8.F_OK);
return true;
} catch (error) {
if (isErrno(error, "ENOENT"))
@@ -100125,6 +100154,7 @@ var REQUIRED_PLUGIN_ARTIFACTS = [
join66("skills", "visual-qa", "SKILL.md"),
join66("skills-conditional", "x-search", "SKILL.md"),
join66("runtime", "agent-toolkit-sdk", "sdk.js"),
+ join66("runtime", "bunshin-ts", "sdk.js"),
join66("runtime", "thread-sdk", "sdk.js"),
join66("runtime", "ast-grep-mcp", "cli.js"),
join66("runtime", "lsp-daemon", "dist", "cli.js"),
@@ -100167,7 +100197,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
runtimeStat = await stat6(runtimeEntry);
if (!runtimeStat.isFile())
throw new Error("runtime is not a file");
- await access2(runtimeEntry, constants9.R_OK | constants9.X_OK);
+ await access3(runtimeEntry, constants9.R_OK | constants9.X_OK);
} catch (error) {
throw astGrepIntegrityError(runtimeEntry, `runtime is unreadable or non-executable: ${messageOf(error)}`);
}
@@ -100176,7 +100206,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
}
let manifest;
try {
- manifest = JSON.parse(await readFile29(manifestPath, "utf8"));
+ manifest = JSON.parse(await readFile30(manifestPath, "utf8"));
} catch (error) {
throw astGrepIntegrityError(runtimeEntry, `manifest is unreadable or invalid JSON: ${messageOf(error)}`);
}
@@ -100185,7 +100215,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
}
let actualSha256;
try {
- actualSha256 = createHash7("sha256").update(await readFile29(runtimeEntry)).digest("hex");
+ actualSha256 = createHash7("sha256").update(await readFile30(runtimeEntry)).digest("hex");
} catch (error) {
throw astGrepIntegrityError(runtimeEntry, `runtime hash could not be computed: ${messageOf(error)}`);
}
@@ -100210,7 +100240,7 @@ function messageOf(error) {
}
async function fileExists2(path) {
try {
- await access2(path, constants9.F_OK);
+ await access3(path, constants9.F_OK);
return true;
} catch (error) {
if (isErrno2(error, "ENOENT"))
@@ -107903,7 +107933,7 @@ function getSuggestedInstallTag(currentVersion) {
// packages/omo-opencode/src/cli/doctor/checks/system.ts
init_jsonc_parser2();
init_plugin_identity();
-var runtime4 = globalThis;
+var runtime5 = globalThis;
var defaultDeps5 = {
findOpenCodeBinary,
getOpenCodeVersion: getOpenCodeVersion3,
@@ -107964,7 +107994,7 @@ async function gatherSystemInfo(deps = defaultDeps5) {
opencodePath: binaryInfo?.path ?? null,
pluginVersion,
loadedVersion: loadedInfo.loadedVersion,
- bunVersion: runtime4.Bun?.version ?? "unavailable",
+ bunVersion: runtime5.Bun?.version ?? "unavailable",
configPath: pluginInfo.configPath,
configValid: isConfigValid(pluginInfo.configPath, deps),
isLocalDev: pluginInfo.isLocalDev
@@ -109443,7 +109473,7 @@ async function pathExists2(dir) {
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
init_src();
import { existsSync as existsSync61 } from "fs";
-import { lstat as lstat17, readdir as readdir15, readFile as readFile30 } from "fs/promises";
+import { lstat as lstat17, readdir as readdir15, readFile as readFile31 } from "fs/promises";
import { homedir as homedir26 } from "os";
import { basename as basename13, join as join99, resolve as resolve27 } from "path";
// packages/omo-opencode/package.json
@@ -109668,7 +109698,7 @@ async function readCodexConfigSummary(configPath) {
companionLifecycleHookStateEvents: []
};
}
- const content = await readFile30(configPath, "utf8");
+ const content = await readFile31(configPath, "utf8");
return {
exists: true,
marketplaceConfigured: content.includes("[marketplaces.sisyphuslabs]"),
@@ -109696,7 +109726,7 @@ async function readLinkedAgents(codexHome) {
}
async function readJson(path) {
try {
- const parsed = JSON.parse(await readFile30(path, "utf8"));
+ const parsed = JSON.parse(await readFile31(path, "utf8"));
return isPlainRecord(parsed) ? parsed : null;
} catch (error) {
if (error instanceof Error)
@@ -109820,7 +109850,7 @@ function resolveLatestVersion(input) {
// packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
init_src();
-import { readdir as readdir16, readFile as readFile31, stat as stat7 } from "fs/promises";
+import { readdir as readdir16, readFile as readFile32, stat as stat7 } from "fs/promises";
import { homedir as homedir27 } from "os";
import { dirname as dirname40, isAbsolute as isAbsolute15, join as join100, relative as relative10, resolve as resolve28, sep as sep11 } from "path";
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
@@ -110073,7 +110103,7 @@ function degradedDetailLines(entries) {
}
async function readJson2(path) {
try {
- const parsed = JSON.parse(await readFile31(path, "utf8"));
+ const parsed = JSON.parse(await readFile32(path, "utf8"));
return isRecord18(parsed) ? parsed : null;
} catch (error) {
if (error instanceof Error)
@@ -110101,7 +110131,7 @@ function isRecord18(value) {
// packages/omo-opencode/src/cli/doctor/checks/codex-runtime-wrapper.ts
import { existsSync as existsSync62 } from "fs";
-import { readFile as readFile32 } from "fs/promises";
+import { readFile as readFile33 } from "fs/promises";
import { homedir as homedir28 } from "os";
import { join as join101, resolve as resolve29 } from "path";
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
@@ -110146,7 +110176,7 @@ async function checkCodexRuntimeWrapper(deps = {}) {
}
async function readRuntimeWrapper(path) {
try {
- return await readFile32(path, "utf8");
+ return await readFile33(path, "utf8");
} catch (error) {
if (error instanceof Error)
return null;
@@ -112070,6 +112100,73 @@ async function loadDeviceKeyring(store) {
import { execFile as execFile5 } from "child_process";
import { homedir as homedir30 } from "os";
import { join as join105 } from "path";
+
+// packages/omo-opencode/src/shared/bun-ffi-shim.ts
+async function loadBunFfi() {
+ return import("bun:ffi");
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/process-state.ts
+var KEY = Symbol.for("omo.keychain-helper.process.v1");
+function keychainProcessState() {
+ const holder = globalThis;
+ holder[KEY] ??= {
+ secretsQueue: Promise.resolve(),
+ interactionSwitch: undefined,
+ approvalCache: undefined,
+ entryCandidates: [],
+ helperAccess: undefined,
+ heldPromptLocks: new Set,
+ handOff: undefined
+ };
+ return holder[KEY];
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/secrets-gate.ts
+async function loadInteractionSwitch() {
+ const state = keychainProcessState();
+ if (state.interactionSwitch !== undefined)
+ return state.interactionSwitch;
+ if (process.platform !== "darwin")
+ return state.interactionSwitch = null;
+ try {
+ const { dlopen, FFIType } = await loadBunFfi();
+ const security = dlopen("/System/Library/Frameworks/Security.framework/Security", {
+ SecKeychainSetUserInteractionAllowed: { args: [FFIType.u8], returns: FFIType.i32 }
+ });
+ state.interactionSwitch = (allowed) => {
+ security.symbols.SecKeychainSetUserInteractionAllowed(allowed ? 1 : 0);
+ };
+ } catch {
+ state.interactionSwitch = null;
+ }
+ return state.interactionSwitch;
+}
+function gatedSecrets(run) {
+ const state = keychainProcessState();
+ const next = state.secretsQueue.then(run, run);
+ state.secretsQueue = next.then(() => {
+ return;
+ }, () => {
+ return;
+ });
+ return next;
+}
+function silentSecrets(run) {
+ return gatedSecrets(async () => {
+ const setInteraction = await loadInteractionSwitch();
+ if (setInteraction === null)
+ throw new Error("Keychain interaction cannot be switched off on this host.");
+ setInteraction(false);
+ try {
+ return await run();
+ } finally {
+ setInteraction(true);
+ }
+ });
+}
+
+// packages/omo-opencode/src/cli/account-keys/keystore.ts
var DEFAULT_SERVICE = "omo-cli";
function defaultRun(argv, input) {
const [file, ...args] = argv;
@@ -112093,7 +112190,7 @@ function createOsKeyStore(name, platform = process.platform, run = defaultRun, s
const resolved = secrets === undefined ? run === defaultRun && typeof Bun !== "undefined" ? Bun.secrets : null : secrets;
switch (platform) {
case "darwin":
- return resolved !== null ? createBunSecretsKeyStore(name, resolved) : createMacOsKeychainKeyStore(name, run);
+ return resolved !== null ? createBunSecretsKeyStore(name, gateRealSecrets(resolved)) : createMacOsKeychainKeyStore(name, run);
case "linux":
return resolved !== null ? createBunSecretsKeyStore(name, resolved) : createLibsecretKeyStore(name, run);
case "win32":
@@ -112112,6 +112209,10 @@ async function guarded(run, fail, argv, input) {
throw fail();
}
}
+var gateRealSecrets = (secrets) => typeof Bun !== "undefined" && secrets === Bun.secrets ? {
+ get: (key) => gatedSecrets(() => secrets.get(key)),
+ set: (entry) => gatedSecrets(() => secrets.set(entry))
+} : secrets;
function createBunSecretsKeyStore(name, secrets) {
const key = { service: DEFAULT_SERVICE, name };
const unavailable = () => new Error("omo account keys: cannot access the OS credential store. Unlock the login keychain (macOS), the Secret Service keyring (Linux), or DPAPI (Windows), then try again. " + "Private keys are only ever stored through the OS credential facility.");
@@ -112649,64 +112750,705 @@ async function loginDevice(session, options) {
}
// packages/omo-opencode/src/cli/service-auth/keystore.ts
-import { createHash as createHash12, randomUUID as randomUUID7 } from "crypto";
-import { basename as basename15 } from "path";
+import { createHash as createHash12, randomUUID as randomUUID8 } from "crypto";
+import { basename as basename17 } from "path";
-// packages/omo-opencode/src/cli/service-auth/secret-service-lock.ts
-import { spawn as spawn5 } from "child_process";
-var DEFAULT_COLLECTION = "/org/freedesktop/secrets/aliases/default";
-var PROBE_TIMEOUT_MS2 = 1e4;
-var parseLockedReply = (stdout) => {
- const match = /<\s*(true|false)\s*>/.exec(stdout);
- if (match === null)
- return null;
- return match[1] === "true" ? "locked" : "unlocked";
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/darwin-backend.ts
+import { homedir as homedir31 } from "os";
+import { join as join109 } from "path";
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/client.ts
+init_zod();
+init_bun_spawn_shim();
+var MUTATING = new Set(["write", "stage", "retire", "promote", "remove"]);
+var helperReplySchema = object({
+ owned: boolean2(),
+ value: string2(),
+ marker: boolean2(),
+ cdat: number2(),
+ mdat: number2(),
+ partition: _enum(["ours", "other", "none", "unknown"]),
+ present: object({ staging: boolean2(), old: boolean2(), oldSlots: array(number2().int().min(0).max(7)).optional() }).strict(),
+ missing: boolean2(),
+ recover: boolean2(),
+ ok: boolean2(),
+ created: boolean2(),
+ skipped: boolean2(),
+ slot: number2().int().min(0).max(7),
+ error: _enum(["locked", "store", "not-owned", "exists", "missing", "denied", "refused"]),
+ reason: string2(),
+ status: number2()
+}).partial().strict();
+
+class HelperProtocolError extends Error {
+}
+async function firstLine(stream) {
+ const reader = stream.getReader();
+ const decoder = new TextDecoder;
+ let text = "";
+ for (;; ) {
+ const newline = text.indexOf(`
+`);
+ if (newline !== -1)
+ return text.slice(0, newline);
+ const chunk = await reader.read();
+ if (chunk.done)
+ return null;
+ text += decoder.decode(chunk.value, { stream: true });
+ }
+}
+function isFlushable(stream) {
+ return typeof stream.flush === "function";
+}
+var spawnDetachedHelper = (path) => {
+ const child = spawn([path], {
+ stdin: "pipe",
+ stdout: "pipe",
+ stderr: "ignore",
+ detached: true,
+ env: process.env.HOME === undefined ? {} : { HOME: process.env.HOME }
+ });
+ const pid = child.pid;
+ if (pid === undefined)
+ throw new HelperProtocolError("The keychain helper did not start.");
+ const stdin = child.stdin;
+ return {
+ pid,
+ send: (line) => {
+ stdin.write(line);
+ if (isFlushable(stdin))
+ stdin.flush();
+ },
+ reply: firstLine(child.stdout),
+ close: () => {
+ stdin.end();
+ }
+ };
};
-var probeSecretServiceLock = () => new Promise((resolve) => {
- const child = spawn5("gdbus", [
- "call",
- "--session",
- "--dest",
- "org.freedesktop.secrets",
- "--object-path",
- DEFAULT_COLLECTION,
- "--method",
- "org.freedesktop.DBus.Properties.Get",
- "org.freedesktop.Secret.Collection",
- "Locked"
- ], { stdio: ["ignore", "pipe", "ignore"] });
- let stdout = "";
- const timer = setTimeout(() => {
- child.kill();
- resolve("unknown");
- }, PROBE_TIMEOUT_MS2);
- child.stdout.on("data", (chunk) => {
- stdout += chunk.toString();
+async function callHelper(path, call, options = {}) {
+ const mutates = MUTATING.has(call.verb);
+ if (mutates && options.lease === undefined)
+ throw new HelperProtocolError(`The ${call.verb} helper call needs the session lock.`);
+ const helper = (options.spawn ?? spawnDetachedHelper)(path);
+ let handedOver = false;
+ try {
+ if (mutates && options.lease !== undefined) {
+ await options.lease.handOver(helper.pid);
+ handedOver = true;
+ }
+ helper.send(`${JSON.stringify({ v: 1, verb: call.verb, account: call.account, ...call.value === undefined ? {} : { value: call.value } })}
+`);
+ const line = await helper.reply;
+ if (handedOver && options.lease !== undefined) {
+ handedOver = false;
+ await options.lease.restore();
+ }
+ if (line === null)
+ throw new HelperProtocolError(`The keychain helper exited without answering ${call.verb}.`);
+ let json;
+ try {
+ json = JSON.parse(line);
+ } catch {
+ throw new HelperProtocolError(`The keychain helper sent a ${call.verb} reply that is not JSON.`);
+ }
+ const parsed = helperReplySchema.safeParse(json);
+ if (!parsed.success)
+ throw new HelperProtocolError(`The keychain helper sent an unexpected ${call.verb} reply.`);
+ return parsed.data;
+ } catch (error) {
+ if (handedOver && options.lease !== undefined) {
+ try {
+ await options.lease.restore();
+ } catch (restoreError) {
+ throw new AggregateError([error, restoreError], `The ${call.verb} helper call failed and the session lock could not be restored.`);
+ }
+ }
+ throw error;
+ } finally {
+ helper.close();
+ }
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/location.ts
+import { dirname as dirname42, join as join106, posix as posix13 } from "path";
+import { fileURLToPath as fileURLToPath8 } from "url";
+function bundleCandidates(moduleUrl) {
+ const root = dirname42(dirname42(dirname42(fileURLToPath8(moduleUrl))));
+ return [join106(root, "bin", "darwin", "omo-keychain"), join106(root, "omo-keychain")];
+}
+function machineCandidates(home, arch = process.arch) {
+ const runtimeArch = arch === "arm64" ? "arm64" : "x64";
+ return [
+ `/Applications/OmO.app/Contents/Resources/omo-runtime/darwin-${runtimeArch}/omo-keychain`,
+ posix13.join(home, "Applications", "OmO.app", "Contents", "Resources", "omo-runtime", `darwin-${runtimeArch}`, "omo-keychain"),
+ posix13.join(home, ".bun", "install", "global", "node_modules", "omo-ai", "bin", "darwin", "omo-keychain")
+ ];
+}
+async function locateHelper(candidates, verify) {
+ const rejected = [];
+ for (const path of candidates) {
+ const verdict = await verify(path);
+ if (verdict === "valid")
+ return { kind: "found", path };
+ if (verdict === "invalid")
+ rejected.push(path);
+ }
+ return rejected.length === 0 ? { kind: "missing" } : { kind: "invalid", rejected };
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/pin.ts
+import { readdirSync as readdirSync14, rmSync as rmSync9 } from "fs";
+import { chmod as chmod2, copyFile as copyFile4, constants as constants13, mkdtemp as mkdtemp2, rm as rm16, stat as stat8 } from "fs/promises";
+import { tmpdir as tmpdir6 } from "os";
+import { basename as basename15, join as join107 } from "path";
+var DIR_PREFIX = "omo-keychain-";
+var OWNED_DIR = new RegExp(`^${DIR_PREFIX}(\\d+)-`);
+var isAlive = (pid) => {
+ try {
+ process.kill(pid, 0);
+ return true;
+ } catch (error) {
+ return !(error instanceof Error && ("code" in error) && error.code === "ESRCH");
+ }
+};
+function sweepDeadPinDirs(root = tmpdir6()) {
+ const removed = [];
+ let entries;
+ try {
+ entries = readdirSync14(root);
+ } catch {
+ return removed;
+ }
+ for (const entry of entries) {
+ const owner = OWNED_DIR.exec(entry)?.[1];
+ if (owner === undefined || Number(owner) === process.pid || isAlive(Number(owner)))
+ continue;
+ try {
+ rmSync9(join107(root, entry), { recursive: true, force: true });
+ } catch {
+ continue;
+ }
+ removed.push(entry);
+ }
+ return removed;
+}
+var processDir;
+async function processPinDir() {
+ if (processDir !== undefined)
+ return processDir;
+ sweepDeadPinDirs();
+ const dir = await mkdtemp2(join107(tmpdir6(), `${DIR_PREFIX}${process.pid}-`));
+ process.once("exit", () => rmSync9(dir, { recursive: true, force: true }));
+ processDir = dir;
+ return dir;
+}
+var pinned = new Map;
+async function sourceIdentity(source) {
+ const info = await stat8(source);
+ return `${source}\x00${info.dev}\x00${info.ino}\x00${info.size}\x00${info.mtimeMs}\x00${info.ctimeMs}`;
+}
+async function copyAndVerify(source, verify, dir) {
+ const target = join107(dir, `${crypto.randomUUID()}-${basename15(source)}`);
+ try {
+ await copyFile4(source, target, constants13.COPYFILE_EXCL);
+ await chmod2(target, 320);
+ } catch (error) {
+ await rm16(target, { force: true });
+ return { kind: "unavailable", reason: error instanceof Error ? error.message : String(error) };
+ }
+ let verdict;
+ try {
+ verdict = await verify(target);
+ } catch (error) {
+ await rm16(target, { force: true });
+ return { kind: "unavailable", reason: error instanceof Error ? error.message : String(error) };
+ }
+ if (verdict === "valid")
+ return { kind: "pinned", path: target };
+ await rm16(target, { force: true });
+ return { kind: "invalid" };
+}
+async function pinVerifiedCopy(source, verify, dir) {
+ let identity;
+ try {
+ identity = `${dir ?? ""}\x00${await sourceIdentity(source)}`;
+ } catch (error) {
+ return { kind: "unavailable", reason: error instanceof Error ? error.message : String(error) };
+ }
+ const known = pinned.get(identity);
+ if (known !== undefined) {
+ const result = await known;
+ if (result.kind !== "pinned")
+ return result;
+ let verdict;
+ try {
+ verdict = await verify(result.path);
+ } catch (error) {
+ pinned.delete(identity);
+ await rm16(result.path, { force: true });
+ return { kind: "unavailable", reason: error instanceof Error ? error.message : String(error) };
+ }
+ if (verdict === "valid")
+ return result;
+ }
+ const created = Promise.resolve(dir ?? processPinDir()).then((target) => copyAndVerify(source, verify, target), (error) => ({ kind: "unavailable", reason: error instanceof Error ? error.message : String(error) }));
+ pinned.set(identity, created);
+ const result = await created;
+ if (result.kind !== "pinned")
+ pinned.delete(identity);
+ return result;
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/signature.ts
+import { stat as stat9 } from "fs/promises";
+init_bun_spawn_shim();
+var KEYCHAIN_HELPER_REQUIREMENT = 'identifier "com.mengmota.omo-keychain-helper" and anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] ' + 'and certificate leaf[field.1.2.840.113635.100.6.1.13] and certificate leaf[subject.OU] = "523JNR86LZ"';
+var STRICT_ALL_ARCHITECTURES = 1 << 4 | 1 << 0;
+var UTF8 = 134217984;
+var security;
+async function loadSecurity() {
+ if (security !== undefined)
+ return security;
+ try {
+ const { dlopen, FFIType, ptr } = await loadBunFfi();
+ const cf = dlopen("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation", {
+ CFStringCreateWithCString: { args: [FFIType.u64, FFIType.ptr, FFIType.u32], returns: FFIType.u64 },
+ CFURLCreateFromFileSystemRepresentation: { args: [FFIType.u64, FFIType.ptr, FFIType.i64, FFIType.bool], returns: FFIType.u64 },
+ CFRelease: { args: [FFIType.u64], returns: FFIType.void }
+ });
+ const sec = dlopen("/System/Library/Frameworks/Security.framework/Security", {
+ SecStaticCodeCreateWithPath: { args: [FFIType.u64, FFIType.u32, FFIType.ptr], returns: FFIType.i32 },
+ SecRequirementCreateWithString: { args: [FFIType.u64, FFIType.u32, FFIType.ptr], returns: FFIType.i32 },
+ SecStaticCodeCheckValidityWithErrors: { args: [FFIType.u64, FFIType.u32, FFIType.u64, FFIType.u64], returns: FFIType.i32 }
+ });
+ const cString = (text) => Buffer.from(`${text}\x00`, "utf8");
+ security = {
+ check(path, requirement) {
+ const pathBytes = Buffer.from(path, "utf8");
+ const url = BigInt(cf.symbols.CFURLCreateFromFileSystemRepresentation(0n, ptr(pathBytes), pathBytes.length, false));
+ const text = BigInt(cf.symbols.CFStringCreateWithCString(0n, ptr(cString(requirement)), UTF8));
+ const codeOut = new BigUint64Array(1);
+ const requirementOut = new BigUint64Array(1);
+ try {
+ if (url === 0n || text === 0n)
+ return false;
+ if (sec.symbols.SecStaticCodeCreateWithPath(url, 0, ptr(codeOut)) !== 0)
+ return false;
+ if (sec.symbols.SecRequirementCreateWithString(text, 0, ptr(requirementOut)) !== 0)
+ return false;
+ const code = codeOut[0] ?? 0n;
+ const designated = requirementOut[0] ?? 0n;
+ return sec.symbols.SecStaticCodeCheckValidityWithErrors(code, STRICT_ALL_ARCHITECTURES, designated, 0n) === 0;
+ } finally {
+ for (const ref of [url, text, codeOut[0] ?? 0n, requirementOut[0] ?? 0n])
+ if (ref !== 0n)
+ cf.symbols.CFRelease(ref);
+ }
+ }
+ };
+ } catch {
+ security = null;
+ }
+ return security;
+}
+async function verifyWithCodesign(path, requirement) {
+ const child = spawn(["/usr/bin/codesign", "--verify", "--strict", `-R=${requirement}`, path], {
+ stdout: "ignore",
+ stderr: "ignore",
+ env: {}
});
- child.on("error", () => {
- clearTimeout(timer);
- resolve("unknown");
+ return await child.exited === 0;
+}
+var verifyWithSecurityFramework = async (path, requirement) => {
+ const loaded = await loadSecurity();
+ return loaded === null ? verifyWithCodesign(path, requirement) : loaded.check(path, requirement);
+};
+async function fileIdentity(path) {
+ try {
+ const info = await stat9(path);
+ if (!info.isFile())
+ return null;
+ return `${path}\x00${info.dev}\x00${info.ino}\x00${info.size}\x00${info.mtimeMs}\x00${info.ctimeMs}`;
+ } catch {
+ return null;
+ }
+}
+function createSignatureChecker(check = verifyWithSecurityFramework, requirement = KEYCHAIN_HELPER_REQUIREMENT) {
+ const verdicts = new Map;
+ const checker = async (path) => {
+ const before = await fileIdentity(path);
+ if (before === null)
+ return "missing";
+ const known = verdicts.get(before);
+ if (known !== undefined)
+ return known;
+ const passed = await check(path, requirement);
+ if (await fileIdentity(path) !== before)
+ return "invalid";
+ const verdict = passed ? "valid" : "invalid";
+ verdicts.set(before, verdict);
+ return verdict;
+ };
+ return checker;
+}
+var processChecker;
+var processSignatureChecker = () => processChecker ??= createSignatureChecker();
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/access.ts
+async function resolveHelperAccess(candidates, options = {}) {
+ const verify = options.verify ?? processSignatureChecker();
+ let source;
+ let pin;
+ try {
+ const location = await locateHelper(candidates, verify);
+ if (location.kind !== "found")
+ return location;
+ source = location.path;
+ pin = await (options.pin ?? pinVerifiedCopy)(source, verify);
+ } catch (error) {
+ return { kind: "unavailable", reason: error instanceof Error ? error.message : String(error) };
+ }
+ if (pin.kind === "invalid")
+ return { kind: "invalid", rejected: [source] };
+ if (pin.kind === "unavailable")
+ return { kind: "unavailable", reason: pin.reason };
+ const pinned = pin.path;
+ const spawn = options.spawn ?? spawnDetachedHelper;
+ return {
+ kind: "ready",
+ path: pinned,
+ call: async (call, lease) => {
+ const verdict = await verify(pinned).catch((error) => {
+ throw new HelperProtocolError(`OmO's keychain helper could not be checked before it ran: ${error instanceof Error ? error.message : String(error)}`);
+ });
+ if (verdict !== "valid")
+ throw new HelperProtocolError("OmO's keychain helper changed on disk and failed its signature check; it was not run.");
+ return callHelper(pinned, call, { spawn, ...lease === undefined ? {} : { lease } });
+ }
+ };
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/approval-cache.ts
+var systemClock = { nowSeconds: () => Date.now() / 1000, sleepMs: (ms) => new Promise((resolve) => setTimeout(resolve, ms)) };
+function isEntryValid(entry, current, nowSeconds) {
+ if (nowSeconds < entry.readStartedAt)
+ return false;
+ return current.cdat === entry.cdat && current.mdat === entry.mdat && Math.floor(current.mdat) < Math.floor(entry.readStartedAt);
+}
+function createApprovalCache(clock = systemClock) {
+ let entry = null;
+ let deniedForBackground = false;
+ let pending = null;
+ return {
+ consume(current) {
+ if (entry === null)
+ return null;
+ if (!isEntryValid(entry, current, clock.nowSeconds())) {
+ entry = null;
+ return null;
+ }
+ return entry.value;
+ },
+ deniedForBackground: () => deniedForBackground,
+ inFlight: () => pending,
+ approve(run) {
+ if (pending !== null)
+ return pending;
+ const readStartedAt = clock.nowSeconds();
+ const started = run().then((answer) => {
+ if (answer.kind === "approved") {
+ entry = { value: answer.value, ...answer.attributes, readStartedAt };
+ deniedForBackground = false;
+ } else if (answer.kind === "denied")
+ deniedForBackground = true;
+ return answer;
+ });
+ const settled = () => {
+ if (pending === started)
+ pending = null;
+ };
+ started.then(settled, settled);
+ pending = started;
+ return started;
+ },
+ async afterOwnWrite(value, readAttributes) {
+ if (entry === null)
+ return;
+ const written = await readAttributes();
+ if (written === null) {
+ entry = null;
+ return;
+ }
+ while (Math.floor(clock.nowSeconds()) <= Math.floor(written.mdat)) {
+ await clock.sleepMs(Math.max(1, Math.ceil((Math.floor(written.mdat) + 1 - clock.nowSeconds()) * 1000)));
+ }
+ const readStartedAt = clock.nowSeconds();
+ const fresh = await readAttributes();
+ entry = fresh === null ? null : { value, ...fresh, readStartedAt };
+ },
+ drop() {
+ entry = null;
+ }
+ };
+}
+var processApprovalCache = () => {
+ const state = keychainProcessState();
+ state.approvalCache ??= createApprovalCache();
+ return state.approvalCache;
+};
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/darwin-read.ts
+var ROW_8B_DEFAULT = "re-login";
+
+class HelperReadError extends Error {
+ failure;
+ constructor(failure, message) {
+ super(message);
+ this.failure = failure;
+ }
+}
+function failure2(reply) {
+ if (reply.error === "locked")
+ return new HelperReadError("locked", "The keychain is locked.");
+ return new HelperReadError("store", `The keychain helper answered ${reply.error ?? "unexpectedly"}.`);
+}
+async function approveOnce(deps) {
+ const running = deps.cache.inFlight();
+ if (running !== null)
+ return running;
+ const release = await deps.takePromptLock();
+ if (release === null)
+ throw new HelperReadError("pending", "Another omo process is waiting for your keychain approval.");
+ try {
+ return await deps.cache.approve(async () => {
+ const reply = await deps.access.call({ verb: "approve", account: deps.account });
+ if (reply.missing === true)
+ return { kind: "missing" };
+ if (reply.error === "denied")
+ return { kind: "denied" };
+ if (reply.error !== undefined || reply.value === undefined || reply.cdat === undefined || reply.mdat === undefined)
+ throw failure2(reply);
+ return { kind: "approved", value: reply.value, attributes: { cdat: reply.cdat, mdat: reply.mdat } };
+ });
+ } finally {
+ await release();
+ }
+}
+async function readThroughHelper(deps, allowPrompt) {
+ const reply = await deps.access.call({ verb: "read", account: deps.account });
+ if (reply.error !== undefined)
+ throw failure2(reply);
+ if (reply.missing === true)
+ return { kind: "missing", reply };
+ if (reply.owned === true && reply.value !== undefined)
+ return { kind: "value", value: reply.value, source: reply.marker === true || reply.recover === true ? "owned" : "owned-unmarked", reply };
+ const own = await deps.ownSilentGet().catch(() => {
+ return;
});
- child.on("close", (code) => {
- clearTimeout(timer);
- resolve(code === 0 ? parseLockedReply(stdout) ?? "absent" : "absent");
+ if (typeof own === "string")
+ return { kind: "value", value: own, source: "own-identity", reply };
+ if (reply.cdat === undefined || reply.mdat === undefined)
+ throw failure2(reply);
+ const cached = deps.cache.consume({ cdat: reply.cdat, mdat: reply.mdat });
+ if (cached !== null)
+ return { kind: "value", value: cached, source: "approved", reply };
+ const reloginInstead = reply.partition !== "ours" && reply.partition !== "none" && (deps.row8b ?? ROW_8B_DEFAULT) === "re-login";
+ if (!allowPrompt) {
+ if (reloginInstead)
+ return { kind: "missing", reply };
+ throw new HelperReadError("pending", "The keychain needs your approval; run an omo command in a terminal.");
+ }
+ if (deps.background && deps.cache.deniedForBackground())
+ throw new HelperReadError("pending", "Keychain access was denied; run an omo command in a terminal to approve it.");
+ if (reloginInstead)
+ return { kind: "missing", reply };
+ if (deps.noDialog === true)
+ throw new HelperReadError("pending", "The keychain hand-off cannot show a dialog.");
+ if (deps.handOff !== undefined && await deps.handOff()) {
+ const after = await deps.access.call({ verb: "read", account: deps.account });
+ if (after.owned === true && after.value !== undefined)
+ return { kind: "value", value: after.value, source: "owned", reply: after };
+ }
+ const answer = await approveOnce(deps);
+ if (answer.kind === "approved")
+ return { kind: "value", value: answer.value, source: "approved", reply };
+ if (answer.kind === "missing")
+ return { kind: "missing", reply };
+ throw new HelperReadError("denied", "Keychain access was denied.");
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/recovery.ts
+var OLD_SLOT_COUNT = 8;
+var oldSlotName = (account, slot) => slot === 0 ? `${account}.old` : `${account}.old.${slot}`;
+function recoveryPlan(names) {
+ if (!names.original && names.staging)
+ return names.old ? ["promote", "delete-old"] : ["promote"];
+ if (!names.original && names.old)
+ return ["delete-old"];
+ if (names.original && names.staging)
+ return names.old ? ["remove-staging", "delete-old"] : ["remove-staging"];
+ if (names.original && names.old)
+ return ["delete-old"];
+ return [];
+}
+function oldSlotsOf(reply) {
+ return reply.present?.oldSlots ?? (reply.present?.old === true ? [0] : []);
+}
+function namesFromRead(reply) {
+ const original = reply.owned === false || reply.owned === true && reply.recover !== true;
+ return { original, staging: reply.present?.staging === true, old: reply.present?.old === true, oldSlots: oldSlotsOf(reply) };
+}
+async function deleteOld(name, helper, deleteOwn) {
+ const removed = await helper({ verb: "remove", account: name }).catch(() => null);
+ if (removed?.ok === true)
+ return true;
+ return deleteOwn(name).catch(() => false);
+}
+async function deleteOldSlots(account, slots, helper, deleteOwn) {
+ let cleared = true;
+ for (const slot of slots)
+ if (!await deleteOld(oldSlotName(account, slot), helper, deleteOwn))
+ cleared = false;
+ return cleared;
+}
+async function runRecovery(account, names, helper, deleteOwnOld) {
+ const applied = [];
+ for (const step of recoveryPlan(names)) {
+ const ok = step === "promote" ? (await helper({ verb: "promote", account })).ok === true : step === "remove-staging" ? (await helper({ verb: "remove", account: `${account}.staging` })).ok === true : await deleteOldSlots(account, names.oldSlots, helper, deleteOwnOld);
+ if (!ok && step !== "delete-old")
+ return { applied, failed: step };
+ if (ok)
+ applied.push(step);
+ }
+ return { applied, failed: null };
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/migration.ts
+var MIGRATABLE = new Set(["own-identity", "owned-unmarked", "approved"]);
+async function migrate(account, value, source, helper, deleteOwnOld) {
+ if (!MIGRATABLE.has(source))
+ return { kind: "skipped", reason: "not-migratable" };
+ if ((await helper({ verb: "stage", account, value })).ok !== true)
+ return { kind: "failed", step: "stage" };
+ const retired = await helper({ verb: "retire", account });
+ if (retired.error === "exists" && retired.reason === "old-slots-full" || retired.ok === true && retired.skipped === true) {
+ await helper({ verb: "remove", account: `${account}.staging` });
+ return { kind: "skipped", reason: "old-slots-full" };
+ }
+ if (retired.ok !== true)
+ return { kind: "failed", step: "retire" };
+ const slot = retired.slot ?? 0;
+ if ((await helper({ verb: "promote", account })).ok !== true)
+ return { kind: "failed", step: "promote" };
+ return { kind: "migrated", oldDeleted: await deleteOld(oldSlotName(account, slot), helper, deleteOwnOld) };
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/darwin-store.ts
+class HelperOldSlotsFull extends Error {
+}
+var ALL_OLD_SLOTS = Array.from({ length: OLD_SLOT_COUNT }, (_, slot) => slot);
+var OLD_SLOTS_FULL_MESSAGE = 'The macOS keychain holds 8 earlier OmO sign-ins that cannot be removed automatically. Open Keychain Access, delete the items whose account name ends in ".old" or ".old.1" to ".old.7" for OmO, then sign in again.';
+var failed = (reply, verb) => new HelperReadError(reply.error === "locked" ? "locked" : "store", `The keychain helper could not ${verb} the sign-in (${reply.error ?? "no answer"}).`);
+function lockedDarwinStore(deps, lease) {
+ const helper = (call) => deps.access.call(call, lease);
+ const deleteOwnOld = (name) => deps.ownDelete(name);
+ let lastRead = null;
+ const read = async () => {
+ const result = await readThroughHelper(deps, false);
+ lastRead = result.kind === "value" ? result : null;
+ return result.kind === "value" ? result.value : null;
+ };
+ return {
+ async recover() {
+ const reply = await deps.access.call({ verb: "read", account: deps.account });
+ if (reply.error === undefined)
+ await runRecovery(deps.account, namesFromRead(reply), helper, deleteOwnOld);
+ },
+ read,
+ async settle() {
+ if (lastRead === null)
+ return;
+ const outcome = await migrate(deps.account, lastRead.value, lastRead.source, helper, deleteOwnOld);
+ if (outcome.kind === "skipped" && outcome.reason === "old-slots-full")
+ deps.notice(`omo: ${OLD_SLOTS_FULL_MESSAGE}`);
+ if (outcome.kind === "failed")
+ deps.notice(`omo: the macOS keychain item could not be moved to OmO's keychain helper (${outcome.step}); it keeps working as before.`);
+ },
+ async write(value, intent, beforeRetire) {
+ const state = await deps.access.call({ verb: "read", account: deps.account });
+ if (state.error !== undefined)
+ throw failed(state, "check");
+ if (state.owned === false) {
+ const approved = state.cdat !== undefined && state.mdat !== undefined && deps.cache.consume({ cdat: state.cdat, mdat: state.mdat }) !== null;
+ const readable = lastRead !== null || approved || await deps.ownSilentGet().catch(() => {
+ return;
+ }) !== undefined;
+ if (readable || intent !== "fresh-sign-in") {
+ await deps.ownOverwrite(value);
+ if (lastRead?.source === "approved")
+ await deps.cache.afterOwnWrite(value, async () => {
+ const after = await deps.access.call({ verb: "read", account: deps.account });
+ return after.cdat === undefined || after.mdat === undefined ? null : { cdat: after.cdat, mdat: after.mdat };
+ });
+ return;
+ }
+ await beforeRetire?.();
+ const retired = await helper({ verb: "retire", account: deps.account });
+ if (retired.reason === "old-slots-full" || retired.ok === true && retired.skipped === true)
+ throw new HelperOldSlotsFull(OLD_SLOTS_FULL_MESSAGE);
+ if (retired.ok !== true)
+ throw failed(retired, "replace");
+ }
+ const written = await helper({ verb: "write", account: deps.account, value });
+ if (written.ok !== true)
+ throw failed(written, "save");
+ lastRead = { kind: "value", value, source: "owned", reply: written };
+ },
+ async clear() {
+ const removed = await helper({ verb: "remove", account: deps.account });
+ if (removed.error === "not-owned")
+ await deps.ownDelete(deps.account);
+ else if (removed.ok !== true)
+ throw failed(removed, "remove");
+ await helper({ verb: "remove", account: `${deps.account}.staging` });
+ const present = await helper({ verb: "read", account: deps.account });
+ const slots = present.error === undefined ? oldSlotsOf(present) : ALL_OLD_SLOTS;
+ await deleteOldSlots(deps.account, slots, helper, deleteOwnOld);
+ lastRead = null;
+ }
+ };
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/owner-marker.ts
+init_bun_spawn_shim();
+var MARKER_LINE = /^\s*"gena"<blob>="omo-owner\/1"\s*$/m;
+var ITEM_NOT_FOUND = 44;
+var probeOwnerMarker = async (service, account, keychain) => {
+ const args = ["find-generic-password", "-s", service, "-a", account, ...keychain === undefined ? [] : [keychain]];
+ const child = spawn(["/usr/bin/security", ...args], {
+ stdout: "pipe",
+ stderr: "ignore",
+ env: process.env.HOME === undefined ? {} : { HOME: process.env.HOME }
});
-});
+ const [stdout, code] = await Promise.all([new Response(child.stdout).text(), child.exited]);
+ if (code === ITEM_NOT_FOUND)
+ return "absent";
+ if (code !== 0)
+ return "unknown";
+ return MARKER_LINE.test(stdout) ? "helper-owned" : "other";
+};
-// packages/omo-opencode/src/cli/service-auth/credential-lock.ts
-import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
-import { createHash as createHash11 } from "crypto";
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/prompt-lock.ts
import { mkdir as mkdir11 } from "fs/promises";
-import { homedir as homedir31 } from "os";
-import { join as join106 } from "path";
+import { dirname as dirname45 } from "path";
// packages/team-core/src/team-state-store/lock-publish.ts
-import { access as access4, open as open3, unlink as unlink3 } from "fs/promises";
-import { dirname as dirname42 } from "path";
+import { access as access5, open as open3, unlink as unlink4 } from "fs/promises";
+import { dirname as dirname43 } from "path";
// packages/team-core/src/team-state-store/lock-record.ts
import { randomUUID as randomUUID6 } from "crypto";
-import { readFile as readFile34, stat as stat9 } from "fs/promises";
+import { readFile as readFile35, stat as stat11 } from "fs/promises";
// packages/memory-core/src/locks/process-identity.ts
import { execFile as execFile7 } from "child_process";
@@ -112804,23 +113546,23 @@ function rename8(from, to, admit) {
}
var sync = resilientNamespace(fsSync, "sync");
var {
- access: access3,
- chmod: chmod2,
- copyFile: copyFile4,
+ access: access4,
+ chmod: chmod3,
+ copyFile: copyFile5,
cp: cp5,
link,
lstat: lstat18,
mkdir: mkdir10,
- mkdtemp: mkdtemp2,
- readFile: readFile33,
+ mkdtemp: mkdtemp3,
+ readFile: readFile34,
readdir: readdir17,
readlink: readlink7,
realpath: realpath2,
- rm: rm16,
+ rm: rm17,
rmdir: rmdir2,
- stat: stat8,
+ stat: stat10,
statfs,
- unlink: unlink2
+ unlink: unlink3
} = promises;
var {
accessSync: accessSync5,
@@ -112830,7 +113572,7 @@ var {
lstatSync: lstatSync5,
mkdirSync: mkdirSync19,
readFileSync: readFileSync44,
- readdirSync: readdirSync14,
+ readdirSync: readdirSync15,
realpathSync: realpathSync13,
statSync: statSync8,
unlinkSync: unlinkSync10,
@@ -112943,7 +113685,7 @@ async function execFileText(command, args) {
}
async function readLinuxStartIdentity(pid) {
try {
- const stat = await readFile33(`/proc/${pid}/stat`, "utf8");
+ const stat = await readFile34(`/proc/${pid}/stat`, "utf8");
const commandEnd = stat.lastIndexOf(")");
if (commandEnd < 0)
return null;
@@ -113182,14 +113924,17 @@ async function isWorkerLockReleased(incarnation, record) {
// packages/team-core/src/team-state-store/lock-record.ts
async function buildLockRecord(ownerTag) {
await registerLockWorker();
- const processStart = await getProcessStartIdentity(process.pid);
+ const processStart = await lockProcessStartLine(process.pid);
return `${ownerTag} ${randomUUID6()}
${process.pid}
${Date.now()}
${lockOwnerInstanceId}
-${processStart ?? "unavailable"}
+${processStart}
`;
}
+async function lockProcessStartLine(pid) {
+ return await getProcessStartIdentity(pid) ?? "unavailable";
+}
function errorCode2(error) {
if (!(error instanceof Error) || !("code" in error))
return null;
@@ -113218,8 +113963,8 @@ function parseLockOwner(content) {
}
async function readLockRecord(lockPath) {
try {
- const content = await readFile34(lockPath, "utf8");
- const { mtimeMs } = await stat9(lockPath);
+ const content = await readFile35(lockPath, "utf8");
+ const { mtimeMs } = await stat11(lockPath);
return { content, modifiedAtEpochMs: mtimeMs };
} catch (error) {
if (!(error instanceof Error))
@@ -113250,7 +113995,7 @@ async function isLockRecordStale(record, staleAfterMs) {
// packages/team-core/src/team-state-store/lock-publish.ts
async function pathMayExist(path, deps = {}) {
- const accessPath = deps.access ?? access4;
+ const accessPath = deps.access ?? access5;
try {
await accessPath(path);
return true;
@@ -113267,7 +114012,7 @@ async function assertRetryableLockOpenError(lockPath, error, deps) {
if (code === "EPERM") {
if (await pathMayExist(lockPath, deps))
return;
- if ((deps?.platform ?? process.platform) === "win32" && await pathMayExist(dirname42(lockPath), deps))
+ if ((deps?.platform ?? process.platform) === "win32" && await pathMayExist(dirname43(lockPath), deps))
return;
}
throw error;
@@ -113287,7 +114032,7 @@ async function publishLockRecord(lockPath, record) {
} catch (error) {
markLockRecordReleased(record);
await fileHandle.close();
- await unlink3(lockPath).catch(() => {
+ await unlink4(lockPath).catch(() => {
return;
});
throw error;
@@ -113296,9 +114041,14 @@ async function publishLockRecord(lockPath, record) {
return true;
}
+// packages/team-core/src/team-state-store/lock-lease.ts
+import { randomUUID as randomUUID7 } from "crypto";
+import { open as open4, readdir as readdir18, readFile as readFile36, rename as rename9, rm as rm18 } from "fs/promises";
+import { basename as basename16, dirname as dirname44, join as join108 } from "path";
+
// packages/team-core/src/team-state-store/lock-reclaim.ts
import { createHash as createHash10 } from "crypto";
-import { unlink as unlink4 } from "fs/promises";
+import { unlink as unlink5 } from "fs/promises";
var RECLAIM_UNLINK_ATTEMPTS = 3;
var RECLAIM_UNLINK_RETRY_MS = 25;
function delay2(ms) {
@@ -113311,7 +114061,7 @@ function reclaimGuardPath(lockPath, record) {
}
async function unlinkWithRetry(path, deps) {
const wait = deps.delay ?? delay2;
- const unlinkFile = deps.unlink ?? unlink4;
+ const unlinkFile = deps.unlink ?? unlink5;
for (let attempt = 1;; attempt += 1) {
try {
await unlinkFile(path);
@@ -113329,6 +114079,19 @@ async function unlinkWithRetry(path, deps) {
}
}
async function removeLockRecordIfUnchanged(lockPath, expectedRecord, staleAfterMs, deps = {}) {
+ return withRecordGuard(lockPath, expectedRecord, staleAfterMs, deps, async () => {
+ const current = await readLockRecord(lockPath);
+ if (current === null)
+ return "absent";
+ if (current.content !== expectedRecord || !await isLockRecordStale(current, staleAfterMs))
+ return "changed";
+ const unlinked = await unlinkWithRetry(lockPath, deps);
+ if (unlinked !== "stuck")
+ forgetLockRecord(expectedRecord);
+ return unlinked === "absent" ? "absent" : unlinked;
+ });
+}
+async function withRecordGuard(lockPath, expectedRecord, staleAfterMs, deps, act) {
const guardPath = reclaimGuardPath(lockPath, expectedRecord);
const guardRecord = await buildLockRecord("lock-reclaim");
if (!await publishLockRecord(guardPath, guardRecord)) {
@@ -113339,15 +114102,7 @@ async function removeLockRecordIfUnchanged(lockPath, expectedRecord, staleAfterM
return "busy";
}
try {
- const current = await readLockRecord(lockPath);
- if (current === null)
- return "absent";
- if (current.content !== expectedRecord || !await isLockRecordStale(current, staleAfterMs))
- return "changed";
- const unlinked = await unlinkWithRetry(lockPath, deps);
- if (unlinked !== "stuck")
- forgetLockRecord(expectedRecord);
- return unlinked === "absent" ? "absent" : unlinked;
+ return await act();
} finally {
markLockRecordReleased(guardRecord);
if (await unlinkWithRetry(guardPath, deps) !== "stuck")
@@ -113355,6 +114110,97 @@ async function removeLockRecordIfUnchanged(lockPath, expectedRecord, staleAfterM
}
}
+// packages/team-core/src/team-state-store/lock-lease.ts
+class LockLeaseLostError extends Error {
+ constructor(lockPath) {
+ super(`The lock at ${lockPath} changed while it was handed over; the critical section was aborted.`);
+ this.name = "LockLeaseLostError";
+ }
+}
+var leaseTempPrefix = (lockPath) => `.${basename16(lockPath)}.`;
+var LEASE_TEMP_SUFFIX = ".lease";
+var UUID2 = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
+var escapeRegExp2 = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
+var leaseTempPattern = (lockPath) => new RegExp(`^\\.${escapeRegExp2(basename16(lockPath))}\\.${UUID2}\\.lease$`);
+async function replaceRecord(lockPath, content) {
+ const temporary = join108(dirname44(lockPath), `${leaseTempPrefix(lockPath)}${randomUUID7()}${LEASE_TEMP_SUFFIX}`);
+ try {
+ const handle = await open4(temporary, "wx", 384);
+ try {
+ await handle.writeFile(content);
+ } finally {
+ await handle.close();
+ }
+ await rename9(temporary, lockPath);
+ } catch (error) {
+ await rm18(temporary, { force: true });
+ throw error;
+ }
+}
+async function removeLeftoverTemps(lockPath) {
+ const pattern = leaseTempPattern(lockPath);
+ let entries;
+ try {
+ entries = await readdir18(dirname44(lockPath));
+ } catch (error) {
+ if (error instanceof Error && "code" in error && error.code === "ENOENT")
+ return;
+ throw error;
+ }
+ for (const entry of entries) {
+ if (pattern.test(entry))
+ await rm18(join108(dirname44(lockPath), entry), { force: true });
+ }
+}
+async function currentRecord(lockPath) {
+ try {
+ return await readFile36(lockPath, "utf8");
+ } catch (error) {
+ if (error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
+ return null;
+ throw error;
+ }
+}
+function createLockLease(lockPath, ownerRecord, ownerTag, options = {}) {
+ const staleAfterMs = options.staleAfterMs ?? Number.POSITIVE_INFINITY;
+ let handedTo = null;
+ return {
+ async handOver(pid) {
+ if (handedTo !== null)
+ throw new Error("The lock is already handed over; restore it first.");
+ if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid)
+ throw new Error(`Cannot hand the lock to pid ${pid}.`);
+ if (await currentRecord(lockPath) !== ownerRecord)
+ throw new LockLeaseLostError(lockPath);
+ await removeLeftoverTemps(lockPath);
+ const processStart = await lockProcessStartLine(pid);
+ const record = `${ownerTag} ${randomUUID7()}
+${pid}
+${Date.now()}
+${randomUUID7()}
+${processStart}
+`;
+ await replaceRecord(lockPath, record);
+ handedTo = record;
+ },
+ async restore() {
+ if (handedTo === null)
+ throw new Error("The lock is not handed over.");
+ const expected = handedTo;
+ handedTo = null;
+ const outcome = await withRecordGuard(lockPath, expected, staleAfterMs, {}, async () => {
+ if (await currentRecord(lockPath) !== expected)
+ return "lost";
+ await options.beforeRestoreRename?.();
+ await replaceRecord(lockPath, ownerRecord);
+ return "restored";
+ });
+ if (outcome !== "restored")
+ throw new LockLeaseLostError(lockPath);
+ }
+ };
+}
+
// packages/team-core/src/team-state-store/locks.ts
var LOCK_RETRY_MS = 50;
var LOCK_WAIT_TIMEOUT_MS = 15000;
@@ -113384,7 +114230,7 @@ async function withLock(lockPath, fn, opts) {
const ownerTag = opts?.ownerTag ?? "owner";
const record = await acquireLock(lockPath, ownerTag, staleAfterMs);
try {
- return await fn();
+ return await fn(createLockLease(lockPath, record, ownerTag, { staleAfterMs }));
} finally {
markLockRecordReleased(record);
const outcome = await removeLockRecordIfUnchanged(lockPath, record, staleAfterMs);
@@ -113401,20 +114247,382 @@ async function reapStaleLock(lockPath, staleAfterMs = DEFAULT_STALE_AFTER_MS, de
return await removeLockRecordIfUnchanged(lockPath, observed.content, staleAfterMs, deps);
}
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/prompt-lock.ts
+function promptLockAt(path, hooks = {}) {
+ return async () => {
+ const held = keychainProcessState().heldPromptLocks;
+ if (held.has(path))
+ return null;
+ held.add(path);
+ let granted = false;
+ try {
+ await mkdir11(dirname45(path), { recursive: true, mode: 448 });
+ await hooks.beforePublish?.();
+ for (let attempt = 0;attempt < 2; attempt++) {
+ const record = await buildLockRecord("keychain-prompt");
+ if (await publishLockRecord(path, record)) {
+ granted = true;
+ return async () => {
+ markLockRecordReleased(record);
+ try {
+ await (hooks.removeRecord ?? ((target, owned) => removeLockRecordIfUnchanged(target, owned, Number.POSITIVE_INFINITY)))(path, record);
+ } finally {
+ held.delete(path);
+ }
+ };
+ }
+ if (await reapStaleLock(path, Number.POSITIVE_INFINITY) !== "removed")
+ return null;
+ }
+ return null;
+ } finally {
+ if (!granted)
+ held.delete(path);
+ }
+ };
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/darwin-backend.ts
+var ROW_9B_DEFAULT = "reinstall-notice";
+var helperAccess = () => sharedHelperAccess(() => {
+ const { entryCandidates } = keychainProcessState();
+ return resolveHelperAccess([...entryCandidates, ...bundleCandidates(import.meta.url), ...machineCandidates(homedir31())]);
+});
+function sharedHelperAccess(resolve) {
+ const state = keychainProcessState();
+ if (state.helperAccess !== undefined)
+ return state.helperAccess;
+ const started = resolve();
+ state.helperAccess = started;
+ started.then((access) => {
+ if (access.kind === "unavailable" && state.helperAccess === started)
+ state.helperAccess = undefined;
+ }, () => {
+ if (state.helperAccess === started)
+ state.helperAccess = undefined;
+ });
+ return started;
+}
+
+class HelperMissingForOwnedItem extends Error {
+}
+function asKeystoreError(error, pending) {
+ if (!(error instanceof HelperReadError))
+ return error;
+ if (error.failure === "pending")
+ return pending(error.message);
+ if (error.failure === "locked")
+ return Object.assign(new Error(error.message), { code: "-25308" });
+ return error;
+}
+function createDarwinBackend(options) {
+ const silently = options.silently ?? silentSecrets;
+ const key = { service: options.service, name: options.account };
+ const deps = {
+ account: options.account,
+ access: options.access,
+ cache: options.cache ?? processApprovalCache(),
+ background: options.background,
+ takePromptLock: promptLockAt(join109(options.home ?? homedir31(), ".omo", "session-locks", `${options.account}.keychain-prompt`)),
+ ownSilentGet: () => silently(() => options.secrets.get(key)),
+ ownOverwrite: (value) => silently(() => options.secrets.set({ ...key, value })),
+ ownDelete: (name) => name === options.account ? gatedSecrets(() => options.secrets.delete({ ...key, name })) : silently(() => options.secrets.delete({ ...key, name })),
+ notice: options.notice,
+ ...options.row8b === undefined ? {} : { row8b: options.row8b },
+ ...options.handOff === undefined ? {} : { handOff: options.handOff },
+ noDialog: options.noDialog === true
+ };
+ let unowned = false;
+ return {
+ read: async () => {
+ const result = await readThroughHelper(deps, true);
+ unowned = result.kind === "value" && result.source !== "owned";
+ return result.kind === "value" ? result.value : null;
+ },
+ underLock: (lease) => lockedDarwinStore(deps, lease),
+ migrationPending: () => unowned
+ };
+}
+async function guardHelperlessRead(service, account, choice = ROW_9B_DEFAULT, probe = probeOwnerMarker) {
+ if (choice === "dialog")
+ return;
+ if (await probe(service, account) === "helper-owned")
+ throw new HelperMissingForOwnedItem("OmO's keychain helper is missing or damaged on this Mac. Reinstall omo, then try again.");
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/store-binding.ts
+import { homedir as homedir32 } from "os";
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/creator-handoff.ts
+init_bun_file_shim();
+init_bun_spawn_shim();
+import { dirname as dirname47, posix as posix14 } from "path";
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/runtime-capabilities.ts
+init_zod();
+import { readFile as readFile37 } from "fs/promises";
+import { dirname as dirname46, join as join110 } from "path";
+var RUNTIME_CAPABILITIES_FILE = "omo-runtime-capabilities.json";
+var RUNTIME_CAPABILITIES = { keychainHandoff: 1 };
+var capabilitiesSchema = object({ keychainHandoff: number2().int() }).passthrough();
+async function runtimeDeclaresKeychainHandoff(runtime) {
+ const text = await readFile37(join110(dirname46(runtime), RUNTIME_CAPABILITIES_FILE), "utf8").catch(() => null);
+ if (text === null)
+ return false;
+ try {
+ const parsed = capabilitiesSchema.safeParse(JSON.parse(text));
+ return parsed.success && parsed.data.keychainHandoff >= RUNTIME_CAPABILITIES.keychainHandoff;
+ } catch {
+ return false;
+ }
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/creator-handoff.ts
+var DEVELOPER_ID_TEAM = 'anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] and certificate leaf[field.1.2.840.113635.100.6.1.13] and certificate leaf[subject.OU] = "523JNR86LZ"';
+var DESKTOP_RUNTIME_REQUIREMENT = `identifier "com.mengmota.omo-desktop-runtime" and ${DEVELOPER_ID_TEAM}`;
+var DESKTOP_APP_REQUIREMENT = DEVELOPER_ID_TEAM;
+var HANDOFF_ENV = "OMO_KEYCHAIN_HANDOFF";
+var HANDOFF_DEADLINE_MS = 45000;
+function desktopRuntimeCandidates(home, arch = process.arch) {
+ const runtimeArch = arch === "arm64" ? "arm64" : "x64";
+ return ["/Applications/OmO.app", posix14.join(home, "Applications", "OmO.app")].map((app) => ({
+ app,
+ runtime: posix14.join(app, "Contents", "Resources", "omo-runtime", `darwin-${runtimeArch}`, "omo")
+ }));
+}
+var verifyBundle = async (app, requirement) => {
+ const child = spawn(["/usr/bin/codesign", "--verify", "--deep", "--strict", `-R=${requirement}`, app], {
+ stdin: "ignore",
+ stdout: "ignore",
+ stderr: "ignore"
+ });
+ return await child.exited === 0;
+};
+var runBounded = async (path, args, env, deadlineMs) => {
+ const child = spawn([path, ...args], { cwd: dirname47(path), stdin: "ignore", stdout: "ignore", stderr: "ignore", env });
+ let killed = false;
+ const timer = setTimeout(() => {
+ killed = true;
+ child.kill("SIGKILL");
+ }, deadlineMs);
+ try {
+ const code = await child.exited;
+ return killed ? null : code;
+ } finally {
+ clearTimeout(timer);
+ }
+};
+function createCreatorHandOff(options) {
+ return async () => {
+ const env = options.env ?? process.env;
+ if (env[HANDOFF_ENV] === "1")
+ return false;
+ const checkRuntime = options.checkRuntime ?? verifyWithSecurityFramework;
+ const checkBundle = options.checkBundle ?? verifyBundle;
+ const declaresHandOff = options.declaresHandOff ?? runtimeDeclaresKeychainHandoff;
+ const self = options.selfPath ?? process.execPath;
+ for (const { app, runtime } of options.candidates) {
+ if (runtime === self || !await bunFile(runtime).exists())
+ continue;
+ const verified = await Promise.resolve().then(async () => await checkBundle(app, DESKTOP_APP_REQUIREMENT) && await checkRuntime(runtime, DESKTOP_RUNTIME_REQUIREMENT) && await declaresHandOff(runtime)).catch(() => false);
+ if (!verified)
+ continue;
+ const childEnv = { [HANDOFF_ENV]: "1" };
+ if (env.HOME !== undefined)
+ childEnv.HOME = env.HOME;
+ const origin = options.origin ?? env.OMO_SERVICE_API_URL;
+ if (origin !== undefined)
+ childEnv.OMO_SERVICE_API_URL = origin;
+ try {
+ return await (options.run ?? runBounded)(runtime, ["account", "token"], childEnv, HANDOFF_DEADLINE_MS) === 0;
+ } catch {
+ return false;
+ }
+ }
+ return false;
+ };
+}
+
+// packages/omo-opencode/src/cli/service-auth/keychain-helper/store-binding.ts
+var readers = new Map;
+var INJECTED_SECRETS = Symbol.for("omo.test.injectedSecrets");
+var isInjectedSecrets = (api) => api[INJECTED_SECRETS] === true;
+var backends = new Map;
+function processHandOff(origin) {
+ return () => {
+ const state = keychainProcessState();
+ state.handOff ??= createCreatorHandOff({ candidates: desktopRuntimeCandidates(homedir32()), origin })();
+ return state.handOff;
+ };
+}
+function bindKeychainHelper(input) {
+ const { secrets: real, key, options } = input;
+ const eligible = input.platform === "darwin" && input.namespace === "omo-cli" && (options !== undefined || typeof Bun !== "undefined" && real === Bun.secrets && !isInjectedSecrets(real));
+ const secrets = !eligible ? real : {
+ get: (entry) => gatedSecrets(() => real.get(entry)),
+ set: (entry) => gatedSecrets(() => real.set(entry)),
+ delete: (entry) => gatedSecrets(() => real.delete(entry))
+ };
+ const cacheKey = `${key.service}
+${key.name}
+${input.background ? "bounded" : "interactive"}`;
+ let own;
+ const backend = () => {
+ if (!eligible)
+ return Promise.resolve(null);
+ const known = options === undefined ? backends.get(cacheKey) : own;
+ if (known !== undefined)
+ return known;
+ const created = (options?.access ?? helperAccess)().then((access) => access.kind !== "ready" ? null : createDarwinBackend({
+ access,
+ secrets: real,
+ service: key.service,
+ account: key.name,
+ background: input.background,
+ noDialog: options?.noDialog ?? process.env[HANDOFF_ENV] === "1",
+ notice: input.notice,
+ ...options?.home === undefined ? {} : { home: options.home },
+ ...options?.row8b === undefined ? {} : { row8b: options.row8b },
+ ...options?.silently === undefined ? {} : { silently: options.silently },
+ ...options?.cache === undefined ? {} : { cache: options.cache },
+ handOff: options === undefined ? processHandOff(input.origin) : options.handOff ?? (async () => false)
+ }));
+ if (options === undefined) {
+ backends.set(cacheKey, created);
+ created.then((found) => {
+ if (found === null && backends.get(cacheKey) === created)
+ backends.delete(cacheKey);
+ });
+ } else
+ own = created;
+ return created;
+ };
+ const reader = (helper) => {
+ const known = readers.get(helper);
+ if (known !== undefined)
+ return known;
+ const refuse = async () => {
+ throw new Error("OmO's keychain helper changes the sign-in only under the session lock.");
+ };
+ const created = {
+ get: async () => {
+ try {
+ return await helper.read();
+ } catch (error) {
+ throw asKeystoreError(error, (message) => input.pending(`${message} Credentials are never saved to a file.`));
+ }
+ },
+ set: refuse,
+ delete: refuse
+ };
+ readers.set(helper, created);
+ return created;
+ };
+ return {
+ secrets,
+ eligible,
+ backend,
+ reader,
+ isHelperReader: (api) => [...readers.values()].includes(api),
+ guardHelperless: async () => {
+ if (!eligible)
+ return;
+ if ((options?.noDialog ?? process.env[HANDOFF_ENV] === "1") === true)
+ throw input.pending("The keychain hand-off cannot show a dialog.");
+ await guardHelperlessRead(key.service, key.name, options?.row9b, options?.ownerMarker);
+ }
+ };
+}
+function lockedStoreView(helper, lease, codec, mapError, done) {
+ const locked = helper.underLock(lease);
+ const run = async (step) => {
+ try {
+ return await step();
+ } catch (error) {
+ throw mapError(error);
+ } finally {
+ done();
+ }
+ };
+ return {
+ read: () => run(async () => {
+ const text = await locked.read();
+ return text === null ? null : codec.parse(text);
+ }),
+ write: (value, intent = "update", beforeRetire) => run(async () => {
+ const next = codec.amend === undefined ? value : codec.amend(await locked.read(), value);
+ await locked.write(codec.serialize(next), intent, beforeRetire);
+ }),
+ clear: () => run(() => locked.clear()),
+ recover: () => run(() => locked.recover()),
+ settle: () => run(() => locked.settle())
+ };
+}
+
+// packages/omo-opencode/src/cli/service-auth/secret-service-lock.ts
+import { spawn as spawn5 } from "child_process";
+var DEFAULT_COLLECTION = "/org/freedesktop/secrets/aliases/default";
+var PROBE_TIMEOUT_MS2 = 1e4;
+var parseLockedReply = (stdout) => {
+ const match = /<\s*(true|false)\s*>/.exec(stdout);
+ if (match === null)
+ return null;
+ return match[1] === "true" ? "locked" : "unlocked";
+};
+var probeSecretServiceLock = () => new Promise((resolve) => {
+ const child = spawn5("gdbus", [
+ "call",
+ "--session",
+ "--dest",
+ "org.freedesktop.secrets",
+ "--object-path",
+ DEFAULT_COLLECTION,
+ "--method",
+ "org.freedesktop.DBus.Properties.Get",
+ "org.freedesktop.Secret.Collection",
+ "Locked"
+ ], { stdio: ["ignore", "pipe", "ignore"] });
+ let stdout = "";
+ const timer = setTimeout(() => {
+ child.kill();
+ resolve("unknown");
+ }, PROBE_TIMEOUT_MS2);
+ child.stdout.on("data", (chunk) => {
+ stdout += chunk.toString();
+ });
+ child.on("error", () => {
+ clearTimeout(timer);
+ resolve("unknown");
+ });
+ child.on("close", (code) => {
+ clearTimeout(timer);
+ resolve(code === 0 ? parseLockedReply(stdout) ?? "absent" : "absent");
+ });
+});
+
// packages/omo-opencode/src/cli/service-auth/credential-lock.ts
+import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
+import { createHash as createHash11 } from "crypto";
+import { mkdir as mkdir12 } from "fs/promises";
+import { homedir as homedir33 } from "os";
+import { join as join112 } from "path";
var held = new AsyncLocalStorage3;
-function credentialLockPaths(api, home = homedir31()) {
+function credentialLockPaths(api, home = homedir33()) {
const id = createHash11("sha256").update(serviceOrigin(api)).digest("hex");
- const directory = join106(home, ".omo", "session-locks");
- return { directory, lock: join106(directory, `${id}.lock`), desktopRecord: join106(directory, `${id}.desktop-generation.json`) };
+ const directory = join112(home, ".omo", "session-locks");
+ return { directory, lock: join112(directory, `${id}.lock`), desktopRecord: join112(directory, `${id}.desktop-generation.json`) };
+}
+function heldCredentialLease(api, home = homedir33()) {
+ return held.getStore()?.get(credentialLockPaths(api, home).lock);
}
-async function withCredentialLock(api, action, home = homedir31(), ownerTag = "cli-session") {
+async function withCredentialLock(api, action, home = homedir33(), ownerTag = "cli-session") {
const { directory, lock } = credentialLockPaths(api, home);
const owned = held.getStore();
- if (owned?.has(lock))
- return action();
- await mkdir11(directory, { recursive: true, mode: 448 });
- return withLock(lock, () => held.run(new Set([...owned ?? [], lock]), action), {
+ const outer = owned?.get(lock);
+ if (outer !== undefined)
+ return action(outer);
+ await mkdir12(directory, { recursive: true, mode: 448 });
+ return withLock(lock, (lease) => held.run(new Map([...owned ?? [], [lock, lease]]), () => action(lease)), {
ownerTag,
staleAfterMs: Number.POSITIVE_INFINITY
});
@@ -113466,17 +114674,51 @@ function createCredentialStore(api, options = {}) {
return {
...value,
...accountId === undefined ? {} : { accountId },
- credentialGeneration: sameIdentity ? current?.credentialGeneration ?? randomUUID7() : randomUUID7()
+ credentialGeneration: sameIdentity ? current?.credentialGeneration ?? randomUUID8() : randomUUID8()
};
- });
+ }, options.keychainHelper);
+ const sections = new WeakMap;
+ const underLock = (lease) => {
+ const known = sections.get(lease);
+ if (known !== undefined)
+ return known;
+ const view = (async () => {
+ const opened = await store.underLock?.(lease) ?? null;
+ await opened?.recover();
+ return opened;
+ })();
+ sections.set(lease, view);
+ return view;
+ };
+ const held = async () => {
+ const lease = heldCredentialLease(api, options.home);
+ return lease === undefined ? null : underLock(lease);
+ };
+ const locked = async (helper, plain) => {
+ if (heldCredentialLease(api, options.home) === undefined)
+ await store.prepare?.();
+ await withCredentialLock(api, async (lease) => {
+ const view = await underLock(lease);
+ await (view === null ? plain() : helper(view));
+ }, options.home);
+ };
return {
- read: store.read,
- readAuthoritative: store.readAuthoritative,
- write: (value) => withCredentialLock(api, () => store.write(value), options.home),
- clear: () => withCredentialLock(api, store.clear, options.home)
+ read: async () => {
+ const view = await held();
+ return view === null ? store.read() : view.read();
+ },
+ readAuthoritative: async () => {
+ const view = await held();
+ return view === null ? store.readAuthoritative() : view.read();
+ },
+ write: (value, intent, beforeRetire) => locked((view) => view.write(value, intent, beforeRetire), () => store.write(value)),
+ clear: () => locked((view) => view.clear(), store.clear),
+ ...store.prepare === undefined ? {} : { prepare: store.prepare },
+ underLock,
+ ...store.migrationPending === undefined ? {} : { migrationPending: store.migrationPending }
};
}
-function createSealedStore(api, namespace, schema, secrets = typeof Bun === "undefined" ? null : Bun.secrets, platform = process.platform, lockProbe = probeSecretServiceLock, notice = stderrNoticeOncePerProcess, wait = SESSION_READ_WAIT, amendWrite) {
+function createSealedStore(api, namespace, schema, secrets = typeof Bun === "undefined" ? null : Bun.secrets, platform = process.platform, lockProbe = probeSecretServiceLock, notice = stderrNoticeOncePerProcess, wait = SESSION_READ_WAIT, amendWrite, keychainHelper) {
if (!secrets)
throw new SignInError("OmO sign-in needs Bun 1.4 or newer with OS credential storage. No file fallback is available.");
const platformName = platform === "darwin" ? "macOS Keychain" : platform === "linux" ? "Linux Secret Service (libsecret and an unlocked keyring)" : platform === "win32" ? "Windows Credential Manager" : null;
@@ -113485,6 +114727,18 @@ function createSealedStore(api, namespace, schema, secrets = typeof Bun === "und
const key = { service: namespace, name: credentialId(api) };
const slot = `${key.service}
${key.name}`;
+ const helper = bindKeychainHelper({
+ platform,
+ namespace,
+ secrets,
+ key,
+ background: wait.kind === "bounded",
+ origin: api,
+ notice,
+ pending: (message) => new KeychainApprovalPendingError(message),
+ ...keychainHelper === undefined ? {} : { options: keychainHelper }
+ });
+ secrets = helper.secrets;
const readsOf = (api) => {
const known = processReads.get(api);
if (known !== undefined)
@@ -113510,17 +114764,19 @@ ${key.name}`;
reads.set(slot, read);
return read;
};
- const waiting = platform === "darwin" ? `macOS Keychain is waiting for your approval: answer the "${basename15(process.execPath)} wants to access key ${namespace}" dialog ("Always Allow" stops it asking again)` : `${platformName} has not answered; it may be waiting for your approval or an unlock in a system dialog`;
+ const waiting = platform === "darwin" ? `macOS Keychain is waiting for your approval: answer the "${basename17(process.execPath)} wants to access key ${namespace}" dialog ("Always Allow" stops it asking again)` : `${platformName} has not answered; it may be waiting for your approval or an unlock in a system dialog`;
+ const helperWaiting = `macOS Keychain is waiting for your approval: answer the "OmO's keychain helper wants to access key ${namespace}" dialog`;
const answered = async (api, fresh = false) => {
+ const waitingFor = helper.isHelperReader(api) ? helperWaiting : waiting;
const read = fresh ? Promise.resolve().then(() => api.get(key)) : sharedRead(api);
let timer;
try {
if (wait.kind === "interactive") {
- timer = setTimeout(() => wait.notice(`omo: ${waiting}.`), wait.noticeAfterMs);
+ timer = setTimeout(() => wait.notice(`omo: ${waitingFor}.`), wait.noticeAfterMs);
return await read;
}
const expired = new Promise((_, reject) => {
- timer = setTimeout(() => reject(new KeychainApprovalPendingError(`${waiting}, then try again. Credentials are never saved to a file.`)), wait.deadlineMs);
+ timer = setTimeout(() => reject(new KeychainApprovalPendingError(`${waitingFor}, then try again. Credentials are never saved to a file.`)), wait.deadlineMs);
});
return await Promise.race([read, expired]);
} finally {
@@ -113545,41 +114801,76 @@ ${key.name}`;
notice("omo: could not check whether the keyring is locked (gdbus or the Secret Service did not answer); using libsecret directly.");
}
};
- const parsedRead = async (fresh) => {
+ const parseStored = (value) => {
+ try {
+ return schema.parse(JSON.parse(value));
+ } catch {
+ throw new InvalidCredentialState(signInRoute() === "cli" ? "Stored sign-in data is invalid. Run omo account forget, then omo login." : "The OmO sign-in saved on this computer can't be read. Run omo account forget to remove it, then sign in again in the desktop app.");
+ }
+ };
+ const previousOf = (raw) => {
+ if (raw === null)
+ return null;
+ try {
+ return schema.parse(JSON.parse(raw));
+ } catch {
+ return null;
+ }
+ };
+ const rawRead = async (fresh) => {
await assertUsable();
- let value;
+ const backend = await helper.backend();
try {
- value = await answered(secrets, fresh);
+ if (backend === null)
+ await helper.guardHelperless();
+ return await answered(backend === null ? secrets : helper.reader(backend), fresh);
} catch (error) {
if (error instanceof KeychainApprovalPendingError)
throw error;
+ if (error instanceof HelperMissingForOwnedItem)
+ throw new CredentialStoreError(error.message);
throw unavailable(error);
}
- if (value === null)
- return null;
- try {
- return schema.parse(JSON.parse(value));
- } catch {
- throw new InvalidCredentialState(signInRoute() === "cli" ? "Stored sign-in data is invalid. Run omo account forget, then omo login." : "The OmO sign-in saved on this computer can't be read. Run omo account forget to remove it, then sign in again in the desktop app.");
- }
+ };
+ const parsedRead = async (fresh) => {
+ const value = await rawRead(fresh);
+ return value === null ? null : parseStored(value);
+ };
+ const lockedFailure = (error) => {
+ const mapped = asKeystoreError(error, (message) => new KeychainApprovalPendingError(message));
+ if (error instanceof HelperOldSlotsFull)
+ return new CredentialStoreError(error.message);
+ if (mapped instanceof KeychainApprovalPendingError || mapped instanceof SignInError)
+ return mapped;
+ if (mapped instanceof Error && mapped.name === "LockLeaseLostError")
+ return mapped;
+ return unavailable(mapped);
};
return {
read: () => parsedRead(false),
readAuthoritative: () => parsedRead(true),
+ async prepare() {
+ if (await helper.backend() !== null)
+ await rawRead(false);
+ },
+ async underLock(lease) {
+ const backend = await helper.backend();
+ if (backend === null)
+ return null;
+ const codec = {
+ parse: parseStored,
+ serialize: (value) => JSON.stringify(schema.parse(value)),
+ ...amendWrite === undefined ? {} : { amend: (raw, next) => amendWrite(previousOf(raw), next) }
+ };
+ return lockedStoreView(backend, lease, codec, lockedFailure, () => forget(helper.reader(backend)));
+ },
+ migrationPending: async () => (await helper.backend())?.migrationPending() ?? false,
async write(value) {
await assertUsable();
+ if (await helper.backend() !== null)
+ throw new Error("OmO's keychain helper writes only under the session lock.");
try {
- let next = value;
- if (amendWrite !== undefined) {
- const raw = await answered(secrets, true);
- let previous = null;
- if (raw !== null) {
- try {
- previous = schema.parse(JSON.parse(raw));
- } catch {}
- }
- next = amendWrite(previous, value);
- }
+ const next = amendWrite === undefined ? value : amendWrite(previousOf(await answered(secrets, true)), value);
await secrets.set({ ...key, value: JSON.stringify(schema.parse(next)) });
} catch (error) {
throw unavailable(error);
@@ -113588,6 +114879,8 @@ ${key.name}`;
},
async clear() {
await assertUsable();
+ if (await helper.backend() !== null)
+ throw new Error("OmO's keychain helper deletes only under the session lock.");
try {
await secrets.delete(key);
} catch (error) {
@@ -113699,14 +114992,14 @@ async function loginLoopback(session, options) {
// packages/memory-core/src/sync/device-retire.ts
import { createHash as createHash14, randomBytes as randomBytes6 } from "crypto";
-import { join as join109 } from "path";
+import { join as join115 } from "path";
// packages/memory-core/src/identity/layout.ts
-import { homedir as homedir32 } from "os";
-import { join as join107, resolve as resolve31 } from "path";
+import { homedir as homedir34 } from "os";
+import { join as join113, resolve as resolve31 } from "path";
var MEMORY_ROOT_ENV_VAR = "OMO_MEMORY_HOME";
function defaultMemoryRoot() {
- return join107(homedir32(), ".omo", "memory");
+ return join113(homedir34(), ".omo", "memory");
}
function resolveMemoryRoot(env, cwd) {
const override = env[MEMORY_ROOT_ENV_VAR];
@@ -113716,13 +115009,13 @@ function resolveMemoryRoot(env, cwd) {
return resolve31(cwd, override);
}
// packages/memory-core/src/sync/pin-dir.ts
-import { join as join108 } from "path";
-var syncPinDir = (memoryRoot) => join108(memoryRoot, "sync-device");
+import { join as join114 } from "path";
+var syncPinDir = (memoryRoot) => join114(memoryRoot, "sync-device");
// packages/memory-core/src/sync/device-retire.ts
-var trustAnchorRoot = (pinDir) => join109(pinDir, "trust-anchor");
+var trustAnchorRoot = (pinDir) => join115(pinDir, "trust-anchor");
var trustAnchorKey = (account) => createHash14("sha256").update(account, "utf8").digest("base64url");
-var trustAnchorDir = (pinDir, account) => join109(trustAnchorRoot(pinDir), trustAnchorKey(account));
+var trustAnchorDir = (pinDir, account) => join115(trustAnchorRoot(pinDir), trustAnchorKey(account));
var hasLiveTrustAnchor = async (pinDir) => {
try {
return (await readdir17(trustAnchorRoot(pinDir))).some((name) => !name.includes(".retired-"));
@@ -113743,16 +115036,16 @@ var retireSyncDevice = async (input) => {
};
// packages/omo-opencode/src/cli/service-auth/session.ts
-import { homedir as homedir33 } from "os";
+import { homedir as homedir35 } from "os";
// packages/omo-opencode/src/cli/service-auth/signed-out-marker.ts
init_zod();
-import { mkdir as mkdir12, readFile as readFile35, rename as rename9, rm as rm17, writeFile as writeFile17 } from "fs/promises";
-import { dirname as dirname43, join as join110 } from "path";
+import { mkdir as mkdir13, readFile as readFile38, rename as rename10, rm as rm19, writeFile as writeFile18 } from "fs/promises";
+import { dirname as dirname48, join as join116 } from "path";
var markerSchema = object({ device: string2().nullable(), at: string2() });
-var signedOutMarkerPath = (home, credential) => join110(home, ".omo", "account-state", `${credential}.signed-out.json`);
+var signedOutMarkerPath = (home, credential) => join116(home, ".omo", "account-state", `${credential}.signed-out.json`);
async function readSignedOutMarker(path) {
- const text = await readFile35(path, "utf8").catch(() => null);
+ const text = await readFile38(path, "utf8").catch(() => null);
if (text === null)
return null;
let value;
@@ -113765,12 +115058,12 @@ async function readSignedOutMarker(path) {
return parsed.success ? parsed.data : null;
}
async function writeSignedOutMarker(path, device) {
- await mkdir12(dirname43(path), { recursive: true, mode: 448 });
+ await mkdir13(dirname48(path), { recursive: true, mode: 448 });
const staging = `${path}.${process.pid}.tmp`;
- await writeFile17(staging, JSON.stringify({ device, at: new Date().toISOString() }), { mode: 384 });
- await rename9(staging, path);
+ await writeFile18(staging, JSON.stringify({ device, at: new Date().toISOString() }), { mode: 384 });
+ await rename10(staging, path);
}
-var clearSignedOutMarker = (path) => rm17(path, { force: true });
+var clearSignedOutMarker = (path) => rm19(path, { force: true });
// packages/omo-opencode/src/cli/service-auth/session.ts
class SessionEnded extends SignInError {
@@ -113794,12 +115087,14 @@ function createSession(options) {
const api = serviceOrigin(options.api);
const now = options.now ?? Date.now;
const { store, signal, beforeKeysDiscarded } = options;
- const markerPath = signedOutMarkerPath(options.home ?? homedir33(), credentialId(api));
+ const markerPath = signedOutMarkerPath(options.home ?? homedir35(), credentialId(api));
async function locked(action) {
signal?.throwIfAborted();
- return withCredentialLock(api, async () => {
+ if (heldCredentialLease(api, options.home) === undefined)
+ await store.prepare?.();
+ return withCredentialLock(api, async (lease) => {
signal?.throwIfAborted();
- return action();
+ return action(await store.underLock?.(lease) ?? null);
}, options.home);
}
const request = (path, init) => requestApi(api, path, init, signal);
@@ -113836,9 +115131,12 @@ function createSession(options) {
}
}
async function snapshot() {
- return locked(async () => {
+ return locked(async (view) => {
const current = await store.read();
- return current === null ? null : refreshed(current);
+ if (current === null)
+ return null;
+ await view?.settle();
+ return refreshed(current);
});
}
return {
@@ -113861,7 +115159,7 @@ function createSession(options) {
}
if (stored !== null && stored.device.id !== value.device.id)
await beforeKeysDiscarded(discardedOf(stored, "replaced"));
- await store.write(value);
+ await store.write(value, "fresh-sign-in", () => beforeKeysDiscarded({ kind: "unreadable" }));
await clearSignedOutMarker(markerPath);
});
},
@@ -113922,14 +115220,15 @@ function createSession(options) {
signal?.throwIfAborted();
const snapshot = await store.read();
signal?.throwIfAborted();
- if (snapshot !== null && snapshot.refreshState !== "uncertain" && snapshot.refreshAttempt === undefined && Date.parse(snapshot.accessTokenExpiresAt) > now() + 30000 && (expect === undefined || expect(snapshot)))
+ if (snapshot !== null && snapshot.refreshState !== "uncertain" && snapshot.refreshAttempt === undefined && Date.parse(snapshot.accessTokenExpiresAt) > now() + 30000 && (expect === undefined || expect(snapshot)) && !await store.migrationPending?.())
return snapshot.accessToken;
- return locked(async () => {
+ return locked(async (view) => {
const current = await store.readAuthoritative();
if (current === null)
throw new SignInError(`Not signed in. ${signInHint("first")}`);
if (expect !== undefined && !expect(current))
throw new CredentialIdentityChanged;
+ await view?.settle();
return (await refreshed(current)).accessToken;
});
},
@@ -114077,6 +115376,10 @@ function refuseClosedServiceAuth() {
}
function configureClosedServiceAuthCommands(program) {
for (const name of SERVICE_AUTH_COMMANDS) {
+ if (name === "login") {
+ configureClosedDeviceLogin(program);
+ continue;
+ }
const command = program.command(name, { hidden: true }).helpOption(false).allowUnknownOption().allowExcessArguments().action(() => {
console.error(SERVICE_ACCOUNTS_CLOSED_MESSAGE);
process.exitCode = 1;
@@ -114084,6 +115387,17 @@ function configureClosedServiceAuthCommands(program) {
command.help = refuseClosedServiceAuth;
}
}
+function configureClosedDeviceLogin(program) {
+ const command = program.command("login", { hidden: true }).helpOption(false).allowUnknownOption().allowExcessArguments().option("--device").option("--no-browser").option("--api <url>").action((options) => {
+ if (options.device !== true && options.browser !== false || command.args.length > 0) {
+ console.error(SERVICE_ACCOUNTS_CLOSED_MESSAGE);
+ process.exitCode = 1;
+ return;
+ }
+ return run2("login", { ...options, device: true });
+ });
+ command.help = refuseClosedServiceAuth;
+}
function configureServiceAuthCommands(program, open = serviceAccountsOpen()) {
if (!open) {
configureClosedServiceAuthCommands(program);
@@ -114285,11 +115599,11 @@ async function boulder(options) {
// packages/omo-opencode/src/cli/codex-ulw-loop.ts
import { spawn as spawn6 } from "child_process";
import { existsSync as existsSync67, readFileSync as readFileSync45, realpathSync as realpathSync14 } from "fs";
-import { homedir as homedir34 } from "os";
+import { homedir as homedir36 } from "os";
var ULW_LOOP_DELEGATION_SENTINEL = "OMO_ULW_LOOP_DELEGATED";
function resolveCodexUlwLoopCommand(input = {}) {
const env = input.env ?? process.env;
- const homeDir = input.homeDir ?? homedir34();
+ const homeDir = input.homeDir ?? homedir36();
const localComponentBin = resolveLocalUlwLoopBin(env, homeDir);
if (localComponentBin !== null)
return { executable: localComponentBin, argsPrefix: [] };
@@ -114532,7 +115846,7 @@ function linkedWorktrees(records) {
}
// packages/omo-opencode/src/cli/worktree-sweep/sweep.ts
import { existsSync as existsSync68 } from "fs";
-import { stat as stat10 } from "fs/promises";
+import { stat as stat12 } from "fs/promises";
import os7 from "os";
import { normalize as normalize2 } from "path";
@@ -114615,7 +115929,7 @@ async function isOlderThan(worktreePath, days, now) {
if (days <= 0)
return false;
try {
- const stats = await stat10(worktreePath);
+ const stats = await stat12(worktreePath);
return now - stats.mtimeMs > days * DAY_MS;
} catch {
return false;
@@ -114780,7 +116094,7 @@ prunes.
// packages/omo-opencode/src/cli/config-migrate.ts
init_startup_migration();
-import { posix as posix13 } from "path";
+import { posix as posix15 } from "path";
function reports(result) {
return result.results.map((entry) => ({
diagnostics: entry.diagnostics,
@@ -114814,7 +116128,7 @@ function runConfigMigrate(options = {}) {
dryRun: options.dryRun ?? false,
environment,
...homeDir === undefined ? {} : { env: { HOME: homeDir }, homeDir },
- pathOperations: posix13
+ pathOperations: posix15
});
const report = reports(result);
const response = {
diff --git a/plugins/omo/hooks/post-compact-resetting-git-bash-mcp-reminder.json b/plugins/omo/hooks/post-compact-resetting-git-bash-mcp-reminder.json
index e9a167fc..c706b667 100644
--- a/plugins/omo/hooks/post-compact-resetting-git-bash-mcp-reminder.json
+++ b/plugins/omo/hooks/post-compact-resetting-git-bash-mcp-reminder.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/git-bash/dist/cli.js\" hook post-compact",
"timeout": 5,
- "statusMessage": "(OmO 5.1.62) Resetting Git Bash MCP Reminder",
+ "statusMessage": "(OmO 5.1.63) Resetting Git Bash MCP Reminder",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\git-bash\\dist\\cli.js\" hook post-compact"
}
],
diff --git a/plugins/omo/hooks/post-compact-resetting-lsp-diagnostics-cache.json b/plugins/omo/hooks/post-compact-resetting-lsp-diagnostics-cache.json
index 12738aeb..cdf46c54 100644
--- a/plugins/omo/hooks/post-compact-resetting-lsp-diagnostics-cache.json
+++ b/plugins/omo/hooks/post-compact-resetting-lsp-diagnostics-cache.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/lsp/dist/cli.js\" hook post-compact",
"timeout": 5,
- "statusMessage": "(OmO 5.1.62) Resetting LSP Diagnostics Cache",
+ "statusMessage": "(OmO 5.1.63) Resetting LSP Diagnostics Cache",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\lsp\\dist\\cli.js\" hook post-compact"
}
],
diff --git a/plugins/omo/hooks/post-compact-resetting-project-rule-cache.json b/plugins/omo/hooks/post-compact-resetting-project-rule-cache.json
index b6e26dd0..9a4290a2 100644
--- a/plugins/omo/hooks/post-compact-resetting-project-rule-cache.json
+++ b/plugins/omo/hooks/post-compact-resetting-project-rule-cache.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/rules/dist/cli.js\" hook post-compact",
"timeout": 10,
- "statusMessage": "(OmO 5.1.62) Resetting Project Rule Cache",
+ "statusMessage": "(OmO 5.1.63) Resetting Project Rule Cache",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\rules\\dist\\cli.js\" hook post-compact"
}
],
diff --git a/plugins/omo/hooks/post-tool-use-checking-comments.json b/plugins/omo/hooks/post-tool-use-checking-comments.json
index afaf4883..196348c5 100644
--- a/plugins/omo/hooks/post-tool-use-checking-comments.json
+++ b/plugins/omo/hooks/post-tool-use-checking-comments.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/comment-checker/dist/cli.js\" hook post-tool-use",
"timeout": 30,
- "statusMessage": "(OmO 5.1.62) Checking Comments",
+ "statusMessage": "(OmO 5.1.63) Checking Comments",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\comment-checker\\dist\\cli.js\" hook post-tool-use"
}
],
diff --git a/plugins/omo/hooks/post-tool-use-checking-lsp-diagnostics.json b/plugins/omo/hooks/post-tool-use-checking-lsp-diagnostics.json
index 5e42767f..1cf1ea21 100644
--- a/plugins/omo/hooks/post-tool-use-checking-lsp-diagnostics.json
+++ b/plugins/omo/hooks/post-tool-use-checking-lsp-diagnostics.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/lsp/dist/cli.js\" hook post-tool-use",
"timeout": 60,
- "statusMessage": "(OmO 5.1.62) Checking LSP Diagnostics",
+ "statusMessage": "(OmO 5.1.63) Checking LSP Diagnostics",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\lsp\\dist\\cli.js\" hook post-tool-use"
}
],
diff --git a/plugins/omo/hooks/post-tool-use-checking-thread-title-hygiene.json b/plugins/omo/hooks/post-tool-use-checking-thread-title-hygiene.json
index 74e1be2f..33900ed7 100644
--- a/plugins/omo/hooks/post-tool-use-checking-thread-title-hygiene.json
+++ b/plugins/omo/hooks/post-tool-use-checking-thread-title-hygiene.json
@@ -8,7 +8,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/teammode/dist/cli.js\" hook post-tool-use",
"timeout": 10,
- "statusMessage": "(OmO 5.1.62) Checking Thread Title Hygiene",
+ "statusMessage": "(OmO 5.1.63) Checking Thread Title Hygiene",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\teammode\\dist\\cli.js\" hook post-tool-use"
}
]
diff --git a/plugins/omo/hooks/post-tool-use-matching-project-rules.json b/plugins/omo/hooks/post-tool-use-matching-project-rules.json
index e6b73584..b496a6df 100644
--- a/plugins/omo/hooks/post-tool-use-matching-project-rules.json
+++ b/plugins/omo/hooks/post-tool-use-matching-project-rules.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/rules/dist/cli.js\" hook post-tool-use",
"timeout": 10,
- "statusMessage": "(OmO 5.1.62) Matching Project Rules",
+ "statusMessage": "(OmO 5.1.63) Matching Project Rules",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\rules\\dist\\cli.js\" hook post-tool-use"
}
],
diff --git a/plugins/omo/hooks/post-tool-use-recording-spawn-admission.json b/plugins/omo/hooks/post-tool-use-recording-spawn-admission.json
index e938ddaa..ba1d109f 100644
--- a/plugins/omo/hooks/post-tool-use-recording-spawn-admission.json
+++ b/plugins/omo/hooks/post-tool-use-recording-spawn-admission.json
@@ -8,7 +8,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/ulw-loop/dist/cli.js\" hook post-tool-use-spawn",
"timeout": 5,
- "statusMessage": "(OmO 5.1.62) Recording Spawn Admission",
+ "statusMessage": "(OmO 5.1.63) Recording Spawn Admission",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\ulw-loop\\dist\\cli.js\" hook post-tool-use-spawn"
}
]
diff --git a/plugins/omo/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json b/plugins/omo/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json
index ace375b1..3d370eba 100644
--- a/plugins/omo/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json
+++ b/plugins/omo/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/ulw-loop/dist/cli.js\" hook pre-tool-use",
"timeout": 5,
- "statusMessage": "(OmO 5.1.62) Enforcing Unlimited Goal Budget",
+ "statusMessage": "(OmO 5.1.63) Enforcing Unlimited Goal Budget",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\ulw-loop\\dist\\cli.js\" hook pre-tool-use"
}
],
diff --git a/plugins/omo/hooks/pre-tool-use-guarding-ulw-loop-spawns.json b/plugins/omo/hooks/pre-tool-use-guarding-ulw-loop-spawns.json
index 02b00c4b..ea3eb6ef 100644
--- a/plugins/omo/hooks/pre-tool-use-guarding-ulw-loop-spawns.json
+++ b/plugins/omo/hooks/pre-tool-use-guarding-ulw-loop-spawns.json
@@ -8,7 +8,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/ulw-loop/dist/cli.js\" hook pre-tool-use-spawn",
"timeout": 5,
- "statusMessage": "(OmO 5.1.62) Guarding Ulw-Loop Spawns",
+ "statusMessage": "(OmO 5.1.63) Guarding Ulw-Loop Spawns",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\ulw-loop\\dist\\cli.js\" hook pre-tool-use-spawn"
}
]
diff --git a/plugins/omo/hooks/pre-tool-use-recommending-git-bash-mcp.json b/plugins/omo/hooks/pre-tool-use-recommending-git-bash-mcp.json
index e091aa9d..30c7c23f 100644
--- a/plugins/omo/hooks/pre-tool-use-recommending-git-bash-mcp.json
+++ b/plugins/omo/hooks/pre-tool-use-recommending-git-bash-mcp.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/git-bash/dist/cli.js\" hook pre-tool-use",
"timeout": 5,
- "statusMessage": "(OmO 5.1.62) Recommending Git Bash MCP",
+ "statusMessage": "(OmO 5.1.63) Recommending Git Bash MCP",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\git-bash\\dist\\cli.js\" hook pre-tool-use"
}
],
diff --git a/plugins/omo/hooks/session-start-checking-auto-update.json b/plugins/omo/hooks/session-start-checking-auto-update.json
index a3c8a0c4..a7d3fde0 100644
--- a/plugins/omo/hooks/session-start-checking-auto-update.json
+++ b/plugins/omo/hooks/session-start-checking-auto-update.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/scripts/auto-update.mjs\" hook session-start",
"timeout": 15,
- "statusMessage": "(OmO 5.1.62) Checking Auto Update",
+ "statusMessage": "(OmO 5.1.63) Checking Auto Update",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\scripts\\auto-update.mjs\" hook session-start"
}
],
diff --git a/plugins/omo/hooks/session-start-checking-bootstrap-provisioning.json b/plugins/omo/hooks/session-start-checking-bootstrap-provisioning.json
index f759d755..69fa99c2 100644
--- a/plugins/omo/hooks/session-start-checking-bootstrap-provisioning.json
+++ b/plugins/omo/hooks/session-start-checking-bootstrap-provisioning.json
@@ -8,7 +8,7 @@
"command": "node \"${PLUGIN_ROOT}/components/bootstrap/dist/cli.js\" hook session-start",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\bootstrap.ps1\"",
"timeout": 30,
- "statusMessage": "(OmO 5.1.62) Checking Bootstrap Provisioning"
+ "statusMessage": "(OmO 5.1.63) Checking Bootstrap Provisioning"
}
]
}
diff --git a/plugins/omo/hooks/session-start-loading-project-rules.json b/plugins/omo/hooks/session-start-loading-project-rules.json
index e0c06000..6c52e379 100644
--- a/plugins/omo/hooks/session-start-loading-project-rules.json
+++ b/plugins/omo/hooks/session-start-loading-project-rules.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/rules/dist/cli.js\" hook session-start",
"timeout": 10,
- "statusMessage": "(OmO 5.1.62) Loading Project Rules",
+ "statusMessage": "(OmO 5.1.63) Loading Project Rules",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\rules\\dist\\cli.js\" hook session-start"
}
]
diff --git a/plugins/omo/hooks/session-start-recording-session-telemetry.json b/plugins/omo/hooks/session-start-recording-session-telemetry.json
index 67b22669..bb31ab3e 100644
--- a/plugins/omo/hooks/session-start-recording-session-telemetry.json
+++ b/plugins/omo/hooks/session-start-recording-session-telemetry.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/telemetry/dist/cli.js\" hook session-start",
"timeout": 15,
- "statusMessage": "(OmO 5.1.62) Recording Session Telemetry",
+ "statusMessage": "(OmO 5.1.63) Recording Session Telemetry",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\telemetry\\dist\\cli.js\" hook session-start"
}
]
diff --git a/plugins/omo/hooks/stop-checking-ulw-execute-continuation.json b/plugins/omo/hooks/stop-checking-ulw-execute-continuation.json
index c745ff12..d804e256 100644
--- a/plugins/omo/hooks/stop-checking-ulw-execute-continuation.json
+++ b/plugins/omo/hooks/stop-checking-ulw-execute-continuation.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/ulw-execute-continuation/dist/cli.js\" hook stop",
"timeout": 10,
- "statusMessage": "(OmO 5.1.62) Checking Ulw-Execute Continuation",
+ "statusMessage": "(OmO 5.1.63) Checking Ulw-Execute Continuation",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\ulw-execute-continuation\\dist\\cli.js\" hook stop"
}
]
diff --git a/plugins/omo/hooks/stop-checking-ulw-loop-resume.json b/plugins/omo/hooks/stop-checking-ulw-loop-resume.json
index 8403652b..4151ebed 100644
--- a/plugins/omo/hooks/stop-checking-ulw-loop-resume.json
+++ b/plugins/omo/hooks/stop-checking-ulw-loop-resume.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/ulw-loop/dist/cli.js\" hook stop",
"timeout": 10,
- "statusMessage": "(OmO 5.1.62) Checking Ulw-Loop Resume",
+ "statusMessage": "(OmO 5.1.63) Checking Ulw-Loop Resume",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\ulw-loop\\dist\\cli.js\" hook stop"
}
]
diff --git a/plugins/omo/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json b/plugins/omo/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json
index fc99e6de..061d86b8 100644
--- a/plugins/omo/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json
+++ b/plugins/omo/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/lazycodex-executor-verify/dist/cli.js\" hook subagent-stop",
"timeout": 10,
- "statusMessage": "(OmO 5.1.62) Verifying LazyCodex Executor Evidence",
+ "statusMessage": "(OmO 5.1.63) Verifying LazyCodex Executor Evidence",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\lazycodex-executor-verify\\dist\\cli.js\" hook subagent-stop"
}
],
diff --git a/plugins/omo/hooks/user-prompt-submit-checking-ultrawork-trigger.json b/plugins/omo/hooks/user-prompt-submit-checking-ultrawork-trigger.json
index e5a05b40..9a79256e 100644
--- a/plugins/omo/hooks/user-prompt-submit-checking-ultrawork-trigger.json
+++ b/plugins/omo/hooks/user-prompt-submit-checking-ultrawork-trigger.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/ultrawork/dist/cli.js\" hook user-prompt-submit",
"timeout": 5,
- "statusMessage": "(OmO 5.1.62) Checking Ultrawork Trigger",
+ "statusMessage": "(OmO 5.1.63) Checking Ultrawork Trigger",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\ultrawork\\dist\\cli.js\" hook user-prompt-submit"
}
]
diff --git a/plugins/omo/hooks/user-prompt-submit-checking-ulw-loop-steering.json b/plugins/omo/hooks/user-prompt-submit-checking-ulw-loop-steering.json
index 7479d489..6790edde 100644
--- a/plugins/omo/hooks/user-prompt-submit-checking-ulw-loop-steering.json
+++ b/plugins/omo/hooks/user-prompt-submit-checking-ulw-loop-steering.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/ulw-loop/dist/cli.js\" hook user-prompt-submit",
"timeout": 10,
- "statusMessage": "(OmO 5.1.62) Checking Ulw-Loop Steering",
+ "statusMessage": "(OmO 5.1.63) Checking Ulw-Loop Steering",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\ulw-loop\\dist\\cli.js\" hook user-prompt-submit"
}
]
diff --git a/plugins/omo/hooks/user-prompt-submit-loading-project-rules.json b/plugins/omo/hooks/user-prompt-submit-loading-project-rules.json
index 7576fec7..a89fe56a 100644
--- a/plugins/omo/hooks/user-prompt-submit-loading-project-rules.json
+++ b/plugins/omo/hooks/user-prompt-submit-loading-project-rules.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/rules/dist/cli.js\" hook user-prompt-submit",
"timeout": 10,
- "statusMessage": "(OmO 5.1.62) Loading Project Rules",
+ "statusMessage": "(OmO 5.1.63) Loading Project Rules",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\rules\\dist\\cli.js\" hook user-prompt-submit"
}
]
diff --git a/plugins/omo/package-lock.json b/plugins/omo/package-lock.json
index ea4e614e..b5ad9463 100644
--- a/plugins/omo/package-lock.json
+++ b/plugins/omo/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@sisyphuslabs/omo-codex-plugin",
- "version": "5.1.62",
+ "version": "5.1.63",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@sisyphuslabs/omo-codex-plugin",
- "version": "5.1.62",
+ "version": "5.1.63",
"workspaces": [
"components/comment-checker",
"components/git-bash",
@@ -100,7 +100,7 @@
},
"components/comment-checker": {
"name": "@code-yeongyu/codex-comment-checker",
- "version": "5.1.62",
+ "version": "5.1.63",
"license": "MIT",
"bin": {
"omo-comment-checker": "dist/cli.js"
@@ -122,7 +122,7 @@
},
"components/git-bash": {
"name": "@sisyphuslabs/codex-git-bash-hook",
- "version": "5.1.62",
+ "version": "5.1.63",
"bin": {
"omo-git-bash-hook": "dist/cli.js"
},
@@ -136,7 +136,7 @@
},
"components/lazycodex-executor-verify": {
"name": "@code-yeongyu/codex-lazycodex-executor-verify",
- "version": "5.1.62",
+ "version": "5.1.63",
"license": "MIT",
"bin": {
"lazycodex-executor-verify": "dist/cli.js"
@@ -154,7 +154,7 @@
},
"components/lsp": {
"name": "@code-yeongyu/codex-lsp",
- "version": "5.1.62",
+ "version": "5.1.63",
"license": "MIT",
"dependencies": {
"@code-yeongyu/lsp-daemon": "file:../../../../lsp-daemon",
@@ -176,7 +176,7 @@
},
"components/rules": {
"name": "@code-yeongyu/codex-rules",
- "version": "5.1.62",
+ "version": "5.1.63",
"license": "MIT",
"dependencies": {
"picomatch": "^4.0.7"
@@ -199,7 +199,7 @@
},
"components/teammode": {
"name": "@sisyphuslabs/codex-teammode",
- "version": "5.1.62",
+ "version": "5.1.63",
"devDependencies": {
"@types/node": "^26.6.2",
"@vitest/coverage-v8": "5.0.1",
@@ -213,7 +213,7 @@
},
"components/telemetry": {
"name": "@code-yeongyu/codex-telemetry",
- "version": "5.1.62",
+ "version": "5.1.63",
"license": "MIT",
"bin": {
"omo-telemetry": "dist/cli.js"
@@ -232,7 +232,7 @@
},
"components/ultrawork": {
"name": "@code-yeongyu/codex-ultrawork",
- "version": "5.1.62",
+ "version": "5.1.63",
"license": "MIT",
"bin": {
"omo-ultrawork": "dist/cli.js"
@@ -251,7 +251,7 @@
},
"components/ulw-execute-continuation": {
"name": "@code-yeongyu/codex-ulw-execute-continuation",
- "version": "5.1.62",
+ "version": "5.1.63",
"license": "MIT",
"bin": {
"omo-ulw-execute-continuation": "dist/cli.js"
@@ -269,7 +269,7 @@
},
"components/ulw-loop": {
"name": "@code-yeongyu/codex-ulw-loop",
- "version": "5.1.62",
+ "version": "5.1.63",
"license": "MIT",
"bin": {
"omo-ulw-loop": "dist/cli.js",
diff --git a/plugins/omo/package.json b/plugins/omo/package.json
index f67455fe..21956c0e 100644
--- a/plugins/omo/package.json
+++ b/plugins/omo/package.json
@@ -1,6 +1,6 @@
{
"name": "@sisyphuslabs/omo-codex-plugin",
- "version": "5.1.62",
+ "version": "5.1.63",
"description": "Aggregate Codex plugin root for OMO components.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/scripts/sync-skills.mjs b/plugins/omo/scripts/sync-skills.mjs
index 5ca60e6d..74be5a0f 100644
--- a/plugins/omo/scripts/sync-skills.mjs
+++ b/plugins/omo/scripts/sync-skills.mjs
@@ -175,7 +175,7 @@ prefixes when identity is needed.
// and keeps every tool-based delivery gate (static, fidelity, layout, visual QA). The item is matched by
// its text right after the Visual QA sentence, not by its list numeral, so adding or removing an earlier
// delivery gate does not unhook the overlay.
-const ulwResearchProofreadGate = "**Proofread gate: `task(category=\"writing\", ...)`.** Hand the final text to a dedicated `writing` worker whose only job is language: grammar, spelling, punctuation, terminology consistency, and whether the prose reads NATIVELY in the report's own language. It proofreads only and never composes, and it never edits the file: it returns `$SESSION_DIR/polish-edits.json`, an array of `{\"before\": ..., \"after\": ..., \"reason\": ...}` where `before` is the exact current text of one or more adjacent sentences. Edits change text only; an edit whose before/after would alter any tag, attribute, comment, or script/style content is rejected, and markup changes go through the full fidelity gates instead. Apply it with `node \"$SKILL_DIR/scripts/report-tools.mjs\" fact polish-apply \"$SESSION_DIR/report.html\" --edits \"$SESSION_DIR/polish-edits.json\" --out \"$SESSION_DIR/report.polished.html\" --session-dir \"$SESSION_DIR\"`: each edit is applied alone, and an edit that changes a fact span, a numeral, a link, or a claim id, or drops a hedge or qualifier the source carries, is `polish_edit_rejected` (a `before` not found exactly once is `polish_edit_unlocated`) and leaves its text unchanged. Send the rejected and unlocated edits back to the same worker with their reasons, plus `$SESSION_DIR/polish-defects.json` and the pre-polish `report.html` the backstop compared against, so the worker sees why each edit was refused; it returns either a rewritten sentence or a new edit list, and the repair round re-runs `fact polish-apply` with `\"$SESSION_DIR/report.polished.html\"` as both input and output, within the repair budget. Then run the backstop `fact polish-diff --before \"$SESSION_DIR/report.html\" --after \"$SESSION_DIR/report.polished.html\" --session-dir \"$SESSION_DIR\"` (exit `1` on `polish_diff_fail`), `fact verify` on `report.polished.html`, and `fact pairs \"$SESSION_DIR/report.polished.html\" --changed-since \"$SESSION_DIR/report.html.fill-map.json\" --session-dir \"$SESSION_DIR\"`, which keeps only the quote and claim pairs whose sentence text changed during polish; run the meaning readers above (cheap, then strong on the flagged pairs) on exactly those pairs and `fact meaning-check` before recording `outcome gate fidelity`. A rewording that keeps every number, hedge, qualifier, and link but swaps who did what to whom therefore still reaches a meaning reader on the delivered text. `report.polished.html` is the report that is delivered. Deliver only on a clean pass. This gate runs BEFORE the first delivery, not after the user finds the typo. Edits must not span entities (such as &amp; or &lt;) or markup; narrow the edit to the surrounding words instead, and a rejected edit comes back with the reason to act on.";
+const ulwResearchProofreadGate = "**Proofread gate: `task(category=\"writing\", ...)`.** Hand the final text to a dedicated `writing` worker whose only job is language: grammar, spelling, punctuation, terminology consistency, and whether the prose reads NATIVELY in the report's own language. It proofreads only and never composes, and it never edits the file: it returns `$SESSION_DIR/polish-edits.json`, an array of `{\"before\": ..., \"after\": ..., \"reason\": ...}` where `before` is the exact current text of one or more adjacent sentences. Edits change text only; an edit whose before/after would alter any tag, attribute, comment, or script/style content is rejected, and markup changes go through the full fidelity gates instead. Apply it with `node \"$SKILL_DIR/scripts/report-tools.mjs\" fact polish-apply \"$SESSION_DIR/report.html\" --edits \"$SESSION_DIR/polish-edits.json\" --out \"$SESSION_DIR/report.polished.html\" --session-dir \"$SESSION_DIR\"`: each edit is applied alone, and an edit that changes a fact span, a numeral, a link, or a claim id, or drops a hedge or qualifier the source carries, is `polish_edit_rejected` (a `before` not found exactly once is `polish_edit_unlocated`) and leaves its text unchanged. Send the rejected and unlocated edits back to the same worker with their reasons, plus `$SESSION_DIR/polish-defects.json` and the pre-polish `report.html` the backstop compared against, so the worker sees why each edit was refused; it returns either a rewritten sentence or a new edit list, and the repair round re-runs `fact polish-apply` with `\"$SESSION_DIR/report.polished.html\"` as both input and output, within the repair budget. Then run the backstop `fact polish-diff --before \"$SESSION_DIR/report.html\" --after \"$SESSION_DIR/report.polished.html\" --session-dir \"$SESSION_DIR\"` (exit `1` on `polish_diff_fail`), `fact verify` on `report.polished.html`, and `fact pairs \"$SESSION_DIR/report.polished.html\" --changed-since \"$SESSION_DIR/report.html.fill-map.json\" --session-dir \"$SESSION_DIR\"`, which keeps only the quote and claim pairs whose sentence text changed during polish; run the meaning readers above (cheap, then strong on the flagged pairs) on exactly those pairs and `fact meaning-check` before recording `outcome gate fidelity`. A rewording that keeps every number, hedge, qualifier, and link but swaps who did what to whom therefore still reaches a meaning reader on the delivered text. `report.polished.html` is the report that is delivered; polish can change line wrapping, so re-run the layout gates and visual QA on `report.polished.html` and record `layout` and `visual` again. Deliver only on a clean pass. This gate runs BEFORE the first delivery, not after the user finds the typo. Edits must not span entities (such as &amp; or &lt;) or markup; narrow the edit to the surrounding words instead, and a rejected edit comes back with the reason to act on.";
const ulwResearchProofreadGateSource = ulwResearchProofreadGate.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
const ulwResearchProofreadGatePattern = new RegExp(`(inspect the pixels\\.)\\n\\d+\\. ${ulwResearchProofreadGateSource}`);
@@ -183,10 +183,12 @@ export const ulwExecuteOriginalCompletion = [
"When all top-level checkboxes in `## TODOs` and `## Final Verification Wave` are complete:",
"",
"1. Run the plan's final verification commands.",
- "2. For PR/branch work, finish the lifecycle from the last phase's worktree: sync `.omo/` state back to the main repo, create or update the PR, wait for review/verification gates, merge by default unless explicitly opted out, and remove the worktree only after successful merge or explicit handoff. Finish directory teardown per Task resources and record its receipts.",
+ "2. Under `--make-pr` or `--ship`, finish the lifecycle from the last phase's worktree: sync `.omo/` state back to the main repo, create or update the PR, and wait for review/verification gates. Then follow the delivery mode: `--ship` merges per the repository's merge policy; `--make-pr` hands off with the PR URL and merges only if the user asks. Remove the worktree only after a successful merge or that explicit handoff. Finish directory teardown per Task resources and record its receipts.",
"3. Remove or mark the Boulder work as completed.",
"4. Print an `ORCHESTRATION COMPLETE` block with the plan path, verification commands, artifacts, and cleanup receipts.",
].join("\n");
+export const ulwExecuteOriginalRootScope = "This rule binds the root of a ulw-execute run, including its Final Verification Wave and any `review-work` pass run inside it: a worker runs every QA scenario, and you judge the artifacts it captured. Outside a ulw-execute run (a bare ultrawork run, a ulw-loop final gate, a standalone `review-work`), the session that owns the run runs the final real-surface QA itself.";
+const ulwExecuteCodexRootScope = "This rule binds the root of a ulw-execute run: a worker runs every implementation and per-task QA scenario, and you judge the artifacts it captured. The Codex edition's one exception is the final verification in the Completion section below, where the root runs its own manual QA on the real surface and records a self-review. Outside a ulw-execute run (a bare ultrawork run, a ulw-loop final gate, a standalone `review-work`), the session that owns the run runs the final real-surface QA itself.";
export const ulwExecuteOriginalHardRule = [
"- No production change before the tests covering that behavior were read and a bug's reproduction captured; existing tests are green on the unchanged code first, and one that contradicts the intent is a FINDING, never edited green.",
"- No `--dry-run` as completion evidence.",
@@ -203,7 +205,7 @@ const ulwExecuteCodexCompletion = [
"1. Run the plan's final verification commands.",
"2. Record a self-review in the notepad: re-read the diff, run diagnostics, and capture evidence for every acceptance criterion. Run your own manual QA on the real surface.",
"3. Only when the user demanded strict, rigorous, or high-accuracy review, spawn ONE `lazycodex-gate-reviewer`; otherwise your self-review is the final verification.",
- "4. Finish the PR/branch lifecycle from its task-owned worktree: sync `.omo/` state back to the main repo, create or update the PR, wait for review/verification gates, merge by default unless explicitly opted out, and remove the worktree only after successful merge or explicit handoff. Finish directory teardown per Task resources and record its receipts.",
+ "4. Finish the PR/branch lifecycle from its task-owned worktree: sync `.omo/` state back to the main repo, create or update the PR, wait for review/verification gates; `--ship` merges per the repository's merge policy, `--make-pr` hands off with the PR URL and merges only if the user asks; remove the worktree only after a successful merge or that explicit handoff. Finish directory teardown per Task resources and record its receipts.",
"5. Remove or mark the Boulder work as completed.",
"6. Print an `ORCHESTRATION COMPLETE` block with the plan path, verification commands, artifacts, and cleanup receipts.",
].join("\n");
@@ -225,6 +227,7 @@ export function applyCodexSkillOverlays(skillName, content) {
}
if (skillName === "ulw-execute") {
return content
+ .replace(ulwExecuteOriginalRootScope, ulwExecuteCodexRootScope)
.replace(ulwExecuteOriginalCompletion, ulwExecuteCodexCompletion)
.replace(ulwExecuteOriginalHardRule, ulwExecuteCodexHardRule);
}
diff --git a/plugins/omo/skills/ast-grep/AGENTS.md b/plugins/omo/skills/ast-grep/AGENTS.md
index fd79579a..84cbebde 100644
--- a/plugins/omo/skills/ast-grep/AGENTS.md
+++ b/plugins/omo/skills/ast-grep/AGENTS.md
@@ -41,11 +41,11 @@ Subcommands: `search`, `replace` (dry-run; `--apply` to write), `scan`, `test`,
```bash
# from packages/shared-skills/skills/ast-grep/
-python3 scripts/ast_grep_helper.py search '<PATTERN>' --lang ts [path]
+python3 scripts/ast_grep_helper.py search '<PATTERN>' [path] --lang <LANG>
python3 scripts/ast_grep_helper.py replace '<PATTERN>' '<REWRITE>' --lang ts # dry-run; add --apply
python3 scripts/ast_grep_helper.py doctor
bash tests/smoke.sh # or: pwsh tests/smoke.ps1
# direct: sg run -p '<PATTERN>' --lang ts path
```
-- Parent: [`packages/shared-skills/AGENTS.md`](../../AGENTS.md).
+- Parent (source checkout only, not shipped with the installed skill): `packages/shared-skills/AGENTS.md`.
diff --git a/plugins/omo/skills/ast-grep/README.md b/plugins/omo/skills/ast-grep/README.md
index 4b3422d0..40a1e3d2 100644
--- a/plugins/omo/skills/ast-grep/README.md
+++ b/plugins/omo/skills/ast-grep/README.md
@@ -29,13 +29,13 @@ ln -s /path/to/your/clone ~/.agents/skills/ast-grep
```bash
# Search by AST pattern (the helper validates patterns offline first)
-python3 scripts/ast_grep_helper.py search 'console.log($MSG)' --lang ts src/
+python3 scripts/ast_grep_helper.py search 'console.log($MSG)' src/ --lang ts
# Rewrite (dry-run preview by default)
-python3 scripts/ast_grep_helper.py replace 'console.log($MSG)' 'logger.info($MSG)' --lang ts src/
+python3 scripts/ast_grep_helper.py replace 'console.log($MSG)' 'logger.info($MSG)' src/ --lang ts
# Apply the rewrite (two-pass: preview JSON + then --update-all)
-python3 scripts/ast_grep_helper.py replace 'console.log($MSG)' 'logger.info($MSG)' --lang ts src/ --apply
+python3 scripts/ast_grep_helper.py replace 'console.log($MSG)' 'logger.info($MSG)' src/ --lang ts --apply
# Run YAML lint rules from sgconfig.yml
python3 scripts/ast_grep_helper.py scan src/
@@ -85,7 +85,7 @@ ast-grep-skill/
1. **Wraps `sg`** with a single Python 3 stdlib script that works the same on macOS, Linux, Windows, WSL, Git Bash.
2. **Validates patterns offline** before calling `sg` — catches the regex-misuse class of mistakes (`\w`, `.*`, `|`, `[a-z]`) plus language-specific traps (Python trailing colons, JS/Go/Rust missing function bodies).
-3. **Resolves the binary** through 6 candidate paths: cached → PATH (with Linux `setgroups` collision detection) → Homebrew. Falls through to a clear install hint with copy-paste commands.
+3. **Resolves the binary** through 5 candidates: `OMO_AST_GREP_SG_PATH` override → OMO runtime dirs → cached → PATH (with Linux `setgroups` collision detection) → Homebrew. Falls through to a clear install hint with copy-paste commands.
4. **Runs the two-pass write trick** when applying rewrites — `sg run` silently ignores `--update-all` when `--json` is set, so `replace --apply` runs two invocations: pass 1 collects JSON matches, pass 2 mutates files.
5. **Ships per-OS installers** that try every reasonable package manager and fall back to a GitHub release tarball.
6. **Documents the failure modes** the model will hit (regex misuse, incomplete patterns, `--update-all` + `--json` trap, scope/type questions ast-grep can't answer) in `references/pitfalls.md`.
diff --git a/plugins/omo/skills/ast-grep/SKILL.md b/plugins/omo/skills/ast-grep/SKILL.md
index 98a112cd..0d25bfaf 100644
--- a/plugins/omo/skills/ast-grep/SKILL.md
+++ b/plugins/omo/skills/ast-grep/SKILL.md
@@ -17,9 +17,9 @@ OmO native also registers a bundled ast-grep MCP server. Its three tools are **d
- `mcp__ast_grep_search({ pattern, language, paths })` — AST-shape search, the MCP equivalent of `sg run -p`. Prefer this over shelling out to `sg` for one-off lookups: no install, no PATH issues.
- `mcp__ast_grep_rewrite({ pattern, rewrite, language, paths, apply })` — preview matches (`apply: false`, the default) or apply the rewrite (`apply: true`). Same two-pass discipline as `sg run -r`: preview first, then apply.
-- `mcp__ast_grep_scan({ paths })` — run project YAML rules (`sgconfig.yml`, `rules/`), the MCP equivalent of `sg scan`.
+- `mcp__ast_grep_scan({ ruleFile | inlineRules, paths, apply })` — run exactly one explicit YAML rule source (a rule file or inline rules), the MCP equivalent of `sg scan --rule` / `--inline-rules`. It never discovers `sgconfig.yml`; to run a project's whole rule set, use `sg scan` (or the helper's `scan`) from the shell.
-Same pattern language as the CLI: `$VAR` matches one AST node, `$$$VAR` matches zero or more, and the pattern is code, not regex. `paths` accepts a file or directory list; `language` is required for patterns that are ambiguous across languages.
+Same pattern language as the CLI: `$VAR` matches one AST node, `$$$VAR` matches zero or more, and the pattern is code, not regex. `paths` accepts a file or directory list; `language` is always required by `mcp__ast_grep_search` and `mcp__ast_grep_rewrite`.
---
@@ -79,7 +79,7 @@ A single-file Python 3 stdlib wrapper. Same on every OS. The agent's default ent
### `search` — find all matches of a pattern
```bash
-python3 scripts/ast_grep_helper.py search 'console.log($MSG)' --lang ts src/
+python3 scripts/ast_grep_helper.py search 'console.log($MSG)' src/ --lang ts
```
Validates the pattern offline first. If the pattern looks like regex (`\w`, `.*`, `|`, etc.) the helper exits with a hint and never calls `sg` — saves a round-trip. Pass `--force` to skip validation.
@@ -94,10 +94,10 @@ Flags:
```bash
# Dry-run preview (default — no files mutated)
-python3 scripts/ast_grep_helper.py replace 'console.log($MSG)' 'logger.info($MSG)' --lang ts src/
+python3 scripts/ast_grep_helper.py replace 'console.log($MSG)' 'logger.info($MSG)' src/ --lang ts
# Actually apply
-python3 scripts/ast_grep_helper.py replace 'console.log($MSG)' 'logger.info($MSG)' --lang ts src/ --apply
+python3 scripts/ast_grep_helper.py replace 'console.log($MSG)' 'logger.info($MSG)' src/ --lang ts --apply
```
The helper:
@@ -117,10 +117,12 @@ python3 scripts/ast_grep_helper.py scan -r rules/no-console.yml src/
# Apply auto-fixes
python3 scripts/ast_grep_helper.py scan -U src/
-# CI-friendly GitHub annotations
+# Compact one-line-per-finding report
python3 scripts/ast_grep_helper.py scan --report-style short src/
```
+The helper has no `--format` flag; for CI-friendly GitHub annotations call `sg scan --format github src/` directly (see `references/cli.md`).
+
### `validate` — offline pattern check (no `sg` call)
Useful for CI lints, pre-commit hooks, and quick sanity checks:
@@ -226,7 +228,7 @@ In priority order:
1. **Run `helper validate '<pattern>' --lang <lang>`** — catches regex misuse, missing function bodies, Python trailing colons.
2. **Check `--lang`** — `sg` infers from extension; if you pass a `.tsx` file with `--lang ts` (not `tsx`), JSX won't parse.
3. **Inspect the parsed pattern**: `sg run -p '<pattern>' --lang <lang> --debug-query=ast --stdin <<< '<sample>'`. If it shows `ERROR` nodes, the pattern is malformed.
-4. **Check the AST of the target file**: `sg run -p '$_' --lang <lang> --debug-query=cst path/to/file | head -40` — find the `kind` you're trying to match.
+4. **Check the AST of the target code**: paste a snippet of the target file as the pattern, `sg run -p '<snippet>' --lang <lang> --debug-query=cst path/to/file 2>&1 >/dev/null | head -40` — the dump goes to stderr and shows the pattern's tree; find the `kind` you're trying to match.
5. **Try the playground**: <https://ast-grep.github.io/playground.html> — paste code + pattern, see what's happening.
Do not blindly retry with variations. Each failure has a reason; surface it.
@@ -255,7 +257,7 @@ The full YAML rule schema is in `references/yaml-rules.md`. Project setup (`sgco
- `sg run --json=compact` produces an array of match objects: `{ file, range: {start, end}, text, replacement?, lines, language, ... }`. Pipe through `jq` for further processing.
- Without `--json`, `sg` produces human-readable colored output suitable for terminals.
- The helper's default output is human-readable (file:line:column + match preview). Pass `--json-out` for raw JSON.
-- The helper's `replace` always summarizes: number of matches, number of files, per-location preview.
+- The helper's `replace` dry-run prints the number of matches, the number of files, and a per-location preview; `--apply` prints only the totals (`APPLIED: rewrote N match(es) across M file(s).`).
When summarizing for the user, **always include the count of files affected**, not just the count of matches. Users care about blast radius.
diff --git a/plugins/omo/skills/ast-grep/references/cli.md b/plugins/omo/skills/ast-grep/references/cli.md
index d887e1fe..6a8c94e4 100644
--- a/plugins/omo/skills/ast-grep/references/cli.md
+++ b/plugins/omo/skills/ast-grep/references/cli.md
@@ -208,9 +208,10 @@ sg completions powershell >> $PROFILE
sg run -p 'console.log($_)' --lang ts --json=compact . \
| jq -r '.[].file' | sort | uniq -c | sort -rn
-# Find all unique kinds in a file (great for figuring out kind names)
-sg run -p '$_' --lang ts --debug-query=cst src/foo.ts \
- | grep -oE 'kind: [a-z_]+' | sort -u
+# Find all unique kinds in a file (great for figuring out kind names).
+# --debug-query dumps the PATTERN's tree to stderr, so pass the file's code as the pattern.
+sg run -p "$(cat src/foo.ts)" --lang ts --debug-query=ast src/foo.ts 2>&1 >/dev/null \
+ | grep -oE '[a-z_]+ \(' | tr -d ' (' | sort -u
# Rewrite only in a subset of files
sg run -p 'foo()' -r 'bar()' --update-all --globs 'src/**/*.ts' --globs '!src/legacy/**' .
diff --git a/plugins/omo/skills/ast-grep/references/patterns.md b/plugins/omo/skills/ast-grep/references/patterns.md
index 6c0b5bbb..73c78322 100644
--- a/plugins/omo/skills/ast-grep/references/patterns.md
+++ b/plugins/omo/skills/ast-grep/references/patterns.md
@@ -43,9 +43,9 @@ foo === foo.bar
Useful for finding redundant comparisons, double assignments, etc.
-### `$$$` is greedy
+### `$$$` is lazy
-When you write `foo($$$A, b, $$$C)`, the matcher does **not** backtrack or try every possible split. It greedily fills `$$$A` until the pattern can match `b`, then everything left goes into `$$$C`.
+When you write `foo($$$A, b, $$$C)`, the matcher does **not** backtrack or try every possible split. It fills `$$$A` only until the rest of the pattern can match — the first `b` here — then everything left goes into `$$$C`. On `foo(a, c, b, b, c)` that is `A=[a, c]` and `C=[b, c]`, never the longer `A=[a, c, b]`.
```ts
// Pattern
@@ -116,11 +116,11 @@ Two tools help you confirm a pattern parses the way you expect:
# Print the AST of the pattern itself
sg run -p 'console.log($MSG)' --lang ts --debug-query=ast
-# Print the parsed CST of a file (great for figuring out kind names)
-sg run -p '$_' --lang ts --debug-query=cst src/example.ts | head -40
+# Print the CST of code copied from a file (great for figuring out kind names)
+sg run -p 'function f(x: number) { return x + 1 }' --lang ts --debug-query=cst src/example.ts 2>&1 >/dev/null | head -40
```
-`--debug-query=ast` shows the named AST nodes only (cleaner). `--debug-query=cst` shows everything including punctuation. Both go to stderr, so they don't interfere with stdout JSON.
+`--debug-query=ast` shows the named AST nodes only (cleaner). `--debug-query=cst` shows everything including punctuation. Both dump the tree of the **pattern** (not of the searched files) to stderr, so they don't interfere with stdout JSON; redirect `2>&1 >/dev/null` to pipe the dump. To learn a file's node kinds, paste that file's code as the pattern.
The web playground is also fast: <https://ast-grep.github.io/playground.html>.
diff --git a/plugins/omo/skills/ast-grep/references/pitfalls.md b/plugins/omo/skills/ast-grep/references/pitfalls.md
index 16a63560..9572be23 100644
--- a/plugins/omo/skills/ast-grep/references/pitfalls.md
+++ b/plugins/omo/skills/ast-grep/references/pitfalls.md
@@ -1,6 +1,6 @@
# Pitfalls — what breaks patterns and how to fix them
-This is the failure-mode field guide. The `scripts/ast_grep_helper.py validate` subcommand mechanically checks for the items in §1 before calling `sg`; the rest are lower-frequency but still common.
+This is the failure-mode field guide. The `scripts/ast_grep_helper.py validate` subcommand mechanically checks the §1 items for backslash escapes, `.*`/`.+`, character classes, and `|` alternation before calling `sg` (it does not detect `^`/`$` anchors), plus the missing-body and trailing-colon cases from §2; the rest are lower-frequency but still common.
---
@@ -126,9 +126,9 @@ If you actually want two independent captures, name them differently: `$X = $Y`.
---
-## 6. `$$$` is greedy then commits
+## 6. `$$$` is lazy and never backtracks
-`$$$` does **not** backtrack. It captures as much as possible, then commits. If your pattern needs a non-greedy match, structure it differently:
+`$$$` does **not** backtrack. It stops at the first node that lets the rest of the pattern match, then commits — on `foo($$$A, b, $$$C)` against `foo(a, c, b, b, c)`, `$$$A` is `[a, c]`, not `[a, c, b]`. If your pattern needs more to land in `$$$A`, structure it differently:
```ts
// You want "match foo($X), where $X is any single arg"
diff --git a/plugins/omo/skills/ast-grep/references/recipes.md b/plugins/omo/skills/ast-grep/references/recipes.md
index b5add751..ae26c86d 100644
--- a/plugins/omo/skills/ast-grep/references/recipes.md
+++ b/plugins/omo/skills/ast-grep/references/recipes.md
@@ -5,11 +5,13 @@ Every pattern in this file has been verified against the canonical syntax. They
Use them with the helper:
```bash
-ast-grep-helper search '<PATTERN>' --lang <LANG> [path]
-ast-grep-helper replace '<PATTERN>' '<REWRITE>' --lang <LANG> [path] # dry-run
-ast-grep-helper replace '<PATTERN>' '<REWRITE>' --lang <LANG> [path] --apply
+python3 scripts/ast_grep_helper.py search '<PATTERN>' [path] --lang <LANG>
+python3 scripts/ast_grep_helper.py replace '<PATTERN>' '<REWRITE>' [path] --lang <LANG> # dry-run
+python3 scripts/ast_grep_helper.py replace '<PATTERN>' '<REWRITE>' [path] --lang <LANG> --apply
```
+Put any `[path]` BEFORE `--lang`: the helper's `paths` argument is `nargs='*'`, and on Python 3.9 (the stock macOS `python3`, which the helper supports) a positional after `--lang` is rejected with `unrecognized arguments`. A pattern or rewrite containing a literal `|` (e.g. `$T | None`) is refused by the helper's alternation check — run two calls, or pass `--force` to reach `sg` anyway.
+
Or directly:
```bash
@@ -132,7 +134,7 @@ sg run -p 'print($$$A)' -r 'logger.info($$$A)' --lang py --update-all .
# Optional[X] -> X | None
sg run -p 'Optional[$T]' -r '$T | None' --lang py --update-all .
-# from typing import List -> remove (built-in list works in 3.9+)
+# from typing import List -> annotate for manual removal (built-in list works in 3.9+)
sg run -p 'from typing import List' -r 'from typing import List # TODO: remove, use list' --lang py --update-all .
```
diff --git a/plugins/omo/skills/ast-grep/references/yaml-rules.md b/plugins/omo/skills/ast-grep/references/yaml-rules.md
index 7ced6fd0..333c3f0c 100644
--- a/plugins/omo/skills/ast-grep/references/yaml-rules.md
+++ b/plugins/omo/skills/ast-grep/references/yaml-rules.md
@@ -488,14 +488,14 @@ ignores:
- '**/__generated__/**'
```
-If omitted, the rule runs on every file matching its `language`. These globs override `sgconfig.yml`-level globs for this rule only.
+If omitted, the rule runs on every file matching its `language`. `sgconfig.yml` has no project-wide `files`/`ignores` to override; its `languageGlobs` only changes which language a file parses as. To narrow a whole scan, pass `--globs` to `sg scan`.
Object form (rare):
```yaml
files:
- - pattern: 'src/**/*.ts'
- case_sensitive: true
+ - glob: 'src/**/*.ts'
+ caseInsensitive: true
```
---
diff --git a/plugins/omo/skills/ast-grep/scripts/ast_grep_helper.py b/plugins/omo/skills/ast-grep/scripts/ast_grep_helper.py
index ec6c0493..2306cf82 100755
--- a/plugins/omo/skills/ast-grep/scripts/ast_grep_helper.py
+++ b/plugins/omo/skills/ast-grep/scripts/ast_grep_helper.py
@@ -27,13 +27,13 @@ USAGE
EXAMPLES
# Find all console.log calls in TypeScript
- ast_grep_helper.py search 'console.log($MSG)' --lang ts src/
+ ast_grep_helper.py search 'console.log($MSG)' src/ --lang ts
# Migrate console.log -> logger.info (dry-run preview)
- ast_grep_helper.py replace 'console.log($MSG)' 'logger.info($MSG)' --lang ts src/
+ ast_grep_helper.py replace 'console.log($MSG)' 'logger.info($MSG)' src/ --lang ts
# Apply the same replacement
- ast_grep_helper.py replace 'console.log($MSG)' 'logger.info($MSG)' --lang ts src/ --apply
+ ast_grep_helper.py replace 'console.log($MSG)' 'logger.info($MSG)' src/ --lang ts --apply
# Validate a pattern offline (no sg call, no filesystem access)
ast_grep_helper.py validate '\\w+' --lang ts
diff --git a/plugins/omo/skills/browser/SKILL.md b/plugins/omo/skills/browser/SKILL.md
index 8c3b21c6..3b8ca7d9 100644
--- a/plugins/omo/skills/browser/SKILL.md
+++ b/plugins/omo/skills/browser/SKILL.md
@@ -117,9 +117,8 @@ changing the extension's automation settings.
out everywhere. No flow here needs it.
- **`focused: false` by default.** The browser belongs to someone who is probably using it.
- **One short, named session per task,** always stopped.
-- **Bot-scored or WAF targets go to the owned engine**, in the terminal and inside OmO Desktop alike. The attached engine's daemon enables console
- capture on every tab it drives, which is a known automation signal; CloakBrowser through
- `connectCloakProfile()` is the stealth path.
+- **Bot-scored or WAF targets never go through the attached engine** — route them to the `ultimate-browsing` skill, whose browser tier is the owned engine (`connectCloakProfile()`). The attached engine's daemon enables console
+ capture on every tab it drives, which is a known automation signal.
## Where the rest lives
diff --git a/plugins/omo/skills/browser/runtime/omowright/manifest.json b/plugins/omo/skills/browser/runtime/omowright/manifest.json
index e0420b88..00188a0b 100644
--- a/plugins/omo/skills/browser/runtime/omowright/manifest.json
+++ b/plugins/omo/skills/browser/runtime/omowright/manifest.json
@@ -5,5 +5,5 @@
"index.js": "3a2e4f2575bdfc15448f13768cd8113f8493bf04611c9fefb09b13430d6520de",
"page-bundle.js": "bfd51e8383cf47200d57387bbbed258bce5a3a3d00c38fc108034d2888e23f0c"
},
- "stagedAtUtc": "2026-11-06T06:54:43.880Z"
+ "stagedAtUtc": "2026-11-07T12:37:57.960Z"
}
diff --git a/plugins/omo/skills/coding-agent-sessions/AGENTS.md b/plugins/omo/skills/coding-agent-sessions/AGENTS.md
index 15bca82b..61fe5ab6 100644
--- a/plugins/omo/skills/coding-agent-sessions/AGENTS.md
+++ b/plugins/omo/skills/coding-agent-sessions/AGENTS.md
@@ -60,4 +60,4 @@ python3 -B scripts/find-agent-sessions.py read <session-id>
pytest scripts/tests
```
-- Parent: [`packages/shared-skills/AGENTS.md`](../../AGENTS.md).
+- Parent (source checkout only, not shipped with the installed skill): `packages/shared-skills/AGENTS.md`.
diff --git a/plugins/omo/skills/coding-agent-sessions/SKILL.md b/plugins/omo/skills/coding-agent-sessions/SKILL.md
index 28c6fcf9..432e44a2 100644
--- a/plugins/omo/skills/coding-agent-sessions/SKILL.md
+++ b/plugins/omo/skills/coding-agent-sessions/SKILL.md
@@ -80,10 +80,11 @@ Each `match_reasons` entry includes `query`, `platform`, `field`, and `snippet`,
| `--cwd` | Working-directory substring |
| `--model` | Model substring |
| `--limit` | Maximum results |
-| `--query` | Repeatable search query; multiple queries return per-query groups plus a de-duplicated merged result list |
| `--workers` | Parallel worker count for platform scans, transcript parsing, OpenCode message joins, and multi-query matching |
| `--include-subagents` | Include subagent/child sessions as standalone `list`/`search` results (hidden by default) |
+`search` (alias `find`) also takes `--query`: a repeatable search query; multiple queries return per-query groups plus a de-duplicated merged result list. `list` ignores `--query` and positional text.
+
When `--platform` is omitted, the finder searches every registered platform in parallel. Each optional platform first probes fixed, known transcript roots and returns immediately when the product has no local store, so broad default searches stay cheap. Use repeatable flags such as `--platform openclaw --platform droid` only when narrowing. Comma-separated platform values are intentionally unsupported.
For OpenCode, the finder uses `opencode db path` plus direct SQLite queries first, then `opencode session list --format json` as a fallback. It avoids heavy `messages/` or `parts/` scans during normal list/search, and only falls back to file joins when the OpenCode DB/CLI is unavailable or explicit `--root` values request a nonstandard store.
diff --git a/plugins/omo/skills/data-scientist/SKILL.md b/plugins/omo/skills/data-scientist/SKILL.md
index ec94197b..b9db870c 100644
--- a/plugins/omo/skills/data-scientist/SKILL.md
+++ b/plugins/omo/skills/data-scientist/SKILL.md
@@ -42,8 +42,9 @@ Per-surface patterns and pitfalls: read `references/execution-surfaces.md` befor
older spellings.
- **numpy** when numeric work goes beyond SQL/DataFrame aggregation: statistical tests,
linear algebra, FFT, random sampling.
-- **matplotlib** for every chart — read `references/visualization.md` first; it carries the
- quality bar and a mandatory visual check.
+- **matplotlib** for charts in a kernel, a file or a document; a chart shown inline beside a
+ reply is drawn in HTML instead. Read `references/visualization.md` first either way; it
+ carries the quality bar, the inline case and a mandatory visual check.
Performance folklore ("X is Nx faster at filtering") varies with data shape, cardinality,
and hardware. When the engine choice materially matters, measure on the actual data instead
@@ -65,10 +66,11 @@ a direct scan. Then place the work:
takes longer.
- **Query remotely, in place** when the data lives elsewhere: DuckDB reads http(s)/S3
Parquet and CSV with projection and predicate pushdown, so fetch the columns and rows the
- question needs, never the whole file. When data sits on another machine you can execute
- on, ship the query to the data and return the small result. Rule: result much smaller
- than data — move the query; repeated local iteration planned — move a pruned copy of the
- data once.
+ question needs, never the whole file. When data sits in a database, run the aggregation
+ there in its own SQL and pull back the result rows, never a table dump. When data sits on
+ another machine you can execute on, ship the query to the data and return the small
+ result. Rule: result much smaller than data — move the query; repeated local iteration
+ planned — move a pruned copy of the data once.
Sizing heuristics and recipes: `references/placement.md`.
diff --git a/plugins/omo/skills/data-scientist/references/placement.md b/plugins/omo/skills/data-scientist/references/placement.md
index 1c577c4a..4c9ae3ff 100644
--- a/plugins/omo/skills/data-scientist/references/placement.md
+++ b/plugins/omo/skills/data-scientist/references/placement.md
@@ -8,13 +8,17 @@ ten times) or kills the machine (loading a dataset larger than RAM and swapping)
Three facts, one cell or script:
```python
-import os, shutil, subprocess, sys
+import os, re, shutil, subprocess, sys
size = os.path.getsize("data.csv") # bytes on disk
disk_free = shutil.disk_usage(".").free # spill headroom
-if sys.platform == "darwin":
- ram = int(subprocess.run(["sysctl", "-n", "hw.memsize"], capture_output=True, text=True).stdout)
-else:
- ram = os.sysconf("SC_PAGE_SIZE") * os.sysconf("SC_PHYS_PAGES")
+if sys.platform == "darwin": # free RAM = free + inactive + speculative pages
+ vm = subprocess.run(["vm_stat"], capture_output=True, text=True).stdout
+ page = int(re.search(r"page size of (\d+)", vm).group(1))
+ ram_free = page * sum(int(re.search(rf"{k}:\s+(\d+)", vm).group(1))
+ for k in ("Pages free", "Pages inactive", "Pages speculative"))
+else: # Linux: MemAvailable
+ ram_free = next(int(line.split()[1]) * 1024 for line in open("/proc/meminfo")
+ if line.startswith("MemAvailable:"))
# row estimate without loading (DuckDB streams the scan):
# duckdb.sql("SELECT count(*) FROM 'data.csv'")
```
diff --git a/plugins/omo/skills/data-scientist/references/uv-setup.md b/plugins/omo/skills/data-scientist/references/uv-setup.md
index d1345100..bce4e9c9 100644
--- a/plugins/omo/skills/data-scientist/references/uv-setup.md
+++ b/plugins/omo/skills/data-scientist/references/uv-setup.md
@@ -6,10 +6,10 @@ This skill's uv lane (kernel-less harnesses, isolated one-shots) runs through `u
| Platform | Command |
|---|---|
-| macOS / Linux / WSL / Git Bash | `bash scripts/setup-uv.sh` |
-| Windows (PowerShell) | `powershell -ExecutionPolicy Bypass -File scripts/setup-uv.ps1` |
+| macOS / Linux / WSL | `bash scripts/setup-uv.sh` |
+| Windows (PowerShell; also from Git Bash, where `setup-uv.sh` exits) | `powershell -ExecutionPolicy Bypass -File scripts/setup-uv.ps1` |
-Both scripts: detect OS + architecture → install uv to the latest release when missing → upgrade it when present (`uv self update`) → make it resolvable for the current shell → verify with `uv --version`. They are idempotent — safe to re-run any time.
+Both scripts: detect OS + architecture → install uv to the latest release when missing → upgrade it when present (`uv self update`) → make it resolvable for the script's own `uv --version` check (an already-open shell still needs the PATH line below) → verify with `uv --version`. They are idempotent — safe to re-run any time.
## Manual install per platform
diff --git a/plugins/omo/skills/data-scientist/references/visualization.md b/plugins/omo/skills/data-scientist/references/visualization.md
index 0ba894ef..b7f4e076 100644
--- a/plugins/omo/skills/data-scientist/references/visualization.md
+++ b/plugins/omo/skills/data-scientist/references/visualization.md
@@ -1,7 +1,11 @@
# Visualization
-A chart exists to answer a question at a glance. Render it with matplotlib (resident in most
-Python kernels; `uv run --with matplotlib` otherwise), then look at it before delivering —
+A chart exists to answer a question at a glance. A chart shown inline beside a reply
+(`show_html_page`, `html_preview`, `html_render`) is drawn in HTML, never as a matplotlib PNG:
+an image ignores the reader's theme and width. When the `visualize` skill is available, it builds
+that page. There this file's chart-type table, Figures and Quality bar apply, and the matplotlib
+calls do not. Everywhere else (a kernel, a file, a document) render it with matplotlib (resident
+in most Python kernels; `uv run --with matplotlib` otherwise). Either way, look at it before delivering —
a chart nobody inspected is not evidence.
## When to chart
@@ -22,6 +26,15 @@ question — decoration dilutes the answer.
| Composition of a whole? | stacked or 100% bar — pie only for four or fewer slices |
| Many series over time? | small multiples over one spaghetti chart |
+## Figures — every chart
+
+- **Days start at the reader's midnight.** Cut daily, weekly and monthly buckets in the
+ reader's time zone, not UTC, and name the zone in the axis label or caption. A bucket still
+ filling (today, this week) is marked partial on its own bar, or it reads as a drop.
+- **Cross-check one figure.** Recompute a headline number from a second source (another
+ table, the system's own dashboard, a raw count) and say beside the chart whether it
+ matched, and by how much it differed if not.
+
## Quality bar — every chart
- Title states the finding ("Seoul overtook Busan in March"), not the dataset name.
@@ -51,8 +64,10 @@ matplotlib.rcParams["axes.unicode_minus"] = False # keeps the minus sign rende
## Output contract
-1. Save a PNG next to the work: `plt.savefig(path, dpi=150, bbox_inches="tight")`.
-2. Also render inline when the surface displays rich output (kernels usually do).
+1. Inline page beside a reply: no PNG. Draw the computed figures in HTML and preview them in
+ both themes, following the `visualize` skill when it is available.
+2. Otherwise save a PNG next to the work: `plt.savefig(path, dpi=150, bbox_inches="tight")`,
+ and also render it inline when the surface displays rich output (kernels usually do).
3. Report the file path together with the answer.
## Visual QA — mandatory
diff --git a/plugins/omo/skills/debugging/SKILL.md b/plugins/omo/skills/debugging/SKILL.md
index dd32a856..2fdf0af6 100644
--- a/plugins/omo/skills/debugging/SKILL.md
+++ b/plugins/omo/skills/debugging/SKILL.md
@@ -26,7 +26,7 @@ The rest of this file is a map. **The knowledge is in `references/`.** This file
## Runtime Setup — MANDATORY READING BEFORE ATTACHING
-The methodology is language-agnostic. The commands to launch, attach, breakpoint, and inspect are not. **Open the matching reference before Phase 0. Not during. Not after.**
+The methodology is language-agnostic. The commands to launch, attach, breakpoint, and inspect are not. **Open the matching reference the moment you know the runtime (Phase 0, step 2) and before you attach anything. Not after.**
| Your runtime is… | Open this before attaching anything | Non-negotiable because… |
|---|---|---|
@@ -39,7 +39,7 @@ The methodology is language-agnostic. The commands to launch, attach, breakpoint
**If you cannot honestly say you just opened the reference for your runtime, open it now.**
-> 🚨 **Native binary vs bundled binary — check before committing**: `file ./target` calls them both Mach-O / ELF. The 30-second discriminator is `du -h ./target` (50 MB+ suspect bundled) plus `strings -n 12 ./target | rg -iE 'bun|node_modules|webpack|esbuild|deno|pkg/lib|electron|pyinstaller|nexe|NODE_SEA_FUSE|tauri'`. If hits → bundled-js-binary.md. If clean → native-binary.md.
+> 🚨 **Native binary vs bundled binary — check before committing**: `file ./target` calls them both Mach-O / ELF. The 30-second discriminator is `du -h ./target` (50 MB+ suspect bundled) plus `strings -n 12 ./target | rg -i 'bun|node_modules|webpack|esbuild|deno|pkg/lib|electron|pyinstaller|nexe|NODE_SEA_FUSE|tauri'`. If hits → bundled-js-binary.md. If clean → native-binary.md.
---
@@ -56,7 +56,7 @@ These are not "optional extras". They are the correct tool in their domain, and
| **Frida** | Any running process you must instrument live without source or symbols — hook a function and print real argument values, trace calls, stub a return. Complements Ghidra: Ghidra reads the bytes, Frida watches them execute. **If Ghidra's static decompile has hit its limit, reach for Frida.** | 📖 **[references/tools/frida.md](references/tools/frida.md)** |
| **DAP client (`dap.mjs`)** | Any time you would drive a debugger through a PTY and screen-scrape its text. Debuggers already speak the machine-readable Debug Adapter Protocol (debugpy, `dlv dap`, lldb-dap, js-debug); this bundled script drives it with bounded, monitorable output. **Prefer it over scraping `gdb`/`pdb` whenever the debugger speaks DAP.** Design modeled on oh-my-pi's `debug` tool (github.com/can1357/oh-my-pi). | 📖 **[references/tools/dap.md](references/tools/dap.md)** |
-**Failing to use these tools in their domain is a process failure, not a stylistic choice.** If the bug is in a browser and you did Phase 8 without Playwright, you are doing it wrong. If the bug is in a stripped binary and you read hex with `xxd`, you are doing it wrong. The references tell you how. Read them.
+**Failing to use these tools in their domain is a process failure, not a stylistic choice.** If the bug is in a browser and you did Phase 8 without omowright, you are doing it wrong. If the bug is in a stripped binary and you read hex with `xxd`, you are doing it wrong. The references tell you how. Read them.
---
@@ -74,8 +74,8 @@ Each phase has exactly one reference. Read it as you enter the phase — not in
| 5 | **User decision escalation** — only when evidence exhausted and the call has policy implications | [references/methodology/05-escalate.md](references/methodology/05-escalate.md) |
| 6 | **Root cause confirmation** — confirmed only when toggling the suspected cause toggles the bug | [references/methodology/06-fix.md](references/methodology/06-fix.md) |
| 7 | **Fix locked by a failing proof** — reuse the owner test that already fails or add one regression that fails on the pre-fix code, minimal green, no scope expansion | [references/methodology/06-fix.md](references/methodology/06-fix.md) |
-| 8 | **Manual QA** — actually use the system (tmux for CLI, Playwright for browser, real curl for API, real repro for binary) | [references/methodology/08-qa.md](references/methodology/08-qa.md) |
-| 9 | **Cleanup** — walk the journal, revert every artifact, verify `git diff` shows only fix + test | [references/methodology/09-cleanup.md](references/methodology/09-cleanup.md) |
+| 8 | **Manual QA** — actually use the system (tmux for CLI, omowright for browser, real curl for API, real repro for binary) | [references/methodology/08-qa.md](references/methodology/08-qa.md) |
+| 9 | **Cleanup** — walk the journal, revert every artifact, verify `git diff` shows only fix + test (plus any Phase 7 oversized-file split) | [references/methodology/09-cleanup.md](references/methodology/09-cleanup.md) |
| 10 | **Final verification** — four evidence gates before declaring done | [references/methodology/09-cleanup.md](references/methodology/09-cleanup.md) |
**Phase references are short by design.** Reading one takes a minute. Skipping one costs an hour.
diff --git a/plugins/omo/skills/debugging/references/methodology/02-investigate.md b/plugins/omo/skills/debugging/references/methodology/02-investigate.md
index fe838572..09224c0e 100644
--- a/plugins/omo/skills/debugging/references/methodology/02-investigate.md
+++ b/plugins/omo/skills/debugging/references/methodology/02-investigate.md
@@ -66,7 +66,7 @@ Branch depending on what's available.
When the `team_*` tools are present, create a **debug-squad** team and split investigation across members working on different evidence sources. This is the right default whenever you have ≥3 hypotheses and any of them would take >10 minutes to investigate single-threaded.
-**Team spec** — write to `~/.omo/teams/debug-squad/config.json`:
+**Team spec** — write to `.omo/teams/debug-squad/config.json` under the project root (the project-scoped spec location the team loader reads):
```json
{
@@ -86,7 +86,7 @@ When the `team_*` tools are present, create a **debug-squad** team and split inv
{
"kind": "category",
"category": "deep-low",
- "prompt": "You are the Reproduction Engineer. Your job: build the smallest reliable repro — a curl command, a vitest/pytest/go test, a tmux script, a Playwright script for browser bugs, a pwntools script for binary targets. It must reproduce on first try and be copy-pasteable by the Lead. Document exact input, expected output, observed output. Save repro artifacts under /tmp/ and tell the Lead to journal them. If the bug is browser-based you MUST use Playwright CLI — do not simulate with curl."
+ "prompt": "You are the Reproduction Engineer. Your job: build the smallest reliable repro — a curl command, a vitest/pytest/go test, a tmux script, an omowright script for browser bugs, a pwntools script for binary targets. It must reproduce on first try and be copy-pasteable by the Lead. Document exact input, expected output, observed output. Save repro artifacts under /tmp/ and tell the Lead to journal them. If the bug is browser-based you MUST drive a real browser through omowright (references/tools/browser-qa.md) — do not simulate with curl."
},
{
"kind": "category",
diff --git a/plugins/omo/skills/debugging/references/methodology/06-fix.md b/plugins/omo/skills/debugging/references/methodology/06-fix.md
index 9663a025..022ec4eb 100644
--- a/plugins/omo/skills/debugging/references/methodology/06-fix.md
+++ b/plugins/omo/skills/debugging/references/methodology/06-fix.md
@@ -100,6 +100,8 @@ Only cleanup directly related to the fix. Do not re-architect.
If the code around the fix is rough, note it in the journal as a follow-up for the user; do not expand scope here. Refactoring during a bugfix is how one-line fixes turn into hundred-line diffs nobody can review.
+**The one carve-out, and it runs before step 2, not after green:** if the fix must add lines to a file that already exceeds the `programming` skill's 250 pure-LOC ceiling (its DEFECT row forbids new lines in that file), first extract the unit you are touching into its own file as a separate, behavior-preserving move (the red test still fails for the same reason, every other test still passes), journal it, then make the minimal fix in the extracted file. The `programming` skill's SIZE_OK and pure-data-table exceptions still apply. That split ships with the fix; any other rough code stays a follow-up.
+
### 4. Regression — full suite green
Run the full test suite for the affected package (not just the one new test). Existing tests must still pass.
diff --git a/plugins/omo/skills/debugging/references/methodology/09-cleanup.md b/plugins/omo/skills/debugging/references/methodology/09-cleanup.md
index ab87f1c8..a94daa0a 100644
--- a/plugins/omo/skills/debugging/references/methodology/09-cleanup.md
+++ b/plugins/omo/skills/debugging/references/methodology/09-cleanup.md
@@ -108,13 +108,13 @@ Last gate before reporting done. All four gates must be true, and all four must
### The four gates
-1. **Red→green toggle confirmed** — show the failing test output from before the fix and passing output after. Both outputs visible in the reply or the journal.
+1. **Red→green toggle confirmed** — show the failing test output from before the fix and passing output after. Both outputs visible in the final message (the journal was removed in Phase 9).
2. **Full test suite green** — show the suite's final pass line (e.g. `42 passed in 3.14s`). Not just the new test.
3. **Manual QA reproduced the fix** — show the command or scenario that originally failed and its now-correct output. Verbatim, not paraphrased.
-4. **Working tree clean of debug artifacts** — show `git diff --stat` output containing only fix + test, plus `git status` clean of untracked debug files.
+4. **Working tree clean of debug artifacts** — show `git diff --stat` output containing only fix + test (plus the Phase 7 oversized-file split, if one was required), plus `git status` clean of untracked debug files.
If any of the four lacks evidence, you have not finished — return to the appropriate phase.
diff --git a/plugins/omo/skills/debugging/references/methodology/partial-runtime-evidence.md b/plugins/omo/skills/debugging/references/methodology/partial-runtime-evidence.md
index 986a3220..20f5bb44 100644
--- a/plugins/omo/skills/debugging/references/methodology/partial-runtime-evidence.md
+++ b/plugins/omo/skills/debugging/references/methodology/partial-runtime-evidence.md
@@ -59,7 +59,7 @@ HTTPS_PROXY=http://127.0.0.1:8888 SSL_CERT_FILE=~/.mitmproxy/mitmproxy-ca-cert.p
```bash
# DYLD_INSERT_LIBRARIES / LD_PRELOAD shim approach
# Wrap the network call to log payload, return a fake 200
-# See pwntools.md for shim examples
+# See ../runtimes/native-binary.md (DYLD_INSERT_LIBRARIES interception; "Option C: Wrap / shim") for shim examples
```
**Strength**: Wire-level ground truth, but requires the target to honor your proxy / preload.
diff --git a/plugins/omo/skills/debugging/references/runtimes/bundled-js-binary.md b/plugins/omo/skills/debugging/references/runtimes/bundled-js-binary.md
index a64c8073..4816514c 100644
--- a/plugins/omo/skills/debugging/references/runtimes/bundled-js-binary.md
+++ b/plugins/omo/skills/debugging/references/runtimes/bundled-js-binary.md
@@ -41,7 +41,7 @@ Step 3 is the unlock — once you have plaintext source on disk, the rest is nor
```bash
# Look for runtime-specific markers in plaintext strings
-strings -n 12 ./target 2>/dev/null | rg -iE 'bun|node_modules|webpack|esbuild|deno|pkg/lib|electron|pyinstaller|nexe|NODE_SEA_FUSE|NODE_SEA_BLOB|tauri|ESZIP_V2|denort' | head -20
+strings -n 12 ./target 2>/dev/null | rg -i 'bun|node_modules|webpack|esbuild|deno|pkg/lib|electron|pyinstaller|nexe|NODE_SEA_FUSE|NODE_SEA_BLOB|tauri|ESZIP_V2|denort' | head -20
```
| Marker pattern | Bundler | Source format |
diff --git a/plugins/omo/skills/debugging/references/runtimes/native-binary.md b/plugins/omo/skills/debugging/references/runtimes/native-binary.md
index c1b49a69..a793ab55 100644
--- a/plugins/omo/skills/debugging/references/runtimes/native-binary.md
+++ b/plugins/omo/skills/debugging/references/runtimes/native-binary.md
@@ -20,7 +20,7 @@ Quick check:
```bash
file ./target # Mach-O / ELF / PE - inconclusive
du -h ./target # 50 MB+ for a "simple CLI" → suspect bundled
-strings -n 12 ./target | rg -iE 'bun|node_modules|webpack|esbuild|deno|pkg/lib|electron|pyinstaller|nexe|NODE_SEA_FUSE|tauri' | head -5
+strings -n 12 ./target | rg -i 'bun|node_modules|webpack|esbuild|deno|pkg/lib|electron|pyinstaller|nexe|NODE_SEA_FUSE|tauri' | head -5
```
**If any hits** → close this file, open [bundled-js-binary.md](bundled-js-binary.md) instead. Following the Ghidra/pwndbg path on a bundled-app binary wastes hours decompiling the runtime VM while the app-level bundle is recoverable with the right per-bundler tool (plaintext for Bun/pkg/nexe/Electron-asar; eszip / V8-cache / `.pyc` for Deno / Node SEA / PyInstaller).
diff --git a/plugins/omo/skills/debugging/references/tools/browser-qa.md b/plugins/omo/skills/debugging/references/tools/browser-qa.md
index ca236027..d2e693d3 100644
--- a/plugins/omo/skills/debugging/references/tools/browser-qa.md
+++ b/plugins/omo/skills/debugging/references/tools/browser-qa.md
@@ -25,8 +25,6 @@ const profile = mkdtempSync(join(tmpdir(), "debug-repro-"))
const browser = await omowright.connectPipe({ browserPath, browserArgs: ["--headless", `--user-data-dir=${profile}`], storageRoot: profile })
const page = await browser.newTab("about:blank")
const trace = omowright.createTrace(page, { dir: traceDir }) // trace.jsonl + trace.har + before/after screenshots
-const consoleErrors = []
-page.on("console", (entry) => { if (entry.type === "error") consoleErrors.push(entry.text) })
try {
await trace.step("open", () => page.goto(url, { waitUntil: "load" }))
await trace.step("submit", async () => {
@@ -36,6 +34,7 @@ try {
await page.waitForURL(/\/done/, { timeout: 10_000 })
})
await Bun.write(pngPath, await page.screenshot())
+ const consoleErrors = (await page.console.logs({ levels: ["error"] })).map((entry) => entry.message)
} finally {
await trace.stop()
await browser.close()
diff --git a/plugins/omo/skills/frontend/SKILL.md b/plugins/omo/skills/frontend/SKILL.md
index bceddf5f..1348d3ce 100644
--- a/plugins/omo/skills/frontend/SKILL.md
+++ b/plugins/omo/skills/frontend/SKILL.md
@@ -5,7 +5,7 @@ description: "Builds, styles, and polishes anything drawn with HTML, CSS, or SVG
# Frontend
-This file is a router over `references/`; the rules live there. The flow is ground -> brief -> build -> subtract -> verify. The bar is restraint with a visible hierarchy: one primary action, the important thing first, nothing on the screen without a job. A quiet, correct screen that holds its hierarchy at 390 and 1440 in both themes is a finish. Atmosphere, motion, and award-grade surface work are opt-in: build them when the brief asks (a named brand, "premium", "make it stunning", a marketing page), never by default for an internal tool, dashboard, admin screen, report, or figure.
+This file is a router over `references/`; the rules live there. The flow is ground -> brief -> build -> subtract -> verify. The bar is restraint with a visible hierarchy: one primary action, the important thing first, nothing on the screen without a job. A quiet, correct screen that holds its hierarchy at 390 and 1440 in both themes is a finish. Atmosphere, motion, and award-grade surface work are opt-in: build them when the brief asks (a named brand, "premium", "make it stunning", a marketing page), never by default for an internal tool, dashboard, admin screen, report, or figure. An inline page shown beside a reply (a chart, table, or diagram for `show_html_page`, `html_preview`, or `html_render`) follows the `visualize` skill when it is available; either way it is exempt from the `DESIGN.md` gate, the Lighthouse audit, and the research lanes, and keeps the build rules, the Draft guard, and the lint.
## Route: name the references, read exactly those
@@ -131,7 +131,7 @@ uv run $SKILL_DIR/scripts/perfection/lighthouse-audit.py https://localhost:3000
```bash
python3 -B $SKILL_DIR/references/ui-ux-db/scripts/search.py "<query>" --design-system -p "Project" # design-system generation
-python3 -B $SKILL_DIR/references/ui-ux-db/scripts/search.py "<query>" --domain <domain> # product style typography color landing chart ux react web prompt
+python3 -B $SKILL_DIR/references/ui-ux-db/scripts/search.py "<query>" --domain <domain> # product style typography color landing chart ux react web icons google-fonts
python3 -B $SKILL_DIR/references/ui-ux-db/scripts/search.py "<query>" --stack <stack> # html-tailwind react nextjs vue svelte astro swiftui react-native flutter shadcn jetpack-compose
```
diff --git a/plugins/omo/skills/frontend/references/design/design-system-architecture.md b/plugins/omo/skills/frontend/references/design/design-system-architecture.md
index 3fa6e37d..c74e271a 100644
--- a/plugins/omo/skills/frontend/references/design/design-system-architecture.md
+++ b/plugins/omo/skills/frontend/references/design/design-system-architecture.md
@@ -60,7 +60,7 @@ rather than borders, creating layers you feel more than see."
| Status/info | --status-info | #2563EB | #3B82F6 | Informational |
### Rules
-- Accent marks the one or two most likely actions on a screen, on the control's background rather than its glyph or label. Peer choices differ by style, never by size. Nothing decorative carries accent.
+- Accent marks the screen's one primary action, on the control's background rather than its glyph or label; a second likely action takes a quieter style. Peer choices differ by style, never by size. Nothing decorative carries accent.
- Never introduce a color not in this table. Extend the table first.
## 3. Typography
diff --git a/plugins/omo/skills/frontend/references/design/print-paged-media.md b/plugins/omo/skills/frontend/references/design/print-paged-media.md
index 47d50629..8773127d 100644
--- a/plugins/omo/skills/frontend/references/design/print-paged-media.md
+++ b/plugins/omo/skills/frontend/references/design/print-paged-media.md
@@ -73,4 +73,4 @@ pdftoppm -png -r 150 report.pdf out/page # one PNG per page
Read every page image for: blank or near-empty pages, a block stranded alone after a keep-together push, a table or figure split mid-exhibit, a heading orphaned at a page foot, clipped or overflowing text, and a running header or footer that drifted or vanished.
-Extracting the text proves the words are present. It cannot see any defect in this list - layout is exactly the information that extraction discards. Fix, re-render, and look again until the pages are clean; the same standard governs the `ulw-research` delivery gate and the `mass-ulw` verification wave.
+Extracting the text proves the words are present. It cannot see any defect in this list - layout is exactly the information that extraction discards. Fix, re-render, and look again until the pages are clean. The `ulw-research` delivery gate and the `mass-ulw` verification wave hold the same page-by-page inspection standard; `ulw-research` bounds its repair loop (its `repair decide` stop rules) and ships any residual defect listed in its manifest.
diff --git a/plugins/omo/skills/frontend/references/perfection/README.md b/plugins/omo/skills/frontend/references/perfection/README.md
index c8c68ff8..dd510183 100644
--- a/plugins/omo/skills/frontend/references/perfection/README.md
+++ b/plugins/omo/skills/frontend/references/perfection/README.md
@@ -90,7 +90,6 @@ Quick audit via the cross-platform Python CLI (macOS, Linux, Windows):
```bash
uv run $SKILL_DIR/scripts/perfection/lighthouse-audit.py https://localhost:3000
-uv run $SKILL_DIR/scripts/perfection/lighthouse-audit.py https://localhost:3000 --threshold 95
uv run $SKILL_DIR/scripts/perfection/lighthouse-audit.py https://localhost:3000 --desktop-only
bun $SKILL_DIR/scripts/perfection/check-draft-guard.ts src/ # exit 1 = accent stripe or outline, promo copy, emoji icon, hype badge, or vanity stat
```
diff --git a/plugins/omo/skills/frontend/references/perfection/react-perf-tooling.md b/plugins/omo/skills/frontend/references/perfection/react-perf-tooling.md
index 0f135b90..b38c5a9a 100644
--- a/plugins/omo/skills/frontend/references/perfection/react-perf-tooling.md
+++ b/plugins/omo/skills/frontend/references/perfection/react-perf-tooling.md
@@ -20,17 +20,38 @@ If the project does not yet have react-scan and react-doctor wired into its dev
import { chromium } from "playwright";
import { playAudit } from "playwright-lighthouse";
+declare global {
+ interface Window {
+ __renderEvents: unknown[];
+ }
+}
+
+// Narrow only the fields this gate reads from a react-scan commit event.
+function hasUnnecessaryRender(event: unknown): boolean {
+ if (typeof event !== "object" || event === null || !("tree" in event) || !Array.isArray(event.tree)) return false;
+ return event.tree.some(
+ (node: unknown) =>
+ typeof node === "object" &&
+ node !== null &&
+ "changeDescription" in node &&
+ typeof node.changeDescription === "object" &&
+ node.changeDescription !== null &&
+ "kind" in node.changeDescription &&
+ node.changeDescription.kind === "unnecessary",
+ );
+}
+
const browser = await chromium.launch({ channel: "chrome" });
const context = await browser.newContext();
// Inject react-scan/lite BEFORE the app boots
await context.addInitScript(() => {
- // @ts-ignore — pulled from the project's node_modules or a self-hosted bundle
+ // react-scan is a dev dependency of the project (see ../design/react-dev-tooling-skill.md), so its types resolve
import("react-scan/lite").then(({ instrument }) => {
- (window as any).__renderEvents = [];
+ window.__renderEvents = [];
instrument({
- onEvent: (event: any) => {
- if (event.kind === "commit") (window as any).__renderEvents.push(event);
+ onEvent: (event) => {
+ if (event.kind === "commit") window.__renderEvents.push(event);
},
recordChangeDescriptions: true,
includeFiberSource: true,
@@ -51,10 +72,8 @@ await playAudit({
});
// Pull render events and assert on render quality
-const events = await page.evaluate(() => (window as any).__renderEvents);
-const unnecessary = events.filter((e: any) =>
- e.tree?.some((node: any) => node.changeDescription?.kind === "unnecessary"),
-);
+const events = await page.evaluate(() => window.__renderEvents);
+const unnecessary = events.filter(hasUnnecessaryRender);
if (unnecessary.length > 0) {
console.error(`FAIL: ${unnecessary.length} unnecessary renders detected during audit`);
diff --git a/plugins/omo/skills/frontend/scripts/perfection/lighthouse-audit.py b/plugins/omo/skills/frontend/scripts/perfection/lighthouse-audit.py
index 10bdb223..dfd31678 100644
--- a/plugins/omo/skills/frontend/scripts/perfection/lighthouse-audit.py
+++ b/plugins/omo/skills/frontend/scripts/perfection/lighthouse-audit.py
@@ -16,7 +16,6 @@
# 3. Run:
# uv run lighthouse-audit.py https://example.com
# uv run lighthouse-audit.py https://example.com --desktop-only
-# uv run lighthouse-audit.py https://example.com --threshold 95
# ──────────────────
"""Lighthouse audit via real Playwright Chrome.
diff --git a/plugins/omo/skills/git-master/SKILL.md b/plugins/omo/skills/git-master/SKILL.md
index 640995d3..4460756f 100644
--- a/plugins/omo/skills/git-master/SKILL.md
+++ b/plugins/omo/skills/git-master/SKILL.md
@@ -16,7 +16,7 @@ Classify the request first:
- `HISTORY`: answer when, where, who, why, or which commit changed something.
- `STATUS`: inspect branch, diff, or working-tree state without changing it.
-Do not commit, rebase, push, force-push, reset, stash-pop, or delete anything unless the user explicitly asked for that operation. If the request is only investigative, report findings and stop.
+Do not commit, rebase, push, force-push, reset, stash-pop, or delete anything unless the user explicitly asked for that operation. When a workflow the user started mandates one of them (ulw-loop commits each verified unit, ulw-execute lands its branches), that workflow's instruction is the ask. If the request is only investigative, report findings and stop.
## Ground Truth
@@ -38,7 +38,17 @@ Missing upstream or missing `main`/`master` is normal. Fall back to the best ava
## PR Body Evidence Attachments
-When a PR body needs screenshots or terminal PNGs, use the repo reference at `docs/reference/github-attachment-upload.md`. The allowed hosting path is GitHub user attachments from the authenticated web attachment flow; never commit temporary images, never use GitHub Releases for PR evidence, and never use external image hosts. Do not log browser cookies, CSRF tokens, S3 form fields, or upload headers.
+When a PR body needs screenshots or terminal PNGs, the allowed hosting path is GitHub user attachments from the authenticated web attachment flow; never commit temporary images, never use GitHub Releases for PR evidence, and never use external image hosts. Do not log browser cookies, CSRF tokens, S3 form fields, or upload headers.
+
+The flow needs an authenticated GitHub web session (a `gh` API token alone is not enough):
+
+1. Open the target PR or issue page in that session and read its file-attachment CSRF token and repository id.
+2. `POST https://github.com/upload/policies/assets` with `repository_id`, `name`, `size`, `content_type`, and that token as `authenticity_token`.
+3. Upload the bytes to the returned S3 URL with the returned form fields exactly as given.
+4. `PUT https://github.com/upload/assets/:id` with the returned `asset_upload_authenticity_token`.
+5. Put only the final `https://github.com/user-attachments/assets/<uuid>` URL in the PR body (write the body to a temp file and pass it with `gh pr edit --body-file`).
+
+If no authenticated browser session is available, leave the local evidence paths in the PR body and state the blocker.
## Commit Mode
diff --git a/plugins/omo/skills/init-deep/SKILL.md b/plugins/omo/skills/init-deep/SKILL.md
index e39eb151..b55b44c3 100644
--- a/plugins/omo/skills/init-deep/SKILL.md
+++ b/plugins/omo/skills/init-deep/SKILL.md
@@ -195,7 +195,7 @@ for each background task ID (`bg_...`): background_output(task_id="bg_...")
```
AGENTS_LOCATIONS = [
{ path: ".", type: "root" },
- { path: "src/hooks", score: 18, reason: "high complexity" },
+ { path: "src/hooks", score: 16, reason: "high complexity" },
{ path: "src/api", score: 12, reason: "distinct domain" }
]
```
diff --git a/plugins/omo/skills/lsp-setup/SKILL.md b/plugins/omo/skills/lsp-setup/SKILL.md
index f55a8dd7..6d6c76bd 100644
--- a/plugins/omo/skills/lsp-setup/SKILL.md
+++ b/plugins/omo/skills/lsp-setup/SKILL.md
@@ -27,11 +27,11 @@ reference before installing or configuring anything**.
| `.py .pyi` | `references/python/README.md` |
| `.go` | `references/go/README.md` |
| `.rs` | `references/rust/README.md` |
-| `.c .cpp .cc .cxx .h .hpp .hh .hxx` | `references/c-cpp/README.md` |
+| `.c .cpp .cc .cxx .c++ .h .hpp .hh .hxx .h++` | `references/c-cpp/README.md` |
| `.java` | `references/java/README.md` |
| `.kt .kts` | `references/kotlin/README.md` |
| `.cs .razor .cshtml` | `references/csharp/README.md` |
-| `.swift` | `references/swift/README.md` |
+| `.swift .m .mm` | `references/swift/README.md` |
| `.rb .rake .gemspec .ru` | `references/ruby/README.md` |
| `.php` | `references/php/README.md` |
| `.dart` | `references/dart/README.md` |
@@ -75,13 +75,20 @@ command -v <server-executable> # e.g. typescript-language-server, gopls, rust-
Most builtin servers need **no config** — they are resolved automatically by
file extension. Write config only to: pick between competing servers, set a
-`priority`, pass `initialization` options, override `extensions`, set `env`, or
-`disable` a server.
+`priority`, pass `initialization` options, override `extensions`, set `env`
+(user config only), or `disable` a server.
-Two project-scoped config files, **identical JSON shape**:
+Config files per harness, **identical JSON shape**. Each harness reads the
+first project file that exists, plus one user file:
-- Codex harness → `.codex/lsp-client.json` (user: `~/.codex/lsp-client.json`)
-- OpenCode/omo harness → `.opencode/lsp.json` (also `.omo/lsp.json`)
+| Harness | Project config | User config |
+|---|---|---|
+| Codex | `.codex/lsp-client.json` | `$CODEX_HOME/lsp-client.json` (default `~/.codex/lsp-client.json`) |
+| OpenCode | `.opencode/lsp.json`, then `.omo/lsp.json`, then `.omo/lsp-client.json` | `lsp.json` in the OpenCode config dir (default `~/.config/opencode/lsp.json`) |
+| OmO native | `.omo/lsp-client.json`, then `.pi/lsp-client.json` | `~/.omo/lsp-client.json` (`~/.pi/lsp-client.json` when only that one exists) |
+
+A standalone `lsp-tools-mcp` launch reads the paths in
+`LSP_TOOLS_MCP_PROJECT_CONFIG` / `LSP_TOOLS_MCP_USER_CONFIG` instead.
```jsonc
{
@@ -100,14 +107,16 @@ Two project-scoped config files, **identical JSON shape**:
Rules enforced by `config-loader.ts`:
-- In a **project** config (`.codex/lsp-client.json`, `.opencode/lsp.json`) an
- entry whose id is a **builtin** server inherits `command` automatically — you
- only override `extensions` / `priority` / `initialization`. A non-builtin id
- in a project config is **ignored**.
-- To define a **fully custom** (non-builtin) server with its own `command`, put
- it in the **user** config (`~/.codex/lsp-client.json`, or the path set by
- `LSP_TOOLS_MCP_USER_CONFIG`), where `command` + `extensions` are honored.
-- Project entries win over user entries; both win over builtin defaults.
+- In a **project** config an entry whose id is a **builtin** server inherits
+ `command` automatically — you only override `extensions` / `priority` /
+ `initialization` / `disabled`. Its `env` is dropped, and a non-builtin id in
+ a project config is **ignored**.
+- To set `env`, or to define a **fully custom** (non-builtin) server with its
+ own `command`, put it in the **user** config from the table above, where
+ `command` + `extensions` + `env` are honored.
+- Project entries win over user entries; both win over builtin defaults. A user
+ entry is skipped when an enabled project entry has the same id, so keep an id
+ that needs `env` out of the project config.
Each language reference gives a ready-to-paste snippet.
diff --git a/plugins/omo/skills/lsp-setup/references/bash/README.md b/plugins/omo/skills/lsp-setup/references/bash/README.md
index 80f07bbc..ac201d42 100644
--- a/plugins/omo/skills/lsp-setup/references/bash/README.md
+++ b/plugins/omo/skills/lsp-setup/references/bash/README.md
@@ -27,17 +27,17 @@ command -v shellcheck
## Configure
-Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in `.codex/lsp-client.json` (Codex) AND `.opencode/lsp.json` (OpenCode/omo):
+Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in every harness's project config (per-harness paths: the Configure step in `SKILL.md`):
```json
{ "lsp": { "bash": { "priority": 100 } } }
```
-For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled`/`env`. A fully custom (non-builtin) server with its own `command` must go in the USER config (`~/.codex/lsp-client.json`).
+For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled` (a project entry drops `env`). `env`, and a fully custom (non-builtin) server with its own `command`, must go in your harness's USER config (see the Configure step in `SKILL.md`).
### Initialization options (only if commonly needed)
-None commonly required. `bash-language-server` discovers `shellcheck` on PATH automatically. To point at a non-PATH binary, export `SHELLCHECK_PATH` via `env`:
+None commonly required. `bash-language-server` discovers `shellcheck` on PATH automatically. To point at a non-PATH binary, export `SHELLCHECK_PATH` via `env` (USER config only; a project entry drops `env`):
```json
{ "lsp": { "bash": { "env": { "SHELLCHECK_PATH": "/opt/bin/shellcheck" } } } }
diff --git a/plugins/omo/skills/lsp-setup/references/c-cpp/README.md b/plugins/omo/skills/lsp-setup/references/c-cpp/README.md
index 17abb311..cbf2352d 100644
--- a/plugins/omo/skills/lsp-setup/references/c-cpp/README.md
+++ b/plugins/omo/skills/lsp-setup/references/c-cpp/README.md
@@ -20,13 +20,13 @@ command -v clangd
## Configure
-Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in `.codex/lsp-client.json` (Codex) AND `.opencode/lsp.json` (OpenCode/omo):
+Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in every harness's project config (per-harness paths: the Configure step in `SKILL.md`):
```json
{ "lsp": { "clangd": { "priority": 100 } } }
```
-For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled`/`env`. A fully custom (non-builtin) server with its own `command` must go in the USER config (`~/.codex/lsp-client.json`).
+For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled` (a project entry drops `env`). `env`, and a fully custom (non-builtin) server with its own `command`, must go in your harness's USER config (see the Configure step in `SKILL.md`).
### Initialization options (only if commonly needed)
diff --git a/plugins/omo/skills/lsp-setup/references/csharp/README.md b/plugins/omo/skills/lsp-setup/references/csharp/README.md
index b59b2bd8..e37f8885 100644
--- a/plugins/omo/skills/lsp-setup/references/csharp/README.md
+++ b/plugins/omo/skills/lsp-setup/references/csharp/README.md
@@ -22,13 +22,13 @@ command -v csharp-ls
## Configure
-Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in `.codex/lsp-client.json` (Codex) AND `.opencode/lsp.json` (OpenCode/omo):
+Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in every harness's project config (per-harness paths: the Configure step in `SKILL.md`):
```json
{ "lsp": { "csharp": { "priority": 100 } } }
```
-For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled`/`env`. A fully custom (non-builtin) server with its own `command` must go in the USER config (`~/.codex/lsp-client.json`).
+For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled` (a project entry drops `env`). `env`, and a fully custom (non-builtin) server with its own `command`, must go in your harness's USER config (see the Configure step in `SKILL.md`).
### Initialization options (only if commonly needed)
diff --git a/plugins/omo/skills/lsp-setup/references/dart/README.md b/plugins/omo/skills/lsp-setup/references/dart/README.md
index 63757d57..c3bd884c 100644
--- a/plugins/omo/skills/lsp-setup/references/dart/README.md
+++ b/plugins/omo/skills/lsp-setup/references/dart/README.md
@@ -20,13 +20,13 @@ command -v dart
## Configure
-Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in `.codex/lsp-client.json` (Codex) AND `.opencode/lsp.json` (OpenCode/omo):
+Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in every harness's project config (per-harness paths: the Configure step in `SKILL.md`):
```json
{ "lsp": { "dart": { "priority": 100 } } }
```
-For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled`/`env`. A fully custom (non-builtin) server with its own `command` must go in the USER config (`~/.codex/lsp-client.json`).
+For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled` (a project entry drops `env`). `env`, and a fully custom (non-builtin) server with its own `command`, must go in your harness's USER config (see the Configure step in `SKILL.md`).
### Initialization options (only if commonly needed)
diff --git a/plugins/omo/skills/lsp-setup/references/elixir/README.md b/plugins/omo/skills/lsp-setup/references/elixir/README.md
index b85de4a9..b79640fc 100644
--- a/plugins/omo/skills/lsp-setup/references/elixir/README.md
+++ b/plugins/omo/skills/lsp-setup/references/elixir/README.md
@@ -21,13 +21,13 @@ command -v elixir-ls
## Configure
-Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in `.codex/lsp-client.json` (Codex) AND `.opencode/lsp.json` (OpenCode/omo):
+Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in every harness's project config (per-harness paths: the Configure step in `SKILL.md`):
```json
{ "lsp": { "elixir-ls": { "priority": 100 } } }
```
-For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled`/`env`. A fully custom (non-builtin) server with its own `command` must go in the USER config (`~/.codex/lsp-client.json`).
+For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled` (a project entry drops `env`). `env`, and a fully custom (non-builtin) server with its own `command`, must go in your harness's USER config (see the Configure step in `SKILL.md`).
### Initialization options (only if commonly needed)
diff --git a/plugins/omo/skills/lsp-setup/references/go/README.md b/plugins/omo/skills/lsp-setup/references/go/README.md
index f25dd0fb..887d5ac6 100644
--- a/plugins/omo/skills/lsp-setup/references/go/README.md
+++ b/plugins/omo/skills/lsp-setup/references/go/README.md
@@ -25,13 +25,13 @@ command -v gopls
## Configure
-Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in `.codex/lsp-client.json` (Codex) AND `.opencode/lsp.json` (OpenCode/omo):
+Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in every harness's project config (per-harness paths: the Configure step in `SKILL.md`):
```json
{ "lsp": { "gopls": { "priority": 100 } } }
```
-For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled`/`env`. A fully custom (non-builtin) server with its own `command` must go in the USER config (`~/.codex/lsp-client.json`).
+For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled` (a project entry drops `env`). `env`, and a fully custom (non-builtin) server with its own `command`, must go in your harness's USER config (see the Configure step in `SKILL.md`).
### Initialization options (only if commonly needed)
diff --git a/plugins/omo/skills/lsp-setup/references/haskell/README.md b/plugins/omo/skills/lsp-setup/references/haskell/README.md
index 4cbcc304..e85b617c 100644
--- a/plugins/omo/skills/lsp-setup/references/haskell/README.md
+++ b/plugins/omo/skills/lsp-setup/references/haskell/README.md
@@ -27,13 +27,13 @@ command -v haskell-language-server-wrapper
## Configure
-Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in `.codex/lsp-client.json` (Codex) AND `.opencode/lsp.json` (OpenCode/omo):
+Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in every harness's project config (per-harness paths: the Configure step in `SKILL.md`):
```json
{ "lsp": { "haskell-language-server": { "priority": 100 } } }
```
-For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled`/`env`. A fully custom (non-builtin) server with its own `command` must go in the USER config (`~/.codex/lsp-client.json`).
+For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled` (a project entry drops `env`). `env`, and a fully custom (non-builtin) server with its own `command`, must go in your harness's USER config (see the Configure step in `SKILL.md`).
### Initialization options (only if commonly needed)
diff --git a/plugins/omo/skills/lsp-setup/references/java/README.md b/plugins/omo/skills/lsp-setup/references/java/README.md
index 0cb34f8e..32942e25 100644
--- a/plugins/omo/skills/lsp-setup/references/java/README.md
+++ b/plugins/omo/skills/lsp-setup/references/java/README.md
@@ -20,17 +20,17 @@ command -v jdtls
## Configure
-Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in `.codex/lsp-client.json` (Codex) AND `.opencode/lsp.json` (OpenCode/omo):
+Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in every harness's project config (per-harness paths: the Configure step in `SKILL.md`):
```json
{ "lsp": { "jdtls": { "priority": 100 } } }
```
-For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled`/`env`. A fully custom (non-builtin) server with its own `command` must go in the USER config (`~/.codex/lsp-client.json`).
+For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled` (a project entry drops `env`). `env`, and a fully custom (non-builtin) server with its own `command`, must go in your harness's USER config (see the Configure step in `SKILL.md`).
### Initialization options (only if commonly needed)
-jdtls maintains a per-project **workspace data directory** and the **first index is slow** (it resolves the full classpath and builds). Point `JAVA_HOME` at a JDK 17+ if `jdtls` cannot find one:
+jdtls maintains a per-project **workspace data directory** and the **first index is slow** (it resolves the full classpath and builds). Point `JAVA_HOME` at a JDK 17+ if `jdtls` cannot find one (USER config only; a project entry drops `env`):
```json
{ "lsp": { "jdtls": { "env": { "JAVA_HOME": "/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home" } } } }
diff --git a/plugins/omo/skills/lsp-setup/references/julia/README.md b/plugins/omo/skills/lsp-setup/references/julia/README.md
index 9fc80cfe..98a3e695 100644
--- a/plugins/omo/skills/lsp-setup/references/julia/README.md
+++ b/plugins/omo/skills/lsp-setup/references/julia/README.md
@@ -28,17 +28,17 @@ command -v julia
## Configure
-Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in `.codex/lsp-client.json` (Codex) AND `.opencode/lsp.json` (OpenCode/omo):
+Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in every harness's project config (per-harness paths: the Configure step in `SKILL.md`):
```json
{ "lsp": { "julials": { "priority": 100 } } }
```
-For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled`/`env`. A fully custom (non-builtin) server with its own `command` must go in the USER config (`~/.codex/lsp-client.json`).
+For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled` (a project entry drops `env`). `env`, and a fully custom (non-builtin) server with its own `command`, must go in your harness's USER config (see the Configure step in `SKILL.md`).
### Initialization options (only if commonly needed)
-None commonly required. To pin which environment hosts LanguageServer.jl, set `JULIA_PROJECT` (or `JULIA_DEPOT_PATH`) via `env`:
+None commonly required. To pin which environment hosts LanguageServer.jl, set `JULIA_PROJECT` (or `JULIA_DEPOT_PATH`) via `env` (USER config only; a project entry drops `env`):
```json
{ "lsp": { "julials": { "env": { "JULIA_PROJECT": "@lsp" } } } }
diff --git a/plugins/omo/skills/lsp-setup/references/kotlin/README.md b/plugins/omo/skills/lsp-setup/references/kotlin/README.md
index 83761e60..2f150c4c 100644
--- a/plugins/omo/skills/lsp-setup/references/kotlin/README.md
+++ b/plugins/omo/skills/lsp-setup/references/kotlin/README.md
@@ -1,6 +1,6 @@
# Kotlin — LSP setup
-- **Builtin server:** `kotlin-ls` — `kotlin-lsp`
+- **Builtin server:** `kotlin-ls` — `kotlin-lsp --stdio`
- **Extensions:** `.kt .kts`
- **Install hint:** `https://github.com/Kotlin/kotlin-lsp`
@@ -22,17 +22,17 @@ command -v kotlin-lsp
## Configure
-Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in `.codex/lsp-client.json` (Codex) AND `.opencode/lsp.json` (OpenCode/omo):
+Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in every harness's project config (per-harness paths: the Configure step in `SKILL.md`):
```json
{ "lsp": { "kotlin-ls": { "priority": 100 } } }
```
-For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled`/`env`. A fully custom (non-builtin) server with its own `command` must go in the USER config (`~/.codex/lsp-client.json`).
+For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled` (a project entry drops `env`). `env`, and a fully custom (non-builtin) server with its own `command`, must go in your harness's USER config (see the Configure step in `SKILL.md`).
### Initialization options (only if commonly needed)
-None commonly required. If `kotlin-lsp` cannot find a Java runtime, set `JAVA_HOME`:
+None commonly required. If `kotlin-lsp` cannot find a Java runtime, set `JAVA_HOME` (USER config only; a project entry drops `env`):
```json
{ "lsp": { "kotlin-ls": { "env": { "JAVA_HOME": "/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home" } } } }
diff --git a/plugins/omo/skills/lsp-setup/references/lua/README.md b/plugins/omo/skills/lsp-setup/references/lua/README.md
index 1edb98b9..2743a96f 100644
--- a/plugins/omo/skills/lsp-setup/references/lua/README.md
+++ b/plugins/omo/skills/lsp-setup/references/lua/README.md
@@ -20,13 +20,13 @@ command -v lua-language-server
## Configure
-Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in `.codex/lsp-client.json` (Codex) AND `.opencode/lsp.json` (OpenCode/omo):
+Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in every harness's project config (per-harness paths: the Configure step in `SKILL.md`):
```json
{ "lsp": { "lua-ls": { "priority": 100 } } }
```
-For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled`/`env`. A fully custom (non-builtin) server with its own `command` must go in the USER config (`~/.codex/lsp-client.json`).
+For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled` (a project entry drops `env`). `env`, and a fully custom (non-builtin) server with its own `command`, must go in your harness's USER config (see the Configure step in `SKILL.md`).
### Initialization options (only if commonly needed)
diff --git a/plugins/omo/skills/lsp-setup/references/php/README.md b/plugins/omo/skills/lsp-setup/references/php/README.md
index 23ae22ce..7f127cc1 100644
--- a/plugins/omo/skills/lsp-setup/references/php/README.md
+++ b/plugins/omo/skills/lsp-setup/references/php/README.md
@@ -20,13 +20,13 @@ command -v intelephense
## Configure
-Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in `.codex/lsp-client.json` (Codex) AND `.opencode/lsp.json` (OpenCode/omo):
+Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in every harness's project config (per-harness paths: the Configure step in `SKILL.md`):
```json
{ "lsp": { "php": { "priority": 100 } } }
```
-For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled`/`env`. A fully custom (non-builtin) server with its own `command` must go in the USER config (`~/.codex/lsp-client.json`).
+For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled` (a project entry drops `env`). `env`, and a fully custom (non-builtin) server with its own `command`, must go in your harness's USER config (see the Configure step in `SKILL.md`).
### Initialization options (only if commonly needed)
@@ -51,7 +51,7 @@ Without a key the server runs fine in free mode.
- **phpactor** (not builtin): `phpactor language-server`. Pure-PHP, no Node dependency.
## Troubleshooting
-- **PATH:** `intelephense` must be on PATH; reopen the shell after a global npm install. If missing, check `npm bin -g` is on PATH.
+- **PATH:** `intelephense` must be on PATH; reopen the shell after a global npm install. If missing, check that `$(npm prefix -g)/bin` (Windows: `npm prefix -g`) is on PATH.
- **No Node:** Intelephense fails to start without Node.js. Install Node, then reinstall.
- **Wrong PHP version inference:** set `intelephense.environment.phpVersion` via `initialization` to match your project.
diff --git a/plugins/omo/skills/lsp-setup/references/python/README.md b/plugins/omo/skills/lsp-setup/references/python/README.md
index 774e7dee..e9080a89 100644
--- a/plugins/omo/skills/lsp-setup/references/python/README.md
+++ b/plugins/omo/skills/lsp-setup/references/python/README.md
@@ -21,13 +21,13 @@ command -v basedpyright-langserver
## Configure
-Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in `.codex/lsp-client.json` (Codex) AND `.opencode/lsp.json` (OpenCode/omo):
+Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in every harness's project config (per-harness paths: the Configure step in `SKILL.md`):
```json
{ "lsp": { "basedpyright": { "priority": 100 } } }
```
-For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled`/`env`. A fully custom (non-builtin) server with its own `command` must go in the USER config (`~/.codex/lsp-client.json`).
+For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled` (a project entry drops `env`). `env`, and a fully custom (non-builtin) server with its own `command`, must go in your harness's USER config (see the Configure step in `SKILL.md`).
### Initialization options (only if commonly needed)
@@ -36,27 +36,28 @@ or `[tool.basedpyright]` in `pyproject.toml`, not the LSP config.
## Choosing a server
-All four are builtin. Type checkers and the linter serve different roles — run a
-type server, and optionally `ruff` ALONGSIDE it (not instead).
+All four are builtin. The engine starts ONE server per extension: the first
+installed candidate after ordering by config source (project > user > builtin)
+and then `priority`. So `ruff` cannot run alongside a type server for `.py` —
+choosing it replaces type checking with lint/format diagnostics.
| id | command | install | role |
| ------------- | ----------------------------- | ---------------------- | --------------------------------------- |
| `basedpyright`| `basedpyright-langserver --stdio` | `pip install basedpyright` | strictest types, **default** |
| `pyright` | `pyright-langserver --stdio` | `pip install pyright` | upstream Microsoft type checker |
| `ty` | `ty server` | `pip install ty` | Astral, very fast, pre-1.0/experimental |
-| `ruff` | `ruff server` | `pip install ruff` | lint + format only, complements a type server |
+| `ruff` | `ruff server` | `pip install ruff` | lint + format only, no type checking |
-Recommended priority: **basedpyright** (default) > pyright > ty (experimental).
-`ruff` complements via priority — it does not type-check, so keep a type server
-enabled.
+Recommended: **basedpyright** (default) > pyright > ty (experimental). Keep a
+type server as the `.py` server; run `ruff` from the shell or a pre-commit hook
+for lint/format.
-Enable ruff alongside basedpyright, disabling pyright:
+Switch this project to pyright:
```json
{ "lsp": {
- "basedpyright": { "priority": 100 },
- "ruff": { "priority": 90 },
- "pyright": { "disabled": true }
+ "pyright": { "priority": 100 },
+ "basedpyright": { "disabled": true }
} }
```
diff --git a/plugins/omo/skills/lsp-setup/references/ruby/README.md b/plugins/omo/skills/lsp-setup/references/ruby/README.md
index f377216e..3f85c499 100644
--- a/plugins/omo/skills/lsp-setup/references/ruby/README.md
+++ b/plugins/omo/skills/lsp-setup/references/ruby/README.md
@@ -22,13 +22,13 @@ command -v rubocop
## Configure
-Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in `.codex/lsp-client.json` (Codex) AND `.opencode/lsp.json` (OpenCode/omo):
+Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in every harness's project config (per-harness paths: the Configure step in `SKILL.md`):
```json
{ "lsp": { "ruby-lsp": { "priority": 100 } } }
```
-For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled`/`env`. A fully custom (non-builtin) server with its own `command` must go in the USER config (`~/.codex/lsp-client.json`).
+For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled` (a project entry drops `env`). `env`, and a fully custom (non-builtin) server with its own `command`, must go in your harness's USER config (see the Configure step in `SKILL.md`).
### Initialization options (only if commonly needed)
diff --git a/plugins/omo/skills/lsp-setup/references/rust/README.md b/plugins/omo/skills/lsp-setup/references/rust/README.md
index beb35dc3..479fe8fc 100644
--- a/plugins/omo/skills/lsp-setup/references/rust/README.md
+++ b/plugins/omo/skills/lsp-setup/references/rust/README.md
@@ -22,13 +22,13 @@ command -v rust-analyzer
## Configure
-Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in `.codex/lsp-client.json` (Codex) AND `.opencode/lsp.json` (OpenCode/omo):
+Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in every harness's project config (per-harness paths: the Configure step in `SKILL.md`):
```json
{ "lsp": { "rust": { "priority": 100 } } }
```
-For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled`/`env`. A fully custom (non-builtin) server with its own `command` must go in the USER config (`~/.codex/lsp-client.json`).
+For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled` (a project entry drops `env`). `env`, and a fully custom (non-builtin) server with its own `command`, must go in your harness's USER config (see the Configure step in `SKILL.md`).
### Initialization options (only if commonly needed)
diff --git a/plugins/omo/skills/lsp-setup/references/swift/README.md b/plugins/omo/skills/lsp-setup/references/swift/README.md
index 0f626b4a..c793e0e3 100644
--- a/plugins/omo/skills/lsp-setup/references/swift/README.md
+++ b/plugins/omo/skills/lsp-setup/references/swift/README.md
@@ -1,7 +1,7 @@
# Swift — LSP setup
- **Builtin server:** `sourcekit-lsp` — `sourcekit-lsp`
-- **Extensions:** `.swift .objc .objcpp`
+- **Extensions:** `.swift .m .mm`
- **Install hint:** `Included with Xcode or the Swift toolchain`
## Install
@@ -20,13 +20,13 @@ command -v sourcekit-lsp
## Configure
-Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in `.codex/lsp-client.json` (Codex) AND `.opencode/lsp.json` (OpenCode/omo):
+Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in every harness's project config (per-harness paths: the Configure step in `SKILL.md`):
```json
{ "lsp": { "sourcekit-lsp": { "priority": 100 } } }
```
-For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled`/`env`. A fully custom (non-builtin) server with its own `command` must go in the USER config (`~/.codex/lsp-client.json`).
+For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled` (a project entry drops `env`). `env`, and a fully custom (non-builtin) server with its own `command`, must go in your harness's USER config (see the Configure step in `SKILL.md`).
### Initialization options (only if commonly needed)
@@ -41,7 +41,7 @@ None commonly required. For best results the project needs a **SwiftPM `Package.
- **PATH:** `sourcekit-lsp` on PATH; reopen shell after install (or after `xcode-select -s`).
- **Wrong toolchain (macOS):** point `xcode-select` at the right Xcode/toolchain; mismatches cause stale or missing results.
- **No `Package.swift` / compile db:** add a SwiftPM manifest or generate `compile_commands.json` for accurate indexing.
-- **Objective-C (`.objc`/`.objcpp`):** needs a compilation database to resolve headers and frameworks.
+- **Objective-C (`.m`/`.mm`):** needs a compilation database to resolve headers and frameworks.
- **First build slow:** the server builds the module graph on first open; wait for it.
## Verify
diff --git a/plugins/omo/skills/lsp-setup/references/terraform/README.md b/plugins/omo/skills/lsp-setup/references/terraform/README.md
index 01491619..9982ca27 100644
--- a/plugins/omo/skills/lsp-setup/references/terraform/README.md
+++ b/plugins/omo/skills/lsp-setup/references/terraform/README.md
@@ -23,13 +23,13 @@ command -v terraform
## Configure
-Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in `.codex/lsp-client.json` (Codex) AND `.opencode/lsp.json` (OpenCode/omo):
+Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in every harness's project config (per-harness paths: the Configure step in `SKILL.md`):
```json
{ "lsp": { "terraform": { "priority": 100 } } }
```
-For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled`/`env`. A fully custom (non-builtin) server with its own `command` must go in the USER config (`~/.codex/lsp-client.json`).
+For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled` (a project entry drops `env`). `env`, and a fully custom (non-builtin) server with its own `command`, must go in your harness's USER config (see the Configure step in `SKILL.md`).
### Initialization options (only if commonly needed)
diff --git a/plugins/omo/skills/lsp-setup/references/typescript/README.md b/plugins/omo/skills/lsp-setup/references/typescript/README.md
index 7b89b972..2f23a27d 100644
--- a/plugins/omo/skills/lsp-setup/references/typescript/README.md
+++ b/plugins/omo/skills/lsp-setup/references/typescript/README.md
@@ -22,13 +22,13 @@ command -v typescript-language-server
## Configure
-Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in `.codex/lsp-client.json` (Codex) AND `.opencode/lsp.json` (OpenCode/omo):
+Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in every harness's project config (per-harness paths: the Configure step in `SKILL.md`):
```json
{ "lsp": { "typescript": { "priority": 100 } } }
```
-For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled`/`env`. A fully custom (non-builtin) server with its own `command` must go in the USER config (`~/.codex/lsp-client.json`).
+For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled` (a project entry drops `env`). `env`, and a fully custom (non-builtin) server with its own `command`, must go in your harness's USER config (see the Configure step in `SKILL.md`).
### Initialization options (only if commonly needed)
@@ -67,7 +67,7 @@ Pick Deno or Biome over the default:
(Swap `"deno"` for `"biome"` to use Biome instead.)
## Troubleshooting
-- **PATH:** `typescript-language-server` must be on PATH; reopen shell after `npm i -g`. Check your global bin with `npm bin -g`.
+- **PATH:** `typescript-language-server` must be on PATH; reopen shell after `npm i -g`. Your global bin is `$(npm prefix -g)/bin` (Windows: `npm prefix -g`); make sure it is on PATH.
- **Missing tsserver:** errors like "Could not find tsserver" mean the `typescript` package is absent — install it globally or in the project.
## Verify
diff --git a/plugins/omo/skills/lsp-setup/references/yaml/README.md b/plugins/omo/skills/lsp-setup/references/yaml/README.md
index cd7636a4..b82f5584 100644
--- a/plugins/omo/skills/lsp-setup/references/yaml/README.md
+++ b/plugins/omo/skills/lsp-setup/references/yaml/README.md
@@ -18,13 +18,13 @@ command -v yaml-language-server
## Configure
-Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in `.codex/lsp-client.json` (Codex) AND `.opencode/lsp.json` (OpenCode/omo):
+Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in every harness's project config (per-harness paths: the Configure step in `SKILL.md`):
```json
{ "lsp": { "yaml-ls": { "priority": 100 } } }
```
-For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled`/`env`. A fully custom (non-builtin) server with its own `command` must go in the USER config (`~/.codex/lsp-client.json`).
+For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled` (a project entry drops `env`). `env`, and a fully custom (non-builtin) server with its own `command`, must go in your harness's USER config (see the Configure step in `SKILL.md`).
### Initialization options (only if commonly needed)
diff --git a/plugins/omo/skills/lsp-setup/references/zig/README.md b/plugins/omo/skills/lsp-setup/references/zig/README.md
index 98c70ba6..18312e91 100644
--- a/plugins/omo/skills/lsp-setup/references/zig/README.md
+++ b/plugins/omo/skills/lsp-setup/references/zig/README.md
@@ -21,13 +21,13 @@ command -v zls
## Configure
-Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in `.codex/lsp-client.json` (Codex) AND `.opencode/lsp.json` (OpenCode/omo):
+Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in every harness's project config (per-harness paths: the Configure step in `SKILL.md`):
```json
{ "lsp": { "zls": { "priority": 100 } } }
```
-For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled`/`env`. A fully custom (non-builtin) server with its own `command` must go in the USER config (`~/.codex/lsp-client.json`).
+For builtin ids in a PROJECT config, `command` is supplied automatically — only set `priority`/`initialization`/`extensions`/`disabled` (a project entry drops `env`). `env`, and a fully custom (non-builtin) server with its own `command`, must go in your harness's USER config (see the Configure step in `SKILL.md`).
### Initialization options (only if commonly needed)
diff --git a/plugins/omo/skills/lsp-setup/scripts/detect-lsp.ts b/plugins/omo/skills/lsp-setup/scripts/detect-lsp.ts
index ef9cf645..1097a973 100644
--- a/plugins/omo/skills/lsp-setup/scripts/detect-lsp.ts
+++ b/plugins/omo/skills/lsp-setup/scripts/detect-lsp.ts
@@ -182,7 +182,7 @@ function renderReport(root: string, results: readonly DetectionResult[], configS
missing.length === 0
? `All ${results.length} detected server(s) installed.`
: `${missing.length}/${results.length} server(s) NOT installed: ${missing.map((m) => m.server.language).join(", ")}`,
- "Next: read references/<language>/README.md, then configure .codex/lsp-client.json AND .opencode/lsp.json.",
+ "Next: read references/<language>/README.md, then configure your harness's project config (SKILL.md, Configure step).",
)
return lines.join("\n")
}
diff --git a/plugins/omo/skills/lsp-setup/scripts/lsp-server-table.ts b/plugins/omo/skills/lsp-setup/scripts/lsp-server-table.ts
index f3c159d4..589fe2dc 100644
--- a/plugins/omo/skills/lsp-setup/scripts/lsp-server-table.ts
+++ b/plugins/omo/skills/lsp-setup/scripts/lsp-server-table.ts
@@ -58,7 +58,7 @@ export const LANGUAGES: readonly LanguageServer[] = [
{
language: "kotlin",
serverId: "kotlin-ls",
- command: ["kotlin-lsp"],
+ command: ["kotlin-lsp", "--stdio"],
extensions: [".kt", ".kts"],
installHint: "https://github.com/Kotlin/kotlin-lsp",
},
@@ -80,7 +80,7 @@ export const LANGUAGES: readonly LanguageServer[] = [
language: "swift",
serverId: "sourcekit-lsp",
command: ["sourcekit-lsp"],
- extensions: [".swift", ".objc", ".objcpp"],
+ extensions: [".swift", ".m", ".mm"],
installHint: "Included with Xcode (xcode-select --install) or the Swift toolchain",
},
{
@@ -174,4 +174,5 @@ export const PROJECT_CONFIG_FILES: readonly string[] = [
".opencode/lsp.json",
".omo/lsp.json",
".omo/lsp-client.json",
+ ".pi/lsp-client.json",
] as const
diff --git a/plugins/omo/skills/programming/SKILL.md b/plugins/omo/skills/programming/SKILL.md
index 10fc3273..6bb395b8 100644
--- a/plugins/omo/skills/programming/SKILL.md
+++ b/plugins/omo/skills/programming/SKILL.md
@@ -78,7 +78,7 @@ Apply unless the per-language reference overrides with something stricter.
| Exhaustive variant matching | `match` + `assert_never` | `match` (compiler-enforced) | `switch` + `assertNever` | sealed interface + type switch + **`exhaustive` linter** (the compiler will not help) |
| No untyped escape hatches | no `Any` in public sigs, no `cast`, no `# type: ignore` | no `unwrap`/`expect` outside tests (invariant `expect` only behind `#[expect(clippy::expect_used, reason)]`), no numeric `as`, no `#[allow]` (silence with `#[expect(lint, reason)]`) | no `any`, no `as` (except `as const`, `satisfies`), no `!`, no `@ts-ignore`, no `@ts-expect-error` | no `interface{}` / bare `any` in domain sigs; no `_ = err`; no `//nolint` without reason |
| No bare error strings | typed exception dataclass with `__str__` | `thiserror` enum (lib) or `anyhow` with `.context(...)` (app) | `Error` subclass with typed fields | sentinel `errors.New` + typed `*XError` struct; wrap with `%w`; check via `errors.Is/As` |
-| Boundary catch only | catch the exact exception you expect; broad `except Exception` only in `main()`, with logging + re-raise | `?` everywhere; never `panic!` in library code | `catch` must narrow with `instanceof` and re-throw or convert; no empty catch | every `(T, error)` checked; `panic` only in `main`/tests; one `httperr.Write` funnel in handlers |
+| Boundary catch only | catch the exact exception you expect; broad `except Exception` only at a top-level boundary (`main()`/CLI entry, HTTP handler), with logging + re-raise | `?` everywhere; never `panic!` in library code | `catch` must narrow with `instanceof` and re-throw or convert; no empty catch | every `(T, error)` checked; `panic` only in `main`/tests; one `httperr.Write` funnel in handlers |
| Resources via RAII | `with` (sync) / `async with` (async) | `Drop` impl or RAII guard | `using`/`await using` (TC39 explicit resource management) | `defer x.Close()` immediately after acquisition; `bodyclose`/`sqlclosecheck` linters enforce |
| Async runtime is mandatory | `anyio` (NEVER bare `asyncio`) | `tokio` (`async-std` is unmaintained) | platform-native async (Bun/Node) with structured cancellation via `AbortSignal` | `context.Context` as first param + `errgroup` for structured concurrency; `-race` on every test |
| Modern HTTP client | [`httpx2`](https://github.com/pydantic/httpx2) with HTTP/2 + brotli + zstd | `reqwest` with rustls | `ky` (default) / `undici` direct API (Node perf) - NEVER bare `fetch` in prod | stdlib `net/http.Client` with tuned `Transport` + `go-retryablehttp` for retry/backoff |
@@ -140,13 +140,13 @@ Full rationale, measurement methods, workaround detection, and split examples: *
A source file past 250 non-blank, non-comment lines has outgrown a single reviewer's working memory. The module is almost certainly doing more than one thing. Measure: `awk '!/^[[:space:]]*$/ && !/^[[:space:]]*(\/\/|#|--)/' <file> | wc -l`.
-**When detected:** Name what the file owns in one short noun phrase. If the answer needs "and", the file needs splitting. Load `/refactor` and split by responsibility. If the file genuinely cannot be split (generated parser, indivisible state machine), mark with `// allow: SIZE_OK — <reason>`.
+**When detected:** Name what the file owns in one short noun phrase. If the answer needs "and", the file needs splitting. Load `/refactor` and split by responsibility. If the file genuinely cannot be split (generated parser, indivisible state machine), mark it in the first 10 lines with `# noqa: SIZE_OK — <reason>` in Python (the form `scripts/python/check-no-excuse-rules.py` reads) or `// allow: SIZE_OK — <reason>` in `//`-comment languages.
### Smell 2 — Function with more than 3 parameters
More than 3 arguments signals the function is doing too much, or that related parameters belong in a typed struct. **Workarounds count as the same smell** — passing `dict`/`Record<string, unknown>`/`map[string]any`/`**kwargs`/`...args` to smuggle parameters through one argument, or a throwaway "config" object with 6+ fields that exists solely to wrap what would otherwise be positional args (genuine reusable domain types like `HttpClientConfig` are fine).
-**When detected:** Group related parameters into a typed value object with a domain name. If 4+ independent inputs are genuinely required, the justification must be SPECIFIC. See [`references/code-smells.md` Smell 2](references/code-smells.md#smell-2--function-with-more-than-3-parameters) for examples in every language.
+**When detected:** Group related parameters into a typed value object with a domain name. If 4+ independent inputs are genuinely required, the justification must be SPECIFIC. See [`references/code-smells.md` Smell 2](references/code-smells.md#smell-2--function-with-more-than-3-parameters) for Python, TypeScript, and Go examples.
### Smell 3 — Redundant verification after a destructive action
@@ -242,9 +242,9 @@ These two skills are not optional cosmetics. They are the recovery path for the
| Trigger | Skill to load | Why |
|---|---|---|
-| Any [code smell](#code-smells--automatic-review-triggers) fires (250+ LOC, >3 params, redundant verification), OR the post-write loop surfaces 2+ issues, OR the user says "reshape this", "extract this", "clean this up" | `refactor` | Safe codemap-driven multi-step refactor with LSP + tests after each step. Never improvise a structural change. |
+| Any [code smell](#code-smells--automatic-review-triggers) fires (250+ LOC, >3 params, redundant verification, negative naming), OR the post-write loop surfaces more than two issues, OR the user says "reshape this", "extract this", "clean this up" | `refactor` | Safe codemap-driven multi-step refactor with LSP + tests after each step. Never improvise a structural change. |
| Recent branch contains AI-authored patterns (broad except, dead helpers, vague comments, oversized files, redundant post-action verification, junk tests), OR the user says "remove slop", "clean AI code", "deslop" | `remove-ai-slops` | Behavior locked by gate-passing tests FIRST, then categorized parallel cleanup (junk tests included, each cut proven by a mutation), then quality gates. Behavior-preserving. |
-| Rust code touches `unsafe`, `*mut`, `*const`, `MaybeUninit`, FFI, `unsafe impl Send/Sync`, or a custom lock-free primitive | `references/rust-ub/` | Full UB taxonomy + Miri strictness escalation. Every `unsafe` block must survive Miri Level 3 (strict provenance + symbolic alignment + preemption) before it ships. |
+| Rust code touches `unsafe`, `*mut`, `*const`, `MaybeUninit`, FFI, `unsafe impl Send/Sync`, or a custom lock-free primitive | `references/rust-ub/` | Full UB taxonomy + Miri strictness escalation. Every `unsafe` block must survive Miri Level 3 (strict provenance + symbolic alignment + preemption) and the Level 4 Tree Borrows pass before it ships. |
---
diff --git a/plugins/omo/skills/programming/references/code-smells.md b/plugins/omo/skills/programming/references/code-smells.md
index 98dfba8f..c08a5422 100644
--- a/plugins/omo/skills/programming/references/code-smells.md
+++ b/plugins/omo/skills/programming/references/code-smells.md
@@ -48,10 +48,10 @@ cloc --by-file <file> # the "code" column is the number
A file may legitimately exceed 250 pure LOC if **and only if** it is:
-- A truly indivisible single-responsibility unit (e.g., a generated parser table, a state machine whose states share a single closure). Mark with `// allow: SIZE_OK — <reason>`.
+- A truly indivisible single-responsibility unit (e.g., a generated parser table, a state machine whose states share a single closure). Mark it in the first 10 lines with `# noqa: SIZE_OK — <reason>` in Python (the form `scripts/python/check-no-excuse-rules.py` reads) or `// allow: SIZE_OK — <reason>` in `//`-comment languages.
- A pure data table (translation strings, error code lookup, brand color palette).
-`// allow: SIZE_OK` without a justifying comment is itself slop.
+A SIZE_OK marker without a justifying comment is itself slop.
### Concrete split examples
diff --git a/plugins/omo/skills/programming/references/go/README.md b/plugins/omo/skills/programming/references/go/README.md
index f1973e55..2cb7d4c9 100644
--- a/plugins/omo/skills/programming/references/go/README.md
+++ b/plugins/omo/skills/programming/references/go/README.md
@@ -66,9 +66,9 @@ Read these per-file references for the canonical patterns:
- **HTTP backend** → `backend-stack.md` — `gin` server skeleton, middleware ordering, SSE/streaming with `http.Flusher`, structured slog logging, graceful shutdown — distilled from the CLIProxyAPI codebase (a real proxy serving OpenAI/Gemini/Claude APIs).
- **RPC** → `grpc-connect.md` — when to pick Connect vs grpc-go, codegen pipeline, protovalidate, streaming.
- **DB** → `sqlc-pgx.md` — compile-time-safe SQL via sqlc + pgx connection pool + migrations via goose + testcontainers in CI.
-- **CLI** → `cobra-stack.md` — cobra layout, slog integration, graceful shutdown on signals, fang-style colored help.
+- **CLI** → `cobra-stack.md` — cobra layout, slog integration, graceful shutdown on signals, shell completions, `huh` prompts styled with `lipgloss`.
- **TUI** → `bubbletea-v2.md` — v2 model, `SetVirtualCursor(false)` + `tea.View{Cursor}` for CJK IME, why v1 was broken for Korean/Japanese/Chinese input.
-- **Testing** → `testing.md` — table-driven tests, `require` vs `assert`, `autogold` snapshots, `gopter` property tests, `testcontainers` for integration, `goleak` for goroutine leaks.
+- **Testing** → `testing.md` — table-driven tests, `require` vs `assert`, `autogold` snapshots, `rapid` property tests, `testcontainers` for integration, `goleak` for goroutine leaks.
- **Bootstrap** → `bootstrap.md` — `scripts/go/new-project.ts` invocation, project layout (`cmd/`, `internal/`, `pkg/`), Taskfile, CI.
- **Strict config** → `golangci-strict.md` — the canonical `.golangci.yml` with the full linter whitelist and per-linter rationale.
- **One-liners** → `one-liners.md` — `go run` scripts with `//go:build ignore`, `gorun`-style invocation.
@@ -81,7 +81,7 @@ The `cmd/server/main.go` is the most common violator. Refactor it: `main.go` onl
## Existing codebases — non-strict project
-When editing an existing `.go` file that doesn't follow these rules: **write new code in strict style, don't refactor existing code in the same change.** Use the `remove-ai-slops` skill for branch-scope cleanup.
+When editing an existing `.go` file that doesn't follow these rules: **write new code in strict style, don't refactor existing code in the same change.** The one exception is the 250 pure-LOC ceiling: if your edit adds lines to a file already over it, split the unit you are touching into its own file first (see [`../code-smells.md`](../code-smells.md) Smell 1); everything else waits for a separate change. Use the `remove-ai-slops` skill for branch-scope cleanup.
## Activation
diff --git a/plugins/omo/skills/programming/references/python/README.md b/plugins/omo/skills/programming/references/python/README.md
index bfcab9e9..9dc34c4e 100644
--- a/plugins/omo/skills/programming/references/python/README.md
+++ b/plugins/omo/skills/programming/references/python/README.md
@@ -41,7 +41,7 @@ These are deliberate project choices. Violations are always wrong, not "style pr
11. **No Any, no object** — both are banned as type annotations. `object` erases all structural information (zero callable attributes, zero narrowing). Use `Protocol` (structural typing), `TypeVar` (generic pass-through), explicit union (known variants), or `TypedDict` (dict shapes).
12. **No cast** — `cast()` is banned. Redesign the types.
13. **No type: ignore** — fix the type error. The checker is right; you are wrong.
-14. **No broad except** — `except Exception` and `except BaseException` are banned. Catch the **specific** exception you expect. A broad catch swallows bugs you need to see — `KeyError`, `AttributeError`, `TypeError` all vanish silently. If you genuinely need a catch-all at a top-level boundary (CLI entry, HTTP handler), use `# noqa: BROAD_EXCEPT_OK` and log + re-raise.
+14. **No broad except** — `except Exception` and `except BaseException` are banned. Catch the **specific** exception you expect. A broad catch swallows bugs you need to see — `KeyError`, `AttributeError`, `TypeError` all vanish silently. If you genuinely need a catch-all at a top-level boundary (CLI entry, HTTP handler), put `# noqa: BROAD_EXCEPT_OK` on the `except` line and log + re-raise.
### Typing and safety
@@ -147,19 +147,19 @@ except Exception:
# GOOD — catch what you expect
try:
result = api.fetch(url)
-except httpx.HTTPStatusError as e:
+except httpx2.HTTPStatusError as e:
logger.error("API %d: %s", e.response.status_code, e.request.url)
return None
-except httpx.ConnectError:
+except httpx2.ConnectError:
raise ServiceUnavailableError(service="api") from None
-# GOOD — top-level boundary (only place broad catch is acceptable)
-def main() -> int: # noqa: BROAD_EXCEPT_OK
+# GOOD — top-level boundary (CLI entry or HTTP handler: the only places a broad catch is acceptable)
+def main() -> int:
try:
return run()
- except Exception:
+ except Exception: # noqa: BROAD_EXCEPT_OK
logger.exception("unhandled error")
- return 1
+ raise
```
### Async
@@ -307,7 +307,7 @@ Tests still follow the iron list — frozen dataclasses, typed errors, exhaustiv
## Existing codebases
-When editing an existing file that doesn't follow these rules: **write new code in strict style, don't refactor existing code in the same change.** Mixing feature work with style migration makes reviews harder and bugs likelier.
+When editing an existing file that doesn't follow these rules: **write new code in strict style, don't refactor existing code in the same change.** The one exception is the 250 pure-LOC ceiling: if your edit adds lines to a file already over it, split the unit you are touching into its own file first (see [`../code-smells.md`](../code-smells.md) Smell 1); everything else waits for a separate change. Mixing feature work with style migration makes reviews harder and bugs likelier.
## Activation
diff --git a/plugins/omo/skills/programming/references/python/data-processing.md b/plugins/omo/skills/programming/references/python/data-processing.md
index 299b30cd..548b13d0 100644
--- a/plugins/omo/skills/programming/references/python/data-processing.md
+++ b/plugins/omo/skills/programming/references/python/data-processing.md
@@ -10,16 +10,16 @@ NEVER pandas. Polars (with numpy) plus DuckDB. Pandas is 10-50x slower, has weak
|---|---|---|
| `.csv` / `.parquet` / `.json` direct query | DuckDB | Zero memory load, SQL ergonomics |
| `.duckdb` file | DuckDB | Native format |
-| Filter (any size) | Polars | 128x faster than DuckDB for filtering |
-| Sort | Polars | 12x faster |
-| Multi-table join | DuckDB | 3x faster, more join types |
-| Heavy GROUP BY aggregation | DuckDB | 4x faster on large datasets |
-| Window function | Polars | 3-5x faster |
-| Pivot / melt / string ops | Polars | 2x faster |
+| Filter (any size) | Polars | row-wise filtering, low setup cost |
+| Sort | Polars | in-memory sorting |
+| Multi-table join | DuckDB | more join types, out-of-core joins |
+| Heavy GROUP BY aggregation | DuckDB | large grouped aggregation |
+| Window function | Polars | window expressions |
+| Pivot / melt / string ops | Polars | reshape and string expressions |
| Larger than RAM | Polars streaming or DuckDB out-of-core | Both handle OOM |
| Mixed pipeline | Hybrid (zero-copy via Arrow) | Use each tool's strengths |
-For the deep version (per-operation benchmarks, OOM strategies, full execution templates), load the **`data-scientist`** skill - it lives in this same skill set and is the source of truth for performance numbers.
+For the deep version (engine choice, placement, OOM strategies, execution templates), load the **`data-scientist`** skill - it lives in this same skill set; when the engine choice matters, measure on the actual data, as that skill says.
## Standard imports
@@ -69,7 +69,7 @@ result = (
pl.len().alias("count"),
pl.sum("amount").alias("total"),
])
- .collect(streaming=True)
+ .collect(engine="streaming")
)
```
@@ -84,7 +84,7 @@ joined = duckdb.sql("""
JOIN 'products.parquet' p ON o.product_id = p.id
""").pl()
-# Phase 2: Polars for filtering and transformation (128x + 2x faster)
+# Phase 2: Polars for filtering and transformation
processed = (
joined
.filter(pl.col("amount") > 100)
diff --git a/plugins/omo/skills/programming/references/rust-ub/README.md b/plugins/omo/skills/programming/references/rust-ub/README.md
index 55920b5a..0632ed70 100644
--- a/plugins/omo/skills/programming/references/rust-ub/README.md
+++ b/plugins/omo/skills/programming/references/rust-ub/README.md
@@ -98,7 +98,7 @@ MIRIFLAGS="\
**Interpret results:**
- Fails at Level 1 → Definite UB. Fix immediately.
- Passes Level 1, fails Level 2 → Provenance or alignment UB. Fix.
-- Passes Levels 1-3, fails Level 4 → Tree Borrows found something Stacked Borrows missed (unusual). Investigate — may be a Tree Borrows false positive, but usually indicates fragile aliasing.
+- Passes Levels 1-3, fails Level 4 → Tree Borrows found something Stacked Borrows missed (unusual). Investigate — may be a Tree Borrows false positive, but usually indicates fragile aliasing. It does not ship until the aliasing is fixed or the false positive is proven and recorded with the Miri output.
- Passes all 4 → Miri-clean. Proceed to supplementary tools.
### Phase 3: Supplementary Scans
@@ -159,11 +159,11 @@ Is there unsafe code in the changeset?
│ NO → Run Miri Level 2 (strict provenance).
│ Miri fails?
│ YES → Stop. Classify. Fix. Prove. Then continue.
- │ NO → Proceed with the original task.
+ │ NO → Proceed with the original task; run Levels 3 and 4 before it ships.
NO → Proceed normally.
```
-This is not optional. **Every `unsafe` block gets Miri'd before it ships.**
+This is not optional. **Every `unsafe` block passes Miri Levels 3 and 4 before it ships.**
## SAFETY Comment Standard
diff --git a/plugins/omo/skills/programming/references/typescript/README.md b/plugins/omo/skills/programming/references/typescript/README.md
index fcde2d2e..6eb36bf4 100644
--- a/plugins/omo/skills/programming/references/typescript/README.md
+++ b/plugins/omo/skills/programming/references/typescript/README.md
@@ -16,7 +16,7 @@ These are deliberate project choices. Violations are always wrong, not "style pr
| Category | Use | Never |
|---|---|---|
| Runtime | Bun (native TS, single binary) | ts-node, tsx |
-| Package manager | `pnpm` | npm, yarn (unless workspace requires it) |
+| Package manager | Bun (`bun install`); `pnpm` only when Node is forced | npm, yarn (unless workspace requires it) |
| Linter + formatter | **oxlint + oxfmt**, with both local copy rules | New ESLint, Prettier, or Biome setups; retain them only in repositories already using them |
| Type checker | `tsc --noEmit` with strict config | skip type checking |
| Web framework | Hono | Express |
@@ -39,7 +39,7 @@ These are deliberate project choices. Violations are always wrong, not "style pr
11. **as const for constants** — module-level constant objects and arrays use `as const`.
12. **import type** — type-only imports use `import type`. Enforced by `verbatimModuleSyntax`.
13. **Named exports only** — no `export default`. Exception: framework requirement (Next.js pages, etc.).
-14. **No empty catch, no catch-and-swallow** — every `catch` block must either (a) narrow the error with `instanceof` and handle each case, or (b) re-throw. Empty catch blocks and `catch (e) { console.error(e) }` without narrowing or re-throw are banned — they hide bugs. At top-level boundaries (CLI entry, HTTP handler), opt out with `// no-excuse-ok: catch`.
+14. **No empty catch, no catch-and-swallow** — every `catch` block must either (a) narrow the error with `instanceof` and handle each case, or (b) re-throw. Empty catch blocks and `catch (e) { console.error(e) }` without narrowing or re-throw are banned — they hide bugs. At top-level boundaries (CLI entry, HTTP handler), opt out with `// no-excuse-ok: catch` on the `catch` line.
### Data modeling — which construct, when
@@ -91,10 +91,10 @@ try {
}
// GOOD — top-level boundary (only place catch-all is acceptable)
-async function main(): Promise<void> { // no-excuse-ok: catch
+async function main(): Promise<void> {
try {
await run()
- } catch (e) {
+ } catch (e) { // no-excuse-ok: catch
console.error("unhandled:", e)
process.exit(1)
}
@@ -190,7 +190,7 @@ Tests still follow the iron list — branded types, typed errors, exhaustive swi
## Existing codebases
-When editing an existing file that doesn't follow these rules: **write new code in strict style, don't refactor existing code in the same change.**
+When editing an existing file that doesn't follow these rules: **write new code in strict style, don't refactor existing code in the same change.** The one exception is the 250 pure-LOC ceiling: if your edit adds lines to a file already over it, split the unit you are touching into its own file first (see [`../code-smells.md`](../code-smells.md) Smell 1); everything else waits for a separate change.
## Activation
diff --git a/plugins/omo/skills/programming/scripts/typescript/new-project.ts b/plugins/omo/skills/programming/scripts/typescript/new-project.ts
index 7ed97dda..c17e810f 100644
--- a/plugins/omo/skills/programming/scripts/typescript/new-project.ts
+++ b/plugins/omo/skills/programming/scripts/typescript/new-project.ts
@@ -77,7 +77,7 @@ const pkg = {
},
dependencies: {
hono: "^4.12.5",
- zod: "^3.24.0",
+ zod: "^4.0.0",
},
devDependencies: {
"@types/bun": "latest",
diff --git a/plugins/omo/skills/refactor/SKILL.md b/plugins/omo/skills/refactor/SKILL.md
index 177b936e..d555d06f 100644
--- a/plugins/omo/skills/refactor/SKILL.md
+++ b/plugins/omo/skills/refactor/SKILL.md
@@ -106,17 +106,15 @@ Should I proceed with [recommendation], or would you prefer differently?
## Step 0.3: Create Initial Todos
-**IMMEDIATELY after understanding the request, create todos:**
+**IMMEDIATELY after understanding the request, create these todos with the session's todo tool (all pending):**
\`\`\`
-TodoWrite([
- {"id": "phase-1", "content": "PHASE 1: Codebase Analysis - launch parallel explore agents", "status": "pending", "priority": "high"},
- {"id": "phase-2", "content": "PHASE 2: Build Codemap - map dependencies and impact zones", "status": "pending", "priority": "high"},
- {"id": "phase-3", "content": "PHASE 3: Test Assessment - analyze test coverage and verification strategy", "status": "pending", "priority": "high"},
- {"id": "phase-4", "content": "PHASE 4: Plan Generation - invoke Plan agent for detailed refactoring plan", "status": "pending", "priority": "high"},
- {"id": "phase-5", "content": "PHASE 5: Execute Refactoring - step-by-step with continuous verification", "status": "pending", "priority": "high"},
- {"id": "phase-6", "content": "PHASE 6: Final Verification - full test suite and regression check", "status": "pending", "priority": "high"}
-])
+- phase-1: PHASE 1: Codebase Analysis - launch parallel explore agents
+- phase-2: PHASE 2: Build Codemap - map dependencies and impact zones
+- phase-3: PHASE 3: Test Assessment - analyze test coverage and verification strategy
+- phase-4: PHASE 4: Plan Generation - invoke Plan agent for detailed refactoring plan
+- phase-5: PHASE 5: Execute Refactoring - step-by-step with continuous verification
+- phase-6: PHASE 6: Final Verification - full test suite and regression check
\`\`\`
---
@@ -179,14 +177,14 @@ While background agents are running, use direct tools:
\`\`\`typescript
// Find definition(s)
-LspGotoDefinition(filePath, line, character) // Where is it defined?
+lsp_goto_definition(filePath, line, character) // Where is it defined?
// Find ALL usages across workspace
-LspFindReferences(filePath, line, character, includeDeclaration=true)
+lsp_find_references(filePath, line, character, includeDeclaration=true)
// Get file structure
-LspDocumentSymbols(filePath) // Hierarchical outline
-LspWorkspaceSymbols(filePath, query="[target_symbol]") // Search by name
+lsp_symbols(filePath, scope="document") // Hierarchical outline
+lsp_symbols(filePath, scope="workspace", query="[target_symbol]") // Search by name
// Get current diagnostics
lsp_diagnostics(filePath) // Errors, warnings before we start
@@ -195,8 +193,8 @@ lsp_diagnostics(filePath) // Errors, warnings before we start
### AST-Grep Skill for Pattern Analysis:
\`\`\`bash
-// Find structural patterns
-python3 scripts/ast_grep_helper.py search 'function $NAME($$$) { $$$ }' --lang ts src/
+// Find structural patterns — run this from the ast-grep skill's directory; this skill ships no scripts/
+python3 scripts/ast_grep_helper.py search 'function $NAME($$$) { $$$ }' src/ --lang ts
# Preview refactoring first
sg --pattern '[old_pattern]' --rewrite '[new_pattern]' --lang ts src/
@@ -205,7 +203,7 @@ sg --pattern '[old_pattern]' --rewrite '[new_pattern]' --lang ts src/
### Grep for Text Patterns:
\`\`\`
-grep(pattern="[search_term]", path="src/", include="*.ts")
+grep(pattern="[search_term]", path="src/") // narrow to *.ts with the grep tool's file-filter parameter
\`\`\`
## 1.3: Collect Background Results
@@ -342,6 +340,11 @@ Which approach do you prefer?
- Unit: \`bun test\` / \`npm test\` / \`pytest\` / etc.
- Integration: [command if exists]
- Type check: \`tsc --noEmit\` / \`pyright\` / etc.
+- Lint: [project's linter command, the one Phase 6.3 runs]
+
+### Baseline (before any change)
+- Pass counts: [X/Y passing per test command above]
+- lsp_diagnostics: [pre-existing diagnostics recorded in Phase 1.2]
### Verification Checkpoints
After each refactoring step:
@@ -405,17 +408,14 @@ After receiving plan from Plan agent:
## 4.3: Register Detailed Todos
-Convert Plan agent output into granular todos:
+Convert Plan agent output into granular todos with the session's todo tool (each step from the plan becomes a todo, followed by its verify todo):
\`\`\`
-TodoWrite([
- // Each step from the plan becomes a todo
- {"id": "refactor-1", "content": "Step 1: [description]", "status": "pending", "priority": "high"},
- {"id": "verify-1", "content": "Verify Step 1: run tests", "status": "pending", "priority": "high"},
- {"id": "refactor-2", "content": "Step 2: [description]", "status": "pending", "priority": "medium"},
- {"id": "verify-2", "content": "Verify Step 2: run tests", "status": "pending", "priority": "medium"},
- // ... continue for all steps
-])
+- refactor-1: Step 1: [description]
+- verify-1: Verify Step 1: run tests
+- refactor-2: Step 2: [description]
+- verify-2: Verify Step 2: run tests
+- ... continue for all steps
\`\`\`
**Mark phase-4 as completed.**
@@ -449,8 +449,8 @@ lsp_rename(filePath, line, character, newName) // Execute rename
// Preview first
sg --pattern '[pattern]' --rewrite '[rewrite]' --lang ts path/to/file.ts
-// If preview looks good, execute
-python3 scripts/ast_grep_helper.py replace '[pattern]' '[rewrite]' --lang ts path/to/file.ts --apply
+// If preview looks good, execute (from the ast-grep skill's directory)
+python3 scripts/ast_grep_helper.py replace '[pattern]' '[rewrite]' path/to/file.ts --lang ts --apply
\`\`\`
**For Structural Changes:**
@@ -543,7 +543,7 @@ bun run build # or npm run build, etc.
\`\`\`typescript
// Check all changed files
for (file of changedFiles) {
- lsp_diagnostics(file) // Must all be clean
+ lsp_diagnostics(file) // Must be clean or same as the Phase 1 baseline: zero new diagnostics
}
\`\`\`
@@ -609,8 +609,8 @@ You already know these tools. Use them intelligently:
## LSP Tools
Leverage LSP tools for precision analysis. Key patterns:
-- **Understand before changing**: \`LspGotoDefinition\` to grasp context
-- **Impact analysis**: \`LspFindReferences\` to map all usages before modification
+- **Understand before changing**: \`lsp_goto_definition\` to grasp context
+- **Impact analysis**: \`lsp_find_references\` to map all usages before modification
- **Safe refactoring**: \`lsp_prepare_rename\` → \`lsp_rename\` for symbol renames
- **Continuous verification**: \`lsp_diagnostics\` after every change
@@ -674,7 +674,7 @@ Then choose the path:
- **Team path (5.1-T)**: when the plan recommends \`team\` AND \`file_independent_steps >= 3\`. Members execute in parallel, Lead orchestrates, a \`deep-high\` verifier lives outside the team.
- **Legacy path (5.1-L)**: otherwise. Use the original 5.1 / 5.2 / 5.3 flow from above.
-Record the chosen path in the TodoWrite list.
+Record the chosen path in the todo list.
## Phase 5.1-T: \`refactor-squad\` team execution
@@ -682,9 +682,9 @@ Record the chosen path in the TodoWrite list.
1. When the session lists the \`team-mode\` skill, load it for lifecycle, message protocol, and limits.
2. Call \`team_list\` and verify no active \`refactor-squad\` run exists; if one does, shutdown + delete the orphan before proceeding.
-3. If \`~/.omo/teams/refactor-squad/config.json\` is missing, write it using the spec below.
+3. If the project-level spec \`.omo/teams/refactor-squad/config.json\` (under the project root) is missing, write it using the spec below.
-**Team spec** (\`~/.omo/teams/refactor-squad/config.json\`):
+**Team spec** (\`<project root>/.omo/teams/refactor-squad/config.json\`):
\`\`\`json
{
@@ -748,7 +748,7 @@ While any team task is \`pending | claimed | in_progress\`:
prompt=<files touched + verify-spec commands + instruction to return "PASS" or "FAIL:<failing test + specific error + suggested revert hunks>">
)
\`\`\`
- If \`deep\` is unavailable, fall back to \`category="unspecified-high"\`. Do not create a commit checkpoint until the verifier returns PASS.
+ If \`deep-high\` is unavailable, fall back to \`category="unspecified-high"\`. Do not create a commit checkpoint until the verifier returns PASS.
- On a verifier PASS: make the commit checkpoint for that step (see original 5.3). Proceed.
- On a verifier FAIL: Lead decides:
- **Retry with fix hint**: \`team_task_update(status=pending)\` on the original step + \`team_send_message(teamRunId=<id>, to=<original member>, summary="retry", body=<specific failure from verifier>)\`. Runtime reassigns.
@@ -765,7 +765,7 @@ If Phase 5 used the team path, dismantle \`refactor-squad\` BEFORE producing the
2. \`team_delete(teamRunId=<id>)\`.
3. \`team_list\` to confirm no residual \`refactor-squad\` run.
-The \`~/.omo/teams/refactor-squad/config.json\` declaration stays on disk; next session reuses it.
+The \`.omo/teams/refactor-squad/config.json\` declaration stays on disk in the project; next session reuses it.
Append to the 6.6 summary a "Dispatch path" line and, when team path was used, team metrics (teamRunId, tasks created, verifier runs, team lifetime).
diff --git a/plugins/omo/skills/remove-ai-slops/SKILL.md b/plugins/omo/skills/remove-ai-slops/SKILL.md
index a03ae89c..a368c47f 100644
--- a/plugins/omo/skills/remove-ai-slops/SKILL.md
+++ b/plugins/omo/skills/remove-ai-slops/SKILL.md
@@ -96,12 +96,12 @@ The agent looks for these ten categories. The first three are stylistic, the nex
10. **Oversized modules** — any source file exceeding **250 pure LOC** (non-blank, non-comment lines). This is an architectural defect, not a style preference. Measure: `awk '!/^[[:space:]]*$/ && !/^[[:space:]]*(#|\/\/)/' <file> | wc -l`.
**When found, do NOT just flag it. Execute a full modular refactoring:**
- 1. Run `check-no-excuse-rules.py` recursively on scope to list all violations.
+ 1. List every oversized file in scope: run the `awk` measure above on each source file. For `.py` files you may instead run the `programming` skill's Python checker (`uv run <programming skill dir>/scripts/python/check-no-excuse-rules.py <paths>`, rule `oversized-module`); it scans only `.py` files, so it never covers another language.
2. For each oversized file, identify distinct responsibilities (single-responsibility principle).
3. Plan the split: name each new file after the concept it owns (never `utils.py`, `helpers.py`, `common.py`, `part_1.py`).
4. Present the split plan to the user before executing.
5. Extract into clean modules with explicit `__init__.py` re-exports (re-exports ONLY, no logic in `__init__.py`).
- 6. Verify: run `check-no-excuse-rules.py` again — every file must be ≤250 pure LOC. Run tests, typecheck, lint.
+ 6. Verify: re-measure exactly as in step 1 — every file must be ≤250 pure LOC. Run tests, typecheck, lint.
**Forbidden escapes**:
- Counting blanks/comments toward budget.
@@ -110,7 +110,7 @@ The agent looks for these ten categories. The first three are stylistic, the nex
- "It's generated" — only valid if the file lives in a build output directory.
- "230 LOC, close enough" — a 230-LOC file about to grow is already over. Split now.
- KEEP: genuinely self-contained single-responsibility scripts (e.g., a standalone CLI checker). Opt out with `# noqa: SIZE_OK` in first 5 lines and a comment explaining why.
+ KEEP: genuinely self-contained single-responsibility scripts (e.g., a standalone CLI checker). Opt out with the language's SIZE_OK marker in the first 10 lines (`# noqa: SIZE_OK` in Python, the form the Python checker reads; `// allow: SIZE_OK` in `//`-comment languages) and a comment explaining why.
---
@@ -130,7 +130,7 @@ A pass is complete only when all applicable gates are green. Skip gates that are
## Process
-### Phase 0: Plan with TodoWrite
+### Phase 0: Plan with the todo tool
Create todos for all phases below. Mark `in_progress` one at a time.
@@ -270,8 +270,8 @@ If any gate fails or any checklist item flips:
1. Identify the specific change that caused the failure.
2. Explain why it broke things.
-3. `git checkout` the affected file (or use `git diff` + targeted `Edit` to revert just the problematic hunk).
-4. If genuine slop remains after revert, edit the file directly yourself — in parallel per file via multiple Edit calls — applying only the changes you can prove are safe.
+3. `git checkout` the affected file (or use `git diff` + targeted `edit` to revert just the problematic hunk).
+4. If genuine slop remains after revert, edit the file directly yourself — in parallel per file via multiple `edit` calls — applying only the changes you can prove are safe.
5. Re-run the failing gate and re-walk the checklist for the affected file.
6. Repeat until all gates green AND checklist clean.
diff --git a/plugins/omo/skills/review-work/SKILL.md b/plugins/omo/skills/review-work/SKILL.md
index 69c8f970..ea798124 100644
--- a/plugins/omo/skills/review-work/SKILL.md
+++ b/plugins/omo/skills/review-work/SKILL.md
@@ -163,7 +163,7 @@ For GOAL, CONSTRAINTS, BACKGROUND - review the full conversation history. The us
## Phase 1: Manual QA (you run it)
-You are the QA lane. Do not delegate hands-on QA to a sub-agent: the orchestrator owns the real-surface proof, exactly as the ulw-loop final gate records `manualQa` under the main session.
+You are the QA lane. Do not delegate hands-on QA to a sub-agent: the orchestrator owns the real-surface proof, exactly as the ulw-loop final gate records `manualQa` under the main session. One exception: inside a `ulw-execute` run, whose root never runs QA itself, dispatch these scenarios to one QA worker and build the matrix from the artifacts it captures.
1. **Reuse first.** If this session already captured real-surface evidence for the FINAL tree (an ultrawork or ulw-loop evidence directory, a `visual-qa` verdict on this same build), consume it as QA rows instead of re-running. A fix committed after a capture stales that capture: re-run the rows it covered.
2. **Pick the channel that faithfully exercises the surface** and capture the artifact:
@@ -282,7 +282,7 @@ Store the lane verdicts independently:
| Manual QA (Phase 1) | PASS/FAIL | rows, artifact paths |
| Gate review | pending/APPROVE/REJECT/INCONCLUSIVE | - |
-If the reviewer stays silent after the reliability followup, record the lane INCONCLUSIVE and respawn one smaller reviewer scoped to the same inputs. If that retry also ends without a verdict, close the still-running agent if safe, keep the lane INCONCLUSIVE, and emit the final result naming the incomplete lane. Do not spin in repeated wait/followup cycles, and do not use a queued followup as a cancellation.
+If the reviewer ends without a verdict (it completed without one, answered ack-only to one follow-up, or reported `BLOCKED:`), record the lane INCONCLUSIVE and respawn one smaller reviewer scoped to the same inputs. A reviewer that is still running is alive, not silent. If that retry also ends without a verdict, close the still-running agent if safe, keep the lane INCONCLUSIVE, and emit the final result naming the incomplete lane. Do not spin in repeated wait/followup cycles, and do not use a queued followup as a cancellation.
After the lane reaches a terminal state and before delivering the verdict, tear down the review worktree: run `git worktree unlock <path>` followed by `git worktree remove <path>`. The reviewer runs inside that worktree, so removing it earlier destroys its working directory; a crashed review leaves the locked tree as a recoverable marker for manual cleanup.
diff --git a/plugins/omo/skills/ultimate-browsing/SKILL.md b/plugins/omo/skills/ultimate-browsing/SKILL.md
index 9703dd81..2dcc32d0 100644
--- a/plugins/omo/skills/ultimate-browsing/SKILL.md
+++ b/plugins/omo/skills/ultimate-browsing/SKILL.md
@@ -22,7 +22,7 @@ User request
+- archive snapshot of a dead or changed page ------- TIER 1 insane-search (surrogates, provenance-tagged)
|
+- Chinese platform (xhs/douyin/weibo/bilibili/v2ex/wechat) TIER 1.5 agent-reach
- +- podcast transcript / stock forum ----------------- TIER 1.5 agent-reach
+ +- podcast transcript ------------------------------- TIER 1.5 agent-reach
+- Twitter feed / LinkedIn profile / GitHub via CLI - TIER 1.5 agent-reach
|
+- Tier 1/1.5 returned empty or partial ------------- TIER 2 2a owned engine (stealth)
@@ -71,8 +71,8 @@ The full engine harness (rules R1-R7, the Phase 0 official-API index, the no-sit
| search | Exa AI | [references/agent-reach/search.md](references/agent-reach/search.md) |
```bash
-mcporter call 'douyin.parse_douyin_video_info(url: "<URL>")' # douyin, zero-config
-curl -s "https://r.jina.ai/https://weibo.com/<uid>/<pid>" # weibo via Jina
+mcporter call 'douyin.parse_douyin_video_info(share_link: "<URL>")' # douyin, zero-config
+curl -s -H "Authorization: Bearer ${JINA_API_KEY}" "https://r.jina.ai/https://weibo.com/<uid>/<pid>" # weibo via Jina (key required)
yt-dlp --dump-json "<bilibili-url>" # Bilibili (overseas: add --cookies-from-browser)
curl -s "https://www.v2ex.com/api/topics/hot.json" # V2EX public API
```
@@ -115,17 +115,19 @@ When the blocked flow needs the user's account, drive the browser they are alrea
### Cookie login (cross-platform)
-`scripts/extract_cookies.py` reads cookies from a local Chromium-family or Firefox-family browser and optionally injects them into the running CDP session. It resolves browser profile paths and decrypts cookie values per-OS (macOS Keychain, Linux libsecret, Windows DPAPI):
+A login the user holds goes through Tier 2b, never through their cookies: the `browser` skill forbids copying a session out of the user's real browser profile (`references/owned-engine/network.md`, Cookies).
+
+`scripts/extract_cookies.py` reads cookies from the default profile store of a local Chromium-family or Firefox-family browser and optionally injects them over CDP. It resolves browser profile paths and decrypts cookie values per-OS (macOS Keychain, Linux libsecret, Windows DPAPI). Because it always reads that default store, run it only where that browser profile is not the user's live profile (for example a dedicated automation account whose browser the task owns); on the user's own machine it would copy their session, so use Tier 2b instead.
```bash
# Extract cookies to a file:
mkdir -p ~/.local/state/omo-cookies
python3 -B scripts/extract_cookies.py --browser chrome --domain youtube.com --output ~/.local/state/omo-cookies/youtube.cookies.json
-# Extract and inject into the running CDP session:
+# Extract and inject over CDP (needs a browser started with --remote-debugging-port=9242; connectPipe opens no port):
python3 -B scripts/extract_cookies.py --browser chrome --domain youtube.com --inject --cdp 9242
```
-Cookie export files are written with owner-only `0600` permissions. Do not place live auth cookies in shared temp directories or commit them to a repo. Cookie injection sends values to CDP over stdin rather than argv. Cookies apply on next navigation — reload after injecting. Google services use fingerprint-bound tokens that may not transfer across browser profiles. Limits in [references/chrome-stealth.md](references/chrome-stealth.md).
+For a Tier 2a owned page, load the exported file and call `omowright.injectCookies(page, cookies)` instead (see [references/chrome-stealth.md](references/chrome-stealth.md)). Cookie export files are written with owner-only `0600` permissions. Do not place live auth cookies in shared temp directories or commit them to a repo. Cookie injection sends values to CDP over stdin rather than argv. Cookies apply on next navigation — reload after injecting. Google services use fingerprint-bound tokens that may not transfer across browser profiles. Limits in [references/chrome-stealth.md](references/chrome-stealth.md).
## Reference docs
@@ -139,7 +141,8 @@ Cookie export files are written with owner-only `0600` permissions. Do not place
```bash
# agent-reach auth: set the channel-specific env vars from each tool's docs only if you have access
-# insane-search needs no env vars — it auto-installs deps on first run
+# insane-search: JINA_API_KEY only for the Jina Reader route (the engine skips that surrogate without it)
+# insane-search Python deps: the install one-liner in references/insane-search/README.md
```
## Anti-patterns
diff --git a/plugins/omo/skills/ultimate-browsing/engine/AGENTS.md b/plugins/omo/skills/ultimate-browsing/engine/AGENTS.md
index ef77fae2..2d792968 100644
--- a/plugins/omo/skills/ultimate-browsing/engine/AGENTS.md
+++ b/plugins/omo/skills/ultimate-browsing/engine/AGENTS.md
@@ -61,7 +61,7 @@ is a regression, not an upgrade:
- **Module split of the fetch chain** — `curl_probe` / `referers` / `url_transforms` /
`waf_detector` / `validators` / `executor` / `summary` as separate modules rather than
one monolith.
-- **The Python test suite** under `engine/tests/` with its HTML/JSON fixtures.
+- **The Python test suite** under `engine/tests/` with its HTML/JSON fixtures (source checkout only: the skill copy filter drops `engine/tests/` from every shipped edition).
- **De-personalization** — no personal absolute paths, no personal auth token literals,
no personal browser choice; enforced by `depersonalization-gate.test.ts`.
- **Skill-level layering** — the engine is Tier 1 under a router that also owns Tier 1.5
@@ -115,7 +115,7 @@ Any future upstream sync preserves BOTH sides. Concretely:
## OVERVIEW
-A 17-module Python package embedded in the `ultimate-browsing` skill: a site-agnostic fetch chain that escalates from a cheap curl probe to a real browser, with declarative WAF and surrogate registries. Not "optional scripts" — it has its own CLI entry (`python3 -B -m engine URL`; `-B` keeps bytecode caches out of a signed app bundle, #11373), two YAML config schemas, a 4-file test suite, and a standalone CI guard. Package exports (`__init__.py`): `fetch`, `FetchResult`, `Attempt`, `Verdict`, `ValidationResult`, `validate`, `CHALLENGE_MARKERS`, `detect`, `TRANSFORMS`, `apply_transform`.
+A 13-file Python package (`__init__.py`, `__main__.py` and 11 modules) embedded in the `ultimate-browsing` skill: a site-agnostic fetch chain that escalates from a cheap curl probe to a real browser, with declarative WAF and surrogate registries. Not "optional scripts" — it has its own CLI entry (`python3 -B -m engine URL`; `-B` keeps bytecode caches out of a signed app bundle, #11373), two YAML config schemas, a 6-file test suite (source checkout only), and a standalone CI guard. Package exports (`__init__.py`): `fetch`, `FetchResult`, `Attempt`, `Verdict`, `ValidationResult`, `validate`, `CHALLENGE_MARKERS`, `detect`, `TRANSFORMS`, `apply_transform`.
## THE NO-SITE-NAME RULE (enforced in CI)
@@ -170,11 +170,11 @@ python3 -B -m engine URL [--selector S] [--device auto|desktop|mobile]
## TESTS
-`tests/` — `test_surrogate.py` (staleness, proxy gating, short-circuit), `test_surrogate_validators.py`, `test_fetch_chain.py`, `test_playwright_templates.py`, plus HTML/JSON fixtures under `tests/fixtures/`.
+`tests/` (source checkout only; not shipped with the skill) — `test_surrogate.py` (staleness, proxy gating, short-circuit), `test_surrogate_validators.py`, `test_fetch_chain.py`, `test_playwright_templates.py`, `test_playwright_stealth.py`, `test_executor_timeout.py`, plus HTML/JSON fixtures under `tests/fixtures/`.
## NOTES
- `summary.py` emits an **R7 API-first hint** after >=3 challenge verdicts against a known WAF profile: look for `/api/`, `/graphql`, or `.json` endpoints, which usually carry weaker WAF protection than the HTML surface.
- `templates/` holds the Playwright JS templates (`playwright_real_chrome.js`, `playwright_mobile_chrome.js`) the executor drives.
- `url_transforms.py` transforms stay domain-agnostic (`mobile_subdomain`, `am_prefix`, `drop_www`).
-- Parent: [`packages/shared-skills/AGENTS.md`](../../../AGENTS.md).
+- Parent (source checkout only; not shipped with the skill): `packages/shared-skills/AGENTS.md`.
diff --git a/plugins/omo/skills/ultimate-browsing/references/agent-reach/README.md b/plugins/omo/skills/ultimate-browsing/references/agent-reach/README.md
index ed2a1de2..0d7de2a9 100644
--- a/plugins/omo/skills/ultimate-browsing/references/agent-reach/README.md
+++ b/plugins/omo/skills/ultimate-browsing/references/agent-reach/README.md
@@ -25,13 +25,13 @@
mcporter call 'exa.web_search_exa(query: "query", numResults: 5)'
# 通用网页阅读
-curl -s "https://r.jina.ai/URL"
+curl -s -H "Authorization: Bearer ${JINA_API_KEY}" "https://r.jina.ai/URL"
# GitHub 搜索
gh search repos "query" --sort stars --limit 10
# Twitter 搜索
-twitter search "query" --limit 10
+twitter search "query" -n 10
# YouTube/B站字幕
yt-dlp --write-sub --skip-download -o "/tmp/%(id)s" "URL"
diff --git a/plugins/omo/skills/ultimate-browsing/references/agent-reach/career.md b/plugins/omo/skills/ultimate-browsing/references/agent-reach/career.md
index f1b46fe7..ff5fed6d 100644
--- a/plugins/omo/skills/ultimate-browsing/references/agent-reach/career.md
+++ b/plugins/omo/skills/ultimate-browsing/references/agent-reach/career.md
@@ -25,5 +25,5 @@ mcporter call 'linkedin-scraper.search_jobs(keyword: "software engineer", limit:
如果 MCP 不可用,可以用 Jina Reader:
```bash
-curl -s "https://r.jina.ai/https://linkedin.com/in/username"
+curl -s -H "Authorization: Bearer ${JINA_API_KEY}" "https://r.jina.ai/https://linkedin.com/in/username"
```
diff --git a/plugins/omo/skills/ultimate-browsing/references/agent-reach/social.md b/plugins/omo/skills/ultimate-browsing/references/agent-reach/social.md
index 723c7424..9679135e 100644
--- a/plugins/omo/skills/ultimate-browsing/references/agent-reach/social.md
+++ b/plugins/omo/skills/ultimate-browsing/references/agent-reach/social.md
@@ -105,7 +105,7 @@ twitter likes
```bash
# 使用 Jina Reader 读取
-curl -s "https://r.jina.ai/https://weibo.com/USER_ID/POST_ID"
+curl -s -H "Authorization: Bearer ${JINA_API_KEY}" "https://r.jina.ai/https://weibo.com/USER_ID/POST_ID"
```
> 微博主要通过网页抓取,推荐使用通用网页读取方式。
diff --git a/plugins/omo/skills/ultimate-browsing/references/agent-reach/web.md b/plugins/omo/skills/ultimate-browsing/references/agent-reach/web.md
index c09a34ea..39a24c80 100644
--- a/plugins/omo/skills/ultimate-browsing/references/agent-reach/web.md
+++ b/plugins/omo/skills/ultimate-browsing/references/agent-reach/web.md
@@ -6,13 +6,13 @@
```bash
# 读取任意网页内容
-curl -s "https://r.jina.ai/URL"
+curl -s -H "Authorization: Bearer ${JINA_API_KEY}" "https://r.jina.ai/URL"
# 示例
-curl -s "https://r.jina.ai/https://example.com/article"
+curl -s -H "Authorization: Bearer ${JINA_API_KEY}" "https://r.jina.ai/https://example.com/article"
```
-**适用场景**: 大多数网页可以直接用 Jina Reader 读取。
+**适用场景**: 大多数网页可以直接用 Jina Reader 读取。匿名调用返回 401,必须带 `JINA_API_KEY`(见 [../insane-search/jina.md](../insane-search/jina.md))。
## Web Reader (MCP)
@@ -69,7 +69,7 @@ for e in feedparser.parse('FEED_URL').entries[:5]:
| 场景 | 推荐工具 |
|-----|---------|
-| 通用网页 | Jina Reader (`curl r.jina.ai`) |
+| 通用网页 | Jina Reader (`curl r.jina.ai`,需 `JINA_API_KEY`) |
| 需要图片/格式控制 | web-reader MCP |
| 微信公众号 | Exa (搜索+阅读) / Camoufox (可选阅读) |
| RSS 订阅 | feedparser |
diff --git a/plugins/omo/skills/ultimate-browsing/references/chrome-stealth.md b/plugins/omo/skills/ultimate-browsing/references/chrome-stealth.md
index a5f9a7fa..6edd1809 100644
--- a/plugins/omo/skills/ultimate-browsing/references/chrome-stealth.md
+++ b/plugins/omo/skills/ultimate-browsing/references/chrome-stealth.md
@@ -29,7 +29,8 @@ page that only a signed-in user can reach belongs to the attached engine, not to
## Cookie login limits
-`scripts/extract_cookies.py` still exports cookies from a local browser; inject them with
+`scripts/extract_cookies.py` still exports cookies from a local browser's default profile store (run it only where
+that profile is not the user's live one; see `../SKILL.md`, Cookie login); inject them with
`injectCookies(page, cookies)` into an **owned** profile. It sanitizes the set (drops expired
entries, keeps host-prefixed cookies secure and root-scoped). Limits that do not change:
diff --git a/plugins/omo/skills/ultimate-browsing/references/insane-search/README.md b/plugins/omo/skills/ultimate-browsing/references/insane-search/README.md
index 48db53fb..bd2d3934 100644
--- a/plugins/omo/skills/ultimate-browsing/references/insane-search/README.md
+++ b/plugins/omo/skills/ultimate-browsing/references/insane-search/README.md
@@ -17,7 +17,7 @@
2. 즉시 다음을 실행:
```bash
python3 -B -m engine "<URL>" [--selector "<CSS>"] [--device auto|desktop|mobile] [--trace] \
- [--no-retry] [--no-extract]
+ [--timeout 25] [--max-attempts 12] [--no-playwright] [--allow-proxy] [--json]
```
3. 종료코드 0(ok) 또는 1(fail) 받은 뒤 판단. trace를 먼저 읽고 재시도 결정.
4. 실패 시에만 `--trace --json`으로 재호출해서 원인 진단 후 `--device` 또는 `user_hint` 조정.
@@ -124,7 +124,7 @@
### 단일 진입점
```python
-from insane_search.engine import fetch
+from engine import fetch # 스킬 디렉터리에서 실행 (패키지는 engine/)
result = fetch(
"https://example.com/path",
@@ -136,15 +136,13 @@ result = fetch(
if result.ok:
print(result.verdict) # strong_ok | weak_ok
- html = result.content # raw body — 단, content-rescue가 발동한 경우 구조 텍스트
- # v0.10.0 content-rescue: PDF 응답은 pypdf 추출 텍스트, visible text가 얇은
- # SPA 셸은 JSON-LD articleBody / 렌더된 innerText로 대체될 수 있다.
- # result.extraction_source로 판별: "raw"(원문 그대로) | pdf | json_ld | *+inner_text.
- # 일반 HTML 성공은 항상 raw. 끄기: enable_extraction=False / --no-extract.
- # 429/502/503/504는 probe에서 백오프 재시도(Retry-After 반영, 총 10초 캡);
- # 끄기: enable_retry=False / --no-retry.
+ html = result.content # raw body (내장 추출/변환 없음)
+ # 필드: ok, content, final_url, verdict, profile_used, trace, summary,
+ # provenance, snapshot_timestamp, trust (engine/result_schema.py FetchResult).
+ # 업스트림 신버전의 content-rescue(PDF/JSON-LD 추출)와 Retry-After 백오프는
+ # 이 스냅샷에 없다 — engine/AGENTS.md의 WANT 목록. grid 시도 사이에는 짧은 jitter만 둔다.
else:
- # Phase 3 수동 개입 (Playwright MCP) 필요 — result.trace로 원인 진단
+ # result.trace로 원인 진단. 브라우저가 필요하면 아래 "needs_js_exec only 폴백 규칙"을 따른다
pass
```
@@ -191,16 +189,17 @@ report — FetchResult(ok, verdict, profile_used, trace, summary)
| 태그 | 실행기 | 언제 |
|------|--------|------|
| `needs_real_tls_stack` + `needs_js_exec` | `playwright_real_chrome.js` (로컬 Node) | Akamai Bot Manager 등 — Chromium 번들 TLS는 탐지됨 |
-| `needs_js_exec` only | Playwright MCP (`mcp__playwright__*`) | Cloudflare 기본 방어 등 |
+| `needs_js_exec` only | 에이전트가 직접 띄우는 브라우저 (엔진은 stub만 반환, 아래 규칙) | Cloudflare 기본 방어 등 |
| `needs_mobile_context` (+ real_tls) | `playwright_mobile_chrome.js` | 모바일 디바이스 에뮬레이션 필요 |
자세한 선택 기준: [playwright.md](playwright.md).
-### Playwright MCP 호출 규칙
+### `needs_js_exec only` 폴백 규칙
-`fetch_chain`의 `needs_js_exec only` 케이스는 **Claude 세션에서 MCP 도구를 직접 호출**해야 한다. subprocess 경로 없음. 즉:
+`fetch_chain`의 `needs_js_exec only` 케이스는 subprocess 경로가 없어 **에이전트가 직접 브라우저를 다뤄야** 한다. 즉:
1. `result.summary`에 "Playwright MCP must be invoked from the Claude session"이 포함되면
-2. `mcp__playwright__browser_navigate` → `browser_wait_for` → `browser_snapshot` 흐름으로 Claude가 직접 처리
+2. 엔진 문구가 MCP를 가리켜도 기본 경로는 Tier 2a owned engine이다: js eval에서 omowright `connectPipe`, 스텔스는 `connectCloakProfile` (`../../SKILL.md` Tier 2, the `browser` skill's `references/owned-engine/`)
+3. `mcp__playwright__*` 도구는 그 MCP가 이미 세션에 연결된 경우에만 쓴다. 없으면 새로 설치하지 않는다 ([playwright.md](playwright.md))
## Phase 2 — 수동 개입 (옵션)
@@ -233,7 +232,7 @@ Tier 1 추출 폴백 전용이며 에이전트가 직접 브라우저를 다루
```bash
# 범용 웹 (Jina Reader — 일반 HTML만, WAF 사이트엔 무효)
-curl -s "https://r.jina.ai/{URL}"
+curl -s -H "Authorization: Bearer ${JINA_API_KEY}" "https://r.jina.ai/{URL}"
# yt-dlp — 1,858 사이트 미디어 메타데이터
yt-dlp --dump-json "URL"
@@ -290,7 +289,7 @@ yt-dlp --write-sub --write-auto-sub --sub-lang "en,ko" --skip-download -o "/tmp/
| 파일 | 언제 읽는가 | 무엇을 다루는가 |
|------|-------------|-----------------|
| [`tls-impersonate.md`](tls-impersonate.md) | curl_cffi 격자가 전부 `challenge`/`blocked`로 끝날 때, 새 impersonate 타겟을 `waf_profiles.yaml`에 추가할 때 | curl_cffi로 Safari/Chrome/Firefox TLS(JA3/JA4) 지문 복제하는 방법, WAF(Akamai/Cloudflare/F5 등)별 최적 타겟 조합, 임퍼소네이션 타겟 버전 목록, `tls_impersonate_avoid`의 실증 근거 |
-| [`playwright.md`](playwright.md) | engine이 Playwright fallback으로 넘어가는데 MCP/Local Chrome 중 어디로 갈지 확인 필요할 때 | Approach 1 (`mcp__playwright__*` — Cloudflare급 챌린지), Approach 2 (Local Node + `channel:'chrome'` + stealth — Akamai Bot Manager급), 템플릿 파라미터 규격 |
+| [`playwright.md`](playwright.md) | engine이 Playwright fallback으로 넘어가는데 MCP/Local Chrome 중 어디로 갈지 확인 필요할 때 | Approach 1 (이미 연결된 경우의 `mcp__playwright__*`, 없으면 omowright owned engine — Cloudflare급 챌린지), Approach 2 (Local Node + `channel:'chrome'` + stealth — Akamai Bot Manager급), 템플릿 파라미터 규격 |
| [`fallback.md`](fallback.md) | `verdict`가 애매하거나 Phase 전환 타이밍 결정 필요할 때 | engine의 Phase 0→1→2→3 에스컬레이션 원칙, 응답 성공/실패 판정 기준 세부, 각 Phase 종료 조건 |
| [`metadata.md`](metadata.md) | 본문 전체를 못 가져왔지만 제목·요약·가격·저자 같은 핵심만이라도 필요할 때 | OGP 메타 태그, JSON-LD (Schema.org), Twitter Card 파싱, 구조화 데이터 추출 패턴 |
@@ -298,7 +297,7 @@ yt-dlp --write-sub --write-auto-sub --sub-lang "en,ko" --skip-download -o "/tmp/
| 파일 | 언제 읽는가 | 무엇을 다루는가 |
|------|-------------|-----------------|
-| [`jina.md`](jina.md) | WAF 없는 일반 웹(블로그·뉴스·Wiki)의 깨끗한 마크다운 추출 필요할 때 | `r.jina.ai/URL` 한 줄로 Puppeteer 기반 JS SPA 렌더링, 마크다운 변환, 무료 500 RPM, API 키 불필요 |
+| [`jina.md`](jina.md) | WAF 없는 일반 웹(블로그·뉴스·Wiki)의 깨끗한 마크다운 추출 필요할 때 | `r.jina.ai/URL` + `JINA_API_KEY` Bearer 헤더(익명 호출은 401)로 Puppeteer 기반 JS SPA 렌더링, 마크다운 변환 |
| [`cache-archive.md`](cache-archive.md) | 원본 사이트가 차단됐지만 과거 스냅샷으로라도 접근 필요할 때 | Wayback Machine CDX API, archive.today, AMP Cache (Google Cache는 2024-07 종료됨) |
| [`rss.md`](rss.md) | 뉴스·블로그·커뮤니티의 시계열 업데이트를 구조화해 받고 싶을 때 | RSS/Atom 자동 발견, 피드 파싱, 인증 불필요 — 가장 깔끔한 시계열 데이터 소스 |
diff --git a/plugins/omo/skills/ultimate-browsing/references/insane-search/fallback.md b/plugins/omo/skills/ultimate-browsing/references/insane-search/fallback.md
index 5065c2cd..e575c914 100644
--- a/plugins/omo/skills/ultimate-browsing/references/insane-search/fallback.md
+++ b/plugins/omo/skills/ultimate-browsing/references/insane-search/fallback.md
@@ -23,9 +23,12 @@
## Phase 1: 경량 프로브 (병렬)
+> **R1 ([README.md](README.md))**: 차단된 URL에는 WebFetch나 즉흥 curl을 쓰지 않는다. `python3 -B -m engine "<URL>"`이
+> 아래 Phase 1-3(curl_cffi 프로브, Referer/변환/디바이스 격자, 서로게이트, Playwright 폴백)을 실행한다.
+> 이 문서는 `--trace` 출력을 읽기 위한 단계 설명이다.
+
**먼저 시도** (동시):
-- WebFetch (Claude 내장)
-- Jina Reader (기본 / JSON / SPA 모드)
+- Jina Reader (기본 / JSON / SPA 모드, `JINA_API_KEY` 있을 때만)
- curl Chrome Desktop UA
**아직 성공 없으면 추가 시도**:
@@ -34,7 +37,6 @@
- URL 변형 시도: `.json`, `/rss`, `/feed`
**사이드카** (1차와 동시, low-trust):
-- Google AMP 캐시
- archive.today
- Wayback Machine
→ **원본이 하나라도 성공하면 사이드카는 참고만.** 전부 실패 시에만 사이드카 채택 (provenance 태깅 필수)
@@ -90,7 +92,7 @@ for target in TARGETS:
session = requests.Session(impersonate=target)
session.headers.update(HEADERS)
resp = session.get("{URL}", timeout=20)
- if resp.status_code == 200 and len(resp.text) > 300:
+ if resp.status_code == 200 and len(resp.text) >= 3072 and not any(m in resp.text for m in ("Access Denied", "Just a moment...", "DataDome", "sec-if-cpt-container")):
# 성공 — JSON-LD도 같이 추출
break
except:
@@ -103,7 +105,7 @@ for target in TARGETS:
---
-## Phase 3: Playwright MCP (브라우저)
+## Phase 3: 브라우저 (owned engine, 또는 이미 연결된 Playwright MCP)
**조건**: Phase 2도 실패 또는 JS 챌린지/CAPTCHA 감지
@@ -114,7 +116,9 @@ browser_evaluate → () => document.body.innerText (Light Mode — 먼저)
필요 시 browser_snapshot → 접근성 트리 전체
```
-**API 발견**: `browser_network_requests`로 숨은 JSON API를 찾으면 이후 curl_cffi로 재사용 가능.
+위 흐름은 Playwright MCP가 이미 세션에 연결된 경우의 도구 이름이다. 없으면 같은 단계를 Tier 2a owned engine(js eval의 omowright `connectPipe` / `connectCloakProfile`)으로 실행한다 — [README.md](README.md) "`needs_js_exec only` 폴백 규칙".
+
+**API 발견**: `browser_network_requests`(MCP) 또는 owned engine의 `createNetworkSnoop`(the `browser` skill's `references/owned-engine/network.md`)로 숨은 JSON API를 찾으면 이후 curl_cffi로 재사용 가능.
상세: [playwright.md](playwright.md)
diff --git a/plugins/omo/skills/ultimate-browsing/references/insane-search/jina.md b/plugins/omo/skills/ultimate-browsing/references/insane-search/jina.md
index 02780cfe..019aa687 100644
--- a/plugins/omo/skills/ultimate-browsing/references/insane-search/jina.md
+++ b/plugins/omo/skills/ultimate-browsing/references/insane-search/jina.md
@@ -21,7 +21,7 @@ curl -s -H "Authorization: Bearer ${JINA_API_KEY}" "https://r.jina.ai/{URL}"
### JSON 구조화 출력
```bash
-curl -H "Accept: application/json" "https://r.jina.ai/{URL}"
+curl -H "Authorization: Bearer ${JINA_API_KEY}" -H "Accept: application/json" "https://r.jina.ai/{URL}"
```
반환: `data.{title, description, url, content, metadata, external, usage}`
@@ -31,7 +31,7 @@ curl -H "Accept: application/json" "https://r.jina.ai/{URL}"
### CSS 선택자 타겟팅
```bash
-curl -H "X-Target-Selector: .article-body" "https://r.jina.ai/{URL}"
+curl -H "Authorization: Bearer ${JINA_API_KEY}" -H "X-Target-Selector: .article-body" "https://r.jina.ai/{URL}"
```
네비게이션/풋터 제거, 본문만 추출. 커뮤니티 게시판에서 특히 효과적.
@@ -39,7 +39,7 @@ curl -H "X-Target-Selector: .article-body" "https://r.jina.ai/{URL}"
### SPA 스트리밍 모드
```bash
-curl -H "Accept: text/event-stream" "https://r.jina.ai/{URL}"
+curl -H "Authorization: Bearer ${JINA_API_KEY}" -H "Accept: text/event-stream" "https://r.jina.ai/{URL}"
```
JS 로딩 완료까지 대기. 동적 콘텐츠가 완전히 렌더링된 최종 버전 반환.
@@ -47,7 +47,7 @@ JS 로딩 완료까지 대기. 동적 콘텐츠가 완전히 렌더링된 최종
### 스크린샷
```bash
-curl -H "X-Respond-With: screenshot" "https://r.jina.ai/{URL}"
+curl -H "Authorization: Bearer ${JINA_API_KEY}" -H "X-Respond-With: screenshot" "https://r.jina.ai/{URL}"
```
GCS 서명 URL 반환 (4시간 유효). 비주얼 검증 용도.
@@ -55,7 +55,7 @@ GCS 서명 URL 반환 (4시간 유효). 비주얼 검증 용도.
### PDF 처리
```bash
-curl -s "https://r.jina.ai/https://example.com/file.pdf"
+curl -s -H "Authorization: Bearer ${JINA_API_KEY}" "https://r.jina.ai/https://example.com/file.pdf"
```
PDF → 마크다운 자동 변환. 페이지 수 메타데이터 포함.
@@ -63,33 +63,33 @@ PDF → 마크다운 자동 변환. 페이지 수 메타데이터 포함.
### 쿠키 전달 (인증 사이트)
```bash
-curl -H "X-Set-Cookie: session=abc123" "https://r.jina.ai/{URL}"
+curl -H "Authorization: Bearer ${JINA_API_KEY}" -H "X-Set-Cookie: session=abc123" "https://r.jina.ai/{URL}"
```
### 링크 보존
```bash
-curl -H "X-With-Links: true" "https://r.jina.ai/{URL}"
+curl -H "Authorization: Bearer ${JINA_API_KEY}" -H "X-With-Links: true" "https://r.jina.ai/{URL}"
```
### 캐시 제어
```bash
# 캐시 우회 (실시간 필요 시)
-curl -H "X-No-Cache: true" "https://r.jina.ai/{URL}"
+curl -H "Authorization: Bearer ${JINA_API_KEY}" -H "X-No-Cache: true" "https://r.jina.ai/{URL}"
# 캐시 TTL 지정 (초)
-curl -H "X-Cache-Tolerance: 600" "https://r.jina.ai/{URL}"
+curl -H "Authorization: Bearer ${JINA_API_KEY}" -H "X-Cache-Tolerance: 600" "https://r.jina.ai/{URL}"
```
### 순수 텍스트 / 원본 HTML
```bash
# body.innerText만
-curl -H "X-Respond-With: text" "https://r.jina.ai/{URL}"
+curl -H "Authorization: Bearer ${JINA_API_KEY}" -H "X-Respond-With: text" "https://r.jina.ai/{URL}"
# 원본 HTML
-curl -H "X-Respond-With: html" "https://r.jina.ai/{URL}"
+curl -H "Authorization: Bearer ${JINA_API_KEY}" -H "X-Respond-With: html" "https://r.jina.ai/{URL}"
```
## 검증된 성공 사이트
@@ -131,6 +131,6 @@ curl -H "X-Respond-With: html" "https://r.jina.ai/{URL}"
Jina JSON 모드의 `external.alternate`에서 사이트의 RSS URL이 자동 노출됨:
```bash
-curl -H "Accept: application/json" "https://r.jina.ai/{URL}" | \
+curl -H "Authorization: Bearer ${JINA_API_KEY}" -H "Accept: application/json" "https://r.jina.ai/{URL}" | \
python3 -c "import sys,json; print(json.load(sys.stdin)['data'].get('external',{}))"
```
diff --git a/plugins/omo/skills/ultimate-browsing/references/insane-search/naver.md b/plugins/omo/skills/ultimate-browsing/references/insane-search/naver.md
index 7fbd5e77..7754659a 100644
--- a/plugins/omo/skills/ultimate-browsing/references/insane-search/naver.md
+++ b/plugins/omo/skills/ultimate-browsing/references/insane-search/naver.md
@@ -26,10 +26,10 @@ Jina Reader로 완전 접근 가능.
```bash
# 기사 목록
-curl -s "https://r.jina.ai/https://news.naver.com/"
+curl -s -H "Authorization: Bearer ${JINA_API_KEY}" "https://r.jina.ai/https://news.naver.com/"
# 개별 기사
-curl -s "https://r.jina.ai/https://n.news.naver.com/article/{press_id}/{article_id}"
+curl -s -H "Authorization: Bearer ${JINA_API_KEY}" "https://r.jina.ai/https://n.news.naver.com/article/{press_id}/{article_id}"
```
## 네이버 증권
@@ -37,7 +37,7 @@ curl -s "https://r.jina.ai/https://n.news.naver.com/article/{press_id}/{article_
Jina Reader로 실시간 주가, 주요 뉴스 접근.
```bash
-curl -s "https://r.jina.ai/https://finance.naver.com/item/main.naver?code={종목코드}"
+curl -s -H "Authorization: Bearer ${JINA_API_KEY}" "https://r.jina.ai/https://finance.naver.com/item/main.naver?code={종목코드}"
```
## 네이버 금융 시세 (비공식, 무인증)
diff --git a/plugins/omo/skills/ultimate-browsing/references/insane-search/playwright.md b/plugins/omo/skills/ultimate-browsing/references/insane-search/playwright.md
index a769294d..6193bdef 100644
--- a/plugins/omo/skills/ultimate-browsing/references/insane-search/playwright.md
+++ b/plugins/omo/skills/ultimate-browsing/references/insane-search/playwright.md
@@ -65,7 +65,7 @@ bun install
### 호출 (engine 내부)
```python
-from insane_search.engine.executor import run_playwright_fallback
+from engine.executor import run_playwright_fallback # 스킬 디렉터리에서 실행 (패키지는 engine/)
attempt, html = run_playwright_fallback(
"https://example.com/path",
diff --git a/plugins/omo/skills/ultimate-browsing/references/insane-search/rss.md b/plugins/omo/skills/ultimate-browsing/references/insane-search/rss.md
index 79e706d2..cc182fd9 100644
--- a/plugins/omo/skills/ultimate-browsing/references/insane-search/rss.md
+++ b/plugins/omo/skills/ultimate-browsing/references/insane-search/rss.md
@@ -13,7 +13,7 @@ python3 -c "import feedparser" 2>/dev/null || pip install feedparser -q
Jina Reader JSON 모드로 사이트의 RSS URL을 자동 탐지:
```bash
-curl -sH "Accept: application/json" "https://r.jina.ai/{URL}" | \
+curl -s -H "Authorization: Bearer ${JINA_API_KEY}" -H "Accept: application/json" "https://r.jina.ai/{URL}" | \
python3 -c "import sys,json; print(json.load(sys.stdin)['data'].get('external',{}).get('alternate',[]))"
```
diff --git a/plugins/omo/skills/ultimate-browsing/references/insane-search/tls-impersonate.md b/plugins/omo/skills/ultimate-browsing/references/insane-search/tls-impersonate.md
index 3a1db50a..96f359fa 100644
--- a/plugins/omo/skills/ultimate-browsing/references/insane-search/tls-impersonate.md
+++ b/plugins/omo/skills/ultimate-browsing/references/insane-search/tls-impersonate.md
@@ -59,11 +59,11 @@ def cffi_fetch(url, locale="ko-KR"):
generic alias는 항상 최신 버전으로 해석된다. **2026년에 chrome99 같은 옛 버전은 WAF가 의심하므로 generic alias 사용 권장.**
-| Alias | 해석 (2026.04) | 용도 |
+| Alias | 해석 (v0.15.0) | 용도 |
|-------|---------------|------|
-| `safari` | safari260 | **한국 사이트 최적** (쿠팡, 에펨코리아) |
+| `safari` | safari2601 | **한국 사이트 최적** (쿠팡, 에펨코리아) |
| `chrome` | chrome146 | 범용 (Cloudflare, Akamai) |
-| `firefox` | firefox135 | chrome/safari 실패 시 대안 |
+| `firefox` | firefox147 | chrome/safari 실패 시 대안 |
| `chrome_android` | chrome131_android | 모바일 API 엔드포인트 |
| `safari_ios` | safari260_ios | iOS 모바일 |
@@ -71,15 +71,20 @@ generic alias는 항상 최신 버전으로 해석된다. **2026년에 chrome99
<summary>핀 버전 전체 (클릭)</summary>
```
+edge99, edge101,
chrome99, chrome100, chrome101, chrome104, chrome107, chrome110,
chrome116, chrome119, chrome120, chrome123, chrome124, chrome131,
chrome133a, chrome136, chrome142, chrome145, chrome146,
-chrome131_android, edge99, edge101,
-safari15_3, safari15_5, safari17_0, safari17_2_ios,
-safari18_0, safari18_0_ios, safari260, safari260_ios,
-firefox133, firefox135
+chrome99_android, chrome131_android,
+safari153, safari155, safari170, safari172_ios,
+safari180, safari180_ios, safari184, safari184_ios,
+safari260, safari2601, safari260_ios,
+firefox133, firefox135, firefox144, firefox147,
+tor145
```
+구 표기(`safari15_3`, `safari15_5`, `safari17_0`, `safari17_2_ios`, `safari18_0`, `safari18_0_ios`, `safari18_4`, `safari18_4_ios`)는 deprecated alias로 아직 받는다.
+
</details>
## WAF별 최적 전략
diff --git a/plugins/omo/skills/ultrawork/SKILL.md b/plugins/omo/skills/ultrawork/SKILL.md
index 50ddfaa2..3cb58f16 100644
--- a/plugins/omo/skills/ultrawork/SKILL.md
+++ b/plugins/omo/skills/ultrawork/SKILL.md
@@ -119,6 +119,8 @@ Before the first task command, create one `RUN_TMP=$(mktemp -d)` per task, track
At task end, after owned processes exit, remove only owned directories, including runtime caches. Never wipe shared caches; retain worktrees still needed by open PRs and any parent directory containing them.
## 0. Survey the skills, gather context, then size the work
+This section records into the notepad, so run section 2's `NOTE=`
+command first; section 2 then initialises that same file.
First, survey the loaded skill list and read the description of each
loosely relevant skill. Decide explicitly which skills this task will
use and prefer using every genuinely applicable one — name them in the
diff --git a/plugins/omo/skills/ulw-execute/SKILL.md b/plugins/omo/skills/ulw-execute/SKILL.md
index 34b9effd..974a6026 100644
--- a/plugins/omo/skills/ulw-execute/SKILL.md
+++ b/plugins/omo/skills/ulw-execute/SKILL.md
@@ -32,6 +32,8 @@ For work likely to exceed one wait cycle, require the child to send `WORKING: <t
**YOU DO NOT WRITE CODE. YOU DO NOT EDIT PRODUCT FILES. YOU DO NOT RUN QA YOURSELF. EVERY unit of implementation, test, QA, and review work MUST be delegated to a spawned subagent. NO EXCEPTIONS.** Your hands touch only plan selection, `.omo/` state (Boulder, ledger, plan checkboxes), decomposition, dispatch, verdicts, and evidence records. About to edit a product file or run an implementation command yourself? **STOP. SPAWN A WORKER INSTEAD.** Orchestrate at **MAXIMUM PARALLELISM**: every independent unit runs concurrently; only named dependencies serialize.
+This rule binds the root of a ulw-execute run: a worker runs every implementation and per-task QA scenario, and you judge the artifacts it captured. The Codex edition's one exception is the final verification in the Completion section below, where the root runs its own manual QA on the real surface and records a self-review. Outside a ulw-execute run (a bare ultrawork run, a ulw-loop final gate, a standalone `review-work`), the session that owns the run runs the final real-surface QA itself.
+
### Codex tier mapping for the delegation router
When tier worker agents are installed, map the delegation router's parenthesized difficulty to `agent_type`: (low) -> `lazycodex-worker-low`; (medium) -> `lazycodex-worker-medium`; (high) -> `lazycodex-worker-high`. Explorer/librarian research lanes keep their own roles. On spawn surfaces without `agent_type`, state the tier inside `message`. Difficulty (model power) is orthogonal to the LIGHT/HEAVY rigor tier in step 4 — judge each on its own facts.
@@ -112,7 +114,7 @@ Every phase (plan wave) runs in its own task-owned worktree with its own goal: b
Solo orchestration with parallel background workers is the default topology. Decide once, when the wave's lanes are known, and record the verdict in the ledger:
- **Independent lanes -> parallel workers.** Separate files, no shared contract: one parallel spawn burst; no team.
-- **Dependency-ordered lanes -> one `workflow` run per wave.** Sub-tasks with real ordering between them (C needs A and B finished first) and a harness with a native `workflow` tool: dispatch the wave as ONE run (one producer node per lane plus a verification node); recover inside it with `retry`/`amend`/`send`; let the run's settle wake you instead of arming per-lane watchers; the next wave is a NEW run (or `amend` when only the definition changed) — never one graph for the whole plan. When the harness lists the `mass-ulw` skill, read its `SKILL.md` and `references/planning.md` IN FULL before defining any graph.
+- **Dependency-ordered lanes -> one `workflow` run per wave.** Sub-tasks with real ordering between them (C needs A and B finished first) and a harness with a native `workflow` tool: dispatch the wave as ONE run (one producer node per lane plus a verification node); recover inside it with `retry`/`amend`/`send`; let the run's settle wake you instead of arming per-lane watchers; the next wave is a NEW run (use `amend` only to re-run the current wave after its definition changed) — never one graph for the whole plan. When the harness lists the `mass-ulw` skill, read its `SKILL.md` and `references/planning.md` IN FULL before defining any graph.
- **Overlapping lanes -> a team.** The lanes touch the same module or contract AND running them concurrently actually finishes sooner: stand up a team (where the harness has one) so one lane's discoveries relay through you mid-flight.
- **PR-mode independent lanes -> a worktree per lane.** Under `--make-pr`/`--ship`, when a wave holds independent checkboxes, give each lane its own branch and task-owned worktree, delivered as its own PR.
@@ -152,7 +154,6 @@ When the plan annotates a todo with `Recommended task executor category:`, follo
| `unspecified-high` (medium) | standard features across a few files with known patterns |
| `visual-engineering` (medium) | frontend, UI/UX, styling, animation |
| `writing` (low) | documentation and prose |
-| `git` (low) | git operations |
| `deep-low` (medium) | hairy debugging, research-heavy or subtle cross-module work the worker can settle from what it reads |
| `deep-high` (high) | the same, when the central decision cannot be settled from evidence: a trade-off, a cross-package contract, or correctness argued from invariants |
| `ultrabrain` (high) | ONE genuinely hard, logic-heavy problem — hand it the goal, not step-by-step instructions |
@@ -162,6 +163,8 @@ Sizing is a two-branch decision made per checkbox, before dispatch:
- **Splittable work splits.** When the checkbox decomposes into independent pieces, dispatch them as a swarm of `quick`/`unspecified-low` workers in ONE parallel burst — many small cheap workers in parallel beat one large delegation.
- **Cohesive hard work stays whole.** When splitting would sever shared reasoning (one algorithm, one migration, one subtle bug), send the WHOLE problem to `deep-low`, `deep-high` or `ultrabrain` as ONE delegation. Never force-split work whose parts share one insight.
+Git operations are not a category: route them to a `quick` worker and name the `git-master` skill in its brief (`load_skills` where the spawn tool takes it).
+
Each sub-task message must include:
1. Goal and exact files or directories in scope.
@@ -173,7 +176,7 @@ Each sub-task message must include:
- Terminal / TUI: drive a real pty; `tmux send-keys` is fine for a boot/behavior smoke, but color/layout/CJK evidence goes through the xterm.js web terminal below, NEVER `tmux capture-pane`.
- Browser use: omowright from js eval (staged in the `browser` skill) — the owned engine (`connectPipe` on a task-owned profile, `connectCloakProfile` for bot-scored targets) for unauthenticated pages, the attached engine (`connectBrowserSkill()` in the user's signed-in browser) when the page needs their login; never a clone of or a launch against the live profile.
- Computer use: OS-level GUI automation against the running desktop app when the surface is not a page.
- - TUI visual evidence: when a TUI claim needs visual QA or PR proof, run `bun script/qa/web-terminal-visual-qa.mjs --command "<cmd>" --input "{Enter}" --evidence-dir <dir>` (real pty rendered through xterm.js in Chrome) and attach `terminal.png` plus `metadata.json`.
+ - TUI visual evidence: when a TUI claim needs visual QA or PR proof, run `bun script/qa/web-terminal-visual-qa.mjs --title "<surface>" --command "<cmd>" --input "{Enter}" --evidence-dir <dir>` (real pty rendered through xterm.js in Chrome) and attach `terminal.png` plus `metadata.json`.
6. The adversarial classes that apply to this sub-task (from the 9 ultraqa classes) and how each is probed.
7. Required artifact path and cleanup receipt.
8. Tool-use expectations: batch independent tool calls in parallel; when the harness exposes a code-execution surface (eval), use it for multi-call steps instead of one-by-one calls.
@@ -218,10 +221,10 @@ A worker done claim is never final: each implementation sub-task returns a `Done
Rules:
- `confirmed` is the only pass verdict. `false-positive`, `needs-fix`, and `needs-human-review` all block checkbox completion.
-- The verifier must be independent from the executor: use the harness's gate reviewer (see the harness compatibility section) or a fresh reviewer worker on a strong model, or root only when root did not implement or materially rewrite that task.
+- The verifier must be independent from the executor: use the harness's gate reviewer (see the harness compatibility section) or a fresh reviewer worker on a strong model. Root never verifies; it records the verifier's verdict.
- A worker done claim must be independently verified before it becomes checkbox completion.
- On a non-confirmed verdict, append the feedback to the ledger with the attempt number and its failure signature (the failing check plus its first error line, with volatile values stripped: temp-dir paths, timestamps, process and run ids, durations). Attempts count per checkbox across all its sub-tasks and re-splits, timed from its first dispatch (`checkpoint_opened_at`). STOP when the same signature repeats on consecutive attempts, on the third failed attempt, or 4 hours after the first dispatch (a plan may change these numbers, never remove the stop). Check the 4-hour bound also when a lane's watcher fires or the turn resumes without a verdict; when it has passed, cancel that lane and stop the same way: mark the checkbox `- [~]` (the plan grammar's blocked state) with a one-line gap naming what is unmet and the last evidence, mark every checkbox that depends on it, directly or through another `[~]` row, `- [~]` with the gap `blocked by <id>`, close the todo of every row marked `[~]` here labelled `blocked: <gap>`, append an `unmet` ledger entry listing what each attempt changed, and continue in the same turn with the next checkpoint that depends on none of them, or with Completion when none remains. Otherwise leave the checkbox `- [ ]` and re-dispatch the executor with the exact failure.
-- A `[~]` row counts as closed, never as a met dependency: Phase 3 skips it, Completion starts once every top-level row is `[x]` or `[~]`, and the `ORCHESTRATION COMPLETE` block names each `[~]` row with its gap. Final Verification Wave rows are never dependents of a `[~]` row: they verify the landed work and report each `[~]` row as a known gap, which alone never fails a final-wave row. A `[~]` gap is never re-queued as a new checkbox in this run, by the blast-radius rule or by a final-wave verdict; the one harness-repair follow-up in the next rule is the only exception.
+- A `[~]` row counts as closed, never as a met dependency: Phase 3 skips it, Completion starts once every top-level row is `[x]` or `[~]`, and the `ORCHESTRATION COMPLETE` block names each `[~]` row with its gap; a block with any `[~]` row is a partial-delivery report, never a success claim, and the run's goal is reported unmet. Final Verification Wave rows are never dependents of a `[~]` row: they verify the landed work and report each `[~]` row as a known gap, which alone never fails a final-wave row. A `[~]` gap is never re-queued as a new checkbox in this run, by the blast-radius rule or by a final-wave verdict; the one harness-repair follow-up in the next rule is the only exception.
- The verifier sets `failure_class`. A `harness` failure (the runner, fixture, CI job or environment failed and the product behavior was never exercised) gets one repair dispatch inside the checkpoint, which does not count as an attempt; when it recurs, stop as above with the harness gap named and append the harness repair once as a follow-up checkbox; a harness-repair follow-up that stops is reported, not re-appended.
- The verifier must probe the applicable adversarial keys, including `stale_state`, `dirty_worktree`, and `misleading_success_output`, before allowing `FullyDone`.
@@ -241,7 +244,7 @@ When all top-level checkboxes in `## TODOs` and `## Final Verification Wave` are
1. Run the plan's final verification commands.
2. Record a self-review in the notepad: re-read the diff, run diagnostics, and capture evidence for every acceptance criterion. Run your own manual QA on the real surface.
3. Only when the user demanded strict, rigorous, or high-accuracy review, spawn ONE `lazycodex-gate-reviewer`; otherwise your self-review is the final verification.
-4. Finish the PR/branch lifecycle from its task-owned worktree: sync `.omo/` state back to the main repo, create or update the PR, wait for review/verification gates, merge by default unless explicitly opted out, and remove the worktree only after successful merge or explicit handoff. Finish directory teardown per Task resources and record its receipts.
+4. Finish the PR/branch lifecycle from its task-owned worktree: sync `.omo/` state back to the main repo, create or update the PR, wait for review/verification gates; `--ship` merges per the repository's merge policy, `--make-pr` hands off with the PR URL and merges only if the user asks; remove the worktree only after a successful merge or that explicit handoff. Finish directory teardown per Task resources and record its receipts.
5. Remove or mark the Boulder work as completed.
6. Print an `ORCHESTRATION COMPLETE` block with the plan path, verification commands, artifacts, and cleanup receipts.
diff --git a/plugins/omo/skills/ulw-loop/SKILL.md b/plugins/omo/skills/ulw-loop/SKILL.md
index 0462c054..7142a9a8 100644
--- a/plugins/omo/skills/ulw-loop/SKILL.md
+++ b/plugins/omo/skills/ulw-loop/SKILL.md
@@ -69,7 +69,7 @@ Stand up a team when BOTH hold:
1. **The units' scopes overlap in a way you cannot cleanly cut.** They touch the same module, contract, or migration, so one unit's discovery changes what another should do. Fire-and-forget workers cannot exchange that mid-flight; teammates can, because the lead relays it.
2. **Running them at the same time actually finishes sooner.** The units are each substantial and none is merely waiting on another's output. Two units where the second only consumes the first's result are a sequence, not a team.
-When the units are genuinely independent — separate files, no shared contract — spawn parallel background `task` workers instead and avoid the team coordination overhead entirely. When the work is one cohesive unit, do it yourself. Overlap alone is not enough: near-identical units that would collide on the same lines are faster done in sequence by one worker.
+When the units are genuinely independent — separate files, no shared contract — spawn parallel background `task` workers instead and avoid the team coordination overhead entirely. When the work is one cohesive unit, keep it in this session - delegating only the code edits, test writes, fixes, and QA executions the rule above requires. Overlap alone is not enough: near-identical units that would collide on the same lines are faster done in sequence by one worker.
Under team mode, isolate and land per unit:
diff --git a/plugins/omo/skills/ulw-loop/references/define-goal.md b/plugins/omo/skills/ulw-loop/references/define-goal.md
index 688a9a07..1cd6e2c7 100644
--- a/plugins/omo/skills/ulw-loop/references/define-goal.md
+++ b/plugins/omo/skills/ulw-loop/references/define-goal.md
@@ -87,7 +87,7 @@ Repaired: "Resolve every open change-requesting review comment on PR 123 touchin
| an active goal conflicting with this intent | Stop and surface the conflict; the user decides whether to finish it, complete it, or branch. |
2. Goals are unlimited. Never invent a numeric budget, token limit, or deadline the user did not state — that ban covers run quotas; the `assumed:` work constraints from Objective anatomy #4 are different and required.
-3. In a ulw-loop run, the loop CLI owns per-goal state (`.omo/ulw-loop/goals.json`): `create_goal` registers the aggregate objective from the printed handoff, and this reference shapes both that objective and every goal's `successCriteria` at `create-goals` time.
+3. In a ulw-loop run, the loop SDK owns per-goal state (`.omo/ulw-loop/<session-id>/goals.json`): `create_goal` registers the aggregate objective from the handoff create-goals returns, and this reference shapes both that objective and every goal's `successCriteria` at `create-goals` time.
## Completion honesty
diff --git a/plugins/omo/skills/ulw-loop/references/full-workflow.md b/plugins/omo/skills/ulw-loop/references/full-workflow.md
index b6ea1dea..7882c423 100644
--- a/plugins/omo/skills/ulw-loop/references/full-workflow.md
+++ b/plugins/omo/skills/ulw-loop/references/full-workflow.md
@@ -10,7 +10,7 @@ Expert goal orchestration agent. You conduct; right-sized subagents play. Plan d
Use GPT-5.x style: outcome-first, evidence-bound, atomic decisions, no nested branching prose.
## Goal
-Deliver every goal in `.omo/ulw-loop/goals.json` end-to-end.
+Deliver every goal in `.omo/ulw-loop/<session-id>/goals.json` end-to-end.
Prove EVERY success criterion with captured observable evidence from a real-usage scenario you ran (HTTP / tmux / browser / computer-use below).
TESTS ALONE NEVER PROVE DONE. A green test suite is supporting evidence, not completion proof.
Audit each pass, fail, block, steering change, and checkpoint in `.omo/ulw-loop/<session-id>/ledger.jsonl`.
@@ -24,8 +24,8 @@ Run each criterion's real-surface proof yourself through the channel that faithf
4. **Computer use** — for desktop/GUI apps, drive the running app via OS automation (computer-use, AppleScript, xdotool, etc.); capture action log + screenshot.
For TUI visual QA (mandatory when a PR or review must inspect the terminal screen),
-run `node script/qa/web-terminal-visual-qa.mjs --command "<cmd>" --input "{Enter}"
---evidence-dir <dir>` (live pty + xterm.js in Chrome; `--from-file` replays a raw
+run `node script/qa/web-terminal-visual-qa.mjs --title "<surface>" --command "<cmd>"
+--input "{Enter}" --evidence-dir <dir>` (live pty + xterm.js in Chrome; `--from-file` replays a raw
stream) and record `terminal.png`, `terminal.txt`, and `metadata.json`.
Auxiliary surfaces (CLI stdout / DB state diff / parsed config dump) are first-class evidence for CLI- or data-shaped criteria; use a channel scenario when the behavior is user-facing. `--dry-run`, printing the command, "should respond", and "looks correct" never count.
@@ -62,9 +62,9 @@ Codex subagent reliability:
- Fallback only when the child is completed without the deliverable, ack-only after `followup_task`, explicitly `BLOCKED:`, or no longer running. Then send `TASK STILL ACTIVE: return <deliverable> or BLOCKED: <reason>` via `followup_task` when it can still recover the lane; otherwise record inconclusive, do not count it as pass/review approval, stop it if safe, and respawn a smaller `fork_turns: "none"` task with the missing deliverable.
## Artifacts
-- `.omo/ulw-loop/brief.md`: original brief and durable constraints.
-- `.omo/ulw-loop/goals.json`: goals with embedded `successCriteria` per goal.
-- `.omo/ulw-loop/ledger.jsonl`: append-only audit trail.
+- `.omo/ulw-loop/<session-id>/brief.md`: original brief and durable constraints.
+- `.omo/ulw-loop/<session-id>/goals.json`: goals with embedded `successCriteria` per goal.
+- `.omo/ulw-loop/<session-id>/ledger.jsonl`: append-only audit trail.
- Read artifacts before resuming, steering, or checkpointing.
- After compaction or context loss, re-read brief + goals + ledger FIRST, then `omo-agent-toolkit ulw-loop status --json`. Recover from artifacts; never re-plan from scratch or repeat completed work.
- Never invent state outside `.omo/ulw-loop` artifacts or `omo-agent-toolkit ulw-loop status --json`.
@@ -152,7 +152,7 @@ Loop per goal. Cap at 5 cycles per goal. Cap identical same-criterion failures a
| get_goal result | action |
|-----------------|--------|
-| no active goal | You MUST call `create_goal` — goal registration goes through the tool, never prose — with objective only from `instruction.json.objective`; do not copy lifecycle fields such as `status`. |
+| no active goal | You MUST call `create_goal` — goal registration goes through the tool, never prose — with objective only from the handoff's rendered `create_goal` payload; do not copy lifecycle fields such as `status`. |
| same aggregate objective active | Continue the current ulw-loop story. |
| different goal active | STOP. Checkpoint blocked and surface the conflict. |
4. If retrying failed work, run `omo-agent-toolkit ulw-loop complete-goals --retry-failed --json`.
@@ -190,11 +190,11 @@ omo-agent-toolkit ulw-loop status --json
# Read nextActions and currentAttemptDir.
omo-agent-toolkit ulw-loop record-evidence --goal-id <g> --criterion-id <c> --status pass --evidence "..."
# Repeat record-evidence once per criterion.
-# Then use the harness update_goal tool with status complete.
omo-agent-toolkit ulw-loop checkpoint --goal-id <g> --print-template --json
# Fill the printed template: replace every placeholder and use real artifact paths under currentAttemptDir.
# codex-goal-json.goal.objective must equal the plan's codexObjective verbatim.
omo-agent-toolkit ulw-loop checkpoint --goal-id <g> --status complete --evidence "..." --codex-goal-json <path> --quality-gate-json <path>
+# Only after that gated checkpoint succeeds, use the harness update_goal tool with status complete.
omo-agent-toolkit ulw-loop complete-goals
```
@@ -206,7 +206,7 @@ Trigger only for the final aggregate goal after every criterion in every goal is
2. FREEZE first — no more edits or rebases. At the frozen HEAD, re-run Manual-QA for any PASS criterion whose stamped tree differs from `git rev-parse --short "HEAD^{tree}"`, so every criterion is proven on the frozen tree; each artifact exists and is non-empty.
3a. Spawn lazycodex-code-reviewer and lazycodex-qa-executor in parallel (`fork_context: false` on v1; `fork_turns: "none"` on v2) with brief, goals, desired outcome, diff, evidence; wait for BOTH and confirm their report artifacts exist on disk.
3b. Only then spawn lazycodex-gate-reviewer with those artifact paths.
-3c. The gate's approval binds to the frozen tree and full commit SHA and covers its three lanes — code quality, hands-on QA, and goal verification. Immediately append one durable `.omo/ulw-loop/ledger.jsonl` record per passing lane with the lane name, full SHA, verdict, and report artifact/source. Before reuse after continuation or compaction, re-read the ledger and require the exact lane/SHA pair; memory or an unstamped report is not coverage. A later rebase or amend that keeps the tree identical still has a new SHA and needs fresh lane stamps; changed content needs fresh review of the delta.
+3c. The gate's approval binds to the frozen tree and full commit SHA and covers its three lanes — code quality, hands-on QA, and goal verification. Immediately append one durable `.omo/ulw-loop/<session-id>/ledger.jsonl` record per passing lane with the lane name, full SHA, verdict, and report artifact/source. Before reuse after continuation or compaction, re-read the ledger and require the exact lane/SHA pair; memory or an unstamped report is not coverage. A later rebase or amend that keeps the tree identical still has a new SHA and needs fresh lane stamps; changed content needs fresh review of the delta.
4. Treat timeout, missing deliverable, ack-only, `BLOCKED:`, or inconclusive review as a blocker. Any fix restarts the freeze at the new HEAD: re-run ONLY the proofs it invalidated and stamp the fresh output — never regenerate all evidence or relabel stale output to HEAD — re-review the delta at most TWICE; then record-review-blockers (step 5) and surface to the user.
5. If review remains blocked, run `omo-agent-toolkit ulw-loop record-review-blockers --goal-id <id> --title "<...>" --objective "<...>" --evidence "<review findings>" --codex-goal-json <snapshot> --json`.
6. If clean, checkpoint final completion:
@@ -251,7 +251,7 @@ Structured prompt directives accepted: `OMO_ULW_LOOP_STEER: { ... }`, `omo.ulw-l
3. Evidence is bound to the tree it was captured at; changed tracked content invalidates it — re-run the QA at the current HEAD and re-record (an identical tree after rebase/amend stays valid). NEVER mark PASS from memory, and NEVER relabel, pin, refresh, or regenerate prior output to a moved HEAD.
4. NEVER bypass the criteria gate: non-final aggregate completion requires all essential criteria; final aggregate completion requires all criteria across the whole plan.
5. Baseline build/lint/typecheck/test commands are necessary evidence, NOT SUFFICIENT completion proof. Criteria coverage with observable evidence is the gate.
-6. Treat `.omo/ulw-loop/ledger.jsonl` as the durable audit trail; checkpoint after every success or failure.
+6. Treat `.omo/ulw-loop/<session-id>/ledger.jsonl` as the durable audit trail; checkpoint after every success or failure.
7. Per-story Codex goal mode is opt-in only with `--codex-goal-mode per-story`; default is aggregate.
8. Structured steering directives mutate state through validation; normal prose does not.
9. Evidence MUST be observable from the real surface per the Manual-QA channel table — never a printed command, `--dry-run`, or "looks correct".
diff --git a/plugins/omo/skills/ulw-plan/references/full-workflow.md b/plugins/omo/skills/ulw-plan/references/full-workflow.md
index 975a88c7..903c4db0 100644
--- a/plugins/omo/skills/ulw-plan/references/full-workflow.md
+++ b/plugins/omo/skills/ulw-plan/references/full-workflow.md
@@ -180,7 +180,7 @@ Every "present the plan summary/brief" above delivers THIS structure, in the use
3. **Shape** - how many phases/waves and how many tasks: N implementation todos (`- [ ] N.` rows) + F final-verification tasks (`- [ ] F<n>.` rows), plus the executor-category mix (e.g. 6x `quick`, 2x `unspecified-high`, 1x `ultrabrain`).
4. **Added beyond the request** - what exploration surfaced and you folded in that the user never explicitly asked for (edge cases, migrations, tests, rollback, docs), each with a one-line reason; say "none" if nothing was added.
5. **Verification** - how completion will be proven: the final verification wave plus the key QA scenarios/commands.
-6. **Execution handoff** - the plan runs in a worker session via `$ulw-execute <plan-name>`; introduce the options: `--worktree <absolute-path>` (task-owned worktree; required for PR/branch work), `--make-pr` (deliver as a PR; auto-creates a task-owned worktree), `--ship` (implies `--make-pr`, keeps working until the PR is reviewed and MERGED).
+6. **Execution handoff** - the plan runs in a worker session via `$ulw-execute <plan-name>`; introduce the options: `--worktree <absolute-path>` (optional: reuse an existing task-owned worktree for the first phase; every phase runs in its own task-owned worktree regardless), `--make-pr` (deliver as a PR; auto-creates a task-owned worktree), `--ship` (implies `--make-pr`, keeps working until the PR is reviewed and MERGED).
### High-accuracy review (dual review)
The high-accuracy review is DUAL and both passes must return OKAY before handoff: (1) the native `momus` reviewer subagent, and (2) an independent Codex CLI review on gpt-5.6-sol at xhigh reasoning, run in a disposable isolated workspace and `CODEX_HOME` with the harness's normal approval and sandbox policy. Do not add flags that disable approvals or sandboxing. Momus runs at High and may take substantially longer than other agents. One round = exactly ONE `momus` + ONE independent review, dispatched together against the COMPLETE plan file (todos + TL;DR filled) at the draft's exact recorded `plan_path`. Keep Momus in flight and wait for its terminal result: elapsed time alone never justifies cancelling, duplicating, replacing, or treating it as failed. After both verdicts return, fix every eligible blocker and resubmit both fresh under the bounded convergence contract below; ineligible findings become non-blocking notes. CLEAR: runs when the user opts in or `review_required: true`. UNCLEAR: runs automatically unless Classify=Trivial.
diff --git a/plugins/omo/skills/ulw-plan/references/intent-unclear.md b/plugins/omo/skills/ulw-plan/references/intent-unclear.md
index 2cdb536f..64e7c36e 100644
--- a/plugins/omo/skills/ulw-plan/references/intent-unclear.md
+++ b/plugins/omo/skills/ulw-plan/references/intent-unclear.md
@@ -10,7 +10,7 @@ metadata:
Read this when INTENT ROUTING resolved to UNCLEAR: the desired OUTCOME is fuzzy - a vague request, a bootstrap, `$ulw-execute` with no selectable plan, or a goal the user cannot yet articulate. Asking the user to resolve it would offload the planner's own job onto them.
<stance>
-PRIME DIRECTIVE: do NOT interrogate the user. Resolve ambiguity by RESEARCH, not questions. You are a consultant who does the homework and ANNOUNCES loud best-practice defaults, not a form to fill in. The user's time is spent only on a genuinely irreversible, destructive, or safety-critical fork that research cannot settle - then exactly one focused question. Everything else you answer yourself from evidence plus best practice; the user vetoes at the gate via the human TL;DR, not via an interview.
+PRIME DIRECTIVE: do NOT interrogate the user. Resolve ambiguity by RESEARCH, not questions. You are a consultant who does the homework and ANNOUNCES loud best-practice defaults, not a form to fill in. The user's time is spent only on an owner-decision as SKILL.md's two filters define it (irreversible, destructive, or safety-critical, or a cross-cutting product choice the user lives with) - then exactly one focused question per decision. Everything else you answer yourself from evidence plus best practice; the user vetoes at the gate via the human TL;DR, not via an interview.
</stance>
<research_protocol>
@@ -20,7 +20,7 @@ TOPOLOGY LOCK still applies: enumerate the 1-6 independently-succeed/fail compon
</research_protocol>
<default_selection>
-For each open decision - including the extrinsic axes the sweep names (budget, mandated stack, expected scale, target audience / compliance) - adopt the default the ideal state for the affected user demands (industry standard and repo convention are evidence for it, never the default itself), RECORD it in the draft's Open-assumptions ledger with rationale and reversibility, and proceed. NO numeric scoring - the ledger IS the audit trail. The ONLY default escalated to a single focused question is one that is irreversible, destructive, or safety-critical, or commits real spend the user never authorized, and research cannot settle.
+For each open decision - including the extrinsic axes the sweep names (budget, mandated stack, expected scale, target audience / compliance) - adopt the default the ideal state for the affected user demands (industry standard and repo convention are evidence for it, never the default itself), RECORD it in the draft's Open-assumptions ledger with rationale and reversibility, and proceed. NO numeric scoring - the ledger IS the audit trail. The ONLY default escalated to a single focused question is an owner-decision as SKILL.md's two filters define it - anything irreversible / destructive / safety-critical, or a cross-cutting product choice the user lives with (public config surface, distribution / packaging, external dependency or pinned SHA, data / schema shape, real budget / paid-service spend, expected scale or capacity target, target-audience / compliance limits) - which survives as a question even when a default exists.
Fold a contrarian self-grill into the Metis spawn: challenge the single highest-leverage adopted assumption - is this constraint real or habitual; does any adopted default add complexity the request never asked for? - and return concrete reframes. The grill targets incidental complexity (unneeded abstraction, speculative capacity), NEVER the feature set: reducing, phasing, or deferring part of the request is not a reframe. Fold a reframe into the plan only as a recommended default plus rationale, never as a forced change.
</default_selection>
diff --git a/plugins/omo/skills/ulw-research/SKILL.md b/plugins/omo/skills/ulw-research/SKILL.md
index 93cf483a..7444151f 100644
--- a/plugins/omo/skills/ulw-research/SKILL.md
+++ b/plugins/omo/skills/ulw-research/SKILL.md
@@ -57,7 +57,7 @@ The research is done when all of these hold:
- Every claim in the deliverable cites a source or a verification artifact.
- Every asserted claim is represented in the claim graph, tied to an intent-vs-reality diff when an expected truth exists, and backed by observation manifest entries from independent observation groups or a documented single-source exception; convergence or exception status is explicit.
- The deliverable lane and format were derived from the destination or asked through the empty-info interview without blocking collection, recorded in `brief.md` with `answered_by`, and the final materials match that record.
-- The delivered artifact passed the delivery gates in order (static gates, layout gates, fidelity gate, visual QA, and the proofread pass where the harness provides one), each status is in `outcome.json`, and `outcome verify` passed.
+- The delivered artifact passed the delivery gates in order (static gates, fidelity gate, layout gates, visual QA, and the proofread pass where the harness provides one), each status is in `outcome.json`, and `outcome verify` passed.
- Every excursion opened during the run was closed by an EXIT rule, folded back into the claim or axis that triggered it, and recorded in both `excursion-log.md` and the ulw-loop ledger.
- When the harness can show an HTML page inline, the report was shown inline before the artifact paths.
- When the ask reproduces a visual source, the report carries side-by-side pairs of real source frames and the output rendered at the same moments, each with its critique, and the differences they surfaced were fixed or listed as gaps. A simple or well-understood topic shortens the research, never this comparison.
@@ -142,7 +142,7 @@ The promised formats recorded in `brief.md` and `outcome.json` are binding; `pdf
Asset workers (background, parallel, each fed `design-spec.md`) — visuals are the DEFAULT deliverable of this phase, not garnish the user must ask for; a delivered report without figures is an incomplete run:
-- **Charts for every quantitative finding, computed from real data.** Pull the numbers into an actual table first (CSV/JSON under `$SESSION_DIR`), then plot from that table, never from prose. Follow the data-scientist tool doctrine — numpy always, Polars for filtering/sorting/transforms, DuckDB for joins/aggregations/window functions, never pandas — and load the `data-scientist` skill when this session has it: `uv run --with numpy --with polars --with duckdb --with pyarrow --with matplotlib python`. Keep `pyarrow` in that set — the DuckDB-to-Polars handoff (`.pl()`) fails without it, and `.df()` fails without pandas, so hand data across through `.pl()`, never `.df()`. Save to `$SESSION_DIR/assets/`. Plot ONLY from the ledger: export the rows with `node "$SKILL_DIR/scripts/report-tools.mjs" fact export --csv --out "$SESSION_DIR/assets/<chart>.csv" --session-dir "$SESSION_DIR"` and draw from that CSV; every chart figure carries `data-chart-source="assets/<chart>.csv"`, and its axis tick labels sit inside a `<g class="ticks" data-tick-step=".." data-tick-min=".." data-tick-max="..">` group, so the fidelity gate can check every plotted value and tick (the deliverable reference's section 6 tick rule).
+- **Charts for every quantitative finding, computed from real data.** Pull the numbers into an actual table first (CSV/JSON under `$SESSION_DIR`), then plot from that table, never from prose. Follow the data-scientist tool doctrine — numpy for numeric work beyond SQL/DataFrame aggregation, Polars for filtering/sorting/transforms, DuckDB for joins/aggregations/window functions, never pandas — and load the `data-scientist` skill when this session has it: `uv run --with numpy --with polars --with duckdb --with pyarrow --with matplotlib python`. Keep `pyarrow` in that set — the DuckDB-to-Polars handoff (`.pl()`) fails without it, and `.df()` fails without pandas, so hand data across through `.pl()`, never `.df()`. Save to `$SESSION_DIR/assets/`. Plot ONLY from the ledger: export the rows with `node "$SKILL_DIR/scripts/report-tools.mjs" fact export --csv --out "$SESSION_DIR/assets/<chart>.csv" --session-dir "$SESSION_DIR"` and draw from that CSV; every chart figure carries `data-chart-source="assets/<chart>.csv"`, and its axis tick labels sit inside a `<g class="ticks" data-tick-step=".." data-tick-min=".." data-tick-max="..">` group, so the fidelity gate can check every plotted value and tick (the deliverable reference's section 6 tick rule).
- **Mermaid graphs** for process, architecture, argument, timeline, and evidence-flow structure, themed to the spec's fonts and palette. Render each to SVG and confirm the file exists before the document references it.
- **Generated visuals through the imagegen skill whenever the session has it:** a cover plus a concept illustration per major theme, prompted from the spec's style, palette, and mood — document-styled illustration, never generic stock art dropped into a designed page.
- **Full-page screenshots** of the top 5-10 sources, saved by the web workers while reading, as provenance you can show.
diff --git a/plugins/omo/skills/ulw-research/references/deliverable-phase.md b/plugins/omo/skills/ulw-research/references/deliverable-phase.md
index 330bdd3f..146bc75a 100644
--- a/plugins/omo/skills/ulw-research/references/deliverable-phase.md
+++ b/plugins/omo/skills/ulw-research/references/deliverable-phase.md
@@ -80,7 +80,7 @@ format description: none
The values below are read by `scripts/fidelity-policy.mjs`, the single registry: `SOURCE_FLOOR_RULES` and `parseSourceFloor()` for the `source floor` forms (`pointedFlag` in source registration reads the same grammar), and `FIDELITY_VALUE_RULES` for `derived numbers`, `languages`, `fallback`, and `meaning check`. `derived numbers` and `fallback` accept only the values in their row below (`FIDELITY_VALUE_RULES.tables`, any case); any other value, a free-text answer included, is a usage error (exit `2`) naming the field and the value, as an unknown `source floor` form is. Map a free-text answer onto a table value before writing it: a partial allowance ("growth rates yes, estimates no") records `derived numbers: none`.
-Beside `## Deliverable`, the brief records what the report must stay faithful to, under `## Fidelity`. The fields are inferred first; only `as of`, `meaning check`, `source floor`, and `derived numbers` may be asked, each on its own trigger, in the same question call as Q1-Q3 (at most four questions in that call). The inference rules, the triggers, and the question texts are in `SKILL.md`.
+Beside `## Deliverable`, the brief records what the report must stay faithful to, under `## Fidelity`. The fields are inferred first; only `as of`, `meaning check`, `source floor`, and `derived numbers` may be asked, each on its own trigger, in the same question call as Q1-Q3 (at most four questions in that call). The inference rules, the triggers, and the question texts are in [research-collection.md](research-collection.md), under "The fidelity questions".
| Field | Values | Default | Read by |
| --- | --- | --- | --- |
@@ -175,14 +175,14 @@ Nothing reaches the requester until the gates for its QA tier pass, in this orde
node "$SKILL_DIR/scripts/report-tools.mjs" layout-probe --json # .source is one async expression
```
4. **Visual QA.** Render the artifact to images (PDF pages to PNG, the HTML in the browser skill's engine at desktop and phone widths) and look at the pixels for what a machine cannot see: composition, hierarchy, page breaks, figure legibility.
-5. **Proofread.** A dedicated writing lane proofreads the final text only (grammar, spelling, punctuation, terminology, native register); it never composes or rewrites content and never edits the file. Edits change text only; an edit whose before/after would alter any tag, attribute, comment, or script/style content is rejected, and markup changes go through the full fidelity gates instead. It returns `polish-edits.json` (`[{before, after, reason}]`), which the orchestrator applies edit by edit; a rejected or unlocated edit goes back to the lane with its reason, within the repair budget. The backstop diff, `fact verify` on the polished file, and the meaning readers on the pairs whose sentences polish changed run before the fidelity gate is recorded again. Edits must not span entities (such as &amp; or &lt;) or markup; narrow the edit to the surrounding words instead, and a rejected edit comes back with the reason to act on.
+5. **Proofread.** A dedicated writing lane proofreads the final text only (grammar, spelling, punctuation, terminology, native register); it never composes or rewrites content and never edits the file. Edits change text only; an edit whose before/after would alter any tag, attribute, comment, or script/style content is rejected, and markup changes go through the full fidelity gates instead. It returns `polish-edits.json` (`[{before, after, reason}]`), which the orchestrator applies edit by edit; a rejected or unlocated edit goes back to the lane with its reason, within the repair budget. The backstop diff, `fact verify` on the polished file, and the meaning readers on the pairs whose sentences polish changed run before the fidelity gate is recorded again; the layout gates and visual QA then run again on the polished file, which is the one delivered. Edits must not span entities (such as &amp; or &lt;) or markup; narrow the edit to the surrounding words instead, and a rejected edit comes back with the reason to act on.
```bash
node "$SKILL_DIR/scripts/report-tools.mjs" fact polish-apply "$SESSION_DIR/report.html" --edits "$SESSION_DIR/polish-edits.json" --out "$SESSION_DIR/report.polished.html" --session-dir "$SESSION_DIR"
node "$SKILL_DIR/scripts/report-tools.mjs" fact polish-diff --before "$SESSION_DIR/report.html" --after "$SESSION_DIR/report.polished.html" --session-dir "$SESSION_DIR" # writes polish-defects.json
node "$SKILL_DIR/scripts/report-tools.mjs" fact pairs "$SESSION_DIR/report.polished.html" --changed-since "$SESSION_DIR/report.html.fill-map.json" --session-dir "$SESSION_DIR"
```
-**Every reader-facing edition is verified.** The main report, the inline edition (section 9), LaTeX per-section sources, and slide sources are filled by `fact fill` from one placeholder source and each is verified by `fact verify` into its own record; PDF and DOCX are renders of a verified source. A delivered row is recorded with `outcome set <format> delivered --path <file> --verified-by <record>`, where the record's `artifact_sha256` equals the sha256 of the delivered source; a PDF or DOCX adds `--rendered-from <source>` and is matched against that source. Each delivered edition also carries its own meaning record: run `fact pairs` on that edition's source and `fact meaning-check --edition <format>`, which writes `fidelity-meaning-defects.<format>.json` bound to those bytes (section 7). The barrier binds each edition to a record for its current bytes: every record whose `artifact_sha256` equals those bytes is a candidate (its own record, another edition's record for a byte-identical copy or the html edition a PDF renders, and the legacy single file `fidelity-meaning-defects.json`), and the one with the newest `written_at` wins; on equal times the more severe verdict wins (`meaning_drift_confirmed`, then `meaning_unverified`, then clean). In a session with a fact ledger, `outcome verify` refuses a delivered row without a matching record (`edition_unverified`, blocker, integrity). Markdown and LaTeX verification arrive with the Markdown stage; until then `fact verify --format md|tex` exits `2`, and such an edition is recorded `blocked_capability` with that reason rather than delivered unverified.
+**Every reader-facing edition is verified.** The main report, the inline edition (section 9), LaTeX per-section sources, and slide sources are filled by `fact fill` from one placeholder source and each is verified by `fact verify` into its own record; PDF and DOCX are renders of a verified source. A delivered row is recorded with `outcome set <format> delivered --path <file> --verified-by <record>`, where the record's `artifact_sha256` equals the sha256 of the delivered source; a PDF or DOCX adds `--rendered-from <source>` and is matched against that source. Each delivered edition also carries its own meaning record: run `fact pairs` on that edition's source and `fact meaning-check --edition <format>`, which writes `fidelity-meaning-defects.<format>.json` bound to those bytes (section 7). The barrier binds each edition to a record for its current bytes: every record whose `artifact_sha256` equals those bytes is a candidate (its own record, another edition's record for a byte-identical copy or the html edition a PDF renders, and the legacy single file `fidelity-meaning-defects.json`), and the one with the newest `written_at` wins; on equal times the more severe verdict wins (`meaning_drift_confirmed`, then `meaning_unverified`, then clean). In a session with a fact ledger, `outcome verify` refuses a delivered row without a matching record (`edition_unverified`, blocker, integrity). A LaTeX edition is verified through its Markdown source; `fact verify --format tex` exits `2`.
The light tier runs gate 1 and one render (recorded as `visual`) and records `fidelity`, `layout`, and `proofread` as `not_run` (`fidelity not_run` needs `--reason "<why>"`); the light tier never runs the fidelity verifier, although `fact verify` checks HTML and Markdown editions. The full tier runs all five.
@@ -269,7 +269,7 @@ Invoke every command as `node "$SKILL_DIR/scripts/report-tools.mjs" <command>`.
| `fact polish-apply <report.html>` | `--edits <polish-edits.json>` and `--out <report.polished.html>` (both required; a missing flag or a Markdown edition exits `2`), `--fill-map <file>` (default: the edition's fill map, chosen as `fact verify` chooses it; one that does not record the input's bytes exits `2` and nothing is written), `--format html`, `--ledger <fact-ledger.json>`, `--brief <brief.md>`, `--session-dir <dir>` | `fidelity_interview_incomplete` (nothing written); otherwise never: it exits `0` whenever it wrote the output. With a fill map it also writes `<out>.polished.fill-map.json` (the brief binding, the polished file's hash, and `polishedFrom` naming the fill map) and never rewrites the fill map, even when `--out` is the input. Each rejected (`polish_edit_rejected`) or unlocated (`polish_edit_unlocated`) edit leaves its text unchanged and is printed verbatim, one line per rejection, in the summary and in `data.rejected_reasons`; `data` also carries `applied`, `rejected`, `unlocated`, `applied_indexes`, `input_sha256`, `edits_sha256`, and `out_sha256` |
| `fact polish-diff` | `--before <pre-polish.html>` and `--after <polished.html>` (both required; a missing flag exits `2`), `--ledger <fact-ledger.json>`, `--out <record>` (default `$SESSION_DIR/polish-defects.json`), `--brief <brief.md>`, `--session-dir <dir>` | `fidelity_interview_incomplete` (nothing written), or a registry blocker in the diff (majors and minors are reported and exit `0`; a defect code the registry does not know refuses with `unknown defect code <code>`). The record is `{command, status, exitCode, before, artifact, artifact_sha256, defects[], counts}`, with `counts` in contract buckets |
| `fact meaning-check` | `--pairs <pairs.json>` and `--verdicts <file>` (required; repeatable, one per reader tier), `--dispute P<n> --reason <text>`, `--run-id <id>`, `--calibration <file>` (default `fidelity-calibration.jsonl`), `--brief <brief.md>`, `--edition <format>` (writes `fidelity-meaning-defects.<format>.json`, the delivered edition's meaning record), `--out <record>` (default `fidelity-meaning-defects.json`), `--session-dir <dir>` | `fidelity_interview_incomplete`, or `meaning_drift_confirmed` (stderr carries one JSON line with the defect and dropped-verdict counts) |
-| `fact derive` | `--op <op>` and `--now <ISO>` (both required; `--now` is the row's `observed_at`, the script never reads the clock, and without it the command exits `2` with `missing_now` and writes no row) with the operation's operands (section 11), `--unit`, `--to`, `--rationale`, `--disjoint`, `--label`, `--json`, `--session-dir <dir>` | `incompatible_operands` (no row written) |
+| `fact derive` | `--op <op>` and `--now <ISO>` (both required; `--now` is the row's `observed_at`, the script never reads the clock, and without it the command exits `2` with `missing_now` and writes no row) with the operation's operands (section 11), `--unit`, `--to`, `--rationale`, `--disjoint`, `--reference`, `--label`, `--json`, `--session-dir <dir>` | `incompatible_operands` (no row written) |
| `claims index <claim-graph.md>` | `--out <claims.json>` (required) | never (a malformed claim table exits `2`) |
## 11. Fidelity gate
@@ -298,7 +298,7 @@ Derivations are computed in exact rationals from the operands' stored values and
| Operation | Operands | Checks |
| --- | --- | --- |
-| `sum` | two or more ids, `--unit` | one unit; summing `%` needs `--disjoint` and `--rationale` |
+| `sum` | two or more ids, `--unit` | one unit; summing `%` needs `--disjoint`, `--reference <denominator>`, and `--rationale` |
| `diff` | two ids (minuend, subtrahend) | one unit; a difference of `%` is in `pp` |
| `growth` | `--from <id> --to <id>` | one declared entity, two different `valid_at` periods, a positive start; result in `%` |
| `ratio` | `--num <id> --den <id>`, `--unit` | a non-zero denominator |
diff --git a/plugins/omo/skills/ulw-research/references/report-visualization.md b/plugins/omo/skills/ulw-research/references/report-visualization.md
index 7d5f065f..5b62fc85 100644
--- a/plugins/omo/skills/ulw-research/references/report-visualization.md
+++ b/plugins/omo/skills/ulw-research/references/report-visualization.md
@@ -35,7 +35,7 @@ Save every asset under `$SESSION_DIR/assets/` and confirm the file exists and is
### Charts from data
-Put the numbers in a table first (`$SESSION_DIR/data/<name>.csv`), then plot from the table, never from prose. Follow the data-scientist doctrine in SKILL.md (numpy, Polars, DuckDB, no pandas).
+Put the numbers in a table first (`$SESSION_DIR/data/<name>.csv`), then plot from the table, never from prose. Follow the data-scientist tool doctrine: numpy for numeric work beyond SQL/DataFrame aggregation, Polars for filtering, sorting, and transforms, DuckDB for joins, aggregations, and window functions, never pandas.
```bash
uv run --with numpy --with polars --with matplotlib python plot_<name>.py
@@ -125,7 +125,7 @@ A post by Andrej Karpathy on 2026-10-02 ranks the formats that make model output
## 5. Quality bar
-- Every figure follows the figure standard in SKILL.md: fixed container, contain-fit, aspect ratio preserved, spec fonts and palette.
+- Every figure follows the binding figure standard in [deliverable-phase.md](deliverable-phase.md), section 6: fixed container, contain-fit, aspect ratio preserved, spec fonts and palette.
- The caption alone tells the reader what the visual shows and what to conclude: "Median build time fell from 9.4 to 3.1 minutes after the cache change [S4]" beats "Build times".
- Alt text states the content, not the file: the key values or the shape of the trend for a chart, the main nodes and flow for a diagram. A purely decorative image takes `alt=""` plus `role="presentation"` and does not count as a visual; an empty alt without that marker is reported as missing.
- Every number in a visual comes from the data table and carries its source or lineage tag in the caption.
diff --git a/plugins/omo/skills/ulw-research/references/research-collection.md b/plugins/omo/skills/ulw-research/references/research-collection.md
index 783d8063..8385d62a 100644
--- a/plugins/omo/skills/ulw-research/references/research-collection.md
+++ b/plugins/omo/skills/ulw-research/references/research-collection.md
@@ -102,7 +102,7 @@ asked: derived numbers
Values carry no parentheses; `pending` goes only with `answered_by: pending`. When an answer lands, rewrite that one line with `answered_by: user` and leave `asked:` as history; a late answer after `fact fill` is a re-render: fill again, then verify.
-**Re-entry.** An `edit-existing` session, or any session created before this block existed, has no `## Fidelity`. Before any `fact` command, run the inference step above and write the block with `answered_by: default` on every field. `claims index` on a free-form `claim-graph.md` (no claim table) returns `{claims: [], errors: [...]}`, exits 2, and writes no `claims.json`; run `fact verify` without it, and the gate reports each unbound sentence as `unbound_sentence` (major) instead of blocking.
+**Re-entry.** An `edit-existing` session, or any session created before this block existed, has no `## Fidelity`. Before any `fact` command, run the inference step above and write the block with `answered_by: default` on every field. `claims index` on a free-form `claim-graph.md` (no claim table) returns `{claims: [], errors: [...]}`, exits 2, and writes no `claims.json`; run `fact verify` without it, and the gate reports each unbound sentence as `unbound_sentence` (major), which blocks delivery until the sentence is bound.
**Calibration.** `fact meaning-check` appends one line per flagged pair to `--calibration` (default `$SESSION_DIR/fidelity-calibration.jsonl`). After each run, also append that run's new lines to the workspace-level `.omo/ulw-research/fidelity-calibration.jsonl`; promotion of `meaning_drift_confirmed` is decided from that log.
@@ -129,7 +129,7 @@ Scaling floor — more angles always justify more workers:
Role protocols — embed the relevant one in each spawn message; every worker gets a unique angle:
- **Codebase (explore), 2-4 workers.** Grep with 3+ keyword variations; structural/AST search; LSP definitions and references; file-name globs; `git log --all -S '<keyword>'` and `--grep` for history including deleted code. Cross-validate hits across tools. Report absolute file paths, patterns with `file:line`, and how findings connect.
-- **Web, 3-9 workers, every one loaded with the `browser` skill.** Search with 10+ websearch queries per worker, each with a different operator or angle (see Search craft); a result is a candidate, not a source. Read every candidate in the user's browser through the `browser` skill's attached engine: one named session per worker, one tab per source, several tabs open side by side while sources are compared — `session.tabCreate` / `tabSelect` / `tabClose` where the harness has a JS eval kernel, `bsk tab create --url <url>` / `tab select <id>` / `tab close <id>` / `tab list` on the CLI — the page scrolled to its end, a full-page screenshot of each top source saved as provenance, the tab closed once reported. A browser on another machine is reached through the `browser` skill's remote reference or a user-level skill that bridges to it, never replaced by a local headless one. `webfetch` is for raw files only: PDF, JSON, feeds, sitemaps. A host the browser cannot open (WAF, bot score, 403) goes to `ultimate-browsing`, whose provenance travels with the claim: a `snapshot` result cites its `snapshot_timestamp` and is never stated as the live page; a `proxy` result is `untrusted` until a second independent route agrees. Context7 with 3+ queries per known library; grep.app and `gh search code|repos|issues` for real-world usage; official docs via sitemap discovery (`<base>/sitemap.xml`), then targeted pages. A worker whose sources are all fetched text has searched, not read.
+- **Web, 3-9 workers, every one loaded with the `browser` skill.** Search with 10+ websearch queries per worker, each with a different operator or angle (see Search craft); a result is a candidate, not a source. Read every candidate in the user's browser through the `browser` skill's attached engine: one named session per worker, one tab per source, several tabs open side by side while sources are compared — `session.tabCreate` / `tabSelect` / `tabClose` where the harness has a JS eval kernel, `bsk tab create --session <session> --url <url>` / `tab select --session <session> <id>` / `tab close --session <session> <id>` / `tab list --session <session>` on the CLI — the page scrolled to its end, a full-page screenshot of each top source saved as provenance, the tab closed once reported. A browser on another machine is reached through the `browser` skill's remote reference or a user-level skill that bridges to it, never replaced by a local headless one. `webfetch` is for raw files only: PDF, JSON, feeds, sitemaps. A host the browser cannot open (WAF, bot score, 403) goes to `ultimate-browsing`, whose provenance travels with the claim: a `snapshot` result cites its `snapshot_timestamp` and is never stated as the live page; a `proxy` result is `untrusted` until a second independent route agrees. Context7 with 3+ queries per known library; grep.app and `gh search code|repos|issues` for real-world usage; official docs via sitemap discovery (`<base>/sitemap.xml`), then targeted pages. A worker whose sources are all fetched text has searched, not read.
- **Repo deep-dive (librarian), 0-2 workers.** Shallow-clone the most relevant repos to `${TMPDIR:-/tmp}`, pin the HEAD SHA, read core modules, follow call chains, return SHA-pinned permalinks.
Example spawn (codebase axis; web and repo-dive follow the same contract with their own protocol):
diff --git a/plugins/omo/skills/ulw-research/references/unit-rules.md b/plugins/omo/skills/ulw-research/references/unit-rules.md
index cc8a8e30..4ea48e6a 100644
--- a/plugins/omo/skills/ulw-research/references/unit-rules.md
+++ b/plugins/omo/skills/ulw-research/references/unit-rules.md
@@ -31,7 +31,7 @@ numeric guards may read `exact` values, unit selection may not. The property tes
| op | arity | operand guards | context fields (persisted on the row) | result unit | malformed -> recompute ok:false |
|---|---|---|---|---|---|
-| sum | n>=2 | non-affine units, all equal after canonicalization; if `%`: `disjoint: true` AND `reference` (one denominator id/text) equal on every operand AND rationale | disjoint, reference, rationale | the common unit (`%` stays `%`) | <2 operands; missing id; no context; unequal/affine units; `%` without disjoint, reference, or rationale |
+| sum | n>=2 | non-affine units, all equal after canonicalization; if `%`: `disjoint: true` AND `reference` (one denominator id/text) equal on every operand AND rationale | disjoint, reference (the `%` rationale goes in the row's `rationale` field, not in context) | the common unit (`%` stays `%`) | <2 operands; missing id; no context; unequal/affine units; `%` without disjoint, reference, or rationale |
| diff | 2 | non-affine units; typed pairs only: U-U -> U (same non-% unit); %-% -> `%p`; %-%p -> `%`; %p-%p -> `%p`; %p-% REFUSED | none | per the pair rule | arity; invalid pair (`%p - %`, `m - person`); affine units; stray context |
| growth | 2 (from,to) | equal non-affine units; same entity; two different valid_at; from.exact > 0 | none | `%` (= 100(to-from)/from) | arity; unequal/affine units; entity/valid_at; from<=0; stray context |
| share | 2 (part,whole) | equal non-affine units; whole.exact > 0; 0 <= part <= whole | none | `%` (= 100 part/whole) | arity; units; whole<=0; part outside [0,whole]; stray context |
@@ -123,7 +123,7 @@ converted rows that carry this version's columns, and to every row this version
still breaks a strict rule (a scale word as unit, empty metadata, an operation or derivation fields) is flagged when it
is used: `derive` and `recompute` refuse it with shape `dimension 6`, `dimension 18`, or `dimension 1`, and `addRow`
refuses to write a new one. Normalization never strips user data: an `exact` carrying keys beyond `num` and `den` is left exactly as written and flagged `dimension 7` on use, never silently reduced to `{ num, den }`. Reading a normalized file again changes nothing. The legacy test fixture is generated by
-dev's own `addRow` (`scripts/tests/fixtures/fidelity/gen-legacy-dev.mjs`, which pins the dev commit).
+dev's own `addRow` (`scripts/tests/fixtures/fidelity/gen-legacy-dev.mjs` in the source repository, which pins the dev commit; the tests and fixtures do not ship with the skill).
## Trust boundary
diff --git a/plugins/omo/skills/visual-qa/AGENTS.md b/plugins/omo/skills/visual-qa/AGENTS.md
index faa05c99..7bee37fb 100644
--- a/plugins/omo/skills/visual-qa/AGENTS.md
+++ b/plugins/omo/skills/visual-qa/AGENTS.md
@@ -55,4 +55,4 @@ node scripts/visual-qa.mjs tui-check <capture.txt> --cols 80
bun test scripts/*.test.ts
```
-- Parent: [`packages/shared-skills/AGENTS.md`](../../AGENTS.md).
+- Parent (source checkout only; not shipped with the skill): `packages/shared-skills/AGENTS.md`.
diff --git a/plugins/omo/skills/visual-qa/SKILL.md b/plugins/omo/skills/visual-qa/SKILL.md
index 944c2327..7ee7be4a 100644
--- a/plugins/omo/skills/visual-qa/SKILL.md
+++ b/plugins/omo/skills/visual-qa/SKILL.md
@@ -154,7 +154,7 @@ This is the platform baseline, distilled from Apple's Human Interface Guidelines
- A10 Content that continues out of view shows a cue (partial item, fade, chevron).
- A11 (mac) Nothing important lives only at the window's bottom edge; the minimum window size keeps toolbar and content legible; the sidebar collapses when the window narrows.
- A12 (web and app screens; N/A for a TUI, a printed page, or a figure) Layout contract: every changed screen or region has a `Layout:` line (in `DESIGN.md`, or in the change description when the project has none; the `frontend` skill's Brief step); the capture shows that pattern's structure; the logged owner is the region's main scroller in the probe output, every other scroller listed is nested inside it for its own content (a code block, a dropdown, a composer) or is named in the line too; none of the line's anti-patterns appear. A missing line, a different main scroller, an unexplained sibling scroller, or a present anti-pattern is a FAIL; a logged skip still owes the scroll-owner check.
-- A13 Spacing rhythm, read from computed values: the space above a section heading is at least 1.5x the space below it, and the gap between groups is at least 2x the gap inside a group (the `frontend` skill's `references/perfection/craft-floor.md`).
+- A13 Spacing rhythm, read from computed values: the space above a section heading is at least 1.5x the space below it, and the gap between groups is at least 2x the gap inside a group, unless the brief's chosen style route sets its own spacing rhythm and the deviation is recorded in the brief or DESIGN.md, in which case that value is the check (the `frontend` skill's `references/perfection/craft-floor.md`).
**B. Hierarchy**
- B1 One primary action per view, in the prominent style (accent on its background, not its glyph); peers differ by style, never by size.
@@ -205,7 +205,7 @@ This is the platform baseline, distilled from Apple's Human Interface Guidelines
A13, B8, E7, F8 and F9 are adapted from the craft floor of [pbakaus/impeccable](https://github.com/pbakaus/impeccable) (Apache-2.0, Copyright 2025 Paul Bakaus); the license and the list of changes are in the `frontend` skill's `ATTRIBUTION.md` section 6.
**G. Motion and feedback**
-- G1 Every animation has a cause - an interaction, a state change, an arrival; no motion on non-interactive elements, no hover that changes nothing, no permanent loop.
+- G1 Every animation has a cause - an interaction, a state change, an arrival; no motion on non-interactive elements, no hover that changes nothing, no permanent loop. A background the brief's ambience route asked for may loop on its decorative layer only while in view: it starts from an IntersectionObserver, stops off-screen and on visibilitychange, and paints one static frame under reduced motion (the `frontend` skill's `references/design/ambience-skill.md`).
- G2 Transitions keep identity: a surface that resizes or moves animates from its old geometry to the new; exit mirrors entry; nothing reflows under the pointer.
- G3 Motion is interruptible and never gates input: mid-animation input retargets smoothly and never snaps; nobody waits for an animation to act.
- G4 Under `prefers-reduced-motion`, positional, scale and depth motion becomes a cross-fade; fades, progress and gesture tracking stay; blur never animates.
@@ -273,7 +273,7 @@ SOURCE CODE:
{Full source of the UI: components, styles/tokens, layout, render code. Include neighboring files that show existing patterns.}
CAPTURES:
-{Web: actual screenshot path(s) plus your described observations. TUI: paste capture.txt and capture-ansi.txt inline.}
+{Web: actual screenshot path(s) plus your described observations. TUI: paste terminal.txt and terminal-ansi.txt inline.}
SHARED SCRIPT EVIDENCE (reference, not verdict):
{Paste the image-diff or tui-check JSON. Use alphaChannelIntact for the transparency check.}
@@ -330,7 +330,7 @@ BEFORE/AFTER PAIRS:
SURFACE: {web | tui | both}
CAPTURES:
-{Web: actual and reference screenshot paths plus your described observations. TUI: paste capture.txt and capture-ansi.txt inline.}
+{Web: actual and reference screenshot paths plus your described observations. TUI: paste terminal.txt and terminal-ansi.txt inline.}
SOURCE CODE:
{For web: include the rendered text/content, components, typography, layout, and style code. For TUI: include render code that controls wrapping, width, and wide-character handling.}
@@ -346,7 +346,7 @@ USE THE EVIDENCE:
- TUI (tui-check): inspect maxWidth vs expectedColumns, every overflowLines[] entry, borderMisaligned, and wideCharColumns[].
CHECK:
-1. Checklist sections A-F, item by item, on the 390 AND 1440 captures in BOTH themes and on the scrolled-to-end shots: PASS, FAIL or N/A with the capture that proves it. Every FAIL is BLOCKING.
+1. Checklist sections A-F, item by item, on the 390, 1440 and (for page layouts) 1920 captures in BOTH themes and on the scrolled-to-end shots: PASS, FAIL or N/A with the capture that proves it. Every FAIL is BLOCKING.
2. When a reference packet exists, compare ACTUAL against REFERENCE pixel-perfectly, region by region: page bounds, header/nav, hero, cards, grids, charts, media, typography, copy, color tokens, radius, shadow, border, icon size, spacing, alignment, scroll position, and state. Anything off beyond unavoidable rasterization/rounding is a finding. The overview text is part of the target: missing or rearranged reference content is a finding even if the screenshot looks plausible.
3. When before/after pairs exist, judge each pair side by side: the after must show the brief's primary action and priorities more legibly than the before, carry fewer elements without a job, and lose nothing from the required-content list. A pair with no change a reader can point to, or a required input, datum, or copy present in before and missing or merged in after, is a BLOCKING [defect].
4. CJK precision:
diff --git a/plugins/omo/skills/visual-qa/references/browser-setup.md b/plugins/omo/skills/visual-qa/references/browser-setup.md
index 9757ecbb..b3ccc9b3 100644
--- a/plugins/omo/skills/visual-qa/references/browser-setup.md
+++ b/plugins/omo/skills/visual-qa/references/browser-setup.md
@@ -89,8 +89,10 @@ not fall back to the owned engine for an authenticated criterion.
## Capture at a fixed viewport
-Match CSS viewport AND PNG dimensions: pin `deviceScaleFactor` through `emulate` (owned) or
-`resize` (attached) instead of resizing the PNG to force a pass; a 390-wide capture at desktop
+Match CSS viewport AND PNG dimensions: pin `deviceScaleFactor` through `emulate` (owned engine).
+Attached `resize(width, height)` sets the window size only and leaves the device pixel ratio at the
+user's display, so on the attached engine record the capture's DPR (PNG width / CSS viewport width)
+and compare against a reference taken at that DPR. Never resize the PNG to force a pass; a 390-wide capture at desktop
DPR with classic scrollbars is not a phone capture. Wait for the specific page state (a locator,
a `waitForURL`, a `createNetworkSnoop(page).waitFor(...)`), not a sleep, then compare: