stitchkit 0.84.1 → 0.85.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/dist/agent-runtime/control-schema.d.ts +61 -0
- package/dist/agent-runtime/control-schema.d.ts.map +1 -1
- package/dist/agent-runtime/event-schema.d.ts +88 -1
- package/dist/agent-runtime/event-schema.d.ts.map +1 -1
- package/dist/agent-runtime/run-execution.d.ts.map +1 -1
- package/dist/agent-runtime/run-operation-lifecycle.d.ts +25 -0
- package/dist/agent-runtime/run-operation-lifecycle.d.ts.map +1 -0
- package/dist/agent-runtime/schemas.d.ts +67 -0
- package/dist/agent-runtime/schemas.d.ts.map +1 -1
- package/dist/agent-runtime/store-driver.d.ts +18 -0
- package/dist/agent-runtime/store-driver.d.ts.map +1 -1
- package/dist/agent-runtime/store.d.ts +208 -0
- package/dist/agent-runtime/store.d.ts.map +1 -1
- package/dist/agent-runtime/terminal-commit.d.ts +9 -0
- package/dist/agent-runtime/terminal-commit.d.ts.map +1 -1
- package/dist/agent-runtime-browser.js +11 -3
- package/dist/agent-runtime-harness.js +4 -4
- package/dist/agent-runtime-sqlite-bun.js +3 -3
- package/dist/agent-runtime-sqlite-node.js +3 -3
- package/dist/agent-runtime.d.ts +2 -2
- package/dist/agent-runtime.d.ts.map +1 -1
- package/dist/agent-runtime.js +14 -4
- package/dist/{index-85vfqd7m.js → index-4hk633vz.js} +11 -3
- package/dist/{index-devfkwfm.js → index-66nxrgy0.js} +2 -2
- package/dist/{index-5s3zajp8.js → index-ff0kcqvp.js} +9 -3
- package/dist/{index-11vzj2sk.js → index-fq492hg0.js} +28 -2
- package/dist/{index-st8v8739.js → index-jpp7jd1p.js} +206 -26
- package/dist/{index-x1th9s8c.js → index-x15ss2dx.js} +50 -1
- package/dist/testing.js +26 -2
- package/llms-full.txt +61 -5
- package/package.json +2 -2
package/llms-full.txt
CHANGED
|
@@ -63,11 +63,11 @@ 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 30 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 16 of the 30 minors since 0.56.2, most recently 0.85.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
|
|
71
71
|
| `stitchkit/agent-runtime/harness` | server | evolving | resource-aware process-local facade over the canonical Agent runtime; supervision stays outside |
|
|
72
72
|
| `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
73
|
| `stitchkit/agent-runtime/openrouter` | server | evolving | isolated OpenRouter language-model adapter |
|
|
@@ -75,7 +75,7 @@ own, recorded as an ADR.
|
|
|
75
75
|
| `stitchkit/agent-runtime/sqlite/bun` | server (Bun) | evolving | durable built-in SQLite store for the agent runtime |
|
|
76
76
|
| `stitchkit/agent-runtime/sqlite/node` | server (Node ≥ 22.5) | evolving | durable built-in SQLite store for the agent runtime |
|
|
77
77
|
| `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
|
|
78
|
+
| `stitchkit/application` | browser + server | evolving<br>_redefined in 7 of the 30 minors since 0.56.2, most recently 0.83.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
|
|
79
79
|
| `stitchkit/application/grammy` | server | evolving | isolated grammY polling and webhook lifecycle adapters |
|
|
80
80
|
| `stitchkit/application/opentelemetry` | server | evolving | maps application snapshots onto an injected OpenTelemetry `Meter` |
|
|
81
81
|
| `stitchkit/application/schemas` | browser + server | evolving | the application's snapshot, health and shutdown schemas alone, without the kernel |
|
|
@@ -5273,12 +5273,38 @@ transaction. Drivers without this guarantee must leave the capability absent. Se
|
|
|
5273
5273
|
while provider metadata stays inside a validated canonical envelope;
|
|
5274
5274
|
- `assistant-checkpoint` follows a successful checkpoint CAS;
|
|
5275
5275
|
- `run-state` follows durable queue/acquire/interrupt transitions;
|
|
5276
|
+
- `run-operation` follows a successful operation CAS. Its `operation` is the
|
|
5277
|
+
durable `AgentRun.lastOperation`: `model-request` or `compaction`, with
|
|
5278
|
+
`started`, `first-output`, `completed`, `failed` or `cancelled` phase and the
|
|
5279
|
+
original timestamps. Concrete models use SDK call identity in an awaited model
|
|
5280
|
+
middleware; global provider IDs use a runtime-generated identity during awaited
|
|
5281
|
+
step preparation. Both durably admit the request before entering `doStream`, so a failed
|
|
5282
|
+
write prevents the provider call. This does not claim HTTP transmission is
|
|
5283
|
+
measured. First output is a
|
|
5284
|
+
non-empty text/reasoning/tool-argument delta or complete tool call; metadata,
|
|
5285
|
+
usage, files and sources do not count;
|
|
5276
5286
|
- `tool-status` is transient lifecycle presentation with JSON-safe input on
|
|
5277
5287
|
start and output on completion. A mounted typed failure carries the same safe
|
|
5278
5288
|
`{ error, details?, _hint? }` envelope as the durable result; an unknown
|
|
5279
5289
|
internal cause remains generic and stays in local observability only;
|
|
5280
5290
|
- `terminal` follows the winning terminal CAS.
|
|
5281
5291
|
|
|
5292
|
+
`loop.checkpointEveryEvents` batches ordinary stream parts (default `20`) and
|
|
5293
|
+
does not batch live event delivery. Tool call/result/error/denial, approval
|
|
5294
|
+
request/response and step-finish boundaries force an assistant checkpoint and
|
|
5295
|
+
reset that batch. The checkpoint is awaited after the managed loop observes the
|
|
5296
|
+
normalized boundary. It does **not** promise persistence before a tool side
|
|
5297
|
+
effect: tool fencing supplies the real ownership checks around execution, while
|
|
5298
|
+
cross-crash effect idempotency stays application-owned. The following model
|
|
5299
|
+
step waits for the previous step-finish checkpoint before its own durable
|
|
5300
|
+
request admission and provider invocation. → ADR 0174.
|
|
5301
|
+
|
|
5302
|
+
`compaction` names invocation of the configured callback, including a
|
|
5303
|
+
`not_needed` context-budget check; it does not by itself say that history was
|
|
5304
|
+
summarized. Operation timestamps are retained wall-clock observations and may
|
|
5305
|
+
move backwards after a clock correction. Do not subtract them for duration;
|
|
5306
|
+
phase order comes from durable snapshot versions/event order.
|
|
5307
|
+
|
|
5282
5308
|
These are post-commit notifications, not a transactional outbox: a process can
|
|
5283
5309
|
crash between the database commit and `publish`. Reconnect should load canonical
|
|
5284
5310
|
state. Exactly-once external delivery remains an application-owned outbox.
|
|
@@ -11022,6 +11048,33 @@ of the range if you want a different one.
|
|
|
11022
11048
|
So upgrading is: read the `### ⚠️ Breaking changes` of every version *above* your
|
|
11023
11049
|
current one *up to* your target, and apply each snippet.
|
|
11024
11050
|
|
|
11051
|
+
## Released migration: 0.85.0
|
|
11052
|
+
|
|
11053
|
+
Only if you implement `AgentRuntimeStore` directly. Add the new durable
|
|
11054
|
+
operation mutation beside the existing run mutations:
|
|
11055
|
+
|
|
11056
|
+
```ts
|
|
11057
|
+
// before
|
|
11058
|
+
const store: AgentRuntimeStore = {
|
|
11059
|
+
checkpointRunAssistant,
|
|
11060
|
+
commitRunTerminal,
|
|
11061
|
+
// ...
|
|
11062
|
+
}
|
|
11063
|
+
|
|
11064
|
+
// after
|
|
11065
|
+
const store: AgentRuntimeStore = {
|
|
11066
|
+
checkpointRunAssistant,
|
|
11067
|
+
recordRunOperation,
|
|
11068
|
+
commitRunTerminal,
|
|
11069
|
+
// ...
|
|
11070
|
+
}
|
|
11071
|
+
```
|
|
11072
|
+
|
|
11073
|
+
It must atomically replace `AgentRun.lastOperation`, increment the run revision
|
|
11074
|
+
and conversation snapshot version, and enforce the supplied owner, fencing
|
|
11075
|
+
token and expected revision. Adapters built with `createAgentRuntimeStore`
|
|
11076
|
+
already receive the reference implementation; no driver method is added.
|
|
11077
|
+
|
|
11025
11078
|
## What your range does, and does not, do for you
|
|
11026
11079
|
|
|
11027
11080
|
A caret range (`"stitchkit": "^0.71.0"`) is a real gate: it resolves `< 0.72.0`,
|
|
@@ -15138,7 +15191,9 @@ Server-only optional application runtime. See the
|
|
|
15138
15191
|
| `AgentSessionCloseResult` | _type_ | what `close()` achieved: `settled`, or `timedOut` with `remaining` runs still in flight. Only omitting `forceTimeoutMs` guarantees nothing is in flight on return |
|
|
15139
15192
|
| `AgentHistoryProjectionOptions` | _type_ | storage-neutral file resolver, explicit unresolved-file behavior, and how an interrupted turn reaches the model (`interruptedAssistant`) |
|
|
15140
15193
|
| `createAgentToolFenceLifecycle` | function | pre-effect and post-effect run ownership fence for `mountAgent`; compose beside application idempotency for [durable operations](../guide/mcp-and-agents.md#durable-application-owned-execution) |
|
|
15141
|
-
| `AgentRuntimeEventSchema` | schema | transient stream lifecycle plus post-commit admission/checkpoint/run-state/terminal projections |
|
|
15194
|
+
| `AgentRuntimeEventSchema` | schema | transient stream lifecycle plus post-commit admission/checkpoint/run-state/run-operation/terminal projections |
|
|
15195
|
+
| `AgentRunOperationKindSchema` / `AgentRunOperationPhaseSchema` / `AgentRunOperationSchema` / `AgentRunOperation` | schemas / _type_ | latest durable model-request or compaction phase with operation/step identity and original timestamps; request admission is awaited before provider invocation |
|
|
15196
|
+
| `RecordRunOperationSchema` / `RecordRunOperation` | schema / _type_ | owner/fencing/revision-checked mutation of `AgentRun.lastOperation` |
|
|
15142
15197
|
| `createAgentObservability` | function | separate agent-run sink over the shared bounded observability lifecycle |
|
|
15143
15198
|
|
|
15144
15199
|
### Complete runtime inventory
|
|
@@ -15268,7 +15323,8 @@ provider and required capabilities without constructing the model; runtime `mode
|
|
|
15268
15323
|
runs before durable admission.
|
|
15269
15324
|
|
|
15270
15325
|
Delivery exports are `AgentAdmissionEventSchema`, `AgentCheckpointEventSchema`,
|
|
15271
|
-
`AgentRunStateEventSchema`, `
|
|
15326
|
+
`AgentRunStateEventSchema`, `AgentRunOperationEventSchema`, `AgentTerminalEventSchema`,
|
|
15327
|
+
`AgentTransientDeltaEventSchema`,
|
|
15272
15328
|
`AgentReasoningStartEventSchema`, `AgentReasoningDeltaEventSchema`,
|
|
15273
15329
|
`AgentReasoningEndEventSchema`, `AgentToolStatusEventSchema`, `AgentRuntimeEvent`,
|
|
15274
15330
|
`AgentRuntimeEventCursor`, `AgentRuntimeEventCursorSchema`, `AgentRuntimeCursorAdvance`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stitchkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.85.1",
|
|
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",
|
|
@@ -285,7 +285,7 @@
|
|
|
285
285
|
"@types/json-schema": "^7.0.15",
|
|
286
286
|
"@types/react": "^19.2.18",
|
|
287
287
|
"@typescript/typescript6": "^6.0.2",
|
|
288
|
-
"ai": "^7.0.
|
|
288
|
+
"ai": "^7.0.93",
|
|
289
289
|
"fake-indexeddb": "^6.2.5",
|
|
290
290
|
"grammy": "^1.45.1",
|
|
291
291
|
"react": "^19.2.8",
|