stitchkit 0.135.0 → 0.135.1

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 (49) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/agent-runtime/providers/openrouter-audio.d.ts +122 -0
  3. package/dist/agent-runtime/providers/openrouter-audio.d.ts.map +1 -0
  4. package/dist/agent-runtime/providers/openrouter-catalog-cache.d.ts.map +1 -1
  5. package/dist/agent-runtime/providers/openrouter-catalog.d.ts +2 -0
  6. package/dist/agent-runtime/providers/openrouter-catalog.d.ts.map +1 -1
  7. package/dist/agent-runtime/providers/openrouter-http.d.ts +100 -0
  8. package/dist/agent-runtime/providers/openrouter-http.d.ts.map +1 -0
  9. package/dist/agent-runtime/providers/openrouter-media.d.ts +160 -0
  10. package/dist/agent-runtime/providers/openrouter-media.d.ts.map +1 -0
  11. package/dist/agent-runtime/providers/openrouter-models.d.ts +1 -1
  12. package/dist/agent-runtime/providers/openrouter-models.d.ts.map +1 -1
  13. package/dist/agent-runtime/providers/openrouter-options.d.ts +2 -0
  14. package/dist/agent-runtime/providers/openrouter-options.d.ts.map +1 -1
  15. package/dist/agent-runtime/providers/openrouter-response.d.ts.map +1 -1
  16. package/dist/agent-runtime/providers/openrouter-retrieval.d.ts +114 -0
  17. package/dist/agent-runtime/providers/openrouter-retrieval.d.ts.map +1 -0
  18. package/dist/agent-runtime/providers/openrouter-spend.d.ts +5 -1
  19. package/dist/agent-runtime/providers/openrouter-spend.d.ts.map +1 -1
  20. package/dist/agent-runtime/providers/openrouter-stream.d.ts +29 -0
  21. package/dist/agent-runtime/providers/openrouter-stream.d.ts.map +1 -0
  22. package/dist/agent-runtime/providers/openrouter-systemone.d.ts +82 -0
  23. package/dist/agent-runtime/providers/openrouter-systemone.d.ts.map +1 -0
  24. package/dist/agent-runtime/providers/openrouter-url.d.ts +13 -0
  25. package/dist/agent-runtime/providers/openrouter-url.d.ts.map +1 -0
  26. package/dist/agent-runtime/providers/openrouter.d.ts +4 -1
  27. package/dist/agent-runtime/providers/openrouter.d.ts.map +1 -1
  28. package/dist/agent-runtime/providers/provider-http.d.ts +15 -1
  29. package/dist/agent-runtime/providers/provider-http.d.ts.map +1 -1
  30. package/dist/agent-runtime/stores/branch-observations.d.ts +42 -42
  31. package/dist/agent-runtime/testing/store-conformance-lifecycle.d.ts +20 -20
  32. package/dist/agent-runtime/testing/store-conformance-support.d.ts +10 -10
  33. package/dist/entrypoints/agent-runtime/anthropic.js +1 -1
  34. package/dist/entrypoints/agent-runtime/openai.js +1 -1
  35. package/dist/entrypoints/agent-runtime/openrouter.d.ts +7 -0
  36. package/dist/entrypoints/agent-runtime/openrouter.d.ts.map +1 -1
  37. package/dist/entrypoints/agent-runtime/openrouter.js +1444 -241
  38. package/dist/{index-zfrysr1e.js → index-ht71v1ag.js} +52 -32
  39. package/llms/agent-runtime-openrouter.txt +11 -3
  40. package/llms/agent-runtime.2.txt +333 -224
  41. package/llms/agent-runtime.3.txt +225 -380
  42. package/llms/agent-runtime.4.txt +381 -158
  43. package/llms/agent-runtime.5.txt +157 -152
  44. package/llms/agent-runtime.6.txt +164 -0
  45. package/llms/agent-runtime.txt +30 -332
  46. package/llms/spend.txt +17 -1
  47. package/llms-full.txt +54 -4
  48. package/llms.txt +3 -3
  49. package/package.json +1 -1
@@ -1,19 +1,172 @@
1
- # stitchkit/agent-runtime — stitchkit docs slice, part 5 of 5
1
+ # stitchkit/agent-runtime — stitchkit docs slice, part 5 of 6
2
2
 
3
3
  > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
4
  > `llms.txt` in this package.
5
+ > Continues in `llms/agent-runtime.6.txt`.
5
6
 
6
7
  Parts of this slice:
7
8
  - `llms/agent-runtime.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
8
9
  - `llms/agent-runtime.2.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
9
10
  - `llms/agent-runtime.3.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
10
- - `llms/agent-runtime.4.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md) · API reference: `stitchkit/agent-runtime` (docs/api/reference.md)
11
- - `llms/agent-runtime.5.txt`: API reference: `stitchkit/agent-runtime` (docs/api/reference.md) · API reference: `stitchkit-tui` (docs/api/reference.md)
11
+ - `llms/agent-runtime.4.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
12
+ - `llms/agent-runtime.5.txt`: API reference: `stitchkit/agent-runtime` (docs/api/reference.md)
13
+ - `llms/agent-runtime.6.txt`: API reference: `stitchkit/agent-runtime` (docs/api/reference.md) · API reference: `stitchkit-tui` (docs/api/reference.md)
12
14
 
13
15
  ==============================================================================
14
- # API reference: `stitchkit/agent-runtime` (docs/api/reference.md) (continued)
16
+ # API reference: `stitchkit/agent-runtime` (docs/api/reference.md)
15
17
  ==============================================================================
16
18
 
19
+ ## `stitchkit/agent-runtime`
20
+
21
+ Server-only, peer-free optional application runtime. Runs models exclusively through `AgentModelDriver` (one provider call per step) with no AI SDK dependency. See the
22
+ [agent runtime guide](../guide/agent-runtime.md).
23
+
24
+ | Export | Kind | Summary |
25
+ |--------|------|---------|
26
+ | `createAgentRuntime` | function | compose durable acceptance, native `AgentModelDriver` step loop, tool parsing/validation, WebCrypto HMAC-SHA256 tool approvals, `beforeStepToolCalls`, bounded terminal continuations (`maxContinuations`), `onAttemptDiscarded`, `onToolInputStart`, checkpoints, coordination, managed tools and winner-only terminal publication; reconciles same-owner terminal/interrupt/head CAS races before releasing the lane |
27
+ | `createDeferredAgentToolSurface` | function | bounded canonical catalog search plus durable same-run activation of direct `mountAgentTools` tools; supports one immutable surface or a finite identity-specific registry |
28
+ | `DeferredAgentToolSearchInputSchema` / `DeferredAgentToolMatchSchema` / `DeferredAgentToolReceiptSchema` | schema | bounded search input, public match and versioned durable selection receipt |
29
+ | `DeferredAgentToolSurfaceConfig` / `DeferredAgentToolCommonConfig` / `DeferredAgentToolSurfaceDefinition` / `DeferredAgentToolController` | _type_ | finite catalogs, selector, pin, budget and `mount`/`prepareStep`/`repairToolCall` composition contracts |
30
+ | `DeferredAgentRuntimeToolDefinition` / `DeferredAgentToolMountConfig` | _type_ | peer-free Agent-only runtime definition and canonical mount configuration accepted by the controller |
31
+ | `DeferredAgentToolManifestEntry` / `DeferredAgentToolSearchContext` / `DeferredAgentToolReceipt` | _type_ | canonical selector input and inferred durable receipt records |
32
+ | `DeferredAgentToolEvent` | _type_ | PII-free search/step evidence with surface, provenance, counts, canonical schema bytes and ceilings |
33
+ | `defineAgentProtocol` | function | declare context, input metadata, canonical parts and optional pre-CAS terminal acceptance (`allow-empty`, `require-output` or callback returning `AgentTerminalAcceptanceDecision`) |
34
+ | `hasAgentTerminalOutput` | function | generic `require-output` predicate for non-blank text, generated files, structured provider parts and explicit tool-only policy stops |
35
+ | `carriedToolWork` | function | pure helper returning whether any completed `AgentStepResult` performed client or provider tool work |
36
+ | `AgentTerminalAcceptanceDecision` | _type_ | `boolean \| { action: 'accept' } \| { action: 'reject' } \| { action: 'continue', message, instructions? }` returned by `protocol.acceptTerminal` for bounded continuations (capped by `loop.maxContinuations`, default 3) |
37
+ | `AgentMessageSchema` / `AgentRunSchema` / `AgentSnapshotSchema` | schema | versioned canonical engine records |
38
+ | `AgentRunQueuePrioritySchema` | schema | durable opt-in priority for queued `interrupt-next` runs |
39
+ | `AgentRuntimeStore` | _type_ | aggregate CAS transaction boundary for message, run and compaction mutations |
40
+ | `BranchAgentConversationInputSchema` / `BranchAgentConversationInput` | schema / _type_ | strict branch request: stable request key, empty destination, settled conversation boundary or archive bytes, fresh artifact authorization, and `applicationFiles` — `{ reference, destinationReference }` pairs for file parts the application stores; an undeclared non-spill file reference refuses the branch. Spills validly retired by `spill/deleted` cross as deterministic rekeyed history (emitting an inert `runtime/branch-observation` across `throughRunId` cutoffs) while missing or inconsistent spills refuse with `integrity`. `applicationKeys` declares, once each, runtime reference names such as `messageId` or `runId` that are the application's own data inside its JSON — `sourceIdentity: 'refuse'` (default) refuses a value naming the source, `'retain'` carries a value naming the source conversation, a run or a message byte for byte as a record of the past, and `'rekey-spill'` rekeys source spill references (live or legitimately expired) while still refusing foreign spills and all other source identities (→ ADR 0300, ADR 0328) |
41
+ | `AgentConversationBranchRefusedError` / `AgentBranchRefusalSchema` / `AgentBranchRefusal` / `AgentBranchRefusalCodeSchema` / `AgentBranchRefusalCode` | class / schemas / _types_ | a branch refusal: a `TypeError` whose `refusals` lists every refusal a declaration or authorization lifts (up to 100, `omittedRefusals` counts the rest), each with `code` and its address — event `seq`, `eventKind`, `messageId`, `toolName`, key `path`, attachment `reference` — never a value; `integrity` stops at once |
42
+ | `AgentConversationBranchPlanSchema` / `AgentConversationBranchPlan` / `AgentRuntimeStore.planConversationBranch` | schema / _type_ / method | what `branchConversation` would refuse for the same input, without writing: `ready`, `refusals`, `omittedRefusals`, `applicationFiles` (every non-spill attachment reference to grant and declare), `undeclaredKeys`, `fingerprint`, `sourceArchiveDigest` |
43
+ | `AgentConversationBranchReceiptSchema` / `AgentConversationBranchReceipt` | schema / _type_ | durable lineage: request fingerprint, source/destination identities, source sequence/version/digest and creation time |
44
+ | `AgentConversationBranchResultSchema` / `AgentConversationBranchResult` | schema / _type_ | `created` or `duplicate` with the same durable receipt; `AgentRuntimeStore.branchConversation` is optional for hand-written stores |
45
+ | `createAgentRuntimeStore` | function | build the aggregate store from one coherent transaction driver; framework owns every state transition; the store reports `capabilities` |
46
+ | `AgentRuntimeStoreCapabilities` / `AgentStoreOptionalCapability` | _type_ | `store.capabilities`, frozen: `{ archive, historyRestore, purge }` — whether the driver has `archive`, `history.restore` and `conversations`; a driver whose `archive` lacks `export` or `import` is refused when the store is built |
47
+ | `AgentStoreUnsupportedCapabilityError` | class | a `TypeError` with `.capability` (`'archive'` or `'historyRestore'`): `importConversation`, `branchConversation` or `planConversationBranch` got a source that needs a driver member the store lacks — without `archive`, an archive carrying spills or companion projections, or a branch source carrying spills; without `history.restore`, a compacted baseline — and refused it before writing anything |
48
+ | `AgentRuntimeStoreDriver` | _type_ | ORM-neutral transaction over a bounded head, normalized runs/admissions, product history, a **required** `events: { append, list }` ledger table, an optional `archive: { export, import }` for driver-owned durable payloads, and indexed run recovery; optional `{ access: 'read' }` selects a coherent read transaction while absent options remain write-safe |
49
+ | `recordAgentRetryDecision` / `AgentRetryPolicy` | function / _type_ | `loop.retry` policy and the ledger record of a retry decision: explicit retryability and backoff at a durable provider-step boundary |
50
+ | `AgentRuntimeHeadSchema` | schema | constant-size conversation identity plus monotonic runtime version |
51
+ | `AgentStoredRunSchema` | schema | canonical normalized run with an optional retained terminal assistant |
52
+ | `AgentAdmissionReceiptSchema` | schema | durable idempotency receipt with canonical input and assigned run/assistant identities |
53
+ | `AgentHistoryMutationSchema` | schema | typed canonical message mutation applied inside the winning state transaction |
54
+ | `RecoverAgentRunSchema` | schema | explicit abandon/requeue recovery decision; acquired runs require replay-safe evidence |
55
+ | `createMemoryAgentRuntimeStore` | function | process-local reference adapter, not production durability |
56
+ | `purgeAgentConversation` | function | dispatch optional atomic deletion; returns `unsupported`, `active`, `conflict`, `purged` or `already_purged` |
57
+ | `AgentConversationPurgeInputSchema` / `AgentConversationPurgeInput` | schema / _type_ | conversation ID and optional expected snapshot version |
58
+ | `AgentConversationPurgeResultSchema` / `AgentConversationPurgeResult` | schema / _type_ | typed deletion/refusal outcomes; active refusal includes run IDs |
59
+ | `AgentConversationPurgedError` | class | runtime mutation rejected because its conversation ID is permanently purged |
60
+ | `AgentConversationPurgeDriver` | _type_ | optional `driver.conversations` capability: serialized tombstone read and atomic removal of all owned records |
61
+ | `projectAgentHistory` | function | asynchronously project canonical records and resolved multimodal files into provider-valid peer-free `AgentModelMessage[]` |
62
+ | `defineModelRegistry` | function | typed language-model descriptors, capabilities and `AgentModelDriverFactory` construction |
63
+ | `AgentModelCatalogSchema` / `AgentModelCatalog` | schema / _type_ | provider-neutral complete/partial model catalog with separately sourced popularity, metrics, prices and observation time |
64
+ | `AgentModelCatalogEntrySchema` / `AgentModelCatalogEntry` | schema / _type_ | one canonical provider model descriptor with optional price, popularity and metric evidence |
65
+ | `AgentModelPriceSchema` / `AgentModelPrice` | schema / _type_ | normalized per-token input/output pricing and source currency |
66
+ | `AgentModelPopularitySchema` / `AgentModelPopularity` | schema / _type_ | independently sourced ranked popularity observation with window and timestamp |
67
+ | `AgentModelMetricSchema` / `AgentModelMetric` | schema / _type_ | independently sourced benchmark measurement with provenance and observation time |
68
+ | `AgentModelCatalogProvider` | _type_ | abortable live catalog loader supplied by a provider adapter or application |
69
+ | `AgentModelSearchInputSchema` / `AgentModelSearchInput` | schema / _type_ | bounded catalog text query and result ceiling |
70
+ | `AgentModelSearchResultSchema` / `AgentModelSearchResult` | schema / _type_ | exact bounded catalog projection with total match count |
71
+ | `searchAgentModelCatalog` | function | deterministic bounded search over a loaded canonical catalog |
72
+ | `AgentModelSelectionSchema` / `AgentModelSelection` / `AgentModelSelectionStore` | schema / _type_ | durable per-conversation model choice; runtime resolvers receive run and snapshot to recover the model pinned to input metadata |
73
+ | `createMemoryAgentModelSelectionStore` | function | process-local selection reference adapter |
74
+ | `AgentConversationReader` | _type_ | optional bounded conversation-summary and message-history reader; `messages` takes `includeCompacted` and every page names its `compacted` ids; not part of the required runtime store contract |
75
+ | `AgentConversationSummarySchema` / `AgentConversationSummary` | schema / _type_ | bounded durable conversation list item with version, activity and preview |
76
+ | `AgentConversationPageSchema` / `AgentConversationPage` | schema / _type_ | cursor-paged conversation summaries |
77
+ | `AgentConversationMessagePageSchema` / `AgentConversationMessagePage` | schema / _type_ | cursor-paged durable message history |
78
+ | `composeAgentPrompt` | function | ordered prompt contributions and provenance-aware signed context budget; irreducible reservation deficits are `oversized`, not compactable history |
79
+ | `SeedConversationInputSchema` / `SeedConversationInput` | schema / _type_ | atomic once-seeding input; partial imported identity sets are refused |
80
+ | `AgentSeedReceiptSchema` / `AgentSeedReceipt` | schema / _type_ | durable seed receipt retained beyond compaction and implemented by custom store drivers |
81
+ | `StepRunOptions` | _type_ | per-step options of the durability engine (`stitchkit/tools`) as the runtime drives it |
82
+ | `DURABILITY_STEP_EVENT_KIND` | const | the ledger event kind a recorded step is written under |
83
+ | `StepResultDecodeError` / `StepResultNotSerializableError` / `StepAbortedError` / `ParkRecordDecodeError` / `ParkAbortedError` | class | fail-closed decode of a recorded step or park, a body whose result cannot be serialized, an aborted step, and a park collapsed around an aborted waiter |
84
+ | `structuredCompaction` | function | summarize a provider-valid snapshot range and replace it through CAS |
85
+ | `selectCompactableHistory` | function | which oldest whole complete turns may be summarised away — the half of compaction that needs no store (→ ADR 0142) |
86
+ | `SelectCompactableHistoryOptions` / `CompactableHistory` | _type_ | message list, retained-turn count and evidence policy in; `leadingSummary`, `compactable` and `retained` out |
87
+ | `createAgentSessionCoordinator` | function | strict process-local queue/interrupt/supersede lifecycle |
88
+ | `AgentRuntimeStopPolicy` | _type_ | named stop rule `AgentRuntimeStopPolicy<CONTEXT = unknown>` persisted and published on policy stop; `when` receives `AgentStepResult[]` plus the run context `prepareStep` gets (`context`, `run`, `signal`, `toolFenceLifecycle`, `contextUsage`) |
89
+ | `AgentRuntimePrepareStep` | _type_ | per-run controlled step callback with typed domain context and managed run signal/fence |
90
+ | `AgentContextOverflowError` | class | deliberate application budget refusal thrown from `loop.prepareStep`; terminalizes as `context_overflow` without classifying arbitrary error text |
91
+ | `AgentRuntimeRecordIds` | _type_ | optional caller-provided input, run and assistant IDs for stable application records |
92
+ | `AgentRuntimeAdmission` | _type_ | canonical committed input, assigned run, pending assistant projection, compatibility IDs and snapshot version |
93
+ | `AgentAdmissionEventSchema` | schema | post-commit admission projection; removes store rereads but does not imply exactly-once delivery |
94
+ | `AgentRunMetricsSchema` | schema | optional provenance-aware usage and timings; `partial` says the provider never reported the run finished, so the figure beside it is not a confirmed total |
95
+ | `AgentRuntimeRecoverOptions` | _type_ | bounded paged startup recovery with causal per-conversation scheduling, context resolver and explicit evidence policy |
96
+ | `AgentRuntimeAbandonInput` | _type_ | one known orphan identity, expected revision and mandatory stale-owner evidence for `runtime.abandon()` |
97
+ | `AgentRuntimeConflictError` | class | thrown when a store mutation loses to a concurrent writer — catchable by type from `stitchkit/agent-runtime` |
98
+ | `AgentRunUnsettledError` | class | rejects `result` when the store never answered: `.run` is still active with no executor, close it with `runtime.abandon()` |
99
+ | `AgentSessionCloseOptions` | _type_ | `gracePeriodMs` for natural settlement, then abort, then `forceTimeoutMs` for bounded settlement after it |
100
+ | `AgentSessionCloseResult` | _type_ | what `close()` achieved: `settled`, or `timedOut` with `remaining` runs still in flight. Only omitting `forceTimeoutMs` guarantees nothing is in flight on return |
101
+ | `AgentHistoryProjectionOptions` | _type_ | storage-neutral file resolver, explicit unresolved-file behavior, and how an interrupted turn reaches the model (`interruptedAssistant`) |
102
+ | `createAgentToolFenceLifecycle` | function | pre-effect and post-effect run ownership fence for `mountAgentTools` / `mountAgent`; compose beside application idempotency for [durable operations](../guide/mcp-and-agents.md#durable-application-owned-execution) |
103
+ | `AgentRuntimeEventSchema` | schema | transient stream lifecycle plus post-commit admission/checkpoint/run-state/run-operation/terminal projections |
104
+ | `AgentRunOperationKindSchema` / `AgentRunOperationPhaseSchema` / `AgentRunOperationSchema` / `AgentRunOperation` | schemas / _type_ | latest durable model-request or compaction phase with operation/step identity and original timestamps; request admission is awaited before provider invocation |
105
+ | `RecordRunOperationSchema` / `RecordRunOperation` | schema / _type_ | owner/fencing/revision-checked mutation of `AgentRun.lastOperation` |
106
+ | `createAgentObservability` | function | separate agent-run sink over the shared bounded observability lifecycle |
107
+ | `AgentProviderResponseSchema` / `AgentProviderResponse` | schema / _type_ | provider-assigned response ID and the optional upstream provider the model's own adapter resolves, shared by `step-finished.response` and durable `provider/response` facts |
108
+ | `AgentStepFinishedEventSchema` / `AgentStepFinishedEvent` | schema / _type_ | one completed provider step, abandoned retry attempt, or compaction call with required usage, optional provider response identity, `attempt`, `phase`, `provider`, and isolated `spendHookError` diagnostics |
109
+ | `AgentStepSpendPhaseSchema` / `AgentStepSpendPhase` | schema / _type_ | lifecycle phase (`'step' \| 'abandoned-attempt' \| 'compaction'`) that produced a billed spend fact |
110
+ | `AgentStepSpendSchema` / `AgentStepSpend` | schema / _type_ | canonical per-step spend fact delivered to `AgentRuntimeConfig.onStepSpend` (`conversationId`, `runId`, `step`, `attempt`, `phase`, `model?`, `provider?: { key, upstream? }`, `response?`, `usage`, `trace?`) |
111
+
112
+ ### Durable capability layer
113
+
114
+ | Export | Kind | Summary |
115
+ |--------|------|---------|
116
+ | `AgentConversationArchiveSchema` / `AgentConversationArchive` / `encodeAgentConversationArchive` / `decodeAgentConversationArchive` / `canonicalAgentJson` | schema / _type_ / functions | canonical validated conversation archive (`canonicalAgentJson` is `canonicalJson` with the node and byte limits at their maximum, reading `-0` as `0` like `z.json()`) with exact ledger events, recovery projection and durable spill payloads |
117
+ | `AgentStoreEventEnvelopeSchema` / `AgentStoreEventEnvelope` / `AgentStoreEventKindSchema` / `AgentStoreEventKind` / `AgentStoreEventPageSchema` / `AgentStoreEventPage` | schema / _type_ | append-only event envelope, closed current vocabulary (including `provider/request` and `provider/response`) and bounded page |
118
+ | `AppendAgentStoreEventSchema` / `AppendAgentStoreEvent` / `ReadAgentStoreEventsSchema` / `ReadAgentStoreEvents` | schema / _type_ | required append and bounded-read store contracts |
119
+ | `AgentStoreTransitionSchema` / `AgentStoreTransition` / `AgentStoreEventDraft` / `AgentStoreEventDecodeAccepted` / `AgentStoreEventDecodeIgnored` / `AgentStoreEventDecodeResult` / `decodeAgentStoreEvent` | schema / _types_ / function | normalized runtime mutations, append drafts and strict current/ignorable future-event decoding outcomes |
120
+ | `AgentStoreTransitionRecordSchema` / `AgentStoreTransitionRecord` | schema / _type_ | persisted journal payloads: full runtime mutations or hash-only streaming checkpoint observations with numeric part/byte counts; inspection does not authorize replay |
121
+ | `defineAgentProjection` / `AgentProjectionDefinition` / `AgentProjectionValue` / `createAgentProjectionRegistry` / `createAgentProjectionStore` | functions / _type_ | deterministic folds with persisted version and honest `uptoSeq` checkpoints |
122
+ | `agentSummaryProjection` / `agentUsageProjection` / `agentOutlineProjection` | constants | built-in list summary, provenance-carrying usage and request outline projections |
123
+ | `agentConversationCardProjection` / `agentStateSlotsProjection` / `agentScheduleSummaryProjection` | constants | focused card, durable-state and schedule lifecycle projections |
124
+ | `defineStateSlot` / `AgentStateSlotDefinition` / `AgentStateSlotStore` / `AgentStateSlotValue` / `AnyAgentStateSlot` / `createAgentStateSlotStore` / `renderAgentStateSlots` | functions / _types_ | typed durable state written as ledger events and injected on every provider request |
125
+ | `agentGoalStateSlot` / `agentTodoStateSlot` / `createAgentStateTools` / `AgentStateToolsConfig` / `AGENT_STATE_TOOL_DESCRIPTORS` | constants / function / _type_ | built-in goal/todo state, `goal_*` / `todo_write` Agent tools bound to the conversation of the run context `tools()` receives, and their deeply frozen non-executable static catalog descriptors |
126
+ | `AgentProcessSandbox` | _type_ | host-provided process sandbox handle accepted by agent coding tools (probe helpers and grade/restriction schemas live in `stitchkit/agent-runtime/sandbox`) |
127
+ | `AgentSandboxProcess` / `AgentSandboxOutputStream` | _types_ | structural child/output interface for optional lifecycle-owned `AgentProcessSandbox.spawn`, without Node ambient type dependencies |
128
+ | `AgentEventSearchResultSchema` / `AgentEventSearchResult` / `createAgentEventSearch` / `createAgentEventSearchTools` / `AgentEventSearchToolsConfig` / `AGENT_EVENT_SEARCH_TOOL_DESCRIPTORS` | schema / _types_ / functions / constant | authorized event search (SQLite FTS5 or Postgres `tsvector`, ADR 0315) with exact event addresses, `session_*` tools for the conversation of the run context `tools()` receives, and their deeply frozen non-executable static catalog descriptors |
129
+ | `PostgresAgentEventSearchConfig` | _type_ | the Postgres index's options for `createAgentEventSearch({ postgres })` — `diacritics` (`preserve` / `unaccent`), `maxIndexedChars`, `maxSyncEvents` |
130
+ | `createAgentSpillStore` | function | durable content-address-checked artifact storage, bounded read/search, retention facts and archive participation |
131
+ | `AgentScheduleSchema` / `AgentSchedule` / `AgentScheduleService` / `AgentScheduleDeliveryOutcomeSchema` / `AgentScheduleDeliveryOutcome` / `createAgentScheduleService` / `AgentScheduleServiceConfig` / `createAgentScheduleTools` / `AgentScheduleToolsConfig` / `AGENT_SCHEDULE_TOOL_DESCRIPTORS` | schemas / _types_ / functions / constant | durable `at`/`after`/timezone-explicit `every` schedules over the store's `AgentCompanionHost`, required `maxActivePerConversation` and `minIntervalMs`, indexed retry eligibility, typed retry/terminal failure (any other returned value delivers), `maxAttempts` (default 1000) per occurrence — a one-off ends `failed`, a recurring schedule skips to its next slot — bounded dispatch and fenced stable occurrence identity (ADR 0202); the tools are bound to the conversation of the run context `tools()` receives, with deeply frozen non-executable static catalog descriptors |
132
+ | `AgentChildBudgetSchema` / `AgentChildBudget` / `AgentChildStateSchema` / `AgentChildState` / `AgentChildRecordSchema` / `AgentChildRecord` | schema / _type_ | durable child graph, bounded seed and measured budget state |
133
+ | `AgentChildBlockingKindSchema` / `AgentChildBlockingKind` / `AgentChildBlockingSourceSchema` / `AgentChildBlockingSource` / `AgentChildBlockingEventSchema` / `AgentChildBlockingEvent` / `AgentChildBlockingDecision` | schemas / _types_ | parent-owned request identities; responses discriminate approval decisions from JSON input values |
134
+ | `AgentChildHandle` / `AgentChildManager` / `AgentChildManagerConfig` / `AgentChildRemainingBudget` / `createAgentChildManager` / `createAgentChildTools` / `AgentChildToolsConfig` / `AGENT_CHILD_TOOL_DESCRIPTORS` / `agentChildBudgetStopPolicy` | _types_ / functions / constant | host execution port, child lifecycle with required `remainingBudget` and `maxActiveChildren`, cascade (given to `createAgentRuntime` as `children`), messaging, Agent tools bound to the parent conversation of the run context `tools()` receives (plus their deeply frozen static catalog descriptors), and the child runtime's own budget stop policy — `recordStepUsage` at every step boundary, `policy_stop` as `child-budget` when spent |
135
+ | `AgentCompanionHost` / `AgentCompanionScope` / `AgentSqlSession` / `AgentSqlTables` / `AgentSqlValue` | _types_ | the store's companion host — one store transaction with the purge check and the event append (`transaction(conversationId, work)`), a read transaction (`read(work)`), the companion tables — given by the SQLite and Postgres stores and taken by every companion |
136
+ | `AgentToolDefinition` / `AgentToolDescriptor` | _types_ | peer-neutral executable shape returned by the bound agent-only tool factories and its non-executable static catalog descriptor shape (assignable to `SurfaceRuntimeToolDefinition` without an active run) |
137
+ | `AgentProviderStreamCutError` / `AgentProviderStreamCutErrorOptions` | class / _type_ | explicit retryable provider stream truncation evidence and constructor options |
138
+
139
+ ### Native model port, driver composition and peer-free completions
140
+
141
+ `stitchkit/agent-runtime` executes models through `AgentModelDriver` — one provider call per step,
142
+ no SDK retries and no tool execution inside the driver. `completeText` and `completeObject` reuse
143
+ the same native step execution without requiring a store. → ADR 0336.
144
+
145
+ | Export | Kind | Summary |
146
+ |--------|------|---------|
147
+ | `AgentModelDriver` / `AgentModelDriverFactory` | _type_ | single-step model port (`stream(request, signal)`) and provider factory registered in `defineModelRegistry` |
148
+ | `AgentModelRequest` / `AgentModelStream` / `AgentModelStreamPart` | _type_ | normalized single-step request (`instructions`, `messages`, `tools`, `toolChoice`, `responseFormat`, `cacheControl`, `settings`, `providerOptions`, `headers`, `correlation`) and ordered stream event union (including keepalive `ping`, multi-block reasoning/text/tool events with unified `toolCallId`, `file` with optional `filename`, and terminal `finish`) |
149
+ | `AgentModelToolSpec` / `AgentModelFunctionToolSpec` / `AgentModelProviderToolSpec` / `AgentModelJsonValue` / `AgentModelToolChoice` / `AgentModelCallSettings` / `AgentModelCorrelation` | _type_ | union of client function tool specs (JSON Schema 2020-12) and provider-native tool specs (`type: 'provider'` with `AgentModelJsonValue` config), tool-choice directive, call sampling settings and non-secret request correlation (`conversationId`, `runId`, `invocationId`, `attemptId`, `step`) |
150
+ | `AgentModelFinishReason` / `AgentModelResponseMetadata` / `AgentModelCostDetails` / `AgentStepTimings` / `AgentStepChunkIntervals` | _type_ | normalized step finish reason, response metadata (including server `modelId` and `timestamp`), optional provider-reported cost/BYOK breakdown (`promptCostUsd`, `outputCostUsd`, `isByok`), and measured step/response/tool/TTFT timings with optional inter-chunk interval percentiles (`min`, `p10`, `median`, `avg`, `p90`, `max`) |
151
+ | `wrapModelDriver` / `composeModelDrivers` | function | wrap one `AgentModelDriver` with one or an ordered outer-to-inner list of lifecycle decorators whose `onClose` runs once on finish, error, early stream cancellation, or abort |
152
+ | `AgentModelDriverDecorator` / `AgentModelDriverStreamOutcome` | _type_ | generic per-stream interceptor (`beforeStream`, `transformRequest`, `transformSignal`, `onPart`, `onClose`) and terminal stream outcome (`finished`, `errored`, `cancelled`) |
153
+ | `completeText` / `streamComplete` / `CompleteTextInput` / `CompleteTextOptions` / `CompletePromptInput` / `CompleteTextResult` / `CompleteTextStream` / `CompleteStreamPart` / `CompletePrepareStep` / `AgentCompleteStopPolicy` | functions / _types_ | peer-free single- or multi-step completion and standalone async-iterable streaming over any `AgentModelDriver` (no store required), with compile-time XOR on `prompt` vs `messages`, `retry`, `stopPolicies`, `idleTimeoutMs`, `onPart`, `headers`, tools, `prepareStep`, `repairToolCall`, timings and usage |
154
+ | `completeObject` / `CompleteObjectInput` / `CompleteObjectResult` | function / _types_ | peer-free structured-output completion emitting strict JSON Schema (`draft-2020-12` via `toJsonSchema(..., 'input')`), stripping strict-mode optional `null`s prior to Zod validation, and supporting multi-step tool loops |
155
+ | `AgentStructuredOutputError` / `AgentStructuredOutputErrorReason` / `AgentStructuredOutputErrorDetails` | class / _types_ | typed error thrown by `completeObject` with `reason` (`'truncated' \| 'tool-calls' \| 'content-filter' \| 'provider-error' \| 'interrupted' \| 'empty' \| 'invalid-json' \| 'schema-mismatch'`), `finishReason`, `rawText`, `steps`, and `usage` |
156
+ | `AgentRetryExhaustedError` / `AgentRetryExhaustedErrorDetails` / `AgentRetryAttemptRecord` | class / _types_ | typed error thrown when stateless completion retries exhaust `retry.maxAttempts` or `maxRetryDurationMs`, carrying every failed attempt, `lastError`, and accumulated billable `usage` |
157
+ | `AgentProviderError` / `AgentProviderErrorDetails` / `isAgentProviderError` | class / _type_ / function | canonical provider HTTP/envelope error carrying `provider`, `statusCode`, `code`, `errorType`, `requestId`, `retryAfterMs`, optional `retryable` (e.g. `false` when `x-should-retry: false`), `failureReason`, redacted safe message, and runtime type guard |
158
+ | `AgentUnknownToolError` / `AgentInvalidToolInputError` | class | PII-safe tool-dispatch errors for unknown/inactive tools and invalid JSON or Zod tool inputs |
159
+ | `AgentToolApprovalError` / `AgentToolApprovalErrorReason` / `AgentInvalidToolApprovalSignatureError` / `AgentToolCallNotFoundForApprovalError` | class / _type_ | typed failures and machine reason codes (`'invalid-signature' \| 'call-not-found' \| 'input-validation-failed' \| 'input-mutated' \| 'invalid-policy-decision' \| 'approval-unsupported'`) for invalid approval payloads, WebCrypto HMAC-SHA256 signature verification failure, unresolved approval call IDs, or standalone fail-closed `needsApproval` refusal |
160
+ | `AgentToolApprovalConfiguration` / `AgentToolApprovalDecision` / `AgentToolApprovalCallOptions` / `AgentToolApprovalToolRule` | _type_ | per-call or per-tool approval policy evaluated by the native step loop |
161
+ | `AgentStepToolCallBatchHook` / `AgentStepToolCallBatchInput` / `AgentStepToolCallBatchDecision` | _type_ | `loop.beforeStepToolCalls` whole-step batch policy invoked once all tool calls of a step are parsed and validated, able to refuse selected calls by `toolCallId` |
162
+ | `AgentToolCallRepairFunction` / `AgentToolCallRepairInput` | _type_ | first-class `repairToolCall` hook that rewrites an unknown, inactive, or invalid tool call before execution |
163
+ | `AgentPrepareStepInput` / `AgentPrepareStepResult` | _type_ | step-preparation input and per-step overrides (`driver`, `instructions`, `messages`, `activeTools`, `toolChoice`, `responseFormat`, `cacheControl`, sampling settings, `providerOptions`, `headers`) |
164
+ | `AgentStepResult` / `AgentStepContentPart` / `AgentStepToolCall` / `AgentStepToolResult` | _type_ | peer-free completed step record delivered to `prepareStep`, `stopPolicies`, and `onStepFinish` |
165
+ | `AgentModelMessageSchema` / `AgentModelMessage` / `AgentModelSystemMessageSchema` / `AgentModelSystemMessage` / `AgentModelUserMessageSchema` / `AgentModelUserMessage` / `AgentModelAssistantMessageSchema` / `AgentModelAssistantMessage` / `AgentModelToolMessageSchema` / `AgentModelToolMessage` / `AgentInstructions` | schemas / _types_ | canonical peer-free model-exchange message schemas and normalized instruction input |
166
+ | `AgentModelUserContentPartSchema` / `AgentModelUserContentPart` / `AgentModelAssistantContentPartSchema` / `AgentModelAssistantContentPart` / `AgentModelToolContentPartSchema` / `AgentModelToolContentPart` / `AgentToolModelContentPart` / `AgentToolModelOutputSchema` | schemas / _types_ | non-deprecated content part schemas (`text`, `reasoning`, `file`, `reasoning-file`, `tool-call`, `tool-result`, approvals, `custom`) and structured tool-output schema |
167
+ | `AgentModelFileDataSchema` / `AgentModelFileData` / `AgentGeneratedFile` / `AgentGeneratedFileData` | schema / _types_ | tagged file payload (`data`, `url`, `reference`, `text`) and generated model file (`mediaType`, `data`, optional `filename`, `url?`, lazy `base64`/`uint8Array`, `providerMetadata?`) handed to `persistGeneratedFile` |
168
+ | `AgentModelResponseFormatSchema` / `AgentModelResponseFormat` / `AgentCacheControlSchema` / `AgentCacheControl` / `AgentModelProviderOptionsSchema` / `AgentModelProviderOptions` / `AgentModelProviderOptionValue` | schemas / _types_ | portable structured-output format (`text`, `json-object`, `json-schema`), prompt-cache breakpoint directive (`ephemeral`, optional `'5m' \| '1h'` TTL), and namespaced provider options with recursive `AgentModelProviderOptionValue` supporting optional `undefined` keys under `exactOptionalPropertyTypes` |
169
+
17
170
  ### Complete runtime inventory
18
171
 
19
172
  The entrypoint deliberately exports the schemas beside their inferred types so persistence and
@@ -171,151 +324,3 @@ Managed effects and operator telemetry additionally export `AgentToolFenceConfig
171
324
  `AgentRunSinkConfig`, `AgentRunSinkDrop` and `AgentRunSinkError`. A monotonic run `fencingToken`
172
325
  may accompany checkpoint/terminal writes and tool context; internal causes are redacted unless an
173
326
  operator-only observability sink explicitly opts in.
174
-
175
- ### Completion and agent invocation receipts
176
-
177
- `createModelInvocationLedger` constructs a `ModelInvocationLedger` from
178
- `ModelInvocationConfig`: the existing store and model registry, a 32-byte payload
179
- key, required host authorization, optional bounded payload size and `onAttempt`.
180
- `complete(input, context, signal?)` executes only the supplied prompt, with no tools
181
- or framework instructions; repeated keys return the existing invocation ID. It
182
- resolves `{ invocationId, outcome, text?, receiptError? }`: `receiptError` says a
183
- receipt could not be written and never changes `outcome` or drops `text`.
184
- `read(input, context)` returns a bounded event page shared by agent and completion;
185
- `readPayload(input, context)` requires a separate authorization action and returns a
186
- discriminated `ModelInvocationPayloadRead` (`available` with decrypted payload or `expired`
187
- with `expiredAt` once redacted); `purgePayloads(input, context)` redacts expired ciphertext
188
- in-place across the store and search indexes while retaining receipt metadata and digests.
189
- When a request or response payload exceeds `maxPayloadBytes`, the provider call still succeeds
190
- while recording `payloadOmitted: 'max-payload-bytes'` (with `artifactId` omitted and `payloadSha256`
191
- preserved) and reporting `InvocationPayloadTooLargeError` through `complete().receiptError`. See the
192
- [guide and migration example](../guide/agent-runtime.md#plain-completions-and-shared-invocation-receipts).
193
-
194
- | Export | Kind | Purpose |
195
- | --- | --- | --- |
196
- | `CompletionInvocationInputSchema` / `CompletionInvocationInput` | schema/type | strict prompt, model-attempt list, deadline, idempotency key and trace input |
197
- | `ModelInvocationTraceSchema` / `ModelInvocationTrace` | schema/type | operation, purpose, project, parent trace and optional experiment/case/profile |
198
- | `ModelInvocationRecordSchema` / `ModelInvocationRecord` | schema/type | discriminated invocation start/finish and per-attempt requested/sent/effective evidence (with optional `artifactId` and `payloadOmitted` when oversized, keeping `payloadSha256`) |
199
- | `InvocationPayloadTooLargeError` | class | `RangeError` carrying `{ bytes, maxBytes, sha256 }` when a recorded invocation payload exceeds `maxPayloadBytes` without aborting the provider call |
200
- | `InvocationPayloadOmissionReasonSchema` / `InvocationPayloadOmissionReason` | schema/type | reason a payload body was not stored (`'max-payload-bytes'`) |
201
- | `ModelInvocationPayloadReadSchema` / `ModelInvocationPayloadRead` | schema/type | discriminated result of `readPayload`: `{ status: 'available', payload, ... }` or `{ status: 'expired', expiredAt, ... }` |
202
- | `PurgeInvocationPayloadsInputSchema` / `PurgeInvocationPayloadsInput` | schema/type | input for `purgePayloads` / `store.purgeExpiredPayloads`: `before`, optional `conversationId` and `limit` |
203
- | `PurgeInvocationPayloadsResultSchema` / `PurgeInvocationPayloadsResult` | schema/type | result of `purgePayloads`: `purged`, `freedBytes`, and `hasMore` |
204
- | `ModelInvocationAuthorizationInput` | type | discriminated authorization payload passed to `ModelInvocationConfig.authorize` (`'complete'`, `'agent'`, `'read'`, `'read-payload'`, or `'purge-payloads'`) |
205
- | `ModelInvocationAttemptContext` | type | conversation, operation, invocation, attempt, step and optional agent run identity |
206
- | `currentModelInvocationAttempt` | function | returns causal IDs inside the provider transport; undefined outside an invocation |
207
- | `modelInvocationSpendAttribution` | function | the current attempt as `stitchkit/spend` attribution fields (conversation, run, invocation, attempt, step) — a spend gateway's `context` |
208
- | `AgentStepBarriers` / `AgentToolCallDependencies` | _type_ | `loop.stepBarriers`, guards on each model step, checked by `createAgentRuntime`: `maxToolCallsPerStep` (a call past it is refused to the model as a `STEP_TOOL_CALL_LIMIT` tool error, without asking for its approval), `toolDependencies` (in the order the model made the calls, a read of an entity waits for the step's earlier writes of it and a write for its earlier reads and writes), `onPredecessorFailure` (`'run'` default, or `'refuse'` to fail-cascade dependent calls on the same entity with `STEP_PREDECESSOR_FAILED`), `maxReasoningCharsPerStep` (past it the run stops as `policy_stop`), `stepText: 'after-tools'` (a step's text is held to its end and shown only if none of its tool calls failed; held text of an interrupted step is not shown) |
209
- | `AgentStepBarrierError` | class | the run stopped at a step bound: `bound` is `reasoning` |
210
- | `createToolDependencyResolver` | function | `toolDependencies` from operation effects — the `effect` of each endpoint of `contracts`, under its mounted tool name, and `effects` (by tool name) for tools of no contract — and the application's `entityOf(toolName, input)`: a `write` tool writes its entity, a `read` tool reads it |
211
-
212
- The runtime `invocations` option takes this ledger and a trace callback; it requires
213
- the same store and preserves the existing tool loop. `AgentRuntimeStore.appendEventOnce`
214
- is an optional atomic capability required by receipt admission, and
215
- `AgentRuntimeStore.findEventOnce` reads the event it wrote by kind and key. Built-in
216
- stores supply both; custom adapters must honor the once-only transaction contract.
217
- A driver's optional `events.find(transaction, { conversationId, eventId })` makes
218
- both one lookup instead of a scan of the conversation log.
219
-
220
- ==============================================================================
221
- # API reference: `stitchkit-tui` (docs/api/reference.md)
222
- ==============================================================================
223
-
224
- ## `stitchkit-tui`
225
-
226
- Separate optional evolving Bun/OpenTUI package over a caller-composed headless harness.
227
-
228
- | Export | Kind | Summary |
229
- |--------|------|---------|
230
- | `defineAgentTui` | function | typed config for title, `theme` (a `TerminalPalette` override) and `themeMode`, status rows, model catalog, context, commands, runtime bundle and optional host-evidenced recovery policy; the default never requeues acquired effects |
231
- | `runAgentTui` | function | start one fresh durable conversation and terminal controller, recover durable work and publish its authenticated local session; `initialConversationId` is an explicit resume override; it closes the session and exits the process on Ctrl-C and every signal OpenTUI catches unless `exitSignals: []` |
232
- | `defineTuiCommand` / `resolveTuiCommand` | function | typed composable slash-command registry; unknown slash input remains an ordinary model prompt |
233
- | `createAgentTuiController` | function | single admission, selection, approval, interruption and conversation-switch owner over the harness |
234
- | `startAgentTuiSessionHost` / `createAgentTuiClient` | function | authenticated mode-`0600` Unix-socket host/client for status, submit and interrupt through that controller |
235
- | `listAgentTuiSessions` | function | discover live local terminal session IDs and their current conversation |
236
- | `createAgentTuiComposer` / `navigateAgentTuiHistory` | function | multiline draft and reversible prompt-history state |
237
- | `defaultAgentTuiStatusLine` / `AgentTuiStatusLineFormatter` | function / _type_ | terminal-native default rows and a host formatter over model capacity, durable snapshot, activity, workspace and local identities; `statusLine: false` hides the rows |
238
- | `createAgentTuiDiagnosticRecorder` / `AgentTuiDiagnosticEventSchema` | function / schema | bounded per-session metadata journal that rejects prompt, reasoning, tool-input and provider-cause payloads before disk admission |
239
-
240
- The `stitchkit-agent` binary runs React's production build unless `NODE_ENV` says otherwise and loads `stitchkit.agent.ts` by default and also exposes `sessions`,
241
- `status`, `send` and `interrupt`. `--workspace` addresses a host outside the caller's cwd,
242
- `send --idempotency-key` accepts caller-owned retry identity, and `interrupt` defaults to the
243
- active run returned by `status`. Session descriptors and sockets are local control credentials,
244
- not a remote API.
245
- Interactive `/resume` and `/sessions` open the durable conversation picker. `/clear` creates a new
246
- conversation and keeps the previous one available there; it is not a viewport-only operation.
247
- The slash palette owns its highlighted selection: Up/Down move it, Tab completes it, Enter runs
248
- the exact command and Escape dismisses it. Partial input is never submitted while the palette is
249
- active; unknown slash text with no match remains an ordinary model prompt.
250
-
251
- ### `stitchkit-tui/core`
252
-
253
- Renderer-neutral state only. This entrypoint imports neither React/OpenTUI nor the agent runtime.
254
-
255
- | Export | Kind | Summary |
256
- |--------|------|---------|
257
- | `createTerminalCollection` / `reduceTerminalCollection` | function | identity-stable live collection selection, reconciliation, windowing and resize |
258
- | `createTerminalFeedViewport` / `reduceTerminalFeedViewport` | function | generic follow-tail, history anchoring, unseen and bounded visible-range state |
259
- | `createTerminalPaneState` / `reduceTerminalPaneState` | function | bounded split-pane focus, resize and single-pane collapse |
260
- | `createTerminalCommandPalette` / `terminalCommandMatches` | function | bounded command filtering and keyboard selection over a collision-validated registry |
261
- | `resolveExactTerminalCommand` / `validateTerminalCommands` | function | exact dispatch and fail-closed name/alias validation |
262
- | `createTerminalOperationState` / `reduceTerminalOperationState` | function | confirmation and single-pending-operation lifecycle |
263
- | `createTerminalTable` / `reduceTerminalTable` / `projectTerminalTable` | function | live table: typed columns, rows validated on entry, sort with key tie-break and missing values last, tree expansion pruned to present rows, filter on displayed text, selection kept across data; a row's `tone` and a column's `tone(value, row)` colour state |
264
- | `layoutTerminalTableColumns` / `formatTerminalTableCell` / `visibleTerminalTableRows` / `terminalTableTreePrefix` | function | fixed and flexible column widths, `—` for missing values, the virtualized window, tree indentation |
265
- | `createTerminalList` / `reduceTerminalList` / `visibleTerminalListLines` | function | picker with sections, fuzzy query with title highlight ranges, multi-select, disabled items and "more above/below" counts |
266
- | `createTerminalForm` / `reduceTerminalForm` / `readTerminalForm` / `terminalFormFieldsFromJsonSchema` | function | typed fields (text, secret, number, integer, boolean, choice, JSON) from a JSON Schema, relative text edits, validation on leave and submit |
267
- | `createTerminalTabs` / `reduceTerminalTabs` | function | tabs with badges, wrap-around movement, digit selection and reconcile that keeps the selected tab |
268
- | `createTerminalNavigation` / `reduceTerminalNavigation` / `terminalBreadcrumbs` | function | screen stack keeping each level's state, root never popped |
269
- | `createTerminalFocus` / `reduceTerminalFocus` | function | focus ring plus layers that take the keyboard and give it back |
270
- | `createTerminalNotices` / `reduceTerminalNotices` / `nextTerminalNoticeExpiry` | function | bounded toasts on a caller clock, replaced by id |
271
- | `createTerminalTimeSeries` / `appendTerminalSample` / `sampleTerminalTimeSeries` | function | time window bounded by duration and sample count, value-in-force sampling with explicit gaps |
272
- | `terminalBrailleChart` / `terminalSparkline` / `terminalTimeAxis` / `terminalChartScale` | function | multi-series braille line or area chart as toned runs, sparkline, time axis |
273
- | `terminalMeter` / `layoutTerminalMeterGrid` | function | eighth-block bar toned by thresholds, unmeasured as muted; column-major core grid |
274
- | `terminalProgress` / `terminalSpinnerFrame` / `terminalIndeterminateBlock` / `formatTerminalDuration` | function | ratio, rate and ETA only when knowable; spinner frames; indeterminate bar; elapsed time |
275
- | `defineTerminalKeymap` / `matchTerminalKey` / `fitTerminalKeyHints` | function | conflict-checked bindings that both answer keys and draw a footer fitted to the width |
276
- | `terminalTableKeymap` / `terminalTableKey` / `terminalTabsKeymap` / `terminalTabsKey` | function | htop-style table bindings and tab bindings as keymaps |
277
- | `matchTerminalSearch` / `searchTerminalItems` / `terminalHighlightRuns` | function | multi-word fuzzy match with ranges, stable ranking, highlight runs |
278
- | `sanitizeTerminalText` / `terminalTextWidth` / `truncateTerminalText` / `fitTerminalText` / `wrapTerminalText` | function | strip escape and control sequences; measure, cut, pad and wrap by terminal cells |
279
- | `terminalTextEdit` / `applyTerminalTextEdit` | function | one-line edits as relative actions, so fast input is never lost |
280
- | `terminalJsonLines` / `layoutTerminalDetails` | function | toned, sanitized JSON lines; aligned key/value pairs |
281
- | `terminalPalettes` / `resolveTerminalPalette` / `TerminalPalette` / `TerminalTone` | value / function / _type_ | one semantic palette (surfaces plus `primary`, `muted`, `accent`, `success`, `warning`, `danger`) for dark and light terminals |
282
- | `terminalLabelsEn` / `terminalLabelsRu` / `TerminalLabels` | value / _type_ | every word the widgets draw |
283
-
284
- ### `stitchkit-tui/widgets`
285
-
286
- OpenTUI React widgets over the core state. React, `@opentui/core` and `@opentui/react` are peers;
287
- this entrypoint never loads `stitchkit`.
288
-
289
- | Export | Kind | Summary |
290
- |--------|------|---------|
291
- | `TerminalAppShell` / `TerminalPanel` / `TerminalStatusBar` / `TerminalKeyHints` | component | breadcrumbs, status lines, body, fitted key hints and toast overlay; titled rounded panels with a focus frame |
292
- | `TerminalTable` | component | virtualized live table with header sort marks, tree, filter line and htop keys; row and cell tones in the palette, bold or dim where colour is missing |
293
- | `terminalToneAttributes` | function | the text attribute that carries a tone without colour: `danger` and `warning` bold, `muted` dim |
294
- | `TerminalList` | component | sections, fuzzy search line with highlights, `›` cursor, meta, badges, multi-select, description |
295
- | `runTerminalApp` / `RunTerminalAppOptions` / `RunningTerminalApp` | function / _type_ | start an application: renderer, theme and labels providers, the error boundary, and an exit with 128 + signal after `onClose` on Ctrl-C and every signal OpenTUI catches — a closed window leaves no orphan |
296
- | `TerminalErrorBoundary` / `TERMINAL_EXIT_SIGNALS` / `TerminalExitSignal` | component / value / _type_ | draws a render error and its stack in place of the screen, where OpenTUI's own boundary renders nothing under production React |
297
- | `TerminalForm` | component | fields edited in place, cycling choices, masked secrets, inline errors; a form without fields says so and submits `{}` on Enter |
298
- | `TerminalTextView` / `TerminalJsonView` | component | pager over sanitized wrapped text or toned JSON |
299
- | `TerminalMeter` / `TerminalMeterGrid` / `TerminalChart` / `TerminalSparkline` | component | htop meters and core grid; btop braille charts with axis |
300
- | `TerminalTabs` / `TerminalDialog` / `TerminalSpinner` / `TerminalProgressBar` / `TerminalAsyncView` / `TerminalDetails` / `TerminalNotices` / `TerminalHelp` | component | views, confirmation, loading, progress, async states, details, toasts, key help |
301
- | `TerminalThemeProvider` / `useTerminalPalette` / `useTerminalThemeMode` | component / hook | palette from the terminal's reported background (`auto`) or a fixed mode |
302
- | `TerminalLabelsProvider` / `TerminalFocusProvider` / `useTerminalFocused` | component / hook | product language and shared focus |
303
-
304
- The `stitchkit-tui-gallery` binary shows every widget live.
305
-
306
- ### `stitchkit-tui/build`
307
-
308
- Build-time only; imports Bun and no React.
309
-
310
- | Export | Kind | Summary |
311
- |--------|------|---------|
312
- | `compileTerminalApp` / `CompileTerminalAppOptions` | function / _type_ | one standalone executable for any Bun compile target, from any machine, with React's production build defined |
313
- | `terminalNativePlugin` / `TerminalNativePluginOptions` | function / _type_ | the `Bun.build` plugin behind it: the target's `@opentui/core-<os>-<arch>` at the pinned version from the registry, verified against `bun.lock`; other platforms' packages throw; musl refused |
314
- | `terminalNativeTarget` / `TerminalNativeTarget` | function / _type_ | the native package a compile target needs |
315
-
316
- ### `stitchkit-tui/testing`
317
-
318
- | Export | Kind | Summary |
319
- |--------|------|---------|
320
- | `renderTerminalTest` / `TerminalTestScreen` / `TerminalTestOptions` | function / _type_ | a screen inside the kit's providers on a test terminal; `press`, `type`, `burst`, `advance`, `waitForText`, `resize` run inside React's `act` and wait out a lone Esc |
321
- | `TerminalTestKey` / `TerminalTestModifiers` | _type_ | the mock input's key names and modifiers |
@@ -0,0 +1,164 @@
1
+ # stitchkit/agent-runtime — stitchkit docs slice, part 6 of 6
2
+
3
+ > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
+ > `llms.txt` in this package.
5
+
6
+ Parts of this slice:
7
+ - `llms/agent-runtime.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
8
+ - `llms/agent-runtime.2.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
9
+ - `llms/agent-runtime.3.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
10
+ - `llms/agent-runtime.4.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
11
+ - `llms/agent-runtime.5.txt`: API reference: `stitchkit/agent-runtime` (docs/api/reference.md)
12
+ - `llms/agent-runtime.6.txt`: API reference: `stitchkit/agent-runtime` (docs/api/reference.md) · API reference: `stitchkit-tui` (docs/api/reference.md)
13
+
14
+ ==============================================================================
15
+ # API reference: `stitchkit/agent-runtime` (docs/api/reference.md) (continued)
16
+ ==============================================================================
17
+
18
+ ### Completion and agent invocation receipts
19
+
20
+ `createModelInvocationLedger` constructs a `ModelInvocationLedger` from
21
+ `ModelInvocationConfig`: the existing store and model registry, a 32-byte payload
22
+ key, required host authorization, optional bounded payload size and `onAttempt`.
23
+ `complete(input, context, signal?)` executes only the supplied prompt, with no tools
24
+ or framework instructions; repeated keys return the existing invocation ID. It
25
+ resolves `{ invocationId, outcome, text?, receiptError? }`: `receiptError` says a
26
+ receipt could not be written and never changes `outcome` or drops `text`.
27
+ `read(input, context)` returns a bounded event page shared by agent and completion;
28
+ `readPayload(input, context)` requires a separate authorization action and returns a
29
+ discriminated `ModelInvocationPayloadRead` (`available` with decrypted payload or `expired`
30
+ with `expiredAt` once redacted); `purgePayloads(input, context)` redacts expired ciphertext
31
+ in-place across the store and search indexes while retaining receipt metadata and digests.
32
+ When a request or response payload exceeds `maxPayloadBytes`, the provider call still succeeds
33
+ while recording `payloadOmitted: 'max-payload-bytes'` (with `artifactId` omitted and `payloadSha256`
34
+ preserved) and reporting `InvocationPayloadTooLargeError` through `complete().receiptError`. See the
35
+ [guide and migration example](../guide/agent-runtime.md#plain-completions-and-shared-invocation-receipts).
36
+
37
+ | Export | Kind | Purpose |
38
+ | --- | --- | --- |
39
+ | `CompletionInvocationInputSchema` / `CompletionInvocationInput` | schema/type | strict prompt, model-attempt list, deadline, idempotency key and trace input |
40
+ | `ModelInvocationTraceSchema` / `ModelInvocationTrace` | schema/type | operation, purpose, project, parent trace and optional experiment/case/profile |
41
+ | `ModelInvocationRecordSchema` / `ModelInvocationRecord` | schema/type | discriminated invocation start/finish and per-attempt requested/sent/effective evidence (with optional `artifactId` and `payloadOmitted` when oversized, keeping `payloadSha256`) |
42
+ | `InvocationPayloadTooLargeError` | class | `RangeError` carrying `{ bytes, maxBytes, sha256 }` when a recorded invocation payload exceeds `maxPayloadBytes` without aborting the provider call |
43
+ | `InvocationPayloadOmissionReasonSchema` / `InvocationPayloadOmissionReason` | schema/type | reason a payload body was not stored (`'max-payload-bytes'`) |
44
+ | `ModelInvocationPayloadReadSchema` / `ModelInvocationPayloadRead` | schema/type | discriminated result of `readPayload`: `{ status: 'available', payload, ... }` or `{ status: 'expired', expiredAt, ... }` |
45
+ | `PurgeInvocationPayloadsInputSchema` / `PurgeInvocationPayloadsInput` | schema/type | input for `purgePayloads` / `store.purgeExpiredPayloads`: `before`, optional `conversationId` and `limit` |
46
+ | `PurgeInvocationPayloadsResultSchema` / `PurgeInvocationPayloadsResult` | schema/type | result of `purgePayloads`: `purged`, `freedBytes`, and `hasMore` |
47
+ | `ModelInvocationAuthorizationInput` | type | discriminated authorization payload passed to `ModelInvocationConfig.authorize` (`'complete'`, `'agent'`, `'read'`, `'read-payload'`, or `'purge-payloads'`) |
48
+ | `ModelInvocationAttemptContext` | type | conversation, operation, invocation, attempt, step and optional agent run identity |
49
+ | `currentModelInvocationAttempt` | function | returns causal IDs inside the provider transport; undefined outside an invocation |
50
+ | `modelInvocationSpendAttribution` | function | the current attempt as `stitchkit/spend` attribution fields (conversation, run, invocation, attempt, step) — a spend gateway's `context` |
51
+ | `AgentStepBarriers` / `AgentToolCallDependencies` | _type_ | `loop.stepBarriers`, guards on each model step, checked by `createAgentRuntime`: `maxToolCallsPerStep` (a call past it is refused to the model as a `STEP_TOOL_CALL_LIMIT` tool error, without asking for its approval), `toolDependencies` (in the order the model made the calls, a read of an entity waits for the step's earlier writes of it and a write for its earlier reads and writes), `onPredecessorFailure` (`'run'` default, or `'refuse'` to fail-cascade dependent calls on the same entity with `STEP_PREDECESSOR_FAILED`), `maxReasoningCharsPerStep` (past it the run stops as `policy_stop`), `stepText: 'after-tools'` (a step's text is held to its end and shown only if none of its tool calls failed; held text of an interrupted step is not shown) |
52
+ | `AgentStepBarrierError` | class | the run stopped at a step bound: `bound` is `reasoning` |
53
+ | `createToolDependencyResolver` | function | `toolDependencies` from operation effects — the `effect` of each endpoint of `contracts`, under its mounted tool name, and `effects` (by tool name) for tools of no contract — and the application's `entityOf(toolName, input)`: a `write` tool writes its entity, a `read` tool reads it |
54
+
55
+ The runtime `invocations` option takes this ledger and a trace callback; it requires
56
+ the same store and preserves the existing tool loop. `AgentRuntimeStore.appendEventOnce`
57
+ is an optional atomic capability required by receipt admission, and
58
+ `AgentRuntimeStore.findEventOnce` reads the event it wrote by kind and key. Built-in
59
+ stores supply both; custom adapters must honor the once-only transaction contract.
60
+ A driver's optional `events.find(transaction, { conversationId, eventId })` makes
61
+ both one lookup instead of a scan of the conversation log.
62
+
63
+ ==============================================================================
64
+ # API reference: `stitchkit-tui` (docs/api/reference.md)
65
+ ==============================================================================
66
+
67
+ ## `stitchkit-tui`
68
+
69
+ Separate optional evolving Bun/OpenTUI package over a caller-composed headless harness.
70
+
71
+ | Export | Kind | Summary |
72
+ |--------|------|---------|
73
+ | `defineAgentTui` | function | typed config for title, `theme` (a `TerminalPalette` override) and `themeMode`, status rows, model catalog, context, commands, runtime bundle and optional host-evidenced recovery policy; the default never requeues acquired effects |
74
+ | `runAgentTui` | function | start one fresh durable conversation and terminal controller, recover durable work and publish its authenticated local session; `initialConversationId` is an explicit resume override; it closes the session and exits the process on Ctrl-C and every signal OpenTUI catches unless `exitSignals: []` |
75
+ | `defineTuiCommand` / `resolveTuiCommand` | function | typed composable slash-command registry; unknown slash input remains an ordinary model prompt |
76
+ | `createAgentTuiController` | function | single admission, selection, approval, interruption and conversation-switch owner over the harness |
77
+ | `startAgentTuiSessionHost` / `createAgentTuiClient` | function | authenticated mode-`0600` Unix-socket host/client for status, submit and interrupt through that controller |
78
+ | `listAgentTuiSessions` | function | discover live local terminal session IDs and their current conversation |
79
+ | `createAgentTuiComposer` / `navigateAgentTuiHistory` | function | multiline draft and reversible prompt-history state |
80
+ | `defaultAgentTuiStatusLine` / `AgentTuiStatusLineFormatter` | function / _type_ | terminal-native default rows and a host formatter over model capacity, durable snapshot, activity, workspace and local identities; `statusLine: false` hides the rows |
81
+ | `createAgentTuiDiagnosticRecorder` / `AgentTuiDiagnosticEventSchema` | function / schema | bounded per-session metadata journal that rejects prompt, reasoning, tool-input and provider-cause payloads before disk admission |
82
+
83
+ The `stitchkit-agent` binary runs React's production build unless `NODE_ENV` says otherwise and loads `stitchkit.agent.ts` by default and also exposes `sessions`,
84
+ `status`, `send` and `interrupt`. `--workspace` addresses a host outside the caller's cwd,
85
+ `send --idempotency-key` accepts caller-owned retry identity, and `interrupt` defaults to the
86
+ active run returned by `status`. Session descriptors and sockets are local control credentials,
87
+ not a remote API.
88
+ Interactive `/resume` and `/sessions` open the durable conversation picker. `/clear` creates a new
89
+ conversation and keeps the previous one available there; it is not a viewport-only operation.
90
+ The slash palette owns its highlighted selection: Up/Down move it, Tab completes it, Enter runs
91
+ the exact command and Escape dismisses it. Partial input is never submitted while the palette is
92
+ active; unknown slash text with no match remains an ordinary model prompt.
93
+
94
+ ### `stitchkit-tui/core`
95
+
96
+ Renderer-neutral state only. This entrypoint imports neither React/OpenTUI nor the agent runtime.
97
+
98
+ | Export | Kind | Summary |
99
+ |--------|------|---------|
100
+ | `createTerminalCollection` / `reduceTerminalCollection` | function | identity-stable live collection selection, reconciliation, windowing and resize |
101
+ | `createTerminalFeedViewport` / `reduceTerminalFeedViewport` | function | generic follow-tail, history anchoring, unseen and bounded visible-range state |
102
+ | `createTerminalPaneState` / `reduceTerminalPaneState` | function | bounded split-pane focus, resize and single-pane collapse |
103
+ | `createTerminalCommandPalette` / `terminalCommandMatches` | function | bounded command filtering and keyboard selection over a collision-validated registry |
104
+ | `resolveExactTerminalCommand` / `validateTerminalCommands` | function | exact dispatch and fail-closed name/alias validation |
105
+ | `createTerminalOperationState` / `reduceTerminalOperationState` | function | confirmation and single-pending-operation lifecycle |
106
+ | `createTerminalTable` / `reduceTerminalTable` / `projectTerminalTable` | function | live table: typed columns, rows validated on entry, sort with key tie-break and missing values last, tree expansion pruned to present rows, filter on displayed text, selection kept across data; a row's `tone` and a column's `tone(value, row)` colour state |
107
+ | `layoutTerminalTableColumns` / `formatTerminalTableCell` / `visibleTerminalTableRows` / `terminalTableTreePrefix` | function | fixed and flexible column widths, `—` for missing values, the virtualized window, tree indentation |
108
+ | `createTerminalList` / `reduceTerminalList` / `visibleTerminalListLines` | function | picker with sections, fuzzy query with title highlight ranges, multi-select, disabled items and "more above/below" counts |
109
+ | `createTerminalForm` / `reduceTerminalForm` / `readTerminalForm` / `terminalFormFieldsFromJsonSchema` | function | typed fields (text, secret, number, integer, boolean, choice, JSON) from a JSON Schema, relative text edits, validation on leave and submit |
110
+ | `createTerminalTabs` / `reduceTerminalTabs` | function | tabs with badges, wrap-around movement, digit selection and reconcile that keeps the selected tab |
111
+ | `createTerminalNavigation` / `reduceTerminalNavigation` / `terminalBreadcrumbs` | function | screen stack keeping each level's state, root never popped |
112
+ | `createTerminalFocus` / `reduceTerminalFocus` | function | focus ring plus layers that take the keyboard and give it back |
113
+ | `createTerminalNotices` / `reduceTerminalNotices` / `nextTerminalNoticeExpiry` | function | bounded toasts on a caller clock, replaced by id |
114
+ | `createTerminalTimeSeries` / `appendTerminalSample` / `sampleTerminalTimeSeries` | function | time window bounded by duration and sample count, value-in-force sampling with explicit gaps |
115
+ | `terminalBrailleChart` / `terminalSparkline` / `terminalTimeAxis` / `terminalChartScale` | function | multi-series braille line or area chart as toned runs, sparkline, time axis |
116
+ | `terminalMeter` / `layoutTerminalMeterGrid` | function | eighth-block bar toned by thresholds, unmeasured as muted; column-major core grid |
117
+ | `terminalProgress` / `terminalSpinnerFrame` / `terminalIndeterminateBlock` / `formatTerminalDuration` | function | ratio, rate and ETA only when knowable; spinner frames; indeterminate bar; elapsed time |
118
+ | `defineTerminalKeymap` / `matchTerminalKey` / `fitTerminalKeyHints` | function | conflict-checked bindings that both answer keys and draw a footer fitted to the width |
119
+ | `terminalTableKeymap` / `terminalTableKey` / `terminalTabsKeymap` / `terminalTabsKey` | function | htop-style table bindings and tab bindings as keymaps |
120
+ | `matchTerminalSearch` / `searchTerminalItems` / `terminalHighlightRuns` | function | multi-word fuzzy match with ranges, stable ranking, highlight runs |
121
+ | `sanitizeTerminalText` / `terminalTextWidth` / `truncateTerminalText` / `fitTerminalText` / `wrapTerminalText` | function | strip escape and control sequences; measure, cut, pad and wrap by terminal cells |
122
+ | `terminalTextEdit` / `applyTerminalTextEdit` | function | one-line edits as relative actions, so fast input is never lost |
123
+ | `terminalJsonLines` / `layoutTerminalDetails` | function | toned, sanitized JSON lines; aligned key/value pairs |
124
+ | `terminalPalettes` / `resolveTerminalPalette` / `TerminalPalette` / `TerminalTone` | value / function / _type_ | one semantic palette (surfaces plus `primary`, `muted`, `accent`, `success`, `warning`, `danger`) for dark and light terminals |
125
+ | `terminalLabelsEn` / `terminalLabelsRu` / `TerminalLabels` | value / _type_ | every word the widgets draw |
126
+
127
+ ### `stitchkit-tui/widgets`
128
+
129
+ OpenTUI React widgets over the core state. React, `@opentui/core` and `@opentui/react` are peers;
130
+ this entrypoint never loads `stitchkit`.
131
+
132
+ | Export | Kind | Summary |
133
+ |--------|------|---------|
134
+ | `TerminalAppShell` / `TerminalPanel` / `TerminalStatusBar` / `TerminalKeyHints` | component | breadcrumbs, status lines, body, fitted key hints and toast overlay; titled rounded panels with a focus frame |
135
+ | `TerminalTable` | component | virtualized live table with header sort marks, tree, filter line and htop keys; row and cell tones in the palette, bold or dim where colour is missing |
136
+ | `terminalToneAttributes` | function | the text attribute that carries a tone without colour: `danger` and `warning` bold, `muted` dim |
137
+ | `TerminalList` | component | sections, fuzzy search line with highlights, `›` cursor, meta, badges, multi-select, description |
138
+ | `runTerminalApp` / `RunTerminalAppOptions` / `RunningTerminalApp` | function / _type_ | start an application: renderer, theme and labels providers, the error boundary, and an exit with 128 + signal after `onClose` on Ctrl-C and every signal OpenTUI catches — a closed window leaves no orphan |
139
+ | `TerminalErrorBoundary` / `TERMINAL_EXIT_SIGNALS` / `TerminalExitSignal` | component / value / _type_ | draws a render error and its stack in place of the screen, where OpenTUI's own boundary renders nothing under production React |
140
+ | `TerminalForm` | component | fields edited in place, cycling choices, masked secrets, inline errors; a form without fields says so and submits `{}` on Enter |
141
+ | `TerminalTextView` / `TerminalJsonView` | component | pager over sanitized wrapped text or toned JSON |
142
+ | `TerminalMeter` / `TerminalMeterGrid` / `TerminalChart` / `TerminalSparkline` | component | htop meters and core grid; btop braille charts with axis |
143
+ | `TerminalTabs` / `TerminalDialog` / `TerminalSpinner` / `TerminalProgressBar` / `TerminalAsyncView` / `TerminalDetails` / `TerminalNotices` / `TerminalHelp` | component | views, confirmation, loading, progress, async states, details, toasts, key help |
144
+ | `TerminalThemeProvider` / `useTerminalPalette` / `useTerminalThemeMode` | component / hook | palette from the terminal's reported background (`auto`) or a fixed mode |
145
+ | `TerminalLabelsProvider` / `TerminalFocusProvider` / `useTerminalFocused` | component / hook | product language and shared focus |
146
+
147
+ The `stitchkit-tui-gallery` binary shows every widget live.
148
+
149
+ ### `stitchkit-tui/build`
150
+
151
+ Build-time only; imports Bun and no React.
152
+
153
+ | Export | Kind | Summary |
154
+ |--------|------|---------|
155
+ | `compileTerminalApp` / `CompileTerminalAppOptions` | function / _type_ | one standalone executable for any Bun compile target, from any machine, with React's production build defined |
156
+ | `terminalNativePlugin` / `TerminalNativePluginOptions` | function / _type_ | the `Bun.build` plugin behind it: the target's `@opentui/core-<os>-<arch>` at the pinned version from the registry, verified against `bun.lock`; other platforms' packages throw; musl refused |
157
+ | `terminalNativeTarget` / `TerminalNativeTarget` | function / _type_ | the native package a compile target needs |
158
+
159
+ ### `stitchkit-tui/testing`
160
+
161
+ | Export | Kind | Summary |
162
+ |--------|------|---------|
163
+ | `renderTerminalTest` / `TerminalTestScreen` / `TerminalTestOptions` | function / _type_ | a screen inside the kit's providers on a test terminal; `press`, `type`, `burst`, `advance`, `waitForText`, `resize` run inside React's `act` and wait out a lone Esc |
164
+ | `TerminalTestKey` / `TerminalTestModifiers` | _type_ | the mock input's key names and modifiers |