open-multi-agent-kit 0.98.4 → 0.98.5
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 +12 -0
- package/README.md +3 -2
- package/dist/commands/run-command.d.ts +2 -1
- package/dist/commands/run-command.d.ts.map +1 -1
- package/dist/commands/run-command.js +9 -1
- package/dist/commands/run-command.js.map +1 -1
- package/dist/commands/verified-run-cli.d.ts +6 -0
- package/dist/commands/verified-run-cli.d.ts.map +1 -0
- package/dist/commands/verified-run-cli.js +190 -0
- package/dist/commands/verified-run-cli.js.map +1 -0
- package/dist/core/agent-session-services.d.ts +8 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +41 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +7 -8
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +61 -41
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/prompt-settlement.d.ts +4 -3
- package/dist/core/prompt-settlement.d.ts.map +1 -1
- package/dist/core/prompt-settlement.js.map +1 -1
- package/dist/core/run-budget-policy.d.ts +18 -0
- package/dist/core/run-budget-policy.d.ts.map +1 -0
- package/dist/core/run-budget-policy.js +52 -0
- package/dist/core/run-budget-policy.js.map +1 -0
- package/dist/core/run-budget.d.ts +33 -0
- package/dist/core/run-budget.d.ts.map +1 -0
- package/dist/core/run-budget.js +89 -0
- package/dist/core/run-budget.js.map +1 -0
- package/dist/core/run-execution-api.d.ts +15 -0
- package/dist/core/run-execution-api.d.ts.map +1 -0
- package/dist/core/run-execution-api.js +7 -0
- package/dist/core/run-execution-api.js.map +1 -0
- package/dist/core/run-journal.d.ts.map +1 -1
- package/dist/core/run-journal.js +30 -208
- package/dist/core/run-journal.js.map +1 -1
- package/dist/core/session-bash-service.d.ts +2 -2
- package/dist/core/session-bash-service.d.ts.map +1 -1
- package/dist/core/session-bash-service.js +21 -9
- package/dist/core/session-bash-service.js.map +1 -1
- package/dist/core/session-failure-cause.d.ts.map +1 -1
- package/dist/core/session-failure-cause.js +5 -0
- package/dist/core/session-failure-cause.js.map +1 -1
- package/dist/core/session-prompt-lifecycle.d.ts +25 -0
- package/dist/core/session-prompt-lifecycle.d.ts.map +1 -0
- package/dist/core/session-prompt-lifecycle.js +87 -0
- package/dist/core/session-prompt-lifecycle.js.map +1 -0
- package/dist/core/session-run-budget.d.ts +28 -0
- package/dist/core/session-run-budget.d.ts.map +1 -0
- package/dist/core/session-run-budget.js +127 -0
- package/dist/core/session-run-budget.js.map +1 -0
- package/dist/core/session-run-termination.d.ts.map +1 -1
- package/dist/core/session-run-termination.js +14 -3
- package/dist/core/session-run-termination.js.map +1 -1
- package/dist/core/session-termination-types.d.ts +97 -0
- package/dist/core/session-termination-types.d.ts.map +1 -0
- package/dist/core/session-termination-types.js +26 -0
- package/dist/core/session-termination-types.js.map +1 -0
- package/dist/core/session-termination.d.ts +3 -97
- package/dist/core/session-termination.d.ts.map +1 -1
- package/dist/core/session-termination.js +24 -28
- package/dist/core/session-termination.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/subagent-lane-launcher.d.ts +3 -2
- package/dist/core/subagent-lane-launcher.d.ts.map +1 -1
- package/dist/core/subagent-lane-launcher.js +24 -13
- package/dist/core/subagent-lane-launcher.js.map +1 -1
- package/dist/core/verified-run/broker.d.ts +26 -0
- package/dist/core/verified-run/broker.d.ts.map +1 -0
- package/dist/core/verified-run/broker.js +210 -0
- package/dist/core/verified-run/broker.js.map +1 -0
- package/dist/core/verified-run/candidate.d.ts +24 -0
- package/dist/core/verified-run/candidate.d.ts.map +1 -0
- package/dist/core/verified-run/candidate.js +167 -0
- package/dist/core/verified-run/candidate.js.map +1 -0
- package/dist/core/verified-run/check-receipt.d.ts +18 -0
- package/dist/core/verified-run/check-receipt.d.ts.map +1 -0
- package/dist/core/verified-run/check-receipt.js +92 -0
- package/dist/core/verified-run/check-receipt.js.map +1 -0
- package/dist/core/verified-run/coordinator.d.ts +39 -0
- package/dist/core/verified-run/coordinator.d.ts.map +1 -0
- package/dist/core/verified-run/coordinator.js +190 -0
- package/dist/core/verified-run/coordinator.js.map +1 -0
- package/dist/core/verified-run/dag-candidates.d.ts +8 -0
- package/dist/core/verified-run/dag-candidates.d.ts.map +1 -0
- package/dist/core/verified-run/dag-candidates.js +65 -0
- package/dist/core/verified-run/dag-candidates.js.map +1 -0
- package/dist/core/verified-run/dag-phase.d.ts +7 -0
- package/dist/core/verified-run/dag-phase.d.ts.map +1 -0
- package/dist/core/verified-run/dag-phase.js +92 -0
- package/dist/core/verified-run/dag-phase.js.map +1 -0
- package/dist/core/verified-run/dag-projection.d.ts +7 -0
- package/dist/core/verified-run/dag-projection.d.ts.map +1 -0
- package/dist/core/verified-run/dag-projection.js +90 -0
- package/dist/core/verified-run/dag-projection.js.map +1 -0
- package/dist/core/verified-run/dag-recovery.d.ts +13 -0
- package/dist/core/verified-run/dag-recovery.d.ts.map +1 -0
- package/dist/core/verified-run/dag-recovery.js +98 -0
- package/dist/core/verified-run/dag-recovery.js.map +1 -0
- package/dist/core/verified-run/dag-retry-projection.d.ts +9 -0
- package/dist/core/verified-run/dag-retry-projection.d.ts.map +1 -0
- package/dist/core/verified-run/dag-retry-projection.js +43 -0
- package/dist/core/verified-run/dag-retry-projection.js.map +1 -0
- package/dist/core/verified-run/dag-types.d.ts +47 -0
- package/dist/core/verified-run/dag-types.d.ts.map +1 -0
- package/dist/core/verified-run/dag-types.js +2 -0
- package/dist/core/verified-run/dag-types.js.map +1 -0
- package/dist/core/verified-run/event-parser.d.ts +3 -0
- package/dist/core/verified-run/event-parser.d.ts.map +1 -0
- package/dist/core/verified-run/event-parser.js +153 -0
- package/dist/core/verified-run/event-parser.js.map +1 -0
- package/dist/core/verified-run/events.d.ts +4 -0
- package/dist/core/verified-run/events.d.ts.map +1 -0
- package/dist/core/verified-run/events.js +3 -0
- package/dist/core/verified-run/events.js.map +1 -0
- package/dist/core/verified-run/evidence-binding.d.ts +18 -0
- package/dist/core/verified-run/evidence-binding.d.ts.map +1 -0
- package/dist/core/verified-run/evidence-binding.js +81 -0
- package/dist/core/verified-run/evidence-binding.js.map +1 -0
- package/dist/core/verified-run/evidence.d.ts +27 -0
- package/dist/core/verified-run/evidence.d.ts.map +1 -0
- package/dist/core/verified-run/evidence.js +100 -0
- package/dist/core/verified-run/evidence.js.map +1 -0
- package/dist/core/verified-run/journal.d.ts +32 -0
- package/dist/core/verified-run/journal.d.ts.map +1 -0
- package/dist/core/verified-run/journal.js +103 -0
- package/dist/core/verified-run/journal.js.map +1 -0
- package/dist/core/verified-run/namespace-identity.d.ts +11 -0
- package/dist/core/verified-run/namespace-identity.d.ts.map +1 -0
- package/dist/core/verified-run/namespace-identity.js +77 -0
- package/dist/core/verified-run/namespace-identity.js.map +1 -0
- package/dist/core/verified-run/owned-execution.d.ts +21 -0
- package/dist/core/verified-run/owned-execution.d.ts.map +1 -0
- package/dist/core/verified-run/owned-execution.js +43 -0
- package/dist/core/verified-run/owned-execution.js.map +1 -0
- package/dist/core/verified-run/phase-context.d.ts +9 -0
- package/dist/core/verified-run/phase-context.d.ts.map +1 -0
- package/dist/core/verified-run/phase-context.js +2 -0
- package/dist/core/verified-run/phase-context.js.map +1 -0
- package/dist/core/verified-run/process-gate.d.ts +5 -0
- package/dist/core/verified-run/process-gate.d.ts.map +1 -0
- package/dist/core/verified-run/process-gate.js +31 -0
- package/dist/core/verified-run/process-gate.js.map +1 -0
- package/dist/core/verified-run/projection.d.ts +4 -0
- package/dist/core/verified-run/projection.d.ts.map +1 -0
- package/dist/core/verified-run/projection.js +219 -0
- package/dist/core/verified-run/projection.js.map +1 -0
- package/dist/core/verified-run/recovery-clock.d.ts +19 -0
- package/dist/core/verified-run/recovery-clock.d.ts.map +1 -0
- package/dist/core/verified-run/recovery-clock.js +69 -0
- package/dist/core/verified-run/recovery-clock.js.map +1 -0
- package/dist/core/verified-run/recovery-command.d.ts +11 -0
- package/dist/core/verified-run/recovery-command.d.ts.map +1 -0
- package/dist/core/verified-run/recovery-command.js +73 -0
- package/dist/core/verified-run/recovery-command.js.map +1 -0
- package/dist/core/verified-run/recovery-projection.d.ts +12 -0
- package/dist/core/verified-run/recovery-projection.d.ts.map +1 -0
- package/dist/core/verified-run/recovery-projection.js +88 -0
- package/dist/core/verified-run/recovery-projection.js.map +1 -0
- package/dist/core/verified-run/recovery.d.ts +12 -0
- package/dist/core/verified-run/recovery.d.ts.map +1 -0
- package/dist/core/verified-run/recovery.js +115 -0
- package/dist/core/verified-run/recovery.js.map +1 -0
- package/dist/core/verified-run/run-types.d.ts +103 -0
- package/dist/core/verified-run/run-types.d.ts.map +1 -0
- package/dist/core/verified-run/run-types.js +2 -0
- package/dist/core/verified-run/run-types.js.map +1 -0
- package/dist/core/verified-run/scripted-writer.d.ts +15 -0
- package/dist/core/verified-run/scripted-writer.d.ts.map +1 -0
- package/dist/core/verified-run/scripted-writer.js +94 -0
- package/dist/core/verified-run/scripted-writer.js.map +1 -0
- package/dist/core/verified-run/session-port.d.ts +27 -0
- package/dist/core/verified-run/session-port.d.ts.map +1 -0
- package/dist/core/verified-run/session-port.js +2 -0
- package/dist/core/verified-run/session-port.js.map +1 -0
- package/dist/core/verified-run/storage.d.ts +15 -0
- package/dist/core/verified-run/storage.d.ts.map +1 -0
- package/dist/core/verified-run/storage.js +96 -0
- package/dist/core/verified-run/storage.js.map +1 -0
- package/dist/core/verified-run/verification-phase.d.ts +5 -0
- package/dist/core/verified-run/verification-phase.d.ts.map +1 -0
- package/dist/core/verified-run/verification-phase.js +56 -0
- package/dist/core/verified-run/verification-phase.js.map +1 -0
- package/dist/core/verified-run/work-recovery.d.ts +8 -0
- package/dist/core/verified-run/work-recovery.d.ts.map +1 -0
- package/dist/core/verified-run/work-recovery.js +44 -0
- package/dist/core/verified-run/work-recovery.js.map +1 -0
- package/dist/core/verified-run/writer-completion.d.ts +4 -0
- package/dist/core/verified-run/writer-completion.d.ts.map +1 -0
- package/dist/core/verified-run/writer-completion.js +27 -0
- package/dist/core/verified-run/writer-completion.js.map +1 -0
- package/dist/core/verified-run/writer-phase.d.ts +8 -0
- package/dist/core/verified-run/writer-phase.d.ts.map +1 -0
- package/dist/core/verified-run/writer-phase.js +76 -0
- package/dist/core/verified-run/writer-phase.js.map +1 -0
- package/dist/core/verified-run/writer-projection.d.ts +11 -0
- package/dist/core/verified-run/writer-projection.d.ts.map +1 -0
- package/dist/core/verified-run/writer-projection.js +70 -0
- package/dist/core/verified-run/writer-projection.js.map +1 -0
- package/dist/core/verified-run/writer-recovery.d.ts +16 -0
- package/dist/core/verified-run/writer-recovery.d.ts.map +1 -0
- package/dist/core/verified-run/writer-recovery.js +107 -0
- package/dist/core/verified-run/writer-recovery.js.map +1 -0
- package/dist/core/workload-permit-pool.d.ts +1 -3
- package/dist/core/workload-permit-pool.d.ts.map +1 -1
- package/dist/core/workload-permit-pool.js +11 -11
- package/dist/core/workload-permit-pool.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +2 -8
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/session-failure.d.ts +13 -0
- package/dist/modes/interactive/components/session-failure.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-failure.js +81 -0
- package/dist/modes/interactive/components/session-failure.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +45 -31
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/tui-diagnostics.d.ts +36 -0
- package/dist/modes/interactive/tui-diagnostics.d.ts.map +1 -0
- package/dist/modes/interactive/tui-diagnostics.js +105 -0
- package/dist/modes/interactive/tui-diagnostics.js.map +1 -0
- package/dist/modes/interactive/tui-runtime-info.d.ts +20 -0
- package/dist/modes/interactive/tui-runtime-info.d.ts.map +1 -0
- package/dist/modes/interactive/tui-runtime-info.js +76 -0
- package/dist/modes/interactive/tui-runtime-info.js.map +1 -0
- package/docs/development.md +10 -0
- package/docs/keybindings.md +1 -1
- package/docs/release-audit-0.98.5.md +84 -0
- package/docs/run-protocol.md +33 -1
- package/docs/runtime-algorithms.md +26 -0
- package/docs/sdk.md +193 -0
- package/docs/usage.md +54 -0
- package/docs/verified-run-testing.md +417 -0
- package/docs/verified-run.md +388 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +18 -18
- package/package.json +6 -6
package/docs/sdk.md
CHANGED
|
@@ -156,6 +156,199 @@ The CLI equivalent is `--model-contract <file>`. This is opt-in dispatch control
|
|
|
156
156
|
not final-wire or billing attestation. See [Model dispatch contracts](model-contract.md)
|
|
157
157
|
for the JSON shape, events, hook restrictions, and uncovered paths.
|
|
158
158
|
|
|
159
|
+
### Isolated command runs (SDK, opt-in)
|
|
160
|
+
|
|
161
|
+
`planVerifiedRun()` and `createRunCoordinator()` provide three experimental profiles:
|
|
162
|
+
`linux-command-v1` executes an approved command, `linux-scripted-agent-v1` drives
|
|
163
|
+
approved steps through the real `AgentSession` and the offline Faux adapter, and
|
|
164
|
+
`linux-command-dag-v1` executes a bounded command DAG serially.
|
|
165
|
+
Commands run in private sandboxes; native EvidenceReceipt v3 cores and a supervisor
|
|
166
|
+
attestation bind the checked candidate before artifact retrieval.
|
|
167
|
+
|
|
168
|
+
The high-level factory injects the closed session runtime through a host-only port;
|
|
169
|
+
low-level `new RunCoordinator(root)` needs no session port for command execution or
|
|
170
|
+
candidate-only recovery. `inspectRecovery(runId)` is read-only; `resume(command,
|
|
171
|
+
approval)` acquires a new generation and rechecks the exact frozen candidate under
|
|
172
|
+
the original boot-relative deadline. It never restarts the writer or model and
|
|
173
|
+
refuses missing process identity, stale refs, unavailable clocks and expired budget.
|
|
174
|
+
|
|
175
|
+
`inspectWriterRecovery(runId)` and `restartWriter(command, approval)` separately
|
|
176
|
+
restart an interrupted local writer from its durable input checkpoint. They preserve
|
|
177
|
+
spent requests and the original work deadline, use a fresh private directory, and
|
|
178
|
+
never continue from partial output or a changed original workspace.
|
|
179
|
+
|
|
180
|
+
For the command DAG, `inspectTaskRecovery(runId)` returns read-only readiness and
|
|
181
|
+
`retryTasks(command, approval)` acquires a new generation for selected failed or
|
|
182
|
+
interrupted tasks. `RunTaskRetryCommand` pins `baseDigest` and `taskIds` alongside the
|
|
183
|
+
contract/revision/generation fields; an empty selection only continues pending work.
|
|
184
|
+
Successful checkpoints are revalidated against their complete ancestor inputs before
|
|
185
|
+
adoption. Final integration verification always uses fresh native receipts. The
|
|
186
|
+
profile supports at most 16 tasks and two preapproved commands per task; it does not
|
|
187
|
+
synthesize a repair or accept overlapping task write scopes. `RunProjection.tasks`
|
|
188
|
+
exposes task attempts and checkpoint digests; a blocked DAG returns `execution: "paused"`.
|
|
189
|
+
All recovery actions share the generation cap, original budget and command-id fence.
|
|
190
|
+
|
|
191
|
+
This does not enable live-model task generation, opaque remote replay, parallel
|
|
192
|
+
frontier scheduling, plan amendment, or host application. See [Verified Run](verified-run.md) for contracts and trust boundaries.
|
|
193
|
+
|
|
194
|
+
### Shared run budgets (SDK, opt-in)
|
|
195
|
+
|
|
196
|
+
Pass `runBudget` to `session.prompt()` to bound one prompt's logical model
|
|
197
|
+
requests. The budget starts before prompt preflight and stays shared across
|
|
198
|
+
provider retries, continuations, and first-party summaries using that session's
|
|
199
|
+
`agent.streamFn` while the prompt is active.
|
|
200
|
+
|
|
201
|
+
```typescript
|
|
202
|
+
import { RunBudgetExceededError } from "open-multi-agent-kit";
|
|
203
|
+
|
|
204
|
+
try {
|
|
205
|
+
await session.prompt("Implement the selected change and run its focused tests", {
|
|
206
|
+
runBudget: { timeoutMs: 120_000, maxRequests: 12, maxConcurrentRequests: 2 },
|
|
207
|
+
});
|
|
208
|
+
} catch (error) {
|
|
209
|
+
if (!(error instanceof RunBudgetExceededError)) throw error;
|
|
210
|
+
console.log(error.code); // deadline, requests, concurrency, or closed
|
|
211
|
+
}
|
|
212
|
+
console.log(session.getRunBudgetSnapshot());
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
| Limit | Meaning |
|
|
216
|
+
| --- | --- |
|
|
217
|
+
| `timeoutMs` | One monotonic work deadline, including preflight and retry waiting; at most 2,147,483,647 ms. |
|
|
218
|
+
| `maxRequests` | Total entries into the scoped stream-dispatch boundary. Failed requests also consume this allowance. |
|
|
219
|
+
| `maxConcurrentRequests` | Outstanding logical streams. Returning a stream object does not release its reservation; terminal metadata does. |
|
|
220
|
+
|
|
221
|
+
Limits must be non-negative safe integers. Zero denies the corresponding
|
|
222
|
+
admission; omitted limits are unbounded. Supply at least one limit. Unknown
|
|
223
|
+
fields, accessors, inherited fields, and malformed values raise
|
|
224
|
+
`RunBudgetPolicyError`. The policy is copied before asynchronous work, so later
|
|
225
|
+
caller mutation cannot enlarge it.
|
|
226
|
+
|
|
227
|
+
Exhaustion latches, requests cancellation through the existing provider, tool,
|
|
228
|
+
retry, compaction, and branch-summary paths, and rejects with
|
|
229
|
+
`RunBudgetExceededError`. Termination records use `kind: "budget_exhausted"` and
|
|
230
|
+
`causeCode: "budget.deadline"`, `"budget.requests"`, or `"budget.concurrency"`;
|
|
231
|
+
these are not automatic-retry or model-failover instructions. A separate prompt
|
|
232
|
+
cannot borrow or reset an active budget. Preflight ownership also applies when
|
|
233
|
+
the first prompt has no budget, preventing a competing budgeted prompt from
|
|
234
|
+
changing its stream or aborting it. Explicit steering/follow-up messages join the
|
|
235
|
+
running prompt without receiving a new allowance; registered commands retain
|
|
236
|
+
their existing streaming path.
|
|
237
|
+
|
|
238
|
+
`getRunBudgetSnapshot()` returns the active or most recent budget's immutable
|
|
239
|
+
limits, started-request count, outstanding-stream count, remaining time, closed
|
|
240
|
+
state, and optional exhaustion reason. It returns `undefined` when no budget has
|
|
241
|
+
been used. Missing terminal metadata retains an outstanding reservation; an
|
|
242
|
+
abort request alone does not release it. Outstanding streams block admission of
|
|
243
|
+
a new bounded or unbounded prompt even after the scope closes. Once terminal
|
|
244
|
+
metadata arrives, that reservation drains and new work can proceed. The original
|
|
245
|
+
stream and core credential resolver are restored unless another owner replaced
|
|
246
|
+
them. Captured old wrappers reject further dispatch after closure.
|
|
247
|
+
|
|
248
|
+
The core credential resolver and compaction-auth preflight now check admission
|
|
249
|
+
before consulting credentials. This is a pre-check, not a reservation: logical
|
|
250
|
+
request counts are still reserved at stream dispatch. Cancellation or expiry
|
|
251
|
+
during credential lookup is checked again before continuing.
|
|
252
|
+
|
|
253
|
+
**Limits of this slice:** request counts are not HTTP-attempt or billing counts.
|
|
254
|
+
The wrapper requests `maxRetries: 0` to disable adapter retries, but cannot attest
|
|
255
|
+
that every provider honors it. Independent context/auth hooks, remote work, detached
|
|
256
|
+
children, direct `omk-ai` calls, and replacement of the stream wrapper remain
|
|
257
|
+
outside that dispatch-count guarantee. In-process plugins are trusted. Deadline
|
|
258
|
+
cancellation is cooperative: synchronous blocking code, an uncooperative hook,
|
|
259
|
+
or a remote service can outlive the signal. This is not an OS kill/join boundary
|
|
260
|
+
or a guaranteed wall-clock return time. There is no financial/output-token cap,
|
|
261
|
+
verification/cleanup reserve, persisted budget recovery, CLI flag, or global
|
|
262
|
+
setting in this slice. Restart does not reconstruct an in-flight budget.
|
|
263
|
+
|
|
264
|
+
Regression tests: `test/run-budget.test.ts`, `test/run-budget-scope.test.ts`,
|
|
265
|
+
`test/suite/agent-session-run-budget.test.ts`, and
|
|
266
|
+
`test/suite/agent-session-admission.test.ts`.
|
|
267
|
+
|
|
268
|
+
### Prompt settlement
|
|
269
|
+
|
|
270
|
+
**Working-tree hardening:** a timeout/abort result is not proof that the tool stopped.
|
|
271
|
+
|
|
272
|
+
| Signal | Meaning |
|
|
273
|
+
| --- | --- |
|
|
274
|
+
| `tool_execution_end` | A result was committed; a timeout/abort can win before the tool stops. |
|
|
275
|
+
| `session_termination` | One agent-loop attempt ended; retries may follow. |
|
|
276
|
+
| `prompt()` resolves | The outer loop returned. A timed-out or aborted tool may remain active. |
|
|
277
|
+
| `prompt_settled` | The prompt producer closed, registered local tool promises ended, and streaming/queues no longer block settlement. |
|
|
278
|
+
|
|
279
|
+
The session retains a per-prompt owner across retries and continuations. Tools
|
|
280
|
+
selected through its registry receive unique runtime tokens, independent of
|
|
281
|
+
model tool-call IDs. Actual promise completion removes only its own token;
|
|
282
|
+
duplicate flushes and an earlier run's finish callback cannot settle another run.
|
|
283
|
+
|
|
284
|
+
After timeout or cancellation, the session withholds `prompt_settled` and its
|
|
285
|
+
resource-lease release while registered tool promises remain active. Another
|
|
286
|
+
ordinary prompt is rejected before model dispatch. Clearing a leftover queue
|
|
287
|
+
rechecks settlement, so a drained run can release its owner and accept new work.
|
|
288
|
+
Default late-settlement handling triggers a fresh settlement check after the workspace-mutation audit.
|
|
289
|
+
With explicit `lateSettlement: "ignore"`, actual completion triggers that check
|
|
290
|
+
without inventing an audit. Durations and the core tool-timeout teardown window
|
|
291
|
+
use a monotonic clock; wall-clock adjustments cannot extend or shorten that window.
|
|
292
|
+
|
|
293
|
+
User cancellation during tool execution remains an abort even when the last
|
|
294
|
+
assistant message says `toolUse`. Timeout text reports cancellation requested,
|
|
295
|
+
not process termination confirmed. Late success never replaces the failed or
|
|
296
|
+
aborted result. **`prompt_settled` is a UX signal, not semantic verification.**
|
|
297
|
+
|
|
298
|
+
This safeguard is session-local. It does not persist ownership, join detached
|
|
299
|
+
work, prove remote cancellation, or fence writers across replacement/disposal,
|
|
300
|
+
restart, or workspace reuse. Direct `Agent` calls, replacing
|
|
301
|
+
`session.agent.state.tools`, independent interactive bash, and plugin-created
|
|
302
|
+
background work are not automatically enrolled. In-process plugins remain trusted.
|
|
303
|
+
|
|
304
|
+
#### Independent bash commands
|
|
305
|
+
|
|
306
|
+
`executeBash()` owns one cancellation controller per invocation, including permit
|
|
307
|
+
waiting. Concurrent commands never share or overwrite that controller. Completion
|
|
308
|
+
removes only its own entry, so `isBashRunning` remains true while another command
|
|
309
|
+
is active. `abortBash()` signals every owned command and does not declare them
|
|
310
|
+
terminated. Cancellation observed after permit admission prevents backend dispatch.
|
|
311
|
+
|
|
312
|
+
These commands remain independent of prompt settlement and its model-request
|
|
313
|
+
budget. Backend promises still own actual termination; detached processes and
|
|
314
|
+
remote completion are not inferred from cancellation. Regression:
|
|
315
|
+
`test/suite/agent-session-bash-ownership.test.ts`.
|
|
316
|
+
|
|
317
|
+
#### Shared permits and internal lanes
|
|
318
|
+
|
|
319
|
+
`WorkloadPermitPool` captures request identity, weight, and signal before waiting;
|
|
320
|
+
caller mutation cannot alter a later release. Per-permit release latches replace
|
|
321
|
+
the unbounded retired-ID set. Removing a cancelled/expired FIFO head immediately
|
|
322
|
+
reconsiders the next request. Explicit pool `capacity: 0` denies grants and
|
|
323
|
+
`maxQueue: 0` denies waiting; lowering capacity never revokes held permits.
|
|
324
|
+
|
|
325
|
+
Internal `launchSubagentLanes()` preserves computed zero width as
|
|
326
|
+
`admission-deferred`, observes run-specific heavy caps, defers marked heavy lanes
|
|
327
|
+
under `defer-heavy`, and rechecks abort after acquiring a permit. It forwards the
|
|
328
|
+
parent signal and awaits the callback before release. Parent cancellation reports
|
|
329
|
+
`cancelled`; failures use a fixed diagnostic rather than arbitrary child error
|
|
330
|
+
text. The existing configured lane setting `0 = unlimited` remains distinct from
|
|
331
|
+
computed admission zero. `heavyLaneIds` is a trusted caller classification.
|
|
332
|
+
This does not activate a live task DAG or a detached-process join adapter.
|
|
333
|
+
|
|
334
|
+
Regression checks from the repository root:
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
LIVE_E2E=0 node node_modules/vitest/dist/cli.js --run \
|
|
338
|
+
packages/coding-agent/test/session-prompt-lifecycle.test.ts \
|
|
339
|
+
packages/coding-agent/test/suite/agent-session-owned-settlement.test.ts \
|
|
340
|
+
packages/coding-agent/test/suite/agent-session-child-settlement.test.ts \
|
|
341
|
+
packages/coding-agent/test/workload-permit-pool-admission.test.ts \
|
|
342
|
+
packages/coding-agent/test/subagent-lane-ownership.test.ts
|
|
343
|
+
npm run check
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
The child test observes a local Node process closing before settlement and lease
|
|
347
|
+
restoration. These are not paid-provider, crash-recovery, or coding-quality benchmarks.
|
|
348
|
+
Shared logical request budgets are available through the opt-in SDK path above.
|
|
349
|
+
Verification/cleanup reserves, protected candidate/verifier binding, effect recovery,
|
|
350
|
+
and approval-bound application remain prerequisites for a durable verified run.
|
|
351
|
+
|
|
159
352
|
### AgentSession policy seams
|
|
160
353
|
|
|
161
354
|
The package root exports focused policy helpers for custom runtimes and tests:
|
package/docs/usage.md
CHANGED
|
@@ -46,6 +46,7 @@ Type `/` in the editor to open command completion. Extensions can register custo
|
|
|
46
46
|
| `/name <name>` | Set session display name |
|
|
47
47
|
| `/session` | Show session file, ID, messages, tokens, and cost |
|
|
48
48
|
| `/resource [probe\|policy]` | Show resource pressure and effective concurrency for this run |
|
|
49
|
+
| `/debug [save]` | Preview runtime diagnostics; explicitly save a metadata-only local report |
|
|
49
50
|
| `/goal [objective]` | Show or set the durable goal for the current working directory |
|
|
50
51
|
| `/tree` | Jump to any point in the session and continue from there |
|
|
51
52
|
| `/fork` | Create a new session from a previous user message |
|
|
@@ -61,6 +62,59 @@ Type `/` in the editor to open command completion. Extensions can register custo
|
|
|
61
62
|
| `/star` | Open the OMK GitHub repository |
|
|
62
63
|
| `/quit` | Quit omk |
|
|
63
64
|
|
|
65
|
+
### Diagnostics and failure details
|
|
66
|
+
|
|
67
|
+
`/debug` previews runtime identity, terminal state and the latest typed outcome
|
|
68
|
+
without saving or contacting a provider. The existing TUI debug shortcut opens
|
|
69
|
+
the same preview instead of dumping the transcript.
|
|
70
|
+
|
|
71
|
+
`/debug save` explicitly creates a new `omk-debug-*/diagnostics.json` under the OS
|
|
72
|
+
temporary directory and prints its path. It does not upload or overwrite a report.
|
|
73
|
+
POSIX directory/file permissions are `0700`/`0600`; Windows access follows the
|
|
74
|
+
temporary directory's ACLs. Delete that directory when it is no longer needed.
|
|
75
|
+
|
|
76
|
+
The version-1 JSON report contains approved metadata fields only. It excludes
|
|
77
|
+
messages, prompts, images, tool output, rendered screen text, raw errors,
|
|
78
|
+
configuration, environment values, credentials, local paths, session/run IDs and
|
|
79
|
+
provider/model/tool names. Launch and UI module paths are visible locally, not
|
|
80
|
+
saved. Metadata such as timestamps and message counts can still describe your
|
|
81
|
+
workload; review a report before sharing it.
|
|
82
|
+
|
|
83
|
+
There is no raw-transcript option in this command. Old `omk-debug.log` files are
|
|
84
|
+
not deleted or rewritten and may contain private transcripts. Explicit raw ANSI
|
|
85
|
+
capture via `OMK_TUI_WRITE_LOG` remains a separate, sensitive debugging facility;
|
|
86
|
+
see [TUI components](tui.md#debug-logging).
|
|
87
|
+
|
|
88
|
+
**Runtime identity:** The UI entry file's SHA-256 is observed at module initialization
|
|
89
|
+
and compared with the same file during inspection. Missing, oversized, virtual or
|
|
90
|
+
unreadable files are `unavailable`, not healthy. This is a single-file observation,
|
|
91
|
+
not a fingerprint of all dependencies or proof of the exact executed bytes.
|
|
92
|
+
An unchanged entry does not establish that a build includes current source changes.
|
|
93
|
+
The package has no embedded build-to-commit binding, so build revision is reported
|
|
94
|
+
as unavailable rather than inferred from checkout `HEAD`.
|
|
95
|
+
|
|
96
|
+
`/reload` refreshes resources, not core JavaScript modules. Its last completion time
|
|
97
|
+
is shown separately. Core changes need an authorized build where applicable and a
|
|
98
|
+
restarted process. Source-mode QA does not update an installed launcher.
|
|
99
|
+
|
|
100
|
+
**Failure cards:** Cause, impact and next action appear before technical fields.
|
|
101
|
+
Ctrl+O (or the configured `app.tools.expand` binding) expands kind/phase/cause code,
|
|
102
|
+
observation source, retry flags, run ID, timestamp and route. Credential-shaped
|
|
103
|
+
values are masked even when input redaction is disabled; terminal controls are
|
|
104
|
+
removed. These local details are not the saved report.
|
|
105
|
+
|
|
106
|
+
Cards never retry, repair or approve effects. Retryability and automatic-retry
|
|
107
|
+
safety stay separate; possible/confirmed side effects require inspection before
|
|
108
|
+
repeating work. Duplicate delivery of the same termination is coalesced; separate
|
|
109
|
+
failed attempts remain visible. Completed runs stay quiet, and compaction
|
|
110
|
+
cancellation retains its concise status. Journal, print, JSON and RPC termination
|
|
111
|
+
contracts are unchanged.
|
|
112
|
+
|
|
113
|
+
Focused regression tests: `test/interactive-mode-diagnostics.test.ts` and
|
|
114
|
+
`test/tui-diagnostics.test.ts` in `packages/coding-agent`. These cover the real
|
|
115
|
+
command adapter, sensitive-field exclusion, private report creation, runtime file
|
|
116
|
+
changes/unavailability, forced masking, narrow-terminal wrapping and theme changes.
|
|
117
|
+
|
|
64
118
|
### Durable Goals
|
|
65
119
|
|
|
66
120
|
Use `/goal <objective>` to create or update the durable goal for the current working directory; `/goal` without arguments shows its status. See [Run Protocol](run-protocol.md#durable-goal-lifecycle) for the authoritative persistence, round-limit, continuation, and SDK lifecycle rules.
|