stitchkit 0.134.1 → 0.134.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 (90) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +6 -6
  3. package/dist/agent-runtime/sql-rows.d.ts +10 -10
  4. package/dist/agent-runtime/sqlite-schema.d.ts +2 -2
  5. package/dist/agent-runtime/sqlite.d.ts +1 -1
  6. package/dist/agent-runtime/store-conformance-lifecycle.d.ts +20 -20
  7. package/dist/agent-runtime/store-conformance-support.d.ts +10 -10
  8. package/dist/agent-runtime/terminal-commit.d.ts +10 -10
  9. package/dist/application/grammy.d.ts +1 -1
  10. package/dist/browser/contract-identity.d.ts +1 -1
  11. package/dist/browser/http-fetch.d.ts +1 -1
  12. package/dist/browser/socket-io-contract.d.ts +1 -1
  13. package/dist/contract/bridge-envelope.d.ts +1 -1
  14. package/dist/contract/client-types.d.ts +1 -1
  15. package/dist/contract/define.d.ts +2 -2
  16. package/dist/contract/errors-factory.d.ts +1 -1
  17. package/dist/contract/fingerprint.d.ts +1 -1
  18. package/dist/device-relay/hub.d.ts +1 -1
  19. package/dist/entrypoints/agent-runtime/postgres.js +3 -3
  20. package/dist/entrypoints/agent-runtime/sqlite/bun.js +1 -1
  21. package/dist/entrypoints/agent-runtime/sqlite/node.js +1 -1
  22. package/dist/entrypoints/bin/upgrade-cli.js +1 -1
  23. package/dist/entrypoints/files/packaging.js +2 -2
  24. package/dist/entrypoints/handler.js +2 -2
  25. package/dist/entrypoints/node.js +2 -2
  26. package/dist/entrypoints/server.js +2 -2
  27. package/dist/entrypoints/tools/mcp.js +3 -3
  28. package/dist/entrypoints/tools/toolkit.js +3 -3
  29. package/dist/entrypoints/tools.js +2 -2
  30. package/dist/files/native-packaging-layout.d.ts +1 -1
  31. package/dist/{index-654rhe5d.js → index-7mjsb7zv.js} +5 -1
  32. package/dist/{index-kdw0n92g.js → index-a09r9ff0.js} +1 -1
  33. package/dist/{index-epyj7ptp.js → index-a84wj6y8.js} +4 -4
  34. package/dist/{index-qymek778.js → index-m2b49tvc.js} +76 -22
  35. package/dist/{index-mrng24wq.js → index-zag9sjpd.js} +1 -1
  36. package/dist/internal/postgres-query.d.ts +1 -1
  37. package/dist/react/query-client.d.ts +1 -1
  38. package/dist/server/bridge-host.d.ts +1 -1
  39. package/dist/server/bun.d.ts +1 -1
  40. package/dist/server/endpoint-dispatch.d.ts.map +1 -1
  41. package/dist/server/middleware/cors.d.ts +3 -3
  42. package/dist/server/middleware/cors.d.ts.map +1 -1
  43. package/dist/server/socket-io-config.d.ts +1 -1
  44. package/dist/service-host/identity.d.ts +1 -1
  45. package/dist/service-host/systemd-inspect.d.ts +1 -1
  46. package/dist/testing/manual-clock.d.ts +1 -1
  47. package/dist/tools/connections/types.d.ts +1 -1
  48. package/dist/tools/mcp/handler.d.ts +1 -1
  49. package/dist/tools/mcp/lazy-discovery.d.ts +1 -1
  50. package/dist/tools/mcp/mount.d.ts +1 -1
  51. package/dist/tools/mcp/stdio.d.ts +1 -1
  52. package/llms/agent-runtime-browser.txt +1 -1
  53. package/llms/agent-runtime-sqlite-bun.txt +1 -1
  54. package/llms/agent-runtime.2.txt +1 -1
  55. package/llms/agent-runtime.3.txt +4 -4
  56. package/llms/agent-runtime.txt +3 -3
  57. package/llms/application.2.txt +4 -4
  58. package/llms/application.txt +4 -4
  59. package/llms/cli.2.txt +27 -6
  60. package/llms/cli.txt +2 -2
  61. package/llms/contract.txt +1 -1
  62. package/llms/files-packaging.txt +1 -1
  63. package/llms/geo.txt +1 -1
  64. package/llms/live.txt +1 -1
  65. package/llms/oauth.txt +4 -4
  66. package/llms/observability.txt +3 -3
  67. package/llms/primitives.txt +1 -1
  68. package/llms/process.2.txt +7 -7
  69. package/llms/react.txt +4 -4
  70. package/llms/server.2.txt +7 -7
  71. package/llms/server.3.txt +5 -5
  72. package/llms/server.4.txt +6 -6
  73. package/llms/server.txt +13 -5
  74. package/llms/stitchkit.2.txt +3 -3
  75. package/llms/stitchkit.3.txt +1 -1
  76. package/llms/stitchkit.txt +4 -4
  77. package/llms/telegram.txt +1 -1
  78. package/llms/testing.txt +4 -4
  79. package/llms/tools-connections.txt +1 -1
  80. package/llms/tools-toolkit.txt +3 -1
  81. package/llms/tools.2.txt +6 -6
  82. package/llms/tools.3.txt +8 -8
  83. package/llms/upgrading-0.106.0-0.126.0.txt +1 -1
  84. package/llms/upgrading-0.128.0-0.134.0.txt +7 -1
  85. package/llms/upgrading-0.37.0-0.53.0.txt +7 -7
  86. package/llms/upgrading-0.69.0-0.95.0.txt +1 -1
  87. package/llms/upgrading-0.96.0-0.105.0.txt +1 -1
  88. package/llms-full.txt +149 -112
  89. package/llms.txt +5 -5
  90. package/package.json +1 -1
package/llms/tools.3.txt CHANGED
@@ -188,7 +188,7 @@ a deadline the remote client hit (`REQUEST_TIMEOUT`, `408`) follows the status l
188
188
  When a contract endpoint or runtime tool declares `output`, its MCP tool
189
189
  registers that exact schema as `outputSchema` and returns the validated value as
190
190
  `structuredContent` alongside a JSON text block. Every JSON root type is kept
191
- unchanged: object, array, string, number, boolean and `null`. Stitchkit does not
191
+ unchanged: object, array, string, number, boolean and `null`. StitchKit does not
192
192
  wrap non-object values in `{ result }`; protocol-era adaptation belongs to the
193
193
  official SDK.
194
194
 
@@ -283,7 +283,7 @@ removes keys on purpose and is not reported. → [ADR 0196](../decisions/0196-a-
283
283
  ## AI agents — `mountAgent`
284
284
 
285
285
  `mountAgent` remains the low-level path when the application owns its own model
286
- loop and conversation state. For the optional Stitchkit-owned run/history loop,
286
+ loop and conversation state. For the optional StitchKit-owned run/history loop,
287
287
  see [Agent application runtime](./agent-runtime.md).
288
288
 
289
289
  `mountAgent` turns a service into a Vercel AI SDK `ToolSet`, ready for
@@ -465,7 +465,7 @@ hook/lifecycle `OperationIdentity` and the tool `RequestEvent`
465
465
  (`serviceName`, `action`, `httpMethod`). A runtime operation has no HTTP route,
466
466
  so no fake `path` is added.
467
467
 
468
- When `output` is declared, Stitchkit validates the neutral handler result after
468
+ When `output` is declared, StitchKit validates the neutral handler result after
469
469
  `afterHandle`. MCP owns `structuredContent` and `isError`: a presenter supplies
470
470
  only rich `content`/metadata, while the framework inserts the validated
471
471
  structured result and normalises failures. The Agent adapter uses the AI SDK's
@@ -474,7 +474,7 @@ neutral output while the model receives text/file content. Presentation
474
474
  callbacks require an output schema.
475
475
 
476
476
  The MCP registration uses an identity carrier: the SDK advertises the compiled
477
- JSON Schema but forwards the raw object into Stitchkit. Input failures therefore
477
+ JSON Schema but forwards the raw object into StitchKit. Input failures therefore
478
478
  use the same validation, lifecycle and hook path as contract tools.
479
479
 
480
480
  ### Managed wait, download, upload and view-file
@@ -585,7 +585,7 @@ batch operation.
585
585
  ### Async-operation protocol
586
586
 
587
587
  For a complete long-running operation, define the linked runtime-only surface
588
- once. Stitchkit owns transport names, validation and wait mechanics; the
588
+ once. StitchKit owns transport names, validation and wait mechanics; the
589
589
  application still owns storage, execution, retries and domain states:
590
590
 
591
591
  ```ts
@@ -649,7 +649,7 @@ prevents a stale run owner from crossing an effect boundary; the transactional
649
649
  idempotency record makes a repeated current call converge on one operation.
650
650
  Neither replaces the other.
651
651
 
652
- Stitchkit deliberately does **not** own the durable queue, operation database,
652
+ StitchKit deliberately does **not** own the durable queue, operation database,
653
653
  lease renewal, provider retry/reconciliation protocol, asset catalog or domain
654
654
  states. The process-local application resource stops admission and drains
655
655
  accepted work; unresolved durable records survive shutdown for the next
@@ -780,7 +780,7 @@ operations whose contract intentionally differs.
780
780
  Deferred tool search, name snapshots and boot diagnostics accept the same
781
781
  object-shaped surface as the mounts. Contract operations are followed by
782
782
  runtime definitions, matching mount order; exposure filters and collisions are
783
- resolved by Stitchkit rather than by consumer code:
783
+ resolved by StitchKit rather than by consumer code:
784
784
 
785
785
  ```ts
786
786
  import {
@@ -807,7 +807,7 @@ fails first on duplicate contract/runtime names. There is no runtime-only
807
807
  manifest helper or public mount adapter: the framework owns merging and schema
808
808
  projection.
809
809
 
810
- Applications using Stitchkit's durable runtime can compose this manifest with
810
+ Applications using StitchKit's durable runtime can compose this manifest with
811
811
  bounded per-run activation through `createDeferredAgentToolSurface` from
812
812
  `stitchkit/agent-runtime`. It keeps selected calls as direct `mountAgent` tools
813
813
  rather than routing them through a generic executor. Search receipts live in
@@ -514,7 +514,7 @@ succeeds, its result stays on stdout, stderr names the refusal and the exit is n
514
514
  A JS bundle uses `delivery: 'companion'`; every shape is in the [native I/O guide](./native-io.md). Search pattern:
515
515
  `createCli` with a `download` option in a project that runs `bun build` for macOS.
516
516
  2. On Windows, run the download through Linux or macOS, or read the URLs from the operation's
517
- JSON result and fetch them yourself. Stitchkit offers no weaker path on that platform.
517
+ JSON result and fetch them yourself. StitchKit offers no weaker path on that platform.
518
518
  3. A download now replaces a file rather than rewriting it. Give the process write permission on
519
519
  the output directory, and do not point it at a bind-mounted file: that refuses with `EBUSY`. A
520
520
  replaced file belongs to the process user, and a read-only file is replaced like any other.
@@ -63,7 +63,13 @@ const runtime = createAgentRuntime({
63
63
  - `anthropicProvider` from `stitchkit/agent-runtime/anthropic`
64
64
  2. Replace `fromAiSdkTools(mountAgent(...))` with `mountAgentTools(...)` from `stitchkit/tools`, and replace custom AI SDK `tool(...)` declarations with `defineAgentTool(...)` from `stitchkit/tools`.
65
65
  3. Replace direct `generateText` / `generateObject` helper calls with `completeText` / `completeObject` from `stitchkit/agent-runtime`, and replace `wrapLanguageModel` middleware with `wrapModelDriver` / `composeModelDrivers`.
66
- 4. Remove `ai` and `@openrouter/ai-sdk-provider` from `package.json` if nothing else in your project uses `stitchkit/tools/agent` or `stitchkit/agent-runtime/ai-sdk`.
66
+ 4. Check for every remaining `ai`-requiring `stitchkit` entrypoint — `stitchkit/tools/agent`, `stitchkit/tools/toolkit`, and `stitchkit/agent-runtime/ai-sdk` — before removing `ai` and `@openrouter/ai-sdk-provider` from `package.json`:
67
+ - `stitchkit/tools/toolkit` (`createToolkit`) deliberately requires **both** `@modelcontextprotocol/server` and `ai` because it composes the MCP server factories and AI SDK `mountAgent` together (ADR 0284). Keeping a `stitchkit/tools/toolkit` import after removing `ai` fails clean installs and bundling (`Could not resolve: "ai"`).
68
+ - If you used `createToolkit<AppContext>()` without AI SDK `mountAgent`, replace it with the narrow entrypoints directly:
69
+ - MCP servers (`createMcpHandler`, `buildMcpServer`, `mountMcp`, `createStdioMcpServer`) → import from `stitchkit/tools/mcp` (requires only `@modelcontextprotocol/server`) and annotate the `context` factory return type (`context: (auth): AppContext => ({ ... })`).
70
+ - Peer-free agent tools (`mountAgentTools`, `defineAgentTool`) → import from `stitchkit/tools` (zero optional peers).
71
+ - CLI (`createCli`, `createCliInvoker`) → import from `stitchkit/cli` (zero optional peers; annotate `context: (auth): AppContext => ({ ... })`).
72
+ - Once no imports of `stitchkit/tools/agent`, `stitchkit/tools/toolkit`, or `stitchkit/agent-runtime/ai-sdk` remain (`rg "stitchkit/(tools/agent|tools/toolkit|agent-runtime/ai-sdk)" .`), remove `ai` and `@openrouter/ai-sdk-provider` from `package.json`.
67
73
 
68
74
  ```ts
69
75
  // After (Step 2: completely peer-free)
@@ -190,7 +190,7 @@ runtime callback arguments; only `.withOptions` reads `ClientRequestOptions`.
190
190
  ### HTTP auth moves to the pre-body `authorize` phase
191
191
 
192
192
  Move the HTTP wiring of `createAuthHook` from `beforeHandle` to `authorize`.
193
- This lets Stitchkit reject an unauthorized JSON or multipart request after path
193
+ This lets StitchKit reject an unauthorized JSON or multipart request after path
194
194
  parameter validation but before reading a body chunk. Keep application
195
195
  preconditions that depend on validated input in `beforeHandle`.
196
196
 
@@ -321,7 +321,7 @@ collected tool logs from stdout.
321
321
 
322
322
  ### MCP TypeScript SDK v2 and protocol `2026-07-28`
323
323
 
324
- This is a hard cut: there is one Stitchkit API and no v1 aliases. Applications
324
+ This is a hard cut: there is one StitchKit API and no v1 aliases. Applications
325
325
  that expose MCP install the split server package; applications that implement an
326
326
  MCP host or run client E2E install the split client package.
327
327
 
@@ -397,7 +397,7 @@ modern-only. This is not a stateful compatibility transport.
397
397
 
398
398
  #### Output shape depends on the negotiated protocol era
399
399
 
400
- Stitchkit always validates the handler result against the declared output
400
+ StitchKit always validates the handler result against the declared output
401
401
  schema. The negotiated MCP era determines only its wire representation:
402
402
 
403
403
  | Negotiated era | Non-object `structuredContent` |
@@ -462,7 +462,7 @@ mountOAuthProvider({
462
462
  A URL client id must be HTTPS and serve a document whose `client_id` exactly
463
463
  matches that URL, with explicit `redirect_uris` and
464
464
  `token_endpoint_auth_method: 'none'`. Do not keep a consumer-side metadata
465
- fetcher or DCR fallback; Stitchkit owns SSRF-safe resolution and caching.
465
+ fetcher or DCR fallback; StitchKit owns SSRF-safe resolution and caching.
466
466
 
467
467
  Multi-round input is opt-in on the operation and does not change Agent, CLI or
468
468
  ordinary HTTP handlers:
@@ -582,7 +582,7 @@ summarizeTransports(surface)
582
582
  `ToolNameEntry` adds `kind: 'contract' | 'runtime'`. `TransportSummary` is now
583
583
  `{ contractServices, runtimeTools, totals, sources }`; replace `services` and
584
584
  `perService` reads with the explicit counts and mixed-source breakdown. There
585
- is no positional overload and no `buildRuntimeToolManifest`: Stitchkit owns the
585
+ is no positional overload and no `buildRuntimeToolManifest`: StitchKit owns the
586
586
  combined order, transport filtering, canonical presentation schema and
587
587
  cross-origin collision checks.
588
588
 
@@ -650,7 +650,7 @@ createMcpHandler({
650
650
  ```
651
651
 
652
652
  Keep direct `services(auth)` / `runtimeTools(auth)` only for genuinely
653
- unbounded definitions; Stitchkit intentionally does not cache arbitrary auth
653
+ unbounded definitions; StitchKit intentionally does not cache arbitrary auth
654
654
  values.
655
655
 
656
656
  Contract success bodies are now determined by the presence of `output`, not by
@@ -823,7 +823,7 @@ mountable.argumentSchema // executable CLI argument adapter only
823
823
 
824
824
  Contract and native handlers keep their original Zod schemas; MCP and agent SDK
825
825
  adapters now forward raw arguments so defaults, coercions, refinements and
826
- transforms execute exactly once inside Stitchkit. There are no compatibility
826
+ transforms execute exactly once inside StitchKit. There are no compatibility
827
827
  exports for `flattenDiscriminatedUnion`, `flattenUnionsDeep` or
828
828
  `MountableTool.schema`. → ADR 0050
829
829
 
@@ -403,7 +403,7 @@ If you operate a built-in SQLite store file:
403
403
 
404
404
  1. Back the file up. The first open by 0.86.0 migrates it to schema 2 in one
405
405
  transaction and there is no way back: a 0.85.x package refuses a migrated
406
- file with `Unsupported Stitchkit agent-runtime SQLite schema version 2`.
406
+ file with `Unsupported StitchKit agent-runtime SQLite schema version 2`.
407
407
  2. Check the build for FTS5 before deploying:
408
408
 
409
409
  ```sql
@@ -91,7 +91,7 @@ pipes drain.
91
91
  read `asset.sourcePath`, hash the addon themselves, switch over the refusal `state`/`code`, pass a
92
92
  `platform` other than the literal `'darwin'`, or parse `node_modules/stitchkit/native-assets.json`.
93
93
 
94
- The package now publishes the `size` and SHA256 of each Darwin addon, computed when Stitchkit is
94
+ The package now publishes the `size` and SHA256 of each Darwin addon, computed when StitchKit is
95
95
  built, in `native-assets.json` at `formatVersion: 2`. `createNativePackaging` reads each selected
96
96
  addon once, compares it with that digest and returns the verified bytes. An installed addon that
97
97
  differs refuses with `NATIVE_ASSET_DIGEST_MISMATCH`.