@theokit/sdk 1.5.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 (369) hide show
  1. package/CHANGELOG.md +1571 -0
  2. package/LICENSE +201 -0
  3. package/README.md +80 -0
  4. package/bin/theokit-migrate-config.mjs +269 -0
  5. package/bin/theokit-migrate-memory.mjs +116 -0
  6. package/dist/agent-builder.d.ts +52 -0
  7. package/dist/agent-factory.d.ts +39 -0
  8. package/dist/agent.d.ts +175 -0
  9. package/dist/batch.d.ts +11 -0
  10. package/dist/budget.d.ts +48 -0
  11. package/dist/cache.d.ts +74 -0
  12. package/dist/cron-1yxL3K2S.d.cts +221 -0
  13. package/dist/cron-BYVdYzob.d.ts +221 -0
  14. package/dist/cron.cjs +14655 -0
  15. package/dist/cron.cjs.map +1 -0
  16. package/dist/cron.d.cts +3 -0
  17. package/dist/cron.d.ts +71 -0
  18. package/dist/cron.js +14652 -0
  19. package/dist/cron.js.map +1 -0
  20. package/dist/define-tool.d.ts +35 -0
  21. package/dist/errors-CK8brCJ1.d.cts +448 -0
  22. package/dist/errors-CvAeEWgE.d.ts +448 -0
  23. package/dist/errors.cjs +255 -0
  24. package/dist/errors.cjs.map +1 -0
  25. package/dist/errors.d.cts +3 -0
  26. package/dist/errors.d.ts +356 -0
  27. package/dist/errors.js +238 -0
  28. package/dist/errors.js.map +1 -0
  29. package/dist/eval.cjs +14826 -0
  30. package/dist/eval.cjs.map +1 -0
  31. package/dist/eval.d.cts +35 -0
  32. package/dist/eval.d.ts +35 -0
  33. package/dist/eval.js +14821 -0
  34. package/dist/eval.js.map +1 -0
  35. package/dist/generate-object.d.ts +67 -0
  36. package/dist/handoff.d.ts +55 -0
  37. package/dist/index.cjs +17127 -0
  38. package/dist/index.cjs.map +1 -0
  39. package/dist/index.d.cts +1878 -0
  40. package/dist/index.d.ts +24 -0
  41. package/dist/index.js +17095 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/internal/agent-loop/loop-types.d.ts +29 -0
  44. package/dist/internal/agent-loop/loop.d.ts +2 -0
  45. package/dist/internal/agent-loop/message-builders.d.ts +6 -0
  46. package/dist/internal/agent-loop/tool-dispatch.d.ts +4 -0
  47. package/dist/internal/agent-loop/usage-and-cost.d.ts +25 -0
  48. package/dist/internal/budget/calendar-window.d.ts +19 -0
  49. package/dist/internal/budget/compute-cost.d.ts +28 -0
  50. package/dist/internal/budget/enforcement.d.ts +32 -0
  51. package/dist/internal/budget/ledger.d.ts +25 -0
  52. package/dist/internal/budget/normalize-usage.d.ts +27 -0
  53. package/dist/internal/budget/pricing-registry.d.ts +36 -0
  54. package/dist/internal/budget/registry.d.ts +16 -0
  55. package/dist/internal/budget/usage-accumulator.d.ts +31 -0
  56. package/dist/internal/cache/cosine.d.ts +14 -0
  57. package/dist/internal/cache/embed-helper.d.ts +15 -0
  58. package/dist/internal/cache/key.d.ts +15 -0
  59. package/dist/internal/cache/lookup.d.ts +28 -0
  60. package/dist/internal/cache/store-handler.d.ts +24 -0
  61. package/dist/internal/cache/store-json.d.ts +48 -0
  62. package/dist/internal/cache/store.d.ts +54 -0
  63. package/dist/internal/cache/telemetry.d.ts +20 -0
  64. package/dist/internal/cache/ttl.d.ts +11 -0
  65. package/dist/internal/catalog/fixtures.d.ts +16 -0
  66. package/dist/internal/catalog/local-models.d.ts +24 -0
  67. package/dist/internal/cron/run-job.d.ts +1 -0
  68. package/dist/internal/cron/scheduler.d.ts +1 -0
  69. package/dist/internal/cron/store.d.ts +1 -0
  70. package/dist/internal/cron/validate.d.ts +1 -0
  71. package/dist/internal/env.d.ts +1 -0
  72. package/dist/internal/errors/mappers/anthropic.d.ts +30 -0
  73. package/dist/internal/errors/mappers/bedrock.d.ts +16 -0
  74. package/dist/internal/errors/mappers/ollama.d.ts +41 -0
  75. package/dist/internal/errors/mappers/openai-compatible.d.ts +25 -0
  76. package/dist/internal/errors/mappers/shared.d.ts +10 -0
  77. package/dist/internal/errors/mappers/vertex.d.ts +15 -0
  78. package/dist/internal/eval/aggregate.d.ts +9 -0
  79. package/dist/internal/eval/dataset-iter.d.ts +9 -0
  80. package/dist/internal/eval/runner.d.ts +9 -0
  81. package/dist/internal/eval/single-flight.d.ts +16 -0
  82. package/dist/internal/eval/telemetry.d.ts +23 -0
  83. package/dist/internal/fixture-mode.d.ts +16 -0
  84. package/dist/internal/handoff/dispatcher.d.ts +29 -0
  85. package/dist/internal/handoff/registry.d.ts +23 -0
  86. package/dist/internal/handoff/telemetry.d.ts +18 -0
  87. package/dist/internal/handoff/tool-injector.d.ts +34 -0
  88. package/dist/internal/http.d.ts +1 -0
  89. package/dist/internal/ids.d.ts +1 -0
  90. package/dist/internal/judge/judge-call.d.ts +35 -0
  91. package/dist/internal/judge/parse-verdict.d.ts +11 -0
  92. package/dist/internal/judge/types.d.ts +17 -0
  93. package/dist/internal/llm/anthropic-shared.d.ts +89 -0
  94. package/dist/internal/llm/anthropic.d.ts +9 -0
  95. package/dist/internal/llm/bedrock-anthropic.d.ts +36 -0
  96. package/dist/internal/llm/bedrock-token-cache.d.ts +18 -0
  97. package/dist/internal/llm/credential-pool-context.d.ts +11 -0
  98. package/dist/internal/llm/credential-pool-types.d.ts +22 -0
  99. package/dist/internal/llm/credential-pool.d.ts +18 -0
  100. package/dist/internal/llm/fallback-client.d.ts +1 -0
  101. package/dist/internal/llm/fault-injection.d.ts +50 -0
  102. package/dist/internal/llm/finish.d.ts +1 -0
  103. package/dist/internal/llm/model-identifier.d.ts +24 -0
  104. package/dist/internal/llm/ollama-native.d.ts +27 -0
  105. package/dist/internal/llm/openai.d.ts +9 -0
  106. package/dist/internal/llm/pool-aware-client.d.ts +16 -0
  107. package/dist/internal/llm/router.d.ts +17 -0
  108. package/dist/internal/llm/sse.d.ts +9 -0
  109. package/dist/internal/llm/stream-relay.d.ts +17 -0
  110. package/dist/internal/llm/types.d.ts +70 -0
  111. package/dist/internal/llm/vertex-anthropic.d.ts +40 -0
  112. package/dist/internal/llm/vertex-auth.d.ts +30 -0
  113. package/dist/internal/llm/vertex-gemini.d.ts +28 -0
  114. package/dist/internal/llm/vertex-router.d.ts +21 -0
  115. package/dist/internal/mcp/client.d.ts +16 -0
  116. package/dist/internal/memory/active-memory-cache.d.ts +10 -0
  117. package/dist/internal/memory/active-memory.d.ts +45 -0
  118. package/dist/internal/memory/adapters/catalog.d.ts +1 -0
  119. package/dist/internal/memory/adapters/deepinfra-embedding.d.ts +2 -0
  120. package/dist/internal/memory/adapters/mistral-embedding.d.ts +2 -0
  121. package/dist/internal/memory/adapters/ollama-embedding.d.ts +34 -0
  122. package/dist/internal/memory/adapters/openai-compatible.d.ts +23 -0
  123. package/dist/internal/memory/adapters/openai-embedding.d.ts +2 -0
  124. package/dist/internal/memory/adapters/openrouter-embedding.d.ts +2 -0
  125. package/dist/internal/memory/adapters/voyage-embedding.d.ts +2 -0
  126. package/dist/internal/memory/atomic-write.d.ts +7 -0
  127. package/dist/internal/memory/chunk-markdown.d.ts +2 -0
  128. package/dist/internal/memory/circuit-breaker.d.ts +22 -0
  129. package/dist/internal/memory/cwd-mutex.d.ts +1 -0
  130. package/dist/internal/memory/dreaming/diary.d.ts +4 -0
  131. package/dist/internal/memory/dreaming/phases.d.ts +15 -0
  132. package/dist/internal/memory/dreaming/run.d.ts +10 -0
  133. package/dist/internal/memory/embedding-adapter.d.ts +42 -0
  134. package/dist/internal/memory/embedding-cache.d.ts +1 -0
  135. package/dist/internal/memory/index-db.d.ts +10 -0
  136. package/dist/internal/memory/index-manager-dispatch.d.ts +23 -0
  137. package/dist/internal/memory/index-manager.d.ts +68 -0
  138. package/dist/internal/memory/index-schema.d.ts +21 -0
  139. package/dist/internal/memory/lance-index.d.ts +32 -0
  140. package/dist/internal/memory/lance-memory-adapter.d.ts +43 -0
  141. package/dist/internal/memory/markdown-store.d.ts +16 -0
  142. package/dist/internal/memory/memory-index.d.ts +52 -0
  143. package/dist/internal/memory/migrate-sqlite-to-lance.d.ts +15 -0
  144. package/dist/internal/memory/migration.d.ts +9 -0
  145. package/dist/internal/memory/reader.d.ts +8 -0
  146. package/dist/internal/memory/session-loader.d.ts +1 -0
  147. package/dist/internal/memory/session-summary-writer.d.ts +2 -0
  148. package/dist/internal/memory/sqlite-vec-loader.d.ts +3 -0
  149. package/dist/internal/memory/tools.d.ts +14 -0
  150. package/dist/internal/memory/transcript-store.d.ts +1 -0
  151. package/dist/internal/memory/types.d.ts +17 -0
  152. package/dist/internal/memory/vec-index.d.ts +28 -0
  153. package/dist/internal/memory/wiki-loader.d.ts +2 -0
  154. package/dist/internal/observability/tracer-loader.d.ts +20 -0
  155. package/dist/internal/persistence/atomic-write.d.ts +1 -0
  156. package/dist/internal/persistence/conversation-storage-fs.d.ts +37 -0
  157. package/dist/internal/persistence/conversation-storage-memory.d.ts +24 -0
  158. package/dist/internal/persistence/cwd-mutex.d.ts +1 -0
  159. package/dist/internal/persistence/file-lock.d.ts +14 -0
  160. package/dist/internal/persistence/fts5-sanitize.d.ts +16 -0
  161. package/dist/internal/persistence/markdown-config-loader.d.ts +35 -0
  162. package/dist/internal/persistence/paths.d.ts +19 -0
  163. package/dist/internal/persistence/persistence-schema.d.ts +17 -0
  164. package/dist/internal/persistence/schema-version.d.ts +13 -0
  165. package/dist/internal/persistence/sqlite-wal.d.ts +10 -0
  166. package/dist/internal/personality/context.d.ts +17 -0
  167. package/dist/internal/personality/registry.d.ts +17 -0
  168. package/dist/internal/personality/store.d.ts +27 -0
  169. package/dist/internal/personality/switch.d.ts +36 -0
  170. package/dist/internal/personality/types.d.ts +18 -0
  171. package/dist/internal/plugins/context.d.ts +31 -0
  172. package/dist/internal/plugins/manager.d.ts +37 -0
  173. package/dist/internal/plugins/types.d.ts +102 -0
  174. package/dist/internal/providers/builtin/anthropic.d.ts +2 -0
  175. package/dist/internal/providers/builtin/bedrock.d.ts +25 -0
  176. package/dist/internal/providers/builtin/gemini.d.ts +10 -0
  177. package/dist/internal/providers/builtin/index.d.ts +19 -0
  178. package/dist/internal/providers/builtin/llamacpp.d.ts +1 -0
  179. package/dist/internal/providers/builtin/lmstudio.d.ts +1 -0
  180. package/dist/internal/providers/builtin/ollama.d.ts +17 -0
  181. package/dist/internal/providers/builtin/openai.d.ts +2 -0
  182. package/dist/internal/providers/builtin/openrouter.d.ts +2 -0
  183. package/dist/internal/providers/builtin/vertex.d.ts +27 -0
  184. package/dist/internal/providers/discovery.d.ts +14 -0
  185. package/dist/internal/providers/index.d.ts +8 -0
  186. package/dist/internal/providers/registry.d.ts +12 -0
  187. package/dist/internal/providers/types.d.ts +27 -0
  188. package/dist/internal/runtime/abort-utils.d.ts +21 -0
  189. package/dist/internal/runtime/agent-factory-registry.d.ts +16 -0
  190. package/dist/internal/runtime/agent-registry-store.d.ts +61 -0
  191. package/dist/internal/runtime/agent-registry.d.ts +34 -0
  192. package/dist/internal/runtime/agent-session-store.d.ts +3 -0
  193. package/dist/internal/runtime/agent-session.d.ts +2 -0
  194. package/dist/internal/runtime/async-local-storage.d.ts +20 -0
  195. package/dist/internal/runtime/async-semaphore.d.ts +24 -0
  196. package/dist/internal/runtime/budget.d.ts +36 -0
  197. package/dist/internal/runtime/cloud-agent.d.ts +1 -0
  198. package/dist/internal/runtime/cloud-config-serializer.d.ts +3 -0
  199. package/dist/internal/runtime/cloud-payload-types.d.ts +56 -0
  200. package/dist/internal/runtime/cloud-run.d.ts +1 -0
  201. package/dist/internal/runtime/cloud-tool-parity.d.ts +1 -0
  202. package/dist/internal/runtime/context-aggregator.d.ts +26 -0
  203. package/dist/internal/runtime/context-discovery-runner.d.ts +27 -0
  204. package/dist/internal/runtime/context-discovery.d.ts +21 -0
  205. package/dist/internal/runtime/context-frontmatter.d.ts +16 -0
  206. package/dist/internal/runtime/context-import-resolver.d.ts +24 -0
  207. package/dist/internal/runtime/context-loaders.d.ts +42 -0
  208. package/dist/internal/runtime/context-manager.d.ts +11 -0
  209. package/dist/internal/runtime/context-mdc-parser.d.ts +24 -0
  210. package/dist/internal/runtime/default-model.d.ts +1 -0
  211. package/dist/internal/runtime/fixture-events.d.ts +12 -0
  212. package/dist/internal/runtime/fixture-responder.d.ts +1 -0
  213. package/dist/internal/runtime/fixture-run-base.d.ts +45 -0
  214. package/dist/internal/runtime/fixture-scripts.d.ts +21 -0
  215. package/dist/internal/runtime/fixture-types.d.ts +1 -0
  216. package/dist/internal/runtime/fork-agent.d.ts +15 -0
  217. package/dist/internal/runtime/hooks-executor.d.ts +35 -0
  218. package/dist/internal/runtime/hooks-frontmatter.d.ts +26 -0
  219. package/dist/internal/runtime/hooks-source.d.ts +22 -0
  220. package/dist/internal/runtime/live-agent-registry.d.ts +87 -0
  221. package/dist/internal/runtime/local-agent-bootstrap.d.ts +37 -0
  222. package/dist/internal/runtime/local-agent-dispatch.d.ts +57 -0
  223. package/dist/internal/runtime/local-agent-invalidate.d.ts +8 -0
  224. package/dist/internal/runtime/local-agent-memory-direct.d.ts +12 -0
  225. package/dist/internal/runtime/local-agent-memory-hooks.d.ts +41 -0
  226. package/dist/internal/runtime/local-agent-memory.d.ts +1 -0
  227. package/dist/internal/runtime/local-agent-personality-extensions.d.ts +19 -0
  228. package/dist/internal/runtime/local-agent-plugins.d.ts +13 -0
  229. package/dist/internal/runtime/local-agent-runtime-extensions.d.ts +13 -0
  230. package/dist/internal/runtime/local-agent-task-wrap.d.ts +11 -0
  231. package/dist/internal/runtime/local-agent.d.ts +1 -0
  232. package/dist/internal/runtime/local-run.d.ts +1 -0
  233. package/dist/internal/runtime/memory-store.d.ts +4 -0
  234. package/dist/internal/runtime/plugin-frontmatter.d.ts +17 -0
  235. package/dist/internal/runtime/plugins-manager.d.ts +1 -0
  236. package/dist/internal/runtime/post-run-lifecycle.d.ts +1 -0
  237. package/dist/internal/runtime/providers-manager.d.ts +1 -0
  238. package/dist/internal/runtime/real-cloud-run.d.ts +2 -0
  239. package/dist/internal/runtime/real-local-run.d.ts +2 -0
  240. package/dist/internal/runtime/run-registry.d.ts +5 -0
  241. package/dist/internal/runtime/run-until.d.ts +22 -0
  242. package/dist/internal/runtime/shell-tool.d.ts +7 -0
  243. package/dist/internal/runtime/skill-frontmatter.d.ts +1 -0
  244. package/dist/internal/runtime/skills-manager.d.ts +1 -0
  245. package/dist/internal/runtime/spawn-collect.d.ts +8 -0
  246. package/dist/internal/runtime/subagents-loader.d.ts +1 -0
  247. package/dist/internal/runtime/system-prompt/escape.d.ts +1 -0
  248. package/dist/internal/runtime/system-prompt/local-assembly.d.ts +1 -0
  249. package/dist/internal/runtime/system-prompt/pipeline.d.ts +1 -0
  250. package/dist/internal/runtime/system-prompt/providers/active-memory-provider.d.ts +1 -0
  251. package/dist/internal/runtime/system-prompt/providers/base-provider.d.ts +1 -0
  252. package/dist/internal/runtime/system-prompt/providers/context-provider.d.ts +1 -0
  253. package/dist/internal/runtime/system-prompt/providers/memory-provider.d.ts +1 -0
  254. package/dist/internal/runtime/system-prompt/providers/skills-provider.d.ts +1 -0
  255. package/dist/internal/runtime/system-prompt/safe-call.d.ts +1 -0
  256. package/dist/internal/runtime/system-prompt/types.d.ts +5 -0
  257. package/dist/internal/runtime/system-prompt.d.ts +1 -0
  258. package/dist/internal/runtime/validate-agent-options.d.ts +1 -0
  259. package/dist/internal/runtime/workspace-dir.d.ts +9 -0
  260. package/dist/internal/runtime/yaml-frontmatter.d.ts +20 -0
  261. package/dist/internal/scorers/llm-judge.d.ts +24 -0
  262. package/dist/internal/security/index.d.ts +11 -0
  263. package/dist/internal/security/path-guard.d.ts +56 -0
  264. package/dist/internal/security/redact.d.ts +21 -0
  265. package/dist/internal/structured-output-helpers.d.ts +54 -0
  266. package/dist/internal/task/registry.d.ts +61 -0
  267. package/dist/internal/task/ring-buffer.d.ts +10 -0
  268. package/dist/internal/task/store.d.ts +59 -0
  269. package/dist/internal/task/subscribe.d.ts +15 -0
  270. package/dist/internal/task/telemetry.d.ts +27 -0
  271. package/dist/internal/telemetry/adapter-registry.d.ts +2 -0
  272. package/dist/internal/telemetry/adapters/langfuse.d.ts +2 -0
  273. package/dist/internal/telemetry/adapters/posthog.d.ts +2 -0
  274. package/dist/internal/telemetry/adapters/sentry.d.ts +2 -0
  275. package/dist/internal/telemetry/safe-require.d.ts +1 -0
  276. package/dist/internal/telemetry/tracer.d.ts +18 -0
  277. package/dist/internal/tool-dispatch/repair-middleware.d.ts +34 -0
  278. package/dist/internal/tool-dispatch/strip-think.d.ts +22 -0
  279. package/dist/internal/tool-registry/personality-filter.d.ts +37 -0
  280. package/dist/internal/workflow/ctx.d.ts +19 -0
  281. package/dist/internal/workflow/error-shape.d.ts +7 -0
  282. package/dist/internal/workflow/executor.d.ts +15 -0
  283. package/dist/internal/workflow/index.d.ts +12 -0
  284. package/dist/internal/workflow/retry-policy.d.ts +14 -0
  285. package/dist/internal/workflow/run-id.d.ts +9 -0
  286. package/dist/internal/workflow/single-flight.d.ts +18 -0
  287. package/dist/internal/workflow/snapshot-store.d.ts +23 -0
  288. package/dist/internal/workflow/step-agent.d.ts +12 -0
  289. package/dist/internal/workflow/step-branch.d.ts +10 -0
  290. package/dist/internal/workflow/step-dowhile.d.ts +8 -0
  291. package/dist/internal/workflow/step-fn.d.ts +10 -0
  292. package/dist/internal/workflow/step-foreach.d.ts +11 -0
  293. package/dist/internal/workflow/step-parallel.d.ts +17 -0
  294. package/dist/internal/workflow/step-sleep.d.ts +7 -0
  295. package/dist/internal/workflow/telemetry.d.ts +23 -0
  296. package/dist/internal/zod/to-json-schema.d.ts +21 -0
  297. package/dist/memory-adapter-helpers.d.ts +28 -0
  298. package/dist/memory.d.ts +123 -0
  299. package/dist/migrate.d.ts +33 -0
  300. package/dist/path-safety.cjs +126 -0
  301. package/dist/path-safety.cjs.map +1 -0
  302. package/dist/path-safety.d.cts +15 -0
  303. package/dist/path-safety.d.ts +15 -0
  304. package/dist/path-safety.js +120 -0
  305. package/dist/path-safety.js.map +1 -0
  306. package/dist/run-DkCD5DeO.d.cts +2181 -0
  307. package/dist/run-DkCD5DeO.d.ts +2181 -0
  308. package/dist/scorers.d.ts +75 -0
  309. package/dist/security.d.ts +67 -0
  310. package/dist/stream-object.d.ts +74 -0
  311. package/dist/task-store.cjs +237 -0
  312. package/dist/task-store.cjs.map +1 -0
  313. package/dist/task-store.d.cts +8 -0
  314. package/dist/task-store.d.ts +8 -0
  315. package/dist/task-store.js +233 -0
  316. package/dist/task-store.js.map +1 -0
  317. package/dist/task.d.ts +87 -0
  318. package/dist/theokit.d.ts +84 -0
  319. package/dist/tools/_path-scope.d.cts +8 -0
  320. package/dist/tools/_path-scope.d.ts +8 -0
  321. package/dist/tools/_subprocess.d.cts +28 -0
  322. package/dist/tools/_subprocess.d.ts +28 -0
  323. package/dist/tools/git-diff.d.cts +22 -0
  324. package/dist/tools/git-diff.d.ts +22 -0
  325. package/dist/tools/index.d.cts +29 -0
  326. package/dist/tools/index.d.ts +29 -0
  327. package/dist/tools/list-dir.d.cts +26 -0
  328. package/dist/tools/list-dir.d.ts +26 -0
  329. package/dist/tools/read-file.d.cts +31 -0
  330. package/dist/tools/read-file.d.ts +31 -0
  331. package/dist/tools/run-vitest.d.cts +46 -0
  332. package/dist/tools/run-vitest.d.ts +46 -0
  333. package/dist/tools/search-text.d.cts +32 -0
  334. package/dist/tools/search-text.d.ts +32 -0
  335. package/dist/tools.cjs +690 -0
  336. package/dist/tools.cjs.map +1 -0
  337. package/dist/tools.js +683 -0
  338. package/dist/tools.js.map +1 -0
  339. package/dist/trajectory-helpers.d.ts +31 -0
  340. package/dist/types/agent.d.ts +771 -0
  341. package/dist/types/batch.d.ts +112 -0
  342. package/dist/types/budget.d.ts +88 -0
  343. package/dist/types/cache.d.ts +76 -0
  344. package/dist/types/context.d.ts +93 -0
  345. package/dist/types/conversation-storage.d.ts +76 -0
  346. package/dist/types/conversation.d.ts +90 -0
  347. package/dist/types/cron.d.ts +150 -0
  348. package/dist/types/eval.d.ts +132 -0
  349. package/dist/types/goal-events.d.ts +95 -0
  350. package/dist/types/handoff.d.ts +135 -0
  351. package/dist/types/index.d.ts +20 -0
  352. package/dist/types/mcp.d.ts +64 -0
  353. package/dist/types/memory-adapter.d.ts +175 -0
  354. package/dist/types/messages.d.ts +154 -0
  355. package/dist/types/providers.d.ts +102 -0
  356. package/dist/types/run.d.ts +215 -0
  357. package/dist/types/task.d.ts +131 -0
  358. package/dist/types/theokit.d.ts +61 -0
  359. package/dist/types/trajectory.d.ts +49 -0
  360. package/dist/types/updates.d.ts +148 -0
  361. package/dist/types/usage.d.ts +61 -0
  362. package/dist/types/workflow.d.ts +217 -0
  363. package/dist/workflow.cjs +2405 -0
  364. package/dist/workflow.cjs.map +1 -0
  365. package/dist/workflow.d.cts +97 -0
  366. package/dist/workflow.d.ts +97 -0
  367. package/dist/workflow.js +2398 -0
  368. package/dist/workflow.js.map +1 -0
  369. package/package.json +183 -0
@@ -0,0 +1,52 @@
1
+ import type { AgentDefinition, AgentOptions, CloudOptions, CustomTool, LocalOptions, MemorySettings, ModelSelection, SDKAgent, SkillsSettings, SystemPromptResolver } from "./types/agent.js";
2
+ import type { ContextSettings } from "./types/context.js";
3
+ import type { McpServerConfig } from "./types/mcp.js";
4
+ import type { PluginsSettings, ProviderRoutingSettings } from "./types/providers.js";
5
+ /**
6
+ * Fluent builder for {@link AgentOptions}. Chainable setters mutate internal
7
+ * state and return `this`. Three terminals:
8
+ *
9
+ * - `.build()` — synchronous snapshot (shallow clone) of accumulated options.
10
+ * - `.create()` — calls the injected `create` (Agent.create).
11
+ * - `.getOrCreate(agentId)` — calls the injected `getOrCreate` (Agent.getOrCreate).
12
+ *
13
+ * Validation runs inside the terminals via `validateAgentOptions`. See ADR D25.
14
+ *
15
+ * @public
16
+ */
17
+ export declare class AgentBuilder {
18
+ private opts;
19
+ private readonly deps;
20
+ constructor(deps?: AgentBuilderDeps);
21
+ model(m: ModelSelection): this;
22
+ apiKey(k: string): this;
23
+ name(n: string): this;
24
+ systemPrompt(p: string | SystemPromptResolver): this;
25
+ local(l: LocalOptions): this;
26
+ cloud(c: CloudOptions): this;
27
+ memory(m: MemorySettings): this;
28
+ tools(t: CustomTool[]): this;
29
+ mcpServers(s: Record<string, McpServerConfig>): this;
30
+ agents(a: Record<string, AgentDefinition>): this;
31
+ context(c: ContextSettings): this;
32
+ providers(p: ProviderRoutingSettings): this;
33
+ plugins(p: PluginsSettings): this;
34
+ skills(s: SkillsSettings): this;
35
+ agentId(id: string): this;
36
+ /**
37
+ * Synchronous snapshot of the accumulated options. Returns a SHALLOW CLONE
38
+ * so external mutation of the result doesn't pollute the builder state (EC-2).
39
+ */
40
+ build(): AgentOptions;
41
+ /**
42
+ * Validate + create a fresh agent. Delegates to `Agent.create` via the
43
+ * injected `deps.create`. Throws if the builder was instantiated without
44
+ * deps (i.e., direct `new AgentBuilder()` instead of `Agent.builder()`).
45
+ */
46
+ create(): Promise<SDKAgent>;
47
+ /**
48
+ * Resume an existing agent or create one if the ID is unknown. Delegates to
49
+ * `Agent.getOrCreate` via the injected `deps.getOrCreate` (ADR D22).
50
+ */
51
+ getOrCreate(agentId: string): Promise<SDKAgent>;
52
+ }
@@ -0,0 +1,39 @@
1
+ import type { AgentOptions, SDKAgent } from "./types/agent.js";
2
+ /**
3
+ * Handle returned by {@link createAgentFactory}. See ADR D23 for merge
4
+ * semantics.
5
+ *
6
+ * @public
7
+ */
8
+ export interface AgentFactory {
9
+ /**
10
+ * Create a fresh agent for this session. Equivalent to `Agent.create(merged)`
11
+ * where `merged` is `common` ⊕ `overrides` ⊕ `{ agentId }`.
12
+ */
13
+ forSession(agentId: string, overrides?: Partial<AgentOptions>): Promise<SDKAgent>;
14
+ /**
15
+ * Resume an existing agent for this session, or create one if the ID is
16
+ * unknown. Equivalent to `Agent.getOrCreate(agentId, merged)`.
17
+ */
18
+ getOrCreate(agentId: string, overrides?: Partial<AgentOptions>): Promise<SDKAgent>;
19
+ }
20
+ /**
21
+ * Capture a common {@link AgentOptions} prefix and produce per-session agents
22
+ * with focused overrides. Useful for chat-bot patterns where most config is
23
+ * shared across users/sessions.
24
+ *
25
+ * Merge rules (ADR D23):
26
+ * - Top-level shallow merge with `overrides` winning.
27
+ * - Deep merge for `local`, `memory`, `cloud` (configuration objects with
28
+ * non-conflicting flat keys).
29
+ * - Total replace for `mcpServers`, `agents`, `tools`, `providers`,
30
+ * `plugins`, `skills`, `context` (collection-shaped).
31
+ * - The function-level `agentId` always wins over both `common.agentId` and
32
+ * `overrides.agentId`.
33
+ *
34
+ * The factory holds `common` by reference — mutating it after construction
35
+ * leaks to subsequent `forSession` calls (documented caveat).
36
+ *
37
+ * @public
38
+ */
39
+ export declare function createAgentFactory(common: Partial<AgentOptions>): AgentFactory;
@@ -0,0 +1,175 @@
1
+ import { AgentBuilder } from "./agent-builder.js";
2
+ import { type LiveAgentRegistry } from "./internal/runtime/live-agent-registry.js";
3
+ import type { AgentOperationOptions, AgentOptions, GetAgentOptions, GetRunOptions, ListAgentsOptions, ListResult, ListRunsOptions, SDKAgent, SDKAgentInfo } from "./types/agent.js";
4
+ import type { Run, RunResult } from "./types/run.js";
5
+ /**
6
+ * Result of a one-shot {@link Agent.prompt} call.
7
+ *
8
+ * @public
9
+ */
10
+ export type AgentPromptResult = RunResult;
11
+ /**
12
+ * Static façade for creating and managing Theo agents.
13
+ *
14
+ * @public
15
+ */
16
+ export declare class Agent {
17
+ private constructor();
18
+ /**
19
+ * Live-agent cache for production deploys (Production-Readiness #2, ADRs D307-D310).
20
+ *
21
+ * Caches `SDKAgent` instances by id with LRU eviction (when `size > maxAgents`)
22
+ * and an idle-timeout sweep. Solves the OOM failure mode for long-running
23
+ * Node servers spawning fresh agents per conversation.
24
+ *
25
+ * Defaults: `maxAgents: 100`, `idleTimeoutMs: 30 min`, sweep `60s`.
26
+ * Configure for high-traffic SaaS:
27
+ *
28
+ * ```ts
29
+ * Agent.registry.configure({ maxAgents: 1000, idleTimeoutMs: 15 * 60_000 });
30
+ * process.on("SIGTERM", () => Agent.registry.evictAll());
31
+ * ```
32
+ *
33
+ * Cache hits are automatic in `Agent.getOrCreate` (T2.6). Disable the cache
34
+ * entirely via `configure({ maxAgents: 0 })` — every getOrCreate then
35
+ * re-initializes.
36
+ *
37
+ * @public
38
+ */
39
+ static readonly registry: LiveAgentRegistry;
40
+ /**
41
+ * Create a new agent. Pass either `local` or `cloud` to pick a runtime.
42
+ *
43
+ * @public
44
+ */
45
+ static create(options: AgentOptions): Promise<SDKAgent>;
46
+ /**
47
+ * One-shot prompt: create an agent, send a single message, wait, dispose.
48
+ *
49
+ * When `options.throwOnError === true`, rejects with `AgentRunError` if
50
+ * the run terminates with `status: 'error'` (instead of resolving with the
51
+ * error wrapped in the RunResult). Cancelled runs still resolve normally.
52
+ *
53
+ * @public
54
+ */
55
+ static prompt(message: string, options: AgentOptions): Promise<AgentPromptResult>;
56
+ /**
57
+ * Reattach to an existing agent by ID.
58
+ *
59
+ * @public
60
+ */
61
+ static resume(agentId: string, options?: Partial<AgentOptions>): Promise<SDKAgent>;
62
+ /**
63
+ * Start building an {@link AgentOptions} via fluent chain. See ADR D25.
64
+ * Terminals: `.build()`, `.create()`, `.getOrCreate(id)`.
65
+ *
66
+ * The builder receives `create` + `getOrCreate` as injected callbacks so
67
+ * that `agent-builder.ts` doesn't need a static import of `Agent` — keeps
68
+ * the module graph acyclic (G6).
69
+ *
70
+ * @public
71
+ */
72
+ static builder(): AgentBuilder;
73
+ /**
74
+ * Generate a typed object matching a Zod schema via a synthetic forced
75
+ * tool call (ADR D33). One-shot: create transient agent → send prompt →
76
+ * model calls `output` tool → parse args via Zod → return typed.
77
+ *
78
+ * @public
79
+ */
80
+ static generateObject<T extends import("zod").ZodType>(options: import("./generate-object.js").GenerateObjectOptions<T>): Promise<import("./generate-object.js").GenerateObjectResult<import("zod").z.infer<T>>>;
81
+ /**
82
+ * Stream a structured output object alongside intermediate `partial`
83
+ * deltas as the model accumulates its response (ADR D39). Returns an
84
+ * `AsyncIterator<StreamObjectEvent<T>>` that yields zero or more
85
+ * `partial` events and exactly one `complete` event at the end.
86
+ *
87
+ * The `complete` event carries the same `object: z.infer<T>` you would get
88
+ * from `Agent.generateObject` — same prompt + schema + model produces
89
+ * the same final object.
90
+ *
91
+ * @public
92
+ */
93
+ static streamObject<T extends import("zod").ZodType>(options: import("./stream-object.js").StreamObjectOptions<T>): AsyncGenerator<import("./stream-object.js").StreamObjectEvent<import("zod").z.infer<T>>, void, void>;
94
+ /**
95
+ * Run N prompts in parallel with bounded concurrency (ADRs D134-D140).
96
+ *
97
+ * Each prompt gets a fresh agent (create → send → wait → dispose). Failures
98
+ * are isolated per-prompt; the batch never throws on a single failure —
99
+ * inspect `result.ok` to discriminate success vs error. Default
100
+ * concurrency is 4. When `options.providers.apiKeys` has ≥2 keys per
101
+ * provider, all in-flight agents share a single credential pool via
102
+ * `AsyncLocalStorage` (EC-A) so rate-limit cooldowns are observed once
103
+ * instead of duplicated per agent.
104
+ *
105
+ * Streaming progress is opt-in via `onResult` / `onProgress`. `AbortSignal`
106
+ * cancels pending prompts; in-flight ones continue to completion (Node
107
+ * AbortSignal semantics). `signal.reason` propagates to `error` when set.
108
+ *
109
+ * @public
110
+ */
111
+ static batch(prompts: ReadonlyArray<string | import("./types/batch.js").BatchItem>, options: import("./types/batch.js").BatchOptions): Promise<import("./types/batch.js").BatchResult[]>;
112
+ /**
113
+ * Get an existing agent by ID, or create one with the supplied options if
114
+ * the ID is not yet registered. Eliminates the resume-vs-create boilerplate
115
+ * common to chat bots and other long-running agent consumers. See ADR D22.
116
+ *
117
+ * Resolution:
118
+ * 1. Try `Agent.resume(agentId, options)`. Return on success.
119
+ * 2. On `UnknownAgentError`, fall through to `Agent.create({ ...options, agentId })`.
120
+ * 3. On same-process race (`ConfigurationError(code: "agent_id_already_exists")`
121
+ * during step 2), retry `Agent.resume` once and return the winner's handle.
122
+ * 4. Any other error propagates verbatim.
123
+ *
124
+ * Caveats:
125
+ * - The function-level `agentId` always wins over `options.agentId`.
126
+ * - Options differ between calls? Last-call-wins for this handle (matches `Agent.resume`).
127
+ * - Disposed agents are NOT auto-deleted from the registry. To force a fresh
128
+ * agent, call `Agent.delete(agentId)` first.
129
+ *
130
+ * @public
131
+ */
132
+ static getOrCreate(agentId: string, options: AgentOptions): Promise<SDKAgent>;
133
+ /**
134
+ * List agents (local or cloud).
135
+ *
136
+ * @public
137
+ */
138
+ static list(options?: ListAgentsOptions): Promise<ListResult<SDKAgentInfo>>;
139
+ /**
140
+ * Get metadata for a single agent.
141
+ *
142
+ * @public
143
+ */
144
+ static get(agentId: string, _options?: GetAgentOptions): Promise<SDKAgentInfo>;
145
+ /**
146
+ * List runs for an agent.
147
+ *
148
+ * @public
149
+ */
150
+ static listRuns(agentId: string, _options?: ListRunsOptions): Promise<ListResult<Run>>;
151
+ /**
152
+ * Get a single run.
153
+ *
154
+ * @public
155
+ */
156
+ static getRun(runId: string, options?: GetRunOptions): Promise<Run>;
157
+ /**
158
+ * Archive a cloud agent.
159
+ *
160
+ * @public
161
+ */
162
+ static archive(agentId: string, _options?: AgentOperationOptions): Promise<void>;
163
+ /**
164
+ * Restore an archived cloud agent.
165
+ *
166
+ * @public
167
+ */
168
+ static unarchive(agentId: string, _options?: AgentOperationOptions): Promise<void>;
169
+ /**
170
+ * Permanently delete a cloud agent.
171
+ *
172
+ * @public
173
+ */
174
+ static delete(agentId: string, _options?: AgentOperationOptions): Promise<void>;
175
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * `Agent.batch(prompts, options)` core (ADRs D134-D140).
3
+ *
4
+ * Fans out N prompts via bounded concurrency, isolates failures per-prompt,
5
+ * preserves input order in the result array, supports streaming callbacks
6
+ * + AbortSignal. The credential pool (D131) is shared across all
7
+ * in-flight agents via `withCredentialPool` ALS scope (EC-A fix).
8
+ *
9
+ * @internal
10
+ */
11
+ export {};
@@ -0,0 +1,48 @@
1
+ /**
2
+ * `Budget` — token cost enforcement primitive (Adoption Roadmap #1
3
+ * post-Tasks, ADRs D375-D388).
4
+ *
5
+ * Static facade delegating to the in-process registry + ledger.
6
+ * 3 modes: `audit` (log-only), `warn` (callbacks + log), `block`
7
+ * (preflight throw before LLM call).
8
+ *
9
+ * @public
10
+ */
11
+ import { computeCost } from "./internal/budget/compute-cost.js";
12
+ import { chargeAndCheckThresholds, preflightCheck } from "./internal/budget/enforcement.js";
13
+ import { inferApiMode, normalizeUsage } from "./internal/budget/normalize-usage.js";
14
+ import { getPricingEntry } from "./internal/budget/pricing-registry.js";
15
+ import { UsageAccumulator } from "./internal/budget/usage-accumulator.js";
16
+ import type { BudgetHandle, BudgetOptions, BudgetSnapshot } from "./types/budget.js";
17
+ export { chargeAndCheckThresholds, computeCost, getPricingEntry, inferApiMode, normalizeUsage, preflightCheck, UsageAccumulator, };
18
+ export declare class Budget {
19
+ private constructor();
20
+ /**
21
+ * Create a budget. `name` must match `^[a-z0-9][a-z0-9_-]*$` (EC-7).
22
+ * Throws `ConfigurationError` if name is invalid OR already exists
23
+ * (EC-16: duplicate surface caller bug).
24
+ *
25
+ * `limits` is stacked (D384) — ANY exceeded triggers enforcement.
26
+ * Empty `limits[]` is valid: pure tracking, no thresholds/exceed
27
+ * callbacks fire (EC-19).
28
+ *
29
+ * Default `mode` is `"warn"` (D383). For emergency stop, use
30
+ * `mode: "block", limits: [{ window: "1d", limitUsd: 0 }]` (EC-18).
31
+ */
32
+ static create(options: BudgetOptions): BudgetHandle;
33
+ /** Returns the handle for an active budget, or `undefined`. */
34
+ static get(name: string): BudgetHandle | undefined;
35
+ /** Returns all active budgets. */
36
+ static list(): readonly BudgetHandle[];
37
+ /**
38
+ * Deletes a budget from the registry. Returns `true` if it existed.
39
+ * In-flight `agent.send` calls referencing the name treat the
40
+ * subsequent charge as a silent no-op + stderr warn (EC-20).
41
+ */
42
+ static delete(name: string): boolean;
43
+ /**
44
+ * Returns per-window spend snapshot for all active budgets. Each
45
+ * entry has `{ name, window, spentUsd, limitUsd, ratio }`.
46
+ */
47
+ static snapshot(): readonly BudgetSnapshot[];
48
+ }
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Public `Cache` class — semantic LLM response cache (Adoption Roadmap #6;
3
+ * ADRs D249-D266).
4
+ *
5
+ * Usage:
6
+ *
7
+ * import { Agent, Cache, definePlugin } from "@theokit/sdk";
8
+ *
9
+ * const cache = Cache.semantic({
10
+ * embedder: myEmbedderRuntime, // EmbeddingRuntime (D11)
11
+ * threshold: 0.85,
12
+ * ttl: { default: "1h", exclude: /weather|today|now/i },
13
+ * namespace: "my-app",
14
+ * modelId: "openai/gpt-4o-mini",
15
+ * });
16
+ *
17
+ * const agent = await Agent.create({
18
+ * model: { id: "openai/gpt-4o-mini" },
19
+ * plugins: [cache.asPlugin()],
20
+ * // ...
21
+ * });
22
+ *
23
+ * await agent.send("What is the capital of France?"); // miss → LLM
24
+ * await agent.send("Tell me the capital of France"); // semantic hit
25
+ *
26
+ * @public
27
+ */
28
+ import type { Plugin } from "./internal/plugins/types.js";
29
+ import type { CacheSemanticOptions, CacheStats } from "./types/cache.js";
30
+ export declare class Cache {
31
+ private readonly embedder;
32
+ private readonly threshold;
33
+ private readonly ttl;
34
+ private readonly namespace;
35
+ private readonly modelId;
36
+ private readonly store;
37
+ private _plugin?;
38
+ private constructor();
39
+ static semantic(options: CacheSemanticOptions): Cache;
40
+ /**
41
+ * EC-4 absorbed: memoized so repeated `asPlugin()` calls return the SAME
42
+ * plugin descriptor — no duplicate hook registration.
43
+ */
44
+ asPlugin(): Plugin;
45
+ /**
46
+ * Explicit cache lookup — callers that want true LLM short-circuit
47
+ * call this BEFORE `agent.send()`, then dispatch to the LLM only on miss.
48
+ *
49
+ * v1 plugin mode provides recall + context-inject (LLM still called).
50
+ * v1.x will add transparent short-circuit via an agent-loop refactor.
51
+ */
52
+ consult(prompt: string): Promise<{
53
+ hit: false;
54
+ } | {
55
+ hit: true;
56
+ response: string;
57
+ source: "kv" | "semantic";
58
+ distance?: number;
59
+ }>;
60
+ /**
61
+ * Explicit cache store — pair with `consult()` to manually feed the
62
+ * cache after dispatching the LLM call yourself.
63
+ */
64
+ remember(prompt: string, response: string, opts?: {
65
+ usedTools?: boolean;
66
+ }): Promise<void>;
67
+ /** Stats snapshot — primary observable for dogfood verification. */
68
+ stats(): CacheStats;
69
+ /** Clear all entries (and flush to disk if JSON backend). */
70
+ clear(): Promise<void>;
71
+ /** Force-evict expired entries. Returns count removed. */
72
+ evictExpired(now?: number): number;
73
+ }
74
+ export { CacheEmbedderError, CacheInvalidTtlError } from "./types/cache.js";
@@ -0,0 +1,221 @@
1
+ import { aG as SDKUserMessage, A as AgentOptions, j as ListResult, m as Run } from './run-DkCD5DeO.cjs';
2
+
3
+ /**
4
+ * Runtime hosting a cron job. Mirrors the agent runtime split.
5
+ *
6
+ * - `local` — the in-process scheduler activated via `Cron.start()` fires the
7
+ * job while the host process is alive.
8
+ * - `cloud` — Theo PaaS schedules the job server-side; fires independent of
9
+ * any SDK process.
10
+ *
11
+ * @public
12
+ */
13
+ type CronRuntime = "local" | "cloud";
14
+ /**
15
+ * Lifecycle state reported by `Cron.list()` / `Cron.get()`.
16
+ *
17
+ * @public
18
+ */
19
+ type CronJobStatus = "scheduled" | "running" | "paused" | "errored";
20
+ /**
21
+ * Persistent cron-scheduled invocation of the Theo agent.
22
+ *
23
+ * Exactly one of {@link CronJob.agent} (ephemeral agent created on each fire)
24
+ * or {@link CronJob.agentId} (bound to an existing agent for context
25
+ * continuity) is set.
26
+ *
27
+ * @public
28
+ */
29
+ interface CronJob {
30
+ id: string;
31
+ name?: string;
32
+ /** Standard 5-field POSIX cron expression or shorthand (`@hourly`, `@daily`, ...). */
33
+ cron: string;
34
+ /** IANA timezone identifier. Defaults to `"UTC"`. */
35
+ timezone?: string;
36
+ /** Message sent to the agent on each fire. */
37
+ message: string | SDKUserMessage;
38
+ /** Ephemeral agent options. Mutually exclusive with `agentId`. */
39
+ agent?: AgentOptions;
40
+ /** ID of an existing agent to reuse for context continuity. Mutually exclusive with `agent`. */
41
+ agentId?: string;
42
+ /** Whether the scheduler will fire this job on schedule. */
43
+ enabled: boolean;
44
+ /** Current status. */
45
+ status: CronJobStatus;
46
+ /** Runtime that hosts this job. Inferred from `agent`/`agentId` at create time. */
47
+ runtime: CronRuntime;
48
+ /** Unix ms of the last successful fire, if any. */
49
+ lastRunAt?: number;
50
+ /** Unix ms of the next scheduled fire, computed by the scheduler. */
51
+ nextRunAt?: number;
52
+ /** Unix ms when the job was created. */
53
+ createdAt: number;
54
+ }
55
+ /**
56
+ * Options for `Cron.create()`.
57
+ *
58
+ * Pass `agent` for an ephemeral agent created fresh on each fire, OR
59
+ * `agentId` to reuse an existing agent (preserves conversation context across
60
+ * fires). Setting both is a `ConfigurationError`.
61
+ *
62
+ * @public
63
+ */
64
+ interface CronCreateOptions {
65
+ cron: string;
66
+ message: string | SDKUserMessage;
67
+ agent?: AgentOptions;
68
+ agentId?: string;
69
+ name?: string;
70
+ timezone?: string;
71
+ /** Defaults to `true`. */
72
+ enabled?: boolean;
73
+ /** Falls back to `THEOKIT_API_KEY`. */
74
+ apiKey?: string;
75
+ }
76
+ /**
77
+ * Options for `Cron.list()`.
78
+ *
79
+ * @public
80
+ */
81
+ type CronListOptions = {
82
+ limit?: number;
83
+ cursor?: string;
84
+ } & ({
85
+ runtime?: undefined;
86
+ } | {
87
+ runtime: "local";
88
+ cwd?: string;
89
+ } | {
90
+ runtime: "cloud";
91
+ apiKey?: string;
92
+ });
93
+ /**
94
+ * Options for `Cron.get()`.
95
+ *
96
+ * @public
97
+ */
98
+ interface CronGetOptions {
99
+ cwd?: string;
100
+ apiKey?: string;
101
+ }
102
+ /**
103
+ * Options for `Cron.delete()` / `Cron.enable()` / `Cron.disable()`.
104
+ *
105
+ * @public
106
+ */
107
+ interface CronOperationOptions {
108
+ cwd?: string;
109
+ apiKey?: string;
110
+ }
111
+ /**
112
+ * Options for `Cron.run()` — manually trigger a job off-schedule.
113
+ *
114
+ * @public
115
+ */
116
+ interface CronRunOptions {
117
+ cwd?: string;
118
+ apiKey?: string;
119
+ }
120
+ /**
121
+ * Options for `Cron.start()` — activates the in-process scheduler for local
122
+ * jobs.
123
+ *
124
+ * @public
125
+ */
126
+ interface CronStartOptions {
127
+ /** Local workspace whose `.theokit/cron/jobs.json` to load. Defaults to `process.cwd()`. */
128
+ cwd?: string;
129
+ /** Override the env API key. */
130
+ apiKey?: string;
131
+ }
132
+ /**
133
+ * Snapshot of the local scheduler returned by `Cron.status()`.
134
+ *
135
+ * @public
136
+ */
137
+ interface CronSchedulerStatus {
138
+ /** Whether the in-process scheduler is currently running. */
139
+ running: boolean;
140
+ /** Number of jobs loaded into the scheduler. */
141
+ jobCount: number;
142
+ /** Unix ms of the next scheduled fire across all jobs, if any. */
143
+ nextFireAt?: number;
144
+ /** Last error observed in the scheduler, if any. */
145
+ lastError?: {
146
+ jobId: string;
147
+ message: string;
148
+ at: number;
149
+ };
150
+ }
151
+
152
+ /**
153
+ * Static façade for scheduling Theo agent runs on a cron expression.
154
+ *
155
+ * @public
156
+ */
157
+ declare class Cron {
158
+ private constructor();
159
+ /**
160
+ * Create and persist a cron job.
161
+ *
162
+ * @public
163
+ */
164
+ static create(options: CronCreateOptions): Promise<CronJob>;
165
+ /**
166
+ * List cron jobs (local, cloud, or both).
167
+ *
168
+ * @public
169
+ */
170
+ static list(options?: CronListOptions): Promise<ListResult<CronJob>>;
171
+ /**
172
+ * Get a single cron job by ID.
173
+ *
174
+ * @public
175
+ */
176
+ static get(jobId: string, _options?: CronGetOptions): Promise<CronJob>;
177
+ /**
178
+ * Delete a cron job permanently.
179
+ *
180
+ * @public
181
+ */
182
+ static delete(jobId: string, _options?: CronOperationOptions): Promise<void>;
183
+ /**
184
+ * Re-enable a paused cron job.
185
+ *
186
+ * @public
187
+ */
188
+ static enable(jobId: string, _options?: CronOperationOptions): Promise<CronJob>;
189
+ /**
190
+ * Pause a cron job without deleting it.
191
+ *
192
+ * @public
193
+ */
194
+ static disable(jobId: string, _options?: CronOperationOptions): Promise<CronJob>;
195
+ /**
196
+ * Manually trigger a cron job off-schedule. Returns the resulting `Run`.
197
+ *
198
+ * @public
199
+ */
200
+ static run(jobId: string, _options?: CronRunOptions): Promise<Run>;
201
+ /**
202
+ * Activate the in-process scheduler for local cron jobs.
203
+ *
204
+ * @public
205
+ */
206
+ static start(options?: CronStartOptions): Promise<void>;
207
+ /**
208
+ * Stop the in-process scheduler. Jobs are preserved.
209
+ *
210
+ * @public
211
+ */
212
+ static stop(): Promise<void>;
213
+ /**
214
+ * Snapshot of the local scheduler.
215
+ *
216
+ * @public
217
+ */
218
+ static status(_options?: CronStartOptions): Promise<CronSchedulerStatus>;
219
+ }
220
+
221
+ export { Cron as C, type CronCreateOptions as a, type CronGetOptions as b, type CronJob as c, type CronJobStatus as d, type CronListOptions as e, type CronOperationOptions as f, type CronRunOptions as g, type CronRuntime as h, type CronSchedulerStatus as i, type CronStartOptions as j };