stitchkit 0.118.1 → 0.120.0

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 (180) hide show
  1. package/CHANGELOG.md +92 -0
  2. package/README.md +10 -7
  3. package/dist/browser/http.d.ts.map +1 -1
  4. package/dist/contract/client-types.d.ts +6 -3
  5. package/dist/contract/client-types.d.ts.map +1 -1
  6. package/dist/contract/define-validation.d.ts.map +1 -1
  7. package/dist/contract/define.d.ts +18 -12
  8. package/dist/contract/define.d.ts.map +1 -1
  9. package/dist/contract/endpoint-capabilities.d.ts +28 -0
  10. package/dist/contract/endpoint-capabilities.d.ts.map +1 -0
  11. package/dist/contract/factory.d.ts +49 -19
  12. package/dist/contract/factory.d.ts.map +1 -1
  13. package/dist/contract/tool-view.d.ts +1 -1
  14. package/dist/contract/tool-view.d.ts.map +1 -1
  15. package/dist/contract/transports.d.ts +5 -0
  16. package/dist/contract/transports.d.ts.map +1 -0
  17. package/dist/entrypoints/agent-runtime/coding-tools.js +9 -8
  18. package/dist/entrypoints/agent-runtime/harness.js +9 -8
  19. package/dist/entrypoints/agent-runtime/realtime.js +3 -3
  20. package/dist/entrypoints/agent-runtime/sandbox.js +10 -9
  21. package/dist/entrypoints/agent-runtime/sqlite/bun.js +12 -11
  22. package/dist/entrypoints/agent-runtime/sqlite/node.js +12 -11
  23. package/dist/entrypoints/agent-runtime/testing.js +12 -11
  24. package/dist/entrypoints/agent-runtime.js +22 -19
  25. package/dist/entrypoints/application/diagnostic-journal.js +3 -3
  26. package/dist/entrypoints/application/directory-inbox.js +4 -4
  27. package/dist/entrypoints/application/opentelemetry.js +1 -1
  28. package/dist/entrypoints/application.js +10 -10
  29. package/dist/entrypoints/cli/publish.js +4 -4
  30. package/dist/entrypoints/cli.js +13 -12
  31. package/dist/entrypoints/contract.d.ts +1 -1
  32. package/dist/entrypoints/contract.d.ts.map +1 -1
  33. package/dist/entrypoints/contract.js +6 -4
  34. package/dist/entrypoints/files.js +3 -3
  35. package/dist/entrypoints/geo/contract.d.ts +7 -0
  36. package/dist/entrypoints/geo/contract.d.ts.map +1 -0
  37. package/dist/entrypoints/geo/contract.js +6 -0
  38. package/dist/entrypoints/geo.js +60 -23
  39. package/dist/entrypoints/http.js +3 -3
  40. package/dist/entrypoints/index.js +9 -7
  41. package/dist/entrypoints/live.js +1 -1
  42. package/dist/entrypoints/node.js +7 -6
  43. package/dist/entrypoints/primitives.js +1 -1
  44. package/dist/entrypoints/process/owner-loss.js +1 -1
  45. package/dist/entrypoints/process.js +3 -3
  46. package/dist/entrypoints/react.js +1 -1
  47. package/dist/entrypoints/remote.js +4 -3
  48. package/dist/entrypoints/server.js +16 -15
  49. package/dist/entrypoints/telegram/screens.js +5 -5
  50. package/dist/entrypoints/telegram.js +7 -7
  51. package/dist/entrypoints/testing.js +7 -6
  52. package/dist/entrypoints/tools/agent.d.ts +9 -0
  53. package/dist/entrypoints/tools/agent.d.ts.map +1 -0
  54. package/dist/entrypoints/tools/agent.js +16 -0
  55. package/dist/entrypoints/tools/connections.js +7 -6
  56. package/dist/entrypoints/tools/contract.js +1 -1
  57. package/dist/entrypoints/tools/invoker.js +5 -4
  58. package/dist/entrypoints/tools/mcp.js +110 -9
  59. package/dist/entrypoints/tools/toolkit.d.ts +9 -0
  60. package/dist/entrypoints/tools/toolkit.d.ts.map +1 -0
  61. package/dist/entrypoints/tools/toolkit.js +40 -0
  62. package/dist/entrypoints/tools.d.ts +0 -10
  63. package/dist/entrypoints/tools.d.ts.map +1 -1
  64. package/dist/entrypoints/tools.js +38 -80
  65. package/dist/entrypoints/tracking/contract.js +5 -3
  66. package/dist/entrypoints/tracking/performance.js +3 -3
  67. package/dist/entrypoints/tracking.d.ts +1 -1
  68. package/dist/entrypoints/tracking.d.ts.map +1 -1
  69. package/dist/entrypoints/tracking.js +63 -83
  70. package/dist/entrypoints/xlsx.js +1 -1
  71. package/dist/geo/index.d.ts +2 -1
  72. package/dist/geo/index.d.ts.map +1 -1
  73. package/dist/geo/record.d.ts +8 -0
  74. package/dist/geo/record.d.ts.map +1 -0
  75. package/dist/geo/resolver.d.ts +1 -3
  76. package/dist/geo/resolver.d.ts.map +1 -1
  77. package/dist/geo/schema.d.ts +44 -0
  78. package/dist/geo/schema.d.ts.map +1 -0
  79. package/dist/geo/types.d.ts +2 -13
  80. package/dist/geo/types.d.ts.map +1 -1
  81. package/dist/{index-n5sv4z0w.js → index-0qyrcjfs.js} +16 -18
  82. package/dist/index-1psbyyhj.js +21 -0
  83. package/dist/{index-tsngj2b5.js → index-2fc1k9k2.js} +206 -206
  84. package/dist/index-3prvb42w.js +30 -0
  85. package/dist/{index-073nw9qr.js → index-3yb5kft5.js} +524 -522
  86. package/dist/{index-d9hq291n.js → index-4jpykzvw.js} +70 -81
  87. package/dist/index-568w258r.js +76 -0
  88. package/dist/index-69t14s4a.js +39 -0
  89. package/dist/{index-dky0dcmf.js → index-72r9k0av.js} +6 -2
  90. package/dist/{index-6p3frkv5.js → index-7zwtbak8.js} +9 -50
  91. package/dist/{index-90p34rts.js → index-8ryydawp.js} +7 -5
  92. package/dist/{index-vv1sch8a.js → index-8vzh5wpv.js} +13 -8
  93. package/dist/{index-75ns2ybj.js → index-8xyf8h2k.js} +1 -1
  94. package/dist/{index-xx1j310k.js → index-8yxgcyt6.js} +171 -169
  95. package/dist/{index-p6apg0jg.js → index-9frf01t9.js} +16 -9
  96. package/dist/{index-q0th8q0z.js → index-9mjrnqxs.js} +1 -3
  97. package/dist/{index-6f49krb5.js → index-aa50qwv4.js} +1 -1
  98. package/dist/{index-ega3yz4c.js → index-aqwg2dm5.js} +1 -1
  99. package/dist/{index-p0rf7sq9.js → index-bgcwxhxh.js} +225 -223
  100. package/dist/index-bph35vpy.js +77 -0
  101. package/dist/{index-tdpmfks8.js → index-bz479f0x.js} +1 -1
  102. package/dist/index-d3xdyjt6.js +38 -0
  103. package/dist/{index-q968hy6y.js → index-e452syyh.js} +1 -1
  104. package/dist/{index-86nbfysb.js → index-ff39f9dr.js} +3 -3
  105. package/dist/index-h1j71dr1.js +48 -0
  106. package/dist/{index-mgb7r8b8.js → index-jswst0h3.js} +1 -1
  107. package/dist/{index-095ya5hm.js → index-knmnj11j.js} +22 -191
  108. package/dist/{index-vwhrnp67.js → index-kz9734jc.js} +3 -3
  109. package/dist/{index-txg1npmg.js → index-mtwh9hyp.js} +1 -1
  110. package/dist/{index-dr3t5n1v.js → index-nn9qvkww.js} +46 -46
  111. package/dist/{index-ghtpfz4z.js → index-nyyam9ce.js} +2 -2
  112. package/dist/{index-qezhmp51.js → index-nz06qw5a.js} +3 -1
  113. package/dist/{index-1bx1xv1k.js → index-pfvde2fz.js} +5 -2
  114. package/dist/{index-w7jq3fz9.js → index-pq2m7t46.js} +1142 -1212
  115. package/dist/{index-yk4g8805.js → index-pq7rkwkk.js} +1 -30
  116. package/dist/{index-s80awwsw.js → index-qch1vcaa.js} +3 -1
  117. package/dist/{index-hdjmdwsj.js → index-qctbzmg9.js} +521 -511
  118. package/dist/{index-n8z3rvzw.js → index-qevqn3d3.js} +3 -5
  119. package/dist/{index-nqxrm176.js → index-r3db01kh.js} +1 -1
  120. package/dist/{index-v6vb5qx8.js → index-s3yxw6kt.js} +1 -1
  121. package/dist/{index-cqmqyjax.js → index-sa99p98w.js} +1 -1
  122. package/dist/index-sb9dr3tq.js +14 -0
  123. package/dist/{index-0gxvns6s.js → index-sba3e6m4.js} +1 -0
  124. package/dist/{index-f24bdt13.js → index-v1swr26p.js} +3 -1
  125. package/dist/{index-rhzkndr5.js → index-x4p3kw1p.js} +533 -530
  126. package/dist/{index-cycp3r3e.js → index-yb9n4pgj.js} +2 -2
  127. package/dist/{index-htxh46ej.js → index-ycqhyars.js} +2 -2
  128. package/dist/{index-9bwcthxw.js → index-yj6saztf.js} +31 -13
  129. package/dist/{index-f6m4c545.js → index-zrdcmg6j.js} +4 -6
  130. package/dist/{index-tvtacc9a.js → index-zyc64nbh.js} +1 -34
  131. package/dist/process/bun-child.d.ts +3 -2
  132. package/dist/process/bun-child.d.ts.map +1 -1
  133. package/dist/server/contract-method.d.ts.map +1 -1
  134. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  135. package/dist/tools/operations/async-operation-canonical-types.d.ts +1 -1
  136. package/dist/tracking/attribution.d.ts +21 -25
  137. package/dist/tracking/attribution.d.ts.map +1 -1
  138. package/dist/tracking/client-visit.d.ts +5 -7
  139. package/dist/tracking/client-visit.d.ts.map +1 -1
  140. package/dist/tracking/client.d.ts +2 -2
  141. package/dist/tracking/client.d.ts.map +1 -1
  142. package/dist/tracking/contract.d.ts +1 -1
  143. package/dist/tracking/host.d.ts +0 -1
  144. package/dist/tracking/host.d.ts.map +1 -1
  145. package/dist/tracking/privacy.d.ts +6 -0
  146. package/dist/tracking/privacy.d.ts.map +1 -1
  147. package/dist/tracking/schemas.d.ts +2 -2
  148. package/dist/tracking/schemas.d.ts.map +1 -1
  149. package/llms/agent-runtime-harness.txt +4 -3
  150. package/llms/agent-runtime-sandbox.txt +1 -1
  151. package/llms/agent-runtime.2.txt +3 -2
  152. package/llms/agent-runtime.3.txt +4 -46
  153. package/llms/agent-runtime.4.txt +113 -0
  154. package/llms/agent-runtime.txt +11 -13
  155. package/llms/cli.txt +1 -1
  156. package/llms/contract.txt +46 -24
  157. package/llms/geo-contract.txt +23 -0
  158. package/llms/geo.txt +40 -4
  159. package/llms/stitchkit.txt +16 -9
  160. package/llms/testing.txt +4 -6
  161. package/llms/tools-agent.txt +24 -0
  162. package/llms/tools-mcp.txt +71 -6
  163. package/llms/tools-toolkit.txt +23 -0
  164. package/llms/tools.2.txt +8 -5
  165. package/llms/tools.3.txt +9 -78
  166. package/llms/tools.txt +8 -8
  167. package/llms/tracking-contract.txt +1 -1
  168. package/llms/tracking.txt +27 -5
  169. package/llms/{upgrading-0.105.0-0.118.0.txt → upgrading-0.106.0-0.120.0.txt} +152 -410
  170. package/llms/upgrading-0.37.0-0.53.0.txt +969 -0
  171. package/llms/{upgrading-0.44.0-0.62.0.txt → upgrading-0.55.0-0.68.0.txt} +509 -528
  172. package/llms/{upgrading-0.63.0-0.83.0.txt → upgrading-0.69.0-0.95.0.txt} +506 -509
  173. package/llms/{upgrading-0.84.0-0.104.0.txt → upgrading-0.96.0-0.105.0.txt} +410 -506
  174. package/llms/upgrading.txt +5 -5
  175. package/llms-full.txt +475 -154
  176. package/llms.txt +17 -14
  177. package/package.json +32 -20
  178. package/llms/upgrading-0.37.0-0.44.0.txt +0 -444
  179. package/dist/{index-arjmb6de.js → index-1jwsfkfz.js} +0 -0
  180. package/dist/{index-qndsr7f0.js → index-5efrpfmj.js} +3 -3
@@ -1,12 +1,14 @@
1
- # stitchkit/agent-runtime — stitchkit docs slice, part 3 of 3
1
+ # stitchkit/agent-runtime — stitchkit docs slice, part 3 of 4
2
2
 
3
3
  > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
4
  > `llms.txt` in this package.
5
+ > Continues in `llms/agent-runtime.4.txt`.
5
6
 
6
7
  Parts of this slice:
7
8
  - `llms/agent-runtime.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
8
9
  - `llms/agent-runtime.2.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
9
- - `llms/agent-runtime.3.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md) · API reference: `stitchkit/agent-runtime` (docs/api/reference.md) · API reference: `stitchkit-tui` (docs/api/reference.md)
10
+ - `llms/agent-runtime.3.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md) · API reference: `stitchkit/agent-runtime` (docs/api/reference.md)
11
+ - `llms/agent-runtime.4.txt`: API reference: `stitchkit-tui` (docs/api/reference.md)
10
12
 
11
13
  ==============================================================================
12
14
  # Guide: Agent application runtime (docs/guide/agent-runtime.md) (continued)
@@ -431,47 +433,3 @@ is an optional atomic capability required by receipt admission, and
431
433
  stores supply both; custom adapters must honor the once-only transaction contract.
432
434
  A driver's optional `events.find(transaction, { conversationId, eventId })` makes
433
435
  both one lookup instead of a scan of the conversation log.
434
-
435
- ==============================================================================
436
- # API reference: `stitchkit-tui` (docs/api/reference.md)
437
- ==============================================================================
438
-
439
- ## `stitchkit-tui`
440
-
441
- Separate optional evolving Bun/OpenTUI package over a caller-composed headless harness.
442
-
443
- | Export | Kind | Summary |
444
- |--------|------|---------|
445
- | `defineAgentTui` | function | typed config for title/theme/status rows, model catalog, context, commands, runtime bundle and optional host-evidenced recovery policy; the default never requeues acquired effects |
446
- | `runAgentTui` | function | start one fresh durable conversation and terminal controller, recover durable work and publish its authenticated local session; `initialConversationId` is an explicit resume override |
447
- | `defineTuiCommand` / `resolveTuiCommand` | function | typed composable slash-command registry; unknown slash input remains an ordinary model prompt |
448
- | `createAgentTuiController` | function | single admission, selection, approval, interruption and conversation-switch owner over the harness |
449
- | `startAgentTuiSessionHost` / `createAgentTuiClient` | function | authenticated mode-`0600` Unix-socket host/client for status, submit and interrupt through that controller |
450
- | `listAgentTuiSessions` | function | discover live local terminal session IDs and their current conversation |
451
- | `createAgentTuiComposer` / `navigateAgentTuiHistory` | function | multiline draft and reversible prompt-history state |
452
- | `defaultAgentTuiStatusLine` / `AgentTuiStatusLineFormatter` | function / _type_ | terminal-native default rows and a host formatter over model capacity, durable snapshot, activity, workspace and local identities; `statusLine: false` hides the rows |
453
- | `createAgentTuiDiagnosticRecorder` / `AgentTuiDiagnosticEventSchema` | function / schema | bounded per-session metadata journal that rejects prompt, reasoning, tool-input and provider-cause payloads before disk admission |
454
-
455
- The `stitchkit-agent` binary loads `stitchkit.agent.ts` by default and also exposes `sessions`,
456
- `status`, `send` and `interrupt`. `--workspace` addresses a host outside the caller's cwd,
457
- `send --idempotency-key` accepts caller-owned retry identity, and `interrupt` defaults to the
458
- active run returned by `status`. Session descriptors and sockets are local control credentials,
459
- not a remote API.
460
- Interactive `/resume` and `/sessions` open the durable conversation picker. `/clear` creates a new
461
- conversation and keeps the previous one available there; it is not a viewport-only operation.
462
- The slash palette owns its highlighted selection: Up/Down move it, Tab completes it, Enter runs
463
- the exact command and Escape dismisses it. Partial input is never submitted while the palette is
464
- active; unknown slash text with no match remains an ordinary model prompt.
465
-
466
- ### `stitchkit-tui/core`
467
-
468
- Renderer-neutral state only. This entrypoint imports neither React/OpenTUI nor the agent runtime.
469
-
470
- | Export | Kind | Summary |
471
- |--------|------|---------|
472
- | `createTerminalCollection` / `reduceTerminalCollection` | function | identity-stable live collection selection, reconciliation, windowing and resize |
473
- | `createTerminalFeedViewport` / `reduceTerminalFeedViewport` | function | generic follow-tail, history anchoring, unseen and bounded visible-range state |
474
- | `createTerminalPaneState` / `reduceTerminalPaneState` | function | bounded split-pane focus, resize and single-pane collapse |
475
- | `createTerminalCommandPalette` / `terminalCommandMatches` | function | bounded command filtering and keyboard selection over a collision-validated registry |
476
- | `resolveExactTerminalCommand` / `validateTerminalCommands` | function | exact dispatch and fail-closed name/alias validation |
477
- | `createTerminalOperationState` / `reduceTerminalOperationState` | function | confirmation and single-pending-operation lifecycle |
@@ -0,0 +1,113 @@
1
+ # stitchkit/agent-runtime — stitchkit docs slice, part 4 of 4
2
+
3
+ > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
+ > `llms.txt` in this package.
5
+
6
+ Parts of this slice:
7
+ - `llms/agent-runtime.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
8
+ - `llms/agent-runtime.2.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
9
+ - `llms/agent-runtime.3.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md) · API reference: `stitchkit/agent-runtime` (docs/api/reference.md)
10
+ - `llms/agent-runtime.4.txt`: API reference: `stitchkit-tui` (docs/api/reference.md)
11
+
12
+ ==============================================================================
13
+ # API reference: `stitchkit-tui` (docs/api/reference.md)
14
+ ==============================================================================
15
+
16
+ ## `stitchkit-tui`
17
+
18
+ Separate optional evolving Bun/OpenTUI package over a caller-composed headless harness.
19
+
20
+ | Export | Kind | Summary |
21
+ |--------|------|---------|
22
+ | `defineAgentTui` | function | typed config for title, `theme` (a `TerminalPalette` override) and `themeMode`, status rows, model catalog, context, commands, runtime bundle and optional host-evidenced recovery policy; the default never requeues acquired effects |
23
+ | `runAgentTui` | function | start one fresh durable conversation and terminal controller, recover durable work and publish its authenticated local session; `initialConversationId` is an explicit resume override; it closes the session and exits the process on Ctrl-C and every signal OpenTUI catches unless `exitSignals: []` |
24
+ | `defineTuiCommand` / `resolveTuiCommand` | function | typed composable slash-command registry; unknown slash input remains an ordinary model prompt |
25
+ | `createAgentTuiController` | function | single admission, selection, approval, interruption and conversation-switch owner over the harness |
26
+ | `startAgentTuiSessionHost` / `createAgentTuiClient` | function | authenticated mode-`0600` Unix-socket host/client for status, submit and interrupt through that controller |
27
+ | `listAgentTuiSessions` | function | discover live local terminal session IDs and their current conversation |
28
+ | `createAgentTuiComposer` / `navigateAgentTuiHistory` | function | multiline draft and reversible prompt-history state |
29
+ | `defaultAgentTuiStatusLine` / `AgentTuiStatusLineFormatter` | function / _type_ | terminal-native default rows and a host formatter over model capacity, durable snapshot, activity, workspace and local identities; `statusLine: false` hides the rows |
30
+ | `createAgentTuiDiagnosticRecorder` / `AgentTuiDiagnosticEventSchema` | function / schema | bounded per-session metadata journal that rejects prompt, reasoning, tool-input and provider-cause payloads before disk admission |
31
+
32
+ The `stitchkit-agent` binary runs React's production build unless `NODE_ENV` says otherwise and loads `stitchkit.agent.ts` by default and also exposes `sessions`,
33
+ `status`, `send` and `interrupt`. `--workspace` addresses a host outside the caller's cwd,
34
+ `send --idempotency-key` accepts caller-owned retry identity, and `interrupt` defaults to the
35
+ active run returned by `status`. Session descriptors and sockets are local control credentials,
36
+ not a remote API.
37
+ Interactive `/resume` and `/sessions` open the durable conversation picker. `/clear` creates a new
38
+ conversation and keeps the previous one available there; it is not a viewport-only operation.
39
+ The slash palette owns its highlighted selection: Up/Down move it, Tab completes it, Enter runs
40
+ the exact command and Escape dismisses it. Partial input is never submitted while the palette is
41
+ active; unknown slash text with no match remains an ordinary model prompt.
42
+
43
+ ### `stitchkit-tui/core`
44
+
45
+ Renderer-neutral state only. This entrypoint imports neither React/OpenTUI nor the agent runtime.
46
+
47
+ | Export | Kind | Summary |
48
+ |--------|------|---------|
49
+ | `createTerminalCollection` / `reduceTerminalCollection` | function | identity-stable live collection selection, reconciliation, windowing and resize |
50
+ | `createTerminalFeedViewport` / `reduceTerminalFeedViewport` | function | generic follow-tail, history anchoring, unseen and bounded visible-range state |
51
+ | `createTerminalPaneState` / `reduceTerminalPaneState` | function | bounded split-pane focus, resize and single-pane collapse |
52
+ | `createTerminalCommandPalette` / `terminalCommandMatches` | function | bounded command filtering and keyboard selection over a collision-validated registry |
53
+ | `resolveExactTerminalCommand` / `validateTerminalCommands` | function | exact dispatch and fail-closed name/alias validation |
54
+ | `createTerminalOperationState` / `reduceTerminalOperationState` | function | confirmation and single-pending-operation lifecycle |
55
+ | `createTerminalTable` / `reduceTerminalTable` / `projectTerminalTable` | function | live table: typed columns, rows validated on entry, sort with key tie-break and missing values last, tree expansion pruned to present rows, filter on displayed text, selection kept across data; a row's `tone` and a column's `tone(value, row)` colour state |
56
+ | `layoutTerminalTableColumns` / `formatTerminalTableCell` / `visibleTerminalTableRows` / `terminalTableTreePrefix` | function | fixed and flexible column widths, `—` for missing values, the virtualized window, tree indentation |
57
+ | `createTerminalList` / `reduceTerminalList` / `visibleTerminalListLines` | function | picker with sections, fuzzy query with title highlight ranges, multi-select, disabled items and "more above/below" counts |
58
+ | `createTerminalForm` / `reduceTerminalForm` / `readTerminalForm` / `terminalFormFieldsFromJsonSchema` | function | typed fields (text, secret, number, integer, boolean, choice, JSON) from a JSON Schema, relative text edits, validation on leave and submit |
59
+ | `createTerminalTabs` / `reduceTerminalTabs` | function | tabs with badges, wrap-around movement, digit selection and reconcile that keeps the selected tab |
60
+ | `createTerminalNavigation` / `reduceTerminalNavigation` / `terminalBreadcrumbs` | function | screen stack keeping each level's state, root never popped |
61
+ | `createTerminalFocus` / `reduceTerminalFocus` | function | focus ring plus layers that take the keyboard and give it back |
62
+ | `createTerminalNotices` / `reduceTerminalNotices` / `nextTerminalNoticeExpiry` | function | bounded toasts on a caller clock, replaced by id |
63
+ | `createTerminalTimeSeries` / `appendTerminalSample` / `sampleTerminalTimeSeries` | function | time window bounded by duration and sample count, value-in-force sampling with explicit gaps |
64
+ | `terminalBrailleChart` / `terminalSparkline` / `terminalTimeAxis` / `terminalChartScale` | function | multi-series braille line or area chart as toned runs, sparkline, time axis |
65
+ | `terminalMeter` / `layoutTerminalMeterGrid` | function | eighth-block bar toned by thresholds, unmeasured as muted; column-major core grid |
66
+ | `terminalProgress` / `terminalSpinnerFrame` / `terminalIndeterminateBlock` / `formatTerminalDuration` | function | ratio, rate and ETA only when knowable; spinner frames; indeterminate bar; elapsed time |
67
+ | `defineTerminalKeymap` / `matchTerminalKey` / `fitTerminalKeyHints` | function | conflict-checked bindings that both answer keys and draw a footer fitted to the width |
68
+ | `terminalTableKeymap` / `terminalTableKey` / `terminalTabsKeymap` / `terminalTabsKey` | function | htop-style table bindings and tab bindings as keymaps |
69
+ | `matchTerminalSearch` / `searchTerminalItems` / `terminalHighlightRuns` | function | multi-word fuzzy match with ranges, stable ranking, highlight runs |
70
+ | `sanitizeTerminalText` / `terminalTextWidth` / `truncateTerminalText` / `fitTerminalText` / `wrapTerminalText` | function | strip escape and control sequences; measure, cut, pad and wrap by terminal cells |
71
+ | `terminalTextEdit` / `applyTerminalTextEdit` | function | one-line edits as relative actions, so fast input is never lost |
72
+ | `terminalJsonLines` / `layoutTerminalDetails` | function | toned, sanitized JSON lines; aligned key/value pairs |
73
+ | `terminalPalettes` / `resolveTerminalPalette` / `TerminalPalette` / `TerminalTone` | value / function / _type_ | one semantic palette (surfaces plus `primary`, `muted`, `accent`, `success`, `warning`, `danger`) for dark and light terminals |
74
+ | `terminalLabelsEn` / `terminalLabelsRu` / `TerminalLabels` | value / _type_ | every word the widgets draw |
75
+
76
+ ### `stitchkit-tui/widgets`
77
+
78
+ OpenTUI React widgets over the core state. React, `@opentui/core` and `@opentui/react` are peers;
79
+ this entrypoint never loads `stitchkit`.
80
+
81
+ | Export | Kind | Summary |
82
+ |--------|------|---------|
83
+ | `TerminalAppShell` / `TerminalPanel` / `TerminalStatusBar` / `TerminalKeyHints` | component | breadcrumbs, status lines, body, fitted key hints and toast overlay; titled rounded panels with a focus frame |
84
+ | `TerminalTable` | component | virtualized live table with header sort marks, tree, filter line and htop keys; row and cell tones in the palette, bold or dim where colour is missing |
85
+ | `terminalToneAttributes` | function | the text attribute that carries a tone without colour: `danger` and `warning` bold, `muted` dim |
86
+ | `TerminalList` | component | sections, fuzzy search line with highlights, `›` cursor, meta, badges, multi-select, description |
87
+ | `runTerminalApp` / `RunTerminalAppOptions` / `RunningTerminalApp` | function / _type_ | start an application: renderer, theme and labels providers, the error boundary, and an exit with 128 + signal after `onClose` on Ctrl-C and every signal OpenTUI catches — a closed window leaves no orphan |
88
+ | `TerminalErrorBoundary` / `TERMINAL_EXIT_SIGNALS` / `TerminalExitSignal` | component / value / _type_ | draws a render error and its stack in place of the screen, where OpenTUI's own boundary renders nothing under production React |
89
+ | `TerminalForm` | component | fields edited in place, cycling choices, masked secrets, inline errors; a form without fields says so and submits `{}` on Enter |
90
+ | `TerminalTextView` / `TerminalJsonView` | component | pager over sanitized wrapped text or toned JSON |
91
+ | `TerminalMeter` / `TerminalMeterGrid` / `TerminalChart` / `TerminalSparkline` | component | htop meters and core grid; btop braille charts with axis |
92
+ | `TerminalTabs` / `TerminalDialog` / `TerminalSpinner` / `TerminalProgressBar` / `TerminalAsyncView` / `TerminalDetails` / `TerminalNotices` / `TerminalHelp` | component | views, confirmation, loading, progress, async states, details, toasts, key help |
93
+ | `TerminalThemeProvider` / `useTerminalPalette` / `useTerminalThemeMode` | component / hook | palette from the terminal's reported background (`auto`) or a fixed mode |
94
+ | `TerminalLabelsProvider` / `TerminalFocusProvider` / `useTerminalFocused` | component / hook | product language and shared focus |
95
+
96
+ The `stitchkit-tui-gallery` binary shows every widget live.
97
+
98
+ ### `stitchkit-tui/build`
99
+
100
+ Build-time only; imports Bun and no React.
101
+
102
+ | Export | Kind | Summary |
103
+ |--------|------|---------|
104
+ | `compileTerminalApp` / `CompileTerminalAppOptions` | function / _type_ | one standalone executable for any Bun compile target, from any machine, with React's production build defined |
105
+ | `terminalNativePlugin` / `TerminalNativePluginOptions` | function / _type_ | the `Bun.build` plugin behind it: the target's `@opentui/core-<os>-<arch>` at the pinned version from the registry, verified against `bun.lock`; other platforms' packages throw; musl refused |
106
+ | `terminalNativeTarget` / `TerminalNativeTarget` | function / _type_ | the native package a compile target needs |
107
+
108
+ ### `stitchkit-tui/testing`
109
+
110
+ | Export | Kind | Summary |
111
+ |--------|------|---------|
112
+ | `renderTerminalTest` / `TerminalTestScreen` / `TerminalTestOptions` | function / _type_ | a screen inside the kit's providers on a test terminal; `press`, `type`, `burst`, `advance`, `waitForText`, `resize` run inside React's `act` and wait out a lone Esc |
113
+ | `TerminalTestKey` / `TerminalTestModifiers` | _type_ | the mock input's key names and modifiers |
@@ -1,4 +1,4 @@
1
- # stitchkit/agent-runtime — stitchkit docs slice, part 1 of 3
1
+ # stitchkit/agent-runtime — stitchkit docs slice, part 1 of 4
2
2
 
3
3
  > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
4
  > `llms.txt` in this package.
@@ -7,7 +7,8 @@
7
7
  Parts of this slice:
8
8
  - `llms/agent-runtime.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
9
9
  - `llms/agent-runtime.2.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md)
10
- - `llms/agent-runtime.3.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md) · API reference: `stitchkit/agent-runtime` (docs/api/reference.md) · API reference: `stitchkit-tui` (docs/api/reference.md)
10
+ - `llms/agent-runtime.3.txt`: Guide: Agent application runtime (docs/guide/agent-runtime.md) · API reference: `stitchkit/agent-runtime` (docs/api/reference.md)
11
+ - `llms/agent-runtime.4.txt`: API reference: `stitchkit-tui` (docs/api/reference.md)
11
12
 
12
13
  ==============================================================================
13
14
  # Guide: Agent application runtime (docs/guide/agent-runtime.md)
@@ -18,16 +19,16 @@ Parts of this slice:
18
19
  > **Maturity: evolving.** This surface is still finding its shape and may be
19
20
  > redefined in any minor release — always with a `### ⚠️ Breaking changes` entry
20
21
  > and a migration section, never silently. If your application already owns the
21
- > conversation loop, `mountAgent` from `stitchkit/tools` is the stable path.
22
+ > conversation loop, `mountAgent` from `stitchkit/tools/agent` is the direct path.
22
23
 
23
24
  `stitchkit/agent-runtime` is the server-only, opinionated layer above
24
25
  `mountAgent`. Use it when the application wants Stitchkit to own conversation
25
26
  mechanics: durable acceptance, history projection, the AI SDK stream loop,
26
27
  checkpoints, keyed interruption, terminal commit and stable application events.
27
28
 
28
- If the application already owns that loop, continue importing `mountAgent` from
29
- `stitchkit/tools`. `stitchkit/tools` does not depend on this entrypoint at all;
30
- this entrypoint uses the tool executor from it, but pulls no MCP peer, so
29
+ If the application already owns that loop, import `mountAgent` from
30
+ `stitchkit/tools/agent`. Neither `stitchkit/tools` nor `stitchkit/tools/agent` depends on
31
+ this entrypoint; this entrypoint uses the tool executor, but pulls no MCP peer, so
31
32
  choosing `mountAgent` alone costs you nothing from here.
32
33
 
33
34
  UI and shared DTO code must import canonical records and delivery validation from
@@ -51,12 +52,8 @@ persistence, event sinks and every Node context dependency.
51
52
  bun add stitchkit ai zod
52
53
  ```
53
54
 
54
- `mountAgent` from `stitchkit/tools` — used in the composition below — additionally
55
- needs the MCP peer, which that entrypoint imports statically:
56
-
57
- ```sh
58
- bun add @modelcontextprotocol/server
59
- ```
55
+ `mountAgent` from `stitchkit/tools/agent` — used in the composition below — needs no
56
+ peer beyond `ai`.
60
57
 
61
58
  OpenRouter is isolated so other runtime users do not resolve its package:
62
59
 
@@ -77,7 +74,8 @@ import {
77
74
  defineModelRegistry,
78
75
  } from 'stitchkit/agent-runtime'
79
76
  import { openRouterProvider } from 'stitchkit/agent-runtime/openrouter'
80
- import { composeToolLifecycle, mountAgent } from 'stitchkit/tools'
77
+ import { composeToolLifecycle } from 'stitchkit/tools'
78
+ import { mountAgent } from 'stitchkit/tools/agent'
81
79
 
82
80
  const protocol = defineAgentProtocol({
83
81
  context: z.object({ userId: z.string() }),
package/llms/cli.txt CHANGED
@@ -36,7 +36,7 @@ types; the package keeps its required dependencies separate from optional SDKs.
36
36
  CLI runtime tools use the one runtime-tool declaration: identity, input and output
37
37
  schemas, handler, and explicit CLI exposure. SDK presenters are the adapter's extension
38
38
  of that declaration (the fourth type argument of `RuntimeToolDefinitionWithOutput`, or
39
- `defineRuntimeTool` in `stitchkit/tools`), which requires the corresponding peers. A typed
39
+ `defineRuntimeTool` in `stitchkit/tools`), whose presenter types name the corresponding SDKs. A typed
40
40
  definition returned by `defineRuntimeTool` or `createRuntimeToolFactory` can be
41
41
  passed directly to both CLI and SDK mounts.
42
42
 
package/llms/contract.txt CHANGED
@@ -176,33 +176,55 @@ tools. Narrow it with `expose`:
176
176
 
177
177
  - `expose: ['HTTP']` — HTTP only. The endpoint never becomes a tool.
178
178
  - `expose: ['MCP', 'AGENT']` — a tool only; no HTTP route.
179
- - omit `expose` — all transports.
179
+ - `expose: []` — no transport; the endpoint stays hidden.
180
+ - omit `expose` — HTTP, MCP and AGENT; CLI is opt-in.
180
181
 
181
- For a curated or security-sensitive tool surface, opt into explicit tool
182
- exposure at the scoped factory:
182
+ Choose an application's default surface at its scoped factory. Scope and policy
183
+ are inferred in separate calls, so the returned endpoint types retain exact transports:
183
184
 
184
185
  ```ts
185
- const { defineContract } = createContractFactory<AppScope>({
186
- toolExposure: 'explicit',
186
+ const { defineContract } = createContractFactory<AppScope>().configure({
187
+ toolExposure: { default: ['HTTP', 'CLI'] },
187
188
  })
188
189
  ```
189
190
 
190
- With this policy, omitting `expose` materializes `['HTTP']` on the returned
191
- endpoint. MCP, Agent and CLI then require an explicit endpoint array. The plain
192
- factory and `defineContract` keep the default-on behaviour above.
191
+ An omitted `expose` (including `undefined`) materializes this array on the returned
192
+ endpoint before validation. An explicit endpoint array **replaces** it, never merges
193
+ with it: `['HTTP']` stays HTTP-only, `['MCP']` enables only MCP, and `[]` hides the
194
+ operation everywhere. Types, HTTP routes, typed clients, tools, CLI, OpenAPI and
195
+ transport summaries read that same materialized exposure.
193
196
 
194
- Consequently, `expose: ['HTTP']` is redundant inside a factory configured with
195
- `toolExposure: 'explicit'`: omit it unless the explicit spelling is useful to a
196
- local reader. Add `MCP`, `AGENT` or `CLI` only on endpoints that intentionally
197
- join those surfaces.
197
+ HTTP client methods and URL builders require a **guaranteed** HTTP transport:
198
+ pass a literal policy array directly to `configure` so its const generic infers
199
+ the tuple. A stored array, even with `satisfies ContractFactoryConfig`, can widen
200
+ to `Transport[]` and contain no HTTP at runtime,
201
+ so it does not promise an HTTP method. Optional capabilities preserve both
202
+ possible effective exposures rather than claiming an unfiltered default tuple.
198
203
 
199
- Tool transports (`MCP`, `AGENT`) skip four kinds of endpoint automatically:
200
- `multipart` (a file upload is not a tool call),
201
- [`rawResponse`](./server.md#raw-response-endpoints) (its answer is bytes, which
202
- a tool result cannot carry — it would serialize to `{}`),
203
- [`responseMeta`](./server.md#typed-json-response-metadata) (outbound HTTP
204
- headers have no meaning on a tool call) and `rawBody` (HTTP-only by
205
- construction).
204
+ The same holds for an endpoint whose own type is broad, with or without a factory:
205
+ a value annotated as `EndpointDef` or `FactoryScopedEndpoint<Scope>` carries
206
+ `expose?: readonly Transport[]`, which may hold no HTTP, so it has no client method
207
+ or URL. A helper that builds endpoints keeps their literal type with a const generic:
208
+
209
+ ```ts
210
+ const endpoint = <const Endpoint extends FactoryScopedEndpoint<AppScope>>(value: Endpoint) => value
211
+ ```
212
+
213
+ For a curated tool surface use `toolExposure: { default: ['HTTP'] }`, then name
214
+ tool transports only on endpoints that intentionally join them. An empty default
215
+ is legal. Each `configure` snapshots its array independently; it does not change
216
+ the base factory, sibling configurations or authored endpoints. The no-config
217
+ factory and plain `defineContract` keep the default-on behaviour above.
218
+
219
+ Six intrinsic HTTP-only forms intersect an **implicit factory default** with HTTP:
220
+ `multipart`, [`rawResponse`](./server.md#raw-response-endpoints),
221
+ [`responseMeta`](./server.md#typed-json-response-metadata), `rawBody`, streaming
222
+ responses and `HEAD`. Under `['HTTP', 'CLI']` they receive `['HTTP']`; under
223
+ `['CLI']` or `[]` they receive `[]`, not an implicitly reopened HTTP route.
224
+ An **explicit** non-HTTP exposure on any of them is a definition error, not a
225
+ silent downgrade. `safelistedBody` only changes HTTP parsing and remains
226
+ multi-transport. A factory policy applies only to contracts authored through
227
+ that factory, not to contracts another helper builds internally.
206
228
 
207
229
  ## Tool options (`tool`)
208
230
 
@@ -220,7 +242,7 @@ endpoint that can never be a tool (a raw response, a stream, `responseMeta`,
220
242
 
221
243
  `expose` stays outside the group: it chooses transports, HTTP included.
222
244
  Setting `tool` on an endpoint with no tool transport — `expose: ['HTTP']`, or an
223
- omitted `expose` under a factory with `toolExposure: 'explicit'` — throws at
245
+ omitted `expose` under a factory with a default containing no tool transport — throws at
224
246
  definition time. The pre-0.94 top-level keys (`toolName`, `toolView`, `ui`,
225
247
  `annotations`, `mcp`) are refused by name, with where each one went.
226
248
 
@@ -504,11 +526,11 @@ from the root `stitchkit`.
504
526
  | Export | Kind | Summary |
505
527
  |--------|------|---------|
506
528
  | `defineContract` | function | declare a contract — [guide](../guide/contracts.md#definecontract) |
529
+ | `ConfiguredScopedDefineContract` | _type_ | scoped authoring parameterized by the exact default transport tuple; explicit endpoint exposure replaces it |
530
+ | `ConfiguredToolExposureEndpoints` | _type_ | endpoint map with materialized exposure; a second generic selects defaults (HTTP when omitted), preserving explicit, optional and conditional overrides |
507
531
  | `createContractFactory` | function | a `defineContract` whose scope — on the contract **and** on any endpoint override — is required and held to your union, retaining each concrete literal — [guide](../guide/contracts.md#scope) |
508
- | `ContractFactoryConfig` | _type_ | optional scoped-factory policy, including explicit tool exposure |
509
- | `ContractFactoryToolExposure` | _type_ | `'explicit'` — omitted endpoint exposure materializes as HTTP-only |
510
- | `ExplicitScopedDefineContract` | _type_ | scoped factory authoring with explicit tool opt-in |
511
- | `ExplicitToolExposureEndpoints` | _type_ | endpoint map after missing exposure is materialized as `['HTTP']` |
532
+ | `ContractFactoryConfig` | _type_ | configuration passed to `createContractFactory<Scope>().configure({ toolExposure: { default: [...] } })`; the constructor itself takes no arguments |
533
+ | `ContractFactoryToolExposure` | _type_ | `default: readonly Transport[]`; omitted endpoint exposure uses the immutable policy snapshot, intersected with intrinsic HTTP-only capabilities |
512
534
  | `FactoryScopedEndpoint` | _type_ | an endpoint authored through the factory — its own `scope` override is held to the same union |
513
535
  | `ScopedContractDef` | _type_ | a factory-defined contract whose `meta.scope` is the required concrete literal |
514
536
  | `ScopedDefineContract` | _type_ | the `defineContract` `createContractFactory` returns — endpoint `scope` overrides join the union |
@@ -0,0 +1,23 @@
1
+ # stitchkit/geo/contract — stitchkit docs slice
2
+
3
+ > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
+ > `llms.txt` in this package.
5
+
6
+ Contains: API reference: `stitchkit/geo/contract` (docs/api/reference.md)
7
+
8
+ Also read:
9
+ - see `llms/geo.txt` for the GeoIP guide
10
+
11
+ ==============================================================================
12
+ # API reference: `stitchkit/geo/contract` (docs/api/reference.md)
13
+ ==============================================================================
14
+
15
+ ## `stitchkit/geo/contract`
16
+
17
+ The place snapshot's schema, browser-safe, for a shared contract. Brings `zod`.
18
+
19
+ | Export | Kind | Summary |
20
+ |--------|------|---------|
21
+ | `GeoAttributionSchema` / `GeoAttribution` | schema / _type_ | the strict readonly Zod owner of the snapshot `stitchkit/geo` resolves — [guide](../guide/geo.md#lookups) |
22
+
23
+ ---
package/llms/geo.txt CHANGED
@@ -70,7 +70,45 @@ const attribution = await geo.resolve(requestIp);
70
70
  `resolve` returns `null` for invalid, loopback, private, link-local and otherwise
71
71
  non-public addresses without querying the reader. A database miss or lookup
72
72
  failure also returns `null`; `onError` receives operational failures. A result
73
- may include country, region, city, postal, coordinates, timezone and ASN fields.
73
+ is a sparse `GeoAttribution`: absent facts have no own property, not `null` or
74
+ an own `undefined` value. City and ASN can be present independently. The default
75
+ mapper preserves the complete City + ASN place snapshot:
76
+
77
+ | Fields | Meaning |
78
+ |--------|---------|
79
+ | `continentCode`, `continentName`, `continentGeonameId` | continent code, English name and GeoNames identifier |
80
+ | `countryCode`, `countryName`, `countryGeonameId` | the country the database locates the address in; absent when the record locates none |
81
+ | `registeredCountryCode`, `registeredCountryName`, `registeredCountryGeonameId` | the country the address block is registered to, a separate fact |
82
+ | `regionCode`, `regionName`, `regionGeonameId` | first subdivision |
83
+ | `city`, `cityGeonameId`, `postalCode` | city and postal facts; no city is required |
84
+ | `latitude`, `longitude`, `timezone`, `accuracyRadiusKm` | coordinates, timezone and accuracy radius in kilometres; zero is a value |
85
+ | `autonomousSystemNumber`, `autonomousSystemOrganization` | finite autonomous system number and organisation |
86
+ | `localizedNames` | every available language under optional `continent`, `country`, `registeredCountry`, `region` and `city` dictionaries |
87
+
88
+ No locale is synthesised: without English names, localized dictionaries make a
89
+ meaningful result, but `countryName`, `regionName` or `city` stays absent. The
90
+ located country is never inferred from the registered one — an application that
91
+ wants a country for every address chooses `countryCode ?? registeredCountryCode`
92
+ itself, knowing which fact it used. Empty localized groups are omitted. Each field
93
+ is validated on its own by the schema: text is nonempty, GeoNames identifiers and
94
+ `accuracyRadiusKm` are nonnegative safe integers, latitude and longitude are in
95
+ range. A malformed field is omitted without erasing the other valid facts. Unknown
96
+ vendor fields are not projected.
97
+
98
+ A snapshot carries every language the database has: with the eight GeoLite2
99
+ languages in all five groups it is 1–1.5 KB of JSON. An application that stores
100
+ one per visit and needs fewer languages maps the result to its own shape.
101
+
102
+ `GeoAttributionSchema` is the strict, readonly Zod owner of the DTO. It lives in
103
+ the browser-safe `stitchkit/geo/contract`, so a shared contract validates a stored
104
+ or transported snapshot without the server-only resolver. Every field is optional
105
+ and readonly; use `.unwrap()` before composing the underlying object schema. The
106
+ mapper copies localized dictionaries, so later reader mutations do not change a
107
+ snapshot. An empty or unrecognised record returns `null`.
108
+
109
+ An explicit `map` callback receives the raw reader result and owns its
110
+ answer. The resolver does not apply `GeoAttributionSchema` after a custom mapper,
111
+ strip its application fields or replace its returned object.
74
112
 
75
113
  When a reload succeeds, new lookups move to the new generation immediately.
76
114
  The previous reader closes only after its in-flight lookups finish.
@@ -100,6 +138,4 @@ adapter is used.
100
138
  | `createGeoIpResolver` / `GeoIpResolver` / `GeoIpResolverOptions` / `GeoIpSnapshot` | function / _type_ | public-IP lookup over one stable reader generation; unavailable start, last-known-good degraded reload and cleanup are explicit states |
101
139
  | `createMaxMindGeoIpLoader` / `MaxMindGeoIpLoaderOptions` / `MaxMindGeoIpPaths` | function / _type_ | lazy optional-peer City+ASN loader with stable before/after file revision checks |
102
140
  | `GeoIpReader` / `GeoIpReaderLoader` | _type_ | peer-neutral reader/generation seam for adapters and tests |
103
- | `GeoAttribution` / `mapGeoIpRecord` | _type_ / function | generic optional place and autonomous-system projection; application-specific fields remain outside |
104
-
105
- ---
141
+ | `GeoAttribution` / `mapGeoIpRecord` | _type_ / function | strict readonly sparse City + ASN snapshot: continent, located and registered country as separate facts, GeoNames IDs, first region/city/postal, coordinates/timezone, `accuracyRadiusKm`, autonomous system and all source languages in five `localizedNames` groups; each malformed field is omitted on its own; custom resolver mappers remain app-owned — [guide](../guide/geo.md#lookups) |
@@ -63,8 +63,10 @@ own, recorded as an ADR.
63
63
  | `stitchkit/primitives` | browser **and** server | evolving | generic values and declarations for lifecycle, access, audit, delivery and exports, exact money and rounding tables |
64
64
  | `stitchkit/server` | server (Bun) | stable | `createServer`, `implement`, hooks, auth, Socket.IO server, server primitives |
65
65
  | `stitchkit/node` | server (Node ≥ 22) | stable | `serveNode` + the runtime-agnostic core — the Node mirror of `/server` |
66
- | `stitchkit/tools` | server | stable | `createMcpHandler`, `mountMcp`, `mountAgent`, the OAuth provider, native tools |
66
+ | `stitchkit/tools` | server | stable | the transport-neutral tool layer — registry, tool names and manifest, runtime tools, native tools, the OAuth provider, the durability engine; loads no optional peer at runtime |
67
67
  | `stitchkit/tools/mcp` | server (Bun or Node) | evolving | the canonical MCP HTTP/stdio server, schemas and typed MCP presenters; only Zod and the MCP server SDK peers |
68
+ | `stitchkit/tools/agent` | server (Bun or Node) | evolving | `mountAgent` — a contract's operations as AI SDK tools; only Zod and the `ai` peer |
69
+ | `stitchkit/tools/toolkit` | server (Bun or Node) | evolving | `createToolkit` — one tool set served over MCP and to an AI SDK agent; the MCP server SDK and `ai` peers |
68
70
  | `stitchkit/tools/contract` | browser + server | evolving | the shapes a tool surface speaks — async-operation contract, snapshot and cancel schemas, view-file input/output — without the runtime that serves them |
69
71
  | `stitchkit/tools/invoker` | server | stable | peer-free `createToolInvoker` over the canonical contract tool runner |
70
72
  | `stitchkit/tools/connections` | server (Bun or Node) | evolving | consume external MCP servers and a bounded OpenAPI subset — typed reauthorization, a per-request host fence and per-call credentials |
@@ -86,16 +88,17 @@ own, recorded as an ADR.
86
88
  | `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 |
87
89
  | `stitchkit/voice` | browser **and** server | evolving | the mechanics of a live voice reply — `SentenceCutter`, `speakableText`, a `SpeechQueue` that synthesises ahead and stops on interruption, the conversation phases |
88
90
  | `stitchkit/geo` | server (Bun or Node) | evolving | managed GeoIP reader generations, last-known-good reload and the optional MaxMind adapter |
91
+ | `stitchkit/geo/contract` | browser **and** server | evolving | the place snapshot schema, for a shared contract that stores or sends `GeoAttribution`; brings `zod` |
89
92
  | `stitchkit/xlsx` | browser **and** server | evolving | a workbook from rows and typed columns, with no dependency; text never runs as a formula |
90
93
  | `stitchkit/oauth` | browser **and** server | evolving | provider-neutral Authorization Code + PKCE request and one-shot callback transaction mechanics |
91
94
  | `stitchkit/google` | server (Bun or Node) | evolving | optional Google code exchange and verified OIDC identity adapter |
92
- | `stitchkit/observability` | server | stable<br>_redefined in 2 of the 63 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
95
+ | `stitchkit/observability` | server | stable<br>_redefined in 2 of the 65 minors since 0.56.2, most recently 0.92.0_ | request/tool event projections — `createObservability`, trace context, sanitisation |
93
96
  | `stitchkit/testing` | tests on Bun or Node | stable | in-process generated clients over a real Fetch handler, the managed-resource conformance kit and manual time for schedules and retries |
94
97
  | `stitchkit/declaration` | browser + build and deployment tooling (Bun or Node) | evolving | `ProjectDeclarationSchema` — the one machine-readable statement a repository makes about itself |
95
98
  | `stitchkit/react` | browser + server rendering | stable | `createCursorQuery`, `createCacheBridge`, QueryClient and `ApiError` retry policy |
96
99
  | `stitchkit/react/keyboard` | browser | evolving | which part of a screen gets a key — ordered layers, one Escape per level, list zones with real focus; see [keyboard guide](keyboard.md) |
97
100
  | `stitchkit/react/keyboard/testing` | server (Bun or Node) | evolving | the keyboard layers and zones without a DOM — fakes for the window, elements and key events beside the two engines, to test the order of layers, `scope`/`inert` and the edges of a zone in milliseconds |
98
- | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 25 of the 63 minors since 0.56.2, most recently 0.115.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
101
+ | `stitchkit/agent-runtime` | server | evolving<br>_redefined in 25 of the 65 minors since 0.56.2, most recently 0.115.0_ | optional durable conversation/run loop, history, models, prompts, fencing and events |
99
102
  | `stitchkit/agent-runtime/sandbox` | server | evolving | optional Linux Bubblewrap sessions, durable workspaces and a host HTTP credential gateway; see [sandbox guide](sandbox.md) |
100
103
  | `stitchkit/agent-runtime/testing` | tests on Bun or Node | evolving | credential-free replay, scripted provider faults, deterministic race controls and the agent-store conformance kit |
101
104
  | `stitchkit/agent-runtime/harness` | server | evolving | resource-aware process-local facade over the canonical Agent runtime; supervision stays outside |
@@ -107,7 +110,7 @@ own, recorded as an ADR.
107
110
  | `stitchkit/agent-runtime/sqlite/bun` | server (Bun) | evolving | durable built-in SQLite store for the agent runtime |
108
111
  | `stitchkit/agent-runtime/sqlite/node` | server (Node ≥ 22.5) | evolving | durable built-in SQLite store for the agent runtime |
109
112
  | `stitchkit-tui` | terminal (Bun) | evolving | optional official OpenTUI host over a caller-composed headless runtime |
110
- | `stitchkit/application` | browser + server | evolving<br>_redefined in 14 of the 63 minors since 0.56.2, most recently 0.110.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
113
+ | `stitchkit/application` | browser + server | evolving<br>_redefined in 14 of the 65 minors since 0.56.2, most recently 0.110.0_ | managed resource graph, readiness, admission, schedules, subtree restart and bounded shutdown |
111
114
  | `stitchkit/application/grammy` | server | evolving | a grammY bot as application resources — configuration, then polling with updates admitted by batch — and the webhook adapter |
112
115
  | `stitchkit/application/opentelemetry` | server | evolving | maps application snapshots onto an injected OpenTelemetry `Meter` |
113
116
  | `stitchkit/application/schemas` | browser + server | evolving | the application's snapshot, health and shutdown schemas alone, without the kernel |
@@ -210,7 +213,10 @@ map — feature → packages:
210
213
  | `createServer` (Bun) | — (uses `Bun.serve`) |
211
214
  | `serveNode` (Node ≥ 22) | `srvx` (+ `@types/bun` dev) |
212
215
  | In-process contract tools (`stitchkit/tools/invoker`) | — |
213
- | MCP / agent adapters (`stitchkit/tools`) | `@modelcontextprotocol/server` `ai` |
216
+ | Tool layer — registry, tool names, runtime tools (`stitchkit/tools`) | — |
217
+ | MCP server (`stitchkit/tools/mcp`) | `@modelcontextprotocol/server` |
218
+ | AI SDK agent tools (`stitchkit/tools/agent`) | `ai` |
219
+ | MCP and agent toolkit (`stitchkit/tools/toolkit`) | `@modelcontextprotocol/server` `ai` |
214
220
  | Agent application runtime (`stitchkit/agent-runtime`) | `ai` |
215
221
  | Headless Agent harness (`stitchkit/agent-runtime/harness`) | `ai` |
216
222
  | Agent coding tools (`stitchkit/agent-runtime/coding-tools`) | — |
@@ -239,15 +245,16 @@ bun add socket.io @socket.io/bun-engine # e.g. the Socket.IO server on Bun
239
245
  ```
240
246
 
241
247
  Dynamic optional-peer adapters fail with an actionable error naming the package
242
- and install command. Static entrypoints such as `stitchkit/tools` fail during
248
+ and install command. Static entrypoints such as `stitchkit/tools/mcp` fail during
243
249
  ESM resolution by naming the exact missing package; the feature-to-peer matrix
244
250
  below is the canonical install command.
245
251
 
246
- The combined tools entry owns MCP and AI-agent adapters, so install both runtime
247
- peers before importing `stitchkit/tools`:
252
+ `stitchkit/tools` itself loads no optional peer. Install the peer of the adapter
253
+ you import — both for `stitchkit/tools/toolkit`:
248
254
 
249
255
  ```bash
250
- bun add @modelcontextprotocol/server@^2 ai@^7
256
+ bun add @modelcontextprotocol/server@^2 # stitchkit/tools/mcp
257
+ bun add ai@^7 # stitchkit/tools/agent
251
258
  ```
252
259
 
253
260
  Browser, HTTP-client and React entrypoints remain usable without either MCP
package/llms/testing.txt CHANGED
@@ -326,8 +326,9 @@ fixture's transitive dependency.
326
326
 
327
327
  That includes `stitchkit/tools/invoker`: a minimal packed consumer imports it
328
328
  without MCP/AI peers and executes validation, output projection and normalized
329
- errors on Bun and Node. The broader `stitchkit/tools` barrel deliberately keeps
330
- the adapter peer budget.
329
+ errors on Bun and Node, and so does `stitchkit/tools`, which loads no optional peer at
330
+ runtime. The adapters keep their peer budgets on their own subpaths:
331
+ `stitchkit/tools/mcp`, `stitchkit/tools/agent` and `stitchkit/tools/toolkit`.
331
332
 
332
333
  Beside the matrix, one case is about the ARTIFACT rather than the inventory: a
333
334
  program that injects the Socket.IO peer loaders is bundled and started in a
@@ -556,10 +557,7 @@ signal and deadline. Bind its process lifecycle with the truthful close-only
556
557
  sibling from `stitchkit/tools`:
557
558
 
558
559
  ```ts
559
- import {
560
- bindStdioProcessSignals,
561
- createStdioMcpServer,
562
- } from 'stitchkit/tools'
560
+ import { bindStdioProcessSignals, createStdioMcpServer } from 'stitchkit/tools/mcp'
563
561
 
564
562
  const stdio = await createStdioMcpServer(config)
565
563
  const binding = bindStdioProcessSignals(stdio, {
@@ -0,0 +1,24 @@
1
+ # stitchkit/tools/agent — stitchkit docs slice
2
+
3
+ > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
+ > `llms.txt` in this package.
5
+
6
+ Contains: API reference: `stitchkit/tools/agent` (docs/api/reference.md)
7
+
8
+ Also read:
9
+ - see `llms/tools.txt` for the MCP & agents guide
10
+
11
+ ==============================================================================
12
+ # API reference: `stitchkit/tools/agent` (docs/api/reference.md)
13
+ ==============================================================================
14
+
15
+ ## `stitchkit/tools/agent`
16
+
17
+ Server-only. A contract's operations as Vercel AI SDK tools; needs Zod and the `ai`
18
+ peer, not the MCP server SDK. → ADR 0284.
19
+
20
+ | Export | Kind | Summary |
21
+ |--------|------|---------|
22
+ | `mountAgent` | function | a Vercel AI SDK `ToolSet` from a service; failed executions reject through the SDK tool-error channel with a safe typed envelope, while successful output is never classified by field name — [guide](../guide/mcp-and-agents.md#ai-agents--mountagent) |
23
+ | `AgentMountConfig` | _type_ | config for `mountAgent` |
24
+ | `AgentContext` | _type_ | the context merged into agent tool handlers |