open-multi-agent-kit 0.91.0 → 0.93.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 +32 -1
- package/README.md +2 -2
- package/dist/core/agent-session.d.ts +29 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +89 -21
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/command-safety.d.ts.map +1 -1
- package/dist/core/command-safety.js +0 -50
- package/dist/core/command-safety.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +5 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +5 -7
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +12 -3
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +28 -15
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/transaction.d.ts.map +1 -1
- package/dist/core/compaction/transaction.js +7 -3
- package/dist/core/compaction/transaction.js.map +1 -1
- package/dist/core/context-budget-headroom-candidates.d.ts.map +1 -1
- package/dist/core/context-budget-headroom-candidates.js +21 -11
- package/dist/core/context-budget-headroom-candidates.js.map +1 -1
- package/dist/core/context-budget-system-prompt-items.d.ts +1 -0
- package/dist/core/context-budget-system-prompt-items.d.ts.map +1 -1
- package/dist/core/context-budget-system-prompt-items.js +7 -8
- package/dist/core/context-budget-system-prompt-items.js.map +1 -1
- package/dist/core/extensions/builtin/command-safety-gate.d.ts +8 -0
- package/dist/core/extensions/builtin/command-safety-gate.d.ts.map +1 -1
- package/dist/core/extensions/builtin/command-safety-gate.js +23 -0
- package/dist/core/extensions/builtin/command-safety-gate.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +4 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +2 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/keybindings.d.ts +5 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +5 -0
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/loadouts.d.ts.map +1 -1
- package/dist/core/loadouts.js +27 -48
- package/dist/core/loadouts.js.map +1 -1
- package/dist/core/model-resolver.d.ts +41 -3
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +17 -9
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/provider-resilience.d.ts.map +1 -1
- package/dist/core/provider-resilience.js +3 -1
- package/dist/core/provider-resilience.js.map +1 -1
- package/dist/core/reasoning-router-v4-weights.d.ts.map +1 -1
- package/dist/core/reasoning-router-v4-weights.js +9 -3
- package/dist/core/reasoning-router-v4-weights.js.map +1 -1
- package/dist/core/reasoning-router-v4.d.ts.map +1 -1
- package/dist/core/reasoning-router-v4.js +94 -24
- package/dist/core/reasoning-router-v4.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +11 -5
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/session-file-compaction.d.ts.map +1 -1
- package/dist/core/session-file-compaction.js +39 -5
- package/dist/core/session-file-compaction.js.map +1 -1
- package/dist/core/session-termination.d.ts.map +1 -1
- package/dist/core/session-termination.js +1 -1
- package/dist/core/session-termination.js.map +1 -1
- package/dist/core/settings-manager.d.ts +3 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +8 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +36 -31
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts +2 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +38 -11
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +112 -11
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/control-panel-box.d.ts +27 -0
- package/dist/modes/interactive/components/control-panel-box.d.ts.map +1 -1
- package/dist/modes/interactive/components/control-panel-box.js +60 -8
- package/dist/modes/interactive/components/control-panel-box.js.map +1 -1
- package/dist/modes/interactive/components/control-panel-layout.d.ts.map +1 -1
- package/dist/modes/interactive/components/control-panel-layout.js +100 -45
- package/dist/modes/interactive/components/control-panel-layout.js.map +1 -1
- package/dist/modes/interactive/components/control-panel-runtime-status.d.ts +9 -0
- package/dist/modes/interactive/components/control-panel-runtime-status.d.ts.map +1 -1
- package/dist/modes/interactive/components/control-panel-runtime-status.js +10 -8
- package/dist/modes/interactive/components/control-panel-runtime-status.js.map +1 -1
- package/dist/modes/interactive/components/control-panel-sparkles.d.ts +5 -0
- package/dist/modes/interactive/components/control-panel-sparkles.d.ts.map +1 -1
- package/dist/modes/interactive/components/control-panel-sparkles.js +14 -9
- package/dist/modes/interactive/components/control-panel-sparkles.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +10 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +3 -3
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/status-sidebar.d.ts +49 -0
- package/dist/modes/interactive/components/status-sidebar.d.ts.map +1 -0
- package/dist/modes/interactive/components/status-sidebar.js +253 -0
- package/dist/modes/interactive/components/status-sidebar.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +9 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +94 -20
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/omk-neon-control.json +13 -13
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +9 -0
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +1 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +19 -8
- package/dist/utils/clipboard.js.map +1 -1
- package/docs/adaptorch-preview-spec.md +174 -0
- package/docs/adaptorch-preview.md +1 -1
- package/docs/compaction.md +20 -13
- package/docs/correctness-wall.md +13 -5
- package/docs/custom-provider.md +8 -8
- package/docs/development.md +2 -2
- package/docs/docs.json +4 -0
- package/docs/environment-variables.md +90 -0
- package/docs/extensions.md +8 -8
- package/docs/index.md +1 -0
- package/docs/json.md +4 -4
- package/docs/providers.md +1 -1
- package/docs/rpc.md +5 -2
- package/docs/session-format.md +5 -5
- package/docs/settings.md +1 -0
- package/docs/skills.md +2 -0
- package/docs/themes.md +2 -2
- package/docs/tui.md +4 -4
- package/docs/usage.md +4 -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/README.md +35 -10
- package/examples/extensions/subagent/adaptive-agent-runtime.test.ts +234 -0
- package/examples/extensions/subagent/adaptive-agent-runtime.ts +240 -0
- package/examples/extensions/subagent/adaptive-result.ts +112 -0
- package/examples/extensions/subagent/agents.test.ts +86 -0
- package/examples/extensions/subagent/agents.ts +18 -4
- package/examples/extensions/subagent/capabilities.ts +15 -1
- package/examples/extensions/subagent/checkpoint-runtime.test.ts +125 -0
- package/examples/extensions/subagent/checkpoint-runtime.ts +198 -0
- package/examples/extensions/subagent/deadline-budget.test.ts +135 -0
- package/examples/extensions/subagent/deadline-budget.ts +242 -0
- package/examples/extensions/subagent/deadline-profile-store.test.ts +72 -0
- package/examples/extensions/subagent/deadline-profile-store.ts +172 -0
- package/examples/extensions/subagent/domain-profiles.ts +272 -0
- package/examples/extensions/subagent/fixtures/fake-omk-json.mjs +13 -0
- package/examples/extensions/subagent/fixtures/hanging-process-tree.mjs +40 -0
- package/examples/extensions/subagent/index.ts +253 -137
- package/examples/extensions/subagent/managed-process.test.ts +178 -0
- package/examples/extensions/subagent/managed-process.ts +236 -0
- package/examples/extensions/subagent/subagent-extension-smoke.test.ts +112 -0
- package/examples/extensions/subagent/subagent-runtime-types.ts +76 -0
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +21 -21
- package/package.json +10 -7
package/dist/utils/clipboard.js
CHANGED
|
@@ -78,15 +78,26 @@ export async function copyToClipboard(text) {
|
|
|
78
78
|
try {
|
|
79
79
|
// Verify wl-copy exists (spawn errors are async and won't be caught)
|
|
80
80
|
execSync("which wl-copy", { stdio: "ignore" });
|
|
81
|
-
// wl-copy with execSync hangs due to fork behavior; use spawn instead
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
// wl-copy with execSync hangs due to fork behavior; use spawn instead.
|
|
82
|
+
// Await the exit code and only claim success on a clean exit, so a
|
|
83
|
+
// failed wl-copy falls through to the xclip/OSC 52 fallbacks.
|
|
84
|
+
const wlCopyExit = await new Promise((resolve) => {
|
|
85
|
+
const proc = spawn("wl-copy", [], { stdio: ["pipe", "ignore", "ignore"] });
|
|
86
|
+
proc.on("error", () => resolve(1));
|
|
87
|
+
proc.on("close", (code) => resolve(code ?? 1));
|
|
88
|
+
proc.stdin.on("error", () => {
|
|
89
|
+
// Ignore EPIPE errors if wl-copy exits early
|
|
90
|
+
});
|
|
91
|
+
proc.stdin.write(text);
|
|
92
|
+
proc.stdin.end();
|
|
85
93
|
});
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
94
|
+
if (wlCopyExit === 0) {
|
|
95
|
+
copied = true;
|
|
96
|
+
}
|
|
97
|
+
else if (hasX11Display) {
|
|
98
|
+
copyToX11Clipboard(options);
|
|
99
|
+
copied = true;
|
|
100
|
+
}
|
|
90
101
|
}
|
|
91
102
|
catch {
|
|
92
103
|
if (hasX11Display) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../../src/utils/clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAQlD,SAAS,kBAAkB,CAAC,OAAmC,EAAQ;IACtE,IAAI,CAAC;QACJ,QAAQ,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;IAAC,MAAM,CAAC;QACR,QAAQ,CAAC,0BAA0B,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;AAAA,CACD;AAED,MAAM,wBAAwB,GAAG,OAAO,CAAC;AAEzC,SAAS,eAAe,CAAC,GAAG,GAAsB,OAAO,CAAC,GAAG,EAAW;IACvE,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,eAAe,CAAC,CAAC;AAAA,CAC5E;AAED,SAAS,SAAS,CAAC,IAAY,EAAW;IACzC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACrD,IAAI,OAAO,CAAC,MAAM,GAAG,wBAAwB,EAAE,CAAC;QAC/C,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,OAAO,MAAM,CAAC,CAAC;IACjD,OAAO,IAAI,CAAC;AAAA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ACD","sourcesContent":["import { execSync, spawn } from \"child_process\";\nimport { platform } from \"os\";\nimport { isWaylandSession } from \"./clipboard-image.ts\";\nimport { clipboard } from \"./clipboard-native.ts\";\n\ntype NativeClipboardExecOptions = {\n\tinput: string;\n\ttimeout: number;\n\tstdio: [\"pipe\", \"ignore\", \"ignore\"];\n};\n\nfunction copyToX11Clipboard(options: NativeClipboardExecOptions): void {\n\ttry {\n\t\texecSync(\"xclip -selection clipboard\", options);\n\t} catch {\n\t\texecSync(\"xsel --clipboard --input\", options);\n\t}\n}\n\nconst MAX_OSC52_ENCODED_LENGTH = 100_000;\n\nfunction isRemoteSession(env: NodeJS.ProcessEnv = process.env): boolean {\n\treturn Boolean(env.SSH_CONNECTION || env.SSH_CLIENT || env.MOSH_CONNECTION);\n}\n\nfunction emitOsc52(text: string): boolean {\n\tconst encoded = Buffer.from(text).toString(\"base64\");\n\tif (encoded.length > MAX_OSC52_ENCODED_LENGTH) {\n\t\treturn false;\n\t}\n\tprocess.stdout.write(`\\x1b]52;c;${encoded}\\x07`);\n\treturn true;\n}\n\nexport async function copyToClipboard(text: string): Promise<void> {\n\tlet copied = false;\n\n\tconst p = platform();\n\n\t// Prefer direct clipboard writes. Emitting OSC 52 first can make terminals\n\t// write the same native clipboard concurrently with the addon, and very large\n\t// OSC 52 payloads can desynchronize terminal rendering.\n\t//\n\t// On Linux, skip the native addon. The underlying `clipboard-rs` crate is\n\t// X11-only and does not retain selection ownership after `set_text`\n\t// resolves, so on Wayland-only compositors (Hyprland, Niri, ...) and even\n\t// some X11 sessions the call resolves successfully without populating the\n\t// clipboard. The platform tools below (wl-copy, xclip, xsel) properly\n\t// daemonize and keep ownership.\n\ttry {\n\t\tif (clipboard && p !== \"linux\") {\n\t\t\tawait clipboard.setText(text);\n\t\t\tcopied = true;\n\t\t}\n\t} catch {\n\t\t// Fall through to platform-specific clipboard tools.\n\t}\n\n\tconst remote = isRemoteSession();\n\tif (copied && !remote) {\n\t\treturn;\n\t}\n\n\tconst options: NativeClipboardExecOptions = { input: text, timeout: 5000, stdio: [\"pipe\", \"ignore\", \"ignore\"] };\n\n\tif (!copied) {\n\t\ttry {\n\t\t\tif (p === \"darwin\") {\n\t\t\t\texecSync(\"pbcopy\", options);\n\t\t\t\tcopied = true;\n\t\t\t} else if (p === \"win32\") {\n\t\t\t\texecSync(\"clip\", options);\n\t\t\t\tcopied = true;\n\t\t\t} else {\n\t\t\t\t// Linux. Try Termux, Wayland, or X11 clipboard tools.\n\t\t\t\tif (process.env.TERMUX_VERSION) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\texecSync(\"termux-clipboard-set\", options);\n\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Fall back to Wayland or X11 tools.\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!copied) {\n\t\t\t\t\tconst hasWaylandDisplay = Boolean(process.env.WAYLAND_DISPLAY);\n\t\t\t\t\tconst hasX11Display = Boolean(process.env.DISPLAY);\n\t\t\t\t\tconst isWayland = isWaylandSession();\n\t\t\t\t\tif (isWayland && hasWaylandDisplay) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t// Verify wl-copy exists (spawn errors are async and won't be caught)\n\t\t\t\t\t\t\texecSync(\"which wl-copy\", { stdio: \"ignore\" });\n\t\t\t\t\t\t\t// wl-copy with execSync hangs due to fork behavior; use spawn instead.\n\t\t\t\t\t\t\t// Await the exit code and only claim success on a clean exit, so a\n\t\t\t\t\t\t\t// failed wl-copy falls through to the xclip/OSC 52 fallbacks.\n\t\t\t\t\t\t\tconst wlCopyExit = await new Promise<number>((resolve) => {\n\t\t\t\t\t\t\t\tconst proc = spawn(\"wl-copy\", [], { stdio: [\"pipe\", \"ignore\", \"ignore\"] });\n\t\t\t\t\t\t\t\tproc.on(\"error\", () => resolve(1));\n\t\t\t\t\t\t\t\tproc.on(\"close\", (code) => resolve(code ?? 1));\n\t\t\t\t\t\t\t\tproc.stdin.on(\"error\", () => {\n\t\t\t\t\t\t\t\t\t// Ignore EPIPE errors if wl-copy exits early\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tproc.stdin.write(text);\n\t\t\t\t\t\t\t\tproc.stdin.end();\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (wlCopyExit === 0) {\n\t\t\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t\t\t} else if (hasX11Display) {\n\t\t\t\t\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\tif (hasX11Display) {\n\t\t\t\t\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (hasX11Display) {\n\t\t\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {\n\t\t\t// Fall through to OSC 52 fallback.\n\t\t}\n\t}\n\n\tif (remote || !copied) {\n\t\tconst osc52Copied = emitOsc52(text);\n\t\tcopied = copied || osc52Copied;\n\t}\n\n\tif (!copied) {\n\t\tthrow new Error(\"Failed to copy to clipboard\");\n\t}\n}\n"]}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# Lane F — AdaptTorch Preview Algorithm (structured spec)
|
|
2
|
+
|
|
3
|
+
**Status:** documentation / interface blueprint only.
|
|
4
|
+
**Evidence roots:** `packages/adaptorch-wpl/`, `.omk/runs/adaptorch-native-loop-algorithm-20260701/final-part1-core-algorithm.md`, `packages/coding-agent/src/core/adaptorch-bridge.ts`, `packages/coding-agent/docs/loadout-domains/README.md`.
|
|
5
|
+
**Not a shipped runtime:** this spec describes a **preview** path (planning, routing, and evidence contracts) unless a future implementation lane wires it.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Inputs
|
|
10
|
+
|
|
11
|
+
| Input | Type | Source | Notes |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| `task_text` | string | user / lane kickoff | Primary routing signal; may be truncated for headroom. |
|
|
14
|
+
| `path_hints` | string[] | cwd, owned paths, globs | Optional; used for domain triggers and write-scope checks. |
|
|
15
|
+
| `upstream_tags` | string[] | goal id, lane role, preset | e.g. `grok-adaptorch-prod`, `omk-planner`. |
|
|
16
|
+
| `payload_shape` | object | planner / DAG artifact | Sanitized shape for topology preview only — **no** raw prompts, secrets, or session ids. |
|
|
17
|
+
| `provider_profile` | enum | session | `grok-oauth-proxy` \| `default` \| other registered provider. |
|
|
18
|
+
| `adaptorch_transport` | optional | MCP grant | If absent, preview runs **local-only** (OMK compose + deterministic fallbacks). |
|
|
19
|
+
| `lane_grants[]` | object[] | root coordinator | Each: scope, authority, skills, MCP, acceptance, evidence path. |
|
|
20
|
+
| `budget_caps` | object | loop / goal | `max_lanes`, `max_dispatch_preview_calls`, wall-clock cap (immutable per preview instance). |
|
|
21
|
+
|
|
22
|
+
**Hard input exclusions (never pass into AdaptOrch advisory or preview payloads):** prompt text/hash, file paths as bulk lists, model/provider identifiers in advisory bridge shape, session/user ids, tool names from live turns, hook stderr, credentials, `.env` material.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Stage A — Signal intake and domain preview
|
|
27
|
+
|
|
28
|
+
**Purpose:** Normalize the kickoff into scored domain signals and a confidence band before any external control-plane call.
|
|
29
|
+
|
|
30
|
+
**Steps:**
|
|
31
|
+
|
|
32
|
+
1. Lowercase and tokenize `task_text`; merge `path_hints` and `upstream_tags` into the scoring buffer.
|
|
33
|
+
2. Score each registered domain profile (keyword, regex, extension, path triggers) per `loadout-domains` rules.
|
|
34
|
+
3. Emit `domain_leader`, `confidence` (`confident` \| `tentative` \| `fallback`), and `ambiguous` flag (runner-up within margin).
|
|
35
|
+
4. Attach recommended **read-only** skills tier (max 2–3) from domain + task class — do not bulk-load the catalog.
|
|
36
|
+
|
|
37
|
+
**Outputs:** `PreviewSignalRecord { domain_id, confidence, ambiguous, suggested_skills[] }`.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Stage B — Topology preview (AdaptOrch read/local)
|
|
42
|
+
|
|
43
|
+
**Purpose:** Classify execution topology **without** submitting `adaptorch_run`.
|
|
44
|
+
|
|
45
|
+
**Precondition:** `adaptorch_transport` granted **and** `payload_shape` is sanitized.
|
|
46
|
+
|
|
47
|
+
**Steps:**
|
|
48
|
+
|
|
49
|
+
1. Call `adaptorch_capabilities` once per preview session (cache TTL).
|
|
50
|
+
2. Call `adaptorch_route_topology` with `{ payload_shape }`.
|
|
51
|
+
3. Map classification to one of: `singleton`, `pipeline`, `DAG`, `ensemble` (closed enum).
|
|
52
|
+
4. If transport missing: set `classification = unknown_local` and record `skipped_reason = no_verified_transport`.
|
|
53
|
+
|
|
54
|
+
**Outputs:** `TopologyPreview { classification, raw_redacted_summary }`.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Stage C — Lane grant and loadout compose
|
|
59
|
+
|
|
60
|
+
**Purpose:** Turn topology + domain into non-overlapping lane grants for parallel workers.
|
|
61
|
+
|
|
62
|
+
**Steps:**
|
|
63
|
+
|
|
64
|
+
1. If `classification` is `DAG` or `ensemble`, decompose into lane candidates along **write-scope boundaries** (one writer per file).
|
|
65
|
+
2. Compose each lane: `scope`, `authority`, `skills[]`, `mcp[]`, relevant hooks, `acceptance`, `evidence_output_path`.
|
|
66
|
+
3. Run read-only authority stripping and always-on security hooks policy.
|
|
67
|
+
4. Reject parallel grants that share the same write path.
|
|
68
|
+
|
|
69
|
+
**Outputs:** `LaneGrantTable[]`, `compose_diagnostics[]`.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Stage D — Dispatch cardinality preview
|
|
74
|
+
|
|
75
|
+
**Purpose:** Preview how many `adaptorch_run` invocations a full loop **might** need without issuing them.
|
|
76
|
+
|
|
77
|
+
**Steps:**
|
|
78
|
+
|
|
79
|
+
1. Read `observed_cardinality_mode` if configured (`single_call` \| `fanout_n` \| `uncalibrated`).
|
|
80
|
+
2. Under `single_call`: `expected_run_ids = 1` per dispatch record.
|
|
81
|
+
3. Under `fanout_n`: derive N from topology template (ensemble = N parallel; pipeline = stage count) — **labeled as hypothesis** until calibrated.
|
|
82
|
+
4. Flag `cardinality_anomaly` if prior observations disagree with mode.
|
|
83
|
+
|
|
84
|
+
**Outputs:** `DispatchPreview { cardinality_mode, expected_run_ids, anomaly_flag }`.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Stage E — Verification preview (adjudicator contract)
|
|
89
|
+
|
|
90
|
+
**Purpose:** State what evidence the Outcome Adjudicator would require **before** any run exists.
|
|
91
|
+
|
|
92
|
+
**Steps:**
|
|
93
|
+
|
|
94
|
+
1. Select verifier registry entry by packet `kind` (string class, stable across retries).
|
|
95
|
+
2. List required checks: terminal run status, artifact presence, trace sanity, scope/schema/content gates.
|
|
96
|
+
3. Map foreseeable `reason_code` values to disposition classes (`escalate`, `reroute_on_recurrence`, `retry_same_topology`) — preview only, no `adjudicate()` call.
|
|
97
|
+
|
|
98
|
+
**Outputs:** `VerificationPreview { kind, required_checks[], reason_code_map_summary }`.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Stage F — Evidence and synthesis contract
|
|
103
|
+
|
|
104
|
+
**Purpose:** Fix the artifact paths and synthesis inputs for the root coordinator.
|
|
105
|
+
|
|
106
|
+
**Steps:**
|
|
107
|
+
|
|
108
|
+
1. Require per-lane evidence files under `.omk/goals/<goal-id>/evidence/` (or lane grant path).
|
|
109
|
+
2. Define synthesis inputs: explorer facts, planner DAG, tester output, reviewer verdict — **no** success claims without attached evidence class.
|
|
110
|
+
3. Optional: if synthesis is explicitly authorized post-evidence, list allowed tools; else local `SYNTHESIS.md` merge.
|
|
111
|
+
4. Emit `PreviewResult` bundle for operators and doc cross-links.
|
|
112
|
+
|
|
113
|
+
**Outputs:** `PreviewResult`, pointers to `packages/coding-agent/docs/adaptorch-preview.md` and this file.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Algorithm 1 — PreviewOrchestrate
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
function PreviewOrchestrate(inputs):
|
|
121
|
+
assert inputs.task_text is non-empty
|
|
122
|
+
A <- StageA_SignalIntake(inputs.task_text, inputs.path_hints, inputs.upstream_tags)
|
|
123
|
+
if inputs.adaptorch_transport is granted and inputs.payload_shape is sanitized:
|
|
124
|
+
B <- StageB_TopologyPreview(inputs.adaptorch_transport, inputs.payload_shape)
|
|
125
|
+
else:
|
|
126
|
+
B <- { classification: unknown_local, skipped_reason: transport_or_shape }
|
|
127
|
+
C <- StageC_ComposeLanes(A, B, inputs.lane_grants, inputs.budget_caps)
|
|
128
|
+
D <- StageD_DispatchCardinalityPreview(B, loop_config.observed_cardinality_mode)
|
|
129
|
+
E <- StageE_VerificationPreview(C.default_kind)
|
|
130
|
+
F <- StageF_EvidenceContract(inputs.goal_id, C.lanes)
|
|
131
|
+
return PreviewResult(A, B, C, D, E, F)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Algorithm 2 — TopologyClassifyPreview
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
function TopologyClassifyPreview(transport, payload_shape):
|
|
140
|
+
caps <- transport.call("adaptorch_capabilities", {})
|
|
141
|
+
if caps indicates unsupported connector:
|
|
142
|
+
return { classification: unknown_local, skipped_reason: capabilities }
|
|
143
|
+
raw <- transport.call("adaptorch_route_topology", { payload_shape: payload_shape })
|
|
144
|
+
class <- extract_enum(raw.classification, {singleton, pipeline, DAG, ensemble})
|
|
145
|
+
if class is missing:
|
|
146
|
+
return { classification: unknown_local, skipped_reason: unparseable }
|
|
147
|
+
return { classification: class, raw_redacted_summary: redact(raw) }
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Algorithm 3 — ClaimSafeNarration
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
function ClaimSafeNarration(preview_result, utterance):
|
|
156
|
+
FORBIDDEN <- phrases implying production AdaptOrch execution without run evidence
|
|
157
|
+
ALLOWED <- planning, routing preview, lane grants, read/local tool names, fallback paths
|
|
158
|
+
if utterance matches any FORBIDDEN pattern:
|
|
159
|
+
return { ok: false, rewrite_hint: use ALLOWED framing + cite evidence path }
|
|
160
|
+
if utterance claims "done" or "verified":
|
|
161
|
+
require preview_result.F.evidence_paths exist and tester evidence class satisfied
|
|
162
|
+
return { ok: true, utterance }
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Acceptance (Lane F)
|
|
168
|
+
|
|
169
|
+
| Criterion | Evidence |
|
|
170
|
+
| --- | --- |
|
|
171
|
+
| This spec exists at the path above | read in session |
|
|
172
|
+
| adaptorch-preview.md links here | link check in intro doc |
|
|
173
|
+
| No adaptorch-wpl src edits | git status scoped to docs + goal only |
|
|
174
|
+
| Algorithms 1–3 present as pseudocode | this file Algorithms section |
|
|
@@ -59,7 +59,7 @@ When in doubt, cite an evidence class from `AGENTS.md` (read, diff, test output,
|
|
|
59
59
|
|
|
60
60
|
The canonical stage breakdown (Inputs, Stages A–F, Algorithms 1–3 as pseudocode) lives in the goal artifact:
|
|
61
61
|
|
|
62
|
-
**[
|
|
62
|
+
**[adaptorch-preview-spec.md](./adaptorch-preview-spec.md)**
|
|
63
63
|
|
|
64
64
|
Use that file for implementation planning; this page is the operator-facing intro and claim boundary.
|
|
65
65
|
|
package/docs/compaction.md
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
LLMs have limited context windows. When conversations grow too long, omk uses compaction to summarize older content while preserving recent work. This page covers both auto-compaction and branch summarization.
|
|
4
4
|
|
|
5
|
-
**Source files** ([omk-mono](https://github.com/
|
|
6
|
-
- [`packages/coding-agent/src/core/compaction/compaction.ts`](https://github.com/
|
|
7
|
-
- [`packages/coding-agent/src/core/compaction/branch-summarization.ts`](https://github.com/
|
|
8
|
-
- [`packages/coding-agent/src/core/compaction/utils.ts`](https://github.com/
|
|
9
|
-
- [`packages/coding-agent/src/core/session-manager.ts`](https://github.com/
|
|
10
|
-
- [`packages/coding-agent/src/core/extensions/types.ts`](https://github.com/
|
|
5
|
+
**Source files** ([omk-mono](https://github.com/dmae97/omk)):
|
|
6
|
+
- [`packages/coding-agent/src/core/compaction/compaction.ts`](https://github.com/dmae97/omk/blob/main/packages/coding-agent/src/core/compaction/compaction.ts) - Auto-compaction logic
|
|
7
|
+
- [`packages/coding-agent/src/core/compaction/branch-summarization.ts`](https://github.com/dmae97/omk/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts) - Branch summarization
|
|
8
|
+
- [`packages/coding-agent/src/core/compaction/utils.ts`](https://github.com/dmae97/omk/blob/main/packages/coding-agent/src/core/compaction/utils.ts) - Shared utilities (file tracking, serialization)
|
|
9
|
+
- [`packages/coding-agent/src/core/session-manager.ts`](https://github.com/dmae97/omk/blob/main/packages/coding-agent/src/core/session-manager.ts) - Entry types (`CompactionEntry`, `BranchSummaryEntry`)
|
|
10
|
+
- [`packages/coding-agent/src/core/extensions/types.ts`](https://github.com/dmae97/omk/blob/main/packages/coding-agent/src/core/extensions/types.ts) - Extension event types
|
|
11
11
|
|
|
12
12
|
For TypeScript definitions in your project, inspect `node_modules/open-multi-agent-kit/dist/`.
|
|
13
13
|
|
|
@@ -62,12 +62,19 @@ You can also trigger manually with `/compact [instructions]`, where optional ins
|
|
|
62
62
|
|
|
63
63
|
By default, compaction uses the active session model. Set `compaction.model` to an authenticated canonical `provider/model` reference when summaries should use a different model. For example, `zai/glm-5.2` keeps an interactive Claude session while using GLM only for auto-compaction and `/compact`.
|
|
64
64
|
|
|
65
|
+
### Summarization Requests
|
|
66
|
+
|
|
67
|
+
Every compaction and branch-summary LLM call flows through one choke point (`completeSummarization`):
|
|
68
|
+
|
|
69
|
+
- **Retries**: transient stream drops (`terminated`, socket close, 5xx, DNS/transport errors) follow the configured `retry` settings (`enabled`, `maxRetries`, `baseDelayMs`) with exponential backoff instead of failing the whole operation on the first attempt. Quota/billing errors fail fast, and aborts are never retried. Retry progress is emitted as `summarization_retry_scheduled` / `summarization_retry_attempt_start` / `summarization_retry_finished` session events (surfaced in the TUI and RPC stream).
|
|
70
|
+
- **Isolation**: each summarization request runs with prompt caching disabled (`cacheRetention: "none"`) and a fresh routing `sessionId`, so summaries never write unusable provider cache entries or inherit interactive session affinity.
|
|
71
|
+
|
|
65
72
|
### How It Works
|
|
66
73
|
|
|
67
74
|
1. **Find cut point**: Walk backwards from newest message, accumulating token estimates until `keepRecentTokens` (default 20k, configurable in `~/.omk/agent/settings.json` or `<project-dir>/.omk/settings.json`) is reached
|
|
68
75
|
2. **Extract messages**: Collect messages from the previous kept boundary (or session start) up to the cut point
|
|
69
76
|
3. **Generate summary**: Call LLM to summarize with structured format, passing the previous summary as iterative context when present
|
|
70
|
-
4. **
|
|
77
|
+
4. **Sanitize and append**: Deterministically redact sensitive values, then save the `CompactionEntry` with its summary and `firstKeptEntryId`. Exact `[REDACTED]` assignment placeholders are valid; appended data and unredacted credential-shaped literals remain rejected.
|
|
71
78
|
5. **Reload**: Session reloads, using summary + messages from `firstKeptEntryId` onwards
|
|
72
79
|
|
|
73
80
|
```
|
|
@@ -144,7 +151,7 @@ Never cut at tool results (they must stay with their tool call).
|
|
|
144
151
|
|
|
145
152
|
### CompactionEntry Structure
|
|
146
153
|
|
|
147
|
-
Defined in [`session-manager.ts`](https://github.com/
|
|
154
|
+
Defined in [`session-manager.ts`](https://github.com/dmae97/omk/blob/main/packages/coding-agent/src/core/session-manager.ts):
|
|
148
155
|
|
|
149
156
|
```typescript
|
|
150
157
|
interface CompactionEntry<T = unknown> {
|
|
@@ -168,7 +175,7 @@ interface CompactionDetails {
|
|
|
168
175
|
|
|
169
176
|
Extensions can store any JSON-serializable data in `details`. The default compaction tracks file operations, but custom extension implementations can use their own structure.
|
|
170
177
|
|
|
171
|
-
See [`prepareCompaction()`](https://github.com/
|
|
178
|
+
See [`prepareCompaction()`](https://github.com/dmae97/omk/blob/main/packages/coding-agent/src/core/compaction/compaction.ts) and [`compact()`](https://github.com/dmae97/omk/blob/main/packages/coding-agent/src/core/compaction/compaction.ts) for the implementation.
|
|
172
179
|
|
|
173
180
|
## Branch Summarization
|
|
174
181
|
|
|
@@ -211,7 +218,7 @@ This means file tracking accumulates across multiple compactions or nested branc
|
|
|
211
218
|
|
|
212
219
|
### BranchSummaryEntry Structure
|
|
213
220
|
|
|
214
|
-
Defined in [`session-manager.ts`](https://github.com/
|
|
221
|
+
Defined in [`session-manager.ts`](https://github.com/dmae97/omk/blob/main/packages/coding-agent/src/core/session-manager.ts):
|
|
215
222
|
|
|
216
223
|
```typescript
|
|
217
224
|
interface BranchSummaryEntry<T = unknown> {
|
|
@@ -234,7 +241,7 @@ interface BranchSummaryDetails {
|
|
|
234
241
|
|
|
235
242
|
Same as compaction, extensions can store custom data in `details`.
|
|
236
243
|
|
|
237
|
-
See [`collectEntriesForBranchSummary()`](https://github.com/
|
|
244
|
+
See [`collectEntriesForBranchSummary()`](https://github.com/dmae97/omk/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts), [`prepareBranchEntries()`](https://github.com/dmae97/omk/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts), and [`generateBranchSummary()`](https://github.com/dmae97/omk/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts) for the implementation.
|
|
238
245
|
|
|
239
246
|
## Summary Format
|
|
240
247
|
|
|
@@ -278,7 +285,7 @@ path/to/changed.ts
|
|
|
278
285
|
|
|
279
286
|
### Message Serialization
|
|
280
287
|
|
|
281
|
-
Before summarization, messages are serialized to text via [`serializeConversation()`](https://github.com/
|
|
288
|
+
Before summarization, messages are serialized to text via [`serializeConversation()`](https://github.com/dmae97/omk/blob/main/packages/coding-agent/src/core/compaction/utils.ts):
|
|
282
289
|
|
|
283
290
|
```
|
|
284
291
|
[User]: What they said
|
|
@@ -294,7 +301,7 @@ Tool results are truncated to 2000 characters during serialization. Content beyo
|
|
|
294
301
|
|
|
295
302
|
## Custom Summarization via Extensions
|
|
296
303
|
|
|
297
|
-
Extensions can intercept and customize both compaction and branch summarization. See [`extensions/types.ts`](https://github.com/
|
|
304
|
+
Extensions can intercept and customize both compaction and branch summarization. See [`extensions/types.ts`](https://github.com/dmae97/omk/blob/main/packages/coding-agent/src/core/extensions/types.ts) for event type definitions.
|
|
298
305
|
|
|
299
306
|
### session_before_compact
|
|
300
307
|
|
package/docs/correctness-wall.md
CHANGED
|
@@ -28,7 +28,7 @@ Structured next steps on the verdict card: **Apply**, **Deep Check**, **Regenera
|
|
|
28
28
|
## Fast wall vs deep wall
|
|
29
29
|
|
|
30
30
|
- **Fast wall (default):** Pure policy — diff paths, scope globs, secret-shaped lines, preview-only limits (`BATCH1_NO_DOCKER_RUNNER`). No Docker runner in batch 1.
|
|
31
|
-
- **Deep wall (Pro / future):** Hermetic paired base/patch replay. Today `deepWall: true` returns **unavailable**
|
|
31
|
+
- **Deep wall (Pro / future):** Hermetic paired base/patch replay. Today `deepWall: true` returns **unavailable** (evidence-gated: requires a valid execution receipt per ALG-003 strict mode; no Docker runner wired in batch 1).
|
|
32
32
|
|
|
33
33
|
## Relationship to Adaptorch
|
|
34
34
|
|
|
@@ -74,7 +74,7 @@ The correctness wall is **not** part of the default `omk-core-verified` preset o
|
|
|
74
74
|
| **Role loadouts** | `code` / `executor` lanes still get `pre-shell-guard`, `protect-secrets`, and `typecheck-after-edit`; the wall **adds** a pre-apply policy gate on `edit` / `write` only when the extension is loaded |
|
|
75
75
|
| **Domain router** | No dedicated domain profile today; patch-safety work may route to [`ai-agent-ops`](./loadout-domains/ai-agent-ops.md) for harness/eval discipline, but that does **not** auto-load this extension |
|
|
76
76
|
|
|
77
|
-
**
|
|
77
|
+
**Domain router triggers (implemented):** `packages/coding-agent/src/core/domain-loadouts.ts` already contains keyword triggers (`correctness wall`, `patch safety`) and a path trigger (`correctness-wall`) that route to the PATCH SAFETY domain profile. The profile instructs operators to load the correctness-wall extension explicitly (not in default preset) and follow the shadow → soft → hard rollout. Auto-generated docs under `docs/loadout-domains/` should be regenerated via `gen-domain-docs.mjs`, not hand-edited.
|
|
78
78
|
|
|
79
79
|
Regression coverage for the wall library surface lives in `packages/coding-agent/test/suite/regressions/018-b2c-correctness-wall.test.ts` (imports `omk-adaptorch-wpl` the same way the extension does).
|
|
80
80
|
|
|
@@ -105,9 +105,17 @@ Goal orchestration v2 artifacts (planner P3) live beside batch-1 plan files:
|
|
|
105
105
|
| Three-wave execution DAG (JSON) | `.omk/goals/b2c-correctness-wall-2026-07-08/dag-v2.json` |
|
|
106
106
|
| Explorer: browser-smoke vs extension load + loadout gaps | `.omk/goals/b2c-correctness-wall-2026-07-08/laneE-explorer.md` |
|
|
107
107
|
|
|
108
|
-
**Wave 2 (prove / integrate)
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
**Wave 2 (prove / integrate) — Partial:**
|
|
109
|
+
- ✅ `domain-loadouts.ts` triggers for `correctness wall` / `patch safety` shipped (keyword + path patterns, PATCH SAFETY domain profile).
|
|
110
|
+
- ✅ Evidence receipt v3 (ALG-003 15/15) gates deep-wall availability on valid execution receipts.
|
|
111
|
+
- ⬜ `AdaptOrchClient` hook wiring when session has run context — not yet connected.
|
|
112
|
+
- ⬜ Lift `BATCH1_NO_DOCKER_RUNNER` for non-preview deep wall — still stub.
|
|
113
|
+
- ⬜ Preset documentation in `~/.omk/runtime-preset.json` — deferred.
|
|
114
|
+
|
|
115
|
+
**Wave 3 (productize) — Not started:**
|
|
116
|
+
- ⬜ Publish `omk-adaptorch-wpl` from `dist/` for out-of-monorepo extensions.
|
|
117
|
+
- ✅ `domain-loadouts.ts` profile exists; `gen-domain-docs.mjs` regen pending.
|
|
118
|
+
- ⬜ Default **soft** for internal dogfood presets after Wave 2 evidence.
|
|
111
119
|
|
|
112
120
|
## See also
|
|
113
121
|
|
package/docs/custom-provider.md
CHANGED
|
@@ -372,12 +372,12 @@ interface OAuthCredentials {
|
|
|
372
372
|
For providers with non-standard APIs, implement `streamSimple`. Study the existing provider implementations before writing your own:
|
|
373
373
|
|
|
374
374
|
**Reference implementations:**
|
|
375
|
-
- [anthropic.ts](https://github.com/
|
|
376
|
-
- [mistral.ts](https://github.com/
|
|
377
|
-
- [openai-completions.ts](https://github.com/
|
|
378
|
-
- [openai-responses.ts](https://github.com/
|
|
379
|
-
- [google.ts](https://github.com/
|
|
380
|
-
- [amazon-bedrock.ts](https://github.com/
|
|
375
|
+
- [anthropic.ts](https://github.com/dmae97/omk/blob/main/packages/ai/src/providers/anthropic.ts) - Anthropic Messages API
|
|
376
|
+
- [mistral.ts](https://github.com/dmae97/omk/blob/main/packages/ai/src/providers/mistral.ts) - Mistral Conversations API
|
|
377
|
+
- [openai-completions.ts](https://github.com/dmae97/omk/blob/main/packages/ai/src/providers/openai-completions.ts) - OpenAI Chat Completions
|
|
378
|
+
- [openai-responses.ts](https://github.com/dmae97/omk/blob/main/packages/ai/src/providers/openai-responses.ts) - OpenAI Responses API
|
|
379
|
+
- [google.ts](https://github.com/dmae97/omk/blob/main/packages/ai/src/providers/google.ts) - Google Generative AI
|
|
380
|
+
- [amazon-bedrock.ts](https://github.com/dmae97/omk/blob/main/packages/ai/src/providers/amazon-bedrock.ts) - AWS Bedrock
|
|
381
381
|
|
|
382
382
|
### Stream Pattern
|
|
383
383
|
|
|
@@ -540,7 +540,7 @@ When a request exceeds the model's context window, omk can recover automatically
|
|
|
540
540
|
Detection runs on the finalized assistant message:
|
|
541
541
|
|
|
542
542
|
- `stopReason === "error"`
|
|
543
|
-
- `errorMessage` matches one of omk's known overflow patterns (see [`packages/ai/src/utils/overflow.ts`](https://github.com/
|
|
543
|
+
- `errorMessage` matches one of omk's known overflow patterns (see [`packages/ai/src/utils/overflow.ts`](https://github.com/dmae97/omk/blob/main/packages/ai/src/utils/overflow.ts))
|
|
544
544
|
|
|
545
545
|
If your provider returns overflow errors with a message omk does not recognize, normalize the error from the same extension that registers the provider. Use a `message_end` handler to rewrite the assistant message so its `errorMessage` starts with a phrase omk recognizes. The generic fallback `context_length_exceeded` is the safest choice.
|
|
546
546
|
|
|
@@ -603,7 +603,7 @@ omk.registerProvider("my-provider", {
|
|
|
603
603
|
|
|
604
604
|
## Testing Your Implementation
|
|
605
605
|
|
|
606
|
-
Test your provider against the same test suites used by built-in providers. Copy and adapt these test files from [packages/ai/test/](https://github.com/
|
|
606
|
+
Test your provider against the same test suites used by built-in providers. Copy and adapt these test files from [packages/ai/test/](https://github.com/dmae97/omk/tree/main/packages/ai/test):
|
|
607
607
|
|
|
608
608
|
| Test | Purpose |
|
|
609
609
|
|------|---------|
|
package/docs/development.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Development
|
|
2
2
|
|
|
3
|
-
See [AGENTS.md](https://github.com/
|
|
3
|
+
See [AGENTS.md](https://github.com/dmae97/omk/blob/main/AGENTS.md) for additional guidelines.
|
|
4
4
|
|
|
5
5
|
## Setup
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
git clone https://github.com/
|
|
8
|
+
git clone https://github.com/dmae97/omk
|
|
9
9
|
cd omk-mono
|
|
10
10
|
npm install
|
|
11
11
|
npm run build
|
package/docs/docs.json
CHANGED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Environment Variables
|
|
2
|
+
|
|
3
|
+
OMK uses environment variables in three ways:
|
|
4
|
+
|
|
5
|
+
- Variables such as `OMK_OFFLINE` configure the OMK process.
|
|
6
|
+
- OMK sets `OMK_CODING_AGENT` so child processes can detect that they run inside OMK.
|
|
7
|
+
- Commands run by the LLM-callable bash tool receive `PI_*` variables describing the current session.
|
|
8
|
+
|
|
9
|
+
Provider API-key variables are documented separately in [Providers](providers.md).
|
|
10
|
+
|
|
11
|
+
## Process Marker
|
|
12
|
+
|
|
13
|
+
The CLI and RPC entry points set `OMK_CODING_AGENT=true`. Child processes inherit it and can use it to detect that they run inside OMK. It is not session-specific and is not set automatically when OMK is embedded through the SDK.
|
|
14
|
+
|
|
15
|
+
## Bash Tool Session Environment
|
|
16
|
+
|
|
17
|
+
Commands run by the bash tool receive the current session state (the `PI_*` names are kept for upstream Pi compatibility):
|
|
18
|
+
|
|
19
|
+
| Variable | Description |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| `PI_SESSION_ID` | Current session ID |
|
|
22
|
+
| `PI_SESSION_FILE` | Absolute path to the current session JSONL file; unset for ephemeral sessions |
|
|
23
|
+
| `PI_PROVIDER` | Currently selected model provider |
|
|
24
|
+
| `PI_MODEL` | Currently selected model ID |
|
|
25
|
+
| `PI_REASONING_LEVEL` | Current effective reasoning level: `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max` |
|
|
26
|
+
|
|
27
|
+
The values are resolved when each command starts. Switching models or changing the reasoning level therefore affects the next bash command without restarting OMK. `PI_PROVIDER` and `PI_MODEL` identify the selected OMK model, not a different upstream model that a router may choose internally.
|
|
28
|
+
|
|
29
|
+
Inherited parent-process values for these variables are always stripped first, so a nested OMK session never exposes stale parent-session metadata.
|
|
30
|
+
|
|
31
|
+
When asked which model or provider is running, inspect these variables instead of inferring the answer from the system prompt:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
printf '%s/%s\n' "$PI_PROVIDER" "$PI_MODEL"
|
|
35
|
+
printf 'reasoning=%s session=%s\n' "$PI_REASONING_LEVEL" "$PI_SESSION_ID"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The session file can be inspected directly when the session is persistent:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
if [ -n "$PI_SESSION_FILE" ]; then
|
|
42
|
+
tail -n 1 "$PI_SESSION_FILE"
|
|
43
|
+
fi
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
These variables are injected into the LLM-callable bash tool. They are not injected into user-entered `!` or `!!` commands.
|
|
47
|
+
|
|
48
|
+
### Custom Bash Tools
|
|
49
|
+
|
|
50
|
+
Bash tools created with `createBashTool()` expose the session environment by default. Injection happens before `spawnHook`, so a hook receives the variables in `ctx.env`:
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
const bashTool = createBashTool(cwd, {
|
|
54
|
+
spawnHook: (ctx) => ({
|
|
55
|
+
...ctx,
|
|
56
|
+
env: { ...ctx.env, CI: "1" },
|
|
57
|
+
}),
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Disable session metadata independently of the spawn hook:
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
const bashTool = createBashTool(cwd, {
|
|
65
|
+
exposeSessionEnvironment: false,
|
|
66
|
+
spawnHook: (ctx) => ctx,
|
|
67
|
+
});
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
When disabled, OMK removes inherited values for these variables so nested OMK processes do not expose stale parent-session metadata.
|
|
71
|
+
|
|
72
|
+
## OMK Process Configuration
|
|
73
|
+
|
|
74
|
+
These variables are read by OMK itself:
|
|
75
|
+
|
|
76
|
+
| Variable | Description |
|
|
77
|
+
| --- | --- |
|
|
78
|
+
| `OMK_CODING_AGENT_DIR` | Override the config directory; default is `~/.omk/agent` |
|
|
79
|
+
| `OMK_CODING_AGENT_SESSION_DIR` | Override session storage; overridden by `--session-dir` |
|
|
80
|
+
| `OMK_PACKAGE_DIR` | Override the package directory, useful for Nix/Guix store paths |
|
|
81
|
+
| `OMK_OFFLINE` | Disable startup network operations, including update checks and install/update telemetry |
|
|
82
|
+
| `OMK_SKIP_VERSION_CHECK` | Disable the latest-version request |
|
|
83
|
+
| `OMK_TELEMETRY` | Override install/update telemetry and provider attribution headers: `1`/`true`/`yes` or `0`/`false`/`no` |
|
|
84
|
+
| `OMK_SHARE_VIEWER_URL` | Override the base URL used by `/share` |
|
|
85
|
+
| `OMK_HARDWARE_CURSOR` | Set to `1` to show the hardware cursor; see [Terminal setup](terminal-setup.md) |
|
|
86
|
+
| `OMK_CONTEXT_GOVERNOR` | Configure the context-budget governor; see `context-budget-*` sources |
|
|
87
|
+
| `VISUAL`, `EDITOR` | External editor fallback when `externalEditor` is unset |
|
|
88
|
+
| `HTTP_PROXY`, `HTTPS_PROXY` | Proxy outbound HTTP requests |
|
|
89
|
+
|
|
90
|
+
Provider credentials such as `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, and cloud-provider configuration are listed in [Providers](providers.md).
|
package/docs/extensions.md
CHANGED
|
@@ -1868,13 +1868,13 @@ See [examples/extensions/tool-override.ts](../examples/extensions/tool-override.
|
|
|
1868
1868
|
**Your implementation must match the exact result shape**, including the `details` type. The UI and session logic depend on these shapes for rendering and state tracking.
|
|
1869
1869
|
|
|
1870
1870
|
Built-in tool implementations:
|
|
1871
|
-
- [read.ts](https://github.com/
|
|
1872
|
-
- [bash.ts](https://github.com/
|
|
1873
|
-
- [edit.ts](https://github.com/
|
|
1874
|
-
- [write.ts](https://github.com/
|
|
1875
|
-
- [grep.ts](https://github.com/
|
|
1876
|
-
- [find.ts](https://github.com/
|
|
1877
|
-
- [ls.ts](https://github.com/
|
|
1871
|
+
- [read.ts](https://github.com/dmae97/omk/blob/main/packages/coding-agent/src/core/tools/read.ts) - `ReadToolDetails`
|
|
1872
|
+
- [bash.ts](https://github.com/dmae97/omk/blob/main/packages/coding-agent/src/core/tools/bash.ts) - `BashToolDetails`
|
|
1873
|
+
- [edit.ts](https://github.com/dmae97/omk/blob/main/packages/coding-agent/src/core/tools/edit.ts)
|
|
1874
|
+
- [write.ts](https://github.com/dmae97/omk/blob/main/packages/coding-agent/src/core/tools/write.ts)
|
|
1875
|
+
- [grep.ts](https://github.com/dmae97/omk/blob/main/packages/coding-agent/src/core/tools/grep.ts) - `GrepToolDetails`
|
|
1876
|
+
- [find.ts](https://github.com/dmae97/omk/blob/main/packages/coding-agent/src/core/tools/find.ts) - `FindToolDetails`
|
|
1877
|
+
- [ls.ts](https://github.com/dmae97/omk/blob/main/packages/coding-agent/src/core/tools/ls.ts) - `LsToolDetails`
|
|
1878
1878
|
|
|
1879
1879
|
### Remote Execution
|
|
1880
1880
|
|
|
@@ -1997,7 +1997,7 @@ export default function (omk: ExtensionAPI) {
|
|
|
1997
1997
|
|
|
1998
1998
|
### Custom Rendering
|
|
1999
1999
|
|
|
2000
|
-
Tools can provide `renderCall` and `renderResult` for custom TUI display. See [tui.md](tui.md) for the full component API and [tool-execution.ts](https://github.com/
|
|
2000
|
+
Tools can provide `renderCall` and `renderResult` for custom TUI display. See [tui.md](tui.md) for the full component API and [tool-execution.ts](https://github.com/dmae97/omk/blob/main/packages/coding-agent/src/modes/interactive/components/tool-execution.ts) for how tool rows are composed.
|
|
2001
2001
|
|
|
2002
2002
|
By default, tool output is wrapped in a `Box` that handles padding and background. A defined `renderCall` or `renderResult` must return a `Component`. If a slot renderer is not defined, `tool-execution.ts` uses fallback rendering for that slot.
|
|
2003
2003
|
|
package/docs/index.md
CHANGED
|
@@ -37,6 +37,7 @@ For the full first-run flow, see [Quickstart](quickstart.md).
|
|
|
37
37
|
- [Providers](providers.md) - subscription and API-key setup for built-in providers.
|
|
38
38
|
- [Containerization](containerization.md) - sandbox omk with OpenShell, Gondolin, or Docker.
|
|
39
39
|
- [Settings](settings.md) - global and project settings.
|
|
40
|
+
- [Environment Variables](environment-variables.md) - process configuration and bash-tool session environment.
|
|
40
41
|
- [Keybindings](keybindings.md) - default shortcuts and custom keybindings.
|
|
41
42
|
- [Sessions](sessions.md) - session management, branching, and tree navigation.
|
|
42
43
|
- [Compaction](compaction.md) - context compaction and branch summarization.
|