@lannguyensi/harness 0.44.0 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1245 -0
- package/dist/cli/adopt/derive.d.ts +16 -7
- package/dist/cli/adopt/derive.js +19 -2
- package/dist/cli/adopt/derive.js.map +1 -1
- package/dist/cli/adopt/index.js +18 -3
- package/dist/cli/adopt/index.js.map +1 -1
- package/dist/cli/apply/apply.d.ts +1 -0
- package/dist/cli/apply/apply.js +62 -6
- package/dist/cli/apply/apply.js.map +1 -1
- package/dist/cli/apply/generate-codex-config.js +5 -6
- package/dist/cli/apply/generate-codex-config.js.map +1 -1
- package/dist/cli/apply/generate-opencode-config.d.ts +58 -0
- package/dist/cli/apply/generate-opencode-config.js +210 -0
- package/dist/cli/apply/generate-opencode-config.js.map +1 -0
- package/dist/cli/apply/generate-settings.d.ts +90 -32
- package/dist/cli/apply/generate-settings.js +133 -10
- package/dist/cli/apply/generate-settings.js.map +1 -1
- package/dist/cli/apply/index.d.ts +2 -1
- package/dist/cli/apply/index.js +2 -1
- package/dist/cli/apply/index.js.map +1 -1
- package/dist/cli/apply/next-steps.d.ts +20 -0
- package/dist/cli/apply/next-steps.js +60 -0
- package/dist/cli/apply/next-steps.js.map +1 -1
- package/dist/cli/approve/stdin-report.d.ts +15 -0
- package/dist/cli/approve/stdin-report.js +1 -1
- package/dist/cli/approve/stdin-report.js.map +1 -1
- package/dist/cli/approve/understanding.d.ts +75 -0
- package/dist/cli/approve/understanding.js +150 -2
- package/dist/cli/approve/understanding.js.map +1 -1
- package/dist/cli/audit.d.ts +1 -1
- package/dist/cli/audit.js +3 -2
- package/dist/cli/audit.js.map +1 -1
- package/dist/cli/doctor/claude-mcp.d.ts +19 -1
- package/dist/cli/doctor/claude-mcp.js +36 -10
- package/dist/cli/doctor/claude-mcp.js.map +1 -1
- package/dist/cli/doctor/codex.d.ts +3 -1
- package/dist/cli/doctor/codex.js +6 -9
- package/dist/cli/doctor/codex.js.map +1 -1
- package/dist/cli/doctor/format.js +94 -8
- package/dist/cli/doctor/format.js.map +1 -1
- package/dist/cli/doctor/index.d.ts +23 -0
- package/dist/cli/doctor/index.js +106 -2
- package/dist/cli/doctor/index.js.map +1 -1
- package/dist/cli/doctor/opencode.d.ts +24 -0
- package/dist/cli/doctor/opencode.js +107 -0
- package/dist/cli/doctor/opencode.js.map +1 -0
- package/dist/cli/doctor/target-checks.d.ts +11 -0
- package/dist/cli/doctor/target-checks.js +25 -0
- package/dist/cli/doctor/target-checks.js.map +1 -0
- package/dist/cli/doctor/toolchain-parity.d.ts +63 -0
- package/dist/cli/doctor/toolchain-parity.js +154 -0
- package/dist/cli/doctor/toolchain-parity.js.map +1 -0
- package/dist/cli/doctor/types.d.ts +85 -1
- package/dist/cli/doctor/types.js +1 -1
- package/dist/cli/doctor/types.js.map +1 -1
- package/dist/cli/doctor/understanding-mode-env.d.ts +39 -0
- package/dist/cli/doctor/understanding-mode-env.js +83 -0
- package/dist/cli/doctor/understanding-mode-env.js.map +1 -0
- package/dist/cli/dry-run.js +32 -17
- package/dist/cli/dry-run.js.map +1 -1
- package/dist/cli/explain.d.ts +1 -1
- package/dist/cli/explain.js +1 -1
- package/dist/cli/explain.js.map +1 -1
- package/dist/cli/index.js +64 -5
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init/composer.js +36 -13
- package/dist/cli/init/composer.js.map +1 -1
- package/dist/cli/init/interactive.d.ts +7 -4
- package/dist/cli/init/interactive.js +79 -27
- package/dist/cli/init/interactive.js.map +1 -1
- package/dist/cli/init/profiles.d.ts +2 -2
- package/dist/cli/init/profiles.js +32 -1
- package/dist/cli/init/profiles.js.map +1 -1
- package/dist/cli/init/templates.d.ts +2 -1
- package/dist/cli/init/templates.js +130 -20
- package/dist/cli/init/templates.js.map +1 -1
- package/dist/cli/pack/approve-escape.js +69 -8
- package/dist/cli/pack/approve-escape.js.map +1 -1
- package/dist/cli/pack/hook-branch-protection.js +1 -1
- package/dist/cli/pack/hook-branch-protection.js.map +1 -1
- package/dist/cli/pack/hook-codex-pre-tool-use.js +27 -1
- package/dist/cli/pack/hook-codex-pre-tool-use.js.map +1 -1
- package/dist/cli/pack/hook-post-merge-gate.js +1 -1
- package/dist/cli/pack/hook-post-merge-gate.js.map +1 -1
- package/dist/cli/pack/hook-pre-tool-use.js +91 -4
- package/dist/cli/pack/hook-pre-tool-use.js.map +1 -1
- package/dist/cli/pack/hook-solution-acceptance.js +19 -2
- package/dist/cli/pack/hook-solution-acceptance.js.map +1 -1
- package/dist/cli/pack/understanding-report-schema-hint.d.ts +13 -0
- package/dist/cli/pack/understanding-report-schema-hint.js +52 -3
- package/dist/cli/pack/understanding-report-schema-hint.js.map +1 -1
- package/dist/cli/pause/index.js +1 -1
- package/dist/cli/pause/index.js.map +1 -1
- package/dist/cli/policy/intercept.d.ts +148 -0
- package/dist/cli/policy/intercept.js +379 -48
- package/dist/cli/policy/intercept.js.map +1 -1
- package/dist/cli/session-start/index.d.ts +12 -3
- package/dist/cli/session-start/index.js +67 -11
- package/dist/cli/session-start/index.js.map +1 -1
- package/dist/cli/session-start/stale-base-check.d.ts +71 -0
- package/dist/cli/session-start/stale-base-check.js +379 -0
- package/dist/cli/session-start/stale-base-check.js.map +1 -0
- package/dist/cli/session-start/toolchain-parity.d.ts +142 -8
- package/dist/cli/session-start/toolchain-parity.js +244 -36
- package/dist/cli/session-start/toolchain-parity.js.map +1 -1
- package/dist/cli/smoke/assertions.d.ts +9 -2
- package/dist/cli/smoke/assertions.js +9 -2
- package/dist/cli/smoke/assertions.js.map +1 -1
- package/dist/cli/uninstall/index.js +18 -2
- package/dist/cli/uninstall/index.js.map +1 -1
- package/dist/cli/validate/checks.d.ts +3 -1
- package/dist/cli/validate/checks.js +298 -3
- package/dist/cli/validate/checks.js.map +1 -1
- package/dist/io/claude-mcp.d.ts +122 -1
- package/dist/io/claude-mcp.js +214 -12
- package/dist/io/claude-mcp.js.map +1 -1
- package/dist/io/duration.js.map +1 -0
- package/dist/io/expand-home.js.map +1 -0
- package/dist/io/extract.js.map +1 -0
- package/dist/io/harness-lock.js +1 -1
- package/dist/io/harness-lock.js.map +1 -1
- package/dist/{runtime → io}/ledger-record.d.ts +1 -1
- package/dist/io/ledger-record.js.map +1 -0
- package/dist/policies/index.d.ts +2 -2
- package/dist/policies/index.js +2 -2
- package/dist/policies/index.js.map +1 -1
- package/dist/policies/ledger-client.js +10 -6
- package/dist/policies/ledger-client.js.map +1 -1
- package/dist/policies/producers.js +1 -1
- package/dist/policies/producers.js.map +1 -1
- package/dist/policies/requires.js +2 -2
- package/dist/policies/requires.js.map +1 -1
- package/dist/policy-packs/builtin/branch-protection.js +28 -3
- package/dist/policy-packs/builtin/branch-protection.js.map +1 -1
- package/dist/policy-packs/builtin/post-merge-gate.js +45 -9
- package/dist/policy-packs/builtin/post-merge-gate.js.map +1 -1
- package/dist/policy-packs/builtin/solution-acceptance-runtime.d.ts +139 -8
- package/dist/policy-packs/builtin/solution-acceptance-runtime.js +246 -12
- package/dist/policy-packs/builtin/solution-acceptance-runtime.js.map +1 -1
- package/dist/policy-packs/builtin/solution-acceptance.js +17 -3
- package/dist/policy-packs/builtin/solution-acceptance.js.map +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution/active-claim.d.ts +25 -0
- package/dist/policy-packs/builtin/understanding-before-execution/active-claim.js +89 -0
- package/dist/policy-packs/builtin/understanding-before-execution/active-claim.js.map +1 -0
- package/dist/policy-packs/builtin/understanding-before-execution/index.d.ts +13 -0
- package/dist/policy-packs/builtin/understanding-before-execution/index.js +39 -0
- package/dist/policy-packs/builtin/understanding-before-execution/index.js.map +1 -0
- package/dist/policy-packs/builtin/understanding-before-execution/ledger.d.ts +25 -0
- package/dist/policy-packs/builtin/understanding-before-execution/ledger.js +56 -0
- package/dist/policy-packs/builtin/understanding-before-execution/ledger.js.map +1 -0
- package/dist/policy-packs/builtin/understanding-before-execution/lifecycle.d.ts +20 -0
- package/dist/policy-packs/builtin/understanding-before-execution/lifecycle.js +79 -0
- package/dist/policy-packs/builtin/understanding-before-execution/lifecycle.js.map +1 -0
- package/dist/policy-packs/builtin/understanding-before-execution/markers.d.ts +103 -0
- package/dist/policy-packs/builtin/understanding-before-execution/markers.js +203 -0
- package/dist/policy-packs/builtin/understanding-before-execution/markers.js.map +1 -0
- package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.d.ts +177 -0
- package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.js +309 -0
- package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.js.map +1 -0
- package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.d.ts +106 -0
- package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.js +209 -0
- package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.js.map +1 -0
- package/dist/policy-packs/builtin/understanding-before-execution/task-markers.d.ts +78 -0
- package/dist/policy-packs/builtin/understanding-before-execution/task-markers.js +185 -0
- package/dist/policy-packs/builtin/understanding-before-execution/task-markers.js.map +1 -0
- package/dist/policy-packs/builtin/understanding-before-execution-runtime.d.ts +1 -536
- package/dist/policy-packs/builtin/understanding-before-execution-runtime.js +9 -1095
- package/dist/policy-packs/builtin/understanding-before-execution-runtime.js.map +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution.d.ts +109 -1
- package/dist/policy-packs/builtin/understanding-before-execution.js +183 -15
- package/dist/policy-packs/builtin/understanding-before-execution.js.map +1 -1
- package/dist/policy-packs/registry.d.ts +11 -0
- package/dist/policy-packs/registry.js +1 -1
- package/dist/policy-packs/registry.js.map +1 -1
- package/dist/policy-packs/runtime.d.ts +1 -1
- package/dist/policy-packs/runtime.js +10 -1
- package/dist/policy-packs/runtime.js.map +1 -1
- package/dist/runtime/agent-facing.js +1 -1
- package/dist/runtime/agent-facing.js.map +1 -1
- package/dist/runtime/bash-match-facts.d.ts +9 -7
- package/dist/runtime/bash-match-facts.js +9 -7
- package/dist/runtime/bash-match-facts.js.map +1 -1
- package/dist/runtime/bash-match-registry.d.ts +75 -38
- package/dist/runtime/bash-match-registry.js +279 -232
- package/dist/runtime/bash-match-registry.js.map +1 -1
- package/dist/runtime/bash-prefix-parse.d.ts +7 -0
- package/dist/runtime/bash-prefix-parse.js +205 -17
- package/dist/runtime/bash-prefix-parse.js.map +1 -1
- package/dist/runtime/command-normalize.d.ts +112 -0
- package/dist/runtime/command-normalize.js +411 -38
- package/dist/runtime/command-normalize.js.map +1 -1
- package/dist/runtime/hermetic-spawn-guard.js +6 -0
- package/dist/runtime/hermetic-spawn-guard.js.map +1 -1
- package/dist/runtime/index.d.ts +2 -2
- package/dist/runtime/index.js +2 -2
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/intercept.d.ts +78 -3
- package/dist/runtime/intercept.js +151 -39
- package/dist/runtime/intercept.js.map +1 -1
- package/dist/runtime/ledger-add.js +1 -1
- package/dist/runtime/ledger-add.js.map +1 -1
- package/dist/runtime/read-only-bash.js +303 -24
- package/dist/runtime/read-only-bash.js.map +1 -1
- package/dist/schema/doctor.d.ts +25 -0
- package/dist/schema/doctor.js +23 -0
- package/dist/schema/doctor.js.map +1 -0
- package/dist/schema/extract.js +1 -1
- package/dist/schema/extract.js.map +1 -1
- package/dist/schema/index.d.ts +76 -0
- package/dist/schema/index.js +9 -0
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/requires.js +2 -2
- package/dist/schema/requires.js.map +1 -1
- package/dist/schema/risk.d.ts +7 -0
- package/dist/schema/risk.js +23 -0
- package/dist/schema/risk.js.map +1 -1
- package/dist/schema/stale-base-check.d.ts +18 -0
- package/dist/schema/stale-base-check.js +37 -0
- package/dist/schema/stale-base-check.js.map +1 -0
- package/dist/schema/toolchain-parity.d.ts +3 -0
- package/dist/schema/toolchain-parity.js +13 -0
- package/dist/schema/toolchain-parity.js.map +1 -1
- package/package.json +3 -2
- package/dist/policies/duration.js.map +0 -1
- package/dist/policies/extract.js.map +0 -1
- package/dist/runtime/expand-home.js.map +0 -1
- package/dist/runtime/ledger-record.js.map +0 -1
- /package/dist/{policies → io}/duration.d.ts +0 -0
- /package/dist/{policies → io}/duration.js +0 -0
- /package/dist/{runtime → io}/expand-home.d.ts +0 -0
- /package/dist/{runtime → io}/expand-home.js +0 -0
- /package/dist/{policies → io}/extract.d.ts +0 -0
- /package/dist/{policies → io}/extract.js +0 -0
- /package/dist/{runtime → io}/ledger-record.js +0 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
// Batch 18 / task f34eb233 -- opencode runtime adapter config generator.
|
|
2
|
+
//
|
|
3
|
+
// ADR-style adapter-mapping notes (verified 2026-08-18 against the
|
|
4
|
+
// published opencode JSON Schema at https://opencode.ai/config.json, the
|
|
5
|
+
// docs at https://opencode.ai/docs/config/ and https://opencode.ai/docs/plugins/,
|
|
6
|
+
// and the real ~/.config/opencode/opencode.json + opencode.jsonc this
|
|
7
|
+
// exploration ran against as a read-only reference; not modified by this
|
|
8
|
+
// generator or by `harness apply`):
|
|
9
|
+
//
|
|
10
|
+
// Config location: opencode reads config from, in merge/precedence order
|
|
11
|
+
// (later sources win, but every source is MERGED, not replaced):
|
|
12
|
+
// 1. remote config from a `.well-known/opencode` endpoint
|
|
13
|
+
// 2. global config: `~/.config/opencode/opencode.json`
|
|
14
|
+
// 3. custom config: `$OPENCODE_CONFIG` (a path)
|
|
15
|
+
// 4. project config: `opencode.json` in the project root
|
|
16
|
+
// 5. `.opencode/` directories (agents, commands, plugins)
|
|
17
|
+
// 6. inline config: `$OPENCODE_CONFIG_CONTENT`
|
|
18
|
+
// 7. OS-managed config (macOS `/Library/Application Support/opencode/`,
|
|
19
|
+
// Linux `/etc/opencode/`, Windows `%ProgramData%\opencode`)
|
|
20
|
+
// Every one of those slots is either operator-owned or environment/OS
|
|
21
|
+
// selected; opencode does not auto-discover an extra "drop a file here"
|
|
22
|
+
// directory the way a plugin/pack system might. That is exactly why this
|
|
23
|
+
// generator does not attempt to install itself into any of them -- see
|
|
24
|
+
// "What we deliberately do NOT do" below.
|
|
25
|
+
//
|
|
26
|
+
// mcp -> PROJECTED. opencode's config.json has a native `mcp` block
|
|
27
|
+
// ($defs.McpLocalConfig in the published schema: `{ type: "local",
|
|
28
|
+
// command: string[], cwd?, environment?: Record<string,string>,
|
|
29
|
+
// enabled?, timeout? }`). We reuse generate-settings.ts's
|
|
30
|
+
// `buildDesiredMcpServers` (Claude Code's `{command, args, env}` shape,
|
|
31
|
+
// already covering the grounding-mcp EVIDENCE_LEDGER_DB and
|
|
32
|
+
// SOLUTION_VERDICT_SIGNING_KEY projections and the literal-tilde
|
|
33
|
+
// env-value warning) and reshape the
|
|
34
|
+
// result into opencode's `{type: "local", command: [...], environment}`
|
|
35
|
+
// instead of hand-rolling a third copy of that logic that could drift
|
|
36
|
+
// from the other two runtimes.
|
|
37
|
+
//
|
|
38
|
+
// enabled:false -> projected as a bare `{"enabled": false}` marker, NOT
|
|
39
|
+
// omitted (LOW-F4, batch18 fix-round, task f34eb233 review; the
|
|
40
|
+
// reviewer verified live against opencode 1.18.18 that a bare
|
|
41
|
+
// `{"enabled": false}` entry -- no `type`/`command` -- is accepted).
|
|
42
|
+
// `buildMcpServers` drops disabled entries entirely, which is fine for
|
|
43
|
+
// Claude Code's settings.json (the only mcpServers source Claude Code
|
|
44
|
+
// reads, so a dropped entry is equivalent to a disabled one) but wrong
|
|
45
|
+
// for opencode: per the "Config location" list above, opencode MERGES
|
|
46
|
+
// multiple config sources, so a server name this generator's output
|
|
47
|
+
// simply omits does NOT override an `enabled: true` (or default-
|
|
48
|
+
// enabled) declaration for the SAME name in another merged source
|
|
49
|
+
// (e.g. the operator's own ~/.config/opencode/opencode.json) -- the
|
|
50
|
+
// operator's intent to disable that server would silently not take
|
|
51
|
+
// effect. Emitting the explicit marker instead makes the disablement
|
|
52
|
+
// actually win once merged.
|
|
53
|
+
//
|
|
54
|
+
// hooks -> NOT PROJECTED (documented no-op, not a bug). opencode.json's
|
|
55
|
+
// schema has NO declarative hook/event field of any kind (confirmed:
|
|
56
|
+
// absent from https://opencode.ai/config.json). opencode's only
|
|
57
|
+
// extensibility surface for tool-call interception is the JS/TS
|
|
58
|
+
// `plugin` array (`@opencode-ai/plugin`; its event set includes
|
|
59
|
+
// `tool.execute.before` / `tool.execute.after`, `session.*`,
|
|
60
|
+
// `permission.asked`, ...) -- a code-authoring surface, not a
|
|
61
|
+
// config-declared shell-command list like Claude Code's settings.json
|
|
62
|
+
// `hooks` or Codex's `[[hooks.*]]` TOML. Building a harness -> opencode
|
|
63
|
+
// plugin bridge that would let manifest hooks actually intercept tool
|
|
64
|
+
// calls is explicitly out of this task's scope (opencode policy
|
|
65
|
+
// enforcement / hook interception). So `manifest.hooks[]` and the
|
|
66
|
+
// `memory.router` UserPromptSubmit-equivalent projection
|
|
67
|
+
// (`generate-settings.ts#buildMemoryRouterHook`) are both left
|
|
68
|
+
// unprojected here; a warning says so instead of silently dropping them.
|
|
69
|
+
//
|
|
70
|
+
// permission -> NOT PROJECTED (v1; documented follow-up). opencode does
|
|
71
|
+
// have a native `permission` block (per-tool `ask`/`allow`/`deny`, with
|
|
72
|
+
// a pattern-keyed object as an escape hatch) that is a genuine
|
|
73
|
+
// PreToolUse-blocking equivalent -- but its shape (tool key -> pattern
|
|
74
|
+
// -> action) is structurally inverted from the
|
|
75
|
+
// `permissions.{allow,ask,deny}: string[]` pattern-DSL that
|
|
76
|
+
// `policy_packs`' `packPermissions` already produce for Claude Code, and
|
|
77
|
+
// mapping one into the other is real, untested-by-this-task translation
|
|
78
|
+
// work. `generate-codex-config.ts`'s header deferred the analogous
|
|
79
|
+
// Codex sandbox-profile mapping for the same "keep v1 small" reason;
|
|
80
|
+
// this adapter follows that precedent instead of inventing a rushed
|
|
81
|
+
// pattern translator. `apply.ts` surfaces a warning (mirroring the
|
|
82
|
+
// Codex branch) when a manifest actually contributes permissions here,
|
|
83
|
+
// so the gap stays visible instead of silent.
|
|
84
|
+
//
|
|
85
|
+
// Stable-output rules (load-bearing for byte-equivalent regeneration on
|
|
86
|
+
// a no-op apply):
|
|
87
|
+
// - `mcp` server keys are in the order `buildMcpServers` already
|
|
88
|
+
// guarantees: ascending lexical by name.
|
|
89
|
+
// - No timestamps, hostnames, or other run-specific data.
|
|
90
|
+
//
|
|
91
|
+
// What we deliberately do NOT do:
|
|
92
|
+
// - Merge into, or otherwise write, any operator-owned opencode config
|
|
93
|
+
// file (`~/.config/opencode/opencode.json`, a project `opencode.json`,
|
|
94
|
+
// or anything `$OPENCODE_CONFIG` points at). Unlike Codex's
|
|
95
|
+
// `--install` (a marked-block splice into `~/.codex/config.toml`),
|
|
96
|
+
// opencode already merges multiple config sources by precedence (see
|
|
97
|
+
// the location list above), and its config format is JSONC --
|
|
98
|
+
// comments and trailing commas are both allowed (the published
|
|
99
|
+
// schema sets `allowComments` / `allowTrailingCommas`), confirmed
|
|
100
|
+
// against the real machine-local `opencode.jsonc`. So wiring this
|
|
101
|
+
// artefact in is left as an operator action: point `$OPENCODE_CONFIG`
|
|
102
|
+
// at `harness.generated/opencode/opencode.json` directly, or copy the
|
|
103
|
+
// `mcp` block into an existing config. harness never touches
|
|
104
|
+
// `~/.config/opencode/` or a project `opencode.json` itself.
|
|
105
|
+
// - Map policy-pack hook commands into opencode plugin code (see
|
|
106
|
+
// "hooks" above) or opencode's `permission` block (see "permission"
|
|
107
|
+
// above).
|
|
108
|
+
import { buildDesiredMcpServers, } from "./generate-settings.js";
|
|
109
|
+
/**
|
|
110
|
+
* First line of the generated opencode config. Exported so callers that
|
|
111
|
+
* need to detect a harness-generated artefact (doctor's banner check)
|
|
112
|
+
* pin against the same literal as the emitter instead of duplicating the
|
|
113
|
+
* string.
|
|
114
|
+
*/
|
|
115
|
+
export const OPENCODE_GENERATED_HEADER_LINE = "// Generated by harness apply --runtime opencode.";
|
|
116
|
+
const HEADER = [
|
|
117
|
+
OPENCODE_GENERATED_HEADER_LINE,
|
|
118
|
+
"// DO NOT EDIT: re-run `harness apply --runtime opencode` to regenerate.",
|
|
119
|
+
"//",
|
|
120
|
+
"// harness does NOT install this file automatically -- it never writes",
|
|
121
|
+
"// into ~/.config/opencode/ or a project opencode.json. Wire it in",
|
|
122
|
+
"// yourself, either:",
|
|
123
|
+
"// - point $OPENCODE_CONFIG at this file's path, or",
|
|
124
|
+
"// - copy the \"mcp\" block below into your own opencode.json /",
|
|
125
|
+
"// opencode.jsonc (opencode merges config sources by precedence;",
|
|
126
|
+
"// see https://opencode.ai/docs/config/).",
|
|
127
|
+
"//",
|
|
128
|
+
"// Adapter mapping (full ADR in this generator's module header,",
|
|
129
|
+
"// src/cli/apply/generate-opencode-config.ts):",
|
|
130
|
+
"// mcp -> projected below (opencode's native `mcp` block).",
|
|
131
|
+
"// A manifest entry with `enabled: false` is emitted",
|
|
132
|
+
"// as a bare `{\"enabled\": false}` marker rather than",
|
|
133
|
+
"// omitted, so it overrides an active declaration for",
|
|
134
|
+
"// the same server name in another merged config",
|
|
135
|
+
"// source instead of silently not disabling it.",
|
|
136
|
+
"// hooks -> NOT projected; opencode has no declarative hook",
|
|
137
|
+
"// field, only a JS/TS plugin API (out of scope here)",
|
|
138
|
+
"// permission -> NOT projected in v1 (documented follow-up)",
|
|
139
|
+
"",
|
|
140
|
+
].join("\n");
|
|
141
|
+
function toOpencodeMcpServer(server) {
|
|
142
|
+
const out = {
|
|
143
|
+
type: "local",
|
|
144
|
+
command: server.args ? [server.command, ...server.args] : [server.command],
|
|
145
|
+
};
|
|
146
|
+
if (server.env && Object.keys(server.env).length > 0) {
|
|
147
|
+
out.environment = { ...server.env };
|
|
148
|
+
}
|
|
149
|
+
return out;
|
|
150
|
+
}
|
|
151
|
+
export function generateOpencodeConfig(manifest, extras = {}) {
|
|
152
|
+
// Claude Code's {command, args, env} shape already carries the
|
|
153
|
+
// grounding-mcp EVIDENCE_LEDGER_DB and SOLUTION_VERDICT_SIGNING_KEY
|
|
154
|
+
// projections plus the literal-tilde warning, via `buildDesiredMcpServers`
|
|
155
|
+
// (review round H1, Finding 2 -- the single choke point every producer of
|
|
156
|
+
// this shape now shares, instead of hand-rolling a third copy of the
|
|
157
|
+
// buildMcpServers/projectGroundingEnv/projectSigningKeyEnv sequence).
|
|
158
|
+
// `buildMcpServers` (inside the helper) returns keys pre-sorted ascending
|
|
159
|
+
// by name (see its own header) AND drops `enabled: false` entries
|
|
160
|
+
// entirely. That drop is correct for the Claude-Code-shaped intermediate
|
|
161
|
+
// this reuses, but NOT for the final opencode `mcp` block: those disabled
|
|
162
|
+
// entries are re-added below as explicit `{"enabled": false}` markers
|
|
163
|
+
// instead of staying dropped (LOW-F4, batch18 fix-round, task f34eb233
|
|
164
|
+
// review — see this module's "enabled:false" header note for why).
|
|
165
|
+
const { mcp: claudeShapeMcp, warnings } = buildDesiredMcpServers(manifest, {
|
|
166
|
+
homeDir: extras.homeDir,
|
|
167
|
+
generatedDir: extras.generatedDir,
|
|
168
|
+
});
|
|
169
|
+
// Built by iterating manifest.tools.mcp SORTED ascending by name (not
|
|
170
|
+
// by re-using claudeShapeMcp's own key order, which only covers the
|
|
171
|
+
// enabled subset) so the combined enabled+disabled output keeps the
|
|
172
|
+
// same stable-output guarantee the enabled-only projection had before.
|
|
173
|
+
const mcp = {};
|
|
174
|
+
const sortedEntries = [...manifest.tools.mcp].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
175
|
+
for (const e of sortedEntries) {
|
|
176
|
+
if (e.enabled === false) {
|
|
177
|
+
mcp[e.name] = { enabled: false };
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
// Absent when buildMcpServers skipped this entry (empty command
|
|
181
|
+
// after token-splitting; already warned above by buildMcpServers
|
|
182
|
+
// itself).
|
|
183
|
+
const server = claudeShapeMcp[e.name];
|
|
184
|
+
if (server)
|
|
185
|
+
mcp[e.name] = toOpencodeMcpServer(server);
|
|
186
|
+
}
|
|
187
|
+
if (manifest.tools.mcp.length > 0 && Object.keys(mcp).length === 0) {
|
|
188
|
+
// Reachable only when every entry is enabled but produced no
|
|
189
|
+
// projectable server (empty command) -- a real `enabled: false`
|
|
190
|
+
// entry always lands in `mcp` as a marker now, so it can no longer
|
|
191
|
+
// be the cause of an empty result here (LOW-F4).
|
|
192
|
+
warnings.push("tools.mcp[] has entries but none produced a projectable opencode `mcp` entry (see the per-entry warnings above)");
|
|
193
|
+
}
|
|
194
|
+
if (manifest.hooks.length > 0) {
|
|
195
|
+
warnings.push(`manifest contributes ${manifest.hooks.length} hook(s); opencode has no declarative hook wiring (see this generator's header) and none were projected`);
|
|
196
|
+
}
|
|
197
|
+
const router = manifest.memory.router;
|
|
198
|
+
if (router && router.enabled !== false) {
|
|
199
|
+
warnings.push("memory.router is configured but not projected; opencode has no declarative UserPromptSubmit-equivalent (see this generator's header)");
|
|
200
|
+
}
|
|
201
|
+
const config = {
|
|
202
|
+
"$schema": "https://opencode.ai/config.json",
|
|
203
|
+
};
|
|
204
|
+
if (Object.keys(mcp).length > 0)
|
|
205
|
+
config["mcp"] = mcp;
|
|
206
|
+
const body = `${JSON.stringify(config, null, 2)}\n`;
|
|
207
|
+
const content = `${HEADER}${body}`;
|
|
208
|
+
return { content, warnings, mcp };
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=generate-opencode-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-opencode-config.js","sourceRoot":"","sources":["../../../src/cli/apply/generate-opencode-config.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,mEAAmE;AACnE,yEAAyE;AACzE,kFAAkF;AAClF,sEAAsE;AACtE,yEAAyE;AACzE,oCAAoC;AACpC,EAAE;AACF,yEAAyE;AACzE,iEAAiE;AACjE,4DAA4D;AAC5D,yDAAyD;AACzD,kDAAkD;AAClD,2DAA2D;AAC3D,4DAA4D;AAC5D,iDAAiD;AACjD,0EAA0E;AAC1E,iEAAiE;AACjE,sEAAsE;AACtE,wEAAwE;AACxE,yEAAyE;AACzE,uEAAuE;AACvE,0CAA0C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jD,QAAQ,CAAC,IAAI,CACX,iHAAiH,CAClH,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9B,QAAQ,CAAC,IAAI,CACX,wBAAwB,QAAQ,CAAC,KAAK,CAAC,MAAM,yGAAyG,CACvJ,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACtC,IAAI,MAAM,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;QACvC,QAAQ,CAAC,IAAI,CACX,sIAAsI,CACvI,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAA4B;QACtC,SAAS,EAAE,iCAAiC;KAC7C,CAAC;IACF,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC;IAErD,MAAM,IAAI,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;IACpD,MAAM,OAAO,GAAG,GAAG,MAAM,GAAG,IAAI,EAAE,CAAC;IACnC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -4,6 +4,8 @@ export declare const DEFAULT_BUDGET_MS = 30000;
|
|
|
4
4
|
export declare const GROUNDING_MCP_SERVER_NAME = "grounding-mcp";
|
|
5
5
|
/** The env var grounding-mcp's ledger-bridge reads for the evidence-ledger DB path. */
|
|
6
6
|
export declare const EVIDENCE_LEDGER_DB_ENV = "EVIDENCE_LEDGER_DB";
|
|
7
|
+
/** The env var grounding-mcp (>= 0.8.0) reads for the harness's own approval-marker signing-key path. */
|
|
8
|
+
export declare const SOLUTION_VERDICT_SIGNING_KEY_ENV = "SOLUTION_VERDICT_SIGNING_KEY";
|
|
7
9
|
export interface SettingsHookCommand {
|
|
8
10
|
type: "command";
|
|
9
11
|
command: string;
|
|
@@ -32,16 +34,22 @@ export interface GenerateSettingsResult {
|
|
|
32
34
|
warnings: string[];
|
|
33
35
|
/**
|
|
34
36
|
* The manifest's `tools.mcp[]` entries translated into Claude Code's
|
|
35
|
-
* server-spec shape (command/args/env)
|
|
36
|
-
*
|
|
37
|
-
*
|
|
37
|
+
* server-spec shape (command/args/env) via `buildDesiredMcpServers` —
|
|
38
|
+
* INCLUDING both the grounding-mcp `EVIDENCE_LEDGER_DB`
|
|
39
|
+
* (`projectGroundingEnv`) and `SOLUTION_VERDICT_SIGNING_KEY`
|
|
40
|
+
* (`projectSigningKeyEnv`) projections. Deliberately NOT part of `root`
|
|
41
|
+
* and never serialized into settings.json (task
|
|
38
42
|
* init-mcp-wiring-claude-code/T-002): Claude Code does not read the
|
|
39
43
|
* settings.json `mcpServers` block at runtime — see
|
|
40
44
|
* `src/io/claude-mcp.ts`'s module header. User-scope MCP registration
|
|
41
45
|
* goes exclusively through the `claude mcp` CLI now
|
|
42
|
-
* (`ensureMcpServers`)
|
|
43
|
-
*
|
|
44
|
-
*
|
|
46
|
+
* (`ensureMcpServers`). `buildDesiredMcpServers` is the single call
|
|
47
|
+
* every producer of this shape shares (review round H1, Finding 2): the
|
|
48
|
+
* init wizard (`src/cli/init/interactive.ts`), the doctor registration-
|
|
49
|
+
* health check (`src/cli/doctor/claude-mcp.ts`), and the opencode config
|
|
50
|
+
* generator (`generate-opencode-config.ts`) all call it directly rather
|
|
51
|
+
* than re-deriving this field from a written settings.json, so a NEW
|
|
52
|
+
* projected env only needs to be added in one place.
|
|
45
53
|
*/
|
|
46
54
|
mcpServers: Record<string, SettingsMcpServer>;
|
|
47
55
|
}
|
|
@@ -58,36 +66,23 @@ export interface GenerateSettingsExtras {
|
|
|
58
66
|
* injected by tests for determinism.
|
|
59
67
|
*/
|
|
60
68
|
homeDir?: string;
|
|
69
|
+
/**
|
|
70
|
+
* The `harness.generated/` directory for the manifest in use (task
|
|
71
|
+
* 03a917fd/H1). Used only to project `SOLUTION_VERDICT_SIGNING_KEY` (see
|
|
72
|
+
* `projectSigningKeyEnv`) onto the grounding-mcp entry — the path to the
|
|
73
|
+
* harness's own `.approval-signing.key` (`signingKeyPathFor`). Unlike
|
|
74
|
+
* `homeDir` above there is no safe universal default: the generated dir
|
|
75
|
+
* depends on manifest-path resolution (a `--config` override changes
|
|
76
|
+
* it), so a caller that omits this gets NO projection rather than a
|
|
77
|
+
* guessed-wrong path. A relative value, or one carrying a literal `~`,
|
|
78
|
+
* is normalized to an absolute path at the projection boundary (review
|
|
79
|
+
* round H1, Finding 1) rather than rejected — see `projectSigningKeyEnv`.
|
|
80
|
+
*/
|
|
81
|
+
generatedDir?: string;
|
|
61
82
|
}
|
|
62
83
|
export declare function generateSettings(manifest: Manifest): SettingsRoot;
|
|
63
84
|
export declare function generateSettingsWithWarnings(manifest: Manifest, extras?: GenerateSettingsExtras): GenerateSettingsResult;
|
|
64
85
|
export declare function buildMcpServers(entries: McpServer[], warnings: string[]): Record<string, SettingsMcpServer>;
|
|
65
|
-
/**
|
|
66
|
-
* Wire the manifest's `grounding:` section into the grounding-mcp server
|
|
67
|
-
* entry (task 129e1b94, harness-review-2026-07-01/grounding-decorative).
|
|
68
|
-
*
|
|
69
|
-
* `grounding.evidence_ledger.path` becomes the `EVIDENCE_LEDGER_DB` env on
|
|
70
|
-
* the `tools.mcp[grounding-mcp]` entry — the exact variable grounding-mcp's
|
|
71
|
-
* ledger-bridge reads (agent-grounding
|
|
72
|
-
* packages/grounding-mcp/src/ledger-bridge.ts). This makes `grounding:` the
|
|
73
|
-
* section that CONFIGURES the grounding-mcp entry instead of a decorative
|
|
74
|
-
* namesake, resolving the naming collision the 2026-07-01 review flagged.
|
|
75
|
-
*
|
|
76
|
-
* Rules:
|
|
77
|
-
* - Projection only fires when a grounding-mcp entry exists; without one
|
|
78
|
-
* there is no consumer (doctor surfaces that inertness separately).
|
|
79
|
-
* - An operator-declared `env.EVIDENCE_LEDGER_DB` on the entry wins — an
|
|
80
|
-
* explicit override is never clobbered (doctor warns when it diverges
|
|
81
|
-
* from `grounding.evidence_ledger.path`).
|
|
82
|
-
* - The projected value is `~`-expanded to an absolute path, so the
|
|
83
|
-
* literal-tilde child-process footgun (agent-tasks/42d224a6, the very
|
|
84
|
-
* warning above in buildMcpServers) cannot re-enter via this path.
|
|
85
|
-
* - `retention_days`, `policies_source`, and `session.*` stay RESERVED:
|
|
86
|
-
* nothing consumes them yet (evidence-ledger has no retention pruning),
|
|
87
|
-
* and projecting an env no server reads would be decorative again. See
|
|
88
|
-
* the status comments in src/schema/grounding.ts.
|
|
89
|
-
*/
|
|
90
|
-
export declare function projectGroundingEnv(manifest: Manifest, mcp: Record<string, SettingsMcpServer>, homeDir?: string): void;
|
|
91
86
|
/**
|
|
92
87
|
* The value apply projects for `EVIDENCE_LEDGER_DB`: the manifest's
|
|
93
88
|
* `grounding.evidence_ledger.path`, `~`-expanded to an absolute path.
|
|
@@ -95,4 +90,67 @@ export declare function projectGroundingEnv(manifest: Manifest, mcp: Record<stri
|
|
|
95
90
|
* round-trip stays drift-free by construction.
|
|
96
91
|
*/
|
|
97
92
|
export declare function groundingLedgerEnvValue(manifest: Manifest, homeDir?: string): string;
|
|
93
|
+
/**
|
|
94
|
+
* The single source of the projected `SOLUTION_VERDICT_SIGNING_KEY` VALUE
|
|
95
|
+
* (mirrors how `EVIDENCE_LEDGER_DB` shares its value): `expandHome` +
|
|
96
|
+
* `path.resolve` on `generatedDir`, then `signingKeyPathFor`. Both the
|
|
97
|
+
* apply-side projection above and the adopt-side mirror
|
|
98
|
+
* (adopt/derive.ts) MUST call this, never `signingKeyPathFor` on a raw
|
|
99
|
+
* `generatedDir` — otherwise apply and adopt disagree for relative or
|
|
100
|
+
* literal-tilde `generatedDir` values and adopt reports phantom drift.
|
|
101
|
+
*/
|
|
102
|
+
export declare function signingKeyEnvValue(generatedDir: string, homeDir?: string): string;
|
|
103
|
+
export interface BuildDesiredMcpServersOptions {
|
|
104
|
+
/** Threaded to `projectGroundingEnv` and `projectSigningKeyEnv`'s tilde-expansion; defaults to `os.homedir()` (see `expandHome`). */
|
|
105
|
+
homeDir?: string;
|
|
106
|
+
/** Threaded to `projectSigningKeyEnv`; no safe default (see that function's doc). */
|
|
107
|
+
generatedDir?: string;
|
|
108
|
+
}
|
|
109
|
+
export interface DesiredMcpServersResult {
|
|
110
|
+
mcp: Record<string, SettingsMcpServer>;
|
|
111
|
+
warnings: string[];
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Single choke point for the manifest -> Claude-Code-shaped MCP
|
|
115
|
+
* server-spec projection (review round H1, Finding 2 — STRUCTURAL fix).
|
|
116
|
+
* Encapsulates the fixed sequence `buildMcpServers` -> `projectGroundingEnv`
|
|
117
|
+
* -> `projectSigningKeyEnv` so every producer of this shape — `harness
|
|
118
|
+
* apply`'s settings.json generation (this module), the init wizard's
|
|
119
|
+
* `claude mcp` CLI wiring (`src/cli/init/interactive.ts`), the doctor
|
|
120
|
+
* registration-health check (`src/cli/doctor/claude-mcp.ts`), and the
|
|
121
|
+
* opencode config generator (`generate-opencode-config.ts`) — calls this
|
|
122
|
+
* ONE function instead of hand-rolling the same three-call sequence.
|
|
123
|
+
*
|
|
124
|
+
* Before this helper existed, that sequence had to be wired into each
|
|
125
|
+
* call site by hand: three of the four remembered to call
|
|
126
|
+
* `projectSigningKeyEnv` when it was added (task 03a917fd/H1b), and
|
|
127
|
+
* doctor's registration check did not, so its "not registered, run this
|
|
128
|
+
* `claude mcp add-json ...`" hint silently omitted
|
|
129
|
+
* `SOLUTION_VERDICT_SIGNING_KEY` (review round H1, Finding 2). Routing
|
|
130
|
+
* every producer through this function means the NEXT projected env only
|
|
131
|
+
* needs to be added here once, and cannot again reach only some of the
|
|
132
|
+
* call sites.
|
|
133
|
+
*/
|
|
134
|
+
export declare function buildDesiredMcpServers(manifest: Manifest, opts?: BuildDesiredMcpServersOptions): DesiredMcpServersResult;
|
|
98
135
|
export declare function buildMemoryRouterHook(manifest: Manifest): Hook | null;
|
|
136
|
+
/**
|
|
137
|
+
* Convert the manifest's `budget_ms` (milliseconds) into the seconds unit
|
|
138
|
+
* both runtime projections' `timeout` field expects.
|
|
139
|
+
*
|
|
140
|
+
* Claude Code's settings.json hook `timeout` is documented in seconds
|
|
141
|
+
* ("Seconds before canceling", https://code.claude.com/docs/en/hooks), NOT
|
|
142
|
+
* milliseconds like the manifest's `budget_ms`. Before this helper existed,
|
|
143
|
+
* `toSettingsCommand` emitted `h.budget_ms` unconverted, so every Claude
|
|
144
|
+
* hook kill-timer was 1000x too large (a 1000-2000ms template budget became
|
|
145
|
+
* a 1000-2000 SECOND, 16-33 minute, Claude Code timeout). Codex's
|
|
146
|
+
* projection (generate-codex-config.ts) already converted correctly; this
|
|
147
|
+
* helper is the single source of truth both projections now share so they
|
|
148
|
+
* cannot diverge again.
|
|
149
|
+
*
|
|
150
|
+
* `Math.ceil` never rounds a budget down to 0s. The floor (2s for `harness
|
|
151
|
+
* policy intercept`, 1s otherwise) matches Codex's existing floor rationale
|
|
152
|
+
* (generate-codex-config.ts): the policy-intercept engine's own ledger
|
|
153
|
+
* round-trip regularly needs slightly longer than a bare 1s floor would
|
|
154
|
+
* allow.
|
|
155
|
+
*/
|
|
156
|
+
export declare function hookTimeoutSeconds(h: Hook): number;
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
// after schema-defaulting). Always-emit is the conservative choice
|
|
18
18
|
// against an unknown runtime default; an explicit value is consumed
|
|
19
19
|
// identically whether or not the runtime would have defaulted to it.
|
|
20
|
+
// UNIT: Claude Code's settings.json `timeout` is documented in SECONDS,
|
|
21
|
+
// not milliseconds like the manifest's `budget_ms`; see
|
|
22
|
+
// `hookTimeoutSeconds` below for the conversion and its history.
|
|
20
23
|
// - `path_match` and `bash_match` are NOT projected. Claude Code's
|
|
21
24
|
// settings.json `matcher` filters only on the tool name, so there is
|
|
22
25
|
// no native settings.json field for "additional filter when this hook
|
|
@@ -43,12 +46,16 @@
|
|
|
43
46
|
// - Within an event, groups sorted by (matcher, command).
|
|
44
47
|
// - Within a group, the inner hooks[] preserves matcher-grouping order
|
|
45
48
|
// and is sorted by command for the same reason.
|
|
46
|
-
import
|
|
49
|
+
import * as path from "node:path";
|
|
50
|
+
import { expandHome } from "../../io/expand-home.js";
|
|
51
|
+
import { signingKeyPathFor } from "../../runtime/approval-signing.js";
|
|
47
52
|
export const DEFAULT_BUDGET_MS = 30_000;
|
|
48
53
|
/** The manifest `tools.mcp[]` entry name that grounding enforcement keys off. */
|
|
49
54
|
export const GROUNDING_MCP_SERVER_NAME = "grounding-mcp";
|
|
50
55
|
/** The env var grounding-mcp's ledger-bridge reads for the evidence-ledger DB path. */
|
|
51
56
|
export const EVIDENCE_LEDGER_DB_ENV = "EVIDENCE_LEDGER_DB";
|
|
57
|
+
/** The env var grounding-mcp (>= 0.8.0) reads for the harness's own approval-marker signing-key path. */
|
|
58
|
+
export const SOLUTION_VERDICT_SIGNING_KEY_ENV = "SOLUTION_VERDICT_SIGNING_KEY";
|
|
52
59
|
export function generateSettings(manifest) {
|
|
53
60
|
return generateSettingsWithWarnings(manifest).root;
|
|
54
61
|
}
|
|
@@ -78,14 +85,18 @@ export function generateSettingsWithWarnings(manifest, extras = {}) {
|
|
|
78
85
|
const hooks = byEvent.get(event) ?? [];
|
|
79
86
|
out.hooks[event] = buildGroups(hooks);
|
|
80
87
|
}
|
|
81
|
-
//
|
|
82
|
-
//
|
|
83
|
-
//
|
|
84
|
-
//
|
|
85
|
-
//
|
|
88
|
+
// buildDesiredMcpServers still runs here (not moved) so the env-tilde
|
|
89
|
+
// and empty-command warnings stay attached to the same `warnings` array
|
|
90
|
+
// regardless of which path (settings.json hooks vs. the claude-mcp
|
|
91
|
+
// Ensure path) consumes the resulting spec map. The result is
|
|
92
|
+
// intentionally NOT projected into `out` — see
|
|
86
93
|
// GenerateSettingsResult.mcpServers.
|
|
87
|
-
const
|
|
88
|
-
|
|
94
|
+
const desiredMcp = buildDesiredMcpServers(manifest, {
|
|
95
|
+
homeDir: extras.homeDir,
|
|
96
|
+
generatedDir: extras.generatedDir,
|
|
97
|
+
});
|
|
98
|
+
warnings.push(...desiredMcp.warnings);
|
|
99
|
+
const mcp = desiredMcp.mcp;
|
|
89
100
|
const permissions = compactPermissions(extras.packPermissions);
|
|
90
101
|
if (permissions)
|
|
91
102
|
out.permissions = permissions;
|
|
@@ -182,7 +193,7 @@ export function buildMcpServers(entries, warnings) {
|
|
|
182
193
|
* and projecting an env no server reads would be decorative again. See
|
|
183
194
|
* the status comments in src/schema/grounding.ts.
|
|
184
195
|
*/
|
|
185
|
-
|
|
196
|
+
function projectGroundingEnv(manifest, mcp, homeDir) {
|
|
186
197
|
const server = mcp[GROUNDING_MCP_SERVER_NAME];
|
|
187
198
|
if (!server)
|
|
188
199
|
return;
|
|
@@ -204,6 +215,94 @@ export function projectGroundingEnv(manifest, mcp, homeDir) {
|
|
|
204
215
|
export function groundingLedgerEnvValue(manifest, homeDir) {
|
|
205
216
|
return expandHome(manifest.grounding.evidence_ledger.path, homeDir);
|
|
206
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* Wire the harness's own approval-signing key path into the grounding-mcp
|
|
220
|
+
* server entry (task 03a917fd/H1, agent-grounding 9b6c4beb comment 2,
|
|
221
|
+
* Option 2), exactly mirroring `projectGroundingEnv` above.
|
|
222
|
+
*
|
|
223
|
+
* `<generatedDir>/.approval-signing.key` (see `signingKeyPathFor`,
|
|
224
|
+
* src/runtime/approval-signing.ts) becomes the `SOLUTION_VERDICT_SIGNING_KEY`
|
|
225
|
+
* env on the `tools.mcp[grounding-mcp]` entry — the variable grounding-mcp
|
|
226
|
+
* (>= 0.8.0) reads primarily and THROWS on a non-absolute value, so this
|
|
227
|
+
* projects only the fully-resolved, already-absolute key PATH, never the
|
|
228
|
+
* key bytes themselves.
|
|
229
|
+
*
|
|
230
|
+
* Rules (mirrors `projectGroundingEnv`):
|
|
231
|
+
* - Projection only fires when a grounding-mcp entry exists; without one
|
|
232
|
+
* there is no consumer.
|
|
233
|
+
* - An operator-declared `env.SOLUTION_VERDICT_SIGNING_KEY` on the entry
|
|
234
|
+
* wins — an explicit override is never clobbered (same truthiness check:
|
|
235
|
+
* an empty-string "override" is treated as absent).
|
|
236
|
+
* - No `generatedDir` passed in -> no projection, no crash. There is
|
|
237
|
+
* nothing correct to derive without it (see `GenerateSettingsExtras`).
|
|
238
|
+
* - `generatedDir` is normalized at this projection boundary before it
|
|
239
|
+
* reaches `signingKeyPathFor` (review round H1, Finding 1): `expandHome`
|
|
240
|
+
* (same idiom `projectGroundingEnv` above and `groundingLedgerEnvValue`
|
|
241
|
+
* use) then `path.resolve`, so a relative `generatedDir` or one carrying
|
|
242
|
+
* a literal `~` still projects an absolute path — the same
|
|
243
|
+
* never-a-tilde, always-absolute contract `groundingLedgerEnvValue`
|
|
244
|
+
* already gives `EVIDENCE_LEDGER_DB`. This harness never THROWS on a
|
|
245
|
+
* relative/tilde `generatedDir` the way grounding-mcp's own consumer
|
|
246
|
+
* throws on a non-absolute env value; it normalizes instead. The
|
|
247
|
+
* normalization lives in `signingKeyEnvValue` so every producer of this
|
|
248
|
+
* env value shares it (review round H1-R2: the adopt mirror in
|
|
249
|
+
* adopt/derive.ts computes the SAME value through the SAME function;
|
|
250
|
+
* a producer that hand-rolls `signingKeyPathFor` on a raw `generatedDir`
|
|
251
|
+
* reintroduces phantom adopt drift). The key FILE's on-disk location for
|
|
252
|
+
* a non-absolute `generatedDir` is a separate, tracked follow-up.
|
|
253
|
+
*/
|
|
254
|
+
function projectSigningKeyEnv(mcp, generatedDir, homeDir) {
|
|
255
|
+
const server = mcp[GROUNDING_MCP_SERVER_NAME];
|
|
256
|
+
if (!server)
|
|
257
|
+
return;
|
|
258
|
+
if (!generatedDir)
|
|
259
|
+
return;
|
|
260
|
+
const env = server.env ?? {};
|
|
261
|
+
if (!env[SOLUTION_VERDICT_SIGNING_KEY_ENV]) {
|
|
262
|
+
env[SOLUTION_VERDICT_SIGNING_KEY_ENV] = signingKeyEnvValue(generatedDir, homeDir);
|
|
263
|
+
server.env = env;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* The single source of the projected `SOLUTION_VERDICT_SIGNING_KEY` VALUE
|
|
268
|
+
* (mirrors how `EVIDENCE_LEDGER_DB` shares its value): `expandHome` +
|
|
269
|
+
* `path.resolve` on `generatedDir`, then `signingKeyPathFor`. Both the
|
|
270
|
+
* apply-side projection above and the adopt-side mirror
|
|
271
|
+
* (adopt/derive.ts) MUST call this, never `signingKeyPathFor` on a raw
|
|
272
|
+
* `generatedDir` — otherwise apply and adopt disagree for relative or
|
|
273
|
+
* literal-tilde `generatedDir` values and adopt reports phantom drift.
|
|
274
|
+
*/
|
|
275
|
+
export function signingKeyEnvValue(generatedDir, homeDir) {
|
|
276
|
+
return signingKeyPathFor(path.resolve(expandHome(generatedDir, homeDir)));
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Single choke point for the manifest -> Claude-Code-shaped MCP
|
|
280
|
+
* server-spec projection (review round H1, Finding 2 — STRUCTURAL fix).
|
|
281
|
+
* Encapsulates the fixed sequence `buildMcpServers` -> `projectGroundingEnv`
|
|
282
|
+
* -> `projectSigningKeyEnv` so every producer of this shape — `harness
|
|
283
|
+
* apply`'s settings.json generation (this module), the init wizard's
|
|
284
|
+
* `claude mcp` CLI wiring (`src/cli/init/interactive.ts`), the doctor
|
|
285
|
+
* registration-health check (`src/cli/doctor/claude-mcp.ts`), and the
|
|
286
|
+
* opencode config generator (`generate-opencode-config.ts`) — calls this
|
|
287
|
+
* ONE function instead of hand-rolling the same three-call sequence.
|
|
288
|
+
*
|
|
289
|
+
* Before this helper existed, that sequence had to be wired into each
|
|
290
|
+
* call site by hand: three of the four remembered to call
|
|
291
|
+
* `projectSigningKeyEnv` when it was added (task 03a917fd/H1b), and
|
|
292
|
+
* doctor's registration check did not, so its "not registered, run this
|
|
293
|
+
* `claude mcp add-json ...`" hint silently omitted
|
|
294
|
+
* `SOLUTION_VERDICT_SIGNING_KEY` (review round H1, Finding 2). Routing
|
|
295
|
+
* every producer through this function means the NEXT projected env only
|
|
296
|
+
* needs to be added here once, and cannot again reach only some of the
|
|
297
|
+
* call sites.
|
|
298
|
+
*/
|
|
299
|
+
export function buildDesiredMcpServers(manifest, opts = {}) {
|
|
300
|
+
const warnings = [];
|
|
301
|
+
const mcp = buildMcpServers(manifest.tools.mcp, warnings);
|
|
302
|
+
projectGroundingEnv(manifest, mcp, opts.homeDir);
|
|
303
|
+
projectSigningKeyEnv(mcp, opts.generatedDir, opts.homeDir);
|
|
304
|
+
return { mcp, warnings };
|
|
305
|
+
}
|
|
207
306
|
// Translate manifest `memory.router` into a synthetic UserPromptSubmit
|
|
208
307
|
// hook so per-prompt context augmentation actually fires alongside the
|
|
209
308
|
// understanding-gate hook. Returns null when memory.router is absent or
|
|
@@ -288,7 +387,31 @@ function buildGroups(hooks) {
|
|
|
288
387
|
}
|
|
289
388
|
return groups;
|
|
290
389
|
}
|
|
390
|
+
/**
|
|
391
|
+
* Convert the manifest's `budget_ms` (milliseconds) into the seconds unit
|
|
392
|
+
* both runtime projections' `timeout` field expects.
|
|
393
|
+
*
|
|
394
|
+
* Claude Code's settings.json hook `timeout` is documented in seconds
|
|
395
|
+
* ("Seconds before canceling", https://code.claude.com/docs/en/hooks), NOT
|
|
396
|
+
* milliseconds like the manifest's `budget_ms`. Before this helper existed,
|
|
397
|
+
* `toSettingsCommand` emitted `h.budget_ms` unconverted, so every Claude
|
|
398
|
+
* hook kill-timer was 1000x too large (a 1000-2000ms template budget became
|
|
399
|
+
* a 1000-2000 SECOND, 16-33 minute, Claude Code timeout). Codex's
|
|
400
|
+
* projection (generate-codex-config.ts) already converted correctly; this
|
|
401
|
+
* helper is the single source of truth both projections now share so they
|
|
402
|
+
* cannot diverge again.
|
|
403
|
+
*
|
|
404
|
+
* `Math.ceil` never rounds a budget down to 0s. The floor (2s for `harness
|
|
405
|
+
* policy intercept`, 1s otherwise) matches Codex's existing floor rationale
|
|
406
|
+
* (generate-codex-config.ts): the policy-intercept engine's own ledger
|
|
407
|
+
* round-trip regularly needs slightly longer than a bare 1s floor would
|
|
408
|
+
* allow.
|
|
409
|
+
*/
|
|
410
|
+
export function hookTimeoutSeconds(h) {
|
|
411
|
+
const minimumSeconds = h.command.trim() === "harness policy intercept" ? 2 : 1;
|
|
412
|
+
return Math.max(minimumSeconds, Math.ceil(h.budget_ms / 1000));
|
|
413
|
+
}
|
|
291
414
|
function toSettingsCommand(h) {
|
|
292
|
-
return { type: "command", command: h.command, timeout: h
|
|
415
|
+
return { type: "command", command: h.command, timeout: hookTimeoutSeconds(h) };
|
|
293
416
|
}
|
|
294
417
|
//# sourceMappingURL=generate-settings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-settings.js","sourceRoot":"","sources":["../../../src/cli/apply/generate-settings.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,iFAAiF;AACjF,sEAAsE;AACtE,EAAE;AACF,sEAAsE;AACtE,EAAE;AACF,uFAAuF;AACvF,EAAE;AACF,wEAAwE;AACxE,0EAA0E;AAC1E,2EAA2E;AAC3E,kCAAkC;AAClC,6EAA6E;AAC7E,0EAA0E;AAC1E,mDAAmD;AACnD,4EAA4E;AAC5E,uEAAuE;AACvE,wEAAwE;AACxE,yEAAyE;AACzE,qEAAqE;AACrE,yEAAyE;AACzE,0EAA0E;AAC1E,sEAAsE;AACtE,yEAAyE;AACzE,2EAA2E;AAC3E,yEAAyE;AACzE,0EAA0E;AAC1E,uEAAuE;AACvE,sEAAsE;AACtE,yEAAyE;AACzE,uEAAuE;AACvE,oEAAoE;AACpE,0EAA0E;AAC1E,qEAAqE;AACrE,uEAAuE;AACvE,wEAAwE;AACxE,0CAA0C;AAC1C,EAAE;AACF,0EAA0E;AAC1E,gBAAgB;AAChB,uEAAuE;AACvE,0DAA0D;AAC1D,4DAA4D;AAC5D,yEAAyE;AACzE,oDAAoD;
|
|
1
|
+
{"version":3,"file":"generate-settings.js","sourceRoot":"","sources":["../../../src/cli/apply/generate-settings.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,iFAAiF;AACjF,sEAAsE;AACtE,EAAE;AACF,sEAAsE;AACtE,EAAE;AACF,uFAAuF;AACvF,EAAE;AACF,wEAAwE;AACxE,0EAA0E;AAC1E,2EAA2E;AAC3E,kCAAkC;AAClC,6EAA6E;AAC7E,0EAA0E;AAC1E,mDAAmD;AACnD,4EAA4E;AAC5E,uEAAuE;AACvE,wEAAwE;AACxE,yEAAyE;AACzE,4EAA4E;AAC5E,4DAA4D;AAC5D,qEAAqE;AACrE,qEAAqE;AACrE,yEAAyE;AACzE,0EAA0E;AAC1E,sEAAsE;AACtE,yEAAyE;AACzE,2EAA2E;AAC3E,yEAAyE;AACzE,0EAA0E;AAC1E,uEAAuE;AACvE,sEAAsE;AACtE,yEAAyE;AACzE,uEAAuE;AACvE,oEAAoE;AACpE,0EAA0E;AAC1E,qEAAqE;AACrE,uEAAuE;AACvE,wEAAwE;AACxE,0CAA0C;AAC1C,EAAE;AACF,0EAA0E;AAC1E,gBAAgB;AAChB,uEAAuE;AACvE,0DAA0D;AAC1D,4DAA4D;AAC5D,yEAAyE;AACzE,oDAAoD;AAEpD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAExC,iFAAiF;AACjF,MAAM,CAAC,MAAM,yBAAyB,GAAG,eAAe,CAAC;AACzD,uFAAuF;AACvF,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAC3D,yGAAyG;AACzG,MAAM,CAAC,MAAM,gCAAgC,GAAG,8BAA8B,CAAC;AA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;IACxC,MAAM,cAAc,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,0BAA0B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/E,OAAO,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC;AACjE,CAAC;AAED,SAAS,iBAAiB,CAAC,CAAO;IAChC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC;AACjF,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { apply, CODEX_CONFIG_BASENAME, DRIFT_HINT_MESSAGE, GENERATED_DIRNAME, MANIFEST_BASENAME, MEMORY_BASENAME, SETTINGS_BASENAME, type ApplyOptions, type ApplyOutcome, type ApplyResult, type CodexConfigInstallOutcome, type FileApplyOutcome, } from "./apply.js";
|
|
1
|
+
export { apply, CODEX_CONFIG_BASENAME, OPENCODE_CONFIG_BASENAME, DRIFT_HINT_MESSAGE, GENERATED_DIRNAME, MANIFEST_BASENAME, MEMORY_BASENAME, SETTINGS_BASENAME, type ApplyOptions, type ApplyOutcome, type ApplyResult, type CodexConfigInstallOutcome, type FileApplyOutcome, } from "./apply.js";
|
|
2
2
|
export { formatNextSteps, type NextStepsContext } from "./next-steps.js";
|
|
3
3
|
export { generateCodexConfig, type CodexConfigResult } from "./generate-codex-config.js";
|
|
4
|
+
export { generateOpencodeConfig, OPENCODE_GENERATED_HEADER_LINE, type OpencodeConfigResult, type OpencodeLocalMcpServer, type OpencodeDisabledMcpServer, type OpencodeMcpEntry, } from "./generate-opencode-config.js";
|
|
4
5
|
export { CODEX_MANAGED_BEGIN, CODEX_MANAGED_END, CODEX_MANAGED_SOURCE_PREFIX, defaultCodexConfigPath, planCodexConfigInstall, validateCodexManagedConfig, writeCodexConfigInstall, type CodexConfigInstallPlan, type CodexConfigInstallResult, } from "./install-codex-config.js";
|
package/dist/cli/apply/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { apply, CODEX_CONFIG_BASENAME, DRIFT_HINT_MESSAGE, GENERATED_DIRNAME, MANIFEST_BASENAME, MEMORY_BASENAME, SETTINGS_BASENAME, } from "./apply.js";
|
|
1
|
+
export { apply, CODEX_CONFIG_BASENAME, OPENCODE_CONFIG_BASENAME, DRIFT_HINT_MESSAGE, GENERATED_DIRNAME, MANIFEST_BASENAME, MEMORY_BASENAME, SETTINGS_BASENAME, } from "./apply.js";
|
|
2
2
|
export { formatNextSteps } from "./next-steps.js";
|
|
3
3
|
export { generateCodexConfig } from "./generate-codex-config.js";
|
|
4
|
+
export { generateOpencodeConfig, OPENCODE_GENERATED_HEADER_LINE, } from "./generate-opencode-config.js";
|
|
4
5
|
export { CODEX_MANAGED_BEGIN, CODEX_MANAGED_END, CODEX_MANAGED_SOURCE_PREFIX, defaultCodexConfigPath, planCodexConfigInstall, validateCodexManagedConfig, writeCodexConfigInstall, } from "./install-codex-config.js";
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/apply/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,GAMlB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAyB,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAA0B,MAAM,4BAA4B,CAAC;AACzF,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,2BAA2B,EAC3B,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,GAGxB,MAAM,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/apply/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,qBAAqB,EACrB,wBAAwB,EACxB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,GAMlB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAyB,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAA0B,MAAM,4BAA4B,CAAC;AACzF,OAAO,EACL,sBAAsB,EACtB,8BAA8B,GAK/B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,2BAA2B,EAC3B,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,GAGxB,MAAM,2BAA2B,CAAC"}
|