stitchkit 0.56.5 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-runtime/compaction.d.ts +3 -0
- package/dist/agent-runtime/compaction.d.ts.map +1 -1
- package/dist/agent-runtime/events.d.ts +693 -0
- package/dist/agent-runtime/events.d.ts.map +1 -1
- package/dist/agent-runtime/history.d.ts +13 -0
- package/dist/agent-runtime/history.d.ts.map +1 -1
- package/dist/agent-runtime/managed-tools.d.ts +1 -0
- package/dist/agent-runtime/managed-tools.d.ts.map +1 -1
- package/dist/agent-runtime/models.d.ts +39 -3
- package/dist/agent-runtime/models.d.ts.map +1 -1
- package/dist/agent-runtime/observability.d.ts +3 -0
- package/dist/agent-runtime/observability.d.ts.map +1 -1
- package/dist/agent-runtime/prompt.d.ts +21 -0
- package/dist/agent-runtime/prompt.d.ts.map +1 -1
- package/dist/agent-runtime/runtime.d.ts +43 -4
- package/dist/agent-runtime/runtime.d.ts.map +1 -1
- package/dist/agent-runtime/schemas.d.ts +75 -0
- package/dist/agent-runtime/schemas.d.ts.map +1 -1
- package/dist/agent-runtime/store-driver.d.ts +409 -0
- package/dist/agent-runtime/store-driver.d.ts.map +1 -0
- package/dist/agent-runtime/store.d.ts +169 -2
- package/dist/agent-runtime/store.d.ts.map +1 -1
- package/dist/agent-runtime/testing.d.ts +10 -1
- package/dist/agent-runtime/testing.d.ts.map +1 -1
- package/dist/agent-runtime.d.ts +7 -6
- package/dist/agent-runtime.d.ts.map +1 -1
- package/dist/agent-runtime.js +1157 -511
- package/dist/index-vtjgx3vv.js +161 -0
- package/dist/server/error-hook.d.ts +8 -1
- package/dist/server/error-hook.d.ts.map +1 -1
- package/dist/server/index.js +4 -2
- package/dist/testing/agent-store-conformance.d.ts +7 -0
- package/dist/testing/agent-store-conformance.d.ts.map +1 -0
- package/dist/testing.d.ts +2 -0
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +331 -0
- package/llms-full.txt +201 -28
- package/package.json +1 -1
package/llms-full.txt
CHANGED
|
@@ -3427,7 +3427,10 @@ const prompt = composeAgentPrompt([
|
|
|
3427
3427
|
const runtime = createAgentRuntime({
|
|
3428
3428
|
protocol,
|
|
3429
3429
|
store: createMemoryAgentRuntimeStore(),
|
|
3430
|
-
models: {
|
|
3430
|
+
models: {
|
|
3431
|
+
preflight: () => models.preflight('fast', ['tools']),
|
|
3432
|
+
resolve: () => models.resolve('fast', ['tools']),
|
|
3433
|
+
},
|
|
3431
3434
|
prompt: ({ context, signal, model }) =>
|
|
3432
3435
|
prompt({
|
|
3433
3436
|
context,
|
|
@@ -3482,7 +3485,8 @@ const terminal = await ticket.result
|
|
|
3482
3485
|
|
|
3483
3486
|
`recordIds` is optional. Supply stable application record IDs when an accepted-response transport must
|
|
3484
3487
|
return durable placeholders before the run finishes. `ticket.admission` resolves after the store
|
|
3485
|
-
acceptance CAS and reports the
|
|
3488
|
+
acceptance CAS and reports the canonical committed `input`, assigned `run`, a typed `pending`
|
|
3489
|
+
assistant projection, compatibility IDs and snapshot version.
|
|
3486
3490
|
Those assigned IDs can differ from the proposal when an input coalesces into an existing queued
|
|
3487
3491
|
successor. Reuse the same `inputMessageId` for retries carrying the same idempotency key; input
|
|
3488
3492
|
identity is caller-stable, while the receipt reports the run/assistant identities that assignment
|
|
@@ -3490,8 +3494,35 @@ may change. Await `admission` first on the immediate accepted-response path. `ti
|
|
|
3490
3494
|
remains the signal-only compatibility surface and additionally waits for admission publication.
|
|
3491
3495
|
|
|
3492
3496
|
The in-memory store is a reference adapter and has process-local durability
|
|
3493
|
-
only. Production applications
|
|
3494
|
-
database transaction
|
|
3497
|
+
only. Production applications normally call `createAgentRuntimeStore()` and
|
|
3498
|
+
provide one database transaction driver:
|
|
3499
|
+
|
|
3500
|
+
```ts
|
|
3501
|
+
const store = createAgentRuntimeStore({
|
|
3502
|
+
transaction: work => db.transaction(tx => work(tx)),
|
|
3503
|
+
state: {
|
|
3504
|
+
load: (tx, conversationId) => loadRuntimeState(tx, conversationId),
|
|
3505
|
+
compareAndSwap: (tx, operation) => casRuntimeState(tx, operation),
|
|
3506
|
+
},
|
|
3507
|
+
history: {
|
|
3508
|
+
load: (tx, conversationId) => loadCanonicalMessages(tx, conversationId),
|
|
3509
|
+
loadById: (tx, identity) => loadActiveOrArchivedMessage(tx, identity),
|
|
3510
|
+
apply: (tx, mutation) => applyCanonicalHistoryMutation(tx, mutation),
|
|
3511
|
+
},
|
|
3512
|
+
scanRecoverable: page => scanRecoverableRuns(page),
|
|
3513
|
+
})
|
|
3514
|
+
```
|
|
3515
|
+
|
|
3516
|
+
The same opaque `tx` reaches state and history callbacks. The adapter maps rows
|
|
3517
|
+
and supplies atomicity; Stitchkit owns transition validation and revision
|
|
3518
|
+
arithmetic. The executable reference is
|
|
3519
|
+
[`examples/agent-store-prisma/adapter.ts`](../../examples/agent-store-prisma/adapter.ts).
|
|
3520
|
+
`compareAndSwap` returns either `{ outcome: 'applied' }` or
|
|
3521
|
+
`{ outcome: 'conflict', actualVersion }`; on a winning write it also persists the
|
|
3522
|
+
framework-provided `recoverable` descriptors in the same transaction. Recovery
|
|
3523
|
+
scans that bounded index instead of loading every aggregate. Compaction may hide
|
|
3524
|
+
rows from `history.load`, but `history.loadById` must retain canonical admitted
|
|
3525
|
+
inputs for durable duplicate receipts.
|
|
3495
3526
|
|
|
3496
3527
|
## Durable order
|
|
3497
3528
|
|
|
@@ -3533,8 +3564,8 @@ hatch.
|
|
|
3533
3564
|
|
|
3534
3565
|
## Store operations
|
|
3535
3566
|
|
|
3536
|
-
|
|
3537
|
-
|
|
3567
|
+
`AgentRuntimeStore` remains the runtime-facing aggregate. Application adapters
|
|
3568
|
+
implement the smaller `AgentRuntimeStoreDriver`, not these eight transitions:
|
|
3538
3569
|
|
|
3539
3570
|
- `acceptInputAndAssignRun`
|
|
3540
3571
|
- `acquireRun`
|
|
@@ -3549,13 +3580,17 @@ Every mutation carries an expected run revision or snapshot version. Input
|
|
|
3549
3580
|
assignment additionally carries an idempotency identity. A conflict is a
|
|
3550
3581
|
control outcome; stale data is never silently overwritten.
|
|
3551
3582
|
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
`runtime.
|
|
3557
|
-
|
|
3558
|
-
|
|
3583
|
+
Acquisition increments an optional monotonic `fencingToken`. The managed runtime carries it through
|
|
3584
|
+
checkpoint/terminal CAS and tool context, so a distributed adapter can reject an old owner even if
|
|
3585
|
+
an owner label is reused. Lease expiry and renewal remain application-owned.
|
|
3586
|
+
|
|
3587
|
+
On startup, `runtime.recover({ resolveContext })` consumes bounded lightweight
|
|
3588
|
+
pages. Its safe default resumes queued runs and reports acquired or
|
|
3589
|
+
`interrupt_requested` runs as skipped. A policy may requeue acquired work only
|
|
3590
|
+
with explicit replay-safe evidence, or abandon it only with stale-owner
|
|
3591
|
+
evidence. Each attempted run returns its own outcome/error; `pageSize`,
|
|
3592
|
+
`maxRuns`, and `signal` bound the pass. `runtime.resume(...)` remains available
|
|
3593
|
+
for one known queued record.
|
|
3559
3594
|
|
|
3560
3595
|
Canonical records currently write `schemaVersion: 1`. A durable adapter owns
|
|
3561
3596
|
read-time migration of older rows: migrate to the current shape at its storage
|
|
@@ -3567,6 +3602,9 @@ or silently accept an unknown future version.
|
|
|
3567
3602
|
|
|
3568
3603
|
`publish` receives event classes with different guarantees:
|
|
3569
3604
|
|
|
3605
|
+
- `admission` follows a successful acceptance CAS and carries the same complete
|
|
3606
|
+
projection as `ticket.admission`;
|
|
3607
|
+
|
|
3570
3608
|
- `assistant-delta` is transient and ordered by
|
|
3571
3609
|
`(runId, runtimeEpoch, sequence)`;
|
|
3572
3610
|
- `reasoning-start`, `reasoning-delta` and `reasoning-end` are transient and
|
|
@@ -3578,6 +3616,16 @@ or silently accept an unknown future version.
|
|
|
3578
3616
|
start and output on completion; internal tool failures remain generic;
|
|
3579
3617
|
- `terminal` follows the winning terminal CAS.
|
|
3580
3618
|
|
|
3619
|
+
These are post-commit notifications, not a transactional outbox: a process can
|
|
3620
|
+
crash between the database commit and `publish`. Reconnect should load canonical
|
|
3621
|
+
state. Exactly-once external delivery remains an application-owned outbox.
|
|
3622
|
+
|
|
3623
|
+
Durable event IDs are derived from run, event type and snapshot version. Use
|
|
3624
|
+
`advanceAgentRuntimeEventCursor` to classify accepted, duplicate and gap delivery; a gap triggers a
|
|
3625
|
+
snapshot reload. `createAgentRuntimeEventSink` adds a bounded failure-isolated lifecycle and typed
|
|
3626
|
+
projection/redaction hook. `onPublishError` records direct publisher failures without changing the
|
|
3627
|
+
already committed run.
|
|
3628
|
+
|
|
3581
3629
|
A named custom stop condition terminalizes with `policy_stop`; its `policyName`
|
|
3582
3630
|
is persisted on the run and included in the terminal event/result. `max-steps`
|
|
3583
3631
|
is the reserved built-in policy name. `loop.prepareStep` is the controlled AI
|
|
@@ -3608,6 +3656,14 @@ effect must be replay-safe.
|
|
|
3608
3656
|
`projectAgentHistory` converts canonical engine records into provider-valid AI
|
|
3609
3657
|
SDK messages and pairs tool calls/results. Provider-required metadata is kept
|
|
3610
3658
|
in a versioned opaque envelope and omitted from product delivery by default.
|
|
3659
|
+
`projectAgentHistoryDetailed` additionally returns one inspectable decision per canonical record;
|
|
3660
|
+
leading assistant records, crash drafts and unmatched tool chronology are never silently passed to
|
|
3661
|
+
the provider.
|
|
3662
|
+
|
|
3663
|
+
`selectAgentHistory` is the non-destructive context-window selector. It removes only whole oldest
|
|
3664
|
+
complete turns, protects system/summary, incomplete and configured recent turns, and reports every
|
|
3665
|
+
keep/remove reason with measured/estimated/unavailable token provenance. An oversized protected turn
|
|
3666
|
+
returns `oversized`; unavailable accounting returns `unavailable` without invented arithmetic.
|
|
3611
3667
|
|
|
3612
3668
|
`ComposedAgentPrompt.instructions` accepts the AI SDK `Instructions` contract.
|
|
3613
3669
|
Use `adaptInstructions` when a provider needs metadata on the system message:
|
|
@@ -3644,22 +3700,32 @@ provider system message. The consumer supplies the structured summary schema
|
|
|
3644
3700
|
and prompt. Pass `previousSummary` for a direct call, or configure
|
|
3645
3701
|
`readPreviousSummary` for runtime-managed compaction, to merge and atomically
|
|
3646
3702
|
replace a leading summary on the next compaction.
|
|
3703
|
+
Set `maxAttempts` to allow bounded conflict recovery. Every retry reloads the snapshot, reselects the
|
|
3704
|
+
eligible range and recomputes the summary; the stale summary is never retried.
|
|
3647
3705
|
|
|
3648
3706
|
## Observability
|
|
3649
3707
|
|
|
3650
3708
|
`createAgentObservability` emits a separate operator-only `AgentRunEvent`. It
|
|
3651
3709
|
reuses the same bounded sink lifecycle as request/tool observability without
|
|
3652
3710
|
sending new event kinds to existing request sinks. Product events omit provider
|
|
3653
|
-
causes
|
|
3654
|
-
|
|
3711
|
+
causes. Operator `internalCause` is also redacted by default; an operator-only sink must explicitly
|
|
3712
|
+
set `includeInternalCause` and own its retention policy.
|
|
3655
3713
|
|
|
3656
3714
|
Usage values carry `provider-reported`, `computed`, `estimated` or
|
|
3657
3715
|
`unavailable` provenance. Cost additionally carries an ISO currency code;
|
|
3658
3716
|
OpenRouter-reported cost is normalized as USD. Missing values remain absent,
|
|
3659
3717
|
never zero-filled.
|
|
3660
3718
|
|
|
3661
|
-
|
|
3662
|
-
|
|
3719
|
+
The sink deduplicates stable event IDs by default. Cross-crash exactly-once still requires a durable
|
|
3720
|
+
outbox.
|
|
3721
|
+
|
|
3722
|
+
## Deterministic race and adapter proof
|
|
3723
|
+
|
|
3724
|
+
`stitchkit/testing` exports `createAgentRaceBarrier`, `createAgentRaceDriver` and
|
|
3725
|
+
`createAgentRaceTrace`. Barriers have bounded teardown, traces assert exact partial order, and the
|
|
3726
|
+
helpers are exercised from packed Bun and Node consumers. `runAgentStoreConformance` runs duplicate,
|
|
3727
|
+
coalescing, collision, stale checkpoint, replay safety, terminal race, compaction and recovery
|
|
3728
|
+
invariants against any fresh durable adapter.
|
|
3663
3729
|
|
|
3664
3730
|
|
|
3665
3731
|
==============================================================================
|
|
@@ -5132,7 +5198,7 @@ never-leak-an-internal-message rule for a raw throw):
|
|
|
5132
5198
|
|
|
5133
5199
|
```ts
|
|
5134
5200
|
const onError = createErrorHook({
|
|
5135
|
-
// Map the codes you have an opinion about
|
|
5201
|
+
// Map the codes you have an opinion about.
|
|
5136
5202
|
codeMap: {
|
|
5137
5203
|
BAD_REQUEST: 'bad_request', VALIDATION_ERROR: 'bad_request',
|
|
5138
5204
|
UNAUTHORIZED: 'unauthenticated', FORBIDDEN: 'forbidden',
|
|
@@ -5140,6 +5206,9 @@ const onError = createErrorHook({
|
|
|
5140
5206
|
CONFLICT: 'conflict', RATE_LIMITED: 'rate_limited',
|
|
5141
5207
|
INTERNAL_SERVER_ERROR: 'internal',
|
|
5142
5208
|
},
|
|
5209
|
+
// Optional: one public vocabulary entry for every other stitchkit code.
|
|
5210
|
+
// A resolver `(code) => ...` is also accepted for grouping code families.
|
|
5211
|
+
unmappedCode: 'framework_error',
|
|
5143
5212
|
// `ctx` is the request's RuntimeContext — read `ctx.traceId` for a
|
|
5144
5213
|
// correlation id in the envelope. Declaring it is optional.
|
|
5145
5214
|
render: (info, ctx) => ({
|
|
@@ -5152,10 +5221,13 @@ const onError = createErrorHook({
|
|
|
5152
5221
|
createServer({ services, hooks: { onError } })
|
|
5153
5222
|
```
|
|
5154
5223
|
|
|
5155
|
-
`codeMap` is partial: map the codes you have an opinion about.
|
|
5156
|
-
you did not list travels as itself
|
|
5157
|
-
|
|
5158
|
-
|
|
5224
|
+
`codeMap` is partial: map the codes you have an opinion about. By default a
|
|
5225
|
+
stitchkit code you did not list travels as itself. Set `unmappedCode` to one
|
|
5226
|
+
wire-code when your public vocabulary has a catch-all, or to a function such as
|
|
5227
|
+
`(code) => code.startsWith('FILE_') ? 'storage_error' : 'framework_error'` when
|
|
5228
|
+
framework code families need different buckets. An explicit `codeMap` entry
|
|
5229
|
+
always wins. Codes your project throws itself do not belong to Stitchkit's
|
|
5230
|
+
vocabulary, so they never pass through this fallback and remain unchanged.
|
|
5159
5231
|
|
|
5160
5232
|
One `satisfies` is the **opt-in** to the stricter deal:
|
|
5161
5233
|
|
|
@@ -5167,9 +5239,7 @@ That makes the map exhaustive on your side, so a release that adds a code stops
|
|
|
5167
5239
|
your build until you decide what the new code is called on your wire. Take it
|
|
5168
5240
|
when your envelope is a published contract and a code surfacing in stitchkit's
|
|
5169
5241
|
spelling would violate it; leave it off when passing one through is fine.
|
|
5170
|
-
Neither choice is silent — the changelog names every added code.
|
|
5171
|
-
catch-all instead of either, decide it in `render`, where `info.code` is the
|
|
5172
|
-
resolved value.
|
|
5242
|
+
Neither choice is silent — the changelog names every added code.
|
|
5173
5243
|
|
|
5174
5244
|
Both `onError` and `render` may be asynchronous and receive the matched endpoint
|
|
5175
5245
|
as their final argument. The observer is awaited before rendering, so it can
|
|
@@ -6506,6 +6576,34 @@ current one *up to* your target, and apply each snippet.
|
|
|
6506
6576
|
runtime): bootstrap the server, one HTTP request, and any feature you rely on
|
|
6507
6577
|
(Socket.IO connect, an MCP tool call, a multipart upload, …).
|
|
6508
6578
|
|
|
6579
|
+
## Unreleased migration: complete agent admission identity
|
|
6580
|
+
|
|
6581
|
+
Custom `AgentRuntimeStore` adapters must persist and return the input and
|
|
6582
|
+
assistant identities associated with an idempotency key:
|
|
6583
|
+
|
|
6584
|
+
```ts
|
|
6585
|
+
// before
|
|
6586
|
+
return { outcome: 'duplicate', runId, snapshot }
|
|
6587
|
+
|
|
6588
|
+
// after
|
|
6589
|
+
return { outcome: 'duplicate', input, inputMessageId, runId, assistantMessageId, snapshot }
|
|
6590
|
+
```
|
|
6591
|
+
|
|
6592
|
+
Prefer replacing the custom aggregate reducer with `createAgentRuntimeStore()`;
|
|
6593
|
+
its `AgentStoredState.admissions` record and transaction driver implement this
|
|
6594
|
+
contract automatically. `history.loadById()` must retain access to compacted
|
|
6595
|
+
admitted inputs so the framework can return the canonical record.
|
|
6596
|
+
|
|
6597
|
+
`AgentRuntimeEvent` also adds a post-commit `admission` variant. Add it to any
|
|
6598
|
+
exhaustive publisher switch. Its `assistant` is either the pending placeholder
|
|
6599
|
+
for a new assignment or the canonical persisted assistant for a duplicate:
|
|
6600
|
+
|
|
6601
|
+
```ts
|
|
6602
|
+
case 'admission':
|
|
6603
|
+
await persistProductProjection(event.input, event.run, event.assistant)
|
|
6604
|
+
break
|
|
6605
|
+
```
|
|
6606
|
+
|
|
6509
6607
|
## Released migration: 0.56.0
|
|
6510
6608
|
|
|
6511
6609
|
### Surface manifests are version 2
|
|
@@ -7819,7 +7917,7 @@ Also re-exports the error helpers from `stitchkit/contract`.
|
|
|
7819
7917
|
| `createAuthHook` | function | one scope gate for HTTP `authorize` and tool `beforeHandle` — [guide](../guide/auth-and-errors.md#createauthhook) |
|
|
7820
7918
|
| `composeAuthHooks` | function | route multiple canonical auth domains by owned scope and atomically commit their typed contributions |
|
|
7821
7919
|
| `createErrorHook` | function | an async-capable, endpoint-aware `onError` hook from a code map + envelope renderer — [guide](../guide/auth-and-errors.md#createerrorhook) |
|
|
7822
|
-
| `ErrorHookConfig` | _type_ | async observer/renderer config
|
|
7920
|
+
| `ErrorHookConfig` | _type_ | async observer/renderer config with partial `codeMap` and optional typed `unmappedCode` fallback |
|
|
7823
7921
|
| `ResolvedError` | _type_ | the normalised error handed to `createErrorHook`'s `render` |
|
|
7824
7922
|
| `createBearerResolver` | function | a bearer-token identity resolver |
|
|
7825
7923
|
| `signJwt` | function | sign an HS256 JWT |
|
|
@@ -7945,6 +8043,10 @@ Server-only optional application runtime. See the
|
|
|
7945
8043
|
| `defineAgentProtocol` | function | declare and validate context, input metadata and canonical message parts |
|
|
7946
8044
|
| `AgentMessageSchema` / `AgentRunSchema` / `AgentSnapshotSchema` | schema | versioned canonical engine records |
|
|
7947
8045
|
| `AgentRuntimeStore` | _type_ | aggregate CAS transaction boundary for message, run and compaction mutations |
|
|
8046
|
+
| `createAgentRuntimeStore` | function | build the aggregate store from one coherent transaction driver; framework owns every state transition |
|
|
8047
|
+
| `AgentRuntimeStoreDriver` | _type_ | ORM-neutral transactional state load/exact-version CAS, active-plus-archived history codec and bounded recoverable-run index scan |
|
|
8048
|
+
| `AgentStoredStateSchema` | schema | versioned runs and full idempotency admission identities without duplicated message history |
|
|
8049
|
+
| `AgentHistoryMutationSchema` | schema | typed canonical message mutation applied inside the winning state transaction |
|
|
7948
8050
|
| `RecoverAgentRunSchema` | schema | explicit abandon/requeue recovery decision; acquired runs require replay-safe evidence |
|
|
7949
8051
|
| `createMemoryAgentRuntimeStore` | function | process-local reference adapter, not production durability |
|
|
7950
8052
|
| `projectAgentHistory` | function | asynchronously project canonical records and resolved multimodal files into provider-valid AI SDK messages |
|
|
@@ -7955,13 +8057,80 @@ Server-only optional application runtime. See the
|
|
|
7955
8057
|
| `AgentRuntimeStopPolicy` | _type_ | named custom AI SDK stop condition persisted and published on policy stop |
|
|
7956
8058
|
| `AgentRuntimePrepareStep` | _type_ | per-run controlled step callback with typed domain context and managed run signal/fence |
|
|
7957
8059
|
| `AgentRuntimeRecordIds` | _type_ | optional caller-provided input, run and assistant IDs for stable application records |
|
|
7958
|
-
| `AgentRuntimeAdmission` | _type_ |
|
|
8060
|
+
| `AgentRuntimeAdmission` | _type_ | canonical committed input, assigned run, pending assistant projection, compatibility IDs and snapshot version |
|
|
8061
|
+
| `AgentAdmissionEventSchema` | schema | post-commit admission projection; removes store rereads but does not imply exactly-once delivery |
|
|
8062
|
+
| `AgentRunMetricsSchema` | schema | optional provenance-aware usage and timings; `partial` distinguishes checkpoint from terminal totals |
|
|
8063
|
+
| `AgentRuntimeRecoverOptions` | _type_ | bounded paged startup recovery with context resolver and explicit evidence policy |
|
|
7959
8064
|
| `AgentSessionCloseOptions` | _type_ | natural `drainTimeoutMs` followed by shutdown abort and optional bounded `forceTimeoutMs` settlement wait |
|
|
7960
8065
|
| `AgentHistoryProjectionOptions` | _type_ | storage-neutral file resolver and explicit unresolved-file behavior |
|
|
7961
8066
|
| `createAgentToolFenceLifecycle` | function | pre-effect and post-effect run ownership fence for `mountAgent` |
|
|
7962
|
-
| `AgentRuntimeEventSchema` | schema | transient
|
|
8067
|
+
| `AgentRuntimeEventSchema` | schema | transient stream lifecycle plus post-commit admission/checkpoint/run-state/terminal projections |
|
|
7963
8068
|
| `createAgentObservability` | function | separate agent-run sink over the shared bounded observability lifecycle |
|
|
7964
8069
|
|
|
8070
|
+
### Complete runtime inventory
|
|
8071
|
+
|
|
8072
|
+
The entrypoint deliberately exports the schemas beside their inferred types so persistence and
|
|
8073
|
+
transport adapters validate the same records. Runtime composition types are `AgentRuntime`,
|
|
8074
|
+
`AgentRuntimeConfig`, `AgentRuntimeInput`, `AgentRuntimeProtocolInput`, `AgentRuntimeRunContext`,
|
|
8075
|
+
`AgentRuntimeResult`, `AgentRuntimeInterruptInput`, `AgentRuntimeRecoveryInput`,
|
|
8076
|
+
`AgentRuntimeRecoveryDecision`, `AgentRuntimeRecoveryOutcome`, `AgentRuntimePublisher`,
|
|
8077
|
+
`AgentInputPolicy`, `AgentStopReason`, `AgentCoordinatedRun`, `AgentRunTicket`,
|
|
8078
|
+
`AgentSessionCoordinator`, `AgentCompactionContext`, `AgentCompactionResult` and
|
|
8079
|
+
`StructuredCompactionConfig`.
|
|
8080
|
+
|
|
8081
|
+
Canonical protocol exports are `AgentProtocol`, `AgentProtocolConfig`, `AgentRecordIdSchema`, `AgentRecordVersionSchema`,
|
|
8082
|
+
`AgentTimestampSchema`, `AgentJsonObjectSchema`, `AgentProviderEnvelopeSchema`,
|
|
8083
|
+
`AgentProviderEnvelope`, `AgentMessagePartSchema`, `AgentMessagePart`, `AgentTextPartSchema`,
|
|
8084
|
+
`AgentReasoningPartSchema`, `AgentFilePartSchema`, `AgentSourcePartSchema`,
|
|
8085
|
+
`AgentToolCallPartSchema`, `AgentToolResultPartSchema`, `AgentOpaquePartSchema`,
|
|
8086
|
+
`AgentControlPartSchema`, `AgentMessageRoleSchema`, `AgentMessageStatusSchema`, `AgentMessage`,
|
|
8087
|
+
`AgentAssistantPlaceholderSchema`, `AgentAssistantPlaceholder`, `AgentRunStateSchema`,
|
|
8088
|
+
`AgentTerminalReasonSchema`, `AgentTerminalReason`, `AgentRun`, `AgentSnapshot`,
|
|
8089
|
+
`AgentUsageValueSchema`, `AgentCostValueSchema`, `AgentUsageSchema`, `AgentUsage` and
|
|
8090
|
+
`AgentRunMetrics`.
|
|
8091
|
+
|
|
8092
|
+
Store command/result exports are `AcceptInputAndAssignRun`, `AcceptInputAndAssignRunSchema`,
|
|
8093
|
+
`AcquireAgentRun`, `AcquireAgentRunSchema`, `CheckpointRunAssistant`,
|
|
8094
|
+
`CheckpointRunAssistantSchema`, `CommitRunTerminal`, `CommitRunTerminalSchema`,
|
|
8095
|
+
`RequestRunInterrupt`, `RequestRunInterruptSchema`, `RecoverAgentRun`, `ReplaceCompactedRange`,
|
|
8096
|
+
`ReplaceCompactedRangeSchema`, `AgentStoreMutationResult`, `AgentStoreMutationResultSchema`,
|
|
8097
|
+
`AgentStoreAppliedSchema`, `AgentStoreConflictSchema`, `AgentStoreDuplicateSchema`,
|
|
8098
|
+
`AgentStoreNotFoundSchema`, `AgentAdmissionIdentity`, `AgentAdmissionIdentitySchema`,
|
|
8099
|
+
`AgentStoredState`, `AgentStoreCompareAndSwapResult`, `AgentHistoryMutation`,
|
|
8100
|
+
`AgentRecoverableDescriptor`, `AgentRecoverableDescriptorSchema`, `AgentRecoverablePage` and
|
|
8101
|
+
`AgentRecoverablePageSchema`.
|
|
8102
|
+
|
|
8103
|
+
History and context-budget exports are `projectAgentHistoryDetailed`,
|
|
8104
|
+
`AgentHistoryProjectionDecision`, `AgentHistoryProjectionResult`, `selectAgentHistory`,
|
|
8105
|
+
`SelectAgentHistoryOptions`, `AgentHistoryBudgetDecision`, `AgentHistoryBudgetResult`,
|
|
8106
|
+
`AgentPromptBudget`, `AgentPromptSection`, `AgentPromptSectionContext`, `AgentTokenCount`,
|
|
8107
|
+
`AgentTokenCountSchema`, `ComposeAgentPromptOptions` and `ComposedAgentPrompt`. Whole-turn history
|
|
8108
|
+
selection never splits a tool chronology and reports why every canonical record was retained or
|
|
8109
|
+
removed.
|
|
8110
|
+
|
|
8111
|
+
Model exports are `AgentLanguageModelProvider`, `AgentModelCapability`,
|
|
8112
|
+
`AgentModelCapabilitySchema`, `AgentModelDeclaration`, `AgentModelDescriptor`,
|
|
8113
|
+
`AgentModelDescriptorSchema`, `AgentModelRegistry`, `AgentModelRegistryConfig`,
|
|
8114
|
+
`AgentModelRegistrySnapshot`, `AgentModelRegistrySnapshotSchema`, `AgentModelSnapshotPolicy`,
|
|
8115
|
+
`AgentResolvedModel` and `validateAgentModelSnapshot`. Registry `preflight` validates availability,
|
|
8116
|
+
provider and required capabilities without constructing the model; runtime `models.preflight`
|
|
8117
|
+
runs before durable admission.
|
|
8118
|
+
|
|
8119
|
+
Delivery exports are `AgentAdmissionEventSchema`, `AgentCheckpointEventSchema`,
|
|
8120
|
+
`AgentRunStateEventSchema`, `AgentTerminalEventSchema`, `AgentTransientDeltaEventSchema`,
|
|
8121
|
+
`AgentReasoningStartEventSchema`, `AgentReasoningDeltaEventSchema`,
|
|
8122
|
+
`AgentReasoningEndEventSchema`, `AgentToolStatusEventSchema`, `AgentRuntimeEvent`,
|
|
8123
|
+
`AgentRuntimeEventCursor`, `AgentRuntimeEventCursorSchema`, `AgentRuntimeCursorAdvance`,
|
|
8124
|
+
`advanceAgentRuntimeEventCursor`, `agentDurableEventId`, `AgentRuntimeEventSink`,
|
|
8125
|
+
`AgentRuntimeEventSinkConfig` and `createAgentRuntimeEventSink`. Cursor gaps require a canonical
|
|
8126
|
+
snapshot reload; the bounded sink isolates transport failure and supports a typed projection step.
|
|
8127
|
+
|
|
8128
|
+
Managed effects and operator telemetry additionally export `AgentToolFenceConfig`,
|
|
8129
|
+
`AgentToolFenceContext`, `AgentObservability`, `AgentRunEvent`, `AgentRunEventSchema`,
|
|
8130
|
+
`AgentRunSinkConfig`, `AgentRunSinkDrop` and `AgentRunSinkError`. A monotonic run `fencingToken`
|
|
8131
|
+
may accompany checkpoint/terminal writes and tool context; internal causes are redacted unless an
|
|
8132
|
+
operator-only observability sink explicitly opts in.
|
|
8133
|
+
|
|
7965
8134
|
## `stitchkit/agent-runtime/openrouter`
|
|
7966
8135
|
|
|
7967
8136
|
| Export | Kind | Summary |
|
|
@@ -8297,6 +8466,10 @@ handler pipeline without opening a TCP port.
|
|
|
8297
8466
|
|--------|------|---------|
|
|
8298
8467
|
| `createHandlerTestClient` | function | one contract client backed by an in-process `FetchHandler` |
|
|
8299
8468
|
| `createHandlerTestClients` | function | exact contract-registry batch form |
|
|
8469
|
+
| `runAgentStoreConformance` | function | reusable black-box duplicate/coalescing/stale/recovery contract for durable agent-store adapters |
|
|
8470
|
+
| `AgentStoreConformanceConfig` | _type_ | factory configuration for running the same contract against a fresh adapter |
|
|
8471
|
+
| `createAgentRaceBarrier` / `createAgentRaceDriver` / `createAgentRaceTrace` | function | bounded named barriers and exact partial-order traces for deterministic runtime race probes |
|
|
8472
|
+
| `AgentRaceBarrier` / `AgentRaceDriver` / `AgentRaceTrace` / `AgentRaceTraceEntry` | _type_ | public packed-consumer types for the deterministic race harness |
|
|
8300
8473
|
| `HandlerTestClientDefaults` | _type_ | ordinary bare-client defaults with handler-owned `baseUrl` and `fetch` removed |
|
|
8301
8474
|
| `HandlerTestClientConfig` | _type_ | handler, contract, path prefix, scoped config and client request defaults |
|
|
8302
8475
|
| `HandlerTestClientsConfig` | _type_ | batch helper configuration |
|
package/package.json
CHANGED