stitchkit 0.68.7 → 0.68.8
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/README.md +5 -0
- package/dist/agent-runtime/sqlite.d.ts +32 -0
- package/dist/agent-runtime/sqlite.d.ts.map +1 -0
- package/dist/agent-runtime-sqlite-bun.d.ts +11 -0
- package/dist/agent-runtime-sqlite-bun.d.ts.map +1 -0
- package/dist/agent-runtime-sqlite-bun.js +40 -0
- package/dist/agent-runtime-sqlite-node.d.ts +11 -0
- package/dist/agent-runtime-sqlite-node.d.ts.map +1 -0
- package/dist/agent-runtime-sqlite-node.js +42 -0
- package/dist/agent-runtime.js +26 -898
- package/dist/index-8vpzxg55.js +403 -0
- package/dist/index-hqza5nde.js +914 -0
- package/llms-full.txt +113 -1
- package/package.json +10 -2
package/llms-full.txt
CHANGED
|
@@ -62,6 +62,8 @@ own, recorded as an ADR.
|
|
|
62
62
|
| `stitchkit/agent-runtime` | server | evolving<br>_redefined in 9 of the 13 minors since 0.56.2, most recently 0.66.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
|
|
63
63
|
| `stitchkit/agent-runtime/openrouter` | server | evolving | isolated OpenRouter language-model adapter |
|
|
64
64
|
| `stitchkit/agent-runtime/browser` | browser + server | evolving | canonical agent records, events and reconnect cursor without execution or sinks |
|
|
65
|
+
| `stitchkit/agent-runtime/sqlite/bun` | server (Bun) | evolving | durable built-in SQLite store for the agent runtime |
|
|
66
|
+
| `stitchkit/agent-runtime/sqlite/node` | server (Node ≥ 22.5) | evolving | durable built-in SQLite store for the agent runtime |
|
|
65
67
|
| `stitchkit/application` | server | evolving<br>_redefined in 3 of the 13 minors since 0.56.2, most recently 0.67.0_ | managed resource graph, readiness, admission, schedules and bounded shutdown |
|
|
66
68
|
| `stitchkit/application/grammy` | server | evolving | isolated grammY polling and webhook lifecycle adapters |
|
|
67
69
|
| `stitchkit/application/opentelemetry` | server | evolving | maps application snapshots onto an injected OpenTelemetry `Meter` |
|
|
@@ -165,6 +167,7 @@ map — feature → packages:
|
|
|
165
167
|
| MCP / agent adapters (`stitchkit/tools`) | `@modelcontextprotocol/server` `ai` |
|
|
166
168
|
| Agent application runtime (`stitchkit/agent-runtime`) | `ai` |
|
|
167
169
|
| OpenRouter runtime adapter (`stitchkit/agent-runtime/openrouter`) | `ai` `@openrouter/ai-sdk-provider` |
|
|
170
|
+
| SQLite agent store (`stitchkit/agent-runtime/sqlite/bun` or `/node`) | — (runtime built-in) |
|
|
168
171
|
| MCP host/client tests | `@modelcontextprotocol/client` |
|
|
169
172
|
| MCP Apps UI widgets | `@modelcontextprotocol/ext-apps` |
|
|
170
173
|
| React data layer (`stitchkit/react`) | `@tanstack/react-query` `react-query-kit` |
|
|
@@ -3730,7 +3733,7 @@ description: Configure Stitchkit's optional durable history, stream loop, run co
|
|
|
3730
3733
|
type: architecture
|
|
3731
3734
|
status: active
|
|
3732
3735
|
created: 2026-08-22
|
|
3733
|
-
updated: 2026-08-
|
|
3736
|
+
updated: 2026-08-28
|
|
3734
3737
|
---
|
|
3735
3738
|
|
|
3736
3739
|
# Agent application runtime
|
|
@@ -3885,6 +3888,47 @@ await ticket.accepted
|
|
|
3885
3888
|
const terminal = await ticket.result
|
|
3886
3889
|
```
|
|
3887
3890
|
|
|
3891
|
+
### Executable headless harness and capability map
|
|
3892
|
+
|
|
3893
|
+
[`packages/core/examples/headless-agent-harness.ts`](../../packages/core/examples/headless-agent-harness.ts)
|
|
3894
|
+
is the complete resource-aware recipe. It accepts injected protocol, model,
|
|
3895
|
+
tool and store ports, validates resources plus diagnostics, carries provenance
|
|
3896
|
+
into the prompt and delegates execution to `createAgentRuntime`. Importing the
|
|
3897
|
+
example starts no process, opens no database and discovers no filesystem path.
|
|
3898
|
+
|
|
3899
|
+
| Concern | Public Stitchkit composition | Boundary |
|
|
3900
|
+
| --- | --- | --- |
|
|
3901
|
+
| execution loop | `createAgentRuntime` | already available; do not copy a second loop |
|
|
3902
|
+
| model choice | `defineModelRegistry` and `models.resolve` | provider credentials/discovery stay application-owned |
|
|
3903
|
+
| resources | injected loader → `composeAgentPrompt` sections | paths, trust, precedence and watching stay application-owned |
|
|
3904
|
+
| tools | `mountAgent` + `createAgentToolFenceLifecycle` | auth and domain effects stay application-owned |
|
|
3905
|
+
| follow-up | `runs.inputPolicy: 'queue'` | durable FIFO after the current run |
|
|
3906
|
+
| interrupt | `interrupt` or `interrupt-next` | `interrupt-next` terminates the active run and gives the new durable admission next priority |
|
|
3907
|
+
| recovery | `runtime.recover` + `scanRecoverable` | replay safety and context reconstruction are explicit callbacks |
|
|
3908
|
+
| reconnect | canonical snapshot + `advanceAgentRuntimeEventCursor` | transient deltas are replaceable; durable event IDs deduplicate |
|
|
3909
|
+
| persistence | memory reference, public driver, or SQLite leaf | product rows/outbox remain outside the runtime store |
|
|
3910
|
+
|
|
3911
|
+
Pi's steering queue waits for the current tool calls and injects the steering
|
|
3912
|
+
message at its next loop boundary. It is therefore not an alias for
|
|
3913
|
+
`interrupt-next`: Stitchkit requests termination of the active durable run,
|
|
3914
|
+
waits for its terminal settlement, and executes the prioritized successor.
|
|
3915
|
+
Pi follow-up is closest to Stitchkit `queue`, while JSONL trees, branching,
|
|
3916
|
+
workspace discovery, permissions and terminal UI remain embedding-application
|
|
3917
|
+
features rather than runtime requirements.
|
|
3918
|
+
|
|
3919
|
+
Runtime events preserve reasoning/text/tool lifecycle order. Durable admission,
|
|
3920
|
+
checkpoint, run-state and terminal events carry stable identities; transient
|
|
3921
|
+
deltas carry one runtime epoch and monotonic sequence. On a transient gap,
|
|
3922
|
+
reload the canonical snapshot and resume from the durable record instead of
|
|
3923
|
+
persisting deltas as a second history.
|
|
3924
|
+
|
|
3925
|
+
Prompt `contextWindow` budgeting is a pre-request decision over the assembled
|
|
3926
|
+
context. `AgentRun.usage` is cumulative measured/provider-reported execution
|
|
3927
|
+
evidence across attempts and compaction. They answer different questions and
|
|
3928
|
+
must not be substituted for each other. TTFT and throughput require timestamps
|
|
3929
|
+
from the actual provider stream plus a provider-reported or tokenizer-measured
|
|
3930
|
+
token count; character counts cannot produce exact token or throughput figures.
|
|
3931
|
+
|
|
3888
3932
|
`recordIds` is optional. Supply stable application record IDs when an accepted-response transport must
|
|
3889
3933
|
return durable placeholders before the run finishes. `ticket.admission` resolves after the store
|
|
3890
3934
|
acceptance CAS and reports the canonical committed `input`, assigned `run`, a typed `pending`
|
|
@@ -3945,6 +3989,47 @@ recovery queries active run states directly instead of maintaining a second proj
|
|
|
3945
3989
|
An admission receipt retains its canonical input, and a terminal run retains its canonical
|
|
3946
3990
|
assistant, so physical product-history compaction cannot break idempotent retries.
|
|
3947
3991
|
|
|
3992
|
+
### Built-in SQLite persistence
|
|
3993
|
+
|
|
3994
|
+
Use the runtime-specific leaf; the neutral agent runtime never imports either
|
|
3995
|
+
SQLite built-in:
|
|
3996
|
+
|
|
3997
|
+
```ts
|
|
3998
|
+
// Bun
|
|
3999
|
+
import { createBunSqliteAgentRuntimeStore } from 'stitchkit/agent-runtime/sqlite/bun'
|
|
4000
|
+
|
|
4001
|
+
const sqlite = createBunSqliteAgentRuntimeStore({ filename: './agent-runtime.sqlite' })
|
|
4002
|
+
const runtime = createAgentRuntime({ ...config, store: sqlite.store })
|
|
4003
|
+
|
|
4004
|
+
await runtime.close()
|
|
4005
|
+
await sqlite.close()
|
|
4006
|
+
```
|
|
4007
|
+
|
|
4008
|
+
```ts
|
|
4009
|
+
// Node 22.5+
|
|
4010
|
+
import { createNodeSqliteAgentRuntimeStore } from 'stitchkit/agent-runtime/sqlite/node'
|
|
4011
|
+
|
|
4012
|
+
const sqlite = createNodeSqliteAgentRuntimeStore({ filename: './agent-runtime.sqlite' })
|
|
4013
|
+
```
|
|
4014
|
+
|
|
4015
|
+
Initialization creates only `stitchkit_agent_runtime_*` tables and records
|
|
4016
|
+
schema version 1 in `stitchkit_agent_runtime_meta`; it does not use
|
|
4017
|
+
`PRAGMA user_version` or mutate application tables. An unknown schema version or
|
|
4018
|
+
unversioned partial Stitchkit schema is refused. The connection is owned by the
|
|
4019
|
+
returned handle and closes only after accepted operations drain.
|
|
4020
|
+
|
|
4021
|
+
Each handle serializes its transactions. Separate connections use
|
|
4022
|
+
`busy_timeout = 0`: a competing synchronous writer fails promptly with
|
|
4023
|
+
SQLite's lock error, so an awaited transaction can resume and commit or roll
|
|
4024
|
+
back. Retry that explicit error with an application-owned bounded policy; do
|
|
4025
|
+
not configure a blocking busy timeout on the same JavaScript thread.
|
|
4026
|
+
|
|
4027
|
+
The adapter proves canonical durability across reopen and process restart. It
|
|
4028
|
+
does not make external tool effects exactly once, join application projections
|
|
4029
|
+
atomically or replace an application outbox. If a product row must commit with
|
|
4030
|
+
an agent transition, implement `AgentRuntimeStoreDriver` over the application's
|
|
4031
|
+
own transaction boundary instead.
|
|
4032
|
+
|
|
3948
4033
|
## Durable order
|
|
3949
4034
|
|
|
3950
4035
|
`acceptInputAndAssignRun` is one atomic operation. It is followed by ownership
|
|
@@ -11697,6 +11782,33 @@ Use this entrypoint from client components and shared DTO packages. The full
|
|
|
11697
11782
|
| `openRouterProvider` | function | isolated `@openrouter/ai-sdk-provider` language-model factory |
|
|
11698
11783
|
| `OpenRouterProviderSettings` | _type_ | official provider settings accepted by the factory |
|
|
11699
11784
|
|
|
11785
|
+
## `stitchkit/agent-runtime/sqlite/bun`
|
|
11786
|
+
|
|
11787
|
+
Bun built-in SQLite persistence. The entrypoint imports `bun:sqlite` and is not
|
|
11788
|
+
loaded by the neutral, browser or Node runtime surfaces.
|
|
11789
|
+
|
|
11790
|
+
| Export | Kind | Summary |
|
|
11791
|
+
|--------|------|---------|
|
|
11792
|
+
| `createBunSqliteAgentRuntimeStore` | function | open an owned Bun SQLite connection, initialize/validate schema v1 and return `{ store, close }` |
|
|
11793
|
+
| `BunSqliteAgentRuntimeStoreConfig` | _type_ | database filename plus optional create and initialization policies |
|
|
11794
|
+
| `createSqliteAgentRuntimeStore` | function | build the normalized store over an injected synchronous SQLite boundary |
|
|
11795
|
+
| `initializeAgentRuntimeSqlite` | function | initialize or validate only Stitchkit's namespaced SQLite schema |
|
|
11796
|
+
| `AgentRuntimeSqliteDatabase` / `AgentRuntimeSqliteStatement` / `AgentRuntimeSqliteValue` | _type_ | minimal runtime-neutral synchronous SQLite boundary |
|
|
11797
|
+
| `SqliteAgentRuntimeStore` / `SqliteAgentRuntimeStoreConfig` | _type_ | durable store handle, owned connection lifecycle and initialization policy |
|
|
11798
|
+
|
|
11799
|
+
## `stitchkit/agent-runtime/sqlite/node`
|
|
11800
|
+
|
|
11801
|
+
Node 22.5+ built-in SQLite persistence. It shares the schema and semantics of
|
|
11802
|
+
the Bun leaf but imports only `node:sqlite`.
|
|
11803
|
+
|
|
11804
|
+
| Export | Kind | Summary |
|
|
11805
|
+
|--------|------|---------|
|
|
11806
|
+
| `createNodeSqliteAgentRuntimeStore` | function | open an owned Node `DatabaseSync`, initialize/validate schema v1 and return `{ store, close }` |
|
|
11807
|
+
| `NodeSqliteAgentRuntimeStoreConfig` | _type_ | database filename plus optional read-only and initialization policies; read-only requires an initialized schema |
|
|
11808
|
+
| `createSqliteAgentRuntimeStore` / `initializeAgentRuntimeSqlite` | function | shared normalized adapter and namespaced schema lifecycle |
|
|
11809
|
+
| `AgentRuntimeSqliteDatabase` / `AgentRuntimeSqliteStatement` / `AgentRuntimeSqliteValue` | _type_ | minimal runtime-neutral synchronous SQLite boundary |
|
|
11810
|
+
| `SqliteAgentRuntimeStore` / `SqliteAgentRuntimeStoreConfig` | _type_ | durable store handle, owned connection lifecycle and initialization policy |
|
|
11811
|
+
|
|
11700
11812
|
## `stitchkit/observability`
|
|
11701
11813
|
|
|
11702
11814
|
Server-only. The audit layer one level above the raw hooks — W3C trace context,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stitchkit",
|
|
3
|
-
"version": "0.68.
|
|
3
|
+
"version": "0.68.8",
|
|
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",
|
|
@@ -92,6 +92,14 @@
|
|
|
92
92
|
"types": "./dist/agent-runtime-openrouter.d.ts",
|
|
93
93
|
"import": "./dist/agent-runtime-openrouter.js"
|
|
94
94
|
},
|
|
95
|
+
"./agent-runtime/sqlite/bun": {
|
|
96
|
+
"types": "./dist/agent-runtime-sqlite-bun.d.ts",
|
|
97
|
+
"import": "./dist/agent-runtime-sqlite-bun.js"
|
|
98
|
+
},
|
|
99
|
+
"./agent-runtime/sqlite/node": {
|
|
100
|
+
"types": "./dist/agent-runtime-sqlite-node.d.ts",
|
|
101
|
+
"import": "./dist/agent-runtime-sqlite-node.js"
|
|
102
|
+
},
|
|
95
103
|
"./application": {
|
|
96
104
|
"types": "./dist/application.d.ts",
|
|
97
105
|
"import": "./dist/application.js"
|
|
@@ -127,7 +135,7 @@
|
|
|
127
135
|
"scripts": {
|
|
128
136
|
"check": "bun x tsc --noEmit",
|
|
129
137
|
"build:browser": "bun build src/index.ts src/react.ts src/contract/index.ts src/declaration.ts src/agent-runtime-browser.ts --outdir dist --target node --packages external --splitting --root src",
|
|
130
|
-
"build:server": "bun build src/server/index.ts src/node.ts src/tools.ts src/tool-invoker.ts src/cli.ts src/remote.ts src/files.ts src/testing.ts src/observability/index.ts src/agent-runtime.ts src/agent-runtime-openrouter.ts src/application.ts src/application-grammy.ts src/application-opentelemetry.ts --outdir dist --target node --packages external --splitting --root src",
|
|
138
|
+
"build:server": "bun build src/server/index.ts src/node.ts src/tools.ts src/tool-invoker.ts src/cli.ts src/remote.ts src/files.ts src/testing.ts src/observability/index.ts src/agent-runtime.ts src/agent-runtime-openrouter.ts src/agent-runtime-sqlite-bun.ts src/agent-runtime-sqlite-node.ts src/application.ts src/application-grammy.ts src/application-opentelemetry.ts --outdir dist --target node --packages external --splitting --root src",
|
|
131
139
|
"build:js": "bun run build:browser && bun run build:server && bun scripts/preserve-webpack-ignore.mjs",
|
|
132
140
|
"build:types": "bun x tsc -p tsconfig.build.json --emitDeclarationOnly && bun scripts/rewrite-declaration-specifiers.mjs",
|
|
133
141
|
"build": "rm -rf dist && bun run build:js && bun run build:types && bun scripts/check-browser-clean.mjs && bun scripts/check-env-live.mjs && bun scripts/check-public-types.mjs",
|