stitchkit 0.103.0 → 0.103.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 (87) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/agent-runtime/browser-control-contract.d.ts +1118 -0
  3. package/dist/agent-runtime/browser-control-contract.d.ts.map +1 -0
  4. package/dist/agent-runtime/browser-controller.d.ts +31 -0
  5. package/dist/agent-runtime/browser-controller.d.ts.map +1 -0
  6. package/dist/agent-runtime/harness-control.d.ts.map +1 -1
  7. package/dist/agent-runtime/harness-realtime.d.ts +25 -0
  8. package/dist/agent-runtime/harness-realtime.d.ts.map +1 -0
  9. package/dist/agent-runtime/harness-tools.d.ts +11 -0
  10. package/dist/agent-runtime/harness-tools.d.ts.map +1 -0
  11. package/dist/agent-runtime/react.d.ts +4 -0
  12. package/dist/agent-runtime/react.d.ts.map +1 -0
  13. package/dist/agent-runtime/run-assertions.d.ts +63 -0
  14. package/dist/agent-runtime/run-assertions.d.ts.map +1 -0
  15. package/dist/entrypoints/agent-runtime/browser.d.ts +2 -0
  16. package/dist/entrypoints/agent-runtime/browser.d.ts.map +1 -1
  17. package/dist/entrypoints/agent-runtime/browser.js +235 -0
  18. package/dist/entrypoints/agent-runtime/coding-tools.js +3 -3
  19. package/dist/entrypoints/agent-runtime/harness-tools.d.ts +2 -0
  20. package/dist/entrypoints/agent-runtime/harness-tools.d.ts.map +1 -0
  21. package/dist/entrypoints/agent-runtime/harness-tools.js +32 -0
  22. package/dist/entrypoints/agent-runtime/harness.js +13 -228
  23. package/dist/entrypoints/agent-runtime/react.d.ts +2 -0
  24. package/dist/entrypoints/agent-runtime/react.d.ts.map +1 -0
  25. package/dist/entrypoints/agent-runtime/react.js +8 -0
  26. package/dist/entrypoints/agent-runtime/realtime.d.ts +2 -0
  27. package/dist/entrypoints/agent-runtime/realtime.d.ts.map +1 -0
  28. package/dist/entrypoints/agent-runtime/realtime.js +159 -0
  29. package/dist/entrypoints/agent-runtime/sandbox.js +3 -3
  30. package/dist/entrypoints/agent-runtime/testing.d.ts +1 -0
  31. package/dist/entrypoints/agent-runtime/testing.d.ts.map +1 -1
  32. package/dist/entrypoints/agent-runtime/testing.js +67 -2
  33. package/dist/entrypoints/agent-runtime.js +25 -20
  34. package/dist/entrypoints/cli.js +8 -8
  35. package/dist/entrypoints/index.js +15 -226
  36. package/dist/entrypoints/node.js +7 -5
  37. package/dist/entrypoints/observability.js +2 -2
  38. package/dist/entrypoints/react.js +2 -2
  39. package/dist/entrypoints/remote.js +3 -3
  40. package/dist/entrypoints/server.js +10 -8
  41. package/dist/entrypoints/testing.js +4 -4
  42. package/dist/entrypoints/tools/connections.js +2 -2
  43. package/dist/entrypoints/tools/invoker.js +6 -6
  44. package/dist/entrypoints/tools.js +25 -36
  45. package/dist/entrypoints/tracking.js +2 -2
  46. package/dist/{index-d82d3xg4.js → index-0c419yx7.js} +1 -1
  47. package/dist/{index-c6aagrbd.js → index-1br6gwhf.js} +4 -4
  48. package/dist/{index-xkhk5d6g.js → index-1khy8y7n.js} +5 -48
  49. package/dist/index-20yvtn9a.js +38 -0
  50. package/dist/{index-a9pd417t.js → index-5vyd0fkb.js} +1 -34
  51. package/dist/{index-r1z0rd9c.js → index-7n68nmc6.js} +1 -1
  52. package/dist/{index-zs4ms3th.js → index-90ppdx3q.js} +7 -30
  53. package/dist/{index-djjhhgjk.js → index-a4ajxwmb.js} +1 -1
  54. package/dist/index-c9d05kvt.js +11 -0
  55. package/dist/{index-ewbaywk5.js → index-dnn9z96q.js} +3 -3
  56. package/dist/index-jn9g8xdt.js +246 -0
  57. package/dist/index-kmpzj1cq.js +48 -0
  58. package/dist/{index-dvwj1f43.js → index-m2xqkv55.js} +2 -2
  59. package/dist/{index-m9fndta6.js → index-n2gre124.js} +3 -3
  60. package/dist/index-nggfa2yn.js +34 -0
  61. package/dist/{index-m79yr938.js → index-pw99k9h5.js} +1 -10
  62. package/dist/index-qapzv4p5.js +54 -0
  63. package/dist/index-r34mvse1.js +225 -0
  64. package/dist/{index-n9tyz8z3.js → index-r956rndn.js} +2 -2
  65. package/dist/index-srs8hj9c.js +10 -0
  66. package/dist/{index-jzczzcsb.js → index-tgzhq07n.js} +1 -1
  67. package/dist/index-vgkbcnkc.js +29 -0
  68. package/dist/{index-7z9ym7t8.js → index-x87j7csh.js} +35 -14
  69. package/dist/{index-3ct7hhq6.js → index-xwq9j1sf.js} +6 -56
  70. package/dist/{index-hby4qhax.js → index-yex7eg1v.js} +4 -10
  71. package/dist/{index-1h6gtdrj.js → index-ygkka6zn.js} +1 -1
  72. package/dist/index-ze1eph1k.js +20 -0
  73. package/dist/tools/schema/flatten-join.d.ts +1 -1
  74. package/dist/tools/schema/flatten-join.d.ts.map +1 -1
  75. package/dist/tools/schema/flatten.d.ts.map +1 -1
  76. package/llms/agent-runtime-browser.txt +26 -0
  77. package/llms/agent-runtime-harness-tools.txt +25 -0
  78. package/llms/agent-runtime-harness.txt +140 -1
  79. package/llms/agent-runtime-react.txt +21 -0
  80. package/llms/agent-runtime-realtime.txt +30 -0
  81. package/llms/agent-runtime-testing.txt +6 -0
  82. package/llms/stitchkit.txt +5 -1
  83. package/llms/tools.3.txt +1 -1
  84. package/llms/tools.txt +19 -1
  85. package/llms-full.txt +229 -3
  86. package/llms.txt +9 -5
  87. package/package.json +13 -1
package/llms-full.txt CHANGED
@@ -81,7 +81,10 @@ own, recorded as an ADR.
81
81
  | `stitchkit/agent-runtime/harness` | server | evolving | resource-aware process-local facade over the canonical Agent runtime; supervision stays outside |
82
82
  | `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 |
83
83
  | `stitchkit/agent-runtime/openrouter` | server | evolving | isolated OpenRouter language-model adapter |
84
- | `stitchkit/agent-runtime/browser` | browser + server | evolving | canonical agent records, events and reconnect cursor without execution or sinks |
84
+ | `stitchkit/agent-runtime/browser` | browser + server | evolving | canonical agent records, events, reconnect cursor and optional conversation controller |
85
+ | `stitchkit/agent-runtime/harness-tools` | server | evolving | full mountAgent configuration with the current run fence |
86
+ | `stitchkit/agent-runtime/react` | browser + server | evolving | React subscription to an application-owned agent controller |
87
+ | `stitchkit/agent-runtime/realtime` | server (Bun or Node) | evolving | authorized agent control over the existing Socket.IO server |
85
88
  | `stitchkit/agent-runtime/sqlite/bun` | server (Bun) | evolving | durable built-in SQLite store for the agent runtime |
86
89
  | `stitchkit/agent-runtime/sqlite/node` | server (Node ≥ 22.5) | evolving | durable built-in SQLite store for the agent runtime |
87
90
  | `stitchkit-tui` | terminal (Bun) | evolving | optional official OpenTUI host over a caller-composed headless runtime |
@@ -191,6 +194,7 @@ map — feature → packages:
191
194
  | MCP / agent adapters (`stitchkit/tools`) | `@modelcontextprotocol/server` `ai` |
192
195
  | Agent application runtime (`stitchkit/agent-runtime`) | `ai` |
193
196
  | Headless Agent harness (`stitchkit/agent-runtime/harness`) | `ai` |
197
+ | Harness tools (`stitchkit/agent-runtime/harness-tools`) | `ai` `@modelcontextprotocol/server` (tool declarations) |
194
198
  | Agent coding tools (`stitchkit/agent-runtime/coding-tools`) | — |
195
199
  | OpenRouter runtime adapter (`stitchkit/agent-runtime/openrouter`) | `ai` `@openrouter/ai-sdk-provider` |
196
200
  | SQLite agent store (`stitchkit/agent-runtime/sqlite/bun` or `/node`) | — (runtime built-in) |
@@ -4173,7 +4177,25 @@ Capable models (Claude, Gemini, GPT) handle that; weaker / cheaper ones can drop
4173
4177
  the field or mangle its strings. Set `flattenUnionInput: true` (on
4174
4178
  `createMcpHandler` / `mountMcp` / `mountAgent`) to advertise each discriminated
4175
4179
  union as a **single flat object** instead — the discriminator becomes an enum and
4176
- each variant's fields become optional with a `Required if <disc> = …` hint.
4180
+ each field required by every variant stays required. Other fields become optional
4181
+ with `Available if <disc> = …` and, where applicable, `Required if <disc> = …` hints.
4182
+
4183
+ **Branch explanations keep their meaning.** A shared description appears once;
4184
+ different descriptions are grouped by text and qualified with `When <disc> = …:`.
4185
+ A branch without a description does not inherit another branch's explanation.
4186
+ For example, an optional object `value` in `single` and a required array `value`
4187
+ in `group` advertise:
4188
+
4189
+ ```text
4190
+ When kind = group: Two to ten references.
4191
+ When kind = single: One reference.
4192
+ Available if kind = group | single. Required if kind = group
4193
+ ```
4194
+
4195
+ A third branch without `value` is absent from those labels. The object and array
4196
+ retain their separate shapes; the array's minimum length does not apply to the object.
4197
+ Discriminator values, branch explanation labels and joined property order are
4198
+ deterministic under branch reordering. → ADR [0221](../decisions/0221-flat-field-explanations-retain-branch-meaning.md).
4177
4199
 
4178
4200
  **A field several variants declare keeps its type.** Flattening puts every
4179
4201
  variant's fields side by side, so a key two variants share has to be advertised
@@ -6612,6 +6634,146 @@ for receipt queries; do not import runtime internals. Available since 0.100.0;
6612
6634
  existing runtime configurations need no migration.
6613
6635
 
6614
6636
 
6637
+ ==============================================================================
6638
+ # Guide: Agent composition (docs/guide/agent-composition.md)
6639
+ ==============================================================================
6640
+
6641
+ ---
6642
+ title: "Agent composition without a second runtime"
6643
+ description: "Compose contract tools, authenticated realtime control, React views and exact-run behavioral checks."
6644
+ type: architecture
6645
+ status: active
6646
+ created: 2026-09-30 22:45 +07:00
6647
+ updated: 2026-09-30 23:03 +07:00
6648
+ participants:
6649
+ - role: authored
6650
+ harness: Codex
6651
+ model: GPT-6
6652
+ at: 2026-09-30 22:45 +07:00
6653
+ ---
6654
+
6655
+ # Compose an agent application
6656
+
6657
+ Use these pieces when an application wants the existing headless harness and a generic
6658
+ conversation view. An application with its own AI SDK loop keeps `mountAgent`; a product
6659
+ with custom message projections can keep its transport and UI. No consumer migration is
6660
+ required. Model selection, storage, compaction, approvals and recovery stay with their
6661
+ existing owners.
6662
+
6663
+ ## Resources and tools
6664
+
6665
+ ```ts
6666
+ import {
6667
+ createAgentHarnessFileResources,
6668
+ createHeadlessAgentHarness,
6669
+ } from 'stitchkit/agent-runtime/harness';
6670
+ import { createAgentHarnessTools } from 'stitchkit/agent-runtime/harness-tools';
6671
+
6672
+ const resources = createAgentHarnessFileResources({
6673
+ roots: [{ id: 'guide', kind: 'instruction', path: instructionRoot }],
6674
+ limits: { maxTotalBytes: 256 * 1024 },
6675
+ });
6676
+ const harness = createHeadlessAgentHarness({
6677
+ protocol, store, models, promptBudget,
6678
+ resources,
6679
+ tools: createAgentHarnessTools(({ context, run }) => ({
6680
+ services: [catalogService],
6681
+ context: { ...context, messageId: run.assistantMessageId },
6682
+ runtimeTools: resources.runtimeTools,
6683
+ lifecycle: authorizeTools,
6684
+ hooks: observeTools,
6685
+ })),
6686
+ });
6687
+ ```
6688
+
6689
+ The factory composes application authorization then the runtime fence through `mountAgent`.
6690
+ The optional harness-tools leaf preserves the complete tool types, including MCP presenter
6691
+ declarations; install the same `ai` and `@modelcontextprotocol/server` peers as for
6692
+ `stitchkit/tools`. The base harness stays AI-only. Every mount option remains available, including registry, runtime tools, extension,
6693
+ coercion, output stripping, hooks and durability. Async per-run configuration is supported.
6694
+ The original tools callback still accepts arbitrary typed AI SDK tools and prepareStep.
6695
+ The resource reader is explicitly selected: filtered allowlists do not gain tools merely
6696
+ because a loader exists. Root IDs, kinds, provenance and limits are unchanged.
6697
+
6698
+ ## Server and browser
6699
+
6700
+ ```ts
6701
+ import { bindAgentHarnessRealtime } from 'stitchkit/agent-runtime/realtime';
6702
+
6703
+ const binding = bindAgentHarnessRealtime(harness, socket, {
6704
+ async authorize({ identity, request, signal }) {
6705
+ // socket.data comes from your verified Socket.IO handshake, not a browser context.
6706
+ if (!await mayAccessConversation(identity, request, signal)) return null;
6707
+ return { context: { userId: identity.userId } };
6708
+ },
6709
+ onError: reportServerError,
6710
+ });
6711
+ ```
6712
+
6713
+ `socket` is the existing `createSocketIOServer` handle, attached to `createServer` (Bun)
6714
+ or the Node adapter. The access policy checks every operation, file/reference and metadata
6715
+ as well as snapshot/event reads. Session handshake authentication alone is insufficient.
6716
+ Conversation ownership and observer/controller roles are application policy; the canonical
6717
+ control server additionally enforces its exclusive controller lease.
6718
+
6719
+ ```ts
6720
+ import { createSocketIOClient } from 'stitchkit';
6721
+ import { createAgentController } from 'stitchkit/agent-runtime/browser';
6722
+ import { useAgent } from 'stitchkit/agent-runtime/react';
6723
+
6724
+ const transport = createSocketIOClient({ url: serverUrl, auth: sessionAuth });
6725
+ const agent = createAgentController({ transport, conversationId, access: 'control' });
6726
+ transport.connect();
6727
+
6728
+ function Conversation() {
6729
+ const state = useAgent(agent);
6730
+ const conversation = state.view.conversations[conversationId];
6731
+ // Render canonical messages/parts, transient progress, approvals and state.error.
6732
+ return <Transcript conversation={conversation} status={state.status} error={state.error} />;
6733
+ }
6734
+
6735
+ await agent.request({
6736
+ operation: 'submit', idempotencyKey: crypto.randomUUID(),
6737
+ parts: [{ type: 'text', text: 'Find available items' }],
6738
+ });
6739
+ await agent.request({ operation: 'interrupt', runId });
6740
+ await agent.request({ operation: 'respond-approval', approvalId, approved: true });
6741
+ await agent.close(); // leaves transport and harness alive
6742
+ ```
6743
+
6744
+ Wait for `ready` before sending. Share a controller among views of the same conversation;
6745
+ create it at session scope, not during React render. Unmount only unsubscribes the view.
6746
+ To release the session, await `close`; to stop the application, separately close the
6747
+ binding, transport and harness through the application's shutdown lifecycle. Closing a
6748
+ view does not interrupt its remote run. Use explicit `interrupt` for cancellation.
6749
+
6750
+ Reconnect reattaches and reads durable state. Mutations are not retried automatically:
6751
+ if an acknowledgement is lost, retain the original idempotency key. Incoming event
6752
+ buffers and outgoing requests have finite limits; capacity/overflow/lease failures stay
6753
+ visible. A server overflow deliberately disconnects the transport; reconnect explicitly.
6754
+
6755
+ ## Check behavior, not just admission
6756
+
6757
+ ```ts
6758
+ import { inspectAgentRun } from 'stitchkit/agent-runtime/testing';
6759
+
6760
+ const ticket = harness.submit(input);
6761
+ const admitted = await ticket.admission;
6762
+ await ticket.result;
6763
+ const result = inspectAgentRun(await harness.snapshot(input.conversationId), admitted.runId);
6764
+ result.calledTool('catalog_search');
6765
+ result.toolSucceeded('catalog_search');
6766
+ result.notCalledTool('catalog_delete');
6767
+ result.completed();
6768
+ ```
6769
+
6770
+ `calledTool` proves a call record (including an approved continuation linked through that
6771
+ run’s exact input messages); `toolSucceeded` also needs a matching successful result.
6772
+ `completed` requires successful terminal output with no pending approval. Prior runs,
6773
+ provider/policy stops, failed calls and unfinished runs cannot satisfy those assertions.
6774
+ The helper does not invoke a model or poll; the existing runtime ticket owns execution.
6775
+
6776
+
6615
6777
  ==============================================================================
6616
6778
  # Guide: Managed application kernel (docs/guide/application-kernel.md)
6617
6779
  ==============================================================================
@@ -19506,6 +19668,11 @@ Credential-free provider and concurrency fixtures for Bun and Node tests.
19506
19668
  | `AgentStoreConformanceConfig` | _type_ | `{ createStore(context), cleanup?(context) }` — the factory the contract runs against, plus a teardown that runs once whether the scenario passed or failed |
19507
19669
  | `AgentStoreConformanceContext` | _type_ | `{ conversationIds }` — every conversation the scenario will mutate, handed over **before** the first mutation so an adapter can provision application-owned parent rows; a zero-argument factory stays valid |
19508
19670
 
19671
+ `inspectAgentRun` takes `(snapshot, runId)` and returns `completed()`, `calledTool(name)`,
19672
+ `notCalledTool(name)` and `toolSucceeded(name)` assertions over durable evidence for
19673
+ that exact run. Completion requires terminal reason `success`, not `policy_stop` or
19674
+ `provider_stop`, and no pending approval. Successful tools require matching call/result IDs.
19675
+
19509
19676
  ## `stitchkit/agent-runtime/harness`
19510
19677
 
19511
19678
  Server-only evolving facade over the canonical Agent runtime. It requires the optional `ai` peer
@@ -19603,6 +19770,31 @@ Use this entrypoint from client components and shared DTO packages. The full
19603
19770
 
19604
19771
  ---
19605
19772
 
19773
+ ### Browser control composition
19774
+
19775
+ `AgentBrowserRequestSchema` / `AgentBrowserRequest` derive from the trusted control
19776
+ protocol but exclude runtime `context`. Submit permits only strict text/file parts;
19777
+ file ownership and metadata policy are checked by server authorization. The shared
19778
+ `agentControlRealtimeContract` owns `agent:control` acknowledgements and `agent:delivery`.
19779
+
19780
+ `createAgentController` / `AgentControllerConfig` take an existing Stitchkit
19781
+ realtime `transport`, `conversationId`, `access` (`observe` or `control`), optional
19782
+ `timeoutMs` (10000), `maxBufferedEvents` (256), `maxBufferedBytes` (1048576) and
19783
+ `maxPendingRequests` (32). All bounds are positive safe integers. One controller owns one
19784
+ attachment per conversation on that transport; share the controller between views.
19785
+
19786
+ `AgentController` exposes stable `subscribe`, `getSnapshot`, `request(command)` and async
19787
+ `close`. `AgentBrowserCommand` uses the canonical operations, without request/conversation identity;
19788
+ `submit` requires a caller-owned idempotency key. Unknown-outcome mutations are never
19789
+ replayed automatically. `AgentControllerState` distinguishes connecting, ready,
19790
+ disconnected, error and closed and retains the canonical full `view` plus safe error
19791
+ code/message. Errors in automatic attach/refresh appear there. Reconnect attaches again
19792
+ and reads a snapshot; snapshot gaps coalesce, stale generations cannot overwrite state,
19793
+ and buffers/queues are bounded. Overflow or failed refresh is visible and requires
19794
+ explicit recovery. Closing detaches without closing the shared transport or remote run.
19795
+
19796
+ See [agent composition](../guide/agent-composition.md) for a complete wiring example.
19797
+
19606
19798
  ## `stitchkit/agent-runtime/openrouter`
19607
19799
 
19608
19800
  | Export | Kind | Summary |
@@ -20042,7 +20234,7 @@ Advanced building blocks — the shared machinery the mounts are built on.
20042
20234
  | `ToolSurfaceDefinition` | _type_ | shared object-shaped `{ services?, runtimeTools? }` introspection surface |
20043
20235
  | `ToolManifestConfig` | _type_ | mixed surface plus required model-facing `transport` and presentation options |
20044
20236
  | `coerceJsonArgs` | function | coerce JSON-stringified array/object tool arguments |
20045
- | `flattenToolJsonSchema` | function | project structurally identifiable discriminated unions into conservative object joins; divergent fields retain every provable base kind in a deterministic `type` array, and the projection never executes validation |
20237
+ | `flattenToolJsonSchema` | function | project structurally identifiable discriminated unions into conservative object joins; scalar collisions retain provable types, object/array collisions retain structural alternatives, and field descriptions retain discriminator labels plus availability/requiredness hints; the projection never executes validation |
20046
20238
  | `ToolPresentationSchema` | _type_ | immutable model-facing JSON Schema document shared by tool transports |
20047
20239
  | `MountableTool` | _type_ | one operation with separate executable CLI argument schema and model-facing presentation schema |
20048
20240
  | `ToolManifestEntry` | _type_ | one `buildToolManifest` row |
@@ -20668,3 +20860,37 @@ Its types are `BubblewrapSandboxConfig`, `SandboxBackend`, `SandboxCommand`,
20668
20860
  `SandboxPrewarmInput`, `SandboxProcess`, `SandboxRunOptions`, `SandboxSession`,
20669
20861
  and `SandboxState`. The [sandbox guide](../guide/sandbox.md) specifies lifecycle,
20670
20862
  network enforcement, gateway credentials and platform/resource boundaries.
20863
+
20864
+ ## `stitchkit/agent-runtime/realtime`
20865
+
20866
+ Optional evolving Socket.IO server binding. `bindAgentHarnessRealtime` takes `(harness, socket, config)` and returns `close()` for its subscriptions and control connections, without closing
20867
+ socket or harness. `AgentHarnessRealtimeConfig` requires `authorize({ identity, request,
20868
+ signal })`: return `{ context }` after verifying the session principal, conversation,
20869
+ operation, files and metadata, or `null`. Identity is `socket.data` from the application's
20870
+ verified handshake. Every request and event delivery is authorized. Observe access does
20871
+ not grant mutation; controller leases and approval policy still belong to the harness.
20872
+
20873
+ `maxPendingEvents` and `maxPendingAttachments` forward to the canonical control server;
20874
+ `maxPendingRequests` bounds in-flight authorization/control requests per socket (32);
20875
+ `authorizationTimeoutMs` bounds each authorization (10000 ms). Honor its AbortSignal.
20876
+ `onError` receives internal errors; peers receive generic denials. Revoking a conversation
20877
+ releases only its attachment. Event overflow closes the socket; explicitly reconnect the
20878
+ application transport. A transport's Engine.IO payload limit remains application-owned.
20879
+
20880
+ ## `stitchkit/agent-runtime/react`
20881
+
20882
+ Optional evolving React peer leaf. `useAgent` takes a controller and subscribes through
20883
+ `useSyncExternalStore`, returning the same `AgentControllerState` as `getSnapshot()`.
20884
+ Create and close the controller at application/session scope. Multiple components can
20885
+ observe it; StrictMode and unmount release only the component's own subscription.
20886
+
20887
+ ## `stitchkit/agent-runtime/harness-tools`
20888
+
20889
+ Optional evolving composition of the full `mountAgent` configuration with the runtime
20890
+ fence. Its runtime peer is `ai`; its full tool presenter declarations also require
20891
+ `@modelcontextprotocol/server`, as `stitchkit/tools` does. The base harness retains its
20892
+ AI-only peer boundary. Existing custom tool callbacks need no new import.
20893
+
20894
+ | Export | Kind | Summary |
20895
+ |--------|------|---------|
20896
+ | `createAgentHarnessTools` / `AgentHarnessToolsConfig` | function / _type_ | async per-run full mount configuration (`services` plus all `AgentMountConfig` options); composes application lifecycle then runtime fence exactly once |
package/llms.txt CHANGED
@@ -9,11 +9,11 @@ Build with stitchkit: define a contract once, then `implement` it and serve it (
9
9
  Load the slice for each entrypoint your code imports — `import … from 'stitchkit/server'` → `llms/server.txt`; the root `stitchkit` import → `llms/stitchkit.txt`. A slice holds that entrypoint's API reference section and the guide pages whose home it is; every guide lives in exactly one slice, and a slice that needs another's guide names it under "Also read". Each file is at most 50.0 KB; a longer one continues in numbered parts, each naming the next at its top. Moving across versions: load `llms/upgrading.txt` and the range slices it lists between your version and the target. `llms-full.txt` inlines everything; it is far larger than a context window, so do not read it whole.
10
10
 
11
11
  ## Entrypoint slices
12
- - **stitchkit**: [llms/stitchkit.txt](llms/stitchkit.txt) 16.6 KB → [llms/stitchkit.2.txt](llms/stitchkit.2.txt) 45.2 KB → [llms/stitchkit.3.txt](llms/stitchkit.3.txt) 17.1 KB
12
+ - **stitchkit**: [llms/stitchkit.txt](llms/stitchkit.txt) 17.0 KB → [llms/stitchkit.2.txt](llms/stitchkit.2.txt) 45.2 KB → [llms/stitchkit.3.txt](llms/stitchkit.3.txt) 17.1 KB
13
13
  - **stitchkit/live**: [llms/live.txt](llms/live.txt) 21.6 KB
14
14
  - **stitchkit/react**: [llms/react.txt](llms/react.txt) 9.0 KB
15
15
  - **stitchkit/react/keyboard**: [llms/react-keyboard.txt](llms/react-keyboard.txt) 9.4 KB
16
- - **stitchkit/tools**: [llms/tools.txt](llms/tools.txt) 45.0 KB → [llms/tools.2.txt](llms/tools.2.txt) 26.9 KB → [llms/tools.3.txt](llms/tools.3.txt) 25.4 KB
16
+ - **stitchkit/tools**: [llms/tools.txt](llms/tools.txt) 45.9 KB → [llms/tools.2.txt](llms/tools.2.txt) 26.9 KB → [llms/tools.3.txt](llms/tools.3.txt) 25.5 KB
17
17
  - **stitchkit/tools/contract**: [llms/tools-contract.txt](llms/tools-contract.txt) 0.2 KB
18
18
  - **stitchkit/tools/invoker**: [llms/tools-invoker.txt](llms/tools-invoker.txt) 0.2 KB
19
19
  - **stitchkit/tools/connections**: [llms/tools-connections.txt](llms/tools-connections.txt) 3.1 KB
@@ -24,10 +24,10 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
24
24
  - **stitchkit/server**: [llms/server.txt](llms/server.txt) 45.3 KB → [llms/server.2.txt](llms/server.2.txt) 14.6 KB → [llms/server.3.txt](llms/server.3.txt) 45.6 KB → [llms/server.4.txt](llms/server.4.txt) 38.1 KB → [llms/server.5.txt](llms/server.5.txt) 21.8 KB
25
25
  - **stitchkit/observability**: [llms/observability.txt](llms/observability.txt) 44.8 KB
26
26
  - **stitchkit/agent-runtime**: [llms/agent-runtime.txt](llms/agent-runtime.txt) 36.8 KB → [llms/agent-runtime.2.txt](llms/agent-runtime.2.txt) 46.7 KB → [llms/agent-runtime.3.txt](llms/agent-runtime.3.txt) 34.3 KB
27
- - **stitchkit/agent-runtime/testing**: [llms/agent-runtime-testing.txt](llms/agent-runtime-testing.txt) 2.2 KB
28
- - **stitchkit/agent-runtime/harness**: [llms/agent-runtime-harness.txt](llms/agent-runtime-harness.txt) 4.1 KB
27
+ - **stitchkit/agent-runtime/testing**: [llms/agent-runtime-testing.txt](llms/agent-runtime-testing.txt) 2.6 KB
28
+ - **stitchkit/agent-runtime/harness**: [llms/agent-runtime-harness.txt](llms/agent-runtime-harness.txt) 10.1 KB
29
29
  - **stitchkit/agent-runtime/coding-tools**: [llms/agent-runtime-coding-tools.txt](llms/agent-runtime-coding-tools.txt) 4.9 KB
30
- - **stitchkit/agent-runtime/browser**: [llms/agent-runtime-browser.txt](llms/agent-runtime-browser.txt) 1.6 KB
30
+ - **stitchkit/agent-runtime/browser**: [llms/agent-runtime-browser.txt](llms/agent-runtime-browser.txt) 3.3 KB
31
31
  - **stitchkit/agent-runtime/openrouter**: [llms/agent-runtime-openrouter.txt](llms/agent-runtime-openrouter.txt) 1.1 KB
32
32
  - **stitchkit/agent-runtime/sqlite/bun**: [llms/agent-runtime-sqlite-bun.txt](llms/agent-runtime-sqlite-bun.txt) 1.8 KB
33
33
  - **stitchkit/agent-runtime/sqlite/node**: [llms/agent-runtime-sqlite-node.txt](llms/agent-runtime-sqlite-node.txt) 1.7 KB
@@ -52,6 +52,9 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
52
52
  - **stitchkit/google**: [llms/google.txt](llms/google.txt) 1.4 KB
53
53
  - **stitchkit/declaration**: [llms/declaration.txt](llms/declaration.txt) 16.0 KB
54
54
  - **stitchkit/node**: [llms/node.txt](llms/node.txt) 3.1 KB
55
+ - **stitchkit/agent-runtime/react**: [llms/agent-runtime-react.txt](llms/agent-runtime-react.txt) 1.0 KB
56
+ - **stitchkit/agent-runtime/realtime**: [llms/agent-runtime-realtime.txt](llms/agent-runtime-realtime.txt) 1.8 KB
57
+ - **stitchkit/agent-runtime/harness-tools**: [llms/agent-runtime-harness-tools.txt](llms/agent-runtime-harness-tools.txt) 1.3 KB
55
58
 
56
59
  ## Upgrading slices
57
60
  - **Upgrading — how to move across versions**: [llms/upgrading.txt](llms/upgrading.txt) 10.3 KB
@@ -69,6 +72,7 @@ Load the slice for each entrypoint your code imports — `import … from 'stitc
69
72
  - [Typed client](https://github.com/max-listov/stitchkit/blob/master/docs/guide/client.md): createClient/createHttpClient, the typed call surface, scoped clients, SSE
70
73
  - [MCP & agents](https://github.com/max-listov/stitchkit/blob/master/docs/guide/mcp-and-agents.md): contracts as MCP tools (createMcpHandler) and AI-agent tools (mountAgent); tool lifecycle, extend, identity, a separate tool answer (withToolView)
71
74
  - [Agent application runtime](https://github.com/max-listov/stitchkit/blob/master/docs/guide/agent-runtime.md): optional durable history, prompt/model composition, stream loop, coordination, fencing and events
75
+ - [Agent composition](https://github.com/max-listov/stitchkit/blob/master/docs/guide/agent-composition.md): tool factories, authorized realtime control, shared React views and exact-run behavior checks
72
76
  - [Managed application kernel](https://github.com/max-listov/stitchkit/blob/master/docs/guide/application-kernel.md): process-local resources, readiness, admission, schedules, projections and optional provider adapters
73
77
  - [Optional process sandbox](https://github.com/max-listov/stitchkit/blob/master/docs/guide/sandbox.md): Linux Bubblewrap sessions, durable workspace reconnect, network policy and host credential brokering
74
78
  - [Generic application primitives](https://github.com/max-listov/stitchkit/blob/master/docs/guide/primitives.md): lifecycle transitions, owner scope, permissions, exact money and quantities, deadlines, audit, delivery and exports — declared, not persisted
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stitchkit",
3
- "version": "0.103.0",
3
+ "version": "0.103.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",
@@ -221,6 +221,18 @@
221
221
  "./node": {
222
222
  "types": "./dist/entrypoints/node.d.ts",
223
223
  "import": "./dist/entrypoints/node.js"
224
+ },
225
+ "./agent-runtime/react": {
226
+ "types": "./dist/entrypoints/agent-runtime/react.d.ts",
227
+ "import": "./dist/entrypoints/agent-runtime/react.js"
228
+ },
229
+ "./agent-runtime/realtime": {
230
+ "types": "./dist/entrypoints/agent-runtime/realtime.d.ts",
231
+ "import": "./dist/entrypoints/agent-runtime/realtime.js"
232
+ },
233
+ "./agent-runtime/harness-tools": {
234
+ "types": "./dist/entrypoints/agent-runtime/harness-tools.d.ts",
235
+ "import": "./dist/entrypoints/agent-runtime/harness-tools.js"
224
236
  }
225
237
  },
226
238
  "publishConfig": {