@theokit/sdk 5.14.0 → 5.15.1

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 (214) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/{agent-T34LCGQM.js → agent-66U5QCPF.js} +18 -17
  3. package/dist/{agent-T34LCGQM.js.map → agent-66U5QCPF.js.map} +1 -1
  4. package/dist/{agent-DExqjqYy.d.cts → agent-BL4kxgwq.d.cts} +30 -214
  5. package/dist/{agent-Dfw3VsIX.d.ts → agent-ByDx7K30.d.ts} +30 -214
  6. package/dist/{agent-TL4K7BTG.cjs → agent-CB27KF6O.cjs} +19 -18
  7. package/dist/{agent-TL4K7BTG.cjs.map → agent-CB27KF6O.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-ZOL3L4EH.js → chunk-26GI3OYA.js} +118 -21
  14. package/dist/chunk-26GI3OYA.js.map +1 -0
  15. package/dist/{chunk-2WY2OFSC.cjs → chunk-26UQG242.cjs} +616 -318
  16. package/dist/chunk-26UQG242.cjs.map +1 -0
  17. package/dist/{chunk-2C24NSNV.js → chunk-3BBTHFGJ.js} +3 -3
  18. package/dist/{chunk-2C24NSNV.js.map → chunk-3BBTHFGJ.js.map} +1 -1
  19. package/dist/{chunk-SNVYOX46.cjs → chunk-3E3VSMB6.cjs} +160 -63
  20. package/dist/chunk-3E3VSMB6.cjs.map +1 -0
  21. package/dist/{chunk-NP362THY.cjs → chunk-3F53FLQ7.cjs} +5 -7
  22. package/dist/chunk-3F53FLQ7.cjs.map +1 -0
  23. package/dist/{chunk-SXH37C7X.cjs → chunk-55LLQFHW.cjs} +6 -6
  24. package/dist/{chunk-SXH37C7X.cjs.map → chunk-55LLQFHW.cjs.map} +1 -1
  25. package/dist/{chunk-ZJAYFSVI.js → chunk-7ACS6P5Z.js} +5 -7
  26. package/dist/chunk-7ACS6P5Z.js.map +1 -0
  27. package/dist/{chunk-WDVG5R2Q.cjs → chunk-AUH2EVWY.cjs} +4 -3
  28. package/dist/chunk-AUH2EVWY.cjs.map +1 -0
  29. package/dist/chunk-BNEUB52I.cjs +55 -0
  30. package/dist/chunk-BNEUB52I.cjs.map +1 -0
  31. package/dist/chunk-BPL5CVZ5.js +53 -0
  32. package/dist/chunk-BPL5CVZ5.js.map +1 -0
  33. package/dist/{chunk-NVQSBRG6.js → chunk-CBBT42VX.js} +3 -3
  34. package/dist/{chunk-NVQSBRG6.js.map → chunk-CBBT42VX.js.map} +1 -1
  35. package/dist/chunk-CHKV2L2Y.cjs +416 -0
  36. package/dist/chunk-CHKV2L2Y.cjs.map +1 -0
  37. package/dist/{chunk-LXG6VL6R.cjs → chunk-FBIDOOJM.cjs} +3 -3
  38. package/dist/{chunk-LXG6VL6R.cjs.map → chunk-FBIDOOJM.cjs.map} +1 -1
  39. package/dist/{chunk-354F3OF5.js → chunk-FGGVSHDW.js} +3 -3
  40. package/dist/{chunk-354F3OF5.js.map → chunk-FGGVSHDW.js.map} +1 -1
  41. package/dist/{chunk-6OCJWGVD.cjs → chunk-FTXY4D44.cjs} +4 -4
  42. package/dist/{chunk-6OCJWGVD.cjs.map → chunk-FTXY4D44.cjs.map} +1 -1
  43. package/dist/chunk-INVEGVGO.js +405 -0
  44. package/dist/chunk-INVEGVGO.js.map +1 -0
  45. package/dist/{chunk-DF77RBF4.js → chunk-LCCT5ZXJ.js} +6 -6
  46. package/dist/{chunk-DF77RBF4.js.map → chunk-LCCT5ZXJ.js.map} +1 -1
  47. package/dist/{chunk-G7XBVM3T.cjs → chunk-MHUOVS5I.cjs} +5 -5
  48. package/dist/{chunk-G7XBVM3T.cjs.map → chunk-MHUOVS5I.cjs.map} +1 -1
  49. package/dist/{chunk-CWQPQTUZ.cjs → chunk-NEH3BPFD.cjs} +15 -15
  50. package/dist/{chunk-CWQPQTUZ.cjs.map → chunk-NEH3BPFD.cjs.map} +1 -1
  51. package/dist/{chunk-5AR6O7GW.js → chunk-NK5EOTDY.js} +3 -3
  52. package/dist/{chunk-5AR6O7GW.js.map → chunk-NK5EOTDY.js.map} +1 -1
  53. package/dist/{chunk-NAVUTK6X.js → chunk-O2RCS3SJ.js} +3 -3
  54. package/dist/{chunk-NAVUTK6X.js.map → chunk-O2RCS3SJ.js.map} +1 -1
  55. package/dist/{chunk-4TEGFMSP.cjs → chunk-P7QYG4RZ.cjs} +23 -15
  56. package/dist/chunk-P7QYG4RZ.cjs.map +1 -0
  57. package/dist/chunk-PPU2D4FZ.js +19 -0
  58. package/dist/chunk-PPU2D4FZ.js.map +1 -0
  59. package/dist/{chunk-AB4OPJLD.js → chunk-RGVMJU57.js} +3 -3
  60. package/dist/{chunk-AB4OPJLD.js.map → chunk-RGVMJU57.js.map} +1 -1
  61. package/dist/{chunk-4KBI37F3.cjs → chunk-RTDVSHJR.cjs} +5 -5
  62. package/dist/{chunk-4KBI37F3.cjs.map → chunk-RTDVSHJR.cjs.map} +1 -1
  63. package/dist/{chunk-CJN5CEI3.js → chunk-RZL2W4C3.js} +23 -15
  64. package/dist/chunk-RZL2W4C3.js.map +1 -0
  65. package/dist/chunk-SPEN7RJU.cjs +18 -0
  66. package/dist/{chunk-R5UQL2R5.cjs.map → chunk-SPEN7RJU.cjs.map} +1 -1
  67. package/dist/{chunk-BZK5QL3N.cjs → chunk-TRPRTZEH.cjs} +4 -4
  68. package/dist/{chunk-BZK5QL3N.cjs.map → chunk-TRPRTZEH.cjs.map} +1 -1
  69. package/dist/{chunk-ZF2LDKQQ.cjs → chunk-U3DW3WDE.cjs} +9 -8
  70. package/dist/chunk-U3DW3WDE.cjs.map +1 -0
  71. package/dist/{chunk-H7G65PNI.js → chunk-VCQ37TC5.js} +3 -3
  72. package/dist/{chunk-H7G65PNI.js.map → chunk-VCQ37TC5.js.map} +1 -1
  73. package/dist/{chunk-3ONIVO2I.js → chunk-VNRNZ3WI.js} +3 -3
  74. package/dist/{chunk-3ONIVO2I.js.map → chunk-VNRNZ3WI.js.map} +1 -1
  75. package/dist/{chunk-SDZ4XDWS.cjs → chunk-VWYFGE27.cjs} +9 -9
  76. package/dist/{chunk-SDZ4XDWS.cjs.map → chunk-VWYFGE27.cjs.map} +1 -1
  77. package/dist/{chunk-RN3XDZGS.js → chunk-WM646HEN.js} +4 -3
  78. package/dist/chunk-WM646HEN.js.map +1 -0
  79. package/dist/chunk-X7CE7Y5W.js +305 -0
  80. package/dist/chunk-X7CE7Y5W.js.map +1 -0
  81. package/dist/{chunk-CGH4BCIY.cjs → chunk-XE3CAY6Z.cjs} +5 -5
  82. package/dist/{chunk-CGH4BCIY.cjs.map → chunk-XE3CAY6Z.cjs.map} +1 -1
  83. package/dist/chunk-XOU3CL7S.cjs +312 -0
  84. package/dist/chunk-XOU3CL7S.cjs.map +1 -0
  85. package/dist/{chunk-ULEK4OM4.js → chunk-YKNBTHMD.js} +3 -3
  86. package/dist/{chunk-ULEK4OM4.js.map → chunk-YKNBTHMD.js.map} +1 -1
  87. package/dist/{chunk-GARVAUCU.js → chunk-ZQWRUJHE.js} +534 -236
  88. package/dist/chunk-ZQWRUJHE.js.map +1 -0
  89. package/dist/{compact-session-D2MQDB6G.cjs → compact-session-CHBJOYWP.cjs} +16 -16
  90. package/dist/{compact-session-D2MQDB6G.cjs.map → compact-session-CHBJOYWP.cjs.map} +1 -1
  91. package/dist/{compact-session-N2PPHQO6.js → compact-session-F3J3FMEU.js} +7 -7
  92. package/dist/{compact-session-N2PPHQO6.js.map → compact-session-F3J3FMEU.js.map} +1 -1
  93. package/dist/{cron-CK2v0VWA.d.cts → cron-B7KH9sHW.d.cts} +2 -2
  94. package/dist/{cron-BubDpFJG.d.ts → cron-FEO7UAQF.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-LC2TROHM.js} +3 -3
  118. package/dist/{inject-session-J26SHHIO.js.map → inject-session-LC2TROHM.js.map} +1 -1
  119. package/dist/{inject-session-3ICZIJ2N.cjs → inject-session-T4RXANG3.cjs} +4 -4
  120. package/dist/{inject-session-3ICZIJ2N.cjs.map → inject-session-T4RXANG3.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/llm/hermes-tool-extract.d.ts +2 -0
  126. package/dist/internal/local-agent/local-agent-dispatch.d.ts +3 -1
  127. package/dist/internal/local-agent/send-queue.d.ts +31 -0
  128. package/dist/internal/mcp/client.d.ts +2 -0
  129. package/dist/internal/mcp/oauth-bearer.d.ts +2 -0
  130. package/dist/internal/memory/adapters/index.cjs +3 -3
  131. package/dist/internal/memory/adapters/index.js +2 -2
  132. package/dist/internal/memory/dreaming/phases.d.ts +15 -0
  133. package/dist/internal/memory/dreaming/run.d.ts +29 -0
  134. package/dist/internal/memory/sdk-memory-peer-loader.d.ts +2 -0
  135. package/dist/internal/memory/storage/index.cjs +51 -35
  136. package/dist/internal/memory/storage/index.d.cts +2 -0
  137. package/dist/internal/memory/storage/index.d.ts +2 -0
  138. package/dist/internal/memory/storage/index.js +4 -4
  139. package/dist/internal/persistence/cwd-mutex.d.cts +4 -2
  140. package/dist/internal/persistence/cwd-mutex.d.ts +4 -2
  141. package/dist/internal/persistence/index.cjs +4 -4
  142. package/dist/internal/persistence/index.js +2 -2
  143. package/dist/internal/persistence/sqlite-session-store.d.cts +25 -0
  144. package/dist/internal/persistence/sqlite-session-store.d.ts +25 -0
  145. package/dist/internal/providers/registry.d.ts +5 -1
  146. package/dist/mcp-auth.cjs +25 -307
  147. package/dist/mcp-auth.cjs.map +1 -1
  148. package/dist/mcp-auth.js +5 -305
  149. package/dist/mcp-auth.js.map +1 -1
  150. package/dist/models.cjs +9 -9
  151. package/dist/models.js +2 -2
  152. package/dist/persistence.cjs +9 -4
  153. package/dist/persistence.cjs.map +1 -1
  154. package/dist/persistence.d.cts +744 -40
  155. package/dist/persistence.d.ts +744 -40
  156. package/dist/persistence.js +3 -2
  157. package/dist/persistence.js.map +1 -1
  158. package/dist/providers.cjs +4 -4
  159. package/dist/providers.js +2 -2
  160. package/dist/sandbox/docker-sandbox.d.cts +58 -0
  161. package/dist/sandbox/docker-sandbox.d.ts +58 -0
  162. package/dist/sandbox/index.cjs +129 -1
  163. package/dist/sandbox/index.cjs.map +1 -1
  164. package/dist/sandbox/index.d.cts +1 -0
  165. package/dist/sandbox/index.d.ts +1 -0
  166. package/dist/sandbox/index.js +132 -5
  167. package/dist/sandbox/index.js.map +1 -1
  168. package/dist/{sdk-agent-DwzHcuxy.d.cts → sdk-agent-BA_6_wtc.d.cts} +30 -2
  169. package/dist/{sdk-agent-a3fW1xUK.d.ts → sdk-agent-CnwPODYH.d.ts} +30 -2
  170. package/dist/session-store-Dh07jr9N.d.cts +209 -0
  171. package/dist/session-store-Dh07jr9N.d.ts +209 -0
  172. package/dist/sqlite-session-store-BbcpKY1L.d.ts +64 -0
  173. package/dist/sqlite-session-store-TKXtT4ON.d.cts +64 -0
  174. package/dist/subagents-loader-KLWF4QPD.cjs +16 -0
  175. package/dist/{subagents-loader-TXOA5EJJ.cjs.map → subagents-loader-KLWF4QPD.cjs.map} +1 -1
  176. package/dist/subagents-loader-SXETS2F2.js +7 -0
  177. package/dist/{subagents-loader-Z744TAKD.js.map → subagents-loader-SXETS2F2.js.map} +1 -1
  178. package/dist/subagents-loader.cjs +2 -2
  179. package/dist/subagents-loader.d.cts +3 -2
  180. package/dist/subagents-loader.d.ts +3 -2
  181. package/dist/subagents-loader.js +1 -1
  182. package/dist/types/agent.d.ts +14 -1
  183. package/dist/types/budget-tracker.d.ts +6 -2
  184. package/dist/types/hooks.d.ts +7 -1
  185. package/dist/types/mcp.d.ts +14 -0
  186. package/dist/types/run.d.ts +15 -1
  187. package/dist/workflow.d.cts +1 -1
  188. package/dist/workflow.d.ts +1 -1
  189. package/docs/adr/mutation-testing-scope.md +12 -2
  190. package/docs/error-codes.md +41 -40
  191. package/docs/harness-capability-map.md +32 -6
  192. package/package.json +1 -1
  193. package/dist/chunk-2WY2OFSC.cjs.map +0 -1
  194. package/dist/chunk-4TEGFMSP.cjs.map +0 -1
  195. package/dist/chunk-6CXRYPG7.cjs +0 -211
  196. package/dist/chunk-6CXRYPG7.cjs.map +0 -1
  197. package/dist/chunk-CJN5CEI3.js.map +0 -1
  198. package/dist/chunk-GARVAUCU.js.map +0 -1
  199. package/dist/chunk-MSEL5E5P.js +0 -204
  200. package/dist/chunk-MSEL5E5P.js.map +0 -1
  201. package/dist/chunk-NP362THY.cjs.map +0 -1
  202. package/dist/chunk-Q5EWJPRY.js +0 -18
  203. package/dist/chunk-Q5EWJPRY.js.map +0 -1
  204. package/dist/chunk-R5UQL2R5.cjs +0 -18
  205. package/dist/chunk-RN3XDZGS.js.map +0 -1
  206. package/dist/chunk-SNVYOX46.cjs.map +0 -1
  207. package/dist/chunk-WDVG5R2Q.cjs.map +0 -1
  208. package/dist/chunk-ZF2LDKQQ.cjs.map +0 -1
  209. package/dist/chunk-ZJAYFSVI.js.map +0 -1
  210. package/dist/chunk-ZOL3L4EH.js.map +0 -1
  211. package/dist/fs-session-store-6ZCCJX3K.js +0 -11
  212. package/dist/fs-session-store-S2AXVJIX.cjs +0 -20
  213. package/dist/subagents-loader-TXOA5EJJ.cjs +0 -16
  214. package/dist/subagents-loader-Z744TAKD.js +0 -7
package/dist/index.d.cts CHANGED
@@ -1,19 +1,20 @@
1
- import { TokenUsage } from "./index.js";
2
1
  import { T as TheokitAgentError, E as ErrorMetadata } from './errors-base-B5g01neU.cjs';
3
2
  export { a as ErrorCode } from './errors-base-B5g01neU.cjs';
4
- import { A as AgentOptions, L as LocalOptions, B as BuiltinToolName, M as MemorySettings, S as SystemPromptResolver, C as CloudOptions, a as AgentDefinition, b as SkillsSettings, c as ListAgentsOptions, d as ListResult, e as SDKAgentInfo, G as GetAgentOptions, f as ListRunsOptions, g as GetRunOptions, h as AgentOperationOptions, i as AgentDescription, P as Plugin$1, j as ProviderProfile, I as InlineSkill, k as Skill, l as BudgetTracker, m as MemoryProvider, n as PreToolCallDecision } from './agent-DExqjqYy.cjs';
5
- export { o as ActiveMemoryPassArgs, p as ActiveMemoryPassResult, q as AgentSubagentDescription, r as AgentToolDescription, s as BudgetCheck, t as BudgetTotal, u as BudgetUsageEvent, v as CloudEnv, w as CloudRepo, x as CompatSource, y as CompatSourceAdapter, z as CompatSurface, D as CreateSkillSpec, H as HookApprovalGate, E as HookApprovalRequest, F as HookName, J as LlmCallContext, K as MemoryProviderAgentRef, N as MemoryProviderFactory, O as MemoryProviderHandle, Q as MemoryProviderInitOptions, R as PluginContext, T as PluginHookDisposer, U as PostAssistantReplyContext, V as PostToolCallContext, W as PreToolCallContext, X as PreUserSendContext, Y as PreUserSendResult, Z as ProviderTransform, _ as ProviderTransformContext, $ as RecordSessionSummaryArgs, a0 as SessionLifecycleContext, a1 as SessionRecord, a2 as SessionStore, a3 as SettingSource, a4 as Skill, a5 as SkillsResolver, a6 as SkillsResolverContext, a7 as SystemPromptContext, a8 as SystemPromptMemoryFact, a9 as TelemetrySettings, aa as ToolCallSummary, ab as ToolContext, ac as ToolResultTransformContext, ad as TransformContext } from './agent-DExqjqYy.cjs';
6
- import { ac as RunEvent, v as CostBreakdown, R as RunResult, P as ProviderRoutingSettings, S as SDKAgent, M as McpServerConfig, C as ContextSettings, a as PluginsSettings, b as Run, c as Processor, J as JudgeResult, G as GoalOptions, d as GoalEvent, e as GoalResult, f as MemoryId, g as RunEventSink$1, h as SDKProvider, i as SDKMessage } from './sdk-agent-DwzHcuxy.cjs';
7
- export { A as AgentConversationTurn, j as AgentMemory, k as AgentOperation, l as AssistantMessage, m as CompletionCheck, n as CompletionCheckResult, o as ContextBudget, p as ContextManagerKind, q as ContextSnapshot, r as ContextSource, s as ContextSourceStatus, t as ConversationStep, u as ConversationTurn, v as CostBreakdown, w as CostSource, x as CostStatus, D as DoomLoopThresholds, E as EnvPolicy, F as ForkOptions, y as ForkResult, z as GenerateOptions, B as GenerateRunResult, I as InputProcessorContext, H as InteractionUpdate, K as InvalidateCacheOptions, L as McpAuthConfig, N as McpHttpServerConfig, O as McpOAuthConfig, Q as McpStdioServerConfig, T as MemoryAdapter, U as MemoryAdapterCapabilities, V as MemoryContext, W as MemoryFact, X as MemoryRevision, Y as MemoryToolSchema, Z as MemoryTurnMessage, _ as MessageOrigin, $ as OutputProcessorContext, a0 as PartialToolCallUpdate, a1 as PersonalityPreset, a2 as ProcessorControls, a3 as ProcessorTripwire, a4 as ProcessorViolation, a5 as ProviderCapability, a6 as ProviderRoute, a7 as PruneToolResultsOptions, a8 as ResolvedProviderRoute, a9 as RunCompactBoundaryEvent, aa as RunCompletionCheckEvent, ab as RunErrorDetail, ac as RunEvent, ad as RunGitInfo, ae as RunMemoryDegradedEvent, af as RunPermissionDeniedEvent, ag as RunRateLimitEvent, ah as RunStatus, ai as RunTaskCompletedEvent, aj as RunTaskStartedEvent, ak as RunTaskUpdatedEvent, al as RunTimelineEvent, am as RunToCompletionOptions, an as RunToCompletionResult, ao as RunToolProgressEvent, ap as RunTripwireEvent, aq as RunUntilIterator, ar as SDKAgentPlugins, as as SDKAgentSkillDetail, at as SDKAgentSkills, au as SDKArtifact, av as SDKAssistantMessage, aw as SDKContextManager, ax as SDKImage, ay as SDKImageDimension, az as SDKObjectDelta, aA as SDKPluginMetadata, aB as SDKProvidersManager, aC as SDKRequestMessage, aD as SDKStatusMessage, aE as SDKSystemMessage, aF as SDKTaskMessage, aG as SDKThinkingMessage, aH as SDKToolUseMessage, aI as SDKUserMessage, aJ as SDKUserMessageEvent, aK as SendOptions, aL as ShellCommand, aM as ShellConversationTurn, aN as ShellOutput, aO as ShellOutputDeltaUpdate, aP as StepCompletedUpdate, aQ as StepStartedUpdate, aR as StreamToCompletionResult, aS as SummaryCompletedUpdate, aT as SummaryStartedUpdate, aU as SummaryUpdate, aV as SystemPromptSkillRef, aW as TextDeltaUpdate, aX as ThinkingCompletedUpdate, aY as ThinkingDeltaUpdate, aZ as ThinkingMessage, a_ as TokenDeltaUpdate, a$ as TokenUsage, b0 as ToolCall, b1 as ToolCallCompletedUpdate, b2 as ToolCallStartedUpdate, b3 as ToolResult, b4 as ToolResultGuardOptions, b5 as ToolUseBlock, b6 as TurnEndedUpdate, b7 as UserMessage, b8 as UserMessageAppendedUpdate, b9 as Verdict } from './sdk-agent-DwzHcuxy.cjs';
3
+ import { A as AgentOptions, L as LocalOptions, B as BuiltinToolName, M as MemorySettings, S as SystemPromptResolver, C as CloudOptions, a as AgentDefinition, b as SkillsSettings, c as ListAgentsOptions, d as ListResult, e as SDKAgentInfo, G as GetAgentOptions, f as ListRunsOptions, g as GetRunOptions, h as AgentOperationOptions, i as AgentDescription, P as Plugin$1, j as ProviderProfile, I as InlineSkill, k as Skill, l as BudgetTracker, m as MemoryProvider, n as PreToolCallDecision } from './agent-BL4kxgwq.cjs';
4
+ export { o as ActiveMemoryPassArgs, p as ActiveMemoryPassResult, q as AgentSubagentDescription, r as AgentToolDescription, s as BudgetCheck, t as BudgetTotal, u as BudgetUsageEvent, v as CloudEnv, w as CloudRepo, x as CompatSource, y as CompatSourceAdapter, z as CompatSurface, D as CreateSkillSpec, H as HookApprovalGate, E as HookApprovalRequest, F as HookName, J as LlmCallContext, K as MemoryProviderAgentRef, N as MemoryProviderFactory, O as MemoryProviderHandle, Q as MemoryProviderInitOptions, R as PluginContext, T as PluginHookDisposer, U as PostAssistantReplyContext, V as PostToolCallContext, W as PreToolCallContext, X as PreUserSendContext, Y as PreUserSendResult, Z as ProviderTransform, _ as ProviderTransformContext, $ as RecordSessionSummaryArgs, a0 as SessionLifecycleContext, a1 as SettingSource, a2 as Skill, a3 as SkillsResolver, a4 as SkillsResolverContext, a5 as SystemPromptContext, a6 as SystemPromptMemoryFact, a7 as TelemetrySettings, a8 as ToolCallSummary, a9 as ToolContext, aa as ToolResultTransformContext, ab as TransformContext } from './agent-BL4kxgwq.cjs';
5
+ import { ad as RunEvent, v as CostBreakdown, b0 as TokenUsage, R as RunResult, P as ProviderRoutingSettings, S as SDKAgent, M as McpServerConfig, C as ContextSettings, a as PluginsSettings, b as Run, c as Processor, J as JudgeResult, G as GoalOptions, d as GoalEvent, e as GoalResult, f as MemoryId, g as RunEventSink$1, h as SDKProvider, i as SDKMessage } from './sdk-agent-BA_6_wtc.cjs';
6
+ export { A as AgentConversationTurn, j as AgentMemory, k as AgentOperation, l as AssistantMessage, m as CompletionCheck, n as CompletionCheckResult, o as ContextBudget, p as ContextManagerKind, q as ContextSnapshot, r as ContextSource, s as ContextSourceStatus, t as ConversationStep, u as ConversationTurn, v as CostBreakdown, w as CostSource, x as CostStatus, D as DoomLoopThresholds, E as EnvPolicy, F as ForkOptions, y as ForkResult, z as GenerateOptions, B as GenerateRunResult, I as InputProcessorContext, H as InteractionUpdate, K as InvalidateCacheOptions, L as McpAuthConfig, N as McpHttpServerConfig, O as McpOAuthConfig, Q as McpStdioServerConfig, T as MemoryAdapter, U as MemoryAdapterCapabilities, V as MemoryContext, W as MemoryFact, X as MemoryRevision, Y as MemoryToolSchema, Z as MemoryTurnMessage, _ as MessageOrigin, $ as OutputProcessorContext, a0 as PartialToolCallUpdate, a1 as PersonalityPreset, a2 as ProcessorControls, a3 as ProcessorTripwire, a4 as ProcessorViolation, a5 as ProviderCapability, a6 as ProviderRoute, a7 as PruneToolResultsOptions, a8 as QueueMode, a9 as ResolvedProviderRoute, aa as RunCompactBoundaryEvent, ab as RunCompletionCheckEvent, ac as RunErrorDetail, ad as RunEvent, ae as RunGitInfo, af as RunMemoryDegradedEvent, ag as RunPermissionDeniedEvent, ah as RunRateLimitEvent, ai as RunStatus, aj as RunTaskCompletedEvent, ak as RunTaskStartedEvent, al as RunTaskUpdatedEvent, am as RunTimelineEvent, an as RunToCompletionOptions, ao as RunToCompletionResult, ap as RunToolProgressEvent, aq as RunTripwireEvent, ar as RunUntilIterator, as as SDKAgentPlugins, at as SDKAgentSkillDetail, au as SDKAgentSkills, av as SDKArtifact, aw as SDKAssistantMessage, ax as SDKContextManager, ay as SDKImage, az as SDKImageDimension, aA as SDKObjectDelta, aB as SDKPluginMetadata, aC as SDKProvidersManager, aD as SDKRequestMessage, aE as SDKStatusMessage, aF as SDKSystemMessage, aG as SDKTaskMessage, aH as SDKThinkingMessage, aI as SDKToolUseMessage, aJ as SDKUserMessage, aK as SDKUserMessageEvent, aL as SendOptions, aM as ShellCommand, aN as ShellConversationTurn, aO as ShellOutput, aP as ShellOutputDeltaUpdate, aQ as StepCompletedUpdate, aR as StepStartedUpdate, aS as StreamToCompletionResult, aT as SummaryCompletedUpdate, aU as SummaryStartedUpdate, aV as SummaryUpdate, aW as SystemPromptSkillRef, aX as TextDeltaUpdate, aY as ThinkingCompletedUpdate, aZ as ThinkingDeltaUpdate, a_ as ThinkingMessage, a$ as TokenDeltaUpdate, b0 as TokenUsage, b1 as ToolCall, b2 as ToolCallCompletedUpdate, b3 as ToolCallStartedUpdate, b4 as ToolResult, b5 as ToolResultGuardOptions, b6 as ToolUseBlock, b7 as TurnEndedUpdate, b8 as UserMessage, b9 as UserMessageAppendedUpdate, ba as Verdict } from './sdk-agent-BA_6_wtc.cjs';
8
7
  import * as zod from 'zod';
9
8
  import { ZodType, z } from 'zod';
10
9
  import { S as StructuredOutputError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot } from './errors-BiDQFWTG.cjs';
11
10
  export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, I as IntegrationNotConnectedError, m as InvalidTaskIdError, M as MemoryAdapterError, n as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, T as TaskNotFoundError, U as UnknownAgentError, o as UnsupportedBudgetOperationError, p as UnsupportedRunOperationError, q as UnsupportedTaskOperationError, r as isTransientError } from './errors-BiDQFWTG.cjs';
12
11
  import { M as ModelSelection, C as CustomTool, T as ToolResultContentBlock, P as PermissionMode } from './agent-prims-CZyxfCmS.cjs';
13
12
  export { I as ImageBlock, a as ModelParameterValue, R as RunOperation, b as TextBlock, c as ToolContextMessage } from './agent-prims-CZyxfCmS.cjs';
14
- export { C as Cron, a as CronCreateOptions, b as CronGetOptions, c as CronJob, d as CronJobStatus, e as CronListOptions, f as CronOperationOptions, g as CronRunOptions, h as CronRuntime, i as CronSchedulerStatus, j as CronStartOptions } from './cron-CK2v0VWA.cjs';
13
+ export { C as Cron, a as CronCreateOptions, b as CronGetOptions, c as CronJob, d as CronJobStatus, e as CronListOptions, f as CronOperationOptions, g as CronRunOptions, h as CronRuntime, i as CronSchedulerStatus, j as CronStartOptions } from './cron-B7KH9sHW.cjs';
14
+ export { S as SqliteSessionStore, a as SqliteSessionStoreOptions, w as withCwdMutex } from './sqlite-session-store-TKXtT4ON.cjs';
15
15
  import { StepResult } from './workflow.cjs';
16
16
  export { Workflow, agentStep, fn } from './workflow.cjs';
17
+ export { S as SessionRecord, a as SessionStore } from './session-store-Dh07jr9N.cjs';
17
18
 
18
19
  /**
19
20
  * Public compaction / context-management helpers (M2-1, extended V3-3).
@@ -800,9 +801,8 @@ declare class Agent {
800
801
  * The agent-builder's M85 interrupt rotates the session id to work around a
801
802
  * constraint that does not exist.
802
803
  *
803
- * - `close()` marks the handle disposed WITHOUT evicting the cache entry. It is
804
- * internal and unused today; if it becomes reachable, this bullet stops being true
805
- * for that path.
804
+ * - `close()` marks the handle disposed AND drops its cache entry, so the next call
805
+ * builds a fresh handle.
806
806
  *
807
807
  * @public
808
808
  */
@@ -2163,42 +2163,6 @@ declare function setDiagnosticsSink(next: DiagnosticsSink | undefined): void;
2163
2163
  */
2164
2164
  declare function emitRunEvent(sink: RunEventSink$1 | undefined, event: RunEvent): void;
2165
2165
 
2166
- /**
2167
- * Run `fn` after every earlier `withCwdMutex` call for the same `key` has settled, and return
2168
- * what `fn` returns.
2169
- *
2170
- * Calls with the same key run strictly in the order they were made — FIFO, never concurrent.
2171
- * Calls with different keys never wait on each other. The key is an opaque string: two callers
2172
- * serialize against each other exactly when they pass equal keys, so a shared key IS the
2173
- * contract, and a mismatched one silently buys no protection at all.
2174
- *
2175
- * A rejection does not poison the queue. The next waiter runs whether the previous `fn` fulfilled
2176
- * or rejected, and the rejection is delivered only to the caller whose `fn` threw. This function
2177
- * neither retries nor swallows: the returned promise rejects with whatever `fn` rejected with.
2178
- *
2179
- * There is no timeout and no cancellation. An `fn` that never settles blocks that key for the
2180
- * lifetime of the process.
2181
- *
2182
- * **Scope — this is an in-process lock only.** State is a module-scoped Map, so it serializes
2183
- * callers that share one module instance and nothing else. Two processes, two worker threads, or
2184
- * two copies of the SDK resolved into the same tree do not see each other's queue. When the
2185
- * resource is a file that other processes can also write, use `withFileLock` from
2186
- * `./file-lock.ts` instead — it takes an OS-level lock and layers this mutex underneath, so it
2187
- * gives both guarantees. Reach for `withCwdMutex` directly when the shared state is in memory, or
2188
- * when the file is one only this process touches.
2189
- *
2190
- * Extracted packages (`@theokit/sdk-budget`, `@theokit/sdk-memory`) import this from
2191
- * `@theokit/sdk` rather than reimplementing it, precisely so the Map is the same one: a per-package
2192
- * copy would give each package its own queue and let their writes race.
2193
- *
2194
- * The Map is module-scoped, so nothing survives a process restart or a fresh module instance, and
2195
- * its entries are never removed — pass keys from a bounded set rather than from arbitrary input.
2196
- * Signature and semantics will not change before sdk-core v3.0.
2197
- *
2198
- * @public
2199
- */
2200
- declare function withCwdMutex<T>(key: string, fn: () => Promise<T>): Promise<T>;
2201
-
2202
2166
  /**
2203
2167
  * What an operator may impose. One key today, and the shape is the point: each addition is a control
2204
2168
  * that already exists somewhere below and is being lifted into a tier the project cannot reach.
@@ -4521,4 +4485,4 @@ interface WiringRecordInput<K extends string> {
4521
4485
  */
4522
4486
  declare function recordWiring<K extends string>(input: WiringRecordInput<K>): Readonly<Record<K, WiredEntity>>;
4523
4487
 
4524
- export { Agent, AgentBuilder, type AgentBuilderDeps, AgentDefinition, type AgentDescription, AgentFactory, AgentOperationOptions, AgentOptions, type AgentPromptResult, type AgentRegistryOptions, type ApprovalDecision, type ApprovalInput, type ApprovalMode, type ApprovalOutcome, type ApprovalReason, type BatchItem, type BatchOptions, type BatchProgress, type BatchResult, type BlastRadiusDecision, type BlastRadiusInput, type BlastRadiusOutcome, type BlastRadiusReason, Budget, BudgetHandle, BudgetOptions, BudgetSnapshot, type BudgetTracker, BuiltinToolName, CloudOptions, ContextSettings, type CounterBudgetTrackerOptions, type CredentialInput, type CredentialReport, type CustomTool, type DeclaredAction, type DeclaredLayer, type DeepPartial, type DefineProviderOptions, type DefineToolSpec, type DiagnosticsSink, type DreamingSweepOptions, type DreamingSweepResult, type EffectiveToolCatalog, type EnvOptOut, type EnvReachabilityAudit, type EnvReachabilityInput, ErrorMetadata, EventBus, type EvictReason, GOAL_CONTINUATION_MARKER, GenerateObjectError, type GenerateObjectOptions, type GenerateObjectResult, GetAgentOptions, GetRunOptions, GoalEvent, type GoalLoopAgent, GoalOptions, GoalResult, InlineSkill, JobQueue, type JobQueueOptions, JudgeCredentialError, type JudgeResult, type KeepReason, type KeptArtifact, LayerOrderError, type LayerValues, ListAgentsOptions, ListResult, ListRunsOptions, type LiveAgentRegistry, LiveSessionError, type LiveSessionReason, LocalOptions, type ManagedSettings, McpServerConfig, Memory, MemoryId, type MemoryProvider, MemorySettings, type MigrateOptions, type MigrateResult, type ModelListItem, type ModelParameterDefinition, ModelSelection, type ModelVariant, NoopMemoryProvider, type NormalizedJsonSchema, type OTelSpan, type PermissionAction, PermissionEngine, type PermissionEngineOptions, type PermissionFloorContext, type PermissionGate, type PermissionGateContext, type PermissionGateDecision, PermissionMode, PermissionPlugin, type PermissionPluginOptions, type PermissionRule, type PermissionRuleSet, Plugin, PluginsSettings, PreToolCallDecision, type Processor, Provider, type ProviderProfile, ProviderRoutingSettings, type ReadSessionMessagesOptions, type ReapPlan, type ReapPlanInput, type ReapableArtifact, type RetentionPolicy, RetentionPolicyError, Run, RunEventSink$1 as RunEventSink, RunResult, type SDKAgent, SDKAgentInfo, SDKMessage, type SDKModel, SDKProvider, type SDKRepository, type SDKUser, SOVEREIGN_ENV_KEYS, Security, type SecurityFloorInput, type SessionMessage, type SessionMessagePart, type SessionScope, type ShareGptMessage, type ShareGptTrajectory, SkillReadTool, SkillsSettings, type SovereignEnvKey, Squad, type SquadOptions, type SquadRun, StreamObjectError, type StreamObjectEvent, type StreamObjectOptions, SystemPromptResolver, TASK_RESERVED_PREFIXES, Task, type TaskCancelResult, type TaskConfigureOptions, type TaskEvent, type TaskFilter, type TaskHandle, type TaskKind, type TaskState, type TaskStoreOptions, type TaskSubmitOptions, type TaskWorkContext, type TaskWorkFn, type TelemetryHandle, Theokit, TheokitAgentError, type TheokitRequestOptions, TokenLimiter, type TokenLimiterOptions, Tool, ToolError, type ToolResultContentBlock, type TrustLevel, type TrustPosture, type TrustPostureInput, type TrustSource, UngatedCapabilityError, UnicodeNormalizer, type UnicodeNormalizerOptions, type UnresolvedToolSource, UsageAccumulator, type WiredEntity, type WiringRecordInput, type WithBlastRadius, applyMode, applySecurityFloor, auditEnvReachability, chargeAndCheckThresholds, computeCost, createCounterBudgetTracker, createTokenLimiter, createUnicodeNormalizer, decideApproval, describeAction, describeCredential, effectiveToolNames, emitRunEvent, estimateTokens, evaluateBlastRadius, extractRawId, foldLayers, getPricingEntry, guardSessionDestruction, inferApiMode, isInside, isValidTaskId, loadProjectEnv, managedSettingsPathFor, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, parsePermissionRules, permissionFloorReason, planReaping, preflightCheck, readManagedSettings, readSessionMessages, recordWiring, resolveTrustPosture, runGoalLoop, scopedConversationId, sessionScopePrefix, setDiagnosticsSink, toShareGptTrajectory, verifyLayerOrdering, withBlastRadius, withCwdMutex };
4488
+ export { Agent, AgentBuilder, type AgentBuilderDeps, AgentDefinition, type AgentDescription, AgentFactory, AgentOperationOptions, AgentOptions, type AgentPromptResult, type AgentRegistryOptions, type ApprovalDecision, type ApprovalInput, type ApprovalMode, type ApprovalOutcome, type ApprovalReason, type BatchItem, type BatchOptions, type BatchProgress, type BatchResult, type BlastRadiusDecision, type BlastRadiusInput, type BlastRadiusOutcome, type BlastRadiusReason, Budget, BudgetHandle, BudgetOptions, BudgetSnapshot, type BudgetTracker, BuiltinToolName, CloudOptions, ContextSettings, type CounterBudgetTrackerOptions, type CredentialInput, type CredentialReport, type CustomTool, type DeclaredAction, type DeclaredLayer, type DeepPartial, type DefineProviderOptions, type DefineToolSpec, type DiagnosticsSink, type DreamingSweepOptions, type DreamingSweepResult, type EffectiveToolCatalog, type EnvOptOut, type EnvReachabilityAudit, type EnvReachabilityInput, ErrorMetadata, EventBus, type EvictReason, GOAL_CONTINUATION_MARKER, GenerateObjectError, type GenerateObjectOptions, type GenerateObjectResult, GetAgentOptions, GetRunOptions, GoalEvent, type GoalLoopAgent, GoalOptions, GoalResult, InlineSkill, JobQueue, type JobQueueOptions, JudgeCredentialError, type JudgeResult, type KeepReason, type KeptArtifact, LayerOrderError, type LayerValues, ListAgentsOptions, ListResult, ListRunsOptions, type LiveAgentRegistry, LiveSessionError, type LiveSessionReason, LocalOptions, type ManagedSettings, McpServerConfig, Memory, MemoryId, type MemoryProvider, MemorySettings, type MigrateOptions, type MigrateResult, type ModelListItem, type ModelParameterDefinition, ModelSelection, type ModelVariant, NoopMemoryProvider, type NormalizedJsonSchema, type OTelSpan, type PermissionAction, PermissionEngine, type PermissionEngineOptions, type PermissionFloorContext, type PermissionGate, type PermissionGateContext, type PermissionGateDecision, PermissionMode, PermissionPlugin, type PermissionPluginOptions, type PermissionRule, type PermissionRuleSet, Plugin, PluginsSettings, PreToolCallDecision, type Processor, Provider, type ProviderProfile, ProviderRoutingSettings, type ReadSessionMessagesOptions, type ReapPlan, type ReapPlanInput, type ReapableArtifact, type RetentionPolicy, RetentionPolicyError, Run, RunEventSink$1 as RunEventSink, RunResult, type SDKAgent, SDKAgentInfo, SDKMessage, type SDKModel, SDKProvider, type SDKRepository, type SDKUser, SOVEREIGN_ENV_KEYS, Security, type SecurityFloorInput, type SessionMessage, type SessionMessagePart, type SessionScope, type ShareGptMessage, type ShareGptTrajectory, SkillReadTool, SkillsSettings, type SovereignEnvKey, Squad, type SquadOptions, type SquadRun, StreamObjectError, type StreamObjectEvent, type StreamObjectOptions, SystemPromptResolver, TASK_RESERVED_PREFIXES, Task, type TaskCancelResult, type TaskConfigureOptions, type TaskEvent, type TaskFilter, type TaskHandle, type TaskKind, type TaskState, type TaskStoreOptions, type TaskSubmitOptions, type TaskWorkContext, type TaskWorkFn, type TelemetryHandle, Theokit, TheokitAgentError, type TheokitRequestOptions, TokenLimiter, type TokenLimiterOptions, Tool, ToolError, type ToolResultContentBlock, type TrustLevel, type TrustPosture, type TrustPostureInput, type TrustSource, UngatedCapabilityError, UnicodeNormalizer, type UnicodeNormalizerOptions, type UnresolvedToolSource, UsageAccumulator, type WiredEntity, type WiringRecordInput, type WithBlastRadius, applyMode, applySecurityFloor, auditEnvReachability, chargeAndCheckThresholds, computeCost, createCounterBudgetTracker, createTokenLimiter, createUnicodeNormalizer, decideApproval, describeAction, describeCredential, effectiveToolNames, emitRunEvent, estimateTokens, evaluateBlastRadius, extractRawId, foldLayers, getPricingEntry, guardSessionDestruction, inferApiMode, isInside, isValidTaskId, loadProjectEnv, managedSettingsPathFor, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, parsePermissionRules, permissionFloorReason, planReaping, preflightCheck, readManagedSettings, readSessionMessages, recordWiring, resolveTrustPosture, runGoalLoop, scopedConversationId, sessionScopePrefix, setDiagnosticsSink, toShareGptTrajectory, verifyLayerOrdering, withBlastRadius };
package/dist/index.d.ts CHANGED
@@ -1,19 +1,20 @@
1
- import { TokenUsage } from "./types/index.js";
2
1
  import { T as TheokitAgentError, E as ErrorMetadata } from './errors-base-B5g01neU.js';
3
2
  export { a as ErrorCode } from './errors-base-B5g01neU.js';
4
- import { A as AgentOptions, L as LocalOptions, B as BuiltinToolName, M as MemorySettings, S as SystemPromptResolver, C as CloudOptions, a as AgentDefinition, b as SkillsSettings, c as ListAgentsOptions, d as ListResult, e as SDKAgentInfo, G as GetAgentOptions, f as ListRunsOptions, g as GetRunOptions, h as AgentOperationOptions, i as AgentDescription, P as Plugin$1, j as ProviderProfile, I as InlineSkill, k as Skill, l as BudgetTracker, m as MemoryProvider, n as PreToolCallDecision } from './agent-Dfw3VsIX.js';
5
- export { o as ActiveMemoryPassArgs, p as ActiveMemoryPassResult, q as AgentSubagentDescription, r as AgentToolDescription, s as BudgetCheck, t as BudgetTotal, u as BudgetUsageEvent, v as CloudEnv, w as CloudRepo, x as CompatSource, y as CompatSourceAdapter, z as CompatSurface, D as CreateSkillSpec, H as HookApprovalGate, E as HookApprovalRequest, F as HookName, J as LlmCallContext, K as MemoryProviderAgentRef, N as MemoryProviderFactory, O as MemoryProviderHandle, Q as MemoryProviderInitOptions, R as PluginContext, T as PluginHookDisposer, U as PostAssistantReplyContext, V as PostToolCallContext, W as PreToolCallContext, X as PreUserSendContext, Y as PreUserSendResult, Z as ProviderTransform, _ as ProviderTransformContext, $ as RecordSessionSummaryArgs, a0 as SessionLifecycleContext, a1 as SessionRecord, a2 as SessionStore, a3 as SettingSource, a4 as Skill, a5 as SkillsResolver, a6 as SkillsResolverContext, a7 as SystemPromptContext, a8 as SystemPromptMemoryFact, a9 as TelemetrySettings, aa as ToolCallSummary, ab as ToolContext, ac as ToolResultTransformContext, ad as TransformContext } from './agent-Dfw3VsIX.js';
6
- import { ac as RunEvent, v as CostBreakdown, R as RunResult, P as ProviderRoutingSettings, S as SDKAgent, M as McpServerConfig, C as ContextSettings, a as PluginsSettings, b as Run, c as Processor, J as JudgeResult, G as GoalOptions, d as GoalEvent, e as GoalResult, f as MemoryId, g as RunEventSink$1, h as SDKProvider, i as SDKMessage } from './sdk-agent-a3fW1xUK.js';
7
- export { A as AgentConversationTurn, j as AgentMemory, k as AgentOperation, l as AssistantMessage, m as CompletionCheck, n as CompletionCheckResult, o as ContextBudget, p as ContextManagerKind, q as ContextSnapshot, r as ContextSource, s as ContextSourceStatus, t as ConversationStep, u as ConversationTurn, v as CostBreakdown, w as CostSource, x as CostStatus, D as DoomLoopThresholds, E as EnvPolicy, F as ForkOptions, y as ForkResult, z as GenerateOptions, B as GenerateRunResult, I as InputProcessorContext, H as InteractionUpdate, K as InvalidateCacheOptions, L as McpAuthConfig, N as McpHttpServerConfig, O as McpOAuthConfig, Q as McpStdioServerConfig, T as MemoryAdapter, U as MemoryAdapterCapabilities, V as MemoryContext, W as MemoryFact, X as MemoryRevision, Y as MemoryToolSchema, Z as MemoryTurnMessage, _ as MessageOrigin, $ as OutputProcessorContext, a0 as PartialToolCallUpdate, a1 as PersonalityPreset, a2 as ProcessorControls, a3 as ProcessorTripwire, a4 as ProcessorViolation, a5 as ProviderCapability, a6 as ProviderRoute, a7 as PruneToolResultsOptions, a8 as ResolvedProviderRoute, a9 as RunCompactBoundaryEvent, aa as RunCompletionCheckEvent, ab as RunErrorDetail, ac as RunEvent, ad as RunGitInfo, ae as RunMemoryDegradedEvent, af as RunPermissionDeniedEvent, ag as RunRateLimitEvent, ah as RunStatus, ai as RunTaskCompletedEvent, aj as RunTaskStartedEvent, ak as RunTaskUpdatedEvent, al as RunTimelineEvent, am as RunToCompletionOptions, an as RunToCompletionResult, ao as RunToolProgressEvent, ap as RunTripwireEvent, aq as RunUntilIterator, ar as SDKAgentPlugins, as as SDKAgentSkillDetail, at as SDKAgentSkills, au as SDKArtifact, av as SDKAssistantMessage, aw as SDKContextManager, ax as SDKImage, ay as SDKImageDimension, az as SDKObjectDelta, aA as SDKPluginMetadata, aB as SDKProvidersManager, aC as SDKRequestMessage, aD as SDKStatusMessage, aE as SDKSystemMessage, aF as SDKTaskMessage, aG as SDKThinkingMessage, aH as SDKToolUseMessage, aI as SDKUserMessage, aJ as SDKUserMessageEvent, aK as SendOptions, aL as ShellCommand, aM as ShellConversationTurn, aN as ShellOutput, aO as ShellOutputDeltaUpdate, aP as StepCompletedUpdate, aQ as StepStartedUpdate, aR as StreamToCompletionResult, aS as SummaryCompletedUpdate, aT as SummaryStartedUpdate, aU as SummaryUpdate, aV as SystemPromptSkillRef, aW as TextDeltaUpdate, aX as ThinkingCompletedUpdate, aY as ThinkingDeltaUpdate, aZ as ThinkingMessage, a_ as TokenDeltaUpdate, a$ as TokenUsage, b0 as ToolCall, b1 as ToolCallCompletedUpdate, b2 as ToolCallStartedUpdate, b3 as ToolResult, b4 as ToolResultGuardOptions, b5 as ToolUseBlock, b6 as TurnEndedUpdate, b7 as UserMessage, b8 as UserMessageAppendedUpdate, b9 as Verdict } from './sdk-agent-a3fW1xUK.js';
3
+ import { A as AgentOptions, L as LocalOptions, B as BuiltinToolName, M as MemorySettings, S as SystemPromptResolver, C as CloudOptions, a as AgentDefinition, b as SkillsSettings, c as ListAgentsOptions, d as ListResult, e as SDKAgentInfo, G as GetAgentOptions, f as ListRunsOptions, g as GetRunOptions, h as AgentOperationOptions, i as AgentDescription, P as Plugin$1, j as ProviderProfile, I as InlineSkill, k as Skill, l as BudgetTracker, m as MemoryProvider, n as PreToolCallDecision } from './agent-ByDx7K30.js';
4
+ export { o as ActiveMemoryPassArgs, p as ActiveMemoryPassResult, q as AgentSubagentDescription, r as AgentToolDescription, s as BudgetCheck, t as BudgetTotal, u as BudgetUsageEvent, v as CloudEnv, w as CloudRepo, x as CompatSource, y as CompatSourceAdapter, z as CompatSurface, D as CreateSkillSpec, H as HookApprovalGate, E as HookApprovalRequest, F as HookName, J as LlmCallContext, K as MemoryProviderAgentRef, N as MemoryProviderFactory, O as MemoryProviderHandle, Q as MemoryProviderInitOptions, R as PluginContext, T as PluginHookDisposer, U as PostAssistantReplyContext, V as PostToolCallContext, W as PreToolCallContext, X as PreUserSendContext, Y as PreUserSendResult, Z as ProviderTransform, _ as ProviderTransformContext, $ as RecordSessionSummaryArgs, a0 as SessionLifecycleContext, a1 as SettingSource, a2 as Skill, a3 as SkillsResolver, a4 as SkillsResolverContext, a5 as SystemPromptContext, a6 as SystemPromptMemoryFact, a7 as TelemetrySettings, a8 as ToolCallSummary, a9 as ToolContext, aa as ToolResultTransformContext, ab as TransformContext } from './agent-ByDx7K30.js';
5
+ import { ad as RunEvent, v as CostBreakdown, b0 as TokenUsage, R as RunResult, P as ProviderRoutingSettings, S as SDKAgent, M as McpServerConfig, C as ContextSettings, a as PluginsSettings, b as Run, c as Processor, J as JudgeResult, G as GoalOptions, d as GoalEvent, e as GoalResult, f as MemoryId, g as RunEventSink$1, h as SDKProvider, i as SDKMessage } from './sdk-agent-CnwPODYH.js';
6
+ export { A as AgentConversationTurn, j as AgentMemory, k as AgentOperation, l as AssistantMessage, m as CompletionCheck, n as CompletionCheckResult, o as ContextBudget, p as ContextManagerKind, q as ContextSnapshot, r as ContextSource, s as ContextSourceStatus, t as ConversationStep, u as ConversationTurn, v as CostBreakdown, w as CostSource, x as CostStatus, D as DoomLoopThresholds, E as EnvPolicy, F as ForkOptions, y as ForkResult, z as GenerateOptions, B as GenerateRunResult, I as InputProcessorContext, H as InteractionUpdate, K as InvalidateCacheOptions, L as McpAuthConfig, N as McpHttpServerConfig, O as McpOAuthConfig, Q as McpStdioServerConfig, T as MemoryAdapter, U as MemoryAdapterCapabilities, V as MemoryContext, W as MemoryFact, X as MemoryRevision, Y as MemoryToolSchema, Z as MemoryTurnMessage, _ as MessageOrigin, $ as OutputProcessorContext, a0 as PartialToolCallUpdate, a1 as PersonalityPreset, a2 as ProcessorControls, a3 as ProcessorTripwire, a4 as ProcessorViolation, a5 as ProviderCapability, a6 as ProviderRoute, a7 as PruneToolResultsOptions, a8 as QueueMode, a9 as ResolvedProviderRoute, aa as RunCompactBoundaryEvent, ab as RunCompletionCheckEvent, ac as RunErrorDetail, ad as RunEvent, ae as RunGitInfo, af as RunMemoryDegradedEvent, ag as RunPermissionDeniedEvent, ah as RunRateLimitEvent, ai as RunStatus, aj as RunTaskCompletedEvent, ak as RunTaskStartedEvent, al as RunTaskUpdatedEvent, am as RunTimelineEvent, an as RunToCompletionOptions, ao as RunToCompletionResult, ap as RunToolProgressEvent, aq as RunTripwireEvent, ar as RunUntilIterator, as as SDKAgentPlugins, at as SDKAgentSkillDetail, au as SDKAgentSkills, av as SDKArtifact, aw as SDKAssistantMessage, ax as SDKContextManager, ay as SDKImage, az as SDKImageDimension, aA as SDKObjectDelta, aB as SDKPluginMetadata, aC as SDKProvidersManager, aD as SDKRequestMessage, aE as SDKStatusMessage, aF as SDKSystemMessage, aG as SDKTaskMessage, aH as SDKThinkingMessage, aI as SDKToolUseMessage, aJ as SDKUserMessage, aK as SDKUserMessageEvent, aL as SendOptions, aM as ShellCommand, aN as ShellConversationTurn, aO as ShellOutput, aP as ShellOutputDeltaUpdate, aQ as StepCompletedUpdate, aR as StepStartedUpdate, aS as StreamToCompletionResult, aT as SummaryCompletedUpdate, aU as SummaryStartedUpdate, aV as SummaryUpdate, aW as SystemPromptSkillRef, aX as TextDeltaUpdate, aY as ThinkingCompletedUpdate, aZ as ThinkingDeltaUpdate, a_ as ThinkingMessage, a$ as TokenDeltaUpdate, b0 as TokenUsage, b1 as ToolCall, b2 as ToolCallCompletedUpdate, b3 as ToolCallStartedUpdate, b4 as ToolResult, b5 as ToolResultGuardOptions, b6 as ToolUseBlock, b7 as TurnEndedUpdate, b8 as UserMessage, b9 as UserMessageAppendedUpdate, ba as Verdict } from './sdk-agent-CnwPODYH.js';
8
7
  import * as zod from 'zod';
9
8
  import { ZodType, z } from 'zod';
10
9
  import { S as StructuredOutputError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot } from './errors-Pf22PJJ-.js';
11
10
  export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, I as IntegrationNotConnectedError, m as InvalidTaskIdError, M as MemoryAdapterError, n as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, T as TaskNotFoundError, U as UnknownAgentError, o as UnsupportedBudgetOperationError, p as UnsupportedRunOperationError, q as UnsupportedTaskOperationError, r as isTransientError } from './errors-Pf22PJJ-.js';
12
11
  import { M as ModelSelection, C as CustomTool, T as ToolResultContentBlock, P as PermissionMode } from './agent-prims-CZyxfCmS.js';
13
12
  export { I as ImageBlock, a as ModelParameterValue, R as RunOperation, b as TextBlock, c as ToolContextMessage } from './agent-prims-CZyxfCmS.js';
14
- export { C as Cron, a as CronCreateOptions, b as CronGetOptions, c as CronJob, d as CronJobStatus, e as CronListOptions, f as CronOperationOptions, g as CronRunOptions, h as CronRuntime, i as CronSchedulerStatus, j as CronStartOptions } from './cron-BubDpFJG.js';
13
+ export { C as Cron, a as CronCreateOptions, b as CronGetOptions, c as CronJob, d as CronJobStatus, e as CronListOptions, f as CronOperationOptions, g as CronRunOptions, h as CronRuntime, i as CronSchedulerStatus, j as CronStartOptions } from './cron-FEO7UAQF.js';
14
+ export { S as SqliteSessionStore, a as SqliteSessionStoreOptions, w as withCwdMutex } from './sqlite-session-store-BbcpKY1L.js';
15
15
  import { StepResult } from './workflow.js';
16
16
  export { Workflow, agentStep, fn } from './workflow.js';
17
+ export { S as SessionRecord, a as SessionStore } from './session-store-Dh07jr9N.js';
17
18
 
18
19
  /**
19
20
  * Public compaction / context-management helpers (M2-1, extended V3-3).
@@ -800,9 +801,8 @@ declare class Agent {
800
801
  * The agent-builder's M85 interrupt rotates the session id to work around a
801
802
  * constraint that does not exist.
802
803
  *
803
- * - `close()` marks the handle disposed WITHOUT evicting the cache entry. It is
804
- * internal and unused today; if it becomes reachable, this bullet stops being true
805
- * for that path.
804
+ * - `close()` marks the handle disposed AND drops its cache entry, so the next call
805
+ * builds a fresh handle.
806
806
  *
807
807
  * @public
808
808
  */
@@ -2163,42 +2163,6 @@ declare function setDiagnosticsSink(next: DiagnosticsSink | undefined): void;
2163
2163
  */
2164
2164
  declare function emitRunEvent(sink: RunEventSink$1 | undefined, event: RunEvent): void;
2165
2165
 
2166
- /**
2167
- * Run `fn` after every earlier `withCwdMutex` call for the same `key` has settled, and return
2168
- * what `fn` returns.
2169
- *
2170
- * Calls with the same key run strictly in the order they were made — FIFO, never concurrent.
2171
- * Calls with different keys never wait on each other. The key is an opaque string: two callers
2172
- * serialize against each other exactly when they pass equal keys, so a shared key IS the
2173
- * contract, and a mismatched one silently buys no protection at all.
2174
- *
2175
- * A rejection does not poison the queue. The next waiter runs whether the previous `fn` fulfilled
2176
- * or rejected, and the rejection is delivered only to the caller whose `fn` threw. This function
2177
- * neither retries nor swallows: the returned promise rejects with whatever `fn` rejected with.
2178
- *
2179
- * There is no timeout and no cancellation. An `fn` that never settles blocks that key for the
2180
- * lifetime of the process.
2181
- *
2182
- * **Scope — this is an in-process lock only.** State is a module-scoped Map, so it serializes
2183
- * callers that share one module instance and nothing else. Two processes, two worker threads, or
2184
- * two copies of the SDK resolved into the same tree do not see each other's queue. When the
2185
- * resource is a file that other processes can also write, use `withFileLock` from
2186
- * `./file-lock.ts` instead — it takes an OS-level lock and layers this mutex underneath, so it
2187
- * gives both guarantees. Reach for `withCwdMutex` directly when the shared state is in memory, or
2188
- * when the file is one only this process touches.
2189
- *
2190
- * Extracted packages (`@theokit/sdk-budget`, `@theokit/sdk-memory`) import this from
2191
- * `@theokit/sdk` rather than reimplementing it, precisely so the Map is the same one: a per-package
2192
- * copy would give each package its own queue and let their writes race.
2193
- *
2194
- * The Map is module-scoped, so nothing survives a process restart or a fresh module instance, and
2195
- * its entries are never removed — pass keys from a bounded set rather than from arbitrary input.
2196
- * Signature and semantics will not change before sdk-core v3.0.
2197
- *
2198
- * @public
2199
- */
2200
- declare function withCwdMutex<T>(key: string, fn: () => Promise<T>): Promise<T>;
2201
-
2202
2166
  /**
2203
2167
  * What an operator may impose. One key today, and the shape is the point: each addition is a control
2204
2168
  * that already exists somewhere below and is being lifted into a tier the project cannot reach.
@@ -4521,4 +4485,4 @@ interface WiringRecordInput<K extends string> {
4521
4485
  */
4522
4486
  declare function recordWiring<K extends string>(input: WiringRecordInput<K>): Readonly<Record<K, WiredEntity>>;
4523
4487
 
4524
- export { Agent, AgentBuilder, type AgentBuilderDeps, AgentDefinition, type AgentDescription, AgentFactory, AgentOperationOptions, AgentOptions, type AgentPromptResult, type AgentRegistryOptions, type ApprovalDecision, type ApprovalInput, type ApprovalMode, type ApprovalOutcome, type ApprovalReason, type BatchItem, type BatchOptions, type BatchProgress, type BatchResult, type BlastRadiusDecision, type BlastRadiusInput, type BlastRadiusOutcome, type BlastRadiusReason, Budget, BudgetHandle, BudgetOptions, BudgetSnapshot, type BudgetTracker, BuiltinToolName, CloudOptions, ContextSettings, type CounterBudgetTrackerOptions, type CredentialInput, type CredentialReport, type CustomTool, type DeclaredAction, type DeclaredLayer, type DeepPartial, type DefineProviderOptions, type DefineToolSpec, type DiagnosticsSink, type DreamingSweepOptions, type DreamingSweepResult, type EffectiveToolCatalog, type EnvOptOut, type EnvReachabilityAudit, type EnvReachabilityInput, ErrorMetadata, EventBus, type EvictReason, GOAL_CONTINUATION_MARKER, GenerateObjectError, type GenerateObjectOptions, type GenerateObjectResult, GetAgentOptions, GetRunOptions, GoalEvent, type GoalLoopAgent, GoalOptions, GoalResult, InlineSkill, JobQueue, type JobQueueOptions, JudgeCredentialError, type JudgeResult, type KeepReason, type KeptArtifact, LayerOrderError, type LayerValues, ListAgentsOptions, ListResult, ListRunsOptions, type LiveAgentRegistry, LiveSessionError, type LiveSessionReason, LocalOptions, type ManagedSettings, McpServerConfig, Memory, MemoryId, type MemoryProvider, MemorySettings, type MigrateOptions, type MigrateResult, type ModelListItem, type ModelParameterDefinition, ModelSelection, type ModelVariant, NoopMemoryProvider, type NormalizedJsonSchema, type OTelSpan, type PermissionAction, PermissionEngine, type PermissionEngineOptions, type PermissionFloorContext, type PermissionGate, type PermissionGateContext, type PermissionGateDecision, PermissionMode, PermissionPlugin, type PermissionPluginOptions, type PermissionRule, type PermissionRuleSet, Plugin, PluginsSettings, PreToolCallDecision, type Processor, Provider, type ProviderProfile, ProviderRoutingSettings, type ReadSessionMessagesOptions, type ReapPlan, type ReapPlanInput, type ReapableArtifact, type RetentionPolicy, RetentionPolicyError, Run, RunEventSink$1 as RunEventSink, RunResult, type SDKAgent, SDKAgentInfo, SDKMessage, type SDKModel, SDKProvider, type SDKRepository, type SDKUser, SOVEREIGN_ENV_KEYS, Security, type SecurityFloorInput, type SessionMessage, type SessionMessagePart, type SessionScope, type ShareGptMessage, type ShareGptTrajectory, SkillReadTool, SkillsSettings, type SovereignEnvKey, Squad, type SquadOptions, type SquadRun, StreamObjectError, type StreamObjectEvent, type StreamObjectOptions, SystemPromptResolver, TASK_RESERVED_PREFIXES, Task, type TaskCancelResult, type TaskConfigureOptions, type TaskEvent, type TaskFilter, type TaskHandle, type TaskKind, type TaskState, type TaskStoreOptions, type TaskSubmitOptions, type TaskWorkContext, type TaskWorkFn, type TelemetryHandle, Theokit, TheokitAgentError, type TheokitRequestOptions, TokenLimiter, type TokenLimiterOptions, Tool, ToolError, type ToolResultContentBlock, type TrustLevel, type TrustPosture, type TrustPostureInput, type TrustSource, UngatedCapabilityError, UnicodeNormalizer, type UnicodeNormalizerOptions, type UnresolvedToolSource, UsageAccumulator, type WiredEntity, type WiringRecordInput, type WithBlastRadius, applyMode, applySecurityFloor, auditEnvReachability, chargeAndCheckThresholds, computeCost, createCounterBudgetTracker, createTokenLimiter, createUnicodeNormalizer, decideApproval, describeAction, describeCredential, effectiveToolNames, emitRunEvent, estimateTokens, evaluateBlastRadius, extractRawId, foldLayers, getPricingEntry, guardSessionDestruction, inferApiMode, isInside, isValidTaskId, loadProjectEnv, managedSettingsPathFor, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, parsePermissionRules, permissionFloorReason, planReaping, preflightCheck, readManagedSettings, readSessionMessages, recordWiring, resolveTrustPosture, runGoalLoop, scopedConversationId, sessionScopePrefix, setDiagnosticsSink, toShareGptTrajectory, verifyLayerOrdering, withBlastRadius, withCwdMutex };
4488
+ export { Agent, AgentBuilder, type AgentBuilderDeps, AgentDefinition, type AgentDescription, AgentFactory, AgentOperationOptions, AgentOptions, type AgentPromptResult, type AgentRegistryOptions, type ApprovalDecision, type ApprovalInput, type ApprovalMode, type ApprovalOutcome, type ApprovalReason, type BatchItem, type BatchOptions, type BatchProgress, type BatchResult, type BlastRadiusDecision, type BlastRadiusInput, type BlastRadiusOutcome, type BlastRadiusReason, Budget, BudgetHandle, BudgetOptions, BudgetSnapshot, type BudgetTracker, BuiltinToolName, CloudOptions, ContextSettings, type CounterBudgetTrackerOptions, type CredentialInput, type CredentialReport, type CustomTool, type DeclaredAction, type DeclaredLayer, type DeepPartial, type DefineProviderOptions, type DefineToolSpec, type DiagnosticsSink, type DreamingSweepOptions, type DreamingSweepResult, type EffectiveToolCatalog, type EnvOptOut, type EnvReachabilityAudit, type EnvReachabilityInput, ErrorMetadata, EventBus, type EvictReason, GOAL_CONTINUATION_MARKER, GenerateObjectError, type GenerateObjectOptions, type GenerateObjectResult, GetAgentOptions, GetRunOptions, GoalEvent, type GoalLoopAgent, GoalOptions, GoalResult, InlineSkill, JobQueue, type JobQueueOptions, JudgeCredentialError, type JudgeResult, type KeepReason, type KeptArtifact, LayerOrderError, type LayerValues, ListAgentsOptions, ListResult, ListRunsOptions, type LiveAgentRegistry, LiveSessionError, type LiveSessionReason, LocalOptions, type ManagedSettings, McpServerConfig, Memory, MemoryId, type MemoryProvider, MemorySettings, type MigrateOptions, type MigrateResult, type ModelListItem, type ModelParameterDefinition, ModelSelection, type ModelVariant, NoopMemoryProvider, type NormalizedJsonSchema, type OTelSpan, type PermissionAction, PermissionEngine, type PermissionEngineOptions, type PermissionFloorContext, type PermissionGate, type PermissionGateContext, type PermissionGateDecision, PermissionMode, PermissionPlugin, type PermissionPluginOptions, type PermissionRule, type PermissionRuleSet, Plugin, PluginsSettings, PreToolCallDecision, type Processor, Provider, type ProviderProfile, ProviderRoutingSettings, type ReadSessionMessagesOptions, type ReapPlan, type ReapPlanInput, type ReapableArtifact, type RetentionPolicy, RetentionPolicyError, Run, RunEventSink$1 as RunEventSink, RunResult, type SDKAgent, SDKAgentInfo, SDKMessage, type SDKModel, SDKProvider, type SDKRepository, type SDKUser, SOVEREIGN_ENV_KEYS, Security, type SecurityFloorInput, type SessionMessage, type SessionMessagePart, type SessionScope, type ShareGptMessage, type ShareGptTrajectory, SkillReadTool, SkillsSettings, type SovereignEnvKey, Squad, type SquadOptions, type SquadRun, StreamObjectError, type StreamObjectEvent, type StreamObjectOptions, SystemPromptResolver, TASK_RESERVED_PREFIXES, Task, type TaskCancelResult, type TaskConfigureOptions, type TaskEvent, type TaskFilter, type TaskHandle, type TaskKind, type TaskState, type TaskStoreOptions, type TaskSubmitOptions, type TaskWorkContext, type TaskWorkFn, type TelemetryHandle, Theokit, TheokitAgentError, type TheokitRequestOptions, TokenLimiter, type TokenLimiterOptions, Tool, ToolError, type ToolResultContentBlock, type TrustLevel, type TrustPosture, type TrustPostureInput, type TrustSource, UngatedCapabilityError, UnicodeNormalizer, type UnicodeNormalizerOptions, type UnresolvedToolSource, UsageAccumulator, type WiredEntity, type WiringRecordInput, type WithBlastRadius, applyMode, applySecurityFloor, auditEnvReachability, chargeAndCheckThresholds, computeCost, createCounterBudgetTracker, createTokenLimiter, createUnicodeNormalizer, decideApproval, describeAction, describeCredential, effectiveToolNames, emitRunEvent, estimateTokens, evaluateBlastRadius, extractRawId, foldLayers, getPricingEntry, guardSessionDestruction, inferApiMode, isInside, isValidTaskId, loadProjectEnv, managedSettingsPathFor, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, parsePermissionRules, permissionFloorReason, planReaping, preflightCheck, readManagedSettings, readSessionMessages, recordWiring, resolveTrustPosture, runGoalLoop, scopedConversationId, sessionScopePrefix, setDiagnosticsSink, toShareGptTrajectory, verifyLayerOrdering, withBlastRadius };
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-NAVUTK6X.js';
12
- import { MEMORY_EMBEDDING_ADAPTERS, resolveSessionDir, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-GARVAUCU.js';
13
- export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry, managedSettingsPathFor, readManagedSettings } from './chunk-GARVAUCU.js';
12
+ export { Cron } from './chunk-O2RCS3SJ.js';
13
+ import { MEMORY_EMBEDDING_ADAPTERS, resolveSessionDir, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-ZQWRUJHE.js';
14
+ export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry, managedSettingsPathFor, readManagedSettings } from './chunk-ZQWRUJHE.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-3ONIVO2I.js';
17
+ import './chunk-VNRNZ3WI.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-ZOL3L4EH.js';
27
- export { inferApiMode, normalizeUsage } from './chunk-ZOL3L4EH.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-26GI3OYA.js';
28
+ export { inferApiMode, normalizeUsage } from './chunk-26GI3OYA.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';
@@ -53,20 +55,20 @@ 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-NVQSBRG6.js';
68
+ import './chunk-CBBT42VX.js';
67
69
  import { parseModelId } from './chunk-R7WIIPUR.js';
68
- import './chunk-ULEK4OM4.js';
69
- import { registerBuiltins, listProviders, getCatalogCapabilities, getProviderProfile } from './chunk-CJN5CEI3.js';
70
+ import './chunk-YKNBTHMD.js';
71
+ import { registerBuiltins, listProviders, getCatalogCapabilities, getProviderProfile } from './chunk-RZL2W4C3.js';
70
72
  import './chunk-AGACYRJ2.js';
71
73
  import './chunk-3GTN4HOO.js';
72
74
  import './chunk-QD6B6W6I.js';
@@ -77,8 +79,8 @@ 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 { mkdir, readFile, readdir } from 'fs/promises';
81
- import { resolve, normalize, sep, isAbsolute, parse, relative, join, dirname } from 'path';
82
+ import { readFile, readdir } from 'fs/promises';
83
+ import { resolve, normalize, sep, isAbsolute, parse, relative, dirname, join } from 'path';
82
84
  import { z } from 'zod';
83
85
  import { homedir } from 'os';
84
86
 
@@ -1047,208 +1049,6 @@ function foldLayers(entries, accumulatingKeys = []) {
1047
1049
  return combined;
1048
1050
  }
1049
1051
 
1050
- // src/internal/memory/dreaming/phases.ts
1051
- var DEFAULT_DEDUP_THRESHOLD = 0.95;
1052
- var DEFAULT_CLUSTER_THRESHOLD = 0.75;
1053
- var CONSOLIDATABLE_KINDS = /* @__PURE__ */ new Set(["project"]);
1054
- var ATOMIC_KINDS = /* @__PURE__ */ new Set(["user", "feedback", "reference"]);
1055
- function dedupPolicy(fact) {
1056
- if (fact.kind === void 0) return "exact";
1057
- if (ATOMIC_KINDS.has(fact.kind)) return "never";
1058
- return CONSOLIDATABLE_KINDS.has(fact.kind) ? "similar" : "never";
1059
- }
1060
- function normalizeForExactMatch(text) {
1061
- return text.trim().toLowerCase().replace(/\s+/g, " ").replace(/[.!?]+$/, "");
1062
- }
1063
- async function lightPhase(facts, embedding, threshold = DEFAULT_DEDUP_THRESHOLD) {
1064
- if (facts.length <= 1) return { kept: [...facts], duplicatesRemoved: 0 };
1065
- const never = facts.filter((f) => dedupPolicy(f) === "never");
1066
- const exact = facts.filter((f) => dedupPolicy(f) === "exact");
1067
- const similar = facts.filter((f) => dedupPolicy(f) === "similar");
1068
- const seen = /* @__PURE__ */ new Set();
1069
- const exactKept = [];
1070
- let removed = 0;
1071
- for (const f of exact) {
1072
- const key = normalizeForExactMatch(f.text);
1073
- if (seen.has(key)) {
1074
- removed += 1;
1075
- continue;
1076
- }
1077
- seen.add(key);
1078
- exactKept.push(f);
1079
- }
1080
- const sim = similar.length > 1 ? await dedupCandidates(similar, embedding, threshold) : { kept: [...similar], duplicatesRemoved: 0 };
1081
- return {
1082
- kept: [...never, ...exactKept, ...sim.kept],
1083
- duplicatesRemoved: removed + sim.duplicatesRemoved
1084
- };
1085
- }
1086
- async function dedupCandidates(facts, embedding, threshold) {
1087
- if (facts.length <= 1) return { kept: [...facts], duplicatesRemoved: 0 };
1088
- const vectors = await embedding.embed(facts.map((f) => f.text));
1089
- const keptIdx = [];
1090
- const keptVecs = [];
1091
- for (let i = 0; i < facts.length; i++) {
1092
- const vec = vectors[i] ?? [];
1093
- const isDup = keptVecs.some((kept2) => cosineSimilarity(vec, kept2) >= threshold);
1094
- if (isDup) continue;
1095
- keptIdx.push(i);
1096
- keptVecs.push(vec);
1097
- }
1098
- const kept = keptIdx.map((i) => facts[i]);
1099
- return { kept, duplicatesRemoved: facts.length - kept.length };
1100
- }
1101
- var DEFAULT_MAX_FACTS_PER_SWEEP = 500;
1102
- async function remPhase(facts, embedding, threshold = DEFAULT_CLUSTER_THRESHOLD, maxFactsPerSweep = DEFAULT_MAX_FACTS_PER_SWEEP) {
1103
- if (facts.length === 0) return { clusters: [], factsLeftOut: 0 };
1104
- const capped = facts.length > maxFactsPerSweep ? facts.slice(0, maxFactsPerSweep) : facts;
1105
- const vectors = await embedding.embed(capped.map((f) => f.text));
1106
- const clusterOfIdx = unionFindByPairs(vectors, threshold);
1107
- const groups = bucketFactsByClusterRoot(capped, clusterOfIdx);
1108
- return {
1109
- clusters: [...groups.values()].map(buildClusterFromMembers),
1110
- factsLeftOut: facts.length - capped.length
1111
- };
1112
- }
1113
- function unionFindByPairs(vectors, threshold) {
1114
- const clusterOfIdx = vectors.map((_, i) => i);
1115
- for (let i = 0; i < vectors.length; i++) {
1116
- for (let j = i + 1; j < vectors.length; j++) {
1117
- if (cosineSimilarity(vectors[i] ?? [], vectors[j] ?? []) >= threshold) {
1118
- unifyClusters(clusterOfIdx, i, j);
1119
- }
1120
- }
1121
- }
1122
- return clusterOfIdx;
1123
- }
1124
- function bucketFactsByClusterRoot(facts, clusterOfIdx) {
1125
- const groups = /* @__PURE__ */ new Map();
1126
- for (let i = 0; i < facts.length; i++) {
1127
- const root = findRoot(clusterOfIdx, i);
1128
- const list2 = groups.get(root) ?? [];
1129
- list2.push(facts[i]);
1130
- groups.set(root, list2);
1131
- }
1132
- return groups;
1133
- }
1134
- function buildClusterFromMembers(members) {
1135
- const sorted = [...members].sort((a, b) => b.text.length - a.text.length);
1136
- return { representativeText: sorted[0]?.text ?? "", members };
1137
- }
1138
- function deepPhase(clusters, timestampMs) {
1139
- if (clusters.length === 0) return "";
1140
- const isoStamp = new Date(timestampMs).toISOString();
1141
- const lines = [`# Dreamed ${isoStamp}`, ""];
1142
- for (let i = 0; i < clusters.length; i++) {
1143
- const c = clusters[i];
1144
- if (c === void 0) continue;
1145
- lines.push(`## Cluster ${i + 1}: ${c.representativeText}`);
1146
- lines.push("");
1147
- for (const member of c.members) lines.push(`- ${member.text}`);
1148
- lines.push("");
1149
- }
1150
- return `${lines.join("\n")}
1151
- `;
1152
- }
1153
- function cosineSimilarity(a, b) {
1154
- if (a.length === 0 || b.length === 0 || a.length !== b.length) return 0;
1155
- let dot = 0;
1156
- let aNorm = 0;
1157
- let bNorm = 0;
1158
- for (let i = 0; i < a.length; i++) {
1159
- const ai = a[i] ?? 0;
1160
- const bi = b[i] ?? 0;
1161
- dot += ai * bi;
1162
- aNorm += ai * ai;
1163
- bNorm += bi * bi;
1164
- }
1165
- const denom = Math.sqrt(aNorm) * Math.sqrt(bNorm);
1166
- return denom === 0 ? 0 : dot / denom;
1167
- }
1168
- function findRoot(parents, i) {
1169
- let root = i;
1170
- while (parents[root] !== root) {
1171
- const next = parents[root] ?? root;
1172
- if (next === root) break;
1173
- root = next;
1174
- }
1175
- parents[i] = root;
1176
- return root;
1177
- }
1178
- function unifyClusters(parents, a, b) {
1179
- const rootA = findRoot(parents, a);
1180
- const rootB = findRoot(parents, b);
1181
- if (rootA !== rootB) parents[rootB] = rootA;
1182
- }
1183
-
1184
- // src/internal/memory/dreaming/run.ts
1185
- function runDreamingSweep(options) {
1186
- return withCwdMutex(`dream:${options.cwd}`, () => runInner(options));
1187
- }
1188
- async function runInner(options) {
1189
- const now = options.now ?? Date.now;
1190
- const timestampMs = now();
1191
- try {
1192
- const root = options.memoryRoot ?? resolveMemoryRoot(options.cwd);
1193
- const facts = await readFactsFromMarkdown(
1194
- options.cwd,
1195
- options.memoryRoot ? { directory: options.memoryRoot } : void 0
1196
- );
1197
- if (facts.length === 0) {
1198
- return emptyResult("skipped");
1199
- }
1200
- const dedup = await lightPhase(facts, options.embedding, options.dedupThreshold);
1201
- const rem = await remPhase(dedup.kept, options.embedding, options.clusterThreshold);
1202
- const notesWritten = await writeConsolidatedNotes(root, rem.clusters, timestampMs);
1203
- const result = {
1204
- status: "ok",
1205
- factsBefore: facts.length,
1206
- factsAfter: dedup.kept.length,
1207
- duplicatesRemoved: dedup.duplicatesRemoved,
1208
- clustersCreated: rem.clusters.length,
1209
- notesWritten,
1210
- diaryEntryHash: void 0,
1211
- factsLeftOut: rem.factsLeftOut
1212
- };
1213
- await appendDiaryEntry(root, {
1214
- timestampMs,
1215
- factsBefore: result.factsBefore,
1216
- factsAfter: result.factsAfter,
1217
- duplicatesRemoved: result.duplicatesRemoved,
1218
- clustersCreated: result.clustersCreated,
1219
- notesWritten: result.notesWritten
1220
- });
1221
- return result;
1222
- } catch (cause) {
1223
- const message = cause instanceof Error ? cause.message : String(cause);
1224
- diag(`[theokit-sdk] dreaming sweep failed: ${message}
1225
- `);
1226
- return emptyResult("error");
1227
- }
1228
- }
1229
- async function writeConsolidatedNotes(root, clusters, timestampMs) {
1230
- if (clusters.length === 0) return 0;
1231
- const notesDir = join(root, "notes");
1232
- await mkdir(notesDir, { recursive: true });
1233
- const isoSlug = new Date(timestampMs).toISOString().replace(/[^\dT]/g, "-");
1234
- const file = join(notesDir, `dreamed-${isoSlug}.md`);
1235
- const body = deepPhase(clusters, timestampMs);
1236
- await replaceFileAtomic(file, body);
1237
- return 1;
1238
- }
1239
- function emptyResult(status) {
1240
- const result = {
1241
- status,
1242
- factsBefore: 0,
1243
- factsAfter: 0,
1244
- duplicatesRemoved: 0,
1245
- clustersCreated: 0,
1246
- notesWritten: 0,
1247
- diaryEntryHash: void 0
1248
- };
1249
- return status === "skipped" ? { ...result, factsLeftOut: 0 } : result;
1250
- }
1251
-
1252
1052
  // src/internal/memory/sdk-memory-peer-loader.ts
1253
1053
  var cachedAttempt;
1254
1054
  async function loadPeer() {
@@ -1305,7 +1105,7 @@ var Memory = {
1305
1105
  openArgs.embedding = await resolveEmbedding(opts.embedding, peer.MEMORY_EMBEDDING_ADAPTERS);
1306
1106
  return await peer.IndexManager.open(openArgs);
1307
1107
  }
1308
- const { IndexManager } = await import('./index-manager-QDH56FER.js');
1108
+ const { IndexManager } = await import('./index-manager-NF2WRLOU.js');
1309
1109
  openArgs.embedding = await resolveEmbedding(opts.embedding, MEMORY_EMBEDDING_ADAPTERS);
1310
1110
  return await IndexManager.open(openArgs);
1311
1111
  },
@@ -1945,7 +1745,7 @@ function isBuiltAgent(m) {
1945
1745
  return typeof m.send === "function";
1946
1746
  }
1947
1747
  async function materialize(def, index) {
1948
- const { Agent: Agent2 } = await import('./agent-T34LCGQM.js');
1748
+ const { Agent: Agent2 } = await import('./agent-66U5QCPF.js');
1949
1749
  return Agent2.create({
1950
1750
  // `AgentDefinition.model` admits the sentinel `'inherit'`, which is not a model id. Inheriting
1951
1751
  // here means "declare nothing and let the default apply" — forwarding the literal would create