stitchkit 0.136.0 → 0.136.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +12 -0
  3. package/dist/agent-executor/executor-contract.d.ts.map +1 -1
  4. package/dist/agent-executor/vocabulary.d.ts +80 -0
  5. package/dist/agent-executor/vocabulary.d.ts.map +1 -1
  6. package/dist/agent-parts/model.d.ts +94 -0
  7. package/dist/agent-parts/model.d.ts.map +1 -1
  8. package/dist/agent-parts/parts.d.ts +176 -0
  9. package/dist/agent-parts/parts.d.ts.map +1 -1
  10. package/dist/agent-runtime/browser/browser-control-contract.d.ts +440 -0
  11. package/dist/agent-runtime/browser/browser-control-contract.d.ts.map +1 -1
  12. package/dist/agent-runtime/browser/control-schema.d.ts +528 -0
  13. package/dist/agent-runtime/browser/control-schema.d.ts.map +1 -1
  14. package/dist/agent-runtime/event-schema.d.ts +704 -0
  15. package/dist/agent-runtime/event-schema.d.ts.map +1 -1
  16. package/dist/agent-runtime/history/run-history-parts.d.ts.map +1 -1
  17. package/dist/agent-runtime/loop/provider-stream-parts.d.ts.map +1 -1
  18. package/dist/agent-runtime/loop/provider-stream-segments.d.ts +0 -2
  19. package/dist/agent-runtime/loop/provider-stream-segments.d.ts.map +1 -1
  20. package/dist/agent-runtime/loop/run-approval-signature.d.ts +5 -1
  21. package/dist/agent-runtime/loop/run-approval-signature.d.ts.map +1 -1
  22. package/dist/agent-runtime/loop/run-loop-events.d.ts +6 -1
  23. package/dist/agent-runtime/loop/run-loop-events.d.ts.map +1 -1
  24. package/dist/agent-runtime/loop/run-stream-parts.d.ts.map +1 -1
  25. package/dist/agent-runtime/loop/run-stream-recorded.d.ts.map +1 -1
  26. package/dist/agent-runtime/loop/run-tool-call.d.ts +11 -3
  27. package/dist/agent-runtime/loop/run-tool-call.d.ts.map +1 -1
  28. package/dist/agent-runtime/providers/ai-sdk-normalize.d.ts +4 -0
  29. package/dist/agent-runtime/providers/ai-sdk-normalize.d.ts.map +1 -1
  30. package/dist/agent-runtime/providers/ai-sdk-tools.d.ts.map +1 -1
  31. package/dist/agent-runtime/runtime-internals.d.ts +1 -3
  32. package/dist/agent-runtime/runtime-internals.d.ts.map +1 -1
  33. package/dist/agent-runtime/schemas-json-projection.d.ts +29 -0
  34. package/dist/agent-runtime/schemas-json-projection.d.ts.map +1 -0
  35. package/dist/agent-runtime/schemas-message.d.ts +88 -0
  36. package/dist/agent-runtime/schemas-message.d.ts.map +1 -1
  37. package/dist/agent-runtime/schemas-run.d.ts +88 -0
  38. package/dist/agent-runtime/schemas-run.d.ts.map +1 -1
  39. package/dist/agent-runtime/stores/branch-messages.d.ts.map +1 -1
  40. package/dist/agent-runtime/stores/branch-replay.d.ts +264 -0
  41. package/dist/agent-runtime/stores/branch-replay.d.ts.map +1 -1
  42. package/dist/agent-runtime/stores/conversations.d.ts +88 -0
  43. package/dist/agent-runtime/stores/conversations.d.ts.map +1 -1
  44. package/dist/agent-runtime/stores/sql-rows.d.ts +64 -0
  45. package/dist/agent-runtime/stores/sql-rows.d.ts.map +1 -1
  46. package/dist/agent-runtime/stores/store-driver-contract.d.ts +616 -0
  47. package/dist/agent-runtime/stores/store-driver-contract.d.ts.map +1 -1
  48. package/dist/agent-runtime/stores/store-events.d.ts +1056 -0
  49. package/dist/agent-runtime/stores/store-events.d.ts.map +1 -1
  50. package/dist/agent-runtime/stores/store.d.ts +1232 -0
  51. package/dist/agent-runtime/stores/store.d.ts.map +1 -1
  52. package/dist/agent-runtime/terminal-commit.d.ts +69 -5
  53. package/dist/agent-runtime/terminal-commit.d.ts.map +1 -1
  54. package/dist/agent-runtime/testing/store-conformance-lifecycle.d.ts +164 -36
  55. package/dist/agent-runtime/testing/store-conformance-lifecycle.d.ts.map +1 -1
  56. package/dist/agent-runtime/testing/store-conformance-support.d.ts +82 -18
  57. package/dist/agent-runtime/testing/store-conformance-support.d.ts.map +1 -1
  58. package/dist/application/diagnostic-journal-manager.d.ts +1 -1
  59. package/dist/application/diagnostic-journal-manager.d.ts.map +1 -1
  60. package/dist/application/notification-delivery.d.ts.map +1 -1
  61. package/dist/entrypoints/agent-executor/acp.js +5 -4
  62. package/dist/entrypoints/agent-executor/claude-sdk.js +7 -6
  63. package/dist/entrypoints/agent-executor/claude.js +7 -6
  64. package/dist/entrypoints/agent-executor/codex.js +6 -5
  65. package/dist/entrypoints/agent-executor/testing/claude-sdk.js +4 -3
  66. package/dist/entrypoints/agent-executor/testing.js +7 -6
  67. package/dist/entrypoints/agent-executor.js +7 -7
  68. package/dist/entrypoints/agent-runtime/ai-sdk.js +30 -24
  69. package/dist/entrypoints/agent-runtime/anthropic.js +3 -3
  70. package/dist/entrypoints/agent-runtime/browser.js +8 -7
  71. package/dist/entrypoints/agent-runtime/harness.js +14 -14
  72. package/dist/entrypoints/agent-runtime/openai.js +3 -3
  73. package/dist/entrypoints/agent-runtime/openrouter.js +3 -3
  74. package/dist/entrypoints/agent-runtime/postgres.js +9 -9
  75. package/dist/entrypoints/agent-runtime/realtime.js +9 -8
  76. package/dist/entrypoints/agent-runtime/sqlite/bun.js +10 -10
  77. package/dist/entrypoints/agent-runtime/sqlite/node.js +10 -10
  78. package/dist/entrypoints/agent-runtime/testing.js +8 -8
  79. package/dist/entrypoints/agent-runtime.js +21 -21
  80. package/dist/entrypoints/application/diagnostic-journal.js +14 -10
  81. package/dist/entrypoints/application.js +16 -4
  82. package/dist/entrypoints/files/packaging.js +72 -36
  83. package/dist/entrypoints/tools/agent.js +2 -2
  84. package/dist/entrypoints/tools/toolkit.js +1 -1
  85. package/dist/entrypoints/tools.js +5 -3
  86. package/dist/files/client-declarations.d.ts +11 -3
  87. package/dist/files/client-declarations.d.ts.map +1 -1
  88. package/dist/files/client-package.d.ts.map +1 -1
  89. package/dist/index-1psbyyhj.js +21 -0
  90. package/dist/{index-kzsetgh9.js → index-26v8hjqm.js} +4 -4
  91. package/dist/{index-4243301z.js → index-2wm9b9vs.js} +5 -5
  92. package/dist/{index-tb36xawm.js → index-32ew02z1.js} +1 -1
  93. package/dist/{index-1en7k3q5.js → index-4q9tmzea.js} +3 -3
  94. package/dist/{index-shte29pg.js → index-8cnfgwg8.js} +148 -106
  95. package/dist/{index-mkmep637.js → index-9m1m92rg.js} +1 -1
  96. package/dist/index-a1rjr381.js +114 -0
  97. package/dist/{index-6kwdfb9m.js → index-akesakvj.js} +23 -4
  98. package/dist/{index-rg08syp1.js → index-d5mhgx72.js} +7 -5
  99. package/dist/{index-36mtj8xm.js → index-e4w0sfm1.js} +2 -2
  100. package/dist/{index-jperyn0c.js → index-gj4wdts6.js} +1 -1
  101. package/dist/{index-pd9e8rz4.js → index-gvv7y0s4.js} +1 -1
  102. package/dist/{index-vebzvse6.js → index-jy907kcs.js} +24 -1
  103. package/dist/{index-54wp467c.js → index-k5azb3v3.js} +4 -21
  104. package/dist/{index-qcy8et93.js → index-kaq9nb7h.js} +6 -6
  105. package/dist/{index-vse7x1qt.js → index-knqye3gv.js} +1 -1
  106. package/dist/{index-tav72wz5.js → index-ks4rhtcc.js} +5 -0
  107. package/dist/{index-xnqab06h.js → index-mtpcax6d.js} +3 -3
  108. package/dist/{index-7qza24g1.js → index-px9r6wv1.js} +1 -1
  109. package/dist/{index-epwvp88y.js → index-r9w7wfgn.js} +1 -1
  110. package/dist/{index-aacwkve4.js → index-sjq4akrx.js} +3 -5
  111. package/dist/{index-5dxgx3yj.js → index-tcv71frn.js} +1 -1
  112. package/dist/{index-1zy31r3b.js → index-v92djygb.js} +1 -1
  113. package/dist/{index-9f60gnfn.js → index-xaa3603f.js} +4 -11
  114. package/dist/{index-j3r7r1mh.js → index-yv7d6tav.js} +1 -1
  115. package/dist/{index-hberxns4.js → index-zagc12j1.js} +5 -5
  116. package/dist/{index-j5vzhj3d.js → index-zqc64g69.js} +3 -3
  117. package/dist/{index-hpzhz1vm.js → index-zthekmrt.js} +2 -2
  118. package/dist/internal/json-stringify.d.ts +37 -0
  119. package/dist/internal/json-stringify.d.ts.map +1 -0
  120. package/llms/agent-runtime.5.txt +1 -1
  121. package/llms/agent-runtime.txt +14 -0
  122. package/llms/application.2.txt +6 -3
  123. package/llms/application.3.txt +2 -1
  124. package/llms/application.txt +4 -1
  125. package/llms/process.2.txt +2 -3
  126. package/llms-full.txt +29 -9
  127. package/llms.txt +2 -2
  128. package/package.json +1 -1
package/llms-full.txt CHANGED
@@ -6995,6 +6995,20 @@ with `mountAgentTools` from `stitchkit/tools` (including the single-argument
6995
6995
  `mountAgentTools({ runtimeTools, access })` form when no HTTP service contracts are mounted). Both
6996
6996
  return `AgentTool` / `AgentToolSet` carrying JSON Schema 2020-12 `inputSchema`, Zod `parseInput`,
6997
6997
  optional `needsApproval`, `onInputAvailable`, and `toModelOutput` returning `AgentToolModelOutput`.
6998
+ Without `toModelOutput`, a tool's output reaches the model, and every later turn that reads the run
6999
+ back, as `JSON.stringify` writes it: a field left `undefined` drops its key and a `Date` becomes its
7000
+ ISO string; a `toModelOutput` JSON value is read the same way. An output `JSON.stringify` cannot
7001
+ write (a BigInt, a cycle, a throwing `toJSON`) fails the call with an `AgentToolError` naming the
7002
+ tool and the field and saying the tool ran, so the model does not take it for a call that never
7003
+ happened. That holds with `toModelOutput` too: a branch presents the result again from the
7004
+ recorded output.
7005
+
7006
+ What `toModelOutput` showed the model is recorded beside the result (`tool-result.modelOutput`),
7007
+ and a later turn sends that again rather than calling `toModelOutput` a second time: history is
7008
+ what the model read, and it does not change when the function does. Three records are presented
7009
+ anew, from the JSON form of the output — where a `Date` is its ISO string: one written before the
7010
+ field existed, one whose model output held a `file` part, and a branched one. To present recorded
7011
+ results differently on purpose, pass `resolveToolModelOutput` to the history projection.
6998
7012
 
6999
7013
  When an operation needs one or a few model steps without a durable conversation store — structured
7000
7014
  extraction, classification, a bounded tool loop, or standalone streaming — call `completeText`,
@@ -9907,7 +9921,10 @@ if (result.outcome === 'refused') internalCounter.add(1, { reason: result.reason
9907
9921
  await journal.close({ timeoutMs: 5_000 })
9908
9922
  ```
9909
9923
 
9910
- The owner schema and JSON serialization run synchronously before admission. Accepted frames carry
9924
+ The owner schema and JSON serialization run synchronously before admission. An event is kept as
9925
+ `JSON.stringify` writes it, and only if the schema reads that form back: an optional field left
9926
+ `undefined` is accepted, while a cycle, a BigInt or a `Date` in a `z.date()` field is `invalid`.
9927
+ Accepted frames carry
9911
9928
  a process epoch and contiguous sequence and retain their complete bytes inside both pending limits
9912
9929
  until their append attempt settles. Capacity, invalid, oversized, closed and terminal-failure
9913
9930
  refusals are explicit; accepted ordered frames are never evicted.
@@ -10460,9 +10477,12 @@ Opt into `delivery: { version, actions, project }` on `createNotificationOutbox`
10460
10477
  The pure `actions(payload)` selector runs at enqueue; the versioned plan remains
10461
10478
  fixed throughout retry. Each `send` receives its action and a stable idempotency
10462
10479
  key; return a small JSON receipt such as a remote message or uploaded object ID.
10463
- An action that returned is confirmed and is never sent again: a result that is not
10464
- JSON, or does not fit the state's byte budget, is kept as `receipt: null` with
10465
- `unrecorded: 'not-json' | 'too-large'` and reported to `onError`.
10480
+ The receipt is kept as `JSON.stringify` writes it: a field left `undefined` drops,
10481
+ a `Date` becomes its ISO string. An action that returned is confirmed and is never
10482
+ sent again: a result JSON cannot carry (a BigInt, a cycle), or one that does not fit
10483
+ the state's byte budget, is kept as `receipt: null` with
10484
+ `unrecorded: 'not-json' | 'too-large'` and reported to `onError`, naming the field
10485
+ for `not-json`.
10466
10486
  `project(notification, receipts)` applies all confirmed results locally and must
10467
10487
  be idempotent. Checkpoints and the final projection timestamp live in the existing
10468
10488
  atomic StateStore; completed receipts retain them within retention/byte limits.
@@ -11737,9 +11757,8 @@ version is outside the range you declared.
11737
11757
  Declarations are emitted with `tsconfig`, for the entries and what they import — nothing else of
11738
11758
  the project is typechecked or shipped. The tsconfig's directory is the root: every entry lies
11739
11759
  under it, and `dist/` in the archive mirrors it. A `typescript` package must be installed in the
11740
- project; the build runs its compiler with the runtime that runs the build (Bun or Node), and
11741
- writes a temporary `.client-package-*.tsconfig.json` beside your tsconfig for the length of the
11742
- emit.
11760
+ project; the build runs its compiler with the runtime that runs the build (Bun or Node) from a
11761
+ generated tsconfig inside the build's temporary directory, leaving the project tree untouched.
11743
11762
 
11744
11763
  The compiler leaves relative specifiers in a declaration as the source wrote them, and a
11745
11764
  consumer under `moduleResolution: NodeNext` cannot resolve an extensionless one. The build
@@ -29614,7 +29633,8 @@ never trust a client-supplied owner ID as that scope.
29614
29633
  immutable executor `version`, pure `actions(payload)` plan selector (1–128 unique
29615
29634
  names, each at most 128 characters), and idempotent `project(notification, receipts)`.
29616
29635
  `send` receives optional `action` and stable `idempotencyKey`, and returns a JSON
29617
- remote receipt (void becomes null). A result that is not JSON or does not fit the
29636
+ remote receipt (void becomes null), kept as `JSON.stringify` writes it. A result JSON
29637
+ cannot carry (a BigInt, a cycle; `onError` names the field) or that does not fit the
29618
29638
  byte budget is kept as `receipt: null` with `unrecorded: 'not-json' | 'too-large'`;
29619
29639
  the action stays confirmed and is not sent again. `retiredVersions` maps earlier
29620
29640
  plan versions to their `NotificationProjection` so queued items drain after an
@@ -29724,7 +29744,7 @@ Server-only, peer-free optional application runtime. Runs models exclusively thr
29724
29744
  | `AgentConversationPurgeResultSchema` / `AgentConversationPurgeResult` | schema / _type_ | typed deletion/refusal outcomes; active refusal includes run IDs |
29725
29745
  | `AgentConversationPurgedError` | class | runtime mutation rejected because its conversation ID is permanently purged |
29726
29746
  | `AgentConversationPurgeDriver` | _type_ | optional `driver.conversations` capability: serialized tombstone read and atomic removal of all owned records |
29727
- | `projectAgentHistory` | function | asynchronously project canonical records and resolved multimodal files into provider-valid peer-free `AgentModelMessage[]` |
29747
+ | `projectAgentHistory` | function | asynchronously project canonical records and resolved multimodal files into provider-valid peer-free `AgentModelMessage[]`; a `tool-result` part sends its recorded `modelOutput` (what the tool's `toModelOutput` showed the model in the live step) and calls `toModelOutput` only for a record without it; `resolveToolModelOutput` runs first |
29728
29748
  | `defineModelRegistry` | function | typed language-model descriptors, capabilities and `AgentModelDriverFactory` construction |
29729
29749
  | `AgentModelCatalogSchema` / `AgentModelCatalog` | schema / _type_ | provider-neutral complete/partial model catalog with separately sourced popularity, metrics, prices and observation time |
29730
29750
  | `AgentModelCatalogEntrySchema` / `AgentModelCatalogEntry` | schema / _type_ | one canonical provider model descriptor with optional price, popularity and metric evidence |
package/llms.txt CHANGED
@@ -29,7 +29,7 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
29
29
  - **stitchkit/handler**: [llms/handler.txt](llms/handler.txt) 2.3 KB
30
30
  - **stitchkit/server**: [llms/server.txt](llms/server.txt) 47.7 KB → [llms/server.2.txt](llms/server.2.txt) 46.4 KB → [llms/server.3.txt](llms/server.3.txt) 47.1 KB → [llms/server.4.txt](llms/server.4.txt) 43.9 KB → [llms/server.5.txt](llms/server.5.txt) 26.7 KB
31
31
  - **stitchkit/observability**: [llms/observability.txt](llms/observability.txt) 40.3 KB → [llms/observability.2.txt](llms/observability.2.txt) 10.1 KB
32
- - **stitchkit/agent-runtime**: [llms/agent-runtime.txt](llms/agent-runtime.txt) 35.9 KB → [llms/agent-runtime.2.txt](llms/agent-runtime.2.txt) 44.2 KB → [llms/agent-runtime.3.txt](llms/agent-runtime.3.txt) 38.2 KB → [llms/agent-runtime.4.txt](llms/agent-runtime.4.txt) 34.1 KB → [llms/agent-runtime.5.txt](llms/agent-runtime.5.txt) 44.3 KB → [llms/agent-runtime.6.txt](llms/agent-runtime.6.txt) 17.5 KB
32
+ - **stitchkit/agent-runtime**: [llms/agent-runtime.txt](llms/agent-runtime.txt) 37.0 KB → [llms/agent-runtime.2.txt](llms/agent-runtime.2.txt) 44.2 KB → [llms/agent-runtime.3.txt](llms/agent-runtime.3.txt) 38.2 KB → [llms/agent-runtime.4.txt](llms/agent-runtime.4.txt) 34.1 KB → [llms/agent-runtime.5.txt](llms/agent-runtime.5.txt) 44.5 KB → [llms/agent-runtime.6.txt](llms/agent-runtime.6.txt) 17.5 KB
33
33
  - **stitchkit/agent-runtime/testing**: [llms/agent-runtime-testing.txt](llms/agent-runtime-testing.txt) 3.8 KB
34
34
  - **stitchkit/agent-runtime/harness**: [llms/agent-runtime-harness.txt](llms/agent-runtime-harness.txt) 13.7 KB
35
35
  - **stitchkit/agent-runtime/coding-tools**: [llms/agent-runtime-coding-tools.txt](llms/agent-runtime-coding-tools.txt) 5.0 KB
@@ -47,7 +47,7 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
47
47
  - **stitchkit/agent-runtime/postgres**: [llms/agent-runtime-postgres.txt](llms/agent-runtime-postgres.txt) 1.7 KB
48
48
  - **stitchkit/agent-runtime/sqlite/bun**: [llms/agent-runtime-sqlite-bun.txt](llms/agent-runtime-sqlite-bun.txt) 1.7 KB
49
49
  - **stitchkit/agent-runtime/sqlite/node**: [llms/agent-runtime-sqlite-node.txt](llms/agent-runtime-sqlite-node.txt) 1.6 KB
50
- - **stitchkit/application**: [llms/application.txt](llms/application.txt) 40.9 KB → [llms/application.2.txt](llms/application.2.txt) 31.3 KB → [llms/application.3.txt](llms/application.3.txt) 32.3 KB
50
+ - **stitchkit/application**: [llms/application.txt](llms/application.txt) 41.1 KB → [llms/application.2.txt](llms/application.2.txt) 31.5 KB → [llms/application.3.txt](llms/application.3.txt) 32.4 KB
51
51
  - **stitchkit/application/grammy**: [llms/application-grammy.txt](llms/application-grammy.txt) 2.3 KB
52
52
  - **stitchkit/application/opentelemetry**: [llms/application-opentelemetry.txt](llms/application-opentelemetry.txt) 1.6 KB
53
53
  - **stitchkit/application/directory-inbox**: [llms/application-directory-inbox.txt](llms/application-directory-inbox.txt) 0.3 KB
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stitchkit",
3
- "version": "0.136.0",
3
+ "version": "0.136.2",
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",