@theokit/sdk 5.13.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 (241) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/dist/{agent-DSMuwADp.d.ts → agent-B6C9i_qu.d.ts} +31 -213
  3. package/dist/{agent-iW5kPpfT.d.cts → agent-B6FQad6P.d.cts} +31 -213
  4. package/dist/{agent-5DSDDH7K.js → agent-DRDGUU6T.js} +21 -20
  5. package/dist/{agent-5DSDDH7K.js.map → agent-DRDGUU6T.js.map} +1 -1
  6. package/dist/{agent-WOMRT3KX.cjs → agent-VI2HITPT.cjs} +22 -21
  7. package/dist/{agent-WOMRT3KX.cjs.map → agent-VI2HITPT.cjs.map} +1 -1
  8. package/dist/agent.d.ts +2 -3
  9. package/dist/auth/index.cjs +17 -16
  10. package/dist/auth/index.cjs.map +1 -1
  11. package/dist/auth/index.js +5 -4
  12. package/dist/auth/index.js.map +1 -1
  13. package/dist/{batch-EP3FCL6D.js → batch-N2XDYZED.js} +4 -4
  14. package/dist/{batch-EP3FCL6D.js.map → batch-N2XDYZED.js.map} +1 -1
  15. package/dist/{batch-IZ5EDKJ5.cjs → batch-VFR2MAUE.cjs} +7 -7
  16. package/dist/{batch-IZ5EDKJ5.cjs.map → batch-VFR2MAUE.cjs.map} +1 -1
  17. package/dist/{chunk-XOYNB3YN.js → chunk-23SS4ID4.js} +3 -3
  18. package/dist/{chunk-XOYNB3YN.js.map → chunk-23SS4ID4.js.map} +1 -1
  19. package/dist/{chunk-NHOEXFZT.js → chunk-2HXTNVLM.js} +5 -2
  20. package/dist/chunk-2HXTNVLM.js.map +1 -0
  21. package/dist/{chunk-2C24NSNV.js → chunk-3BBTHFGJ.js} +3 -3
  22. package/dist/{chunk-2C24NSNV.js.map → chunk-3BBTHFGJ.js.map} +1 -1
  23. package/dist/{chunk-NP362THY.cjs → chunk-3F53FLQ7.cjs} +5 -7
  24. package/dist/chunk-3F53FLQ7.cjs.map +1 -0
  25. package/dist/{chunk-3FSBE4PS.js → chunk-3GTN4HOO.js} +10 -6
  26. package/dist/chunk-3GTN4HOO.js.map +1 -0
  27. package/dist/{chunk-7WARNHWW.cjs → chunk-3UMPP553.cjs} +5 -2
  28. package/dist/chunk-3UMPP553.cjs.map +1 -0
  29. package/dist/{chunk-SXH37C7X.cjs → chunk-55LLQFHW.cjs} +6 -6
  30. package/dist/{chunk-SXH37C7X.cjs.map → chunk-55LLQFHW.cjs.map} +1 -1
  31. package/dist/{chunk-QISSETTG.cjs → chunk-5645PMVU.cjs} +6 -4
  32. package/dist/chunk-5645PMVU.cjs.map +1 -0
  33. package/dist/{chunk-JX4LB6XO.js → chunk-5M5GQYBM.js} +617 -250
  34. package/dist/chunk-5M5GQYBM.js.map +1 -0
  35. package/dist/{chunk-KL7ZUMK3.cjs → chunk-64ECM3XM.cjs} +704 -337
  36. package/dist/chunk-64ECM3XM.cjs.map +1 -0
  37. package/dist/{chunk-ZJAYFSVI.js → chunk-7ACS6P5Z.js} +5 -7
  38. package/dist/chunk-7ACS6P5Z.js.map +1 -0
  39. package/dist/{chunk-5A4UFBHW.cjs → chunk-A77UMVMD.cjs} +15 -11
  40. package/dist/chunk-A77UMVMD.cjs.map +1 -0
  41. package/dist/{chunk-ZTP6ZACR.js → chunk-ARC2V7NY.js} +3 -3
  42. package/dist/{chunk-ZTP6ZACR.js.map → chunk-ARC2V7NY.js.map} +1 -1
  43. package/dist/{chunk-WDVG5R2Q.cjs → chunk-AUH2EVWY.cjs} +4 -3
  44. package/dist/chunk-AUH2EVWY.cjs.map +1 -0
  45. package/dist/chunk-BNEUB52I.cjs +55 -0
  46. package/dist/chunk-BNEUB52I.cjs.map +1 -0
  47. package/dist/chunk-BPL5CVZ5.js +53 -0
  48. package/dist/chunk-BPL5CVZ5.js.map +1 -0
  49. package/dist/{chunk-2SFLLOMN.js → chunk-CBBT42VX.js} +3 -3
  50. package/dist/{chunk-2SFLLOMN.js.map → chunk-CBBT42VX.js.map} +1 -1
  51. package/dist/chunk-CHKV2L2Y.cjs +416 -0
  52. package/dist/chunk-CHKV2L2Y.cjs.map +1 -0
  53. package/dist/{chunk-4UYHP6NF.cjs → chunk-DJKGDLYZ.cjs} +93 -63
  54. package/dist/chunk-DJKGDLYZ.cjs.map +1 -0
  55. package/dist/{chunk-354F3OF5.js → chunk-FGGVSHDW.js} +3 -3
  56. package/dist/{chunk-354F3OF5.js.map → chunk-FGGVSHDW.js.map} +1 -1
  57. package/dist/{chunk-6OCJWGVD.cjs → chunk-FTXY4D44.cjs} +4 -4
  58. package/dist/{chunk-6OCJWGVD.cjs.map → chunk-FTXY4D44.cjs.map} +1 -1
  59. package/dist/chunk-INVEGVGO.js +405 -0
  60. package/dist/chunk-INVEGVGO.js.map +1 -0
  61. package/dist/{chunk-2PRGRYEQ.js → chunk-IOBHFP2E.js} +50 -20
  62. package/dist/chunk-IOBHFP2E.js.map +1 -0
  63. package/dist/{chunk-47EACDOC.cjs → chunk-KMFBNKCT.cjs} +4 -4
  64. package/dist/{chunk-47EACDOC.cjs.map → chunk-KMFBNKCT.cjs.map} +1 -1
  65. package/dist/{chunk-DF77RBF4.js → chunk-LCCT5ZXJ.js} +6 -6
  66. package/dist/{chunk-DF77RBF4.js.map → chunk-LCCT5ZXJ.js.map} +1 -1
  67. package/dist/{chunk-G7XBVM3T.cjs → chunk-MHUOVS5I.cjs} +5 -5
  68. package/dist/{chunk-G7XBVM3T.cjs.map → chunk-MHUOVS5I.cjs.map} +1 -1
  69. package/dist/{chunk-CWQPQTUZ.cjs → chunk-NEH3BPFD.cjs} +15 -15
  70. package/dist/{chunk-CWQPQTUZ.cjs.map → chunk-NEH3BPFD.cjs.map} +1 -1
  71. package/dist/{chunk-5AR6O7GW.js → chunk-NK5EOTDY.js} +3 -3
  72. package/dist/{chunk-5AR6O7GW.js.map → chunk-NK5EOTDY.js.map} +1 -1
  73. package/dist/{chunk-S46WJTDL.cjs → chunk-P7QYG4RZ.cjs} +27 -19
  74. package/dist/chunk-P7QYG4RZ.cjs.map +1 -0
  75. package/dist/chunk-PPU2D4FZ.js +19 -0
  76. package/dist/chunk-PPU2D4FZ.js.map +1 -0
  77. package/dist/{chunk-MS3TQSXU.js → chunk-QD6B6W6I.js} +6 -4
  78. package/dist/chunk-QD6B6W6I.js.map +1 -0
  79. package/dist/{chunk-AB4OPJLD.js → chunk-RGVMJU57.js} +3 -3
  80. package/dist/{chunk-AB4OPJLD.js.map → chunk-RGVMJU57.js.map} +1 -1
  81. package/dist/{chunk-NWWTYBD3.cjs → chunk-RTDVSHJR.cjs} +5 -5
  82. package/dist/{chunk-NWWTYBD3.cjs.map → chunk-RTDVSHJR.cjs.map} +1 -1
  83. package/dist/{chunk-5HSMH2ZZ.js → chunk-RZL2W4C3.js} +25 -17
  84. package/dist/chunk-RZL2W4C3.js.map +1 -0
  85. package/dist/chunk-SPEN7RJU.cjs +18 -0
  86. package/dist/{chunk-LO6LIUZ6.cjs.map → chunk-SPEN7RJU.cjs.map} +1 -1
  87. package/dist/{chunk-ZF2LDKQQ.cjs → chunk-U3DW3WDE.cjs} +9 -8
  88. package/dist/chunk-U3DW3WDE.cjs.map +1 -0
  89. package/dist/{chunk-DVP3YMDA.cjs → chunk-U7PRI3XM.cjs} +3 -3
  90. package/dist/{chunk-DVP3YMDA.cjs.map → chunk-U7PRI3XM.cjs.map} +1 -1
  91. package/dist/{chunk-H7G65PNI.js → chunk-VCQ37TC5.js} +3 -3
  92. package/dist/{chunk-H7G65PNI.js.map → chunk-VCQ37TC5.js.map} +1 -1
  93. package/dist/{chunk-SDZ4XDWS.cjs → chunk-VWYFGE27.cjs} +9 -9
  94. package/dist/{chunk-SDZ4XDWS.cjs.map → chunk-VWYFGE27.cjs.map} +1 -1
  95. package/dist/{chunk-RN3XDZGS.js → chunk-WM646HEN.js} +4 -3
  96. package/dist/chunk-WM646HEN.js.map +1 -0
  97. package/dist/chunk-X7CE7Y5W.js +305 -0
  98. package/dist/chunk-X7CE7Y5W.js.map +1 -0
  99. package/dist/{chunk-CGH4BCIY.cjs → chunk-XE3CAY6Z.cjs} +5 -5
  100. package/dist/{chunk-CGH4BCIY.cjs.map → chunk-XE3CAY6Z.cjs.map} +1 -1
  101. package/dist/chunk-XOU3CL7S.cjs +312 -0
  102. package/dist/chunk-XOU3CL7S.cjs.map +1 -0
  103. package/dist/{chunk-NKQVLWDF.js → chunk-YKNBTHMD.js} +3 -3
  104. package/dist/{chunk-NKQVLWDF.js.map → chunk-YKNBTHMD.js.map} +1 -1
  105. package/dist/{compact-session-B7P6EU3Z.cjs → compact-session-NX7HUNTB.cjs} +18 -18
  106. package/dist/{compact-session-B7P6EU3Z.cjs.map → compact-session-NX7HUNTB.cjs.map} +1 -1
  107. package/dist/{compact-session-5HMX6KYT.js → compact-session-Q5IGNFPW.js} +9 -9
  108. package/dist/{compact-session-5HMX6KYT.js.map → compact-session-Q5IGNFPW.js.map} +1 -1
  109. package/dist/{cron-BvxrLW5J.d.cts → cron-Bh3aWgQ2.d.cts} +2 -2
  110. package/dist/{cron-DdKzwJqK.d.ts → cron-CCDxeeFZ.d.ts} +2 -2
  111. package/dist/cron.cjs +21 -20
  112. package/dist/cron.d.cts +4 -3
  113. package/dist/cron.d.ts +4 -3
  114. package/dist/cron.js +20 -19
  115. package/dist/eval.cjs +20 -19
  116. package/dist/eval.cjs.map +1 -1
  117. package/dist/eval.js +19 -18
  118. package/dist/eval.js.map +1 -1
  119. package/dist/fs-session-store-CYNTEPJZ.cjs +20 -0
  120. package/dist/{fs-session-store-S2AXVJIX.cjs.map → fs-session-store-CYNTEPJZ.cjs.map} +1 -1
  121. package/dist/fs-session-store-MYQEVUFL.js +11 -0
  122. package/dist/{fs-session-store-6ZCCJX3K.js.map → fs-session-store-MYQEVUFL.js.map} +1 -1
  123. package/dist/{index-manager-HO456AVW.cjs → index-manager-2KH75BRW.cjs} +7 -7
  124. package/dist/{index-manager-HO456AVW.cjs.map → index-manager-2KH75BRW.cjs.map} +1 -1
  125. package/dist/{index-manager-QDH56FER.js → index-manager-NF2WRLOU.js} +6 -6
  126. package/dist/{index-manager-QDH56FER.js.map → index-manager-NF2WRLOU.js.map} +1 -1
  127. package/dist/index.cjs +93 -273
  128. package/dist/index.cjs.map +1 -1
  129. package/dist/index.d.cts +13 -46
  130. package/dist/index.d.ts +13 -46
  131. package/dist/index.js +52 -236
  132. package/dist/index.js.map +1 -1
  133. package/dist/{inject-session-75L3NCNL.js → inject-session-4ROYLZHY.js} +3 -3
  134. package/dist/{inject-session-75L3NCNL.js.map → inject-session-4ROYLZHY.js.map} +1 -1
  135. package/dist/{inject-session-WOH7TPDX.cjs → inject-session-AWKDCGHV.cjs} +4 -4
  136. package/dist/{inject-session-WOH7TPDX.cjs.map → inject-session-AWKDCGHV.cjs.map} +1 -1
  137. package/dist/internal/agent-loop/doom-loop-tracker.d.ts +3 -0
  138. package/dist/internal/agent-loop/prune-tool-results.d.ts +37 -0
  139. package/dist/internal/agent-loop/types.d.ts +6 -0
  140. package/dist/internal/auth/credential-store.d.ts +1 -1
  141. package/dist/internal/auth/types.d.ts +4 -0
  142. package/dist/internal/error-mappers/anthropic.d.ts +3 -0
  143. package/dist/internal/error-mappers/openai-compatible.d.ts +2 -3
  144. package/dist/internal/local-agent/local-agent-dispatch.d.ts +3 -1
  145. package/dist/internal/local-agent/send-queue.d.ts +31 -0
  146. package/dist/internal/mcp/client.d.ts +2 -0
  147. package/dist/internal/mcp/oauth-bearer.d.ts +2 -0
  148. package/dist/internal/memory/adapters/index.cjs +3 -3
  149. package/dist/internal/memory/adapters/index.js +2 -2
  150. package/dist/internal/memory/dreaming/phases.d.ts +15 -0
  151. package/dist/internal/memory/dreaming/run.d.ts +29 -0
  152. package/dist/internal/memory/sdk-memory-peer-loader.d.ts +2 -0
  153. package/dist/internal/memory/storage/index.cjs +51 -35
  154. package/dist/internal/memory/storage/index.d.cts +2 -0
  155. package/dist/internal/memory/storage/index.d.ts +2 -0
  156. package/dist/internal/memory/storage/index.js +4 -4
  157. package/dist/internal/persistence/cwd-mutex.d.cts +4 -2
  158. package/dist/internal/persistence/cwd-mutex.d.ts +4 -2
  159. package/dist/internal/persistence/index.cjs +4 -4
  160. package/dist/internal/persistence/index.js +2 -2
  161. package/dist/internal/persistence/sqlite-session-store.d.cts +25 -0
  162. package/dist/internal/persistence/sqlite-session-store.d.ts +25 -0
  163. package/dist/internal/providers/registry.d.ts +5 -1
  164. package/dist/internal/runtime/skills/binary-on-path.d.ts +1 -0
  165. package/dist/internal/runtime/skills/discover-skills.d.ts +2 -0
  166. package/dist/mcp-auth.cjs +25 -307
  167. package/dist/mcp-auth.cjs.map +1 -1
  168. package/dist/mcp-auth.js +5 -305
  169. package/dist/mcp-auth.js.map +1 -1
  170. package/dist/models.cjs +11 -11
  171. package/dist/models.js +4 -4
  172. package/dist/persistence.cjs +9 -4
  173. package/dist/persistence.cjs.map +1 -1
  174. package/dist/persistence.d.cts +744 -40
  175. package/dist/persistence.d.ts +744 -40
  176. package/dist/persistence.js +3 -2
  177. package/dist/persistence.js.map +1 -1
  178. package/dist/providers.cjs +6 -6
  179. package/dist/providers.js +4 -4
  180. package/dist/sandbox/docker-sandbox.d.cts +58 -0
  181. package/dist/sandbox/docker-sandbox.d.ts +58 -0
  182. package/dist/sandbox/index.cjs +129 -1
  183. package/dist/sandbox/index.cjs.map +1 -1
  184. package/dist/sandbox/index.d.cts +1 -0
  185. package/dist/sandbox/index.d.ts +1 -0
  186. package/dist/sandbox/index.js +132 -5
  187. package/dist/sandbox/index.js.map +1 -1
  188. package/dist/{sdk-agent-4-dXI2GS.d.cts → sdk-agent-BA_6_wtc.d.cts} +57 -4
  189. package/dist/{sdk-agent-CTOJlWA_.d.ts → sdk-agent-CnwPODYH.d.ts} +57 -4
  190. package/dist/session-store-Dh07jr9N.d.cts +209 -0
  191. package/dist/session-store-Dh07jr9N.d.ts +209 -0
  192. package/dist/skills.cjs +4 -4
  193. package/dist/skills.js +1 -1
  194. package/dist/sqlite-session-store-BbcpKY1L.d.ts +64 -0
  195. package/dist/sqlite-session-store-TKXtT4ON.d.cts +64 -0
  196. package/dist/subagents-loader-KLWF4QPD.cjs +16 -0
  197. package/dist/{subagents-loader-TXOA5EJJ.cjs.map → subagents-loader-KLWF4QPD.cjs.map} +1 -1
  198. package/dist/subagents-loader-SXETS2F2.js +7 -0
  199. package/dist/{subagents-loader-Z744TAKD.js.map → subagents-loader-SXETS2F2.js.map} +1 -1
  200. package/dist/subagents-loader.cjs +2 -2
  201. package/dist/subagents-loader.d.cts +3 -2
  202. package/dist/subagents-loader.d.ts +3 -2
  203. package/dist/subagents-loader.js +1 -1
  204. package/dist/types/agent.d.ts +20 -1
  205. package/dist/types/budget-tracker.d.ts +6 -2
  206. package/dist/types/mcp.d.ts +14 -0
  207. package/dist/types/run.d.ts +42 -3
  208. package/dist/workflow.d.cts +1 -1
  209. package/dist/workflow.d.ts +1 -1
  210. package/docs/adr/mutation-testing-scope.md +66 -0
  211. package/docs/error-codes.md +48 -45
  212. package/docs/harness-capability-map.md +60 -6
  213. package/package.json +1 -1
  214. package/dist/chunk-2PRGRYEQ.js.map +0 -1
  215. package/dist/chunk-3FSBE4PS.js.map +0 -1
  216. package/dist/chunk-4UYHP6NF.cjs.map +0 -1
  217. package/dist/chunk-5A4UFBHW.cjs.map +0 -1
  218. package/dist/chunk-5HSMH2ZZ.js.map +0 -1
  219. package/dist/chunk-6CXRYPG7.cjs +0 -211
  220. package/dist/chunk-6CXRYPG7.cjs.map +0 -1
  221. package/dist/chunk-7WARNHWW.cjs.map +0 -1
  222. package/dist/chunk-JX4LB6XO.js.map +0 -1
  223. package/dist/chunk-KL7ZUMK3.cjs.map +0 -1
  224. package/dist/chunk-LO6LIUZ6.cjs +0 -18
  225. package/dist/chunk-MS3TQSXU.js.map +0 -1
  226. package/dist/chunk-MSEL5E5P.js +0 -204
  227. package/dist/chunk-MSEL5E5P.js.map +0 -1
  228. package/dist/chunk-NHOEXFZT.js.map +0 -1
  229. package/dist/chunk-NP362THY.cjs.map +0 -1
  230. package/dist/chunk-Q5EWJPRY.js +0 -18
  231. package/dist/chunk-Q5EWJPRY.js.map +0 -1
  232. package/dist/chunk-QISSETTG.cjs.map +0 -1
  233. package/dist/chunk-RN3XDZGS.js.map +0 -1
  234. package/dist/chunk-S46WJTDL.cjs.map +0 -1
  235. package/dist/chunk-WDVG5R2Q.cjs.map +0 -1
  236. package/dist/chunk-ZF2LDKQQ.cjs.map +0 -1
  237. package/dist/chunk-ZJAYFSVI.js.map +0 -1
  238. package/dist/fs-session-store-6ZCCJX3K.js +0 -11
  239. package/dist/fs-session-store-S2AXVJIX.cjs +0 -20
  240. package/dist/subagents-loader-TXOA5EJJ.cjs +0 -16
  241. package/dist/subagents-loader-Z744TAKD.js +0 -7
package/dist/index.js CHANGED
@@ -1,39 +1,41 @@
1
1
  export { StreamObjectError } from './chunk-CYWOJA6B.js';
2
2
  export { GOAL_CONTINUATION_MARKER } from './chunk-PY2RQOA7.js';
3
3
  export { JudgeCredentialError } from './chunk-XZKIAENA.js';
4
- import { migrateSqliteToLance, appendDiaryEntry } from './chunk-MSEL5E5P.js';
4
+ import { runDreamingSweep, migrateSqliteToLance } from './chunk-INVEGVGO.js';
5
5
  export { GenerateObjectError } from './chunk-3LMVJTNJ.js';
6
6
  import './chunk-DFBWYETS.js';
7
7
  import { Workflow, agentStep } from './chunk-73IITAF7.js';
8
8
  export { Workflow, agentStep, fn } from './chunk-73IITAF7.js';
9
9
  import './chunk-TDED5XES.js';
10
+ export { SqliteSessionStore } from './chunk-BPL5CVZ5.js';
10
11
  import './chunk-HY66GLM6.js';
11
- export { Cron } from './chunk-ZTP6ZACR.js';
12
- import { MEMORY_EMBEDDING_ADAPTERS, resolveSessionDir, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-JX4LB6XO.js';
13
- export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry, managedSettingsPathFor, readManagedSettings } from './chunk-JX4LB6XO.js';
12
+ export { Cron } from './chunk-ARC2V7NY.js';
13
+ import { MEMORY_EMBEDDING_ADAPTERS, resolveSessionDir, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-5M5GQYBM.js';
14
+ export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry, managedSettingsPathFor, readManagedSettings } from './chunk-5M5GQYBM.js';
14
15
  import { configure, submit, list, get, cancel, subscribe } from './chunk-HWMGR3HA.js';
15
16
  export { emitRunEvent } from './chunk-HWMGR3HA.js';
16
- import './chunk-XOYNB3YN.js';
17
+ import './chunk-23SS4ID4.js';
17
18
  import './chunk-K2BQQ445.js';
18
- import './chunk-2C24NSNV.js';
19
+ import './chunk-3BBTHFGJ.js';
19
20
  import './chunk-HJ2LV464.js';
20
21
  import './chunk-2SFBB54R.js';
21
- import './chunk-H7G65PNI.js';
22
+ import './chunk-VCQ37TC5.js';
22
23
  import './chunk-H73MEMQB.js';
23
24
  import './chunk-QK2ERTO3.js';
24
- import { resolveMemoryRoot, readFactsFromMarkdown } from './chunk-DF77RBF4.js';
25
- import { FsSessionStore } from './chunk-AB4OPJLD.js';
26
- import { discoverProviderPlugins, shouldUseFixtureMode, isFixtureApiKey, httpRequest, mapOllamaTransportError, readErrorResponseBody, mapOllamaHttpError } from './chunk-2PRGRYEQ.js';
27
- export { inferApiMode, normalizeUsage } from './chunk-2PRGRYEQ.js';
28
- import './chunk-5AR6O7GW.js';
25
+ import { resolveMemoryRoot } from './chunk-LCCT5ZXJ.js';
26
+ import { FsSessionStore } from './chunk-RGVMJU57.js';
27
+ import { discoverProviderPlugins, shouldUseFixtureMode, isFixtureApiKey, httpRequest, mapOllamaTransportError, readErrorResponseBody, mapOllamaHttpError } from './chunk-IOBHFP2E.js';
28
+ export { inferApiMode, normalizeUsage } from './chunk-IOBHFP2E.js';
29
+ import './chunk-NK5EOTDY.js';
29
30
  import './chunk-2XC6KDJM.js';
30
- import './chunk-ZJAYFSVI.js';
31
+ import './chunk-7ACS6P5Z.js';
31
32
  import './chunk-24MGQDK3.js';
32
33
  import { readSessionMessages } from './chunk-AGO5S5WD.js';
33
34
  import './chunk-HKCKOAIO.js';
34
35
  import './chunk-KCM3RMKR.js';
35
36
  import './chunk-XJ3WU5CZ.js';
36
37
  import './chunk-KVNWIAO4.js';
38
+ import './chunk-X7CE7Y5W.js';
37
39
  import './chunk-OLJOI4LK.js';
38
40
  import './chunk-FD2UT76F.js';
39
41
  import { toJsonSchema } from './chunk-7I5Z3UBJ.js';
@@ -41,7 +43,7 @@ import './chunk-FJWQP6EE.js';
41
43
  import './chunk-NAF4L3T6.js';
42
44
  import './chunk-VZGE7NAI.js';
43
45
  import './chunk-6X6ID4MO.js';
44
- import { stripSkillFrontmatter } from './chunk-NHOEXFZT.js';
46
+ import { stripSkillFrontmatter } from './chunk-2HXTNVLM.js';
45
47
  import './chunk-4QCJAJAG.js';
46
48
  import './chunk-SAGRF4IB.js';
47
49
  import './chunk-PKRPV3R7.js';
@@ -53,23 +55,23 @@ import './chunk-XESYJ4JC.js';
53
55
  import './chunk-WE22OXQA.js';
54
56
  import './chunk-MLJDW2YK.js';
55
57
  import './chunk-KU5O7WPK.js';
56
- import './chunk-354F3OF5.js';
57
- import { withCwdMutex } from './chunk-Q5EWJPRY.js';
58
- export { withCwdMutex } from './chunk-Q5EWJPRY.js';
58
+ import './chunk-FGGVSHDW.js';
59
+ import { withCwdMutex } from './chunk-PPU2D4FZ.js';
60
+ export { withCwdMutex } from './chunk-PPU2D4FZ.js';
59
61
  export { TASK_RESERVED_PREFIXES, isValidTaskId } from './chunk-MLGETTYX.js';
60
- import { replaceFileAtomic } from './chunk-M4U24U6G.js';
61
- import './chunk-RN3XDZGS.js';
62
+ import './chunk-M4U24U6G.js';
63
+ import './chunk-WM646HEN.js';
62
64
  import { CLAUDE_DIR_NAME, THEOKIT_DIR_LITERAL } from './chunk-YMVTUV5K.js';
63
65
  import './chunk-Q7UG242V.js';
64
66
  import { estimateTokens, CHARS_PER_TOKEN } from './chunk-SZQFCHU6.js';
65
67
  export { estimateTokens } from './chunk-SZQFCHU6.js';
66
- import './chunk-2SFLLOMN.js';
68
+ import './chunk-CBBT42VX.js';
67
69
  import { parseModelId } from './chunk-R7WIIPUR.js';
68
- import './chunk-NKQVLWDF.js';
69
- import { registerBuiltins, listProviders, getCatalogCapabilities, getProviderProfile } from './chunk-5HSMH2ZZ.js';
70
+ import './chunk-YKNBTHMD.js';
71
+ import { registerBuiltins, listProviders, getCatalogCapabilities, getProviderProfile } from './chunk-RZL2W4C3.js';
70
72
  import './chunk-AGACYRJ2.js';
71
- import './chunk-3FSBE4PS.js';
72
- import './chunk-MS3TQSXU.js';
73
+ import './chunk-3GTN4HOO.js';
74
+ import './chunk-QD6B6W6I.js';
73
75
  import './chunk-5IUDICRK.js';
74
76
  import './chunk-Q7GYMXVC.js';
75
77
  import { BudgetExceededError, ConfigurationError, TheokitAgentError, MemoryAdapterError, AuthenticationError } from './chunk-TNFOU6SB.js';
@@ -77,7 +79,7 @@ export { AgentDisposedError, AgentRunError, AuthenticationError, BudgetExceededE
77
79
  import { diag, redactSecrets, addPattern, resolveApiKey } from './chunk-3OY6H3I7.js';
78
80
  export { setDiagnosticsSink } from './chunk-3OY6H3I7.js';
79
81
  import { createHash, randomUUID } from 'crypto';
80
- import { readFile, mkdir, readdir } from 'fs/promises';
82
+ import { readFile, readdir } from 'fs/promises';
81
83
  import { resolve, normalize, sep, isAbsolute, parse, relative, dirname, join } from 'path';
82
84
  import { z } from 'zod';
83
85
  import { homedir } from 'os';
@@ -630,6 +632,14 @@ async function readReferences(skillDir) {
630
632
  }
631
633
  return Object.keys(refs).length > 0 ? refs : void 0;
632
634
  }
635
+ function readNamed(skills, name) {
636
+ const skill = skills.find((s) => s.name === name);
637
+ if (skill === void 0) {
638
+ const available = skills.map((s) => s.name).join(", ");
639
+ return `Skill "${name}" not found. Available skills: ${available.length > 0 ? available : "(none)"}.`;
640
+ }
641
+ return renderSkill(skill);
642
+ }
633
643
  var SkillReadInputSchema = z.object({
634
644
  name: z.string().min(1, "skill_read: `name` is required.")
635
645
  });
@@ -645,7 +655,9 @@ async function renderSkill(skill) {
645
655
  }
646
656
  return parts.join("\n");
647
657
  }
648
- function defineSkillReadTool(skills) {
658
+ function defineSkillReadTool(source) {
659
+ if (typeof source === "function") return lazySkillReadTool(source);
660
+ const skills = source;
649
661
  const seen = /* @__PURE__ */ new Set();
650
662
  for (const skill of skills) {
651
663
  if (seen.has(skill.name)) {
@@ -666,12 +678,18 @@ function defineSkillReadTool(skills) {
666
678
  // promise: parse and the not-found answer stay exactly as synchronous as they were.
667
679
  handler: (input) => {
668
680
  const { name } = SkillReadInputSchema.parse(input);
669
- const skill = skills.find((s) => s.name === name);
670
- if (skill === void 0) {
671
- const available = skills.map((s) => s.name).join(", ");
672
- return `Skill "${name}" not found. Available skills: ${available.length > 0 ? available : "(none)"}.`;
673
- }
674
- return renderSkill(skill);
681
+ return readNamed(skills, name);
682
+ }
683
+ };
684
+ }
685
+ function lazySkillReadTool(source) {
686
+ const fixed = defineSkillReadTool([]);
687
+ return {
688
+ ...fixed,
689
+ handler: async (input) => {
690
+ const { name } = SkillReadInputSchema.parse(input);
691
+ const skills = await source();
692
+ return readNamed(skills, name);
675
693
  }
676
694
  };
677
695
  }
@@ -1031,208 +1049,6 @@ function foldLayers(entries, accumulatingKeys = []) {
1031
1049
  return combined;
1032
1050
  }
1033
1051
 
1034
- // src/internal/memory/dreaming/phases.ts
1035
- var DEFAULT_DEDUP_THRESHOLD = 0.95;
1036
- var DEFAULT_CLUSTER_THRESHOLD = 0.75;
1037
- var CONSOLIDATABLE_KINDS = /* @__PURE__ */ new Set(["project"]);
1038
- var ATOMIC_KINDS = /* @__PURE__ */ new Set(["user", "feedback", "reference"]);
1039
- function dedupPolicy(fact) {
1040
- if (fact.kind === void 0) return "exact";
1041
- if (ATOMIC_KINDS.has(fact.kind)) return "never";
1042
- return CONSOLIDATABLE_KINDS.has(fact.kind) ? "similar" : "never";
1043
- }
1044
- function normalizeForExactMatch(text) {
1045
- return text.trim().toLowerCase().replace(/\s+/g, " ").replace(/[.!?]+$/, "");
1046
- }
1047
- async function lightPhase(facts, embedding, threshold = DEFAULT_DEDUP_THRESHOLD) {
1048
- if (facts.length <= 1) return { kept: [...facts], duplicatesRemoved: 0 };
1049
- const never = facts.filter((f) => dedupPolicy(f) === "never");
1050
- const exact = facts.filter((f) => dedupPolicy(f) === "exact");
1051
- const similar = facts.filter((f) => dedupPolicy(f) === "similar");
1052
- const seen = /* @__PURE__ */ new Set();
1053
- const exactKept = [];
1054
- let removed = 0;
1055
- for (const f of exact) {
1056
- const key = normalizeForExactMatch(f.text);
1057
- if (seen.has(key)) {
1058
- removed += 1;
1059
- continue;
1060
- }
1061
- seen.add(key);
1062
- exactKept.push(f);
1063
- }
1064
- const sim = similar.length > 1 ? await dedupCandidates(similar, embedding, threshold) : { kept: [...similar], duplicatesRemoved: 0 };
1065
- return {
1066
- kept: [...never, ...exactKept, ...sim.kept],
1067
- duplicatesRemoved: removed + sim.duplicatesRemoved
1068
- };
1069
- }
1070
- async function dedupCandidates(facts, embedding, threshold) {
1071
- if (facts.length <= 1) return { kept: [...facts], duplicatesRemoved: 0 };
1072
- const vectors = await embedding.embed(facts.map((f) => f.text));
1073
- const keptIdx = [];
1074
- const keptVecs = [];
1075
- for (let i = 0; i < facts.length; i++) {
1076
- const vec = vectors[i] ?? [];
1077
- const isDup = keptVecs.some((kept2) => cosineSimilarity(vec, kept2) >= threshold);
1078
- if (isDup) continue;
1079
- keptIdx.push(i);
1080
- keptVecs.push(vec);
1081
- }
1082
- const kept = keptIdx.map((i) => facts[i]);
1083
- return { kept, duplicatesRemoved: facts.length - kept.length };
1084
- }
1085
- var DEFAULT_MAX_FACTS_PER_SWEEP = 500;
1086
- async function remPhase(facts, embedding, threshold = DEFAULT_CLUSTER_THRESHOLD, maxFactsPerSweep = DEFAULT_MAX_FACTS_PER_SWEEP) {
1087
- if (facts.length === 0) return { clusters: [], factsLeftOut: 0 };
1088
- const capped = facts.length > maxFactsPerSweep ? facts.slice(0, maxFactsPerSweep) : facts;
1089
- const vectors = await embedding.embed(capped.map((f) => f.text));
1090
- const clusterOfIdx = unionFindByPairs(vectors, threshold);
1091
- const groups = bucketFactsByClusterRoot(capped, clusterOfIdx);
1092
- return {
1093
- clusters: [...groups.values()].map(buildClusterFromMembers),
1094
- factsLeftOut: facts.length - capped.length
1095
- };
1096
- }
1097
- function unionFindByPairs(vectors, threshold) {
1098
- const clusterOfIdx = vectors.map((_, i) => i);
1099
- for (let i = 0; i < vectors.length; i++) {
1100
- for (let j = i + 1; j < vectors.length; j++) {
1101
- if (cosineSimilarity(vectors[i] ?? [], vectors[j] ?? []) >= threshold) {
1102
- unifyClusters(clusterOfIdx, i, j);
1103
- }
1104
- }
1105
- }
1106
- return clusterOfIdx;
1107
- }
1108
- function bucketFactsByClusterRoot(facts, clusterOfIdx) {
1109
- const groups = /* @__PURE__ */ new Map();
1110
- for (let i = 0; i < facts.length; i++) {
1111
- const root = findRoot(clusterOfIdx, i);
1112
- const list2 = groups.get(root) ?? [];
1113
- list2.push(facts[i]);
1114
- groups.set(root, list2);
1115
- }
1116
- return groups;
1117
- }
1118
- function buildClusterFromMembers(members) {
1119
- const sorted = [...members].sort((a, b) => b.text.length - a.text.length);
1120
- return { representativeText: sorted[0]?.text ?? "", members };
1121
- }
1122
- function deepPhase(clusters, timestampMs) {
1123
- if (clusters.length === 0) return "";
1124
- const isoStamp = new Date(timestampMs).toISOString();
1125
- const lines = [`# Dreamed ${isoStamp}`, ""];
1126
- for (let i = 0; i < clusters.length; i++) {
1127
- const c = clusters[i];
1128
- if (c === void 0) continue;
1129
- lines.push(`## Cluster ${i + 1}: ${c.representativeText}`);
1130
- lines.push("");
1131
- for (const member of c.members) lines.push(`- ${member.text}`);
1132
- lines.push("");
1133
- }
1134
- return `${lines.join("\n")}
1135
- `;
1136
- }
1137
- function cosineSimilarity(a, b) {
1138
- if (a.length === 0 || b.length === 0 || a.length !== b.length) return 0;
1139
- let dot = 0;
1140
- let aNorm = 0;
1141
- let bNorm = 0;
1142
- for (let i = 0; i < a.length; i++) {
1143
- const ai = a[i] ?? 0;
1144
- const bi = b[i] ?? 0;
1145
- dot += ai * bi;
1146
- aNorm += ai * ai;
1147
- bNorm += bi * bi;
1148
- }
1149
- const denom = Math.sqrt(aNorm) * Math.sqrt(bNorm);
1150
- return denom === 0 ? 0 : dot / denom;
1151
- }
1152
- function findRoot(parents, i) {
1153
- let root = i;
1154
- while (parents[root] !== root) {
1155
- const next = parents[root] ?? root;
1156
- if (next === root) break;
1157
- root = next;
1158
- }
1159
- parents[i] = root;
1160
- return root;
1161
- }
1162
- function unifyClusters(parents, a, b) {
1163
- const rootA = findRoot(parents, a);
1164
- const rootB = findRoot(parents, b);
1165
- if (rootA !== rootB) parents[rootB] = rootA;
1166
- }
1167
-
1168
- // src/internal/memory/dreaming/run.ts
1169
- function runDreamingSweep(options) {
1170
- return withCwdMutex(`dream:${options.cwd}`, () => runInner(options));
1171
- }
1172
- async function runInner(options) {
1173
- const now = options.now ?? Date.now;
1174
- const timestampMs = now();
1175
- try {
1176
- const root = options.memoryRoot ?? resolveMemoryRoot(options.cwd);
1177
- const facts = await readFactsFromMarkdown(
1178
- options.cwd,
1179
- options.memoryRoot ? { directory: options.memoryRoot } : void 0
1180
- );
1181
- if (facts.length === 0) {
1182
- return emptyResult("skipped");
1183
- }
1184
- const dedup = await lightPhase(facts, options.embedding, options.dedupThreshold);
1185
- const rem = await remPhase(dedup.kept, options.embedding, options.clusterThreshold);
1186
- const notesWritten = await writeConsolidatedNotes(root, rem.clusters, timestampMs);
1187
- const result = {
1188
- status: "ok",
1189
- factsBefore: facts.length,
1190
- factsAfter: dedup.kept.length,
1191
- duplicatesRemoved: dedup.duplicatesRemoved,
1192
- clustersCreated: rem.clusters.length,
1193
- notesWritten,
1194
- diaryEntryHash: void 0,
1195
- factsLeftOut: rem.factsLeftOut
1196
- };
1197
- await appendDiaryEntry(root, {
1198
- timestampMs,
1199
- factsBefore: result.factsBefore,
1200
- factsAfter: result.factsAfter,
1201
- duplicatesRemoved: result.duplicatesRemoved,
1202
- clustersCreated: result.clustersCreated,
1203
- notesWritten: result.notesWritten
1204
- });
1205
- return result;
1206
- } catch (cause) {
1207
- const message = cause instanceof Error ? cause.message : String(cause);
1208
- diag(`[theokit-sdk] dreaming sweep failed: ${message}
1209
- `);
1210
- return emptyResult("error");
1211
- }
1212
- }
1213
- async function writeConsolidatedNotes(root, clusters, timestampMs) {
1214
- if (clusters.length === 0) return 0;
1215
- const notesDir = join(root, "notes");
1216
- await mkdir(notesDir, { recursive: true });
1217
- const isoSlug = new Date(timestampMs).toISOString().replace(/[^\dT]/g, "-");
1218
- const file = join(notesDir, `dreamed-${isoSlug}.md`);
1219
- const body = deepPhase(clusters, timestampMs);
1220
- await replaceFileAtomic(file, body);
1221
- return 1;
1222
- }
1223
- function emptyResult(status) {
1224
- const result = {
1225
- status,
1226
- factsBefore: 0,
1227
- factsAfter: 0,
1228
- duplicatesRemoved: 0,
1229
- clustersCreated: 0,
1230
- notesWritten: 0,
1231
- diaryEntryHash: void 0
1232
- };
1233
- return status === "skipped" ? { ...result, factsLeftOut: 0 } : result;
1234
- }
1235
-
1236
1052
  // src/internal/memory/sdk-memory-peer-loader.ts
1237
1053
  var cachedAttempt;
1238
1054
  async function loadPeer() {
@@ -1289,7 +1105,7 @@ var Memory = {
1289
1105
  openArgs.embedding = await resolveEmbedding(opts.embedding, peer.MEMORY_EMBEDDING_ADAPTERS);
1290
1106
  return await peer.IndexManager.open(openArgs);
1291
1107
  }
1292
- const { IndexManager } = await import('./index-manager-QDH56FER.js');
1108
+ const { IndexManager } = await import('./index-manager-NF2WRLOU.js');
1293
1109
  openArgs.embedding = await resolveEmbedding(opts.embedding, MEMORY_EMBEDDING_ADAPTERS);
1294
1110
  return await IndexManager.open(openArgs);
1295
1111
  },
@@ -1929,7 +1745,7 @@ function isBuiltAgent(m) {
1929
1745
  return typeof m.send === "function";
1930
1746
  }
1931
1747
  async function materialize(def, index) {
1932
- const { Agent: Agent2 } = await import('./agent-5DSDDH7K.js');
1748
+ const { Agent: Agent2 } = await import('./agent-DRDGUU6T.js');
1933
1749
  return Agent2.create({
1934
1750
  // `AgentDefinition.model` admits the sentinel `'inherit'`, which is not a model id. Inheriting
1935
1751
  // here means "declare nothing and let the default apply" — forwarding the literal would create