@theokit/sdk 5.14.0 → 5.15.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 (212) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/{agent-Dfw3VsIX.d.ts → agent-B6C9i_qu.d.ts} +23 -213
  3. package/dist/{agent-DExqjqYy.d.cts → agent-B6FQad6P.d.cts} +23 -213
  4. package/dist/{agent-T34LCGQM.js → agent-DRDGUU6T.js} +18 -17
  5. package/dist/{agent-T34LCGQM.js.map → agent-DRDGUU6T.js.map} +1 -1
  6. package/dist/{agent-TL4K7BTG.cjs → agent-VI2HITPT.cjs} +19 -18
  7. package/dist/{agent-TL4K7BTG.cjs.map → agent-VI2HITPT.cjs.map} +1 -1
  8. package/dist/agent.d.ts +2 -3
  9. package/dist/{batch-EP3FCL6D.js → batch-N2XDYZED.js} +4 -4
  10. package/dist/{batch-EP3FCL6D.js.map → batch-N2XDYZED.js.map} +1 -1
  11. package/dist/{batch-IZ5EDKJ5.cjs → batch-VFR2MAUE.cjs} +7 -7
  12. package/dist/{batch-IZ5EDKJ5.cjs.map → batch-VFR2MAUE.cjs.map} +1 -1
  13. package/dist/{chunk-3ONIVO2I.js → chunk-23SS4ID4.js} +3 -3
  14. package/dist/{chunk-3ONIVO2I.js.map → chunk-23SS4ID4.js.map} +1 -1
  15. package/dist/{chunk-2C24NSNV.js → chunk-3BBTHFGJ.js} +3 -3
  16. package/dist/{chunk-2C24NSNV.js.map → chunk-3BBTHFGJ.js.map} +1 -1
  17. package/dist/{chunk-NP362THY.cjs → chunk-3F53FLQ7.cjs} +5 -7
  18. package/dist/chunk-3F53FLQ7.cjs.map +1 -0
  19. package/dist/{chunk-SXH37C7X.cjs → chunk-55LLQFHW.cjs} +6 -6
  20. package/dist/{chunk-SXH37C7X.cjs.map → chunk-55LLQFHW.cjs.map} +1 -1
  21. package/dist/{chunk-GARVAUCU.js → chunk-5M5GQYBM.js} +534 -236
  22. package/dist/chunk-5M5GQYBM.js.map +1 -0
  23. package/dist/{chunk-2WY2OFSC.cjs → chunk-64ECM3XM.cjs} +616 -318
  24. package/dist/chunk-64ECM3XM.cjs.map +1 -0
  25. package/dist/{chunk-ZJAYFSVI.js → chunk-7ACS6P5Z.js} +5 -7
  26. package/dist/chunk-7ACS6P5Z.js.map +1 -0
  27. package/dist/{chunk-NAVUTK6X.js → chunk-ARC2V7NY.js} +3 -3
  28. package/dist/{chunk-NAVUTK6X.js.map → chunk-ARC2V7NY.js.map} +1 -1
  29. package/dist/{chunk-WDVG5R2Q.cjs → chunk-AUH2EVWY.cjs} +4 -3
  30. package/dist/chunk-AUH2EVWY.cjs.map +1 -0
  31. package/dist/chunk-BNEUB52I.cjs +55 -0
  32. package/dist/chunk-BNEUB52I.cjs.map +1 -0
  33. package/dist/chunk-BPL5CVZ5.js +53 -0
  34. package/dist/chunk-BPL5CVZ5.js.map +1 -0
  35. package/dist/{chunk-NVQSBRG6.js → chunk-CBBT42VX.js} +3 -3
  36. package/dist/{chunk-NVQSBRG6.js.map → chunk-CBBT42VX.js.map} +1 -1
  37. package/dist/chunk-CHKV2L2Y.cjs +416 -0
  38. package/dist/chunk-CHKV2L2Y.cjs.map +1 -0
  39. package/dist/{chunk-SNVYOX46.cjs → chunk-DJKGDLYZ.cjs} +91 -61
  40. package/dist/chunk-DJKGDLYZ.cjs.map +1 -0
  41. package/dist/{chunk-354F3OF5.js → chunk-FGGVSHDW.js} +3 -3
  42. package/dist/{chunk-354F3OF5.js.map → chunk-FGGVSHDW.js.map} +1 -1
  43. package/dist/{chunk-6OCJWGVD.cjs → chunk-FTXY4D44.cjs} +4 -4
  44. package/dist/{chunk-6OCJWGVD.cjs.map → chunk-FTXY4D44.cjs.map} +1 -1
  45. package/dist/chunk-INVEGVGO.js +405 -0
  46. package/dist/chunk-INVEGVGO.js.map +1 -0
  47. package/dist/{chunk-ZOL3L4EH.js → chunk-IOBHFP2E.js} +49 -19
  48. package/dist/chunk-IOBHFP2E.js.map +1 -0
  49. package/dist/{chunk-BZK5QL3N.cjs → chunk-KMFBNKCT.cjs} +4 -4
  50. package/dist/{chunk-BZK5QL3N.cjs.map → chunk-KMFBNKCT.cjs.map} +1 -1
  51. package/dist/{chunk-DF77RBF4.js → chunk-LCCT5ZXJ.js} +6 -6
  52. package/dist/{chunk-DF77RBF4.js.map → chunk-LCCT5ZXJ.js.map} +1 -1
  53. package/dist/{chunk-G7XBVM3T.cjs → chunk-MHUOVS5I.cjs} +5 -5
  54. package/dist/{chunk-G7XBVM3T.cjs.map → chunk-MHUOVS5I.cjs.map} +1 -1
  55. package/dist/{chunk-CWQPQTUZ.cjs → chunk-NEH3BPFD.cjs} +15 -15
  56. package/dist/{chunk-CWQPQTUZ.cjs.map → chunk-NEH3BPFD.cjs.map} +1 -1
  57. package/dist/{chunk-5AR6O7GW.js → chunk-NK5EOTDY.js} +3 -3
  58. package/dist/{chunk-5AR6O7GW.js.map → chunk-NK5EOTDY.js.map} +1 -1
  59. package/dist/{chunk-4TEGFMSP.cjs → chunk-P7QYG4RZ.cjs} +23 -15
  60. package/dist/chunk-P7QYG4RZ.cjs.map +1 -0
  61. package/dist/chunk-PPU2D4FZ.js +19 -0
  62. package/dist/chunk-PPU2D4FZ.js.map +1 -0
  63. package/dist/{chunk-AB4OPJLD.js → chunk-RGVMJU57.js} +3 -3
  64. package/dist/{chunk-AB4OPJLD.js.map → chunk-RGVMJU57.js.map} +1 -1
  65. package/dist/{chunk-4KBI37F3.cjs → chunk-RTDVSHJR.cjs} +5 -5
  66. package/dist/{chunk-4KBI37F3.cjs.map → chunk-RTDVSHJR.cjs.map} +1 -1
  67. package/dist/{chunk-CJN5CEI3.js → chunk-RZL2W4C3.js} +23 -15
  68. package/dist/chunk-RZL2W4C3.js.map +1 -0
  69. package/dist/chunk-SPEN7RJU.cjs +18 -0
  70. package/dist/{chunk-R5UQL2R5.cjs.map → chunk-SPEN7RJU.cjs.map} +1 -1
  71. package/dist/{chunk-ZF2LDKQQ.cjs → chunk-U3DW3WDE.cjs} +9 -8
  72. package/dist/chunk-U3DW3WDE.cjs.map +1 -0
  73. package/dist/{chunk-LXG6VL6R.cjs → chunk-U7PRI3XM.cjs} +3 -3
  74. package/dist/{chunk-LXG6VL6R.cjs.map → chunk-U7PRI3XM.cjs.map} +1 -1
  75. package/dist/{chunk-H7G65PNI.js → chunk-VCQ37TC5.js} +3 -3
  76. package/dist/{chunk-H7G65PNI.js.map → chunk-VCQ37TC5.js.map} +1 -1
  77. package/dist/{chunk-SDZ4XDWS.cjs → chunk-VWYFGE27.cjs} +9 -9
  78. package/dist/{chunk-SDZ4XDWS.cjs.map → chunk-VWYFGE27.cjs.map} +1 -1
  79. package/dist/{chunk-RN3XDZGS.js → chunk-WM646HEN.js} +4 -3
  80. package/dist/chunk-WM646HEN.js.map +1 -0
  81. package/dist/chunk-X7CE7Y5W.js +305 -0
  82. package/dist/chunk-X7CE7Y5W.js.map +1 -0
  83. package/dist/{chunk-CGH4BCIY.cjs → chunk-XE3CAY6Z.cjs} +5 -5
  84. package/dist/{chunk-CGH4BCIY.cjs.map → chunk-XE3CAY6Z.cjs.map} +1 -1
  85. package/dist/chunk-XOU3CL7S.cjs +312 -0
  86. package/dist/chunk-XOU3CL7S.cjs.map +1 -0
  87. package/dist/{chunk-ULEK4OM4.js → chunk-YKNBTHMD.js} +3 -3
  88. package/dist/{chunk-ULEK4OM4.js.map → chunk-YKNBTHMD.js.map} +1 -1
  89. package/dist/{compact-session-D2MQDB6G.cjs → compact-session-NX7HUNTB.cjs} +16 -16
  90. package/dist/{compact-session-D2MQDB6G.cjs.map → compact-session-NX7HUNTB.cjs.map} +1 -1
  91. package/dist/{compact-session-N2PPHQO6.js → compact-session-Q5IGNFPW.js} +7 -7
  92. package/dist/{compact-session-N2PPHQO6.js.map → compact-session-Q5IGNFPW.js.map} +1 -1
  93. package/dist/{cron-CK2v0VWA.d.cts → cron-Bh3aWgQ2.d.cts} +2 -2
  94. package/dist/{cron-BubDpFJG.d.ts → cron-CCDxeeFZ.d.ts} +2 -2
  95. package/dist/cron.cjs +18 -17
  96. package/dist/cron.d.cts +4 -3
  97. package/dist/cron.d.ts +4 -3
  98. package/dist/cron.js +17 -16
  99. package/dist/eval.cjs +17 -16
  100. package/dist/eval.cjs.map +1 -1
  101. package/dist/eval.js +16 -15
  102. package/dist/eval.js.map +1 -1
  103. package/dist/fs-session-store-CYNTEPJZ.cjs +20 -0
  104. package/dist/{fs-session-store-S2AXVJIX.cjs.map → fs-session-store-CYNTEPJZ.cjs.map} +1 -1
  105. package/dist/fs-session-store-MYQEVUFL.js +11 -0
  106. package/dist/{fs-session-store-6ZCCJX3K.js.map → fs-session-store-MYQEVUFL.js.map} +1 -1
  107. package/dist/{index-manager-HO456AVW.cjs → index-manager-2KH75BRW.cjs} +7 -7
  108. package/dist/{index-manager-HO456AVW.cjs.map → index-manager-2KH75BRW.cjs.map} +1 -1
  109. package/dist/{index-manager-QDH56FER.js → index-manager-NF2WRLOU.js} +6 -6
  110. package/dist/{index-manager-QDH56FER.js.map → index-manager-NF2WRLOU.js.map} +1 -1
  111. package/dist/index.cjs +66 -262
  112. package/dist/index.cjs.map +1 -1
  113. package/dist/index.d.cts +10 -46
  114. package/dist/index.d.ts +10 -46
  115. package/dist/index.js +27 -227
  116. package/dist/index.js.map +1 -1
  117. package/dist/{inject-session-J26SHHIO.js → inject-session-4ROYLZHY.js} +3 -3
  118. package/dist/{inject-session-J26SHHIO.js.map → inject-session-4ROYLZHY.js.map} +1 -1
  119. package/dist/{inject-session-3ICZIJ2N.cjs → inject-session-AWKDCGHV.cjs} +4 -4
  120. package/dist/{inject-session-3ICZIJ2N.cjs.map → inject-session-AWKDCGHV.cjs.map} +1 -1
  121. package/dist/internal/agent-loop/doom-loop-tracker.d.ts +3 -0
  122. package/dist/internal/agent-loop/types.d.ts +6 -0
  123. package/dist/internal/error-mappers/anthropic.d.ts +3 -0
  124. package/dist/internal/error-mappers/openai-compatible.d.ts +2 -3
  125. package/dist/internal/local-agent/local-agent-dispatch.d.ts +3 -1
  126. package/dist/internal/local-agent/send-queue.d.ts +31 -0
  127. package/dist/internal/mcp/client.d.ts +2 -0
  128. package/dist/internal/mcp/oauth-bearer.d.ts +2 -0
  129. package/dist/internal/memory/adapters/index.cjs +3 -3
  130. package/dist/internal/memory/adapters/index.js +2 -2
  131. package/dist/internal/memory/dreaming/phases.d.ts +15 -0
  132. package/dist/internal/memory/dreaming/run.d.ts +29 -0
  133. package/dist/internal/memory/sdk-memory-peer-loader.d.ts +2 -0
  134. package/dist/internal/memory/storage/index.cjs +51 -35
  135. package/dist/internal/memory/storage/index.d.cts +2 -0
  136. package/dist/internal/memory/storage/index.d.ts +2 -0
  137. package/dist/internal/memory/storage/index.js +4 -4
  138. package/dist/internal/persistence/cwd-mutex.d.cts +4 -2
  139. package/dist/internal/persistence/cwd-mutex.d.ts +4 -2
  140. package/dist/internal/persistence/index.cjs +4 -4
  141. package/dist/internal/persistence/index.js +2 -2
  142. package/dist/internal/persistence/sqlite-session-store.d.cts +25 -0
  143. package/dist/internal/persistence/sqlite-session-store.d.ts +25 -0
  144. package/dist/internal/providers/registry.d.ts +5 -1
  145. package/dist/mcp-auth.cjs +25 -307
  146. package/dist/mcp-auth.cjs.map +1 -1
  147. package/dist/mcp-auth.js +5 -305
  148. package/dist/mcp-auth.js.map +1 -1
  149. package/dist/models.cjs +9 -9
  150. package/dist/models.js +2 -2
  151. package/dist/persistence.cjs +9 -4
  152. package/dist/persistence.cjs.map +1 -1
  153. package/dist/persistence.d.cts +744 -40
  154. package/dist/persistence.d.ts +744 -40
  155. package/dist/persistence.js +3 -2
  156. package/dist/persistence.js.map +1 -1
  157. package/dist/providers.cjs +4 -4
  158. package/dist/providers.js +2 -2
  159. package/dist/sandbox/docker-sandbox.d.cts +58 -0
  160. package/dist/sandbox/docker-sandbox.d.ts +58 -0
  161. package/dist/sandbox/index.cjs +129 -1
  162. package/dist/sandbox/index.cjs.map +1 -1
  163. package/dist/sandbox/index.d.cts +1 -0
  164. package/dist/sandbox/index.d.ts +1 -0
  165. package/dist/sandbox/index.js +132 -5
  166. package/dist/sandbox/index.js.map +1 -1
  167. package/dist/{sdk-agent-DwzHcuxy.d.cts → sdk-agent-BA_6_wtc.d.cts} +30 -2
  168. package/dist/{sdk-agent-a3fW1xUK.d.ts → sdk-agent-CnwPODYH.d.ts} +30 -2
  169. package/dist/session-store-Dh07jr9N.d.cts +209 -0
  170. package/dist/session-store-Dh07jr9N.d.ts +209 -0
  171. package/dist/sqlite-session-store-BbcpKY1L.d.ts +64 -0
  172. package/dist/sqlite-session-store-TKXtT4ON.d.cts +64 -0
  173. package/dist/subagents-loader-KLWF4QPD.cjs +16 -0
  174. package/dist/{subagents-loader-TXOA5EJJ.cjs.map → subagents-loader-KLWF4QPD.cjs.map} +1 -1
  175. package/dist/subagents-loader-SXETS2F2.js +7 -0
  176. package/dist/{subagents-loader-Z744TAKD.js.map → subagents-loader-SXETS2F2.js.map} +1 -1
  177. package/dist/subagents-loader.cjs +2 -2
  178. package/dist/subagents-loader.d.cts +3 -2
  179. package/dist/subagents-loader.d.ts +3 -2
  180. package/dist/subagents-loader.js +1 -1
  181. package/dist/types/agent.d.ts +14 -1
  182. package/dist/types/budget-tracker.d.ts +6 -2
  183. package/dist/types/mcp.d.ts +14 -0
  184. package/dist/types/run.d.ts +15 -1
  185. package/dist/workflow.d.cts +1 -1
  186. package/dist/workflow.d.ts +1 -1
  187. package/docs/adr/mutation-testing-scope.md +12 -2
  188. package/docs/error-codes.md +41 -40
  189. package/docs/harness-capability-map.md +32 -6
  190. package/package.json +1 -1
  191. package/dist/chunk-2WY2OFSC.cjs.map +0 -1
  192. package/dist/chunk-4TEGFMSP.cjs.map +0 -1
  193. package/dist/chunk-6CXRYPG7.cjs +0 -211
  194. package/dist/chunk-6CXRYPG7.cjs.map +0 -1
  195. package/dist/chunk-CJN5CEI3.js.map +0 -1
  196. package/dist/chunk-GARVAUCU.js.map +0 -1
  197. package/dist/chunk-MSEL5E5P.js +0 -204
  198. package/dist/chunk-MSEL5E5P.js.map +0 -1
  199. package/dist/chunk-NP362THY.cjs.map +0 -1
  200. package/dist/chunk-Q5EWJPRY.js +0 -18
  201. package/dist/chunk-Q5EWJPRY.js.map +0 -1
  202. package/dist/chunk-R5UQL2R5.cjs +0 -18
  203. package/dist/chunk-RN3XDZGS.js.map +0 -1
  204. package/dist/chunk-SNVYOX46.cjs.map +0 -1
  205. package/dist/chunk-WDVG5R2Q.cjs.map +0 -1
  206. package/dist/chunk-ZF2LDKQQ.cjs.map +0 -1
  207. package/dist/chunk-ZJAYFSVI.js.map +0 -1
  208. package/dist/chunk-ZOL3L4EH.js.map +0 -1
  209. package/dist/fs-session-store-6ZCCJX3K.js +0 -11
  210. package/dist/fs-session-store-S2AXVJIX.cjs +0 -20
  211. package/dist/subagents-loader-TXOA5EJJ.cjs +0 -16
  212. package/dist/subagents-loader-Z744TAKD.js +0 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#913](https://github.com/usetheokit/theokit-sdk/pull/913) [`f944093`](https://github.com/usetheokit/theokit-sdk/commit/f9440934f33df86054a24a33120d40f7028789ec) Thanks [@aifactory-paulohenriquevn](https://github.com/apps/aifactory-paulohenriquevn)! - `@theokit/sdk/sandbox` ships `DockerSandbox`, a `SandboxBackend` that runs each command in a
8
+ throwaway container with a read-only root filesystem, no network by default, dropped capabilities and
9
+ the workspace as the only writable mount, so a shell command cannot write outside its workspace.
10
+
11
+ - [#942](https://github.com/usetheokit/theokit-sdk/pull/942) [`ccaac78`](https://github.com/usetheokit/theokit-sdk/commit/ccaac78d735e0bbd6b7cb91fcfb019fbb0492d35) Thanks [@aifactory-paulohenriquevn](https://github.com/apps/aifactory-paulohenriquevn)! - `McpStdioServerConfig` and `McpHttpServerConfig` accept `sequential: true` ([#932](https://github.com/usetheokit/theokit-sdk/issues/932)). The calls a model makes to that server's tools in one step then run one at a time, in the order the model listed them, and the results still come back in call order. Calls to other servers or to non-MCP tools in the same step are not held behind them. Without the option the calls still run at once. Use it for a stateful server such as Playwright MCP, where a snapshot must wait for the navigation before it.
12
+
13
+ - [#879](https://github.com/usetheokit/theokit-sdk/pull/879) [`de5c7bd`](https://github.com/usetheokit/theokit-sdk/commit/de5c7bdc65c6e9b01b1aa02c84069bfc00e03edf) Thanks [@aifactory-paulohenriquevn](https://github.com/apps/aifactory-paulohenriquevn)! - New `SqliteSessionStore` (exported from `@theokit/sdk` and `@theokit/sdk/persistence`): a `SessionStore` backed by one SQLite file, passed as `local.sessionStore`. `Agent.transcript`, `injectSessionTurn` and `compact` now read from the agent's configured `local.sessionStore` instead of always opening the JSONL file.
14
+
15
+ ### Patch Changes
16
+
17
+ - [#905](https://github.com/usetheokit/theokit-sdk/pull/905) [`418b27c`](https://github.com/usetheokit/theokit-sdk/commit/418b27ceed5931bdce846b743f1e348df6ae2f46) Thanks [@aifactory-paulohenriquevn](https://github.com/apps/aifactory-paulohenriquevn)! - `registerProvider` lowercases a profile's name and aliases, and `getProviderProfile` looks names up
18
+ in lowercase, so a profile registered as `AcmeAI` with alias `AcmeX` is reached by routes naming
19
+ either. This replaces the router's "register it in lowercase" errors for mixed-case names and
20
+ aliases (their two tests now assert routing instead), since such a registration can no longer occur.
21
+
22
+ - [#896](https://github.com/usetheokit/theokit-sdk/pull/896) [`419ba63`](https://github.com/usetheokit/theokit-sdk/commit/419ba631cb248ec6ab8e9e8432aee26b1a93b618) Thanks [@aifactory-paulohenriquevn](https://github.com/apps/aifactory-paulohenriquevn)! - `skills.enabled` now restricts the local runtime: a skill not named in it is neither listed nor readable.
23
+
24
+ - [#940](https://github.com/usetheokit/theokit-sdk/pull/940) [`7f21de1`](https://github.com/usetheokit/theokit-sdk/commit/7f21de1b73d9fd62c4d6f26f220b87a7b8540dfe) Thanks [@aifactory-paulohenriquevn](https://github.com/apps/aifactory-paulohenriquevn)! - Correction to the 5.12.0 note on malformed chat-completions `prompt_tokens`: the dropped count is left out of the per-call `LlmFinish` and no input budget event is emitted for it, and the SDK writes `provider reported an unusable inputTokens (…)` to the diagnostics sink. `RunResult.usage` and `usage.requests[]` still read that count as `inputTokens: 0`, because `TokenUsage.inputTokens` is a required number; only a consumer with a diagnostics sink can tell a dropped count from a real zero. The diagnostic prints `NaN` in place of the value the provider sent.
25
+
3
26
  ## 5.14.0
4
27
 
5
28
  ### Minor Changes
@@ -1,214 +1,7 @@
1
- import { W as MemoryFact, T as MemoryAdapter, V as MemoryContext, aV as SystemPromptSkillRef, M as McpServerConfig, C as ContextSettings, P as ProviderRoutingSettings, a as PluginsSettings, c as Processor, S as SDKAgent } from './sdk-agent-a3fW1xUK.js';
1
+ import { W as MemoryFact, T as MemoryAdapter, V as MemoryContext, aW as SystemPromptSkillRef, M as McpServerConfig, C as ContextSettings, P as ProviderRoutingSettings, a as PluginsSettings, c as Processor, S as SDKAgent } from './sdk-agent-CnwPODYH.js';
2
+ import { a as SessionStore } from './session-store-Dh07jr9N.js';
2
3
  import { M as ModelSelection, C as CustomTool, P as PermissionMode } from './agent-prims-CZyxfCmS.js';
3
4
 
4
- /**
5
- * Owner: `src/` (1 of 2 importers). Derived from the import graph, not
6
- * declared — `tests/lint/types-name-their-owner.test.ts` re-derives it.
7
- *
8
- * `SessionRecord` — the native on-disk transcript record shape (SE40).
9
- *
10
- * The theokit session format IS the Claude Code record shape: a
11
- * `uuid`/`parentUuid` DAG of records with structured
12
- * `text`/`tool_use`/`tool_result`/`thinking` blocks. This is the contract the
13
- * pluggable {@link SessionStore} seam operates over.
14
- *
15
- * DIP-correct home (SE46): the contract lives in the domain `types/` layer;
16
- * the application-layer DAG core (`internal/persistence/session-transcript.ts`)
17
- * re-exports it for back-compat while owning the record builders + reader.
18
- *
19
- * @public
20
- */
21
- /** A content block inside {@link TranscriptMessage}. */
22
- type TranscriptBlock = {
23
- type: "text";
24
- text: string;
25
- } | {
26
- type: "thinking";
27
- thinking?: string;
28
- signature?: string;
29
- } | {
30
- type: "tool_use";
31
- id: string;
32
- name: string;
33
- input: unknown;
34
- } | {
35
- type: "tool_result";
36
- tool_use_id: string;
37
- content: unknown;
38
- is_error?: boolean;
39
- };
40
- /**
41
- * The message body of a {@link SessionRecord}.
42
- *
43
- * **It is NOT called `SessionMessage`** — that name already exists in
44
- * `internal/session/session-types.ts` with the shape `{role, text}`, incompatible with this one.
45
- * Reusing an exported name for a new shape is
46
- * precisely the silent break M91 cost two patches to undo.
47
- *
48
- * Parsing from disk stays **tolerant** (`readTranscript` skips a malformed line): what changes here
49
- * is the **type**, not leniency — records written by earlier versions stay readable.
50
- *
51
- * @public
52
- */
53
- interface TranscriptMessage {
54
- role: "user" | "assistant";
55
- content: TranscriptBlock[];
56
- /**
57
- * The three fields below appear **only** on the assistant record, and come from the writer
58
- * (`SessionTranscript.appendAssistant`). Declared optional because the user record does not carry
59
- * them — measured in the writer itself, not assumed.
60
- */
61
- id?: string;
62
- type?: "message";
63
- model?: string;
64
- }
65
- /**
66
- * One transcript record — a single line of the session JSONL file, and the unit the pluggable
67
- * `SessionStore` seam reads and writes.
68
- *
69
- * Records form a `uuid`/`parentUuid` DAG, not a flat list: `parentUuid` names the preceding record
70
- * and is `null` at the root. Thread a session by following those links; a reader that assumes file
71
- * order is linear will mis-thread one that branched.
72
- *
73
- * `message` is absent on `system` records — a compaction boundary carries `compactMetadata` instead —
74
- * so it is optional even on records you would expect to be conversational, and `type` is what tells
75
- * you which you are holding.
76
- *
77
- * Reading is deliberately tolerant: a malformed line is skipped rather than failing the whole read.
78
- * Every record you receive is well-formed, but the file may have contained more than you got back,
79
- * so this is not the type to use for an exact-count audit of what was written.
80
- *
81
- * @public
82
- */
83
- interface SessionRecord {
84
- type: "user" | "assistant" | "system";
85
- uuid: string;
86
- parentUuid: string | null;
87
- sessionId: string;
88
- timestamp: string;
89
- isSidechain?: boolean;
90
- userType?: string;
91
- cwd?: string;
92
- version?: string;
93
- subtype?: string;
94
- compactMetadata?: {
95
- preTokens: number;
96
- trigger: string;
97
- };
98
- /**
99
- * The message body, in the shape the transcript writer actually writes.
100
- *
101
- * M94 — it was `Record<string, unknown>`, and the consumer recovered the type with a cast on every read.
102
- * The shape **has always been fixed** (`SessionTranscript.appendToolResults` / `#push` produce
103
- * it); it simply was not declared. It stays optional because system records carry no message.
104
- */
105
- message?: TranscriptMessage;
106
- }
107
-
108
- /**
109
- * Owner: `internal/session/` (4 of 8 importers). Derived from the import graph, not declared —
110
- * `tests/lint/types-name-their-owner.test.ts` re-derives it.
111
- *
112
- * SE41 — the pluggable `SessionStore` seam over the NATIVE session transcript.
113
- *
114
- * A minimal, two-method port so an external store (Postgres / Redis / KV /
115
- * durable object) can be the **primary store AND resume source** — the
116
- * serverless (ephemeral FS) and multi-host / multi-pod use case that SE40
117
- * dropped when it removed the `ConversationStorageAdapter`. This is deliberately
118
- * NOT that removed ~10-method adapter: the seam is JUST record read/append over
119
- * the native {@link SessionRecord} shape (no getMessages / getSessionMeta /
120
- * delete / objective methods).
121
- *
122
- * The SDK ships a real default implementation, `FsSessionStore`, that reads and
123
- * append-writes the native Claude-shaped `.jsonl` transcript — omitting
124
- * `local.sessionStore` yields byte-identical current behavior (back-compat, zero
125
- * consumer change). Injected via `local.sessionStore` for external stores.
126
- *
127
- * THIS SEAM DOES NOT HIDE THE STORAGE, AND IS NOT MEANT TO. A Repository
128
- * abstracts a persistence model away; this one is defined in terms of the
129
- * native one — the port speaks {@link SessionRecord}, "the exact SessionRecord
130
- * the SDK writes", and the on-disk layout's path helpers (`encodeProjectDir`,
131
- * `transcriptPath`, `transcriptRoot`) are published on purpose at
132
- * `@theokit/sdk/persistence` so a consumer can locate a transcript file.
133
- *
134
- * That is the whole design and the reason the seam is two methods rather than
135
- * ten: the format is the contract, and a store implements read/append over it.
136
- * A consumer supplying `local.sessionStore` is NOT bound by those paths — they
137
- * describe where the DEFAULT `FsSessionStore` puts files, not where an external
138
- * store must.
139
- *
140
- * Consistency contract: `appendRecords` is append-only and ordering-preserving.
141
- * The FS default serializes appends per agent with a cross-process file lock;
142
- * external implementations own (and MUST document) their own concurrency
143
- * guarantees for two hosts appending to the same `agentId`.
144
- *
145
- * @public
146
- */
147
-
148
- /**
149
- * The pluggable session-store seam. Exactly two methods over the native
150
- * {@link SessionRecord} shape.
151
- *
152
- * @public
153
- */
154
- interface SessionStore {
155
- /**
156
- * Return every persisted record for `agentId`, in append order. A session
157
- * that was never written MUST resolve to `[]` (not throw) — a fresh agent has
158
- * no history. The SDK reconstructs the resumable `LlmMessage[]` from these
159
- * records via the native DAG reader, so the shape MUST be the exact
160
- * {@link SessionRecord} the SDK writes.
161
- *
162
- * A store that cannot READ (e.g. the backing DB is unreachable on resume)
163
- * MUST throw a typed error rather than silently returning `[]` — a silent
164
- * empty read would masquerade as "no history" and drop the conversation.
165
- */
166
- readRecords(agentId: string): Promise<SessionRecord[]>;
167
- /**
168
- * Append `records` (the new-turn delta) to `agentId`'s session, append-only.
169
- * MUST preserve order and MUST NOT drop or rewrite prior records — the native
170
- * format is an append-only `parentUuid` DAG (compaction is a new-root
171
- * `compact_boundary` record, still an append).
172
- *
173
- * Note on the write path: per-turn persistence is fire-and-forget so `send()`
174
- * is never blocked by store I/O — an `appendRecords` rejection is logged to
175
- * stderr, NOT thrown to the caller (best-effort write). An external store that
176
- * must guarantee durability should make `appendRecords` resilient (retry /
177
- * durable write) internally. This differs from {@link SessionStore.readRecords},
178
- * which MUST throw on failure (a resume cannot proceed on a silent partial history).
179
- */
180
- appendRecords(agentId: string, records: readonly SessionRecord[]): Promise<void>;
181
- /**
182
- * Claim the single-writer lease for `agentId`, if this store has one. OPTIONAL.
183
- *
184
- * The SDK calls it when an agent starts and skips it when absent, so a two-method store keeps
185
- * working unchanged — declaring it here does not require it, which is the whole reason it is
186
- * optional. What declaring it DOES is make the capability discoverable: the SDK probed for this
187
- * method through an `as unknown` cast against an interface that never mentioned it, so a
188
- * third-party store author — the serverless / multi-pod case this port exists to serve — read a
189
- * two-method interface, implemented two methods, and never learned the hook was there.
190
- *
191
- * CONTRACT, and the half that matters: a rejection whose `name` is `"SessionBusyError"` PROPAGATES
192
- * to the caller, because another process holding the session is a decision the caller has to make
193
- * (`exec` forks to a new id). Any other rejection is treated as "no lease available here" —
194
- * logged, and the turn proceeds without single-writer protection, since the write is best-effort
195
- * by contract anyway.
196
- */
197
- acquire?(agentId: string): Promise<void>;
198
- /**
199
- * Release the lease `acquire` claimed, if this store has one. OPTIONAL.
200
- *
201
- * Called on agent disposal. A rejection is not handled specially.
202
- */
203
- release?(agentId: string): Promise<void>;
204
- /**
205
- * Release store-level resources — a connection pool, a file handle. OPTIONAL.
206
- *
207
- * Called once, on agent disposal, after {@link SessionStore.release}.
208
- */
209
- dispose?(): Promise<void>;
210
- }
211
-
212
5
  /**
213
6
  * A discovered skill's metadata. The skill BODY is never included — only the
214
7
  * strict frontmatter fields plus the resolved `source` path.
@@ -299,8 +92,12 @@ interface BudgetUsageEvent {
299
92
  readonly tokens: number;
300
93
  /** Provider/model identifier (e.g., `"openai/gpt-4o-mini"`). */
301
94
  readonly model: string;
302
- /** Whether this is an input (prompt) or output (completion) measurement. */
303
- readonly type: "input" | "output";
95
+ /**
96
+ * Whether this is an input (uncached prompt), output (completion), `cache_read` (prompt tokens
97
+ * served from the provider's cache) or `cache_write` (prompt tokens written to it) measurement.
98
+ * A tracker that has no separate rate for the cache types should treat them as input.
99
+ */
100
+ readonly type: "input" | "output" | "cache_read" | "cache_write";
304
101
  /** Optional ISO 8601 timestamp; defaults to now() if omitted. */
305
102
  readonly at?: string;
306
103
  }
@@ -1362,7 +1159,8 @@ type SystemPromptResolver = (ctx: SystemPromptContext) => string | Promise<strin
1362
1159
  */
1363
1160
  interface SkillsSettings {
1364
1161
  /**
1365
- * Names of skills the parent agent may invoke. When omitted, every
1162
+ * Names of skills the local runtime loads: a skill not named here cannot be listed or read.
1163
+ * When omitted, every
1366
1164
  * discovered skill is enabled.
1367
1165
  */
1368
1166
  enabled?: string[];
@@ -1778,6 +1576,18 @@ interface AgentOptions {
1778
1576
  conversationId: string;
1779
1577
  userId?: string;
1780
1578
  }) => Promise<void> | void;
1579
+ /**
1580
+ * Start a fresh conversation when the agent has been idle this many minutes.
1581
+ *
1582
+ * Checked at the start of a local `send`: when more than this long has passed since the previous
1583
+ * `send` on the same agent began, the in-memory conversation is cleared first, so the model
1584
+ * receives no prior messages and `onBeforeSend` reports `previousMessageCount: 0`. Absent (the
1585
+ * default), or not a positive finite number, never resets. The first send of a process has no
1586
+ * previous send, so it never resets. The on-disk transcript is not deleted.
1587
+ *
1588
+ * @public
1589
+ */
1590
+ sessionIdleResetMinutes?: number;
1781
1591
  /**
1782
1592
  * Fires before each `agent.send`. `previousMessageCount` is the count of
1783
1593
  * messages already persisted BEFORE the current send adds the user
@@ -2070,4 +1880,4 @@ interface ListResult<T> {
2070
1880
  nextCursor?: string;
2071
1881
  }
2072
1882
 
2073
- export { type RecordSessionSummaryArgs as $, type AgentOptions as A, type BuiltinToolName as B, type CloudOptions as C, type CreateSkillSpec as D, type HookApprovalRequest as E, type HookName as F, type GetAgentOptions as G, type HookApprovalGate as H, type InlineSkill as I, type LlmCallContext as J, type MemoryProviderAgentRef as K, type LocalOptions as L, type MemorySettings as M, type MemoryProviderFactory as N, type MemoryProviderHandle as O, type Plugin as P, type MemoryProviderInitOptions as Q, type PluginContext as R, type SystemPromptResolver as S, type PluginHookDisposer as T, type PostAssistantReplyContext as U, type PostToolCallContext as V, type PreToolCallContext as W, type PreUserSendContext as X, type PreUserSendResult as Y, type ProviderTransform as Z, type ProviderTransformContext as _, type AgentDefinition as a, type SessionLifecycleContext as a0, type SessionRecord as a1, type SessionStore as a2, type SettingSource as a3, Skill as a4, type SkillsResolver as a5, type SkillsResolverContext as a6, type SystemPromptContext as a7, type SystemPromptMemoryFact as a8, type TelemetrySettings as a9, type ToolCallSummary as aa, type ToolContext as ab, type ToolResultTransformContext as ac, type TransformContext as ad, type SkillsSettings as b, type ListAgentsOptions as c, type ListResult as d, type SDKAgentInfo as e, type ListRunsOptions as f, type GetRunOptions as g, type AgentOperationOptions as h, type AgentDescription as i, type ProviderProfile as j, type Skill$1 as k, type BudgetTracker as l, type MemoryProvider as m, type PreToolCallDecision as n, type ActiveMemoryPassArgs as o, type ActiveMemoryPassResult as p, type AgentSubagentDescription as q, type AgentToolDescription as r, type BudgetCheck as s, type BudgetTotal as t, type BudgetUsageEvent as u, type CloudEnv as v, type CloudRepo as w, type CompatSource as x, type CompatSourceAdapter as y, type CompatSurface as z };
1883
+ export { type RecordSessionSummaryArgs as $, type AgentOptions as A, type BuiltinToolName as B, type CloudOptions as C, type CreateSkillSpec as D, type HookApprovalRequest as E, type HookName as F, type GetAgentOptions as G, type HookApprovalGate as H, type InlineSkill as I, type LlmCallContext as J, type MemoryProviderAgentRef as K, type LocalOptions as L, type MemorySettings as M, type MemoryProviderFactory as N, type MemoryProviderHandle as O, type Plugin as P, type MemoryProviderInitOptions as Q, type PluginContext as R, type SystemPromptResolver as S, type PluginHookDisposer as T, type PostAssistantReplyContext as U, type PostToolCallContext as V, type PreToolCallContext as W, type PreUserSendContext as X, type PreUserSendResult as Y, type ProviderTransform as Z, type ProviderTransformContext as _, type AgentDefinition as a, type SessionLifecycleContext as a0, type SettingSource as a1, Skill as a2, type SkillsResolver as a3, type SkillsResolverContext as a4, type SystemPromptContext as a5, type SystemPromptMemoryFact as a6, type TelemetrySettings as a7, type ToolCallSummary as a8, type ToolContext as a9, type ToolResultTransformContext as aa, type TransformContext as ab, type SkillsSettings as b, type ListAgentsOptions as c, type ListResult as d, type SDKAgentInfo as e, type ListRunsOptions as f, type GetRunOptions as g, type AgentOperationOptions as h, type AgentDescription as i, type ProviderProfile as j, type Skill$1 as k, type BudgetTracker as l, type MemoryProvider as m, type PreToolCallDecision as n, type ActiveMemoryPassArgs as o, type ActiveMemoryPassResult as p, type AgentSubagentDescription as q, type AgentToolDescription as r, type BudgetCheck as s, type BudgetTotal as t, type BudgetUsageEvent as u, type CloudEnv as v, type CloudRepo as w, type CompatSource as x, type CompatSourceAdapter as y, type CompatSurface as z };
@@ -1,214 +1,7 @@
1
- import { W as MemoryFact, T as MemoryAdapter, V as MemoryContext, aV as SystemPromptSkillRef, M as McpServerConfig, C as ContextSettings, P as ProviderRoutingSettings, a as PluginsSettings, c as Processor, S as SDKAgent } from './sdk-agent-DwzHcuxy.cjs';
1
+ import { W as MemoryFact, T as MemoryAdapter, V as MemoryContext, aW as SystemPromptSkillRef, M as McpServerConfig, C as ContextSettings, P as ProviderRoutingSettings, a as PluginsSettings, c as Processor, S as SDKAgent } from './sdk-agent-BA_6_wtc.cjs';
2
+ import { a as SessionStore } from './session-store-Dh07jr9N.cjs';
2
3
  import { M as ModelSelection, C as CustomTool, P as PermissionMode } from './agent-prims-CZyxfCmS.cjs';
3
4
 
4
- /**
5
- * Owner: `src/` (1 of 2 importers). Derived from the import graph, not
6
- * declared — `tests/lint/types-name-their-owner.test.ts` re-derives it.
7
- *
8
- * `SessionRecord` — the native on-disk transcript record shape (SE40).
9
- *
10
- * The theokit session format IS the Claude Code record shape: a
11
- * `uuid`/`parentUuid` DAG of records with structured
12
- * `text`/`tool_use`/`tool_result`/`thinking` blocks. This is the contract the
13
- * pluggable {@link SessionStore} seam operates over.
14
- *
15
- * DIP-correct home (SE46): the contract lives in the domain `types/` layer;
16
- * the application-layer DAG core (`internal/persistence/session-transcript.ts`)
17
- * re-exports it for back-compat while owning the record builders + reader.
18
- *
19
- * @public
20
- */
21
- /** A content block inside {@link TranscriptMessage}. */
22
- type TranscriptBlock = {
23
- type: "text";
24
- text: string;
25
- } | {
26
- type: "thinking";
27
- thinking?: string;
28
- signature?: string;
29
- } | {
30
- type: "tool_use";
31
- id: string;
32
- name: string;
33
- input: unknown;
34
- } | {
35
- type: "tool_result";
36
- tool_use_id: string;
37
- content: unknown;
38
- is_error?: boolean;
39
- };
40
- /**
41
- * The message body of a {@link SessionRecord}.
42
- *
43
- * **It is NOT called `SessionMessage`** — that name already exists in
44
- * `internal/session/session-types.ts` with the shape `{role, text}`, incompatible with this one.
45
- * Reusing an exported name for a new shape is
46
- * precisely the silent break M91 cost two patches to undo.
47
- *
48
- * Parsing from disk stays **tolerant** (`readTranscript` skips a malformed line): what changes here
49
- * is the **type**, not leniency — records written by earlier versions stay readable.
50
- *
51
- * @public
52
- */
53
- interface TranscriptMessage {
54
- role: "user" | "assistant";
55
- content: TranscriptBlock[];
56
- /**
57
- * The three fields below appear **only** on the assistant record, and come from the writer
58
- * (`SessionTranscript.appendAssistant`). Declared optional because the user record does not carry
59
- * them — measured in the writer itself, not assumed.
60
- */
61
- id?: string;
62
- type?: "message";
63
- model?: string;
64
- }
65
- /**
66
- * One transcript record — a single line of the session JSONL file, and the unit the pluggable
67
- * `SessionStore` seam reads and writes.
68
- *
69
- * Records form a `uuid`/`parentUuid` DAG, not a flat list: `parentUuid` names the preceding record
70
- * and is `null` at the root. Thread a session by following those links; a reader that assumes file
71
- * order is linear will mis-thread one that branched.
72
- *
73
- * `message` is absent on `system` records — a compaction boundary carries `compactMetadata` instead —
74
- * so it is optional even on records you would expect to be conversational, and `type` is what tells
75
- * you which you are holding.
76
- *
77
- * Reading is deliberately tolerant: a malformed line is skipped rather than failing the whole read.
78
- * Every record you receive is well-formed, but the file may have contained more than you got back,
79
- * so this is not the type to use for an exact-count audit of what was written.
80
- *
81
- * @public
82
- */
83
- interface SessionRecord {
84
- type: "user" | "assistant" | "system";
85
- uuid: string;
86
- parentUuid: string | null;
87
- sessionId: string;
88
- timestamp: string;
89
- isSidechain?: boolean;
90
- userType?: string;
91
- cwd?: string;
92
- version?: string;
93
- subtype?: string;
94
- compactMetadata?: {
95
- preTokens: number;
96
- trigger: string;
97
- };
98
- /**
99
- * The message body, in the shape the transcript writer actually writes.
100
- *
101
- * M94 — it was `Record<string, unknown>`, and the consumer recovered the type with a cast on every read.
102
- * The shape **has always been fixed** (`SessionTranscript.appendToolResults` / `#push` produce
103
- * it); it simply was not declared. It stays optional because system records carry no message.
104
- */
105
- message?: TranscriptMessage;
106
- }
107
-
108
- /**
109
- * Owner: `internal/session/` (4 of 8 importers). Derived from the import graph, not declared —
110
- * `tests/lint/types-name-their-owner.test.ts` re-derives it.
111
- *
112
- * SE41 — the pluggable `SessionStore` seam over the NATIVE session transcript.
113
- *
114
- * A minimal, two-method port so an external store (Postgres / Redis / KV /
115
- * durable object) can be the **primary store AND resume source** — the
116
- * serverless (ephemeral FS) and multi-host / multi-pod use case that SE40
117
- * dropped when it removed the `ConversationStorageAdapter`. This is deliberately
118
- * NOT that removed ~10-method adapter: the seam is JUST record read/append over
119
- * the native {@link SessionRecord} shape (no getMessages / getSessionMeta /
120
- * delete / objective methods).
121
- *
122
- * The SDK ships a real default implementation, `FsSessionStore`, that reads and
123
- * append-writes the native Claude-shaped `.jsonl` transcript — omitting
124
- * `local.sessionStore` yields byte-identical current behavior (back-compat, zero
125
- * consumer change). Injected via `local.sessionStore` for external stores.
126
- *
127
- * THIS SEAM DOES NOT HIDE THE STORAGE, AND IS NOT MEANT TO. A Repository
128
- * abstracts a persistence model away; this one is defined in terms of the
129
- * native one — the port speaks {@link SessionRecord}, "the exact SessionRecord
130
- * the SDK writes", and the on-disk layout's path helpers (`encodeProjectDir`,
131
- * `transcriptPath`, `transcriptRoot`) are published on purpose at
132
- * `@theokit/sdk/persistence` so a consumer can locate a transcript file.
133
- *
134
- * That is the whole design and the reason the seam is two methods rather than
135
- * ten: the format is the contract, and a store implements read/append over it.
136
- * A consumer supplying `local.sessionStore` is NOT bound by those paths — they
137
- * describe where the DEFAULT `FsSessionStore` puts files, not where an external
138
- * store must.
139
- *
140
- * Consistency contract: `appendRecords` is append-only and ordering-preserving.
141
- * The FS default serializes appends per agent with a cross-process file lock;
142
- * external implementations own (and MUST document) their own concurrency
143
- * guarantees for two hosts appending to the same `agentId`.
144
- *
145
- * @public
146
- */
147
-
148
- /**
149
- * The pluggable session-store seam. Exactly two methods over the native
150
- * {@link SessionRecord} shape.
151
- *
152
- * @public
153
- */
154
- interface SessionStore {
155
- /**
156
- * Return every persisted record for `agentId`, in append order. A session
157
- * that was never written MUST resolve to `[]` (not throw) — a fresh agent has
158
- * no history. The SDK reconstructs the resumable `LlmMessage[]` from these
159
- * records via the native DAG reader, so the shape MUST be the exact
160
- * {@link SessionRecord} the SDK writes.
161
- *
162
- * A store that cannot READ (e.g. the backing DB is unreachable on resume)
163
- * MUST throw a typed error rather than silently returning `[]` — a silent
164
- * empty read would masquerade as "no history" and drop the conversation.
165
- */
166
- readRecords(agentId: string): Promise<SessionRecord[]>;
167
- /**
168
- * Append `records` (the new-turn delta) to `agentId`'s session, append-only.
169
- * MUST preserve order and MUST NOT drop or rewrite prior records — the native
170
- * format is an append-only `parentUuid` DAG (compaction is a new-root
171
- * `compact_boundary` record, still an append).
172
- *
173
- * Note on the write path: per-turn persistence is fire-and-forget so `send()`
174
- * is never blocked by store I/O — an `appendRecords` rejection is logged to
175
- * stderr, NOT thrown to the caller (best-effort write). An external store that
176
- * must guarantee durability should make `appendRecords` resilient (retry /
177
- * durable write) internally. This differs from {@link SessionStore.readRecords},
178
- * which MUST throw on failure (a resume cannot proceed on a silent partial history).
179
- */
180
- appendRecords(agentId: string, records: readonly SessionRecord[]): Promise<void>;
181
- /**
182
- * Claim the single-writer lease for `agentId`, if this store has one. OPTIONAL.
183
- *
184
- * The SDK calls it when an agent starts and skips it when absent, so a two-method store keeps
185
- * working unchanged — declaring it here does not require it, which is the whole reason it is
186
- * optional. What declaring it DOES is make the capability discoverable: the SDK probed for this
187
- * method through an `as unknown` cast against an interface that never mentioned it, so a
188
- * third-party store author — the serverless / multi-pod case this port exists to serve — read a
189
- * two-method interface, implemented two methods, and never learned the hook was there.
190
- *
191
- * CONTRACT, and the half that matters: a rejection whose `name` is `"SessionBusyError"` PROPAGATES
192
- * to the caller, because another process holding the session is a decision the caller has to make
193
- * (`exec` forks to a new id). Any other rejection is treated as "no lease available here" —
194
- * logged, and the turn proceeds without single-writer protection, since the write is best-effort
195
- * by contract anyway.
196
- */
197
- acquire?(agentId: string): Promise<void>;
198
- /**
199
- * Release the lease `acquire` claimed, if this store has one. OPTIONAL.
200
- *
201
- * Called on agent disposal. A rejection is not handled specially.
202
- */
203
- release?(agentId: string): Promise<void>;
204
- /**
205
- * Release store-level resources — a connection pool, a file handle. OPTIONAL.
206
- *
207
- * Called once, on agent disposal, after {@link SessionStore.release}.
208
- */
209
- dispose?(): Promise<void>;
210
- }
211
-
212
5
  /**
213
6
  * A discovered skill's metadata. The skill BODY is never included — only the
214
7
  * strict frontmatter fields plus the resolved `source` path.
@@ -299,8 +92,12 @@ interface BudgetUsageEvent {
299
92
  readonly tokens: number;
300
93
  /** Provider/model identifier (e.g., `"openai/gpt-4o-mini"`). */
301
94
  readonly model: string;
302
- /** Whether this is an input (prompt) or output (completion) measurement. */
303
- readonly type: "input" | "output";
95
+ /**
96
+ * Whether this is an input (uncached prompt), output (completion), `cache_read` (prompt tokens
97
+ * served from the provider's cache) or `cache_write` (prompt tokens written to it) measurement.
98
+ * A tracker that has no separate rate for the cache types should treat them as input.
99
+ */
100
+ readonly type: "input" | "output" | "cache_read" | "cache_write";
304
101
  /** Optional ISO 8601 timestamp; defaults to now() if omitted. */
305
102
  readonly at?: string;
306
103
  }
@@ -1362,7 +1159,8 @@ type SystemPromptResolver = (ctx: SystemPromptContext) => string | Promise<strin
1362
1159
  */
1363
1160
  interface SkillsSettings {
1364
1161
  /**
1365
- * Names of skills the parent agent may invoke. When omitted, every
1162
+ * Names of skills the local runtime loads: a skill not named here cannot be listed or read.
1163
+ * When omitted, every
1366
1164
  * discovered skill is enabled.
1367
1165
  */
1368
1166
  enabled?: string[];
@@ -1778,6 +1576,18 @@ interface AgentOptions {
1778
1576
  conversationId: string;
1779
1577
  userId?: string;
1780
1578
  }) => Promise<void> | void;
1579
+ /**
1580
+ * Start a fresh conversation when the agent has been idle this many minutes.
1581
+ *
1582
+ * Checked at the start of a local `send`: when more than this long has passed since the previous
1583
+ * `send` on the same agent began, the in-memory conversation is cleared first, so the model
1584
+ * receives no prior messages and `onBeforeSend` reports `previousMessageCount: 0`. Absent (the
1585
+ * default), or not a positive finite number, never resets. The first send of a process has no
1586
+ * previous send, so it never resets. The on-disk transcript is not deleted.
1587
+ *
1588
+ * @public
1589
+ */
1590
+ sessionIdleResetMinutes?: number;
1781
1591
  /**
1782
1592
  * Fires before each `agent.send`. `previousMessageCount` is the count of
1783
1593
  * messages already persisted BEFORE the current send adds the user
@@ -2070,4 +1880,4 @@ interface ListResult<T> {
2070
1880
  nextCursor?: string;
2071
1881
  }
2072
1882
 
2073
- export { type RecordSessionSummaryArgs as $, type AgentOptions as A, type BuiltinToolName as B, type CloudOptions as C, type CreateSkillSpec as D, type HookApprovalRequest as E, type HookName as F, type GetAgentOptions as G, type HookApprovalGate as H, type InlineSkill as I, type LlmCallContext as J, type MemoryProviderAgentRef as K, type LocalOptions as L, type MemorySettings as M, type MemoryProviderFactory as N, type MemoryProviderHandle as O, type Plugin as P, type MemoryProviderInitOptions as Q, type PluginContext as R, type SystemPromptResolver as S, type PluginHookDisposer as T, type PostAssistantReplyContext as U, type PostToolCallContext as V, type PreToolCallContext as W, type PreUserSendContext as X, type PreUserSendResult as Y, type ProviderTransform as Z, type ProviderTransformContext as _, type AgentDefinition as a, type SessionLifecycleContext as a0, type SessionRecord as a1, type SessionStore as a2, type SettingSource as a3, Skill as a4, type SkillsResolver as a5, type SkillsResolverContext as a6, type SystemPromptContext as a7, type SystemPromptMemoryFact as a8, type TelemetrySettings as a9, type ToolCallSummary as aa, type ToolContext as ab, type ToolResultTransformContext as ac, type TransformContext as ad, type SkillsSettings as b, type ListAgentsOptions as c, type ListResult as d, type SDKAgentInfo as e, type ListRunsOptions as f, type GetRunOptions as g, type AgentOperationOptions as h, type AgentDescription as i, type ProviderProfile as j, type Skill$1 as k, type BudgetTracker as l, type MemoryProvider as m, type PreToolCallDecision as n, type ActiveMemoryPassArgs as o, type ActiveMemoryPassResult as p, type AgentSubagentDescription as q, type AgentToolDescription as r, type BudgetCheck as s, type BudgetTotal as t, type BudgetUsageEvent as u, type CloudEnv as v, type CloudRepo as w, type CompatSource as x, type CompatSourceAdapter as y, type CompatSurface as z };
1883
+ export { type RecordSessionSummaryArgs as $, type AgentOptions as A, type BuiltinToolName as B, type CloudOptions as C, type CreateSkillSpec as D, type HookApprovalRequest as E, type HookName as F, type GetAgentOptions as G, type HookApprovalGate as H, type InlineSkill as I, type LlmCallContext as J, type MemoryProviderAgentRef as K, type LocalOptions as L, type MemorySettings as M, type MemoryProviderFactory as N, type MemoryProviderHandle as O, type Plugin as P, type MemoryProviderInitOptions as Q, type PluginContext as R, type SystemPromptResolver as S, type PluginHookDisposer as T, type PostAssistantReplyContext as U, type PostToolCallContext as V, type PreToolCallContext as W, type PreUserSendContext as X, type PreUserSendResult as Y, type ProviderTransform as Z, type ProviderTransformContext as _, type AgentDefinition as a, type SessionLifecycleContext as a0, type SettingSource as a1, Skill as a2, type SkillsResolver as a3, type SkillsResolverContext as a4, type SystemPromptContext as a5, type SystemPromptMemoryFact as a6, type TelemetrySettings as a7, type ToolCallSummary as a8, type ToolContext as a9, type ToolResultTransformContext as aa, type TransformContext as ab, type SkillsSettings as b, type ListAgentsOptions as c, type ListResult as d, type SDKAgentInfo as e, type ListRunsOptions as f, type GetRunOptions as g, type AgentOperationOptions as h, type AgentDescription as i, type ProviderProfile as j, type Skill$1 as k, type BudgetTracker as l, type MemoryProvider as m, type PreToolCallDecision as n, type ActiveMemoryPassArgs as o, type ActiveMemoryPassResult as p, type AgentSubagentDescription as q, type AgentToolDescription as r, type BudgetCheck as s, type BudgetTotal as t, type BudgetUsageEvent as u, type CloudEnv as v, type CloudRepo as w, type CompatSource as x, type CompatSourceAdapter as y, type CompatSurface as z };
@@ -1,25 +1,26 @@
1
- export { Agent } from './chunk-GARVAUCU.js';
1
+ export { Agent } from './chunk-5M5GQYBM.js';
2
2
  import './chunk-HWMGR3HA.js';
3
- import './chunk-3ONIVO2I.js';
3
+ import './chunk-23SS4ID4.js';
4
4
  import './chunk-K2BQQ445.js';
5
- import './chunk-2C24NSNV.js';
5
+ import './chunk-3BBTHFGJ.js';
6
6
  import './chunk-HJ2LV464.js';
7
7
  import './chunk-2SFBB54R.js';
8
- import './chunk-H7G65PNI.js';
8
+ import './chunk-VCQ37TC5.js';
9
9
  import './chunk-H73MEMQB.js';
10
10
  import './chunk-QK2ERTO3.js';
11
- import './chunk-DF77RBF4.js';
12
- import './chunk-AB4OPJLD.js';
13
- import './chunk-ZOL3L4EH.js';
14
- import './chunk-5AR6O7GW.js';
11
+ import './chunk-LCCT5ZXJ.js';
12
+ import './chunk-RGVMJU57.js';
13
+ import './chunk-IOBHFP2E.js';
14
+ import './chunk-NK5EOTDY.js';
15
15
  import './chunk-2XC6KDJM.js';
16
- import './chunk-ZJAYFSVI.js';
16
+ import './chunk-7ACS6P5Z.js';
17
17
  import './chunk-24MGQDK3.js';
18
18
  import './chunk-AGO5S5WD.js';
19
19
  import './chunk-HKCKOAIO.js';
20
20
  import './chunk-KCM3RMKR.js';
21
21
  import './chunk-XJ3WU5CZ.js';
22
22
  import './chunk-KVNWIAO4.js';
23
+ import './chunk-X7CE7Y5W.js';
23
24
  import './chunk-OLJOI4LK.js';
24
25
  import './chunk-FD2UT76F.js';
25
26
  import './chunk-7I5Z3UBJ.js';
@@ -39,18 +40,18 @@ import './chunk-XESYJ4JC.js';
39
40
  import './chunk-WE22OXQA.js';
40
41
  import './chunk-MLJDW2YK.js';
41
42
  import './chunk-KU5O7WPK.js';
42
- import './chunk-354F3OF5.js';
43
- import './chunk-Q5EWJPRY.js';
43
+ import './chunk-FGGVSHDW.js';
44
+ import './chunk-PPU2D4FZ.js';
44
45
  import './chunk-MLGETTYX.js';
45
46
  import './chunk-M4U24U6G.js';
46
- import './chunk-RN3XDZGS.js';
47
+ import './chunk-WM646HEN.js';
47
48
  import './chunk-YMVTUV5K.js';
48
49
  import './chunk-Q7UG242V.js';
49
50
  import './chunk-SZQFCHU6.js';
50
- import './chunk-NVQSBRG6.js';
51
+ import './chunk-CBBT42VX.js';
51
52
  import './chunk-R7WIIPUR.js';
52
- import './chunk-ULEK4OM4.js';
53
- import './chunk-CJN5CEI3.js';
53
+ import './chunk-YKNBTHMD.js';
54
+ import './chunk-RZL2W4C3.js';
54
55
  import './chunk-AGACYRJ2.js';
55
56
  import './chunk-3GTN4HOO.js';
56
57
  import './chunk-QD6B6W6I.js';
@@ -58,5 +59,5 @@ import './chunk-5IUDICRK.js';
58
59
  import './chunk-Q7GYMXVC.js';
59
60
  import './chunk-TNFOU6SB.js';
60
61
  import './chunk-3OY6H3I7.js';
61
- //# sourceMappingURL=agent-T34LCGQM.js.map
62
- //# sourceMappingURL=agent-T34LCGQM.js.map
62
+ //# sourceMappingURL=agent-DRDGUU6T.js.map
63
+ //# sourceMappingURL=agent-DRDGUU6T.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"agent-T34LCGQM.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"agent-DRDGUU6T.js"}