open-multi-agent-kit 0.90.7 → 0.90.9
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 +52 -0
- package/README.md +17 -10
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +5 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/commands/doctor-provider-cli.d.ts +33 -0
- package/dist/commands/doctor-provider-cli.d.ts.map +1 -0
- package/dist/commands/doctor-provider-cli.js +215 -0
- package/dist/commands/doctor-provider-cli.js.map +1 -0
- package/dist/commands/doctor-provider-transport.d.ts +35 -0
- package/dist/commands/doctor-provider-transport.d.ts.map +1 -0
- package/dist/commands/doctor-provider-transport.js +185 -0
- package/dist/commands/doctor-provider-transport.js.map +1 -0
- package/dist/commands/doctor-provider.d.ts +121 -7
- package/dist/commands/doctor-provider.d.ts.map +1 -1
- package/dist/commands/doctor-provider.js +1295 -102
- package/dist/commands/doctor-provider.js.map +1 -1
- package/dist/commands/session-doctor-cli.d.ts +43 -0
- package/dist/commands/session-doctor-cli.d.ts.map +1 -0
- package/dist/commands/session-doctor-cli.js +494 -0
- package/dist/commands/session-doctor-cli.js.map +1 -0
- package/dist/commands/verify-ci.d.ts +21 -0
- package/dist/commands/verify-ci.d.ts.map +1 -0
- package/dist/commands/verify-ci.js +66 -0
- package/dist/commands/verify-ci.js.map +1 -0
- package/dist/core/agent-session-services.d.ts +3 -0
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +3 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +116 -2
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +1015 -71
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/agent-tool-settings.d.ts +35 -0
- package/dist/core/agent-tool-settings.d.ts.map +1 -0
- package/dist/core/agent-tool-settings.js +155 -0
- package/dist/core/agent-tool-settings.js.map +1 -0
- package/dist/core/atomic-session-file.d.ts +14 -0
- package/dist/core/atomic-session-file.d.ts.map +1 -0
- package/dist/core/atomic-session-file.js +104 -0
- package/dist/core/atomic-session-file.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts +6 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +12 -1
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/hysteresis.d.ts +27 -0
- package/dist/core/compaction/hysteresis.d.ts.map +1 -0
- package/dist/core/compaction/hysteresis.js +84 -0
- package/dist/core/compaction/hysteresis.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/transaction.d.ts +172 -0
- package/dist/core/compaction/transaction.d.ts.map +1 -0
- package/dist/core/compaction/transaction.js +824 -0
- package/dist/core/compaction/transaction.js.map +1 -0
- package/dist/core/context-budget-governor-v2.d.ts +2 -1
- package/dist/core/context-budget-governor-v2.d.ts.map +1 -1
- package/dist/core/context-budget-governor-v2.js +2 -1
- package/dist/core/context-budget-governor-v2.js.map +1 -1
- package/dist/core/context-budget-headroom.d.ts.map +1 -1
- package/dist/core/context-budget-headroom.js +5 -1
- package/dist/core/context-budget-headroom.js.map +1 -1
- package/dist/core/context-budget-reserved-tokens.d.ts +110 -0
- package/dist/core/context-budget-reserved-tokens.d.ts.map +1 -0
- package/dist/core/context-budget-reserved-tokens.js +188 -0
- package/dist/core/context-budget-reserved-tokens.js.map +1 -0
- package/dist/core/context-budget-v2-cache-invalidation.d.ts +133 -0
- package/dist/core/context-budget-v2-cache-invalidation.d.ts.map +1 -0
- package/dist/core/context-budget-v2-cache-invalidation.js +452 -0
- package/dist/core/context-budget-v2-cache-invalidation.js.map +1 -0
- package/dist/core/context-budget-v2-cache-keys.d.ts +3 -0
- package/dist/core/context-budget-v2-cache-keys.d.ts.map +1 -1
- package/dist/core/context-budget-v2-cache-keys.js +6 -0
- package/dist/core/context-budget-v2-cache-keys.js.map +1 -1
- package/dist/core/context-budget-v2-cache-provider.d.ts +8 -2
- package/dist/core/context-budget-v2-cache-provider.d.ts.map +1 -1
- package/dist/core/context-budget-v2-cache-provider.js +28 -5
- package/dist/core/context-budget-v2-cache-provider.js.map +1 -1
- package/dist/core/context-budget-v2-plan-cache-keys.d.ts.map +1 -1
- package/dist/core/context-budget-v2-plan-cache-keys.js +1 -0
- package/dist/core/context-budget-v2-plan-cache-keys.js.map +1 -1
- package/dist/core/context-budget-v2-planner.d.ts.map +1 -1
- package/dist/core/context-budget-v2-planner.js +1 -0
- package/dist/core/context-budget-v2-planner.js.map +1 -1
- package/dist/core/context-budget-v2-selection.d.ts.map +1 -1
- package/dist/core/context-budget-v2-selection.js +9 -0
- package/dist/core/context-budget-v2-selection.js.map +1 -1
- package/dist/core/context-budget-v2-types.d.ts +4 -0
- 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/durable-file-directory.d.ts +4 -0
- package/dist/core/durable-file-directory.d.ts.map +1 -0
- package/dist/core/durable-file-directory.js +76 -0
- package/dist/core/durable-file-directory.js.map +1 -0
- package/dist/core/durable-file-identity.d.ts +26 -0
- package/dist/core/durable-file-identity.d.ts.map +1 -0
- package/dist/core/durable-file-identity.js +118 -0
- package/dist/core/durable-file-identity.js.map +1 -0
- package/dist/core/durable-file-io.d.ts +29 -0
- package/dist/core/durable-file-io.d.ts.map +1 -0
- package/dist/core/durable-file-io.js +179 -0
- package/dist/core/durable-file-io.js.map +1 -0
- package/dist/core/durable-file-lock-cleanup.d.ts +12 -0
- package/dist/core/durable-file-lock-cleanup.d.ts.map +1 -0
- package/dist/core/durable-file-lock-cleanup.js +39 -0
- package/dist/core/durable-file-lock-cleanup.js.map +1 -0
- package/dist/core/durable-file-lock-owner.d.ts +18 -0
- package/dist/core/durable-file-lock-owner.d.ts.map +1 -0
- package/dist/core/durable-file-lock-owner.js +78 -0
- package/dist/core/durable-file-lock-owner.js.map +1 -0
- package/dist/core/durable-file-lock-storage.d.ts +35 -0
- package/dist/core/durable-file-lock-storage.d.ts.map +1 -0
- package/dist/core/durable-file-lock-storage.js +263 -0
- package/dist/core/durable-file-lock-storage.js.map +1 -0
- package/dist/core/durable-file-mode.d.ts +8 -0
- package/dist/core/durable-file-mode.d.ts.map +1 -0
- package/dist/core/durable-file-mode.js +41 -0
- package/dist/core/durable-file-mode.js.map +1 -0
- package/dist/core/extensions/loader.d.ts +12 -0
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +50 -37
- package/dist/core/extensions/loader.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/index.d.ts +6 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +5 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/loop-gates.d.ts.map +1 -1
- package/dist/core/loop-gates.js +25 -1
- package/dist/core/loop-gates.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +1 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/pi-package-intake.d.ts +1 -0
- package/dist/core/pi-package-intake.d.ts.map +1 -1
- package/dist/core/pi-package-intake.js +7 -0
- package/dist/core/pi-package-intake.js.map +1 -1
- package/dist/core/redaction.d.ts +8 -0
- package/dist/core/redaction.d.ts.map +1 -0
- package/dist/core/redaction.js +31 -0
- package/dist/core/redaction.js.map +1 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +36 -0
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/run-journal-store.d.ts +53 -0
- package/dist/core/run-journal-store.d.ts.map +1 -0
- package/dist/core/run-journal-store.js +278 -0
- package/dist/core/run-journal-store.js.map +1 -0
- package/dist/core/run-journal.d.ts +172 -0
- package/dist/core/run-journal.d.ts.map +1 -0
- package/dist/core/run-journal.js +1053 -0
- package/dist/core/run-journal.js.map +1 -0
- package/dist/core/sdk.d.ts +7 -0
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +94 -3
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-doctor-plan.d.ts +128 -0
- package/dist/core/session-doctor-plan.d.ts.map +1 -0
- package/dist/core/session-doctor-plan.js +833 -0
- package/dist/core/session-doctor-plan.js.map +1 -0
- package/dist/core/session-file-compaction.d.ts +6 -0
- package/dist/core/session-file-compaction.d.ts.map +1 -0
- package/dist/core/session-file-compaction.js +169 -0
- package/dist/core/session-file-compaction.js.map +1 -0
- package/dist/core/session-file-head.d.ts +10 -0
- package/dist/core/session-file-head.d.ts.map +1 -0
- package/dist/core/session-file-head.js +78 -0
- package/dist/core/session-file-head.js.map +1 -0
- package/dist/core/session-file-persistence.d.ts +30 -0
- package/dist/core/session-file-persistence.d.ts.map +1 -0
- package/dist/core/session-file-persistence.js +106 -0
- package/dist/core/session-file-persistence.js.map +1 -0
- package/dist/core/session-integrity.d.ts +43 -0
- package/dist/core/session-integrity.d.ts.map +1 -0
- package/dist/core/session-integrity.js +420 -0
- package/dist/core/session-integrity.js.map +1 -0
- package/dist/core/session-manager.d.ts +24 -4
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +242 -125
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-owner-lease.d.ts +22 -0
- package/dist/core/session-owner-lease.d.ts.map +1 -0
- package/dist/core/session-owner-lease.js +176 -0
- package/dist/core/session-owner-lease.js.map +1 -0
- package/dist/core/session-path-policy.d.ts +132 -0
- package/dist/core/session-path-policy.d.ts.map +1 -0
- package/dist/core/session-path-policy.js +780 -0
- package/dist/core/session-path-policy.js.map +1 -0
- package/dist/core/session-repair-plan.d.ts +49 -0
- package/dist/core/session-repair-plan.d.ts.map +1 -0
- package/dist/core/session-repair-plan.js +202 -0
- package/dist/core/session-repair-plan.js.map +1 -0
- package/dist/core/session-termination.d.ts +100 -0
- package/dist/core/session-termination.d.ts.map +1 -0
- package/dist/core/session-termination.js +403 -0
- package/dist/core/session-termination.js.map +1 -0
- package/dist/core/settings-manager.d.ts +32 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +52 -5
- 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 +1 -1
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/verified-bash-adapter.d.ts +36 -0
- package/dist/core/verified-bash-adapter.d.ts.map +1 -0
- package/dist/core/verified-bash-adapter.js +90 -0
- package/dist/core/verified-bash-adapter.js.map +1 -0
- package/dist/guardrails/command-redaction.d.ts +32 -0
- package/dist/guardrails/command-redaction.d.ts.map +1 -0
- package/dist/guardrails/command-redaction.js +776 -0
- package/dist/guardrails/command-redaction.js.map +1 -0
- package/dist/guardrails/evidence-attestation.d.ts +31 -0
- package/dist/guardrails/evidence-attestation.d.ts.map +1 -0
- package/dist/guardrails/evidence-attestation.js +178 -0
- package/dist/guardrails/evidence-attestation.js.map +1 -0
- package/dist/guardrails/evidence-receipt-store.d.ts +33 -0
- package/dist/guardrails/evidence-receipt-store.d.ts.map +1 -0
- package/dist/guardrails/evidence-receipt-store.js +446 -0
- package/dist/guardrails/evidence-receipt-store.js.map +1 -0
- package/dist/guardrails/evidence-receipt.d.ts +58 -0
- package/dist/guardrails/evidence-receipt.d.ts.map +1 -0
- package/dist/guardrails/evidence-receipt.js +389 -0
- package/dist/guardrails/evidence-receipt.js.map +1 -0
- package/dist/guardrails/evidence-system.d.ts +40 -9
- package/dist/guardrails/evidence-system.d.ts.map +1 -1
- package/dist/guardrails/evidence-system.js +379 -83
- package/dist/guardrails/evidence-system.js.map +1 -1
- package/dist/guardrails/replay-ledger-io.d.ts +6 -0
- package/dist/guardrails/replay-ledger-io.d.ts.map +1 -0
- package/dist/guardrails/replay-ledger-io.js +42 -0
- package/dist/guardrails/replay-ledger-io.js.map +1 -0
- package/dist/guardrails/replay-ledger-lock-owner.d.ts +32 -0
- package/dist/guardrails/replay-ledger-lock-owner.d.ts.map +1 -0
- package/dist/guardrails/replay-ledger-lock-owner.js +138 -0
- package/dist/guardrails/replay-ledger-lock-owner.js.map +1 -0
- package/dist/guardrails/replay-ledger-lock.d.ts +24 -0
- package/dist/guardrails/replay-ledger-lock.d.ts.map +1 -0
- package/dist/guardrails/replay-ledger-lock.js +135 -0
- package/dist/guardrails/replay-ledger-lock.js.map +1 -0
- package/dist/guardrails/replay-ledger-mutation-gate.d.ts +24 -0
- package/dist/guardrails/replay-ledger-mutation-gate.d.ts.map +1 -0
- package/dist/guardrails/replay-ledger-mutation-gate.js +205 -0
- package/dist/guardrails/replay-ledger-mutation-gate.js.map +1 -0
- package/dist/guardrails/replay-ledger-quarantine.d.ts +2 -0
- package/dist/guardrails/replay-ledger-quarantine.d.ts.map +1 -0
- package/dist/guardrails/replay-ledger-quarantine.js +19 -0
- package/dist/guardrails/replay-ledger-quarantine.js.map +1 -0
- package/dist/guardrails/replay-ledger-store.d.ts +32 -0
- package/dist/guardrails/replay-ledger-store.d.ts.map +1 -0
- package/dist/guardrails/replay-ledger-store.js +211 -0
- package/dist/guardrails/replay-ledger-store.js.map +1 -0
- package/dist/guardrails/shell-command-name-glob.d.ts +3 -0
- package/dist/guardrails/shell-command-name-glob.d.ts.map +1 -0
- package/dist/guardrails/shell-command-name-glob.js +233 -0
- package/dist/guardrails/shell-command-name-glob.js.map +1 -0
- package/dist/guardrails/shell-command-option.d.ts +7 -0
- package/dist/guardrails/shell-command-option.d.ts.map +1 -0
- package/dist/guardrails/shell-command-option.js +24 -0
- package/dist/guardrails/shell-command-option.js.map +1 -0
- package/dist/guardrails/shell-command-tokenizer.d.ts +29 -0
- package/dist/guardrails/shell-command-tokenizer.d.ts.map +1 -0
- package/dist/guardrails/shell-command-tokenizer.js +145 -0
- package/dist/guardrails/shell-command-tokenizer.js.map +1 -0
- package/dist/guardrails/shell-command-wrapper.d.ts +18 -0
- package/dist/guardrails/shell-command-wrapper.d.ts.map +1 -0
- package/dist/guardrails/shell-command-wrapper.js +42 -0
- package/dist/guardrails/shell-command-wrapper.js.map +1 -0
- package/dist/guardrails/verified-executor.d.ts +65 -0
- package/dist/guardrails/verified-executor.d.ts.map +1 -0
- package/dist/guardrails/verified-executor.js +171 -0
- package/dist/guardrails/verified-executor.js.map +1 -0
- package/dist/guardrails/workspace-fingerprint.d.ts +23 -0
- package/dist/guardrails/workspace-fingerprint.d.ts.map +1 -0
- package/dist/guardrails/workspace-fingerprint.js +634 -0
- package/dist/guardrails/workspace-fingerprint.js.map +1 -0
- package/dist/index.d.ts +15 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +12 -0
- package/dist/main.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 +1 -1
- package/dist/modes/interactive/components/control-panel-layout.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +1 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +3 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +59 -9
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +43 -2
- 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 +23 -5
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +3 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/types/evidence.d.ts +215 -1
- package/dist/types/evidence.d.ts.map +1 -1
- package/dist/types/evidence.js.map +1 -1
- package/dist/verify-ci.d.ts +3 -0
- package/dist/verify-ci.d.ts.map +1 -0
- package/dist/verify-ci.js +30 -0
- package/dist/verify-ci.js.map +1 -0
- package/docs/compaction.md +44 -4
- package/docs/extensions.md +2 -0
- package/docs/providers.md +6 -0
- package/docs/sdk.md +238 -1
- package/docs/settings.md +67 -4
- package/docs/usage.md +38 -0
- package/examples/extensions/correctness-wall/README.md +6 -6
- package/examples/extensions/correctness-wall/index.ts +37 -11
- package/examples/extensions/custom-provider-anthropic/package-lock.json +5 -5
- 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/with-deps/package-lock.json +4 -4
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +12 -12
- package/package.json +4 -4
package/docs/sdk.md
CHANGED
|
@@ -87,6 +87,19 @@ interface AgentSession {
|
|
|
87
87
|
sessionFile: string | undefined;
|
|
88
88
|
sessionId: string;
|
|
89
89
|
|
|
90
|
+
// Lifecycle and termination
|
|
91
|
+
lastTermination: SessionTermination | undefined;
|
|
92
|
+
recordProcessSignal(signal: "SIGINT" | "SIGTERM" | "SIGHUP" | "SIGQUIT"): SessionTermination;
|
|
93
|
+
|
|
94
|
+
// Audit / repair
|
|
95
|
+
transcriptRepair: { insertedToolCallIds: string[]; reason: string } | undefined;
|
|
96
|
+
runJournalRecords: readonly unknown[];
|
|
97
|
+
runJournalQuarantineReport: RunJournalQuarantineReport | null;
|
|
98
|
+
|
|
99
|
+
// Workspace mutation signals (used by evidence freshness gating)
|
|
100
|
+
sessionRiskLevel: "normal" | "elevated";
|
|
101
|
+
workspaceMutationCount: number;
|
|
102
|
+
|
|
90
103
|
// Model control
|
|
91
104
|
setModel(model: Model): Promise<void>;
|
|
92
105
|
setThinkingLevel(level: ThinkingLevel): void;
|
|
@@ -181,6 +194,24 @@ session = runtime.session;
|
|
|
181
194
|
unsubscribe = session.subscribe(() => {});
|
|
182
195
|
```
|
|
183
196
|
|
|
197
|
+
### Run Termination and Replay Binding
|
|
198
|
+
|
|
199
|
+
Every real AgentSession run emits a `session_termination` event and exposes the latest value as `session.lastTermination`. The typed record includes `kind`, `provider`, `model`, retry flags, `causeCode`, `nextAction`, and `runId`; persisted sessions also fsync lifecycle records to `<session>.runjournal`.
|
|
200
|
+
|
|
201
|
+
To share evidence freshness ordering with runtime repairs and late tool settlements, pass the same optional replay ledger to the session and `VerifiedEvidenceExecutor`:
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
const ledger = new ReplayLedgerManager(goalId, ledgerPath);
|
|
205
|
+
const { session } = await createAgentSession({
|
|
206
|
+
replayLedger: ledger,
|
|
207
|
+
replayGoalId: goalId,
|
|
208
|
+
replayLaneId: laneId,
|
|
209
|
+
});
|
|
210
|
+
const executor = new VerifiedEvidenceExecutor({ store, ledger });
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
`transcript_repaired`, `tool_timeout`, `tool_late_settlement`, and `workspace_mutation` use that ledger. A receipt at or before a later relevant workspace mutation is blocked by `EvidenceGate`.
|
|
214
|
+
|
|
184
215
|
### Prompting and Message Queueing
|
|
185
216
|
|
|
186
217
|
`PromptOptions` controls prompt expansion, queueing behavior while streaming, and prompt preflight notifications:
|
|
@@ -315,7 +346,7 @@ session.subscribe((event) => {
|
|
|
315
346
|
// event.toolResults: tool results from this turn
|
|
316
347
|
break;
|
|
317
348
|
|
|
318
|
-
// Session events (queue, compaction, retry)
|
|
349
|
+
// Session events (queue, compaction, retry, termination, workspace mutation)
|
|
319
350
|
case "queue_update":
|
|
320
351
|
console.log(event.steering, event.followUp);
|
|
321
352
|
break;
|
|
@@ -324,6 +355,12 @@ session.subscribe((event) => {
|
|
|
324
355
|
case "auto_retry_start":
|
|
325
356
|
case "auto_retry_end":
|
|
326
357
|
break;
|
|
358
|
+
case "session_termination":
|
|
359
|
+
// event.termination: latest session termination record
|
|
360
|
+
break;
|
|
361
|
+
case "workspace_mutation":
|
|
362
|
+
// Emitted when a late-settling potentially-writing tool may have mutated the workspace
|
|
363
|
+
break;
|
|
327
364
|
}
|
|
328
365
|
});
|
|
329
366
|
```
|
|
@@ -1091,6 +1128,122 @@ RPC mode is preferred when:
|
|
|
1091
1128
|
- You want process isolation
|
|
1092
1129
|
- You're building a language-agnostic client
|
|
1093
1130
|
|
|
1131
|
+
## Evidence and Verification
|
|
1132
|
+
|
|
1133
|
+
Execution-bound evidence is an optional, application-driven layer. It records a declared verification command and reported outcome between two artifact-set snapshots, then binds that record to a tamper-evident ledger. `VerifiedEvidenceExecutor` never executes the declared command. The opt-in `executeVerifiedBash()` adapter invokes caller-supplied `BashOperations`; `executeVerifiedLocalBash()` instead derives the shell identity and runner from OMK's built-in local backend. The default CLI and AgentSession bash paths remain unverified. The repository CI workflow is the sole built-in callsite: it runs the release-consistency verifier through the local adapter.
|
|
1134
|
+
|
|
1135
|
+
### Recorded and invoked inputs
|
|
1136
|
+
|
|
1137
|
+
| Input | SDK behavior |
|
|
1138
|
+
|-------|--------------|
|
|
1139
|
+
| `request.command` (`EvidenceCommandDescriptor`) | Validates, hashes, and records the structured descriptor; never executes it |
|
|
1140
|
+
| `request.executor` (`"bash-tool" \| "ci-runner" \| "mcp" \| "internal"`) | Records a label only |
|
|
1141
|
+
| `request.workspaceScope` (`WorkspaceScope`) | Captures the selected artifact set before and after the callback |
|
|
1142
|
+
| `request.execute` | Invokes your callback; your application owns its implementation and truthfulness |
|
|
1143
|
+
| `executeVerifiedBash()` | Passes the exact shell script to injected `BashOperations`; the caller supplies the matching shell identity and trusts the runner |
|
|
1144
|
+
| `executeVerifiedLocalBash()` | Resolves OMK's local shell identity, creates the matching local `BashOperations`, and delegates to `executeVerifiedBash()` |
|
|
1145
|
+
|
|
1146
|
+
### Runner honesty is a trust boundary
|
|
1147
|
+
|
|
1148
|
+
The SDK cannot prove that a callback or injected runner executed what it reported. A direct `VerifiedEvidenceExecutor` callback must execute the exact descriptor, normalize the disposition, and return already-redacted `Uint8Array` output.
|
|
1149
|
+
|
|
1150
|
+
`executeVerifiedBash()` handles the mechanical shell adapter contract:
|
|
1151
|
+
|
|
1152
|
+
- records a `kind: "shell"` descriptor using the same script passed to `BashOperations.exec()`,
|
|
1153
|
+
- maps exit, timeout, and abort states to receipt dispositions,
|
|
1154
|
+
- retains a rolling 128 KiB combined-output tail, applies OMK's high-confidence text redaction, then keeps the final 64 KiB, and
|
|
1155
|
+
- records the combined `BashOperations` stream as receipt `stdout`; receipt `stderr` is empty because that interface does not expose separate channels.
|
|
1156
|
+
|
|
1157
|
+
The policy is best-effort masking, not DLP. A credential spanning the rolling-window cut may lose matching context, although receipts persist only the resulting digest and byte count. The runner, declared shell identity, environment, remote execution behavior, and any runner-owned spill files remain caller trust boundaries. The script is stored in the receipt after credential-shaped preflight, so keep secrets out of command strings.
|
|
1158
|
+
|
|
1159
|
+
Injected runners must follow the built-in terminal protocol: return an integer exit code, throw `Error("aborted")` for abort, or throw an error whose message starts with `timeout:`. Other failures propagate without a receipt; `null` or non-integer exit codes fail closed with `VerifiedBashAdapterError`.
|
|
1160
|
+
|
|
1161
|
+
`executeVerifiedLocalBash()` removes the caller-declared shell mismatch by resolving the descriptor shell and local backend from the same shell setting. It does not bind the inherited environment, prove runner honesty, or provide OS isolation.
|
|
1162
|
+
|
|
1163
|
+
### First-party CI callsite
|
|
1164
|
+
|
|
1165
|
+
`.github/workflows/ci.yml` invokes the compiled `dist/verify-ci.js` entry after the normal repository check. That entry runs only `node scripts/check-release-consistency.mjs` through `executeVerifiedLocalBash()` with `executor: "ci-runner"`, applies a strict `EvidenceGate`, writes receipts, ledger, and report under `.omk/ci-evidence`, and returns a non-zero process exit when the gate is blocked. CI uploads that directory as `verified-release-consistency`.
|
|
1166
|
+
|
|
1167
|
+
This callsite does not wrap the full build, check, or test suite and does not enable receipts for interactive, RPC, or SDK-created AgentSession bash calls. Its workspace freshness scope is limited to the root and coding-agent package manifests.
|
|
1168
|
+
|
|
1169
|
+
### Execution ordering
|
|
1170
|
+
|
|
1171
|
+
`VerifiedEvidenceExecutor.execute(request)` runs, in order:
|
|
1172
|
+
|
|
1173
|
+
1. before artifact-set snapshot (`workspaceBefore`)
|
|
1174
|
+
2. your callback (`await request.execute()`)
|
|
1175
|
+
3. after artifact-set snapshot (`workspaceAfter`)
|
|
1176
|
+
4. replay-ledger `append` + `persist()`
|
|
1177
|
+
5. envelope binding to the ledger event (`seq`, `eventHash`)
|
|
1178
|
+
6. no-overwrite store publish (hard-link; cannot replace an existing receipt)
|
|
1179
|
+
|
|
1180
|
+
Ledger and receipt publication are fail-closed but not one filesystem transaction. A failure after `ledger.persist()` and before publication can leave a dangling ledger event; a failure after hard-link publication can leave a readable receipt even though `execute()` rejects. Reconcile the ledger and store before retrying an explicit receipt ID.
|
|
1181
|
+
|
|
1182
|
+
### Freshness, ledger load, and store hardening
|
|
1183
|
+
|
|
1184
|
+
- **Freshness** compares only the caller-selected artifact set (`WorkspaceScope.artifactPaths`). It issues no Git command and carries no Git fingerprint.
|
|
1185
|
+
- **Ledger**: `ReplayLedgerManager` verifies an existing ledger on construction (sequence order, prev-hash chain, payload hash, event hash) and **fails closed** on any violation.
|
|
1186
|
+
- **Store**: `EvidenceReceiptStore` uses an owner-only directory, symlink rejection, no-overwrite hard-link publication, and identity rechecks to detect observed path replacement. These checks assume same-UID path mutation is quiescent; they are **not** filesystem sandbox isolation.
|
|
1187
|
+
|
|
1188
|
+
### Receipt policy
|
|
1189
|
+
|
|
1190
|
+
`EvidenceGate` (default `receiptMode: "prefer"`) gates a `TaskContract` against its satisfied receipts. Pass `executor.createGateOptions()` so the gate resolves receipts, ledger events, and workspace fingerprints from the same store and ledger.
|
|
1191
|
+
|
|
1192
|
+
| Mode | Soft missing data | Tamper-grade mismatch | Legacy `hash` / `command` |
|
|
1193
|
+
|------|-------------------|-----------------------|----------------------------|
|
|
1194
|
+
| `strict` | blocked | blocked | n/a |
|
|
1195
|
+
| `prefer` (default) | conditional | blocked | n/a |
|
|
1196
|
+
| `legacy` | receipt checks skipped | receipt checks skipped | checked by legacy options (enabled by default) |
|
|
1197
|
+
|
|
1198
|
+
Soft missing data means no resolver was supplied or a resolver returned `undefined`. Resolver exceptions are hard failures in both `strict` and `prefer`. The resolver from `createGateOptions()` calls `EvidenceReceiptStore.read()`, so a claimed receipt ID that has no stored file throws and blocks the gate.
|
|
1199
|
+
|
|
1200
|
+
Tamper-grade mismatches include: receipt ID, goal, or claim mismatch; schema version ≠ 3; status not `passed` or `exitCode` ≠ 0; command-SHA mismatch; lane mismatch; artifact-changed-after-verification; and ledger-binding mismatch.
|
|
1201
|
+
|
|
1202
|
+
`createGateOptions()` returns three resolvers bound to the executor's own store and ledger: `resolveReceipt` (read a stored receipt), `resolveLedgerEvent` (find a chain event by `seq`), and `captureWorkspaceFingerprint` (snapshot the selected artifact set). The gate validates every returned value.
|
|
1203
|
+
|
|
1204
|
+
### Integration example
|
|
1205
|
+
|
|
1206
|
+
```typescript
|
|
1207
|
+
import {
|
|
1208
|
+
EvidenceGate, EvidenceReceiptStore, executeVerifiedLocalBash,
|
|
1209
|
+
ReplayLedgerManager, TaskContractBuilder, VerifiedEvidenceExecutor,
|
|
1210
|
+
type WorkspaceScope,
|
|
1211
|
+
} from "open-multi-agent-kit";
|
|
1212
|
+
|
|
1213
|
+
const goalId = "goal-123";
|
|
1214
|
+
const claim = "repository checks passed";
|
|
1215
|
+
const cwd = process.cwd();
|
|
1216
|
+
const workspaceScope: WorkspaceScope = { root: cwd, artifactPaths: ["packages/coding-agent/src/index.ts"] };
|
|
1217
|
+
|
|
1218
|
+
const store = new EvidenceReceiptStore("/secure/receipts");
|
|
1219
|
+
const ledger = new ReplayLedgerManager(goalId, "/secure/ledger.jsonl");
|
|
1220
|
+
const executor = new VerifiedEvidenceExecutor({ store, ledger });
|
|
1221
|
+
|
|
1222
|
+
const { evidenceMetadata } = await executeVerifiedLocalBash({
|
|
1223
|
+
evidenceExecutor: executor,
|
|
1224
|
+
goalId,
|
|
1225
|
+
claim,
|
|
1226
|
+
script: "npm run check",
|
|
1227
|
+
cwd,
|
|
1228
|
+
timeoutMs: 30_000,
|
|
1229
|
+
workspaceScope,
|
|
1230
|
+
});
|
|
1231
|
+
|
|
1232
|
+
const contract = new TaskContractBuilder(goalId)
|
|
1233
|
+
.setClaim(claim)
|
|
1234
|
+
.addRequiredEvidence({
|
|
1235
|
+
claim, category: "feature",
|
|
1236
|
+
receiptId: evidenceMetadata.receiptId, receiptSchemaVersion: 3,
|
|
1237
|
+
receiptCommandSha256: evidenceMetadata.receiptCommandSha256,
|
|
1238
|
+
})
|
|
1239
|
+
.updateEvidenceStatus(claim, "satisfied")
|
|
1240
|
+
.setVerdict("pass")
|
|
1241
|
+
.build();
|
|
1242
|
+
|
|
1243
|
+
const result = new EvidenceGate(executor.createGateOptions()).check(contract);
|
|
1244
|
+
// result.status: "open" | "conditional" | "blocked"
|
|
1245
|
+
```
|
|
1246
|
+
|
|
1094
1247
|
## Exports
|
|
1095
1248
|
|
|
1096
1249
|
The main entry point exports:
|
|
@@ -1098,7 +1251,9 @@ The main entry point exports:
|
|
|
1098
1251
|
```typescript
|
|
1099
1252
|
// Factory
|
|
1100
1253
|
createAgentSession
|
|
1254
|
+
createAgentSessionFromServices
|
|
1101
1255
|
createAgentSessionRuntime
|
|
1256
|
+
createAgentSessionServices
|
|
1102
1257
|
AgentSessionRuntime
|
|
1103
1258
|
|
|
1104
1259
|
// Auth and Models
|
|
@@ -1122,16 +1277,98 @@ createCodingTools
|
|
|
1122
1277
|
createReadOnlyTools
|
|
1123
1278
|
createReadTool, createBashTool, createEditTool, createWriteTool
|
|
1124
1279
|
createGrepTool, createFindTool, createLsTool
|
|
1280
|
+
createLocalBashOperations
|
|
1281
|
+
|
|
1282
|
+
// Compaction (programmatic primitives)
|
|
1283
|
+
calculateContextTokens, compact, createCompactionEnvelope,
|
|
1284
|
+
createCompactionHysteresisConfig, createCompactionHysteresisState,
|
|
1285
|
+
createCompactionSourceIdentity, createCompactionTransaction,
|
|
1286
|
+
createSessionRevisionToken, decideCompactionCommit, estimateTokens,
|
|
1287
|
+
evaluateCompactionBarrier, findCutPoint, findTurnStartIndex,
|
|
1288
|
+
generateBranchSummary, generateSummary, getLastAssistantUsage,
|
|
1289
|
+
prepareBranchEntries, serializeConversation, shouldCompact, stepCompactionHysteresis,
|
|
1290
|
+
validateCompactionEnvelope
|
|
1291
|
+
|
|
1292
|
+
// Context-budget v2 and reserved-token budget
|
|
1293
|
+
planPromptContextBudgetV2, applyContextCacheInvalidation,
|
|
1294
|
+
createMemoryContextBudgetCacheProviderV2, buildContextBudgetPlanCacheKeyV2,
|
|
1295
|
+
buildContextBudgetMaterializedRepresentationCacheKeyV2, createContextBudgetCacheKeyBaseV2,
|
|
1296
|
+
createContextCacheInvalidationSnapshot, serializeContextCacheSnapshot,
|
|
1297
|
+
CONTEXT_BUDGET_POLICY_VERSION_V2
|
|
1298
|
+
computeReservedTokenBudget, estimateToolResultReserve, ReservedTokenBudgetError
|
|
1299
|
+
|
|
1300
|
+
// Run journal and session termination
|
|
1301
|
+
RunJournalStore, appendRunJournalRecordDurably, writeQuarantineBytesDurably,
|
|
1302
|
+
classifySessionTermination, formatSessionTermination, SessionTerminationError
|
|
1303
|
+
|
|
1304
|
+
// Execution-bound evidence (optional, application-driven verification receipts)
|
|
1305
|
+
EvidenceReceiptStore
|
|
1306
|
+
ReplayLedgerManager
|
|
1307
|
+
EvidenceGate
|
|
1308
|
+
FailClosedMergeGate
|
|
1309
|
+
TaskContractBuilder
|
|
1310
|
+
VerifiedEvidenceExecutor
|
|
1311
|
+
VerifiedEvidenceExecutorError
|
|
1312
|
+
executeVerifiedBash
|
|
1313
|
+
executeVerifiedLocalBash
|
|
1314
|
+
VERIFIED_BASH_REDACTION_POLICY_ID
|
|
1315
|
+
VerifiedBashAdapterError
|
|
1316
|
+
redactCommandDescriptor
|
|
1317
|
+
createCommandHmacBinder
|
|
1318
|
+
EVIDENCE_COMMAND_REDACTION_POLICY_ID
|
|
1319
|
+
MAX_COMMAND_REDACTION_PLACEHOLDERS
|
|
1320
|
+
parseCommandHmacBinding
|
|
1321
|
+
parseCommandRedactionSummary
|
|
1322
|
+
CommandRedactionError
|
|
1125
1323
|
|
|
1126
1324
|
// Types
|
|
1127
1325
|
type CreateAgentSessionOptions
|
|
1128
1326
|
type CreateAgentSessionResult
|
|
1327
|
+
type CreateAgentSessionRuntimeFactory
|
|
1328
|
+
type CreateAgentSessionRuntimeResult
|
|
1329
|
+
type CreateAgentSessionServicesOptions
|
|
1129
1330
|
type ExtensionFactory
|
|
1130
1331
|
type ExtensionAPI
|
|
1131
1332
|
type ToolDefinition
|
|
1132
1333
|
type Skill
|
|
1133
1334
|
type PromptTemplate
|
|
1134
1335
|
type Tool
|
|
1336
|
+
type CompactionEnvelope
|
|
1337
|
+
type CompactionTransaction
|
|
1338
|
+
type CompactionHysteresisConfig
|
|
1339
|
+
type CompactionHysteresisState
|
|
1340
|
+
type CompactionBarrierResult
|
|
1341
|
+
type CompactionCommitDecision
|
|
1342
|
+
type ContextBudgetCacheProviderV2
|
|
1343
|
+
type ContextCacheInvalidationEvent
|
|
1344
|
+
type ContextCacheInvalidationSnapshot
|
|
1345
|
+
type ReservedTokenBudgetInput
|
|
1346
|
+
type ReservedTokenBudgetResult
|
|
1347
|
+
type RunJournalQuarantineReport
|
|
1348
|
+
type SessionTermination
|
|
1349
|
+
type SessionTerminationCause
|
|
1350
|
+
type SessionTerminationKind
|
|
1351
|
+
type ToolSchedulerSetting
|
|
1352
|
+
type AgentRuntimeSettings
|
|
1353
|
+
type VerifiedBashExecutionRequest
|
|
1354
|
+
type VerifiedLocalBashExecutionRequest
|
|
1355
|
+
type EvidenceGateOptions
|
|
1356
|
+
type VerifiedEvidenceExecutionRequest
|
|
1357
|
+
type VerifiedEvidenceExecutionResult
|
|
1358
|
+
type VerifiedEvidenceExecutionOutcome
|
|
1359
|
+
type EvidenceReceiptMode
|
|
1360
|
+
type TaskContract
|
|
1361
|
+
type EvidenceCommandDescriptor
|
|
1362
|
+
type WorkspaceScope
|
|
1363
|
+
type CommandRedactionPlaceholder
|
|
1364
|
+
type CommandRedactionSummary
|
|
1365
|
+
type EvidenceReceipt
|
|
1366
|
+
type EvidenceReceiptLedgerBinding
|
|
1367
|
+
type ReplayEvent
|
|
1368
|
+
type ReplayEventType
|
|
1369
|
+
type WorkspaceMutationReplayPayload
|
|
1370
|
+
type Sha256Hex
|
|
1371
|
+
type ArtifactSetWorkspaceFingerprint
|
|
1135
1372
|
```
|
|
1136
1373
|
|
|
1137
1374
|
For extension types, see [extensions.md](extensions.md) for the full API.
|
package/docs/settings.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Settings
|
|
2
2
|
|
|
3
|
-
OMK uses JSON settings files with project settings overriding global settings.
|
|
3
|
+
OMK uses JSON settings files with project settings overriding global settings, except settings explicitly marked global-only.
|
|
4
4
|
|
|
5
5
|
| Location | Scope |
|
|
6
6
|
|----------|-------|
|
|
@@ -73,19 +73,81 @@ Set `OMK_SKIP_VERSION_CHECK=1` to disable the OMK version update check. Use `--o
|
|
|
73
73
|
| Setting | Type | Default | Description |
|
|
74
74
|
|---------|------|---------|-------------|
|
|
75
75
|
| `compaction.enabled` | boolean | `true` | Enable auto-compaction |
|
|
76
|
-
| `compaction.
|
|
76
|
+
| `compaction.model` | string | session model | Authenticated canonical `provider/model` used only for compaction |
|
|
77
|
+
| `compaction.reserveTokens` | number | `16384` | Legacy/default output reserve (tokens reserved for the LLM response) |
|
|
78
|
+
| `compaction.reservedOutputTokens` | number | `reserveTokens` | Optional override for output-only reserve |
|
|
79
|
+
| `compaction.reservedToolResultTokens` | number | `0` | Reserve tokens for pending tool results |
|
|
80
|
+
| `compaction.safetyMarginTokens` | number | `0` | Extra safety margin added to the reserve |
|
|
81
|
+
| `compaction.imageReserveTokens` | number | `0` | Reserve tokens for image content |
|
|
77
82
|
| `compaction.keepRecentTokens` | number | `20000` | Recent tokens to keep (not summarized) |
|
|
83
|
+
| `compaction.maxUsageRatio` | number | `0.9` | Normal trigger ratio (fraction of context window) |
|
|
84
|
+
| `compaction.rearmRatio` | number | `0.75 × maxUsageRatio` | Ratio below which a triggered compaction can rearm |
|
|
85
|
+
| `compaction.emergencyRatio` | number | `0.98` | Emergency compaction ratio |
|
|
86
|
+
|
|
87
|
+
All numeric token reserves must be non-negative safe integers. Ratios must be finite and in `(0, 1]`. Invalid values fail session creation instead of silently weakening the policy.
|
|
78
88
|
|
|
79
89
|
```json
|
|
80
90
|
{
|
|
81
91
|
"compaction": {
|
|
82
92
|
"enabled": true,
|
|
93
|
+
"model": "zai/glm-5.2",
|
|
83
94
|
"reserveTokens": 16384,
|
|
84
|
-
"
|
|
95
|
+
"reservedToolResultTokens": 8192,
|
|
96
|
+
"safetyMarginTokens": 1024,
|
|
97
|
+
"keepRecentTokens": 20000,
|
|
98
|
+
"maxUsageRatio": 0.9,
|
|
99
|
+
"rearmRatio": 0.7,
|
|
100
|
+
"emergencyRatio": 0.98
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Context Budget
|
|
106
|
+
|
|
107
|
+
| Setting | Type | Default | Description |
|
|
108
|
+
|---------|------|---------|-------------|
|
|
109
|
+
| `contextBudget.enabled` | boolean | `false` | Globally enable prompt resource budgeting and its in-memory, session-scoped plan/representation cache |
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"contextBudget": { "enabled": true }
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
This setting is global-only: `.omk/settings.json` cannot enable or disable it. Use `OMK_CONTEXT_GOVERNOR=1` to force it on for one process or `OMK_CONTEXT_GOVERNOR=0` to force it off for a baseline run. The cache is never persisted or shared between sessions.
|
|
118
|
+
|
|
119
|
+
### Agent Tool Execution
|
|
120
|
+
|
|
121
|
+
| Setting | Type | Default | Description |
|
|
122
|
+
|---------|------|---------|-------------|
|
|
123
|
+
| `agent.toolScheduler` | string | `"dag-v2"` | Deterministic resource-claim scheduler. Use `"waves-v1"` for compatibility rollback |
|
|
124
|
+
| `agent.maxToolConcurrency` | number | `4` | Maximum calls in one DAG level; `0` removes the cap |
|
|
125
|
+
| `agent.toolTimeoutMs` | number | `0` | Fallback tool execution timeout in milliseconds; `0` disables the fallback timer |
|
|
126
|
+
| `agent.toolTimeouts` | object | built-in defaults | Per-tool-name timeout overrides; `0` disables that tool's timer |
|
|
127
|
+
|
|
128
|
+
Built-in defaults are 30 seconds for `read`, `grep`, `find`, and `ls`; 60 seconds for `edit` and `write`; and 300 seconds for `bash`. Explicit `agent.toolTimeouts` entries override these defaults. Extension/custom tools without a per-name value use `agent.toolTimeoutMs`. Timeout values must be integer milliseconds from `0` through `2147483647`.
|
|
129
|
+
|
|
130
|
+
```json
|
|
131
|
+
{
|
|
132
|
+
"agent": {
|
|
133
|
+
"toolScheduler": "dag-v2",
|
|
134
|
+
"maxToolConcurrency": 4,
|
|
135
|
+
"toolTimeoutMs": 0,
|
|
136
|
+
"toolTimeouts": {
|
|
137
|
+
"read": 30000,
|
|
138
|
+
"write": 60000,
|
|
139
|
+
"bash": 300000,
|
|
140
|
+
"my_mcp_tool": 120000,
|
|
141
|
+
"my_browser_tool": 180000
|
|
142
|
+
}
|
|
85
143
|
}
|
|
86
144
|
}
|
|
87
145
|
```
|
|
88
146
|
|
|
147
|
+
`OMK_TOOL_SCHEDULER` overrides the file setting for one process. Set it to `waves-v1` for rollback or `dag-v2` to force the resource DAG. Invalid scheduler and timeout values fail session creation instead of silently weakening the policy.
|
|
148
|
+
|
|
149
|
+
The DAG preserves source-order result artifacts. `bash`, unknown tools, and extension tools without explicit resource claims remain exclusive. Tool timeout is logical cancellation: OMK closes the tool call and signals cancellation, but arbitrary JavaScript or external side effects may continue if the tool ignores that signal.
|
|
150
|
+
|
|
89
151
|
### Branch Summary
|
|
90
152
|
|
|
91
153
|
| Setting | Type | Default | Description |
|
|
@@ -245,6 +307,7 @@ See [packages.md](packages.md) for package management details.
|
|
|
245
307
|
"reserveTokens": 16384,
|
|
246
308
|
"keepRecentTokens": 20000
|
|
247
309
|
},
|
|
310
|
+
"contextBudget": { "enabled": true },
|
|
248
311
|
"retry": {
|
|
249
312
|
"enabled": true,
|
|
250
313
|
"maxRetries": 3
|
|
@@ -259,7 +322,7 @@ See [packages.md](packages.md) for package management details.
|
|
|
259
322
|
|
|
260
323
|
## Project Overrides
|
|
261
324
|
|
|
262
|
-
Project settings (`.omk/settings.json`) override global settings. Nested objects are merged:
|
|
325
|
+
Project settings (`.omk/settings.json`) override global settings. Nested objects are merged. `contextBudget` is the exception: it is read from global settings only.
|
|
263
326
|
|
|
264
327
|
```json
|
|
265
328
|
// ~/.omk/agent/settings.json (global)
|
package/docs/usage.md
CHANGED
|
@@ -126,6 +126,21 @@ Useful session commands:
|
|
|
126
126
|
|
|
127
127
|
See [Sessions](sessions.md) and [Compaction](compaction.md) for details.
|
|
128
128
|
|
|
129
|
+
### Session Doctor and Recovery
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
omk session doctor # inspect all stored sessions
|
|
133
|
+
omk session doctor --session <path|id> # inspect one session
|
|
134
|
+
omk session doctor --session <path|id> --repair --dry-run
|
|
135
|
+
omk session doctor --session <path|id> --repair
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
The doctor verifies the session's complete JSONL prefix, run journal, compaction envelopes/transactions, replay-evidence links, workspace, and provider/model binding. `--dry-run` plans repairs without writing. Repair mode rechecks file hashes under a lock before writing and only allows unambiguous missing tool results, exact trailing-fragment quarantine, unclosed-run crash recovery, and stale compaction abandonment. Duplicate/orphan tool results, duplicate IDs, broken hashes/chains, and changed preconditions are refused.
|
|
139
|
+
|
|
140
|
+
Session and journal bytes after the final newline are copied byte-for-byte to a `.quarantine-*` file before the original is atomically rewritten to its valid complete prefix. Opening a session uses the same complete-prefix rule; `SessionManager.getQuarantineReport()` reports any startup quarantine.
|
|
141
|
+
|
|
142
|
+
Each real agent run writes fsynced `run_started` and `run_finished` records to `<session>.runjournal`. An unclosed valid run is recorded as an inferred `process_crash` on the next startup. JSON/RPC emit `session_termination`; text and TUI errors include kind, provider/model, retryability, cause, run ID, and next action.
|
|
143
|
+
|
|
129
144
|
## Context Files
|
|
130
145
|
|
|
131
146
|
OMK loads `AGENTS.md` or `CLAUDE.md` at startup from:
|
|
@@ -177,6 +192,28 @@ These commands manage omk packages, not the omk CLI installation. To uninstall o
|
|
|
177
192
|
|
|
178
193
|
See [OMK Packages](packages.md) for package sources and security notes.
|
|
179
194
|
|
|
195
|
+
### Session Doctor
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
omk session doctor [--session <path|id>] [--repair [--dry-run]]
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Exit codes: `0` healthy or successfully repaired, `1` issues found or dry-run repairs available, `2` refused/usage/CAS failure.
|
|
202
|
+
|
|
203
|
+
### Provider Doctor
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
omk provider doctor <provider-id> [--level <0|1>] [--model <model-id>] [--timeout <ms>] [--probe-model <model-id>]
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Diagnoses one provider and prints a single sanitized JSON document. Exit codes are stable: `0` ok, `1` diagnosis failed, `2` usage error. The legacy flag form `omk --doctor-provider <provider-id>` (with `--doctor-level`, `--doctor-model`, `--doctor-timeout`) remains an alias.
|
|
210
|
+
|
|
211
|
+
- **Level 0** (default) — static checks only, no network: config resolution, URL/scheme/address policy, model↔provider relation, credential presence.
|
|
212
|
+
- **Level 1** (`--level 1`) — adds non-generative, GET-only reachability probes (root + `/models`) with strict timeouts, no redirects, and DNS/address pinning. Results use the exact probe categories `ok | network | auth | unsupported-endpoint | server`: a root or `/models` 404 is neutral (`unsupported-endpoint`), 401/403 is an auth failure, and 5xx is a `server` failure.
|
|
213
|
+
- **Level 2** — reachable only via the explicit `--probe-model <model-id>` opt-in: sends one minimal-token generative request (`max_tokens: 1`) to the completions endpoint. **This may incur provider costs**; the JSON result marks it with `"costWarning": true`. No tool-call probe is ever sent.
|
|
214
|
+
|
|
215
|
+
Config sources, highest precedence first: `models.json`, `KIMI_BASE_URL`/`KIMI_MODEL_NAME` env, `~/.kimi/config.toml` root keys, then `[providers.<name>]` TOML tables with `type = "openai_legacy"` — the last are classified `custom-openai-compatible`, so native-only checks (login, native config) are skipped and endpoint reachability is checked instead. Credentials, URL userinfo/query/fragment, request bodies, and response bodies never appear in the output; malformed TOML is reported by line number only.
|
|
216
|
+
|
|
180
217
|
### Modes
|
|
181
218
|
|
|
182
219
|
| Flag | Description |
|
|
@@ -308,6 +345,7 @@ omk --exclude-tools ask_question
|
|
|
308
345
|
| `OMK_CODING_AGENT_DIR` | Override config directory; default is `~/.omk/agent` |
|
|
309
346
|
| `OMK_CODING_AGENT_SESSION_DIR` | Override session storage directory; overridden by `--session-dir` |
|
|
310
347
|
| `OMK_PACKAGE_DIR` | Override package directory, useful for Nix/Guix store paths |
|
|
348
|
+
| `OMK_TOOL_SCHEDULER` | Override the tool scheduler with `dag-v2` or use `waves-v1` for process-local rollback |
|
|
311
349
|
| `OMK_OFFLINE` | Disable startup network operations, including update checks, package update checks, and install/update telemetry |
|
|
312
350
|
| `OMK_SKIP_VERSION_CHECK` | Skip the OMK version update check at startup. This prevents the `the OMK repository` latest-version request |
|
|
313
351
|
| `OMK_TELEMETRY` | Override install/update telemetry and provider attribution headers: `1`/`true`/`yes` or `0`/`false`/`no`. This does not disable update checks |
|
|
@@ -18,7 +18,7 @@ cp -r examples/extensions/correctness-wall ~/.omk/agent/extensions/correctness-w
|
|
|
18
18
|
|
|
19
19
|
## Claim boundaries
|
|
20
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
|
|
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 either an OA fixture file or an explicitly enabled host-injected MCP transport.
|
|
22
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
23
|
|
|
24
24
|
## Environment variables
|
|
@@ -29,12 +29,12 @@ cp -r examples/extensions/correctness-wall ~/.omk/agent/extensions/correctness-w
|
|
|
29
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
30
|
| `OMK_WALL_OVERRIDE` | unset | When `1` / `true` / `yes`, `soft` mode does not block `BLOCKED` verdicts (human override). |
|
|
31
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,
|
|
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`,
|
|
32
|
+
| `OMK_WALL_RUN_IDS` | *(empty)* | Comma-separated AdaptOrch run ids. On `edit`/`write` hooks, non-empty IDs enable OA only with either `OMK_WALL_OA_FIXTURE_PATH` or explicit `OMK_WALL_OA_TRANSPORT=mcp`/`live` plus a bound host `callMcpTool`; otherwise hooks stay preview-only. An unbound MCP facade falls back to 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`, or as the fixture alternative for edit/write hooks. Overridden per call by `adjudicationFixturePath`. |
|
|
34
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
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
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
|
|
37
|
+
| `OMK_WALL_OA_TRANSPORT` | `fixture` | `mcp` or `live` uses host-injected MCP `callMcpTool` via `setWallAdaptOrchCallTool` (see `adjudication-fixture.ts`). With non-empty `OMK_WALL_RUN_IDS` and a bound handler, this explicitly enables fixtureless read-only OA hook adjudication; it calls only `adaptorch_get_run`, `adaptorch_get_artifacts`, and `adaptorch_get_traces`. An unbound facade falls back to preview-only. |
|
|
38
38
|
|
|
39
39
|
## OA adjudication fixture format
|
|
40
40
|
|
|
@@ -98,7 +98,7 @@ Example receipt fragment:
|
|
|
98
98
|
On each `edit` or `write` `tool_call` hook:
|
|
99
99
|
|
|
100
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`;
|
|
101
|
+
2. Call `evaluateCorrectnessWall` with scope from `OMK_WALL_SCOPE`. Default `previewOnly: true`; with non-empty `OMK_WALL_RUN_IDS`, hooks use `previewOnly: false` when either an OA fixture path is set or `OMK_WALL_OA_TRANSPORT=mcp`/`live` reaches a bound host-injected MCP transport. An unbound facade falls back to preview-only. The live hook path performs read-only OA introspection only.
|
|
102
102
|
3. Apply `OMK_PATCH_SAFETY_WALL_MODE` blocking rules; blocked calls return `{ block: true, reason: "<short user message>" }`.
|
|
103
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
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).
|
|
@@ -107,5 +107,5 @@ On each `edit` or `write` `tool_call` hook:
|
|
|
107
107
|
## Limitations
|
|
108
108
|
|
|
109
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
|
|
110
|
+
- Hook OA requires non-empty `OMK_WALL_RUN_IDS` plus either a fixture path or explicit `OMK_WALL_OA_TRANSPORT=mcp`/`live` with bound host `callMcpTool`; otherwise hooks remain preview-only. An unbound facade also falls back to preview-only. Explicit `correctness_wall_evaluate` can still pass `runIds`, `previewOnly: false`, and `adjudicationFixturePath` per call.
|
|
111
111
|
- Relative imports require loading this extension from the monorepo layout (or an equivalent path to `adaptorch-wpl` and `coding-agent` sources).
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
buildRegeneratePacket,
|
|
18
18
|
capRepairHints,
|
|
19
19
|
evaluateCorrectnessWall,
|
|
20
|
+
parseOaTransportModeFromEnv,
|
|
20
21
|
parseRepairBudget,
|
|
21
22
|
shouldOfferRepair,
|
|
22
23
|
} from "../../../../adaptorch-wpl/src/index.ts";
|
|
@@ -105,6 +106,11 @@ function receiptSigningSecret(): string | undefined {
|
|
|
105
106
|
return v && v.length > 0 ? v : undefined;
|
|
106
107
|
}
|
|
107
108
|
|
|
109
|
+
function isUnboundMcpCall(value: unknown): boolean {
|
|
110
|
+
const message = value instanceof Error ? value.message : typeof value === "string" ? value : "";
|
|
111
|
+
return /callMcpTool is not bound/i.test(message);
|
|
112
|
+
}
|
|
113
|
+
|
|
108
114
|
function shortBlockReason(card: VerdictCard): string {
|
|
109
115
|
if (card.blocked_reasons.length > 0) return card.blocked_reasons[0];
|
|
110
116
|
if (card.next_actions.length > 0) return card.next_actions[0];
|
|
@@ -379,8 +385,10 @@ export default function (omk: ExtensionAPI) {
|
|
|
379
385
|
const approvedWriteScope = parseApprovedScope();
|
|
380
386
|
const runIds = parseRunIdsFromEnv();
|
|
381
387
|
const adjudicationFixturePath = resolveAdjudicationFixturePath(undefined);
|
|
382
|
-
const hookOaEnabled =
|
|
383
|
-
|
|
388
|
+
const hookOaEnabled =
|
|
389
|
+
runIds.length > 0 &&
|
|
390
|
+
(adjudicationFixturePath !== undefined || (parseOaTransportModeFromEnv() === "mcp" && omk.isMcpToolBound()));
|
|
391
|
+
let previewOnly = !hookOaEnabled;
|
|
384
392
|
|
|
385
393
|
const input = event.input as EditInput;
|
|
386
394
|
const preview =
|
|
@@ -413,19 +421,37 @@ export default function (omk: ExtensionAPI) {
|
|
|
413
421
|
return undefined;
|
|
414
422
|
}
|
|
415
423
|
|
|
416
|
-
const
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
+
const fixturelessLiveCall =
|
|
425
|
+
hookOaEnabled && adjudicationFixturePath === undefined && parseOaTransportModeFromEnv() === "mcp";
|
|
426
|
+
let evaluation: Awaited<ReturnType<typeof evaluateDiff>>;
|
|
427
|
+
try {
|
|
428
|
+
evaluation = await evaluateDiff({
|
|
429
|
+
kind,
|
|
430
|
+
diffText: preview,
|
|
431
|
+
approvedWriteScope,
|
|
432
|
+
previewOnly,
|
|
433
|
+
runIds: hookOaEnabled ? runIds : undefined,
|
|
434
|
+
adjudicationFixturePath: hookOaEnabled ? adjudicationFixturePath : undefined,
|
|
435
|
+
});
|
|
436
|
+
} catch (error) {
|
|
437
|
+
if (!fixturelessLiveCall || !isUnboundMcpCall(error)) throw error;
|
|
438
|
+
previewOnly = true;
|
|
439
|
+
evaluation = await evaluateDiff({ kind, diffText: preview, approvedWriteScope, previewOnly: true });
|
|
440
|
+
}
|
|
441
|
+
if (
|
|
442
|
+
fixturelessLiveCall &&
|
|
443
|
+
evaluation.receipt.adjudicationReasonCode === "RUN_FETCH_FAILED" &&
|
|
444
|
+
evaluation.verdictCard.blocked_reasons.some(isUnboundMcpCall)
|
|
445
|
+
) {
|
|
446
|
+
previewOnly = true;
|
|
447
|
+
evaluation = await evaluateDiff({ kind, diffText: preview, approvedWriteScope, previewOnly: true });
|
|
448
|
+
}
|
|
449
|
+
const { verdictCard, receipt } = evaluation;
|
|
424
450
|
|
|
425
451
|
await persistToolCallVerdict(ctx, mode, verdictCard, {
|
|
426
452
|
tool: event.toolName,
|
|
427
453
|
previewOnly,
|
|
428
|
-
usedOaFixture:
|
|
454
|
+
usedOaFixture: adjudicationFixturePath !== undefined,
|
|
429
455
|
wall_version: receipt.wall_version,
|
|
430
456
|
});
|
|
431
457
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "omk-extension-custom-provider",
|
|
3
|
-
"version": "0.90.
|
|
2
|
+
"name": "omk-extension-custom-provider-anthropic",
|
|
3
|
+
"version": "0.90.9",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
|
-
"name": "omk-extension-custom-provider",
|
|
9
|
-
"version": "0.90.
|
|
8
|
+
"name": "omk-extension-custom-provider-anthropic",
|
|
9
|
+
"version": "0.90.9",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@anthropic-ai/sdk": "
|
|
11
|
+
"@anthropic-ai/sdk": "0.52.0"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"node_modules/@anthropic-ai/sdk": {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omk-extension-gondolin",
|
|
3
|
-
"version": "0.90.
|
|
3
|
+
"version": "0.90.9",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "omk-extension-gondolin",
|
|
9
|
-
"version": "0.90.
|
|
9
|
+
"version": "0.90.9",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@earendil-works/gondolin": "0.12.0"
|
|
12
12
|
}
|