open-multi-agent-kit 0.90.4 → 0.90.6
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 +54 -0
- package/README.md +9 -9
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +1 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/codexbar-cli.d.ts +39 -0
- package/dist/codexbar-cli.d.ts.map +1 -0
- package/dist/codexbar-cli.js +230 -0
- package/dist/codexbar-cli.js.map +1 -0
- package/dist/commands/doctor-provider.d.ts.map +1 -1
- package/dist/commands/doctor-provider.js +16 -3
- package/dist/commands/doctor-provider.js.map +1 -1
- package/dist/core/adaptorch-bridge.d.ts +14 -21
- package/dist/core/adaptorch-bridge.d.ts.map +1 -1
- package/dist/core/adaptorch-bridge.js +11 -18
- package/dist/core/adaptorch-bridge.js.map +1 -1
- package/dist/core/agent-session.d.ts +6 -39
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +37 -107
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/codexbar-adapter.d.ts +44 -0
- package/dist/core/codexbar-adapter.d.ts.map +1 -0
- package/dist/core/codexbar-adapter.js +211 -0
- package/dist/core/codexbar-adapter.js.map +1 -0
- package/dist/core/compaction/index.d.ts +2 -0
- package/dist/core/compaction/index.d.ts.map +1 -1
- package/dist/core/compaction/index.js +2 -0
- package/dist/core/compaction/index.js.map +1 -1
- package/dist/core/compaction/model-policy.d.ts +9 -0
- package/dist/core/compaction/model-policy.d.ts.map +1 -0
- package/dist/core/compaction/model-policy.js +37 -0
- package/dist/core/compaction/model-policy.js.map +1 -0
- package/dist/core/compaction/resume-policy.d.ts +6 -0
- package/dist/core/compaction/resume-policy.d.ts.map +1 -0
- package/dist/core/compaction/resume-policy.js +8 -0
- package/dist/core/compaction/resume-policy.js.map +1 -0
- package/dist/core/context-budget-v2-planner.d.ts.map +1 -1
- package/dist/core/context-budget-v2-planner.js +10 -2
- package/dist/core/context-budget-v2-planner.js.map +1 -1
- package/dist/core/context-budget-v2-types.d.ts +7 -1
- package/dist/core/context-budget-v2-types.d.ts.map +1 -1
- package/dist/core/context-budget-v2-types.js.map +1 -1
- package/dist/core/domain-loadouts.d.ts.map +1 -1
- package/dist/core/domain-loadouts.js +68 -1
- package/dist/core/domain-loadouts.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +12 -0
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +3 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +15 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/grok-harness-dispatch.d.ts +22 -0
- package/dist/core/grok-harness-dispatch.d.ts.map +1 -0
- package/dist/core/grok-harness-dispatch.js +44 -0
- package/dist/core/grok-harness-dispatch.js.map +1 -0
- package/dist/core/grok-harness.d.ts +25 -0
- package/dist/core/grok-harness.d.ts.map +1 -0
- package/dist/core/grok-harness.js +61 -0
- package/dist/core/grok-harness.js.map +1 -0
- package/dist/core/grok-playbook.d.ts +7 -0
- package/dist/core/grok-playbook.d.ts.map +1 -0
- package/dist/core/grok-playbook.js +34 -0
- package/dist/core/grok-playbook.js.map +1 -0
- package/dist/core/reasoning-router-bias.d.ts +11 -23
- package/dist/core/reasoning-router-bias.d.ts.map +1 -1
- package/dist/core/reasoning-router-bias.js +9 -18
- package/dist/core/reasoning-router-bias.js.map +1 -1
- package/dist/core/reasoning-router-resolver.d.ts +44 -0
- package/dist/core/reasoning-router-resolver.d.ts.map +1 -0
- package/dist/core/reasoning-router-resolver.js +79 -0
- package/dist/core/reasoning-router-resolver.js.map +1 -0
- package/dist/core/reasoning-router-v4-weights.d.ts +28 -72
- package/dist/core/reasoning-router-v4-weights.d.ts.map +1 -1
- package/dist/core/reasoning-router-v4-weights.js +16 -60
- package/dist/core/reasoning-router-v4-weights.js.map +1 -1
- package/dist/core/reasoning-router-v4.d.ts +25 -70
- package/dist/core/reasoning-router-v4.d.ts.map +1 -1
- package/dist/core/reasoning-router-v4.js +46 -144
- package/dist/core/reasoning-router-v4.js.map +1 -1
- package/dist/core/router-feedback-collector.d.ts +13 -16
- package/dist/core/router-feedback-collector.d.ts.map +1 -1
- package/dist/core/router-feedback-collector.js +5 -8
- package/dist/core/router-feedback-collector.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +31 -12
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +4 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +16 -98
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +3 -2
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +42 -17
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/correctness-wall.md +117 -0
- package/docs/grok-harness.md +63 -0
- package/docs/loadout-domains/README.md +2 -1
- package/docs/loadout-domains/ai-agent-ops.md +8 -1
- package/docs/loadout-domains/grok-harness.md +74 -0
- package/docs/providers.md +4 -0
- package/docs/usage.md +11 -12
- package/examples/extensions/correctness-wall/LOADOUT.md +87 -0
- package/examples/extensions/correctness-wall/README.md +111 -0
- package/examples/extensions/correctness-wall/adjudication-fixture.ts +151 -0
- package/examples/extensions/correctness-wall/index.ts +470 -0
- package/examples/extensions/correctness-wall/repair-state.ts +77 -0
- package/examples/extensions/correctness-wall/wall-cache.ts +81 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/subagent/agent-capability-router.test.ts +123 -0
- package/examples/extensions/subagent/agent-capability-router.ts +274 -0
- package/examples/extensions/subagent/agents/planner.md +3 -0
- package/examples/extensions/subagent/agents/reviewer.md +3 -0
- package/examples/extensions/subagent/agents/scout.md +3 -0
- package/examples/extensions/subagent/agents/worker.md +2 -0
- package/examples/extensions/subagent/agents.ts +14 -0
- package/examples/extensions/subagent/capabilities.ts +368 -0
- package/examples/extensions/subagent/domain-profiles.ts +1089 -0
- package/examples/extensions/subagent/index.ts +71 -3
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/sdk/12-full-control.ts +1 -1
- package/npm-shrinkwrap.json +12 -12
- package/package.json +5 -5
- package/dist/core/compactor.d.ts +0 -42
- package/dist/core/compactor.d.ts.map +0 -1
- package/dist/core/compactor.js +0 -128
- package/dist/core/compactor.js.map +0 -1
- package/dist/core/reasoning-router-v2.d.ts +0 -94
- package/dist/core/reasoning-router-v2.d.ts.map +0 -1
- package/dist/core/reasoning-router-v2.js +0 -288
- package/dist/core/reasoning-router-v2.js.map +0 -1
- package/dist/core/reasoning-router-v3.d.ts +0 -15
- package/dist/core/reasoning-router-v3.d.ts.map +0 -1
- package/dist/core/reasoning-router-v3.js +0 -193
- package/dist/core/reasoning-router-v3.js.map +0 -1
- package/dist/core/reasoning-router-weights.d.ts +0 -155
- package/dist/core/reasoning-router-weights.d.ts.map +0 -1
- package/dist/core/reasoning-router-weights.js +0 -204
- package/dist/core/reasoning-router-weights.js.map +0 -1
- package/dist/core/reasoning-router.d.ts +0 -44
- package/dist/core/reasoning-router.d.ts.map +0 -1
- package/dist/core/reasoning-router.js +0 -138
- package/dist/core/reasoning-router.js.map +0 -1
- package/dist/core/token-optimizer.d.ts +0 -58
- package/dist/core/token-optimizer.d.ts.map +0 -1
- package/dist/core/token-optimizer.js +0 -179
- package/dist/core/token-optimizer.js.map +0 -1
package/docs/usage.md
CHANGED
|
@@ -38,7 +38,7 @@ Type `/` in the editor to open command completion. Extensions can register custo
|
|
|
38
38
|
|---------|-------------|
|
|
39
39
|
| `/login`, `/logout` | Manage OAuth or API-key credentials |
|
|
40
40
|
| `/model` | Switch models, then choose thinking level |
|
|
41
|
-
| `/think` | Choose thinking level, or `auto
|
|
41
|
+
| `/think` | Choose thinking level, or `auto` to route per task through v4 |
|
|
42
42
|
| `/scoped-models` | Enable/disable models for Ctrl+P cycling |
|
|
43
43
|
| `/settings` | Thinking level, theme, message delivery, transport |
|
|
44
44
|
| `/resume` | Pick from previous sessions |
|
|
@@ -61,35 +61,34 @@ Type `/` in the editor to open command completion. Extensions can register custo
|
|
|
61
61
|
|
|
62
62
|
`/think <level>` sets the thinking level manually. Manual levels always win: choosing a concrete level leaves auto routing, so no auto router runs.
|
|
63
63
|
|
|
64
|
-
`/think auto`
|
|
64
|
+
`/think auto` enables the deterministic local v4 router (no network calls). Versioned auto commands are no longer accepted; choose `/think auto` for automatic routing or `/think <level>` for a manual override.
|
|
65
65
|
|
|
66
|
-
The
|
|
66
|
+
The auto router classifies each prompt into a task class (trivial, simple edit, code generation, debug, refactor, review, plan) and maps it to a recommended level, from `minimal` for trivial prompts up to `xhigh` for planning work.
|
|
67
67
|
|
|
68
68
|
The routing core is deterministic and local. It looks only at bounded turn signals such as:
|
|
69
69
|
|
|
70
70
|
- prompt length
|
|
71
71
|
- presence of code fences or diff markers
|
|
72
|
-
- keyword families
|
|
73
|
-
- leading intent, localized edit objects, diagnostic evidence, review scope, plan briefs, refactor cues, and implementation objects
|
|
74
|
-
- bounded negation of
|
|
75
|
-
- recent auto-router task history in the session
|
|
76
|
-
- context pressure buckets
|
|
72
|
+
- keyword families
|
|
73
|
+
- leading intent, localized edit objects, diagnostic evidence, review scope, plan briefs, refactor cues, and implementation objects
|
|
74
|
+
- bounded negation of whole-prompt matches and short-range compound-intent detection across a leading conjunction
|
|
75
|
+
- recent auto-router task history in the session
|
|
76
|
+
- context pressure buckets
|
|
77
77
|
- the subagent lane type, when one is set
|
|
78
78
|
|
|
79
|
-
v4
|
|
79
|
+
v4 reports a confidence band (`high`, `medium`, `low`), the score margin between the top two task classes, and a fallback reason on every turn, none of which carry prompt text. When confidence is low or no weighted signal decided the class, v4 raises the resolved level by one step above what the same task class would otherwise resolve to; confidence never lowers it. v4 is checked against a gold-set evaluation harness with fixed train/dev/holdout splits and accuracy, macro-F1, severe-under-allocation, and class-flip/McNemar checks.
|
|
80
80
|
|
|
81
81
|
Precedence:
|
|
82
82
|
|
|
83
83
|
- Manual `/think <level>` always wins.
|
|
84
84
|
- The router only resolves levels while `auto` mode is active.
|
|
85
85
|
- Auto-resolved levels apply per turn only and never overwrite the persisted default thinking level in settings.
|
|
86
|
-
- v1 remains the default auto router; v2, v3, and v4 must be selected explicitly for the current session.
|
|
87
86
|
|
|
88
87
|
Resolved levels are clamped to the model's capabilities: models without `xhigh`/`max` are capped at their highest supported level, and models without reasoning support bypass the router entirely.
|
|
89
88
|
|
|
90
|
-
The v4 learning path is available only through the global `reasoningRouterLearning` setting and is off by default. When `reasoningRouterLearning.enabled` is `true`, auto
|
|
89
|
+
The v4 learning path is available only through the global `reasoningRouterLearning` setting and is off by default. When `reasoningRouterLearning.enabled` is `true`, `/think auto` loads one validated bias snapshot for the session, applies a bounded `-2..2` ladder-step bias, and appends a privacy-safe feedback record containing only bounded enums, booleans, and buckets. Project-local settings cannot enable or redirect this feature, and the ledger never stores raw prompts, file paths, diffs, session identifiers, model/provider payloads, tool output, or hook output.
|
|
91
90
|
|
|
92
|
-
The Adaptorch advisory bridge module still ships as default-off groundwork only. It has no settings key, command, transport, or session call site yet, so it does not affect `/think auto
|
|
91
|
+
The Adaptorch advisory bridge module still ships as default-off groundwork only. It has no settings key, command, transport, or session call site yet, so it does not affect `/think auto` until a future transport and security review explicitly wire it.
|
|
93
92
|
|
|
94
93
|
## Message Queue
|
|
95
94
|
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Correctness Wall — optional loadout (copy-paste)
|
|
2
|
+
|
|
3
|
+
Use this when you run OMK with the default **`omk-core-verified`** preset and want a **B2C patch safety screen** on `edit` / `write` before changes land on disk. The wall is policy- and evidence-limited; it is **not** proof of correctness. Canonical operator doc: [`docs/correctness-wall.md`](../../docs/correctness-wall.md).
|
|
4
|
+
|
|
5
|
+
## When to enable
|
|
6
|
+
|
|
7
|
+
| Situation | Action |
|
|
8
|
+
|-----------|--------|
|
|
9
|
+
| AI-generated or high-risk patches in a scoped lane | Load extension + set `OMK_WALL_SCOPE` |
|
|
10
|
+
| Shadow telemetry only (no blocking) | `OMK_PATCH_SAFETY_WALL_MODE=shadow` (default) |
|
|
11
|
+
| Block out-of-scope or secret-shaped diffs | `soft` or `hard` + explicit scope globs |
|
|
12
|
+
| Full outcome adjudication (OA) | Call tool `correctness_wall_evaluate` with fixture — not on the edit hook path |
|
|
13
|
+
|
|
14
|
+
**Routing note:** Domain router may send similar work to [`qa-testing`](../../docs/loadout-domains/qa-testing.md) (`execute-tests`, green-run evidence). The wall complements that lane: it gates **apply**, not **test execution**. For monorepo layout and extension paths, load skill **`packages`** when wiring paths from a checkout.
|
|
15
|
+
|
|
16
|
+
## Copy-paste: session start
|
|
17
|
+
|
|
18
|
+
From repo root (paths assume monorepo checkout):
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
export OMK_PATCH_SAFETY_WALL_MODE=shadow
|
|
22
|
+
export OMK_WALL_SCOPE='packages/coding-agent/**,packages/adaptorch-wpl/**'
|
|
23
|
+
export OMK_WALL_REPAIR_BUDGET=1
|
|
24
|
+
|
|
25
|
+
omk --extension packages/coding-agent/examples/extensions/correctness-wall/index.ts
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Persistent install (user extensions dir):
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
cp -r packages/coding-agent/examples/extensions/correctness-wall ~/.omk/agent/extensions/correctness-wall/
|
|
32
|
+
# Then start omk; discovery depends on your agent config loading ~/.omk/agent/extensions/
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Dogfood phase 2 (soft) — internal lanes
|
|
36
|
+
|
|
37
|
+
After shadow telemetry review (see [correctness-wall.md](../../docs/correctness-wall.md#recommended-rollout-shadow--soft--hard)):
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
export OMK_PATCH_SAFETY_WALL_MODE=soft
|
|
41
|
+
export OMK_WALL_SCOPE='packages/adaptorch-wpl/**,packages/coding-agent/examples/extensions/correctness-wall/**'
|
|
42
|
+
export OMK_WALL_OVERRIDE= # set only for intentional human override
|
|
43
|
+
omk --extension packages/coding-agent/examples/extensions/correctness-wall/index.ts
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Live OA (optional): `OMK_WALL_OA_TRANSPORT=mcp`. The extension entry calls `autoWireLiveAdaptOrch(omk)` so live transport uses host `omk.callMcpTool` when the harness binds a handler at `bindCore`. Until a session MCP hub binds that handler, invocations throw and fixture transport remains the safe default. Manual `setWallAdaptOrchCallTool` is still available for tests.
|
|
47
|
+
|
|
48
|
+
## Copy-paste: `omk-core-verified` + extension
|
|
49
|
+
|
|
50
|
+
Keep your usual preset (`~/.omk/runtime-preset.json` or project default). Add **one** extra flag for this harness:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
omk --extension packages/coding-agent/examples/extensions/correctness-wall/index.ts
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Optional hardening for a single lane (example owned paths only):
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
export OMK_PATCH_SAFETY_WALL_MODE=soft
|
|
60
|
+
export OMK_WALL_SCOPE='packages/coding-agent/examples/extensions/correctness-wall/**'
|
|
61
|
+
export OMK_WALL_OVERRIDE= # unset unless human override is intentional
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## On-demand evaluation (tool)
|
|
65
|
+
|
|
66
|
+
Does not require blocking mode; useful for planners/reviewers:
|
|
67
|
+
|
|
68
|
+
- Tool: `correctness_wall_evaluate`
|
|
69
|
+
- Params: `kind`, optional `diffPath`, `approvedWriteScope`, `previewOnly`, `runIds`, `adjudicationFixturePath`
|
|
70
|
+
- OA fixture format: see [README.md](./README.md#oa-adjudication-fixture-format)
|
|
71
|
+
|
|
72
|
+
## Evidence & cache (no secrets in logs)
|
|
73
|
+
|
|
74
|
+
| Artifact | Purpose |
|
|
75
|
+
|----------|---------|
|
|
76
|
+
| `.omk/wall-cache/latest.json` | Last verdict summary |
|
|
77
|
+
| `.omk/wall-cache/shadow-telemetry.ndjson` | Shadow-mode audit trail |
|
|
78
|
+
| `.omk/wall-cache/repair-budget.json` | Capped repair hints per packet |
|
|
79
|
+
|
|
80
|
+
Final claims still need project rules: e.g. `npm run check` / targeted tests per [`AGENTS.md`](../../../../AGENTS.md) — the wall does not replace those.
|
|
81
|
+
|
|
82
|
+
## See also
|
|
83
|
+
|
|
84
|
+
- [correctness-wall.md](../../docs/correctness-wall.md) — verdicts, fast vs deep wall, Adaptorch relationship
|
|
85
|
+
- [adaptorch-preview.md](../../docs/adaptorch-preview.md) — preview planning (separate from apply gate)
|
|
86
|
+
- [README.md](./README.md) — env vars, hook behavior, limitations
|
|
87
|
+
- Domain catalog: [loadout-domains/README.md](../../docs/loadout-domains/README.md)
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Correctness Wall extension
|
|
2
|
+
|
|
3
|
+
B2C patch safety gate for `edit` and `write` tool calls, plus an explicit `correctness_wall_evaluate` tool. Policy checks come from `omk-adaptorch-wpl` via a **relative import** (no workspace `package.json` dependency).
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
From the `packages/coding-agent` directory (or repo root with a valid path):
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
omk --extension examples/extensions/correctness-wall/index.ts
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Copy into user extensions for auto-discovery:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
cp -r examples/extensions/correctness-wall ~/.omk/agent/extensions/correctness-wall/
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Claim boundaries
|
|
20
|
+
|
|
21
|
+
- **In scope**: unified-diff preview for pending `edit`/`write`, fast policy wall (write scope, flags), optional OA adjudication when `correctness_wall_evaluate` is called with `runIds`, `previewOnly: false`, and an OA fixture file (env or tool param).
|
|
22
|
+
- **Out of scope**: Replacing core hooks, modifying `packages/adaptorch-wpl` from this lane, or adding npm workspace dependencies. The extension only **imports** `evaluateCorrectnessWall` and `AdaptOrchClient` from `../../../../adaptorch-wpl/src/index.ts`.
|
|
23
|
+
|
|
24
|
+
## Environment variables
|
|
25
|
+
|
|
26
|
+
| Variable | Default | Meaning |
|
|
27
|
+
|----------|---------|---------|
|
|
28
|
+
| `OMK_PATCH_SAFETY_WALL_MODE` | `shadow` | `shadow` — log/notify only, never block. `soft` — block `BLOCKED` unless override. `hard` — block `BLOCKED` and `INCONCLUSIVE`. |
|
|
29
|
+
| `OMK_WALL_SCOPE` | *(empty)* | Comma-separated glob/path prefixes allowed in the diff. Empty means scope checks do not approve any path (out-of-scope diffs can trigger blocking flags when paths are present). |
|
|
30
|
+
| `OMK_WALL_OVERRIDE` | unset | When `1` / `true` / `yes`, `soft` mode does not block `BLOCKED` verdicts (human override). |
|
|
31
|
+
| `OMK_WALL_REPAIR_BUDGET` | `1` | Capped regenerate budget: max **blocked attempts** per packet (keyed by `packetId` or SHA-256 of `kind` + sorted `OMK_WALL_SCOPE`) before repair hints are treated as exhausted. Also caps hint string count in UI/JSON. Persisted in `.omk/wall-cache/repair-budget.json`. Hints only — no auto-regenerate. |
|
|
32
|
+
| `OMK_WALL_RUN_IDS` | *(empty)* | Comma-separated AdaptOrch run ids. On `edit`/`write` hooks, when non-empty **and** `OMK_WALL_OA_FIXTURE_PATH` (or per-tool `adjudicationFixturePath`) is set, evaluation uses `previewOnly: false` and OA adjudication via `resolveOaClientForEvaluation`. Otherwise hooks stay preview-only. |
|
|
33
|
+
| `OMK_WALL_OA_FIXTURE_PATH` | unset | Path to OA adjudication fixture JSON. Used when `correctness_wall_evaluate` runs with `previewOnly: false` and non-empty `runIds`, and on edit/write hooks when combined with `OMK_WALL_RUN_IDS`. Overridden per call by `adjudicationFixturePath`. |
|
|
34
|
+
| `OMK_WALL_AUTO_REGENERATE` | unset | When `1` / `true` / `yes`, `correctness_wall_evaluate` JSON may include a `regeneratePacket` (capped hints only; no automatic patch apply). |
|
|
35
|
+
| `OMK_WALL_RECEIPT_SIGNING_SECRET` | unset | When set, verification receipts include `signedReceipt` (HMAC-SHA256 over digest composite). Never log or commit this value. |
|
|
36
|
+
| `OMK_WALL_DEEP_PHASE` | `stub` | `docker` records deep-wall intent; hermetic runner still unavailable (batch-2). |
|
|
37
|
+
| `OMK_WALL_OA_TRANSPORT` | `fixture` | `mcp` or `live` uses session-injected MCP `callTool` via `setWallAdaptOrchCallTool` (see `adjudication-fixture.ts`). Fixture path optional for receipt metadata when using `mcp`. |
|
|
38
|
+
|
|
39
|
+
## OA adjudication fixture format
|
|
40
|
+
|
|
41
|
+
Fixture file (JSON object). Each `run_id` must define the three AdaptOrch introspection payloads the in-memory client serves:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"wall_version": "1",
|
|
46
|
+
"dispatchRecordId": "local-dev-dispatch",
|
|
47
|
+
"runsById": {
|
|
48
|
+
"run-oa-1": {
|
|
49
|
+
"run": { "run_id": "run-oa-1", "status": "completed" },
|
|
50
|
+
"artifacts": [{ "path": "out.md", "size_bytes": 42 }],
|
|
51
|
+
"traces": [{ "kind": "write", "level": "info" }]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
- **`wall_version`**: optional string copied onto the verification **receipt** returned by `correctness_wall_evaluate` (defaults to extension version `1`).
|
|
58
|
+
- **`dispatchRecordId`**: optional; passed to OA adjudication when not set elsewhere.
|
|
59
|
+
- **`runsById`**: required map; keys must match `runIds` in the tool call.
|
|
60
|
+
|
|
61
|
+
`createInMemoryAdaptOrchClient` (in `adjudication-fixture.ts`) wraps these entries with the same transport pattern as `packages/adaptorch-wpl/test/b2c-wall-oa.test.ts`.
|
|
62
|
+
|
|
63
|
+
## Tools
|
|
64
|
+
|
|
65
|
+
### `correctness_wall_evaluate`
|
|
66
|
+
|
|
67
|
+
Parameters:
|
|
68
|
+
|
|
69
|
+
- `kind` (string, required)
|
|
70
|
+
- `approvedWriteScope` (optional string array)
|
|
71
|
+
- `previewOnly` (optional boolean, default `true`)
|
|
72
|
+
- `diffPath` (optional string) — if omitted, returns an `INCONCLUSIVE` verdict card JSON
|
|
73
|
+
- `runIds` (optional string array)
|
|
74
|
+
- `packetId` (optional string)
|
|
75
|
+
- `adjudicationFixturePath` (optional string) — OA fixture file; falls back to `OMK_WALL_OA_FIXTURE_PATH`
|
|
76
|
+
|
|
77
|
+
Returns JSON text: `{ verdictCard, receipt }`, and `repairHints` when `verdictCard.verdict` is `BLOCKED`.
|
|
78
|
+
|
|
79
|
+
The **`receipt`** includes standard `VerificationReceipt` fields from adaptorch-wpl plus **`wall_version`** (from the fixture or default).
|
|
80
|
+
|
|
81
|
+
Example receipt fragment:
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"schemaVersion": 1,
|
|
86
|
+
"evaluatedAt": "2026-07-08T12:00:00.000Z",
|
|
87
|
+
"kind": "code-edit",
|
|
88
|
+
"runIds": ["run-oa-1"],
|
|
89
|
+
"previewOnly": false,
|
|
90
|
+
"wall_version": "1",
|
|
91
|
+
"adjudicationVerdict": "CONFIRMED",
|
|
92
|
+
"policyFlags": []
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Edit/write gate
|
|
97
|
+
|
|
98
|
+
On each `edit` or `write` `tool_call` hook:
|
|
99
|
+
|
|
100
|
+
1. Build a unified diff preview from `event.input` (edits or write content).
|
|
101
|
+
2. Call `evaluateCorrectnessWall` with scope from `OMK_WALL_SCOPE`. Default `previewOnly: true`; when `OMK_WALL_RUN_IDS` is non-empty and an OA fixture path is set (`OMK_WALL_OA_FIXTURE_PATH`), hooks use `previewOnly: false`, pass `runIds`, and supply the OA client from `resolveOaClientForEvaluation`.
|
|
102
|
+
3. Apply `OMK_PATCH_SAFETY_WALL_MODE` blocking rules; blocked calls return `{ block: true, reason: "<short user message>" }`.
|
|
103
|
+
4. Write a summary snapshot to `.omk/wall-cache/latest.json` (mode, verdict, `wouldBlock`, compact card summary, timestamp — no full diff or secrets).
|
|
104
|
+
5. In `shadow` mode, append one NDJSON line per gated tool call to **`.omk/wall-cache/shadow-telemetry.ndjson`** (`event`, `wall_version`, `mode`, `verdict`, `wouldBlock`, `kind`, `tool`, `previewOnly`, `usedOaFixture`, `timestamp` — no diff or secrets).
|
|
105
|
+
6. On `BLOCKED`, increment per-packet attempts in `.omk/wall-cache/repair-budget.json`. In `shadow` mode, append capped repair hints to the UI notification; when `attempts >= OMK_WALL_REPAIR_BUDGET`, append a repair-budget-exhausted message.
|
|
106
|
+
|
|
107
|
+
## Limitations
|
|
108
|
+
|
|
109
|
+
- Edit preview reads the target file from disk relative to session `cwd`; if the file is missing or paths are wrong, the hook may return `INCONCLUSIVE` (and block in `hard` mode).
|
|
110
|
+
- Hook OA requires both `OMK_WALL_RUN_IDS` and a fixture path; if either is missing, hooks remain preview-only. Explicit `correctness_wall_evaluate` can still pass `runIds`, `previewOnly: false`, and `adjudicationFixturePath` per call.
|
|
111
|
+
- Relative imports require loading this extension from the monorepo layout (or an equivalent path to `adaptorch-wpl` and `coding-agent` sources).
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OA adjudication fixture loader and in-memory AdaptOrch client for local/dev evaluation.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { readFile } from "node:fs/promises";
|
|
6
|
+
import type { AdaptOrchCallToolFn, AdaptOrchClient } from "../../../../adaptorch-wpl/src/index.ts";
|
|
7
|
+
import {
|
|
8
|
+
createLiveAdaptOrchClient,
|
|
9
|
+
createInMemoryAdaptOrchClient as createWplInMemoryClient,
|
|
10
|
+
parseOaTransportModeFromEnv,
|
|
11
|
+
} from "../../../../adaptorch-wpl/src/index.ts";
|
|
12
|
+
|
|
13
|
+
/** Optional session-injected MCP `callTool` when `OMK_WALL_OA_TRANSPORT=mcp`. */
|
|
14
|
+
let wallAdaptOrchCallTool: AdaptOrchCallToolFn | undefined;
|
|
15
|
+
|
|
16
|
+
export function setWallAdaptOrchCallTool(fn: AdaptOrchCallToolFn | undefined): void {
|
|
17
|
+
wallAdaptOrchCallTool = fn;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Minimal capability surface an extension host may expose for live MCP transport. */
|
|
21
|
+
export interface McpCallToolCapable {
|
|
22
|
+
callMcpTool?(server: string, name: string, args: Record<string, unknown>): Promise<unknown>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Default MCP server name used by the live adaptorch transport. */
|
|
26
|
+
export const ADAPTORCH_MCP_SERVER = "adaptorch";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Build an {@link AdaptOrchCallToolFn} that forwards to a session MCP capability,
|
|
30
|
+
* or return `undefined` when the host does not expose `callMcpTool`. The adaptorch
|
|
31
|
+
* server name is used as the MCP target by default. Pure: does not touch module state.
|
|
32
|
+
*/
|
|
33
|
+
export function buildLiveCallToolFromCapability(
|
|
34
|
+
api: McpCallToolCapable,
|
|
35
|
+
server: string = ADAPTORCH_MCP_SERVER,
|
|
36
|
+
): AdaptOrchCallToolFn | undefined {
|
|
37
|
+
if (typeof api.callMcpTool !== "function") return undefined;
|
|
38
|
+
return (name, args) => api.callMcpTool!(server, name, args);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Auto-wire live adaptorch MCP transport when the host exposes `callMcpTool`.
|
|
43
|
+
* Called once from the extension entry. Idempotent and a no-op when the capability
|
|
44
|
+
* is absent (fixture transport remains the default). Using the live client is still
|
|
45
|
+
* gated by `OMK_WALL_OA_TRANSPORT=mcp` (explicit operator opt-in).
|
|
46
|
+
*/
|
|
47
|
+
export function autoWireLiveAdaptOrch(api: McpCallToolCapable): void {
|
|
48
|
+
setWallAdaptOrchCallTool(buildLiveCallToolFromCapability(api));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const CORRECTNESS_WALL_EXTENSION_VERSION = "1" as const;
|
|
52
|
+
|
|
53
|
+
/** Per-run payloads returned by fake adaptorch_get_run / _get_artifacts / _get_traces. */
|
|
54
|
+
export interface OaRunFixture {
|
|
55
|
+
run: unknown;
|
|
56
|
+
artifacts: unknown;
|
|
57
|
+
traces: unknown;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface AdjudicationFixtureFile {
|
|
61
|
+
/** Extension / fixture schema version (surfaced on verification receipts as wall_version). */
|
|
62
|
+
wall_version?: string;
|
|
63
|
+
/** Optional default dispatch record id for adjudication requests. */
|
|
64
|
+
dispatchRecordId?: string;
|
|
65
|
+
/** Map of AdaptOrch run_id → MCP tool payloads. */
|
|
66
|
+
runsById: Record<string, OaRunFixture>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
70
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function parseFixtureJson(raw: unknown): AdjudicationFixtureFile {
|
|
74
|
+
if (!isRecord(raw)) {
|
|
75
|
+
throw new Error("OA fixture root must be a JSON object");
|
|
76
|
+
}
|
|
77
|
+
const runsById = raw.runsById;
|
|
78
|
+
if (!isRecord(runsById)) {
|
|
79
|
+
throw new Error("OA fixture missing runsById object");
|
|
80
|
+
}
|
|
81
|
+
const normalized: Record<string, OaRunFixture> = {};
|
|
82
|
+
for (const [runId, entry] of Object.entries(runsById)) {
|
|
83
|
+
if (!isRecord(entry)) {
|
|
84
|
+
throw new Error(`OA fixture runsById.${runId} must be an object`);
|
|
85
|
+
}
|
|
86
|
+
if (!("run" in entry) || !("artifacts" in entry) || !("traces" in entry)) {
|
|
87
|
+
throw new Error(`OA fixture runsById.${runId} must include run, artifacts, and traces`);
|
|
88
|
+
}
|
|
89
|
+
normalized[runId] = {
|
|
90
|
+
run: entry.run,
|
|
91
|
+
artifacts: entry.artifacts,
|
|
92
|
+
traces: entry.traces,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
wall_version:
|
|
97
|
+
typeof raw.wall_version === "string" && raw.wall_version.length > 0
|
|
98
|
+
? raw.wall_version
|
|
99
|
+
: CORRECTNESS_WALL_EXTENSION_VERSION,
|
|
100
|
+
dispatchRecordId: typeof raw.dispatchRecordId === "string" ? raw.dispatchRecordId : undefined,
|
|
101
|
+
runsById: normalized,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export async function loadAdjudicationFixtureFile(filePath: string): Promise<AdjudicationFixtureFile> {
|
|
106
|
+
const text = await readFile(filePath, "utf-8");
|
|
107
|
+
const parsed: unknown = JSON.parse(text);
|
|
108
|
+
return parseFixtureJson(parsed);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** In-memory {@link AdaptOrchClient} backed by fixture run payloads (delegates to omk-adaptorch-wpl). */
|
|
112
|
+
export function createInMemoryAdaptOrchClient(fixture: AdjudicationFixtureFile): AdaptOrchClient {
|
|
113
|
+
return createWplInMemoryClient(fixture.runsById);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function resolveAdjudicationFixturePath(toolParamPath?: string): string | undefined {
|
|
117
|
+
const fromTool = toolParamPath?.trim();
|
|
118
|
+
if (fromTool) return fromTool;
|
|
119
|
+
const fromEnv = process.env.OMK_WALL_OA_FIXTURE_PATH?.trim();
|
|
120
|
+
return fromEnv && fromEnv.length > 0 ? fromEnv : undefined;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export async function resolveOaClientForEvaluation(options: {
|
|
124
|
+
previewOnly: boolean;
|
|
125
|
+
runIds?: string[];
|
|
126
|
+
adjudicationFixturePath?: string;
|
|
127
|
+
}): Promise<{ client?: AdaptOrchClient; fixture?: AdjudicationFixtureFile }> {
|
|
128
|
+
const runIds = options.runIds ?? [];
|
|
129
|
+
if (options.previewOnly || runIds.length === 0) {
|
|
130
|
+
return {};
|
|
131
|
+
}
|
|
132
|
+
const transportMode = parseOaTransportModeFromEnv();
|
|
133
|
+
if (transportMode === "mcp" && wallAdaptOrchCallTool !== undefined) {
|
|
134
|
+
const fixturePath = resolveAdjudicationFixturePath(options.adjudicationFixturePath);
|
|
135
|
+
const fixture = fixturePath !== undefined ? await loadAdjudicationFixtureFile(fixturePath) : undefined;
|
|
136
|
+
return {
|
|
137
|
+
client: createLiveAdaptOrchClient(wallAdaptOrchCallTool),
|
|
138
|
+
fixture,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
const fixturePath = resolveAdjudicationFixturePath(options.adjudicationFixturePath);
|
|
142
|
+
if (!fixturePath) {
|
|
143
|
+
return {};
|
|
144
|
+
}
|
|
145
|
+
const fixture = await loadAdjudicationFixtureFile(fixturePath);
|
|
146
|
+
return { client: createInMemoryAdaptOrchClient(fixture), fixture };
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function wallVersionFromFixture(fixture?: AdjudicationFixtureFile): string {
|
|
150
|
+
return fixture?.wall_version ?? CORRECTNESS_WALL_EXTENSION_VERSION;
|
|
151
|
+
}
|