open-multi-agent-kit 0.90.5 → 0.90.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/CHANGELOG.md +39 -1
  2. package/README.md +9 -9
  3. package/dist/cli/args.d.ts.map +1 -1
  4. package/dist/cli/args.js +2 -1
  5. package/dist/cli/args.js.map +1 -1
  6. package/dist/codexbar-cli.d.ts +39 -0
  7. package/dist/codexbar-cli.d.ts.map +1 -0
  8. package/dist/codexbar-cli.js +230 -0
  9. package/dist/codexbar-cli.js.map +1 -0
  10. package/dist/commands/doctor-provider.d.ts.map +1 -1
  11. package/dist/commands/doctor-provider.js +16 -3
  12. package/dist/commands/doctor-provider.js.map +1 -1
  13. package/dist/core/agent-session.d.ts.map +1 -1
  14. package/dist/core/agent-session.js +30 -8
  15. package/dist/core/agent-session.js.map +1 -1
  16. package/dist/core/codexbar-adapter.d.ts +44 -0
  17. package/dist/core/codexbar-adapter.d.ts.map +1 -0
  18. package/dist/core/codexbar-adapter.js +211 -0
  19. package/dist/core/codexbar-adapter.js.map +1 -0
  20. package/dist/core/command-safety.d.ts.map +1 -1
  21. package/dist/core/command-safety.js +7 -0
  22. package/dist/core/command-safety.js.map +1 -1
  23. package/dist/core/compaction/index.d.ts +2 -0
  24. package/dist/core/compaction/index.d.ts.map +1 -1
  25. package/dist/core/compaction/index.js +2 -0
  26. package/dist/core/compaction/index.js.map +1 -1
  27. package/dist/core/compaction/model-policy.d.ts +9 -0
  28. package/dist/core/compaction/model-policy.d.ts.map +1 -0
  29. package/dist/core/compaction/model-policy.js +37 -0
  30. package/dist/core/compaction/model-policy.js.map +1 -0
  31. package/dist/core/compaction/resume-policy.d.ts +6 -0
  32. package/dist/core/compaction/resume-policy.d.ts.map +1 -0
  33. package/dist/core/compaction/resume-policy.js +8 -0
  34. package/dist/core/compaction/resume-policy.js.map +1 -0
  35. package/dist/core/domain-loadouts.d.ts.map +1 -1
  36. package/dist/core/domain-loadouts.js +68 -1
  37. package/dist/core/domain-loadouts.js.map +1 -1
  38. package/dist/core/extensions/loader.d.ts.map +1 -1
  39. package/dist/core/extensions/loader.js +12 -0
  40. package/dist/core/extensions/loader.js.map +1 -1
  41. package/dist/core/extensions/runner.d.ts.map +1 -1
  42. package/dist/core/extensions/runner.js +3 -0
  43. package/dist/core/extensions/runner.js.map +1 -1
  44. package/dist/core/extensions/types.d.ts +15 -0
  45. package/dist/core/extensions/types.d.ts.map +1 -1
  46. package/dist/core/extensions/types.js.map +1 -1
  47. package/dist/core/grok-harness-dispatch.d.ts +22 -0
  48. package/dist/core/grok-harness-dispatch.d.ts.map +1 -0
  49. package/dist/core/grok-harness-dispatch.js +44 -0
  50. package/dist/core/grok-harness-dispatch.js.map +1 -0
  51. package/dist/core/grok-harness.d.ts +25 -0
  52. package/dist/core/grok-harness.d.ts.map +1 -0
  53. package/dist/core/grok-harness.js +61 -0
  54. package/dist/core/grok-harness.js.map +1 -0
  55. package/dist/core/grok-playbook.d.ts +7 -0
  56. package/dist/core/grok-playbook.d.ts.map +1 -0
  57. package/dist/core/grok-playbook.js +34 -0
  58. package/dist/core/grok-playbook.js.map +1 -0
  59. package/dist/core/reasoning-router-v4-normalize.d.ts +11 -0
  60. package/dist/core/reasoning-router-v4-normalize.d.ts.map +1 -0
  61. package/dist/core/reasoning-router-v4-normalize.js +224 -0
  62. package/dist/core/reasoning-router-v4-normalize.js.map +1 -0
  63. package/dist/core/reasoning-router-v4-weights.d.ts +13 -5
  64. package/dist/core/reasoning-router-v4-weights.d.ts.map +1 -1
  65. package/dist/core/reasoning-router-v4-weights.js +8 -4
  66. package/dist/core/reasoning-router-v4-weights.js.map +1 -1
  67. package/dist/core/reasoning-router-v4.d.ts +3 -3
  68. package/dist/core/reasoning-router-v4.d.ts.map +1 -1
  69. package/dist/core/reasoning-router-v4.js +394 -58
  70. package/dist/core/reasoning-router-v4.js.map +1 -1
  71. package/dist/core/router-feedback-collector.d.ts +1 -1
  72. package/dist/core/router-feedback-collector.d.ts.map +1 -1
  73. package/dist/core/router-feedback-collector.js +9 -1
  74. package/dist/core/router-feedback-collector.js.map +1 -1
  75. package/dist/core/sdk.d.ts.map +1 -1
  76. package/dist/core/sdk.js +31 -12
  77. package/dist/core/sdk.js.map +1 -1
  78. package/dist/core/settings-manager.d.ts +3 -3
  79. package/dist/core/settings-manager.d.ts.map +1 -1
  80. package/dist/core/settings-manager.js.map +1 -1
  81. package/dist/main.d.ts.map +1 -1
  82. package/dist/main.js +4 -0
  83. package/dist/main.js.map +1 -1
  84. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  85. package/dist/modes/interactive/components/settings-selector.js +1 -0
  86. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  87. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  88. package/dist/modes/interactive/components/thinking-selector.js +1 -0
  89. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  90. package/dist/modes/interactive/theme/theme.d.ts +1 -1
  91. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  92. package/dist/modes/interactive/theme/theme.js +2 -0
  93. package/dist/modes/interactive/theme/theme.js.map +1 -1
  94. package/dist/utils/tools-manager.d.ts +3 -2
  95. package/dist/utils/tools-manager.d.ts.map +1 -1
  96. package/dist/utils/tools-manager.js +42 -17
  97. package/dist/utils/tools-manager.js.map +1 -1
  98. package/docs/adaptorch-preview.md +84 -0
  99. package/docs/correctness-wall.md +117 -0
  100. package/docs/grok-harness.md +63 -0
  101. package/docs/loadout-domains/README.md +2 -1
  102. package/docs/loadout-domains/ai-agent-ops.md +8 -1
  103. package/docs/loadout-domains/frontend-ui.md +5 -1
  104. package/docs/loadout-domains/grok-harness.md +74 -0
  105. package/docs/providers.md +4 -0
  106. package/examples/extensions/correctness-wall/LOADOUT.md +87 -0
  107. package/examples/extensions/correctness-wall/README.md +111 -0
  108. package/examples/extensions/correctness-wall/adjudication-fixture.ts +151 -0
  109. package/examples/extensions/correctness-wall/index.ts +470 -0
  110. package/examples/extensions/correctness-wall/repair-state.ts +77 -0
  111. package/examples/extensions/correctness-wall/wall-cache.ts +81 -0
  112. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  113. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  114. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  115. package/examples/extensions/gondolin/package-lock.json +2 -2
  116. package/examples/extensions/gondolin/package.json +1 -1
  117. package/examples/extensions/preset.ts +2 -2
  118. package/examples/extensions/sandbox/package-lock.json +2 -2
  119. package/examples/extensions/sandbox/package.json +1 -1
  120. package/examples/extensions/with-deps/package-lock.json +2 -2
  121. package/examples/extensions/with-deps/package.json +1 -1
  122. package/npm-shrinkwrap.json +12 -12
  123. package/package.json +5 -5
@@ -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
+ }