open-multi-agent-kit 0.95.2 → 0.96.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.
Files changed (70) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +15 -0
  3. package/dist/approvals/approval-receipt-store.d.ts.map +1 -1
  4. package/dist/approvals/approval-receipt-store.js +25 -0
  5. package/dist/approvals/approval-receipt-store.js.map +1 -1
  6. package/dist/core/agent-session.d.ts +2 -2
  7. package/dist/core/agent-session.d.ts.map +1 -1
  8. package/dist/core/agent-session.js +41 -17
  9. package/dist/core/agent-session.js.map +1 -1
  10. package/dist/core/provider-resilience.d.ts +7 -0
  11. package/dist/core/provider-resilience.d.ts.map +1 -1
  12. package/dist/core/provider-resilience.js +11 -0
  13. package/dist/core/provider-resilience.js.map +1 -1
  14. package/dist/core/subagent-orchestration.d.ts.map +1 -1
  15. package/dist/core/subagent-orchestration.js +4 -2
  16. package/dist/core/subagent-orchestration.js.map +1 -1
  17. package/dist/core/tools/diagnostics.d.ts.map +1 -1
  18. package/dist/core/tools/diagnostics.js +8 -2
  19. package/dist/core/tools/diagnostics.js.map +1 -1
  20. package/dist/guardrails/evidence-protocol.d.ts +10 -0
  21. package/dist/guardrails/evidence-protocol.d.ts.map +1 -0
  22. package/dist/guardrails/evidence-protocol.js +34 -0
  23. package/dist/guardrails/evidence-protocol.js.map +1 -0
  24. package/dist/guardrails/evidence-system.d.ts +3 -1
  25. package/dist/guardrails/evidence-system.d.ts.map +1 -1
  26. package/dist/guardrails/evidence-system.js +22 -14
  27. package/dist/guardrails/evidence-system.js.map +1 -1
  28. package/dist/guardrails/replay-ledger-lock-owner.d.ts.map +1 -1
  29. package/dist/guardrails/replay-ledger-lock-owner.js +3 -1
  30. package/dist/guardrails/replay-ledger-lock-owner.js.map +1 -1
  31. package/dist/guardrails/replay-payload-hash.d.ts +6 -0
  32. package/dist/guardrails/replay-payload-hash.d.ts.map +1 -0
  33. package/dist/guardrails/replay-payload-hash.js +24 -0
  34. package/dist/guardrails/replay-payload-hash.js.map +1 -0
  35. package/dist/index.d.ts +2 -1
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +1 -0
  38. package/dist/index.js.map +1 -1
  39. package/dist/types/evidence.d.ts +11 -3
  40. package/dist/types/evidence.d.ts.map +1 -1
  41. package/dist/types/evidence.js.map +1 -1
  42. package/docs/book-to-skill.md +79 -0
  43. package/docs/compaction.md +10 -0
  44. package/docs/docs.json +8 -0
  45. package/docs/index.md +3 -0
  46. package/docs/models.md +12 -0
  47. package/docs/provider-resilience.md +37 -56
  48. package/docs/providers.md +4 -0
  49. package/docs/run-protocol.md +72 -0
  50. package/docs/sdk.md +15 -2
  51. package/docs/sessions.md +6 -0
  52. package/docs/settings.md +2 -0
  53. package/docs/skills.md +9 -1
  54. package/docs/usage.md +1 -1
  55. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  56. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  57. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  58. package/examples/extensions/gondolin/package-lock.json +2 -2
  59. package/examples/extensions/gondolin/package.json +1 -1
  60. package/examples/extensions/sandbox/package-lock.json +2 -2
  61. package/examples/extensions/sandbox/package.json +1 -1
  62. package/examples/extensions/with-deps/package-lock.json +2 -2
  63. package/examples/extensions/with-deps/package.json +1 -1
  64. package/npm-shrinkwrap.json +37 -15
  65. package/package.json +8 -5
  66. package/dist/core/context-budget-compressors.d.ts +0 -50
  67. package/dist/core/context-budget-compressors.d.ts.map +0 -1
  68. package/dist/core/context-budget-compressors.js +0 -166
  69. package/dist/core/context-budget-compressors.js.map +0 -1
  70. package/dist/core/extensions/loader.js.bak-sharedjiti-20260812-111246 +0 -553
package/docs/docs.json CHANGED
@@ -60,6 +60,10 @@
60
60
  "title": "Skills",
61
61
  "path": "skills.md"
62
62
  },
63
+ {
64
+ "title": "Book to Skill",
65
+ "path": "book-to-skill.md"
66
+ },
63
67
  {
64
68
  "title": "MCP",
65
69
  "path": "mcp.md"
@@ -102,6 +106,10 @@
102
106
  "title": "SDK",
103
107
  "path": "sdk.md"
104
108
  },
109
+ {
110
+ "title": "Run Protocol v1",
111
+ "path": "run-protocol.md"
112
+ },
105
113
  {
106
114
  "title": "RPC Mode",
107
115
  "path": "rpc.md"
package/docs/index.md CHANGED
@@ -35,6 +35,7 @@ For the full first-run flow, see [Quickstart](quickstart.md).
35
35
  - [Quickstart](quickstart.md) - install, authenticate, and run a first session.
36
36
  - [Using OMK](usage.md) - interactive mode, slash commands, context files, and CLI reference.
37
37
  - [Providers](providers.md) - subscription and API-key setup for built-in providers.
38
+ - [Provider Resilience](provider-resilience.md) - retry, failover, quota, and safety-stop recovery.
38
39
  - [Containerization](containerization.md) - sandbox omk with OpenShell, Gondolin, or Docker.
39
40
  - [Settings](settings.md) - global and project settings.
40
41
  - [Environment Variables](environment-variables.md) - process configuration and bash-tool session environment.
@@ -46,6 +47,7 @@ For the full first-run flow, see [Quickstart](quickstart.md).
46
47
 
47
48
  - [Extensions](extensions.md) - TypeScript modules for tools, commands, events, and custom UI.
48
49
  - [Skills](skills.md) - Agent Skills for reusable on-demand capabilities.
50
+ - [Book to Skill](book-to-skill.md) - optional document-to-skill compiler with local provenance checks.
49
51
  - [Prompt templates](prompt-templates.md) - reusable prompts that expand from slash commands.
50
52
  - [Themes](themes.md) - built-in and custom terminal themes.
51
53
  - [OMK packages](packages.md) - bundle and share extensions, skills, prompts, and themes.
@@ -55,6 +57,7 @@ For the full first-run flow, see [Quickstart](quickstart.md).
55
57
  ## Programmatic usage
56
58
 
57
59
  - [SDK](sdk.md) - embed omk in Node.js applications.
60
+ - [Run Protocol v1](run-protocol.md) - canonical task, attempt, observation, evaluation, decision, and waiver contracts.
58
61
  - [RPC mode](rpc.md) - integrate over stdin/stdout JSONL.
59
62
  - [JSON event stream mode](json.md) - print mode with structured events.
60
63
  - [TUI components](tui.md) - build custom terminal UI for extensions.
package/docs/models.md CHANGED
@@ -4,6 +4,7 @@ Add custom providers and models (Ollama, vLLM, LM Studio, proxies) via `~/.omk/a
4
4
 
5
5
  ## Table of Contents
6
6
 
7
+ - [Built-in NVIDIA GLM-5.2](#built-in-nvidia-glm-52)
7
8
  - [Minimal Example](#minimal-example)
8
9
  - [Full Example](#full-example)
9
10
  - [Supported APIs](#supported-apis)
@@ -14,6 +15,10 @@ Add custom providers and models (Ollama, vLLM, LM Studio, proxies) via `~/.omk/a
14
15
  - [Anthropic Messages Compatibility](#anthropic-messages-compatibility)
15
16
  - [OpenAI Compatibility](#openai-compatibility)
16
17
 
18
+ ## Built-in NVIDIA GLM-5.2
19
+
20
+ With `NVIDIA_API_KEY` configured, `nvidia/z-ai/glm-5.2` supports OMK thinking levels through NVIDIA NIM. Its generated metadata explicitly enables `reasoning_effort`, so `/thinking max` is sent as `reasoning_effort: "max"`. Other NVIDIA models do not inherit that capability automatically.
21
+
17
22
  ## Minimal Example
18
23
 
19
24
  For local models (Ollama, LM Studio, vLLM), only `id` is required per model:
@@ -146,22 +151,29 @@ Set `api` at provider level (default for all models) or model level (override pe
146
151
  The `apiKey` and `headers` fields support command execution, environment interpolation, and literals:
147
152
 
148
153
  - **Shell command:** `"!command"` at the start executes the whole value as a command and uses stdout
154
+
149
155
  ```json
150
156
  "apiKey": "!security find-generic-password -ws 'anthropic'"
151
157
  "apiKey": "!op read 'op://vault/item/credential'"
152
158
  ```
159
+
153
160
  - **Environment interpolation:** `"$ENV_VAR"` or `"${ENV_VAR}"` uses the value of the named variable. Interpolation works inside larger literals.
161
+
154
162
  ```json
155
163
  "apiKey": "$MY_API_KEY"
156
164
  "apiKey": "${KEY_PREFIX}_${KEY_SUFFIX}"
157
165
  ```
166
+
158
167
  `$FOO_BAR` is the variable `FOO_BAR`; use `${FOO}_BAR` when `BAR` is literal text. Missing environment variables make the value unresolved.
159
168
  - **Escapes:** `"$$"` emits a literal `"$"`; `"$!"` emits a literal `"!"` without triggering command execution.
169
+
160
170
  ```json
161
171
  "apiKey": "$$literal-dollar-prefix"
162
172
  "apiKey": "$!literal-bang-prefix"
163
173
  ```
174
+
164
175
  - **Literal value:** Used directly
176
+
165
177
  ```json
166
178
  "apiKey": "sk-..."
167
179
  ```
@@ -1,87 +1,68 @@
1
- # Provider resilience (root-level)
1
+ # Provider Resilience
2
2
 
3
- Built into OMK core not an optional extension.
3
+ OMK can recover an agent turn from provider failures that are unlikely to succeed unchanged:
4
4
 
5
- ## What it does
5
+ - content or safety stops reported as errors
6
+ - billing-cycle or quota exhaustion
7
+ - orphaned `tool_call_id` protocol errors
8
+ - transient transport and server failures
6
9
 
7
- 1. **Blocks sticky safety models** (e.g. `claude-fable-5`) from being selected as the session chat model.
8
- 2. **Ejects** them at prompt time if a resumed session still has one loaded.
9
- 3. On **content/safety stop** (`stop_reason=refusal`), **auto-failovers** to `k3 → grok-4.5 → deepseek` before retry.
10
- 4. Works with message sanitize (`transform-messages` orphan `tool_call_id` drop) so K3 protocol 400s can heal on retry.
10
+ This is availability behavior, not a safety bypass. Provider safety policy and the user's configured model access remain authoritative.
11
11
 
12
- This is session survival engineering, not a jailbreak.
12
+ ## Settings
13
13
 
14
- ## Settings (`~/.omk/agent/settings.json`)
14
+ Configure resilience in `~/.omk/agent/settings.json` or `.omk/settings.json`:
15
15
 
16
16
  ```json
17
17
  {
18
- "defaultProvider": "kimi-coding",
19
- "defaultModel": "k3",
20
18
  "providerResilience": {
21
19
  "blockStickySafetyModels": true,
22
20
  "autoFailoverOnSafetyStop": true,
23
21
  "failoverCandidates": [
24
22
  { "provider": "kimi-coding", "id": "k3" },
25
- { "provider": "grok-oauth-proxy", "id": "grok-4.5" },
26
- { "provider": "deepseek", "id": "deepseek-v4-pro" }
23
+ { "provider": "modelstudio-maas", "id": "qwen3.8-max-preview" }
27
24
  ]
28
25
  }
29
26
  }
30
27
  ```
31
28
 
32
- | Key | Default | Meaning |
33
- |---|---|---|
34
- | `blockStickySafetyModels` | `true` | Refuse `setModel` / initial pick of Fable-class ids |
35
- | `autoFailoverOnSafetyStop` | `true` | Switch model before auto-retry on safety stop |
36
- | `failoverCandidates` | k3→grok→deepseek… | Ordered targets |
29
+ | Setting | Default | Behavior |
30
+ |---|---:|---|
31
+ | `blockStickySafetyModels` | `true` | Rejects models known to produce sticky false-positive safety stops. |
32
+ | `autoFailoverOnSafetyStop` | `true` | Enables failover for safety stops and quota/billing exhaustion. |
33
+ | `failoverCandidates` | built-in chain | Ordered models considered before an automatic retry. |
37
34
 
38
- Disable only if you intentionally want Fable:
35
+ Automatic recovery also requires `retry.enabled: true` and available retry budget.
39
36
 
40
- ```json
41
- "providerResilience": { "blockStickySafetyModels": false, "autoFailoverOnSafetyStop": false }
42
- ```
37
+ ## Failover behavior
43
38
 
44
- ## Code
39
+ For a safety stop or recognized quota/billing error, OMK:
45
40
 
46
- | Module | Role |
47
- |---|---|
48
- | `src/core/provider-resilience.ts` | Shared detectors + failover pick |
49
- | `src/core/agent-session.ts` | eject / failover / retry wiring |
50
- | `src/core/model-resolver.ts` | skip sticky on initial model pick |
51
- | `src/core/settings-manager.ts` | `providerResilience` settings |
52
- | `packages/ai/.../transform-messages.ts` | drop orphan tool results |
41
+ 1. classifies the failed provider attempt;
42
+ 2. excludes the current model and models already failed during this retry sequence;
43
+ 3. selects the first non-sticky candidate that exists and has configured authentication;
44
+ 4. switches models before retrying with a short delay.
53
45
 
54
- ## How Fable is neutralized (not "jailbroken")
46
+ If no candidate qualifies, the normal same-model retry policy and backoff apply. Plain authentication errors remain non-retryable and do not trigger failover.
55
47
 
56
- Server-side content/safety stops cannot be removed by OAuth RE or local patches.
57
- OMK **deletes Fable from the operational surface**:
48
+ Recognized quota shapes include billing-cycle usage limits, `insufficient_quota`, exhausted balances, `GoUsageLimitError`, `FreeUsageLimitError`, and out-of-budget responses. These are classified as `provider.rate_limit`, even when a provider wraps them in HTTP 403.
58
49
 
59
- | Layer | Kill switch |
60
- |---|---|
61
- | `models.json` | `claude-fable-5` removed from anthropic catalog |
62
- | `model-registry.loadModels` | `/fable/i` filtered unless `OMK_ALLOW_STICKY_SAFETY_MODELS=1` |
63
- | `model-resolver` | sticky skipped; k3 preferred |
64
- | `setModel` | throws if sticky + block on |
65
- | `cycleModel` (scoped + available) | sticky filtered; goes through `setModel` |
66
- | prompt boundary | ejects leftover Fable session model → k3 |
67
- | safety-stop retry | failover chain before continue |
50
+ The default candidate order is:
68
51
 
69
- **You don't fight Fable. You never load it.**
52
+ 1. `kimi-coding/k3`
53
+ 2. `modelstudio-maas/qwen3.8-max-preview`
54
+ 3. `grok-oauth-proxy/grok-4.5`
55
+ 4. `deepseek/deepseek-v4-pro`
56
+ 5. `deepseek/deepseek-v4-flash`
57
+ 6. `modelstudio-maas/deepseek-v4-pro`
58
+ 7. `kimi-coding/kimi-for-coding`
70
59
 
71
- ## Operator
60
+ ## Retry and termination events
72
61
 
73
- ```
74
- # after rebuild — restart OMK session (required)
62
+ Each provider attempt is journaled separately and emits `session_termination`. A retryable failure is attempt-level when an `auto_retry_start` event follows it. A recovered retry later emits a `completed` termination; an exhausted retry budget leaves the last provider failure as the final termination.
75
63
 
76
- /model k3 # if still on a bad model
77
- /new # if transcript is corrupted (orphan tool ids)
78
-
79
- # emergency re-enable Fable (not recommended)
80
- OMK_ALLOW_STICKY_SAFETY_MODELS=1 omk
81
- # and settings: providerResilience.blockStickySafetyModels=false
82
- ```
64
+ See [Sessions](sessions.md#retries-and-termination-events) for consumer guidance.
83
65
 
84
- ## arXiv note (2026-07)
66
+ ## Protocol recovery
85
67
 
86
- Recent cs.CL hits on refusal/jailbreak are mostly attack-ASR / weight-edit / prefill studies.
87
- No immediate ops patch beyond routing+sanitize already in-tree. Skip theory-only papers.
68
+ For orphaned `tool_call_id` errors, OMK removes the failed assistant message from the live retry context. The standard message transform then drops tool results whose originating call is absent. Persisted session history remains unchanged for auditability.
package/docs/providers.md CHANGED
@@ -99,6 +99,10 @@ omk
99
99
 
100
100
  Reference for environment variables and `auth.json` keys: [`const envMap`](https://github.com/dmae97/omk/blob/main/packages/ai/src/env-api-keys.ts) in [`packages/ai/src/env-api-keys.ts`](https://github.com/dmae97/omk/blob/main/packages/ai/src/env-api-keys.ts).
101
101
 
102
+ #### NVIDIA NIM
103
+
104
+ Set `NVIDIA_API_KEY` and select an NVIDIA model with `/model`. The built-in `nvidia/z-ai/glm-5.2` entry sends `reasoning_effort`, including the `max` level. Other NVIDIA models keep conservative compatibility defaults unless their model metadata explicitly enables reasoning effort.
105
+
102
106
  #### Zyloo
103
107
 
104
108
  Zyloo is an OpenAI-compatible unified API gateway. Set `ZYLOO_API_KEY` and use any Zyloo-hosted model:
@@ -0,0 +1,72 @@
1
+ # OMK Run Protocol v1
2
+
3
+ The OMK Run Protocol defines one versioned contract for task execution and evaluation:
4
+
5
+ ```text
6
+ TaskSpec -> ExecutionAttempt -> Observation -> EvaluationResult -> RuntimeDecision
7
+ ```
8
+
9
+ `omk-protocol` owns these records and the pure reducers that connect them. Tool execution, persistence, scheduling, routing, and topology remain outside the package.
10
+
11
+ ## Implemented scope
12
+
13
+ The first v1 slice is available under `packages/protocol` with schema version `omk.run.v1`.
14
+
15
+ | Contract | Purpose |
16
+ | --- | --- |
17
+ | `TaskSpec` | Goal and required or advisory `ClaimPredicate` records |
18
+ | `ExecutionAttempt` | One completed initial, retry, failover, or resumed execution |
19
+ | `Observation` | Immutable facts tied to a task and attempt |
20
+ | `ClaimEvaluation` | Derived `satisfied`, `violated`, or `inconclusive` claim result |
21
+ | `EvaluationResult` | Claim evaluations plus one semantic `pass`, `fail`, or `inconclusive` verdict |
22
+ | `RuntimeDecision` | Pure `continue`, `retry`, `failover`, or `stop` decision |
23
+ | `WaiverRecord` | Explicit, scoped, attributable, and optionally expiring exception |
24
+
25
+ Every top-level record carries `schemaVersion`. Parsers reject unsupported versions, malformed timestamps, duplicate claim IDs, invalid JSON facts, and empty logical conditions.
26
+
27
+ ## Evaluation model
28
+
29
+ `evaluateTask()` is a pure `TaskSpec + ExecutionAttempt + Observation[] + WaiverRecord[] -> EvaluationResult` reducer. It does not mutate its inputs or stored evidence.
30
+
31
+ An observation condition selects facts by observation kind and task or attempt scope. Its expected facts are a recursive object subset; arrays match exactly.
32
+
33
+ - no candidate observation: `inconclusive`
34
+ - candidate with matching facts: `satisfied`
35
+ - candidates present but none match: `violated`
36
+ - `all`, `any`, and `not` compose conditions without adding evaluator state
37
+
38
+ Required, unwaived violations reduce to `fail`. Required, unwaived missing observations reduce to `inconclusive`. Otherwise the semantic verdict is `pass`. Advisory claims are reported but do not block. A task with no required claims is `inconclusive`.
39
+
40
+ `reduceRuntimeDecision()` then maps the semantic verdict through an explicit runtime policy. `pass` always stops successfully; fail and inconclusive behavior is supplied as `onFail` and `onInconclusive`. Retry and failover counters are not fields: consumers derive them from `ExecutionAttempt` records.
41
+
42
+ ## Waivers
43
+
44
+ A waiver names one task and claim, the approver, approval time, rationale, and evidence references. It may be limited to one attempt and may expire. Evaluation fails closed for cross-task, unknown-claim, future-approved, expired, duplicate, or advisory-claim waivers. The underlying claim result remains visible; `waiverId` records why it did not block.
45
+
46
+ ## EvidenceReceipt v3 bridge
47
+
48
+ `EvidenceReceipt v3` remains the integrity layer. `evidenceReceiptToObservation()` from `open-multi-agent-kit` validates the immutable core digest, then projects only execution facts into an `Observation`:
49
+
50
+ - receipt schema version and claim text
51
+ - exit code, timeout flag, and abort flag
52
+ - duration and executor
53
+ - a digest-bound receipt reference
54
+
55
+ The adapter deliberately omits the legacy mutable evidence status. Receipt digest validation does not prove ledger membership, trusted attestation, runner honesty, freshness, or OS isolation; apply those checks separately before trusting the observation.
56
+
57
+ ```typescript
58
+ import { evaluateTask, reduceRuntimeDecision } from "omk-protocol";
59
+ import { evidenceReceiptToObservation } from "open-multi-agent-kit";
60
+ ```
61
+
62
+ The legacy `TaskContract`, `EvidenceStatus`, `TaskContractBuilder.setVerdict()`, and `updateEvidenceStatus()` remain for compatibility and are deprecated. New code should append observations and recompute evaluation.
63
+
64
+ ## Authority boundaries
65
+
66
+ This slice does not change runtime ownership:
67
+
68
+ - the coding-agent still owns provider retry and failover execution;
69
+ - AdaptOrch WPL still owns its existing work-packet state machine and adjudication types;
70
+ - scheduler and router separation, topology validation, background-task durability, and algorithm-isolation work remain follow-up migrations.
71
+
72
+ Those components should consume `omk-protocol` rather than define new task, attempt, observation, or semantic-verdict types.
package/docs/sdk.md CHANGED
@@ -216,6 +216,8 @@ const executor = new VerifiedEvidenceExecutor({ store, ledger });
216
216
 
217
217
  `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`.
218
218
 
219
+ New replay events declare `payloadHashAlgorithm: "jcs-rfc8785-v2"`; payload keys are canonicalized with RFC 8785 before SHA-256 hashing, and the algorithm identifier is part of the event-hash commitment. Existing events with no algorithm are verified with the original `json-stringify-v1` contract. Loading, appending to, replaying, or exporting a mixed ledger does not rewrite or relabel those legacy events. Unknown declared algorithms fail closed.
220
+
219
221
  ### Prompting and Message Queueing
220
222
 
221
223
  `PromptOptions` controls prompt expansion, queueing behavior while streaming, and prompt preflight notifications:
@@ -374,6 +376,8 @@ session.subscribe((event) => {
374
376
  });
375
377
  ```
376
378
 
379
+ `session_termination` is emitted per provider attempt, not only when the outer `prompt()` call stops. If `auto_retry_start` follows a retryable termination, wait for the recovered attempt; `session.lastTermination` is updated to the later `completed` result on success.
380
+
377
381
  ## Options Reference
378
382
 
379
383
  ### Directories
@@ -1212,9 +1216,15 @@ Ledger and receipt publication are fail-closed but not one filesystem transactio
1212
1216
  - **Ledger**: `ReplayLedgerManager` verifies an existing ledger on construction (sequence order, prev-hash chain, payload hash, event hash) and **fails closed** on any violation.
1213
1217
  - **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.
1214
1218
 
1219
+ ### Protocol-first semantic evaluation
1220
+
1221
+ New integrations should use `TaskSpec`, `ExecutionAttempt`, `Observation`, `EvaluationResult`, `RuntimeDecision`, and `WaiverRecord` from `omk-protocol`. `evaluateTask()` derives the semantic verdict from current observations; `reduceRuntimeDecision()` derives the next runtime action. See [Run Protocol v1](run-protocol.md) for the rules and current migration boundary.
1222
+
1223
+ `evidenceReceiptToObservation(receipt, attemptId)` validates the receipt core digest and emits immutable execution facts for protocol evaluation. It does not replace ledger, attestation, freshness, or sandbox checks.
1224
+
1215
1225
  ### Receipt policy
1216
1226
 
1217
- `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.
1227
+ `EvidenceGate` (default `receiptMode: "prefer"`) gates the legacy `TaskContract` against its satisfied receipts. Pass `executor.createGateOptions()` so the gate resolves receipts, ledger events, and workspace fingerprints from the same store and ledger.
1218
1228
 
1219
1229
  | Mode | Soft missing data | Tamper-grade mismatch | Legacy `hash` / `command` |
1220
1230
  | ------ | ------------------- | ----------------------- | ---------------------------- |
@@ -1228,7 +1238,9 @@ Tamper-grade mismatches include: receipt ID, goal, or claim mismatch; schema ver
1228
1238
 
1229
1239
  `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.
1230
1240
 
1231
- ### Integration example
1241
+ ### Legacy gate integration example
1242
+
1243
+ This compatibility path still uses mutable `TaskContract` evidence status and verdict fields. `TaskContractBuilder.setVerdict()` and `updateEvidenceStatus()` are deprecated for new integrations.
1232
1244
 
1233
1245
  ```typescript
1234
1246
  import {
@@ -1329,6 +1341,7 @@ RunJournalStore, appendRunJournalRecordDurably, writeQuarantineBytesDurably,
1329
1341
  classifySessionTermination, formatSessionTermination, SessionTerminationError
1330
1342
 
1331
1343
  // Execution-bound evidence (optional, application-driven verification receipts)
1344
+ evidenceReceiptToObservation
1332
1345
  EvidenceReceiptStore
1333
1346
  ReplayLedgerManager
1334
1347
  EvidenceGate
package/docs/sessions.md CHANGED
@@ -19,6 +19,12 @@ Use `/session` in interactive mode to see the current session file, session ID,
19
19
 
20
20
  For the JSONL file format and SessionManager API, see [Session Format](session-format.md).
21
21
 
22
+ ## Retries and Termination Events
23
+
24
+ Each provider attempt writes its own `run_started`/`run_finished` journal pair and emits `session_termination`. A retryable termination is attempt-level when `auto_retry_start` follows it; consumers should not treat that event alone as the end of the outer `prompt()` call.
25
+
26
+ If a retry or failover succeeds, the later attempt emits `completed` and becomes `session.lastTermination`. If retry budget is exhausted, the last provider failure remains final. Quota and billing-cycle exhaustion are classified as `provider.rate_limit` and can switch through the configured provider-resilience chain before retrying. See [Provider Resilience](provider-resilience.md).
27
+
22
28
  ## Session Commands
23
29
 
24
30
  | Command | Description |
package/docs/settings.md CHANGED
@@ -202,6 +202,8 @@ When a provider requests a retry delay longer than `retry.provider.maxRetryDelay
202
202
 
203
203
  Keep `retry.provider.maxRetries` at `0` unless provider-level retries are explicitly needed. Setting it above `0` can make SDK/provider retries handle out-of-usage-limit errors before OMK sees them, which may block the agent until the provider quota resets in some circumstances.
204
204
 
205
+ At the agent level, recognized quota and billing-cycle failures are retryable so OMK can first switch to an authenticated `providerResilience.failoverCandidates` entry. If no candidate qualifies, normal retry backoff applies. See [Provider Resilience](provider-resilience.md).
206
+
205
207
  ```json
206
208
  {
207
209
  "retry": {
package/docs/skills.md CHANGED
@@ -11,6 +11,7 @@ OMK implements the [Agent Skills standard](https://agentskills.io/specification)
11
11
  ## Table of Contents
12
12
 
13
13
  - [Locations](#locations)
14
+ - [Optional Document Compiler](#optional-document-compiler)
14
15
  - [How Skills Work](#how-skills-work)
15
16
  - [Skill Commands](#skill-commands)
16
17
  - [Skill Structure](#skill-structure)
@@ -42,6 +43,10 @@ Discovery rules:
42
43
 
43
44
  Disable discovery with `--no-skills` (explicit `--skill` paths still load).
44
45
 
46
+ ## Optional Document Compiler
47
+
48
+ Install [`omk-book-to-skill`](book-to-skill.md) to compile PDF, EPUB, DOCX, HTML, Markdown, text, RTF, MOBI, and AZW sources into generated skills. It is an optional OMK package, not a built-in skill, and keeps Python extractors outside OMK core.
49
+
45
50
  ### Using Skills from Other Harnesses
46
51
 
47
52
  To use skills from Claude Code or OpenAI Codex, add their directories to settings:
@@ -88,7 +93,7 @@ Arguments after the command are appended after the skill content for the current
88
93
 
89
94
  `!omk <role-or-request>` is a deterministic OMK hub router. Exact role aliases such as `frontend`, `backend`, `loop`, and `plan` select `omk-frontend`, `omk-backend-data`, `omk-loop`, and `omk-plan`; free-form prompts are scored against the same hub vocabulary and fall back to `omk-skills` when no role is clear.
90
95
 
91
- In interactive mode, type `!` to open skill autocomplete. Selecting a skill inserts the explicit `!skill:name ` form, and `!omk` is offered when the OMK skill hub index is available. Bash remains available as `! command`, and `!! command` runs bash without sending output to the model. If `!token` is not a known skill, it falls back to bash; use `! command` when a command name might collide with a skill. `!omk` is reserved for OMK hub routing and never falls through to bash.
96
+ In interactive mode, type `!` to open skill autocomplete. Selecting a skill inserts the explicit `!skill:name` form, and `!omk` is offered when the OMK skill hub index is available. Bash remains available as `! command`, and `!! command` runs bash without sending output to the model. If `!token` is not a known skill, it falls back to bash; use `! command` when a command name might collide with a skill. `!omk` is reserved for OMK hub routing and never falls through to bash.
92
97
 
93
98
  Toggle skill commands via `/settings` in interactive mode or in `settings.json`:
94
99
 
@@ -173,11 +178,13 @@ Invalid: `PDF-Processing`, `-pdf`, `pdf--processing`
173
178
  The description determines when the agent loads the skill. Be specific.
174
179
 
175
180
  Good:
181
+
176
182
  ```yaml
177
183
  description: Extracts text and tables from PDF files, fills PDF forms, and merges multiple PDFs. Use when working with PDF documents.
178
184
  ```
179
185
 
180
186
  Poor:
187
+
181
188
  ```yaml
182
189
  description: Helps with PDFs.
183
190
  ```
@@ -206,6 +213,7 @@ brave-search/
206
213
  ```
207
214
 
208
215
  **SKILL.md:**
216
+
209
217
  ````markdown
210
218
  ---
211
219
  name: brave-search
package/docs/usage.md CHANGED
@@ -150,7 +150,7 @@ The doctor verifies the session's complete JSONL prefix, run journal, compaction
150
150
 
151
151
  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.
152
152
 
153
- 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.
153
+ Each agent attempt 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. Recovered retries therefore record the failed attempt and a later `completed` attempt.
154
154
 
155
155
  ## Context Files
156
156
 
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omk-extension-custom-provider-anthropic",
3
- "version": "0.95.2",
3
+ "version": "0.96.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omk-extension-custom-provider-anthropic",
9
- "version": "0.95.2",
9
+ "version": "0.96.0",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "0.52.0"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "omk-extension-custom-provider-anthropic",
3
3
  "private": true,
4
- "version": "0.95.2",
4
+ "version": "0.96.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "omk-extension-custom-provider-gitlab-duo",
3
3
  "private": true,
4
- "version": "0.95.2",
4
+ "version": "0.96.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omk-extension-gondolin",
3
- "version": "0.95.2",
3
+ "version": "0.96.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omk-extension-gondolin",
9
- "version": "0.95.2",
9
+ "version": "0.96.0",
10
10
  "dependencies": {
11
11
  "@earendil-works/gondolin": "0.12.0"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "omk-extension-gondolin",
3
3
  "private": true,
4
- "version": "0.95.2",
4
+ "version": "0.96.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omk-extension-sandbox",
3
- "version": "0.95.2",
3
+ "version": "0.96.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omk-extension-sandbox",
9
- "version": "0.95.2",
9
+ "version": "0.96.0",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sandbox-runtime": "0.0.26"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "omk-extension-sandbox",
3
3
  "private": true,
4
- "version": "0.95.2",
4
+ "version": "0.96.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omk-extension-with-deps",
3
- "version": "0.95.2",
3
+ "version": "0.96.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omk-extension-with-deps",
9
- "version": "0.95.2",
9
+ "version": "0.96.0",
10
10
  "dependencies": {
11
11
  "ms": "2.1.3"
12
12
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "omk-extension-with-deps",
3
3
  "private": true,
4
- "version": "0.95.2",
4
+ "version": "0.96.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",