stitchkit 0.85.2 → 0.87.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/CHANGELOG.md +243 -0
- package/README.md +3 -0
- package/dist/agent-runtime/agent-tool.d.ts +25 -0
- package/dist/agent-runtime/agent-tool.d.ts.map +1 -0
- package/dist/agent-runtime/child-tools.d.ts +69 -0
- package/dist/agent-runtime/child-tools.d.ts.map +1 -0
- package/dist/agent-runtime/children.d.ts +113 -0
- package/dist/agent-runtime/children.d.ts.map +1 -0
- package/dist/agent-runtime/coding-tool-contract.d.ts +29 -0
- package/dist/agent-runtime/coding-tool-contract.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-refusals.d.ts +2 -0
- package/dist/agent-runtime/coding-tool-refusals.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tool-shell.d.ts.map +1 -1
- package/dist/agent-runtime/coding-tools.d.ts +1 -0
- package/dist/agent-runtime/coding-tools.d.ts.map +1 -1
- package/dist/agent-runtime/control-schema.d.ts +17 -0
- package/dist/agent-runtime/control-schema.d.ts.map +1 -1
- package/dist/agent-runtime/conversations.d.ts +11 -0
- package/dist/agent-runtime/conversations.d.ts.map +1 -1
- package/dist/agent-runtime/event-schema.d.ts +34 -0
- package/dist/agent-runtime/event-schema.d.ts.map +1 -1
- package/dist/agent-runtime/event-search-tools.d.ts +53 -0
- package/dist/agent-runtime/event-search-tools.d.ts.map +1 -0
- package/dist/agent-runtime/event-search.d.ts +23 -0
- package/dist/agent-runtime/event-search.d.ts.map +1 -0
- package/dist/agent-runtime/fault-bench.d.ts +45 -0
- package/dist/agent-runtime/fault-bench.d.ts.map +1 -0
- package/dist/agent-runtime/observability.d.ts +6 -0
- package/dist/agent-runtime/observability.d.ts.map +1 -1
- package/dist/agent-runtime/projections.d.ts +69 -0
- package/dist/agent-runtime/projections.d.ts.map +1 -0
- package/dist/agent-runtime/provider-failure.d.ts +5 -1
- package/dist/agent-runtime/provider-failure.d.ts.map +1 -1
- package/dist/agent-runtime/provider-origin.d.ts +12 -0
- package/dist/agent-runtime/provider-origin.d.ts.map +1 -0
- package/dist/agent-runtime/retry-policy.d.ts +27 -0
- package/dist/agent-runtime/retry-policy.d.ts.map +1 -0
- package/dist/agent-runtime/run-execution.d.ts +0 -9
- package/dist/agent-runtime/run-execution.d.ts.map +1 -1
- package/dist/agent-runtime/run-operation-lifecycle.d.ts.map +1 -1
- package/dist/agent-runtime/runtime.d.ts +15 -0
- package/dist/agent-runtime/runtime.d.ts.map +1 -1
- package/dist/agent-runtime/sandbox.d.ts +66 -0
- package/dist/agent-runtime/sandbox.d.ts.map +1 -0
- package/dist/agent-runtime/schedule-tools.d.ts +35 -0
- package/dist/agent-runtime/schedule-tools.d.ts.map +1 -0
- package/dist/agent-runtime/schedules.d.ts +63 -0
- package/dist/agent-runtime/schedules.d.ts.map +1 -0
- package/dist/agent-runtime/schemas.d.ts +9 -0
- package/dist/agent-runtime/schemas.d.ts.map +1 -1
- package/dist/agent-runtime/spill.d.ts +24 -0
- package/dist/agent-runtime/spill.d.ts.map +1 -0
- package/dist/agent-runtime/sqlite-purge.d.ts.map +1 -1
- package/dist/agent-runtime/sqlite.d.ts +26 -0
- package/dist/agent-runtime/sqlite.d.ts.map +1 -1
- package/dist/agent-runtime/state-slots.d.ts +48 -0
- package/dist/agent-runtime/state-slots.d.ts.map +1 -0
- package/dist/agent-runtime/state-tools.d.ts +58 -0
- package/dist/agent-runtime/state-tools.d.ts.map +1 -0
- package/dist/agent-runtime/store-driver.d.ts +13 -0
- package/dist/agent-runtime/store-driver.d.ts.map +1 -1
- package/dist/agent-runtime/store-events.d.ts +829 -0
- package/dist/agent-runtime/store-events.d.ts.map +1 -0
- package/dist/agent-runtime/store-migrations/v1-to-v2.d.ts +6 -0
- package/dist/agent-runtime/store-migrations/v1-to-v2.d.ts.map +1 -0
- package/dist/agent-runtime/store.d.ts +45 -0
- package/dist/agent-runtime/store.d.ts.map +1 -1
- package/dist/agent-runtime/terminal-commit.d.ts +1 -1
- package/dist/agent-runtime-browser.js +5 -3
- package/dist/agent-runtime-coding-tools.js +144 -15
- package/dist/agent-runtime-harness.js +12 -11
- package/dist/agent-runtime-sqlite-bun.d.ts +1 -1
- package/dist/agent-runtime-sqlite-bun.d.ts.map +1 -1
- package/dist/agent-runtime-sqlite-bun.js +5 -4
- package/dist/agent-runtime-sqlite-node.d.ts +1 -1
- package/dist/agent-runtime-sqlite-node.d.ts.map +1 -1
- package/dist/agent-runtime-sqlite-node.js +5 -4
- package/dist/agent-runtime-testing.d.ts +3 -0
- package/dist/agent-runtime-testing.d.ts.map +1 -0
- package/dist/agent-runtime-testing.js +156 -0
- package/dist/agent-runtime.d.ts +16 -2
- package/dist/agent-runtime.d.ts.map +1 -1
- package/dist/agent-runtime.js +1632 -156
- package/dist/application.js +14 -14
- package/dist/cli.js +6 -6
- package/dist/{index-fwbkp2jn.js → index-0vfdh685.js} +2 -2
- package/dist/{index-5z8tezpx.js → index-0ydchz76.js} +3 -3
- package/dist/{index-3ds42w1w.js → index-1szetq6f.js} +33 -4
- package/dist/{index-2jg7b11j.js → index-35aefxby.js} +879 -424
- package/dist/index-3yrqvza8.js +964 -0
- package/dist/{index-fq492hg0.js → index-5wezxcxx.js} +238 -161
- package/dist/index-9553432s.js +26 -0
- package/dist/{index-27487ay5.js → index-9hw9eq48.js} +4 -4
- package/dist/index-cnyk6te3.js +77 -0
- package/dist/index-gskm1k5a.js +50 -0
- package/dist/{index-4hk633vz.js → index-hkm6wysp.js} +9 -2
- package/dist/{index-dx9xehwt.js → index-kc6h6hg0.js} +1 -1
- package/dist/{index-x15ss2dx.js → index-p1b1y93x.js} +3 -0
- package/dist/{index-mgtxfe6b.js → index-r159gjwy.js} +8 -1
- package/dist/{index-s4ckmrac.js → index-rcgsnrr6.js} +3 -3
- package/dist/{index-dggwnnjv.js → index-wn9cb82y.js} +1 -1
- package/dist/index-z1m86vc8.js +334 -0
- package/dist/{index-ff0kcqvp.js → index-z2452tsw.js} +3 -3
- package/dist/internal/sqlite.d.ts +13 -0
- package/dist/internal/sqlite.d.ts.map +1 -1
- package/dist/testing/agent-store-conformance.d.ts.map +1 -1
- package/dist/testing.js +89 -80
- package/dist/tool-invoker.js +4 -4
- package/dist/tools/internal/surface-projector.d.ts.map +1 -1
- package/dist/tools/manifest.d.ts +16 -0
- package/dist/tools/manifest.d.ts.map +1 -1
- package/dist/tools.d.ts +1 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +10 -8
- package/llms-full.txt +373 -16
- package/package.json +6 -1
- package/dist/index-66nxrgy0.js +0 -554
- package/dist/index-y2s6h5bf.js +0 -83
package/llms-full.txt
CHANGED
|
@@ -63,11 +63,12 @@ own, recorded as an ADR.
|
|
|
63
63
|
| `stitchkit/tracking/server` | server (Bun or Node) | evolving | the decisions a tracking backend makes — dispositions, visit lease over an application-owned store, active intervals, presence; no database |
|
|
64
64
|
| `stitchkit/release` | browser **and** server | evolving | a page follows the release it was built for — `createReleaseMarker` on the server, `createReleaseWatcher` in the browser, the `X-Build-Id` header and a socket event between them |
|
|
65
65
|
| `stitchkit/geo` | server (Bun or Node) | evolving | managed GeoIP reader generations, last-known-good reload and the optional MaxMind adapter |
|
|
66
|
-
| `stitchkit/observability` | server | stable<br>_redefined in 1 of the
|
|
66
|
+
| `stitchkit/observability` | server | stable<br>_redefined in 1 of the 32 minors since 0.56.2, most recently 0.83.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
|
|
67
67
|
| `stitchkit/testing` | tests on Bun or Node | stable | in-process generated clients over a real Fetch handler, plus the store and managed-resource conformance kits |
|
|
68
68
|
| `stitchkit/declaration` | browser + build and deployment tooling (Bun or Node) | evolving | `ProjectDeclarationSchema` — the one machine-readable statement a repository makes about itself |
|
|
69
69
|
| `stitchkit/react` | browser + server rendering | stable | `createCursorQuery`, `createCacheBridge`, QueryClient and `ApiError` retry policy |
|
|
70
|
-
| `stitchkit/agent-runtime` | server | evolving<br>_redefined in
|
|
70
|
+
| `stitchkit/agent-runtime` | server | evolving<br>_redefined in 18 of the 32 minors since 0.56.2, most recently 0.87.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
|
|
71
|
+
| `stitchkit/agent-runtime/testing` | tests on Bun or Node | evolving | credential-free replay, scripted provider faults and deterministic race controls |
|
|
71
72
|
| `stitchkit/agent-runtime/harness` | server | evolving | resource-aware process-local facade over the canonical Agent runtime; supervision stays outside |
|
|
72
73
|
| `stitchkit/agent-runtime/coding-tools` | server (Bun or Node) | evolving | bounded host-authorized direct file and shell tools; a root boundary, not an OS sandbox |
|
|
73
74
|
| `stitchkit/agent-runtime/openrouter` | server | evolving | isolated OpenRouter language-model adapter |
|
|
@@ -75,7 +76,7 @@ own, recorded as an ADR.
|
|
|
75
76
|
| `stitchkit/agent-runtime/sqlite/bun` | server (Bun) | evolving | durable built-in SQLite store for the agent runtime |
|
|
76
77
|
| `stitchkit/agent-runtime/sqlite/node` | server (Node ≥ 22.5) | evolving | durable built-in SQLite store for the agent runtime |
|
|
77
78
|
| `stitchkit-tui` | terminal (Bun) | evolving | optional official OpenTUI host over a caller-composed headless runtime |
|
|
78
|
-
| `stitchkit/application` | browser + server | evolving<br>_redefined in 7 of the
|
|
79
|
+
| `stitchkit/application` | browser + server | evolving<br>_redefined in 7 of the 32 minors since 0.56.2, most recently 0.83.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
|
|
79
80
|
| `stitchkit/application/grammy` | server | evolving | isolated grammY polling and webhook lifecycle adapters |
|
|
80
81
|
| `stitchkit/application/opentelemetry` | server | evolving | maps application snapshots onto an injected OpenTelemetry `Meter` |
|
|
81
82
|
| `stitchkit/application/schemas` | browser + server | evolving | the application's snapshot, health and shutdown schemas alone, without the kernel |
|
|
@@ -4854,8 +4855,14 @@ and supplies atomicity; Stitchkit owns transition validation and revision
|
|
|
4854
4855
|
arithmetic. The executable reference is
|
|
4855
4856
|
[`examples/agent-store-prisma/adapter.ts`](../../examples/agent-store-prisma/adapter.ts).
|
|
4856
4857
|
`compareAndSwap` returns either `{ outcome: 'applied' }` or
|
|
4857
|
-
`{ outcome: 'conflict', actualVersion }`.
|
|
4858
|
-
|
|
4858
|
+
`{ outcome: 'conflict', actualVersion }`. Decide that outcome by reading the
|
|
4859
|
+
version, comparing it and then writing unconditionally — inside the transaction
|
|
4860
|
+
the adapter supplies, that is atomic. A conditional upsert is the shorter thing
|
|
4861
|
+
to write and it is wrong twice: `ON CONFLICT ... WHERE` guards the update branch
|
|
4862
|
+
only, so the first write to a conversation applies whatever `expectedVersion` it
|
|
4863
|
+
was given, and the affected-row count that would report the outcome is the
|
|
4864
|
+
driver's, which need not be the rows the statement moved. The head contains only
|
|
4865
|
+
schema version, conversation identity and monotonic version. Runs and admission receipts are normalized records;
|
|
4859
4866
|
recovery queries active run states directly instead of maintaining a second projection.
|
|
4860
4867
|
An admission receipt retains its canonical input, and a terminal run retains its canonical
|
|
4861
4868
|
assistant, so physical product-history compaction cannot break idempotent retries.
|
|
@@ -4884,7 +4891,7 @@ const sqlite = createNodeSqliteAgentRuntimeStore({ filename: './agent-runtime.sq
|
|
|
4884
4891
|
```
|
|
4885
4892
|
|
|
4886
4893
|
Initialization creates only `stitchkit_agent_runtime_*` tables and records
|
|
4887
|
-
schema version
|
|
4894
|
+
schema version 2 in `stitchkit_agent_runtime_meta`; it does not use
|
|
4888
4895
|
`PRAGMA user_version` or mutate application tables. An unknown schema version or
|
|
4889
4896
|
unversioned partial Stitchkit schema is refused. The connection is owned by the
|
|
4890
4897
|
returned handle and closes only after accepted operations drain.
|
|
@@ -4908,6 +4915,136 @@ atomically or replace an application outbox. If a product row must commit with
|
|
|
4908
4915
|
an agent transition, implement `AgentRuntimeStoreDriver` over the application's
|
|
4909
4916
|
own transaction boundary instead.
|
|
4910
4917
|
|
|
4918
|
+
Opening a version 1 store migrates it in one transaction, forward only — back
|
|
4919
|
+
the file up first, a 0.85.x package refuses a migrated file. Existing
|
|
4920
|
+
normalized state becomes one `runtime/baseline` event per conversation, dated
|
|
4921
|
+
when the migration ran and carrying `asOf` for the last message it describes;
|
|
4922
|
+
search and projections address that pre-migration history as one snapshot at
|
|
4923
|
+
`seq 1`. New transitions continue the monotonic conversation sequence. Version
|
|
4924
|
+
2 requires SQLite FTS5 because event search is an advertised capability, so a
|
|
4925
|
+
build without FTS5 is a startup error (`requires FTS5 support`) rather than an
|
|
4926
|
+
empty search result; check with
|
|
4927
|
+
`SELECT sqlite_compileoption_used('ENABLE_FTS5')`.
|
|
4928
|
+
|
|
4929
|
+
The handle returned by `createBunSqliteAgentRuntimeStore` /
|
|
4930
|
+
`createNodeSqliteAgentRuntimeStore` is `{ store, conversations, database,
|
|
4931
|
+
transaction, close }`. `database` is the shared connection and `transaction`
|
|
4932
|
+
is one write transaction in the store's own serialization: the SQLite
|
|
4933
|
+
companions — `createSqliteAgentProjectionStore`, `createSqliteAgentSpillStore`,
|
|
4934
|
+
`createSqliteAgentChildManager`, `createAgentScheduleService` — take `{ sqlite }`
|
|
4935
|
+
and write their rows and events through it, so a row and its event land
|
|
4936
|
+
together or not at all.
|
|
4937
|
+
|
|
4938
|
+
`conversations.messages` pages the model's history: what compaction removed is
|
|
4939
|
+
not in it, which is the point of compaction. A person reading back their own
|
|
4940
|
+
conversation needs the other view, and asks for it explicitly:
|
|
4941
|
+
|
|
4942
|
+
```ts
|
|
4943
|
+
const page = await conversations.messages({
|
|
4944
|
+
conversationId,
|
|
4945
|
+
limit: 50,
|
|
4946
|
+
direction: 'after',
|
|
4947
|
+
includeCompacted: true,
|
|
4948
|
+
})
|
|
4949
|
+
const removed = new Set(page.compacted)
|
|
4950
|
+
```
|
|
4951
|
+
|
|
4952
|
+
`items` stays one sequence in the order it happened, and `compacted` names the
|
|
4953
|
+
ids inside it that the model no longer sees — the boundary is a mark on the
|
|
4954
|
+
conversation, not a second list. A compaction summary sits at the position of
|
|
4955
|
+
the first message it replaced, so it appears at the head of the block it
|
|
4956
|
+
stands for. Without the flag the page is exactly what it was, `compacted`
|
|
4957
|
+
empty. The v1 → v2 migration baseline records the same thing: the whole
|
|
4958
|
+
sequence, with `compacted` naming what had been folded away. A file migrated
|
|
4959
|
+
by 0.86.0 has a baseline built from the active history only — the messages
|
|
4960
|
+
themselves are still in the store and this read reaches them, but that one
|
|
4961
|
+
event cannot be rewritten after the fact.
|
|
4962
|
+
|
|
4963
|
+
### Retried provider streams
|
|
4964
|
+
|
|
4965
|
+
With `loop.retry` set, a provider stream that fails before any tool call in the
|
|
4966
|
+
attempt is retried at the step boundary. Subscribers see `attempt-reset` for the
|
|
4967
|
+
run before the next attempt's first delta and drop what the failed attempt
|
|
4968
|
+
streamed; the durable draft is checkpointed after that output is discarded; an
|
|
4969
|
+
input injected into the failed attempt is taken again by the retry; and the
|
|
4970
|
+
failed attempt's reported usage stays in the run's spend. Transient events —
|
|
4971
|
+
deltas, reasoning, `attempt-reset` — are numbered from 1 per run, counting only
|
|
4972
|
+
what was published, so a cursor sees no gap on an ordinary stream.
|
|
4973
|
+
|
|
4974
|
+
### Event ledger, projections and durable capabilities
|
|
4975
|
+
|
|
4976
|
+
`AgentRuntimeStore` exposes bounded `readEvents`, declared `appendEvent`,
|
|
4977
|
+
canonical `exportConversation` and empty-target `importConversation`. Runtime
|
|
4978
|
+
transitions and exact provider requests enter the same append-only ledger; the
|
|
4979
|
+
normalized head/run/message tables remain the fast operational projection.
|
|
4980
|
+
|
|
4981
|
+
Use `defineAgentProjection` with `createSqliteAgentProjectionStore` for a
|
|
4982
|
+
deterministic versioned fold. Every value reports `uptoSeq`, so a caller can
|
|
4983
|
+
distinguish current data from a projection that still has events to consume.
|
|
4984
|
+
Changing the projection version folds from sequence one.
|
|
4985
|
+
|
|
4986
|
+
The built-ins are `agentSummaryProjection`, `agentUsageProjection` and
|
|
4987
|
+
`agentOutlineProjection`; focused card, state-slot and schedule projections are
|
|
4988
|
+
also available. `list(projection)` reads all materialized conversation rows in
|
|
4989
|
+
one SQLite query instead of reopening their event logs.
|
|
4990
|
+
|
|
4991
|
+
Durable state is declared once and injected on every provider request:
|
|
4992
|
+
|
|
4993
|
+
```ts
|
|
4994
|
+
const goal = defineStateSlot({
|
|
4995
|
+
name: 'goal',
|
|
4996
|
+
schema: z.object({ objective: z.string(), status: z.string() }),
|
|
4997
|
+
})
|
|
4998
|
+
|
|
4999
|
+
const slots = createAgentStateSlotStore({ store: sqlite.store, definitions: [goal] })
|
|
5000
|
+
await slots.set({
|
|
5001
|
+
conversationId,
|
|
5002
|
+
name: 'goal',
|
|
5003
|
+
value: { objective: 'finish migration', status: 'active' },
|
|
5004
|
+
actor: 'human',
|
|
5005
|
+
})
|
|
5006
|
+
|
|
5007
|
+
const runtime = createAgentRuntime({ ...config, store: sqlite.store, stateSlots: [goal] })
|
|
5008
|
+
```
|
|
5009
|
+
|
|
5010
|
+
`createAgentStateTools` binds `create_goal`, `update_goal`, `get_goal` and
|
|
5011
|
+
`todo_write` to one conversation. Human changes call the same slot store with
|
|
5012
|
+
`actor: 'human'`; they remain structured `state/set` facts rather than forged
|
|
5013
|
+
chat messages.
|
|
5014
|
+
|
|
5015
|
+
`createSqliteAgentSpillStore` persists oversized output separately and records
|
|
5016
|
+
its locator, hash and lifecycle in the ledger. `read_output` and
|
|
5017
|
+
`search_output` re-run both locator authorization and the originating tool
|
|
5018
|
+
authorization before reading bytes. `createSqliteAgentEventSearch` returns the
|
|
5019
|
+
exact conversation and event sequence; cross-conversation results are denied
|
|
5020
|
+
unless `authorizeConversation` approves each target.
|
|
5021
|
+
`createAgentEventSearchTools` supplies `session_search`, `session_trace` and
|
|
5022
|
+
`session_event` over the same bounded APIs.
|
|
5023
|
+
|
|
5024
|
+
For credential-free failure tests, import `createFaultProviderServer` and
|
|
5025
|
+
`createReplayAgentProvider` from `stitchkit/agent-runtime/testing`. Runtime
|
|
5026
|
+
`loop.retry` applies an explicit `AgentRetryPolicy`: each decision is recorded
|
|
5027
|
+
as `retry/scheduled`, each new attempt as `retry/started`, and an attempt that
|
|
5028
|
+
has invoked a tool is never automatically replayed.
|
|
5029
|
+
|
|
5030
|
+
`createAgentScheduleService` persists `at`, `after` and `every` input. Repeating
|
|
5031
|
+
schedules require an explicit IANA time zone. Dispatch uses a stable
|
|
5032
|
+
`schedule:<id>:<occurrence>` idempotency key, and restart lateness is recorded.
|
|
5033
|
+
`createAgentScheduleTools` exposes the exact `schedule_after`, `schedule_at`,
|
|
5034
|
+
`schedule_every`, `schedule_list` and `schedule_cancel` surface.
|
|
5035
|
+
|
|
5036
|
+
`createSqliteAgentChildManager` seeds a child from the parent's ledger through
|
|
5037
|
+
an exact sequence, stores the graph, clamps requested limits to a durable parent
|
|
5038
|
+
remainder and stops budget overruns at the next step boundary as
|
|
5039
|
+
`policy_stop`. That enforcement runs inside the child's own runtime: the host that spawns it gives the child
|
|
5040
|
+
`loop.stopPolicies: [agentChildBudgetStopPolicy({ manager, childConversationId })]`, which
|
|
5041
|
+
calls `recordStepUsage` at every step boundary; `recordStepUsage` alone measures and decides,
|
|
5042
|
+
and reports `enforced: false` when the deciding process holds no handle to stop. Given to `createAgentRuntime` as `children`, the manager stops the parent's children after the parent's terminal is durable — interrupted, cancelled, timed out or shut down; a successful, policy-stopped, superseded or failed parent leaves them to the conversation (ADR 0175 carries the table); without `children` nothing cascades; an unreachable child is recorded
|
|
5043
|
+
as `lost`, not misreported as a provider failure.
|
|
5044
|
+
`createAgentChildTools` adds `subagent`, `subagent_fork`, `list_agents`,
|
|
5045
|
+
`send_message` and `interrupt_agent`; final output stays behind its bounded
|
|
5046
|
+
result locator.
|
|
5047
|
+
|
|
4911
5048
|
## Durable order
|
|
4912
5049
|
|
|
4913
5050
|
`acceptInputAndAssignRun` is one atomic operation. It is followed by ownership
|
|
@@ -5261,6 +5398,12 @@ transaction. Drivers without this guarantee must leave the capability absent. Se
|
|
|
5261
5398
|
|
|
5262
5399
|
## Events and reconnect
|
|
5263
5400
|
|
|
5401
|
+
A subscriber that switches over `event.type` handles one transient event
|
|
5402
|
+
beyond deltas and reasoning: `attempt-reset`, published when `loop.retry`
|
|
5403
|
+
starts a new attempt, meaning everything this run streamed before it is
|
|
5404
|
+
withdrawn. `reduceAgentControlEvent` does that; a hand-written reducer must,
|
|
5405
|
+
or it keeps the failed attempt's partial text on screen.
|
|
5406
|
+
|
|
5264
5407
|
`publish` receives event classes with different guarantees:
|
|
5265
5408
|
|
|
5266
5409
|
- `admission` follows a successful acceptance CAS and carries the same complete
|
|
@@ -5382,8 +5525,12 @@ prepareStep: (step) => {
|
|
|
5382
5525
|
|
|
5383
5526
|
That deliberate refusal ends the run as `context_overflow` on the durable
|
|
5384
5527
|
record, delivery terminal and operator event. Stitchkit does not inspect error
|
|
5385
|
-
messages
|
|
5386
|
-
|
|
5528
|
+
messages — it recognises failures by identity, not by text. A store refusing an
|
|
5529
|
+
owned mutation ends the run `storage_conflict`; `protocol.acceptTerminal`
|
|
5530
|
+
refusing a finished message ends it `output_rejected`; a check the SDK runs on
|
|
5531
|
+
what this runtime handed it ends it `runtime_failure`. Every error the runtime
|
|
5532
|
+
cannot identify as its own remains `provider_failure`, and operator-only
|
|
5533
|
+
observability retains its original cause in all of them.
|
|
5387
5534
|
|
|
5388
5535
|
Completion validity belongs to the protocol and is checked before the terminal
|
|
5389
5536
|
CAS. Protocols that require a visible answer opt in explicitly:
|
|
@@ -10096,6 +10243,38 @@ sink never escapes into application code.
|
|
|
10096
10243
|
stitchkit's own test suite runs on `bun:test`. The contract makes most of an
|
|
10097
10244
|
API testable without a live socket.
|
|
10098
10245
|
|
|
10246
|
+
### Agent runtime faults and replay
|
|
10247
|
+
|
|
10248
|
+
`stitchkit/agent-runtime/testing` is a credential-free test entrypoint for Bun
|
|
10249
|
+
and Node. It provides a local OpenAI-compatible SSE server with a deterministic
|
|
10250
|
+
fault plan, a replay provider for model fixtures, and named race barriers for
|
|
10251
|
+
event-order assertions:
|
|
10252
|
+
|
|
10253
|
+
```ts
|
|
10254
|
+
import {
|
|
10255
|
+
createFaultProviderServer,
|
|
10256
|
+
createReplayAgentProvider,
|
|
10257
|
+
} from 'stitchkit/agent-runtime/testing'
|
|
10258
|
+
|
|
10259
|
+
const server = await createFaultProviderServer({
|
|
10260
|
+
scenario: [
|
|
10261
|
+
{ kind: 'stream-cut', afterBytes: 50 },
|
|
10262
|
+
{ kind: 'pass', text: 'recovered' },
|
|
10263
|
+
],
|
|
10264
|
+
})
|
|
10265
|
+
|
|
10266
|
+
const provider = createReplayAgentProvider({
|
|
10267
|
+
attempts: { primary: [firstModel, recoveredModel] },
|
|
10268
|
+
})
|
|
10269
|
+
```
|
|
10270
|
+
|
|
10271
|
+
The fault vocabulary also covers connection refusal, timeout before the first
|
|
10272
|
+
byte, HTTP errors, malformed JSON, slow streams and missing usage. Configure
|
|
10273
|
+
runtime retry explicitly through `loop.retry`. A retry is recorded at the
|
|
10274
|
+
durable provider-step boundary; once a tool has executed, the runtime will not
|
|
10275
|
+
replay that attempt automatically. Always close the local server in test
|
|
10276
|
+
teardown with `await server.close()`.
|
|
10277
|
+
|
|
10099
10278
|
### Test generated clients in process
|
|
10100
10279
|
|
|
10101
10280
|
`createHandlerTestClient` runs the real generated client against the real Fetch
|
|
@@ -11048,6 +11227,143 @@ of the range if you want a different one.
|
|
|
11048
11227
|
So upgrading is: read the `### ⚠️ Breaking changes` of every version *above* your
|
|
11049
11228
|
current one *up to* your target, and apply each snippet.
|
|
11050
11229
|
|
|
11230
|
+
## Released migration: 0.87.0
|
|
11231
|
+
|
|
11232
|
+
Only if your project implements `AgentConversationReader` itself. A message page
|
|
11233
|
+
now names which of its messages compaction removed:
|
|
11234
|
+
|
|
11235
|
+
```ts
|
|
11236
|
+
// before
|
|
11237
|
+
return { items, ...(nextCursor && { nextCursor }) }
|
|
11238
|
+
|
|
11239
|
+
// after
|
|
11240
|
+
return { items, compacted: [], ...(nextCursor && { nextCursor }) }
|
|
11241
|
+
```
|
|
11242
|
+
|
|
11243
|
+
An empty array is the honest answer for a reader that pages only the active
|
|
11244
|
+
history; it is what the SQLite reader returns unless the caller asks for
|
|
11245
|
+
`includeCompacted`. Calling the reader needs no change, and no data migration is
|
|
11246
|
+
involved.
|
|
11247
|
+
|
|
11248
|
+
## Released migration: 0.86.0
|
|
11249
|
+
|
|
11250
|
+
Only if you branch on `AgentTerminalReason` or show it to a person. Three
|
|
11251
|
+
failures that used to arrive as `provider_failure` now arrive as themselves:
|
|
11252
|
+
|
|
11253
|
+
```ts
|
|
11254
|
+
// before
|
|
11255
|
+
if (run.terminalReason === 'provider_failure') showOutage()
|
|
11256
|
+
|
|
11257
|
+
// after
|
|
11258
|
+
switch (run.terminalReason) {
|
|
11259
|
+
case 'provider_failure':
|
|
11260
|
+
showOutage()
|
|
11261
|
+
break
|
|
11262
|
+
case 'storage_conflict':
|
|
11263
|
+
// Another writer took this run's revision, or the store refused the write.
|
|
11264
|
+
retryOrReport()
|
|
11265
|
+
break
|
|
11266
|
+
case 'output_rejected':
|
|
11267
|
+
// Your own `protocol.acceptTerminal` refused the finished message.
|
|
11268
|
+
reportRejectedAnswer()
|
|
11269
|
+
break
|
|
11270
|
+
case 'runtime_failure':
|
|
11271
|
+
// The runtime, or a check the SDK ran on what it was handed, failed
|
|
11272
|
+
// before the provider was reached.
|
|
11273
|
+
reportInternal()
|
|
11274
|
+
break
|
|
11275
|
+
}
|
|
11276
|
+
```
|
|
11277
|
+
|
|
11278
|
+
A run that never reached the provider can no longer report `provider_failure`,
|
|
11279
|
+
so an alert keyed on that value stops firing for causes that were never the
|
|
11280
|
+
provider's.
|
|
11281
|
+
|
|
11282
|
+
If you implement `AgentRuntimeStore` directly, add the event-ledger surface:
|
|
11283
|
+
|
|
11284
|
+
```ts
|
|
11285
|
+
const store: AgentRuntimeStore = {
|
|
11286
|
+
// existing normalized operations
|
|
11287
|
+
appendEvent,
|
|
11288
|
+
readEvents,
|
|
11289
|
+
exportConversation,
|
|
11290
|
+
importConversation,
|
|
11291
|
+
}
|
|
11292
|
+
```
|
|
11293
|
+
|
|
11294
|
+
If you implement an `AgentRuntimeStoreDriver` (Prisma, Postgres, any external
|
|
11295
|
+
database), the ledger is yours to keep: `events` is a required member, and it
|
|
11296
|
+
needs a table.
|
|
11297
|
+
|
|
11298
|
+
```ts
|
|
11299
|
+
// before
|
|
11300
|
+
const driver: AgentRuntimeStoreDriver<Tx> = { transaction, head, runs, admissions, history, scanRecoverable }
|
|
11301
|
+
|
|
11302
|
+
// after
|
|
11303
|
+
const driver: AgentRuntimeStoreDriver<Tx> = {
|
|
11304
|
+
transaction, head, runs, admissions, history, scanRecoverable,
|
|
11305
|
+
events: {
|
|
11306
|
+
// One row per event; `seq` is per conversation, starts at 1, and is
|
|
11307
|
+
// assigned inside the caller's transaction so concurrent appends cannot
|
|
11308
|
+
// share or skip a number.
|
|
11309
|
+
append: async (tx, draft) => {
|
|
11310
|
+
// Two transactions that both read max(seq) and both insert max + 1
|
|
11311
|
+
// collide on the primary key; under SERIALIZABLE the snapshot predates
|
|
11312
|
+
// any lock you take here. Treat a unique violation on this table as a
|
|
11313
|
+
// serialization conflict and re-run the whole transaction — see
|
|
11314
|
+
// `runTransaction` in examples/agent-store-prisma/adapter.ts.
|
|
11315
|
+
const seq = (await tx.event.aggregate({ _max: { seq: true }, where: { conversationId: draft.conversationId } }))._max.seq ?? 0
|
|
11316
|
+
await tx.event.create({ data: { ...draft, seq: seq + 1, payload: JSON.stringify(draft.payload) } })
|
|
11317
|
+
return { ...draft, seq: seq + 1 }
|
|
11318
|
+
},
|
|
11319
|
+
// Ordered by `seq`, bounded by `fromSeq`/`toSeq`/`limit`; `nextSeq` when
|
|
11320
|
+
// more remain.
|
|
11321
|
+
list: async (tx, input) => { /* see examples/agent-store-prisma/adapter.ts */ },
|
|
11322
|
+
},
|
|
11323
|
+
}
|
|
11324
|
+
```
|
|
11325
|
+
|
|
11326
|
+
The table carries `eventId` (unique), `conversationId`, `seq`, `schemaVersion`,
|
|
11327
|
+
`kind`, `occurredAt`, `ignorable` and `payload`. `runAgentStoreConformance`
|
|
11328
|
+
from `stitchkit/testing` now exercises it — contiguous `seq` under twenty
|
|
11329
|
+
concurrent appends, bounded reads, the `ignorable` flag, a byte-stable export
|
|
11330
|
+
— so run it against your driver before deploying. Expect one more insert per
|
|
11331
|
+
run operation (`runtime/transition`) and one per model step
|
|
11332
|
+
(`provider/request`) on the hot path; there is no opt-out.
|
|
11333
|
+
|
|
11334
|
+
If you operate a built-in SQLite store file:
|
|
11335
|
+
|
|
11336
|
+
1. Back the file up. The first open by 0.86.0 migrates it to schema 2 in one
|
|
11337
|
+
transaction and there is no way back: a 0.85.x package refuses a migrated
|
|
11338
|
+
file with `Unsupported Stitchkit agent-runtime SQLite schema version 2`.
|
|
11339
|
+
2. Check the build for FTS5 before deploying:
|
|
11340
|
+
|
|
11341
|
+
```sql
|
|
11342
|
+
SELECT sqlite_compileoption_used('ENABLE_FTS5');
|
|
11343
|
+
```
|
|
11344
|
+
|
|
11345
|
+
A build without it is refused at open with `requires FTS5 support`. On the
|
|
11346
|
+
machine this was verified, Bun 1.3 `bun:sqlite` and Node 24.18 `node:sqlite`
|
|
11347
|
+
both carry it; verify your own build rather than assuming — the table of
|
|
11348
|
+
supported runtimes says Node ≥ 22.5, and FTS5 there is not verified here.
|
|
11349
|
+
3. Know what the migration wrote. Each existing conversation becomes one
|
|
11350
|
+
`runtime/baseline` event at `seq 1`, dated when the migration ran, with
|
|
11351
|
+
`asOf` inside the payload naming the last message it describes. Event
|
|
11352
|
+
search and projections address that conversation's pre-migration history as
|
|
11353
|
+
one snapshot at `seq 1`; event-level precision begins with the first event
|
|
11354
|
+
after the migration.
|
|
11355
|
+
|
|
11356
|
+
If you subscribe to `AgentRuntimeEvent` and switch over `event.type`
|
|
11357
|
+
exhaustively, add the transient `attempt-reset` case — drop the run's
|
|
11358
|
+
transient text — or the reducer stops compiling; a reducer that ignores it
|
|
11359
|
+
keeps a failed attempt's partial text on screen.
|
|
11360
|
+
|
|
11361
|
+
New in this release, not a migration: child runs cascade only when the manager
|
|
11362
|
+
is given to the runtime —
|
|
11363
|
+
`createAgentRuntime({ ...config, children: createSqliteAgentChildManager({ sqlite, spawn }) })`
|
|
11364
|
+
— and the SQLite companions take the store handle (`{ sqlite }`), whose
|
|
11365
|
+
`database` and `transaction` they share.
|
|
11366
|
+
|
|
11051
11367
|
## Released migration: 0.85.0
|
|
11052
11368
|
|
|
11053
11369
|
Only if you implement `AgentRuntimeStore` directly. Add the new durable
|
|
@@ -15144,7 +15460,8 @@ Server-only optional application runtime. See the
|
|
|
15144
15460
|
| `AgentRunQueuePrioritySchema` | schema | durable opt-in priority for queued `interrupt-next` runs |
|
|
15145
15461
|
| `AgentRuntimeStore` | _type_ | aggregate CAS transaction boundary for message, run and compaction mutations |
|
|
15146
15462
|
| `createAgentRuntimeStore` | function | build the aggregate store from one coherent transaction driver; framework owns every state transition |
|
|
15147
|
-
| `AgentRuntimeStoreDriver` | _type_ | ORM-neutral transaction over a bounded head, normalized runs/admissions, product history and indexed run recovery; optional `{ access: 'read' }` selects a coherent read transaction while absent options remain write-safe |
|
|
15463
|
+
| `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 |
|
|
15464
|
+
| `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 |
|
|
15148
15465
|
| `AgentRuntimeHeadSchema` | schema | constant-size conversation identity plus monotonic runtime version |
|
|
15149
15466
|
| `AgentStoredRunSchema` | schema | canonical normalized run with an optional retained terminal assistant |
|
|
15150
15467
|
| `AgentAdmissionReceiptSchema` | schema | durable idempotency receipt with canonical input and assigned run/assistant identities |
|
|
@@ -15169,7 +15486,7 @@ Server-only optional application runtime. See the
|
|
|
15169
15486
|
| `searchAgentModelCatalog` | function | deterministic bounded search over a loaded canonical catalog |
|
|
15170
15487
|
| `AgentModelSelectionSchema` / `AgentModelSelection` / `AgentModelSelectionStore` | schema / _type_ | durable per-conversation model choice; runtime resolvers receive run and snapshot to recover the model pinned to input metadata |
|
|
15171
15488
|
| `createMemoryAgentModelSelectionStore` | function | process-local selection reference adapter |
|
|
15172
|
-
| `AgentConversationReader` | _type_ | optional bounded conversation-summary and message-history reader; not part of the required runtime store contract |
|
|
15489
|
+
| `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 |
|
|
15173
15490
|
| `AgentConversationSummarySchema` / `AgentConversationSummary` | schema / _type_ | bounded durable conversation list item with version, activity and preview |
|
|
15174
15491
|
| `AgentConversationPageSchema` / `AgentConversationPage` | schema / _type_ | cursor-paged conversation summaries |
|
|
15175
15492
|
| `AgentConversationMessagePageSchema` / `AgentConversationMessagePage` | schema / _type_ | cursor-paged durable message history |
|
|
@@ -15196,6 +15513,29 @@ Server-only optional application runtime. See the
|
|
|
15196
15513
|
| `RecordRunOperationSchema` / `RecordRunOperation` | schema / _type_ | owner/fencing/revision-checked mutation of `AgentRun.lastOperation` |
|
|
15197
15514
|
| `createAgentObservability` | function | separate agent-run sink over the shared bounded observability lifecycle |
|
|
15198
15515
|
|
|
15516
|
+
### Durable capability layer
|
|
15517
|
+
|
|
15518
|
+
| Export | Kind | Summary |
|
|
15519
|
+
|--------|------|---------|
|
|
15520
|
+
| `AgentConversationArchiveSchema` / `AgentConversationArchive` / `encodeAgentConversationArchive` / `decodeAgentConversationArchive` / `canonicalAgentJson` | schema / _type_ / functions | canonical validated conversation archive with exact ledger events, recovery projection and durable spill payloads |
|
|
15521
|
+
| `AgentStoreEventEnvelopeSchema` / `AgentStoreEventEnvelope` / `AgentStoreEventKindSchema` / `AgentStoreEventKind` / `AgentStoreEventPageSchema` / `AgentStoreEventPage` | schema / _type_ | append-only event envelope, closed current vocabulary and bounded page |
|
|
15522
|
+
| `AppendAgentStoreEventSchema` / `AppendAgentStoreEvent` / `ReadAgentStoreEventsSchema` / `ReadAgentStoreEvents` | schema / _type_ | required append and bounded-read store contracts |
|
|
15523
|
+
| `AgentStoreTransitionSchema` / `AgentStoreTransition` / `AgentStoreEventDraft` / `AgentStoreEventDecodeAccepted` / `AgentStoreEventDecodeIgnored` / `AgentStoreEventDecodeResult` / `decodeAgentStoreEvent` | schema / _types_ / function | normalized runtime mutations, append drafts and strict current/ignorable future-event decoding outcomes |
|
|
15524
|
+
| `defineAgentProjection` / `AgentProjectionDefinition` / `AgentProjectionValue` / `createAgentProjectionRegistry` / `createSqliteAgentProjectionStore` | functions / _type_ | deterministic folds with persisted version and honest `uptoSeq` checkpoints |
|
|
15525
|
+
| `agentSummaryProjection` / `agentUsageProjection` / `agentOutlineProjection` | constants | built-in list summary, provenance-carrying usage and request outline projections |
|
|
15526
|
+
| `agentConversationCardProjection` / `agentStateSlotsProjection` / `agentScheduleSummaryProjection` | constants | focused card, durable-state and schedule lifecycle projections |
|
|
15527
|
+
| `defineStateSlot` / `AgentStateSlotDefinition` / `AgentStateSlotStore` / `AgentStateSlotValue` / `AnyAgentStateSlot` / `createAgentStateSlotStore` / `renderAgentStateSlots` | functions / _types_ | typed durable state written as ledger events and injected on every provider request |
|
|
15528
|
+
| `agentGoalStateSlot` / `agentTodoStateSlot` / `createAgentStateTools` | constants / function | built-in goal/todo state and bound `goal_*` / `todo_write` Agent tools |
|
|
15529
|
+
| `AgentSandboxGradeSchema` / `AgentSandboxGrade` / `AgentSandboxRestrictionSchema` / `AgentSandboxRestriction` / `AgentProcessSandbox` | schema / _type_ | host-provided process sandbox capability and explicit restriction vocabulary |
|
|
15530
|
+
| `probeAgentProcessSandbox` / `missingSandboxRestrictions` / `recordAgentSandboxProbe` | functions | process-cached probe, fail-closed required-gap calculation and durable probe record |
|
|
15531
|
+
| `AgentEventSearchResultSchema` / `AgentEventSearchResult` / `createSqliteAgentEventSearch` / `createAgentEventSearchTools` | schema / _type_ / functions | authorized FTS5 search with exact event addresses and `session_*` tools |
|
|
15532
|
+
| `createSqliteAgentSpillStore` | function | durable content-address-checked artifact storage, bounded read/search, retention facts and archive participation |
|
|
15533
|
+
| `AgentScheduleSchema` / `AgentSchedule` / `AgentScheduleService` / `createAgentScheduleService` / `createAgentScheduleTools` | schema / _types_ / functions | durable `at`/`after`/timezone-explicit `every`, stable dispatch identity and Agent tools |
|
|
15534
|
+
| `AgentChildBudgetSchema` / `AgentChildBudget` / `AgentChildStateSchema` / `AgentChildState` / `AgentChildRecordSchema` / `AgentChildRecord` | schema / _type_ | durable child graph, bounded seed and measured budget state |
|
|
15535
|
+
| `AgentChildHandle` / `AgentChildManager` / `createSqliteAgentChildManager` / `createAgentChildTools` / `agentChildBudgetStopPolicy` | _type_ / functions | host execution port, child lifecycle, cascade (given to `createAgentRuntime` as `children`), messaging, Agent tools, and the child runtime's own budget stop policy — `recordStepUsage` at every step boundary, `policy_stop` as `child-budget` when spent |
|
|
15536
|
+
| `AgentToolDefinition` | _type_ | peer-neutral shape returned by the bound agent-only state, search, schedule and child tool factories |
|
|
15537
|
+
| `AgentProviderStreamCutError` | class | explicit retryable provider stream truncation evidence |
|
|
15538
|
+
|
|
15199
15539
|
### Complete runtime inventory
|
|
15200
15540
|
|
|
15201
15541
|
The entrypoint deliberately exports the schemas beside their inferred types so persistence and
|
|
@@ -15322,7 +15662,7 @@ Model exports are `AgentLanguageModelProvider`, `AgentModelCapability`,
|
|
|
15322
15662
|
provider and required capabilities without constructing the model; runtime `models.preflight`
|
|
15323
15663
|
runs before durable admission.
|
|
15324
15664
|
|
|
15325
|
-
Delivery exports are `AgentAdmissionEventSchema`, `AgentCheckpointEventSchema`,
|
|
15665
|
+
Delivery exports are `AgentAdmissionEventSchema`, `AgentAttemptResetEventSchema`, `AgentCheckpointEventSchema`,
|
|
15326
15666
|
`AgentRunStateEventSchema`, `AgentRunOperationEventSchema`, `AgentTerminalEventSchema`,
|
|
15327
15667
|
`AgentTransientDeltaEventSchema`,
|
|
15328
15668
|
`AgentReasoningStartEventSchema`, `AgentReasoningDeltaEventSchema`,
|
|
@@ -15340,6 +15680,20 @@ Managed effects and operator telemetry additionally export `AgentToolFenceConfig
|
|
|
15340
15680
|
may accompany checkpoint/terminal writes and tool context; internal causes are redacted unless an
|
|
15341
15681
|
operator-only observability sink explicitly opts in.
|
|
15342
15682
|
|
|
15683
|
+
## `stitchkit/agent-runtime/testing`
|
|
15684
|
+
|
|
15685
|
+
Credential-free provider and concurrency fixtures for Bun and Node tests.
|
|
15686
|
+
|
|
15687
|
+
| Export | Kind | Summary |
|
|
15688
|
+
|--------|------|---------|
|
|
15689
|
+
| `createFaultProviderServer` | function | start an OpenAI-compatible local SSE endpoint with deterministic pass, connection-refused, timeout, stream-cut, HTTP, malformed JSON, slow-stream and missing-usage steps |
|
|
15690
|
+
| `AgentFaultStepSchema` / `AgentFaultStep` | schema / _type_ | strict fault-plan step vocabulary |
|
|
15691
|
+
| `defineAgentFaultPlan` | function | validate a non-empty deterministic fault sequence |
|
|
15692
|
+
| `createReplayAgentProvider` | function | serve a declared sequence of credential-free language-model fixtures per model ID |
|
|
15693
|
+
| `createAgentRaceBarrier` / `AgentRaceBarrier` | function / _type_ | named bounded deterministic concurrency barrier |
|
|
15694
|
+
| `createAgentRaceTrace` / `AgentRaceTrace` / `AgentRaceTraceEntry` | function / _type_ | record and assert exact event order without wall-clock guesses |
|
|
15695
|
+
| `createAgentRaceDriver` / `AgentRaceDriver` | function / _type_ | collect named barriers and release their teardown together |
|
|
15696
|
+
|
|
15343
15697
|
## `stitchkit/agent-runtime/harness`
|
|
15344
15698
|
|
|
15345
15699
|
Server-only evolving facade over the canonical Agent runtime. It requires the optional `ai` peer
|
|
@@ -15411,7 +15765,8 @@ not path filtering, to constrain its filesystem access. → ADR 0172.
|
|
|
15411
15765
|
|
|
15412
15766
|
Browser-safe canonical agent data. It re-exports the run, message, part, usage,
|
|
15413
15767
|
terminal and provider-envelope schemas/types listed under
|
|
15414
|
-
`stitchkit/agent-runtime`, together with all runtime delivery event schemas,
|
|
15768
|
+
`stitchkit/agent-runtime`, together with all runtime delivery event schemas (durable and transient,
|
|
15769
|
+
including `AgentAttemptResetEventSchema` for `attempt-reset`),
|
|
15415
15770
|
`AgentRuntimeEventCursorSchema`, `advanceAgentRuntimeEventCursor`,
|
|
15416
15771
|
`AgentControlRequestSchema` / `AgentControlRequest`, `AgentControlResponseSchema` /
|
|
15417
15772
|
`AgentControlResponse`, `AgentControlDeliverySchema` / `AgentControlDelivery`, `AgentMultiSessionCursorSchema` /
|
|
@@ -15442,12 +15797,12 @@ loaded by the neutral, browser or Node runtime surfaces.
|
|
|
15442
15797
|
|
|
15443
15798
|
| Export | Kind | Summary |
|
|
15444
15799
|
|--------|------|---------|
|
|
15445
|
-
| `createBunSqliteAgentRuntimeStore` | function | open an owned Bun SQLite connection, initialize/validate schema v1 and return `{ store, conversations, close }` |
|
|
15800
|
+
| `createBunSqliteAgentRuntimeStore` | function | open an owned Bun SQLite connection, initialize/validate schema v2, migrate v1 transactionally and return `{ store, conversations, database, transaction, close }` |
|
|
15446
15801
|
| `BunSqliteAgentRuntimeStoreConfig` | _type_ | database filename plus optional create and initialization policies |
|
|
15447
15802
|
| `createSqliteAgentRuntimeStore` | function | build the normalized store over an injected synchronous SQLite boundary |
|
|
15448
15803
|
| `initializeAgentRuntimeSqlite` | function | initialize or validate only Stitchkit's namespaced SQLite schema |
|
|
15449
15804
|
| `SqliteDatabase` / `SqliteStatement` / `SqliteValue` | _type_ | minimal runtime-neutral synchronous SQLite boundary |
|
|
15450
|
-
| `SqliteAgentRuntimeStore` / `SqliteAgentRuntimeStoreConfig` | _type_ | durable store handle
|
|
15805
|
+
| `SqliteAgentRuntimeStore` / `SqliteAgentRuntimeStoreConfig` / `SqliteStoreTransaction` | _type_ | durable store handle — `store`, `conversations`, `database`, `transaction`, `close` — owned connection lifecycle, initialization policy, and the one write transaction the SQLite companions share |
|
|
15451
15806
|
|
|
15452
15807
|
---
|
|
15453
15808
|
|
|
@@ -15498,11 +15853,11 @@ the Bun leaf but imports only `node:sqlite`.
|
|
|
15498
15853
|
|
|
15499
15854
|
| Export | Kind | Summary |
|
|
15500
15855
|
|--------|------|---------|
|
|
15501
|
-
| `createNodeSqliteAgentRuntimeStore` | function | open an owned Node `DatabaseSync`, initialize/validate schema v1 and return `{ store, close }` |
|
|
15856
|
+
| `createNodeSqliteAgentRuntimeStore` | function | open an owned Node `DatabaseSync`, initialize/validate schema v2, migrate v1 transactionally and return `{ store, conversations, database, transaction, close }` |
|
|
15502
15857
|
| `NodeSqliteAgentRuntimeStoreConfig` | _type_ | database filename plus optional read-only and initialization policies; read-only requires an initialized schema |
|
|
15503
15858
|
| `createSqliteAgentRuntimeStore` / `initializeAgentRuntimeSqlite` | function | shared normalized adapter and namespaced schema lifecycle |
|
|
15504
15859
|
| `SqliteDatabase` / `SqliteStatement` / `SqliteValue` | _type_ | minimal runtime-neutral synchronous SQLite boundary |
|
|
15505
|
-
| `SqliteAgentRuntimeStore` / `SqliteAgentRuntimeStoreConfig` | _type_ | durable store handle
|
|
15860
|
+
| `SqliteAgentRuntimeStore` / `SqliteAgentRuntimeStoreConfig` / `SqliteStoreTransaction` | _type_ | durable store handle — `store`, `conversations`, `database`, `transaction`, `close` — owned connection lifecycle, initialization policy, and the one write transaction the SQLite companions share |
|
|
15506
15861
|
|
|
15507
15862
|
## `stitchkit/observability`
|
|
15508
15863
|
|
|
@@ -15621,6 +15976,8 @@ payload.
|
|
|
15621
15976
|
| `validateMcpSchemas` | function | object-shaped assertion over the exact advertised schema surface — compatibility, typed properties and portable formats ([guide](../guide/mcp-and-agents.md#mcp-schema-validation-profile)) |
|
|
15622
15977
|
| `listToolNames` | function | every contract/runtime tool name with origin, identity and transports — for stable snapshots — [guide](../guide/mcp-and-agents.md#pinning-tool-names--listtoolnames) |
|
|
15623
15978
|
| `listContractToolNames` | function | the same listing straight from contracts — no handlers or stub services needed |
|
|
15979
|
+
| `describeToolCatalog` | function | inspect the exact model-facing names, source identities, schema byte sizes and deferred state; an explicit total byte budget fails closed |
|
|
15980
|
+
| `ToolCatalogConfig` / `ToolCatalogEntry` | _type_ | catalog source, transport, optional explicit schema budget and one inspectable result row |
|
|
15624
15981
|
| `McpHandlerConfig` | _type_ | server surface plus stateless HTTP transport config |
|
|
15625
15982
|
| `McpHttpConfig` | _type_ | HTTP auth, protected-resource, legacy-era and security options |
|
|
15626
15983
|
| `McpHttpHandler` | _type_ | framework-owned `{ fetch(request), close() }` lifecycle |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stitchkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.87.0",
|
|
4
4
|
"description": "Contract-first backend framework — one defineContract() into an HTTP API, MCP tools, AI-agent tools and a typed client. Bun and Node.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|
|
@@ -101,6 +101,10 @@
|
|
|
101
101
|
"types": "./dist/agent-runtime.d.ts",
|
|
102
102
|
"import": "./dist/agent-runtime.js"
|
|
103
103
|
},
|
|
104
|
+
"./agent-runtime/testing": {
|
|
105
|
+
"types": "./dist/agent-runtime-testing.d.ts",
|
|
106
|
+
"import": "./dist/agent-runtime-testing.js"
|
|
107
|
+
},
|
|
104
108
|
"./agent-runtime/harness": {
|
|
105
109
|
"types": "./dist/agent-runtime-harness.d.ts",
|
|
106
110
|
"import": "./dist/agent-runtime-harness.js"
|
|
@@ -198,6 +202,7 @@
|
|
|
198
202
|
"smoke:next-ssr": "node scripts/next-ssr-retry-smoke.mjs",
|
|
199
203
|
"consumer-lane": "bun scripts/consumer-lane/run.mjs",
|
|
200
204
|
"bench:mcp-preparation": "bun scripts/benchmark-mcp-preparation.ts",
|
|
205
|
+
"bench:durable-store": "bun scripts/bench-durable-store.ts",
|
|
201
206
|
"build:entrypoints": "bun scripts/build-entrypoints.mjs"
|
|
202
207
|
},
|
|
203
208
|
"peerDependencies": {
|