@theokit/sdk 1.6.1 → 1.7.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 (351) hide show
  1. package/CHANGELOG.md +187 -0
  2. package/dist/a2a/agent-mailbox.d.cts +27 -0
  3. package/dist/a2a/agent-mailbox.d.ts +27 -0
  4. package/dist/a2a/index.cjs +16850 -0
  5. package/dist/a2a/index.cjs.map +1 -0
  6. package/dist/a2a/index.d.cts +9 -0
  7. package/dist/a2a/index.d.ts +9 -0
  8. package/dist/a2a/index.js +16844 -0
  9. package/dist/a2a/index.js.map +1 -0
  10. package/dist/a2a/message-bus.d.cts +27 -0
  11. package/dist/a2a/message-bus.d.ts +27 -0
  12. package/dist/a2a/subagent.d.cts +25 -0
  13. package/dist/a2a/subagent.d.ts +25 -0
  14. package/dist/a2a/types.d.cts +12 -0
  15. package/dist/a2a/types.d.ts +12 -0
  16. package/dist/agent.d.ts +1 -1
  17. package/dist/client/index.cjs +73 -0
  18. package/dist/client/index.cjs.map +1 -0
  19. package/dist/client/index.d.cts +7 -0
  20. package/dist/client/index.d.ts +7 -0
  21. package/dist/client/index.js +71 -0
  22. package/dist/client/index.js.map +1 -0
  23. package/dist/client/theokit-client.d.cts +18 -0
  24. package/dist/client/theokit-client.d.ts +18 -0
  25. package/dist/client/types.d.cts +19 -0
  26. package/dist/client/types.d.ts +19 -0
  27. package/dist/{run-DkCD5DeO.d.cts → cron-BnywDYLq.d.cts} +496 -910
  28. package/dist/{run-DkCD5DeO.d.ts → cron-CtZvJD9J.d.ts} +496 -910
  29. package/dist/cron.cjs +4285 -2893
  30. package/dist/cron.cjs.map +1 -1
  31. package/dist/cron.d.cts +2 -3
  32. package/dist/cron.d.ts +2 -71
  33. package/dist/cron.js +4289 -2897
  34. package/dist/cron.js.map +1 -1
  35. package/dist/{errors-CvAeEWgE.d.ts → errors-ChqOmFH1.d.cts} +52 -6
  36. package/dist/{errors-CK8brCJ1.d.cts → errors-DV9e0rcp.d.ts} +52 -6
  37. package/dist/errors.cjs +218 -3
  38. package/dist/errors.cjs.map +1 -1
  39. package/dist/errors.d.cts +2 -3
  40. package/dist/errors.d.ts +50 -4
  41. package/dist/errors.js +217 -4
  42. package/dist/errors.js.map +1 -1
  43. package/dist/eval.cjs +4285 -2893
  44. package/dist/eval.cjs.map +1 -1
  45. package/dist/eval.d.cts +35 -0
  46. package/dist/eval.js +4289 -2897
  47. package/dist/eval.js.map +1 -1
  48. package/dist/event-bus.d.ts +23 -0
  49. package/dist/index.cjs +5132 -4200
  50. package/dist/index.cjs.map +1 -1
  51. package/dist/index.d.cts +298 -278
  52. package/dist/index.d.ts +1898 -24
  53. package/dist/index.js +6441 -5509
  54. package/dist/index.js.map +1 -1
  55. package/dist/internal/agent-loop/loop-context-init.d.ts +2 -0
  56. package/dist/internal/agent-loop/tool-dispatch.d.ts +22 -1
  57. package/dist/internal/auth/api-key-validator.d.ts +46 -0
  58. package/dist/internal/llm/anthropic-shared.d.ts +8 -1
  59. package/dist/internal/llm/retry.d.ts +22 -0
  60. package/dist/internal/llm/types.d.ts +47 -1
  61. package/dist/internal/memory/active-memory-cache.d.ts +3 -3
  62. package/dist/internal/memory/active-memory-types.d.ts +8 -0
  63. package/dist/internal/memory/active-memory.d.ts +24 -20
  64. package/dist/internal/memory/adapters/azure-openai-embedding.d.ts +2 -0
  65. package/dist/internal/memory/adapters/cohere-embedding.d.ts +2 -0
  66. package/dist/internal/memory/adapters/gemini-embedding.d.ts +2 -0
  67. package/dist/internal/memory/adapters/jina-embedding.d.ts +2 -0
  68. package/dist/internal/memory/index-manager-contract.d.ts +26 -0
  69. package/dist/internal/memory/index-manager-dispatch.d.ts +1 -1
  70. package/dist/internal/memory/index-manager.d.ts +8 -26
  71. package/dist/internal/memory/{chunk-markdown.d.ts → storage/chunk-markdown.d.ts} +1 -1
  72. package/dist/internal/memory/{markdown-store.d.ts → storage/markdown-store.d.ts} +1 -1
  73. package/dist/internal/memory/{reader.d.ts → storage/reader.d.ts} +1 -1
  74. package/dist/internal/observability/context.d.cts +23 -0
  75. package/dist/internal/observability/context.d.ts +23 -0
  76. package/dist/internal/observability/index.cjs +38 -0
  77. package/dist/internal/observability/index.cjs.map +1 -0
  78. package/dist/internal/observability/index.d.cts +8 -0
  79. package/dist/internal/observability/index.d.ts +8 -0
  80. package/dist/internal/observability/index.js +33 -0
  81. package/dist/internal/observability/index.js.map +1 -0
  82. package/dist/internal/observability/tracer-loader.d.cts +20 -0
  83. package/dist/internal/persistence/conversation-storage-fs.d.cts +37 -0
  84. package/dist/internal/persistence/conversation-storage-memory.d.cts +24 -0
  85. package/dist/internal/persistence/credential-pool-store.d.cts +32 -0
  86. package/dist/internal/persistence/credential-pool-store.d.ts +32 -0
  87. package/dist/internal/persistence/cwd-mutex.d.cts +1 -0
  88. package/dist/internal/persistence/exclusive-create.d.cts +22 -0
  89. package/dist/internal/persistence/exclusive-create.d.ts +22 -0
  90. package/dist/internal/persistence/file-lock.d.cts +14 -0
  91. package/dist/internal/persistence/fts5-sanitize.d.cts +16 -0
  92. package/dist/internal/persistence/index.cjs +359 -0
  93. package/dist/internal/persistence/index.cjs.map +1 -0
  94. package/dist/internal/persistence/index.d.cts +20 -0
  95. package/dist/internal/persistence/index.d.ts +20 -0
  96. package/dist/internal/persistence/index.js +341 -0
  97. package/dist/internal/persistence/index.js.map +1 -0
  98. package/dist/internal/persistence/markdown-config-loader.d.cts +35 -0
  99. package/dist/internal/persistence/paths.d.cts +19 -0
  100. package/dist/internal/persistence/persistence-schema.d.cts +21 -0
  101. package/dist/internal/persistence/persistence-schema.d.ts +4 -0
  102. package/dist/internal/persistence/schema-version.d.cts +13 -0
  103. package/dist/internal/persistence/sqlite-cas.d.cts +25 -0
  104. package/dist/internal/persistence/sqlite-cas.d.ts +25 -0
  105. package/dist/internal/persistence/sqlite-wal.d.cts +10 -0
  106. package/dist/internal/plugins/context.d.cts +31 -0
  107. package/dist/internal/plugins/index.cjs +228 -0
  108. package/dist/internal/plugins/index.cjs.map +1 -0
  109. package/dist/internal/plugins/index.d.cts +8 -0
  110. package/dist/internal/plugins/index.d.ts +8 -0
  111. package/dist/internal/plugins/index.js +222 -0
  112. package/dist/internal/plugins/index.js.map +1 -0
  113. package/dist/internal/plugins/lifecycle.d.cts +14 -0
  114. package/dist/internal/plugins/lifecycle.d.ts +14 -0
  115. package/dist/internal/plugins/manager.d.cts +37 -0
  116. package/dist/internal/plugins/types.d.cts +102 -0
  117. package/dist/internal/providers/catalog-loader.d.ts +39 -0
  118. package/dist/internal/runtime/agent-session-store.d.ts +1 -1
  119. package/dist/internal/runtime/agent-session.d.ts +1 -0
  120. package/dist/internal/runtime/budget-tracker.d.ts +73 -0
  121. package/dist/internal/runtime/{context-manager.d.ts → context/context-manager.d.ts} +1 -1
  122. package/dist/internal/runtime/{fixture-events.d.ts → fixtures/fixture-events.d.ts} +1 -1
  123. package/dist/internal/runtime/{fixture-run-base.d.ts → fixtures/fixture-run-base.d.ts} +4 -4
  124. package/dist/internal/runtime/{fixture-scripts.d.ts → fixtures/fixture-scripts.d.ts} +1 -1
  125. package/dist/internal/runtime/local-agent-bootstrap.d.ts +2 -2
  126. package/dist/internal/runtime/local-agent-memory-provider.d.ts +57 -0
  127. package/dist/internal/runtime/memory-path-selector.d.ts +73 -0
  128. package/dist/internal/runtime/memory-provider.d.ts +165 -0
  129. package/dist/internal/runtime/{agent-registry.d.ts → registry/agent-registry-contract.d.ts} +15 -9
  130. package/dist/internal/runtime/registry/agent-registry.d.ts +7 -0
  131. package/dist/internal/runtime/{live-agent-registry.d.ts → registry/live-agent-registry.d.ts} +1 -1
  132. package/dist/internal/runtime/{run-registry.d.ts → registry/run-registry.d.ts} +1 -1
  133. package/dist/internal/runtime/session-types.d.ts +35 -0
  134. package/dist/internal/runtime/system-prompt/sources/skills-provider.d.ts +1 -0
  135. package/dist/internal/runtime/validate-response.d.ts +18 -0
  136. package/dist/internal/security/index.cjs +361 -0
  137. package/dist/internal/security/index.cjs.map +1 -0
  138. package/dist/internal/security/index.d.cts +11 -0
  139. package/dist/internal/security/index.js +350 -0
  140. package/dist/internal/security/index.js.map +1 -0
  141. package/dist/internal/security/path-guard.d.cts +59 -0
  142. package/dist/internal/security/path-guard.d.ts +3 -0
  143. package/dist/internal/security/redact.d.cts +21 -0
  144. package/dist/internal/security/secret-redactor.d.cts +1 -0
  145. package/dist/internal/security/secret-redactor.d.ts +1 -0
  146. package/dist/internal/security/test-reset.d.cts +10 -0
  147. package/dist/internal/security/test-reset.d.ts +10 -0
  148. package/dist/internal/telemetry/adapters/arize.d.ts +2 -0
  149. package/dist/internal/telemetry/adapters/braintrust.d.ts +2 -0
  150. package/dist/internal/telemetry/adapters/datadog.d.ts +2 -0
  151. package/dist/internal/telemetry/adapters/langsmith.d.ts +2 -0
  152. package/dist/internal/telemetry/span-names.d.ts +6 -0
  153. package/dist/internal/telemetry/tracer.d.ts +1 -0
  154. package/dist/internal/workflow/evented-executor.d.ts +42 -0
  155. package/dist/internal/workflow/scheduler.d.ts +23 -0
  156. package/dist/internal/zod/to-json-schema.d.ts +5 -15
  157. package/dist/job-queue.d.ts +28 -0
  158. package/dist/path-safety.cjs +67 -6
  159. package/dist/path-safety.cjs.map +1 -1
  160. package/dist/path-safety.d.cts +15 -0
  161. package/dist/path-safety.d.ts +1 -1
  162. package/dist/path-safety.js +67 -7
  163. package/dist/path-safety.js.map +1 -1
  164. package/dist/permission-engine.d.ts +21 -0
  165. package/dist/provider-catalog.json +702 -0
  166. package/dist/rag/index.cjs +136 -0
  167. package/dist/rag/index.cjs.map +1 -0
  168. package/dist/rag/index.d.cts +11 -0
  169. package/dist/rag/index.d.ts +11 -0
  170. package/dist/rag/index.js +129 -0
  171. package/dist/rag/index.js.map +1 -0
  172. package/dist/rag/reranker.d.cts +26 -0
  173. package/dist/rag/reranker.d.ts +26 -0
  174. package/dist/rag/retriever.d.cts +25 -0
  175. package/dist/rag/retriever.d.ts +25 -0
  176. package/dist/rag/text-splitter.d.cts +12 -0
  177. package/dist/rag/text-splitter.d.ts +12 -0
  178. package/dist/rag/types.d.cts +37 -0
  179. package/dist/rag/types.d.ts +37 -0
  180. package/dist/run-DrwUpFxZ.d.cts +823 -0
  181. package/dist/run-DrwUpFxZ.d.ts +823 -0
  182. package/dist/sandbox/index.cjs +133 -0
  183. package/dist/sandbox/index.cjs.map +1 -0
  184. package/dist/sandbox/index.d.cts +2 -0
  185. package/dist/sandbox/index.d.ts +2 -0
  186. package/dist/sandbox/index.js +128 -0
  187. package/dist/sandbox/index.js.map +1 -0
  188. package/dist/sandbox/local-sandbox.d.cts +17 -0
  189. package/dist/sandbox/local-sandbox.d.ts +17 -0
  190. package/dist/sandbox/types.d.cts +44 -0
  191. package/dist/sandbox/types.d.ts +44 -0
  192. package/dist/server/adapter/express.d.cts +9 -0
  193. package/dist/server/adapter/express.d.ts +9 -0
  194. package/dist/server/adapter/fastify.d.cts +9 -0
  195. package/dist/server/adapter/fastify.d.ts +9 -0
  196. package/dist/server/adapter/hono.d.cts +9 -0
  197. package/dist/server/adapter/hono.d.ts +9 -0
  198. package/dist/server/adapter/index.d.cts +8 -0
  199. package/dist/server/adapter/index.d.ts +8 -0
  200. package/dist/server/adapter/shared-handler.d.cts +9 -0
  201. package/dist/server/adapter/shared-handler.d.ts +9 -0
  202. package/dist/server/adapter/types.d.cts +33 -0
  203. package/dist/server/adapter/types.d.ts +33 -0
  204. package/dist/server/auth/errors.d.cts +53 -0
  205. package/dist/server/auth/errors.d.ts +53 -0
  206. package/dist/server/auth/index.cjs +48 -42
  207. package/dist/server/auth/index.cjs.map +1 -1
  208. package/dist/server/auth/index.d.cts +11 -172
  209. package/dist/server/auth/index.d.ts +11 -172
  210. package/dist/server/auth/index.js +49 -43
  211. package/dist/server/auth/index.js.map +1 -1
  212. package/dist/server/auth/oauth-transaction-store.d.cts +39 -0
  213. package/dist/server/auth/oauth-transaction-store.d.ts +39 -0
  214. package/dist/server/auth/orchestrator.d.cts +8 -0
  215. package/dist/server/auth/orchestrator.d.ts +8 -0
  216. package/dist/server/auth/types.d.cts +91 -0
  217. package/dist/server/auth/types.d.ts +91 -0
  218. package/dist/server/auth/validate-return-to.d.cts +17 -0
  219. package/dist/server/auth/validate-return-to.d.ts +17 -0
  220. package/dist/server/errors-envelope.cjs +409 -0
  221. package/dist/server/errors-envelope.cjs.map +1 -0
  222. package/dist/server/errors-envelope.d.cts +61 -0
  223. package/dist/server/errors-envelope.d.ts +61 -0
  224. package/dist/server/errors-envelope.js +405 -0
  225. package/dist/server/errors-envelope.js.map +1 -0
  226. package/dist/subscription/define-subscription.d.cts +63 -0
  227. package/dist/subscription/define-subscription.d.ts +63 -0
  228. package/dist/subscription/index.cjs +402 -0
  229. package/dist/subscription/index.cjs.map +1 -0
  230. package/dist/subscription/index.d.cts +18 -0
  231. package/dist/subscription/index.d.ts +18 -0
  232. package/dist/subscription/index.js +394 -0
  233. package/dist/subscription/index.js.map +1 -0
  234. package/dist/subscription/internal/adapter-types.d.cts +11 -0
  235. package/dist/subscription/internal/adapter-types.d.ts +11 -0
  236. package/dist/subscription/internal/backpressure.d.cts +24 -0
  237. package/dist/subscription/internal/backpressure.d.ts +24 -0
  238. package/dist/subscription/internal/server-integration.d.cts +17 -0
  239. package/dist/subscription/internal/server-integration.d.ts +17 -0
  240. package/dist/subscription/internal/sse-encoder.d.cts +13 -0
  241. package/dist/subscription/internal/sse-encoder.d.ts +13 -0
  242. package/dist/subscription/internal/sse-parser.d.cts +15 -0
  243. package/dist/subscription/internal/sse-parser.d.ts +15 -0
  244. package/dist/subscription/internal/subscription-runtime.d.cts +9 -0
  245. package/dist/subscription/internal/subscription-runtime.d.ts +9 -0
  246. package/dist/subscription/internal/ws-adapter-node.d.cts +10 -0
  247. package/dist/subscription/internal/ws-adapter-node.d.ts +10 -0
  248. package/dist/subscription/theokit-subscribe.d.cts +41 -0
  249. package/dist/subscription/theokit-subscribe.d.ts +41 -0
  250. package/dist/subscription/types.d.cts +140 -0
  251. package/dist/subscription/types.d.ts +140 -0
  252. package/dist/task-store.cjs +30 -2
  253. package/dist/task-store.cjs.map +1 -1
  254. package/dist/task-store.d.cts +8 -0
  255. package/dist/task-store.js +31 -3
  256. package/dist/task-store.js.map +1 -1
  257. package/dist/types/agent-prims.d.ts +61 -0
  258. package/dist/types/agent.d.ts +48 -53
  259. package/dist/types/conversation.d.ts +20 -8
  260. package/dist/types/index.d.ts +0 -2
  261. package/dist/types/messages-base.d.ts +20 -0
  262. package/dist/types/messages.d.ts +1 -1
  263. package/dist/types/run.d.ts +1 -1
  264. package/dist/types/updates.d.ts +1 -1
  265. package/dist/voice/index.d.ts +7 -0
  266. package/dist/voice/openai-realtime.d.ts +21 -0
  267. package/dist/voice/types.d.ts +35 -0
  268. package/dist/workflow.cjs +179 -88
  269. package/dist/workflow.cjs.map +1 -1
  270. package/dist/workflow.d.cts +97 -0
  271. package/dist/workflow.js +180 -89
  272. package/dist/workflow.js.map +1 -1
  273. package/package.json +126 -25
  274. package/dist/budget.d.ts +0 -48
  275. package/dist/cache.d.ts +0 -74
  276. package/dist/cron-1yxL3K2S.d.cts +0 -221
  277. package/dist/cron-BYVdYzob.d.ts +0 -221
  278. package/dist/handoff.d.ts +0 -55
  279. package/dist/internal/budget/calendar-window.d.ts +0 -19
  280. package/dist/internal/budget/enforcement.d.ts +0 -32
  281. package/dist/internal/budget/ledger.d.ts +0 -25
  282. package/dist/internal/budget/normalize-usage.d.ts +0 -27
  283. package/dist/internal/budget/registry.d.ts +0 -16
  284. package/dist/internal/cache/cosine.d.ts +0 -14
  285. package/dist/internal/cache/embed-helper.d.ts +0 -15
  286. package/dist/internal/cache/key.d.ts +0 -15
  287. package/dist/internal/cache/lookup.d.ts +0 -28
  288. package/dist/internal/cache/store-handler.d.ts +0 -24
  289. package/dist/internal/cache/store-json.d.ts +0 -48
  290. package/dist/internal/cache/store.d.ts +0 -54
  291. package/dist/internal/cache/telemetry.d.ts +0 -20
  292. package/dist/internal/cache/ttl.d.ts +0 -11
  293. package/dist/internal/catalog/fixtures.d.ts +0 -16
  294. package/dist/internal/catalog/local-models.d.ts +0 -24
  295. package/dist/internal/handoff/dispatcher.d.ts +0 -29
  296. package/dist/internal/handoff/registry.d.ts +0 -23
  297. package/dist/internal/handoff/telemetry.d.ts +0 -18
  298. package/dist/internal/handoff/tool-injector.d.ts +0 -34
  299. package/dist/internal/memory/atomic-write.d.ts +0 -7
  300. package/dist/internal/memory/dreaming/diary.d.ts +0 -4
  301. package/dist/internal/memory/dreaming/phases.d.ts +0 -15
  302. package/dist/internal/memory/dreaming/run.d.ts +0 -10
  303. package/dist/internal/memory/migrate-sqlite-to-lance.d.ts +0 -15
  304. package/dist/memory-adapter-helpers.d.ts +0 -28
  305. package/dist/memory.d.ts +0 -123
  306. package/dist/migrate.d.ts +0 -33
  307. package/dist/security.d.ts +0 -67
  308. package/dist/task.d.ts +0 -87
  309. package/dist/theokit.d.ts +0 -84
  310. package/dist/tools/_path-scope.d.ts +0 -8
  311. package/dist/tools/_subprocess.d.ts +0 -28
  312. package/dist/tools/git-diff.d.ts +0 -22
  313. package/dist/tools/index.d.ts +0 -29
  314. package/dist/tools/list-dir.d.ts +0 -26
  315. package/dist/tools/read-file.d.ts +0 -31
  316. package/dist/tools/run-vitest.d.ts +0 -46
  317. package/dist/tools/search-text.d.ts +0 -32
  318. package/dist/tools.cjs +0 -690
  319. package/dist/tools.cjs.map +0 -1
  320. package/dist/tools.js +0 -683
  321. package/dist/tools.js.map +0 -1
  322. package/dist/trajectory-helpers.d.ts +0 -31
  323. package/dist/types/cache.d.ts +0 -76
  324. package/dist/types/handoff.d.ts +0 -135
  325. /package/dist/{internal/cron/run-job.d.ts → agent-helpers.d.ts} +0 -0
  326. /package/dist/internal/{cron/scheduler.d.ts → agent-loop/loop-llm-stream.d.ts} +0 -0
  327. /package/dist/internal/{cron/store.d.ts → agent-loop/tool-executors.d.ts} +0 -0
  328. /package/dist/internal/{cron/validate.d.ts → memory/index-manager-helpers.d.ts} +0 -0
  329. /package/dist/internal/memory/{session-loader.d.ts → storage/session-loader.d.ts} +0 -0
  330. /package/dist/internal/memory/{session-summary-writer.d.ts → storage/session-summary-writer.d.ts} +0 -0
  331. /package/dist/internal/memory/{transcript-store.d.ts → storage/transcript-store.d.ts} +0 -0
  332. /package/dist/internal/memory/{wiki-loader.d.ts → storage/wiki-loader.d.ts} +0 -0
  333. /package/dist/internal/{memory/cwd-mutex.d.ts → persistence/atomic-write.d.cts} +0 -0
  334. /package/dist/internal/runtime/{context-aggregator.d.ts → context/context-aggregator.d.ts} +0 -0
  335. /package/dist/internal/runtime/{context-discovery-runner.d.ts → context/context-discovery-runner.d.ts} +0 -0
  336. /package/dist/internal/runtime/{context-discovery.d.ts → context/context-discovery.d.ts} +0 -0
  337. /package/dist/internal/runtime/{context-frontmatter.d.ts → context/context-frontmatter.d.ts} +0 -0
  338. /package/dist/internal/runtime/{context-import-resolver.d.ts → context/context-import-resolver.d.ts} +0 -0
  339. /package/dist/internal/runtime/{context-loaders.d.ts → context/context-loaders.d.ts} +0 -0
  340. /package/dist/internal/runtime/{context-mdc-parser.d.ts → context/context-mdc-parser.d.ts} +0 -0
  341. /package/dist/internal/runtime/{fixture-responder.d.ts → fixtures/fixture-responder.d.ts} +0 -0
  342. /package/dist/internal/runtime/{fixture-types.d.ts → fixtures/fixture-types.d.ts} +0 -0
  343. /package/dist/internal/runtime/{plugins-manager.d.ts → local-agent-send.d.ts} +0 -0
  344. /package/dist/internal/runtime/{plugin-frontmatter.d.ts → plugins/plugin-frontmatter.d.ts} +0 -0
  345. /package/dist/internal/runtime/{system-prompt/providers/active-memory-provider.d.ts → plugins/plugins-manager.d.ts} +0 -0
  346. /package/dist/internal/runtime/{agent-factory-registry.d.ts → registry/agent-factory-registry.d.ts} +0 -0
  347. /package/dist/internal/runtime/{agent-registry-store.d.ts → registry/agent-registry-store.d.ts} +0 -0
  348. /package/dist/internal/runtime/system-prompt/{providers/base-provider.d.ts → sources/active-memory-provider.d.ts} +0 -0
  349. /package/dist/internal/runtime/system-prompt/{providers/context-provider.d.ts → sources/base-provider.d.ts} +0 -0
  350. /package/dist/internal/runtime/system-prompt/{providers/memory-provider.d.ts → sources/context-provider.d.ts} +0 -0
  351. /package/dist/internal/runtime/system-prompt/{providers/skills-provider.d.ts → sources/memory-provider.d.ts} +0 -0
@@ -1,24 +0,0 @@
1
- /**
2
- * Local model discovery via OpenAI-compatible `/v1/models` endpoint
3
- * (T2.1, ADR D184).
4
- *
5
- * Used by `Theokit.models.list({ provider: "ollama" })` (and any other
6
- * future provider with `authType: "none"` exposing the OpenAI-shape
7
- * models endpoint — LM Studio, llama.cpp `./server`, vLLM, etc.) to
8
- * enumerate locally-installed models without a cloud round-trip.
9
- *
10
- * Aligned with OpenClaw `extensions/ollama/src/provider-models.ts` which
11
- * targets the same endpoint shape. Mirrors the relevant Hermes
12
- * `models.dev` catalog behavior for local providers.
13
- *
14
- * @internal
15
- */
16
- import type { SDKModel } from "../../types/theokit.js";
17
- /**
18
- * Fetch and map `<baseUrl>/v1/models` → `SDKModel[]`. Throws a typed
19
- * `ConfigurationError` on connection failures (ECONNREFUSED → "Run
20
- * `ollama serve`"). Returns `[]` when the body is unparseable —
21
- * defensive choice over crashing on malformed responses from
22
- * non-standard local runtimes.
23
- */
24
- export declare function listLocalModelsViaOpenAiCompat(baseUrl: string): Promise<SDKModel[]>;
@@ -1,29 +0,0 @@
1
- /**
2
- * Handoff dispatch orchestration.
3
- *
4
- * Pragmatic v1: when a handoff fires, the sender calls `receiver.send()`
5
- * with the (optionally filtered) history. The receiver's reply is returned
6
- * to the sender, which captures it as the answer to the user's question.
7
- *
8
- * NOTE: this is NOT pure peer-to-peer (the sender stays on the call stack
9
- * until the receiver returns). Pure intercept-and-swap requires deeper
10
- * agent-loop refactor; deferred to v2. v1 still validates the user-facing
11
- * value: "agent A reasoned about routing, agent B answered."
12
- *
13
- * @internal
14
- */
15
- import type { HandoffDescriptor, HandoffHistory, HandoffResult } from "../../types/handoff.js";
16
- import { type HandoffChainState } from "./registry.js";
17
- export declare function dispatchHandoff(args: {
18
- descriptor: HandoffDescriptor;
19
- senderAgentId: string;
20
- chainState: HandoffChainState;
21
- rawInputJson: unknown;
22
- /** The conversation so far (history wrapper). v1: just the LAST user message. */
23
- history: HandoffHistory;
24
- /** Override the message text sent to the receiver. Used by `Agent.handoffTo` imperative. */
25
- messageOverride?: string;
26
- }): Promise<{
27
- reply: string;
28
- result: HandoffResult;
29
- }>;
@@ -1,23 +0,0 @@
1
- /**
2
- * Handoff registry — pure state container per `Agent` instance.
3
- *
4
- * Holds the active dispatch chain (for depth + pair tracking) across the
5
- * lifetime of a single `agent.send()` call. Cleared between calls.
6
- *
7
- * @internal
8
- */
9
- export interface HandoffChainState {
10
- /** Ordered chain of agentIds traversed so far (oldest first). */
11
- readonly chain: string[];
12
- /** Set of "<sender>-><receiver>" keys for pair-level loop detection (D221). */
13
- readonly seenPairs: Set<string>;
14
- /** Caller-supplied max depth (D218). */
15
- readonly maxDepth: number;
16
- }
17
- export declare function createChainState(rootAgentId: string, maxDepth: number): HandoffChainState;
18
- /**
19
- * Record a handoff hop. Throws on depth-exceed (D218) or pair-loop (D221).
20
- * Mutates the state in place.
21
- */
22
- export declare function recordHop(state: HandoffChainState, senderAgentId: string, receiverAgentId: string): void;
23
- export declare function currentDepth(state: HandoffChainState): number;
@@ -1,18 +0,0 @@
1
- /**
2
- * D220 — Lazy-loaded OTel `handoff.transfer` span emitter.
3
- *
4
- * @internal
5
- */
6
- export interface HandoffSpanHandle {
7
- setAttribute(key: string, value: string | number | boolean): void;
8
- end(): void;
9
- }
10
- export declare function startHandoffSpan(attrs: {
11
- from: string;
12
- to: string;
13
- reason: string;
14
- depth: number;
15
- toolName: string;
16
- }): HandoffSpanHandle;
17
- /** Test-only — reset cached OTel handle. */
18
- export declare function __resetHandoffOtelCacheForTests(): void;
@@ -1,34 +0,0 @@
1
- /**
2
- * Convert `handoffs[]` entries into synthetic `transfer_to_<receiver>` tools
3
- * for injection into the agent's tool registry at construction time.
4
- *
5
- * The synthesized tool's handler calls `dispatchHandoff` internally and
6
- * returns the receiver's reply as `tool_result`. v1 trade-off documented
7
- * in dispatcher.ts.
8
- *
9
- * @internal
10
- */
11
- import type { CustomTool, SDKAgent } from "../../types/agent.js";
12
- import { type HandoffDescriptor } from "../../types/handoff.js";
13
- interface NormalizedHandoff {
14
- descriptor: HandoffDescriptor;
15
- }
16
- /**
17
- * Normalize each `handoffs[]` entry to a `HandoffDescriptor`. Raw `SDKAgent`
18
- * instances are auto-wrapped with default options. Validates:
19
- * - EC-6: no self-reference (would cause infinite recursion).
20
- * - D215: resolved tool names must be unique.
21
- */
22
- export declare function normalizeHandoffs(parentAgentId: string, entries: ReadonlyArray<SDKAgent | HandoffDescriptor>): NormalizedHandoff[];
23
- /**
24
- * Build a `CustomTool` for one handoff descriptor. The handler dispatches
25
- * the handoff using a fresh chain state per `send()`-level invocation.
26
- *
27
- * NOTE: this v1 builds a NEW chain state per tool invocation. Pure
28
- * cross-tool depth tracking within one send() requires per-Agent context
29
- * — deferred. The single-flight pair guard catches direct ping-pong even
30
- * without cross-invocation chain (since each call wraps the same depth
31
- * counter from 1).
32
- */
33
- export declare function buildHandoffTool(parentAgentId: string, descriptor: HandoffDescriptor, maxHandoffDepth: number): CustomTool;
34
- export {};
@@ -1,7 +0,0 @@
1
- /**
2
- * @deprecated Import from `../persistence/atomic-write.js` instead.
3
- * Maintained as re-export for backward compatibility (ADR D59).
4
- *
5
- * @internal
6
- */
7
- export { atomicWriteJson, replaceFileAtomic } from "../persistence/atomic-write.js";
@@ -1,4 +0,0 @@
1
- export declare function diaryPath(cwd: string): string;
2
- export declare function renderDiaryEntry(entry: DiaryEntry): string;
3
- export declare function appendDiaryEntry(cwd: string, entry: DiaryEntry): Promise<void>;
4
- export declare function entryHash(entry: DiaryEntry): string;
@@ -1,15 +0,0 @@
1
- import type { EmbeddingRuntime } from "../embedding-adapter.js";
2
- import type { MemoryFact } from "../types.js";
3
- export interface Cluster {
4
- representativeText: string;
5
- members: ReadonlyArray<MemoryFact>;
6
- }
7
- export interface ClusterResult {
8
- clusters: Cluster[];
9
- }
10
- /** Light phase — drop facts whose embedding is too similar to one already kept. */
11
- export declare function lightPhase(facts: ReadonlyArray<MemoryFact>, embedding: EmbeddingRuntime, threshold?: number): Promise<DedupResult>;
12
- /** REM phase — single-link agglomerative clustering by cosine similarity. */
13
- export declare function remPhase(facts: ReadonlyArray<MemoryFact>, embedding: EmbeddingRuntime, threshold?: number): Promise<ClusterResult>;
14
- /** Deep phase — render consolidated markdown for the dreamed note. */
15
- export declare function deepPhase(clusters: ReadonlyArray<Cluster>, timestampMs: number): string;
@@ -1,10 +0,0 @@
1
- export interface DreamingResult {
2
- status: "ok" | "skipped" | "error";
3
- factsBefore: number;
4
- factsAfter: number;
5
- duplicatesRemoved: number;
6
- clustersCreated: number;
7
- notesWritten: number;
8
- diaryEntryHash: string | undefined;
9
- }
10
- export declare function runDreamingSweep(options: DreamingOptions): Promise<DreamingResult>;
@@ -1,15 +0,0 @@
1
- export interface MigrateResult {
2
- countSqlite: number;
3
- countLance: number;
4
- /** Set when validation succeeded (or dryRun); false on validation failure. */
5
- validated: boolean;
6
- /** Per-fact compare results (size = sample count, up to 10). */
7
- sampleComparisons: ReadonlyArray<{
8
- id: string;
9
- match: boolean;
10
- }>;
11
- /** Lance storage location (final, after migration). */
12
- lancePath: string;
13
- /** Was the migration committed (false for dry-run). */
14
- committed: boolean;
15
- }
@@ -1,28 +0,0 @@
1
- /**
2
- * Runtime helpers for `MemoryAdapter` (T1.1, ADR D141).
3
- *
4
- * Kept separate from `types/memory-adapter.ts` so the types module
5
- * stays import-free of runtime code (dep-cruise rule
6
- * `types-dont-import-runtime`). Adapter authors call `mkMemoryId` to
7
- * construct a branded id and `extractRawId` to unwrap with cross-adapter
8
- * safety (EC-B).
9
- *
10
- * @public
11
- */
12
- import type { MemoryId } from "./types/memory-adapter.js";
13
- /**
14
- * Construct a branded `MemoryId` for an adapter. Embeds the adapter
15
- * identifier so `extractRawId` can reject ids minted by other adapters.
16
- *
17
- * @public
18
- */
19
- export declare function mkMemoryId(adapterId: string, rawId: string): MemoryId;
20
- /**
21
- * Extract the raw provider id from a `MemoryId`, enforcing that the
22
- * prefix matches `expectedAdapterId`. Throws `MemoryAdapterError(code:
23
- * "invalid_input")` on mismatch — prevents `mem0.delete(supermemoryId)`
24
- * from accidentally deleting unrelated data (EC-B).
25
- *
26
- * @public
27
- */
28
- export declare function extractRawId(id: MemoryId, expectedAdapterId: string): string;
package/dist/memory.d.ts DELETED
@@ -1,123 +0,0 @@
1
- /**
2
- * Public handle to an open memory index. Mirrors the internal `MemoryIndex`
3
- * contract structurally; defined here (NOT re-exported from internal/) so
4
- * the public DTS surface does not pull the internal/runtime cycle that
5
- * trips rollup-plugin-dts.
6
- *
7
- * @public
8
- */
9
- export interface MemoryIndexHandle {
10
- sync(): Promise<{
11
- filesScanned: number;
12
- filesUpdated: number;
13
- chunksWritten: number;
14
- chunksEmbedded: number;
15
- }>;
16
- search(query: string, options?: {
17
- maxResults?: number;
18
- minScore?: number;
19
- sources?: ReadonlyArray<"memory" | "sessions" | "wiki">;
20
- }): Promise<ReadonlyArray<{
21
- path: string;
22
- startLine: number;
23
- endLine: number;
24
- score: number;
25
- textScore: number;
26
- vectorScore?: number;
27
- snippet: string;
28
- source: "memory" | "sessions" | "wiki";
29
- citation: string;
30
- }>>;
31
- status(): {
32
- backend: "fts-only" | "hybrid";
33
- filesIndexed: number;
34
- chunksIndexed: number;
35
- lastSyncMs?: number;
36
- };
37
- close(): Promise<void> | void;
38
- }
39
- /**
40
- * Public `Memory` namespace.
41
- *
42
- * Exposes operations users can run outside of `agent.send()` — most notably
43
- * the dreaming sweep (consolidation of facts via dedup + clustering).
44
- *
45
- * @public
46
- */
47
- export interface DreamingSweepOptions {
48
- /** Workspace cwd holding `.theokit/memory/`. */
49
- cwd: string;
50
- /**
51
- * Embedding provider for semantic dedup + clustering. Required — dreaming
52
- * relies on real embeddings to score cosine similarity. Supported providers:
53
- * `"openai"`, `"mistral"`, `"openrouter"`, `"voyage"`, `"deepinfra"`,
54
- * `"ollama"` (local, ADR D183).
55
- */
56
- embedding: {
57
- provider: "openai" | "mistral" | "openrouter" | "voyage" | "deepinfra" | "ollama";
58
- model?: string;
59
- };
60
- /** Cosine-similarity threshold for the dedup phase. Default `0.95`. */
61
- dedupThreshold?: number;
62
- /** Cosine-similarity threshold for the clustering phase. Default `0.75`. */
63
- clusterThreshold?: number;
64
- }
65
- export interface DreamingSweepResult {
66
- status: "ok" | "skipped" | "error";
67
- factsBefore: number;
68
- factsAfter: number;
69
- duplicatesRemoved: number;
70
- clustersCreated: number;
71
- notesWritten: number;
72
- }
73
- /**
74
- * Options for `Memory.openIndex`. Mirrors the internal `OpenIndexOptions`
75
- * but using only public types from the SDK surface.
76
- *
77
- * @public
78
- */
79
- export interface OpenMemoryIndexOptions {
80
- /** Workspace cwd holding `.theokit/memory/`. */
81
- cwd: string;
82
- /** Override storage file path (SQLite) OR storage directory (Lance). */
83
- filePath?: string;
84
- /**
85
- * Embedding runtime — REQUIRED for `backend: "lance"`, optional for
86
- * `"sqlite-vec"` (when omitted, SQLite runs FTS-only without vector
87
- * recall).
88
- */
89
- embedding?: {
90
- provider: "openai" | "mistral" | "openrouter" | "voyage" | "deepinfra" | "ollama";
91
- model?: string;
92
- };
93
- /** Default `"sqlite-vec"`. Set to `"lance"` to opt into LanceDB (peer dep). */
94
- backend?: "sqlite-vec" | "lance";
95
- }
96
- export declare const Memory: {
97
- /**
98
- * Open a memory index. Dispatches to SQLite-vec (default, zero deps) or
99
- * LanceDB (opt-in via `backend: "lance"`, requires `@lancedb/lancedb`
100
- * peer dep + an embedding runtime).
101
- *
102
- * Returns a `MemoryIndex` with `sync()`, `search(query, opts?)`,
103
- * `status()`, and `close()`. Use this when you want a direct index
104
- * handle outside of `Agent.create({ memory: ... })`.
105
- *
106
- * @throws ConfigurationError({code:"invalid_memory_backend"}) for typos
107
- * like `"lancedb"`.
108
- * @throws ConfigurationError({code:"lance_requires_embedding"}) when
109
- * `backend: "lance"` is requested without `embedding`.
110
- * @throws ConfigurationError({code:"lance_backend_unavailable"}) when
111
- * `backend: "lance"` is requested but the peer dep is absent.
112
- *
113
- * @public
114
- */
115
- openIndex(opts: OpenMemoryIndexOptions): Promise<MemoryIndexHandle>;
116
- /**
117
- * Run a dreaming sweep: dedup near-duplicate facts, cluster thematically
118
- * related ones, and write a consolidated note + diary entry.
119
- *
120
- * @public
121
- */
122
- runDreamingSweep(opts: DreamingSweepOptions): Promise<DreamingSweepResult>;
123
- };
package/dist/migrate.d.ts DELETED
@@ -1,33 +0,0 @@
1
- /**
2
- * Options for {@link migrateSqliteToLance}.
3
- *
4
- * @public
5
- */
6
- export interface MigrateOptions {
7
- cwd: string;
8
- dryRun?: boolean;
9
- batchSize?: number;
10
- logger?: (msg: string) => void;
11
- }
12
- /**
13
- * Outcome of {@link migrateSqliteToLance}.
14
- *
15
- * @public
16
- */
17
- export interface MigrateResult {
18
- countSqlite: number;
19
- countLance: number;
20
- validated: boolean;
21
- sampleComparisons: ReadonlyArray<{
22
- id: string;
23
- match: boolean;
24
- }>;
25
- lancePath: string;
26
- committed: boolean;
27
- }
28
- /**
29
- * Migrate the Memory index from SQLite to LanceDB. ADR D44.
30
- *
31
- * @public
32
- */
33
- export declare function migrateSqliteToLance(options: MigrateOptions): Promise<MigrateResult>;
@@ -1,67 +0,0 @@
1
- /**
2
- * Public security namespace (T2.1, ADR D68).
3
- *
4
- * Two entry points:
5
- *
6
- * - `Security.redact(text, opts?)` — apply the canonical redactor to
7
- * arbitrary text. Useful when a consumer app (or example) writes its
8
- * own logs / metrics / paste-share artifacts that the SDK's wired
9
- * sinks (error metadata, telemetry, transcript, migration) don't
10
- * cover.
11
- * - `Security.addPattern(re)` — register a custom credential pattern
12
- * on top of the 12 builtins (OpenAI, Anthropic, GitHub PAT classic +
13
- * fine, GitLab, AWS, Google, Slack, Sentry, Stripe live + restricted)
14
- * plus the parametric `key=value` + `Bearer <token>` matchers.
15
- *
16
- * Redaction is ON by default. Disable with `THEOKIT_REDACT_SECRETS=false`
17
- * (a warning is emitted on stderr so the operator knows the SDK process
18
- * is vulnerable). The env var is snapshotted at module init — runtime
19
- * mutation cannot disable it, defending against prompt injection that
20
- * tries to flip the flag mid-run.
21
- */
22
- export declare class Security {
23
- private constructor();
24
- /**
25
- * Redact known credential patterns from `text` and return the masked
26
- * string. Use this at any consumer output boundary the SDK does not
27
- * directly own (custom stdout loggers, app-level metrics, debug-share
28
- * artifacts, etc.).
29
- *
30
- * Coerces non-strings (objects via JSON.stringify, null/undefined → "").
31
- * Two-bucket masking: tokens shorter than 18 chars → `***`; longer
32
- * tokens preserve `prefix...suffix` for debuggability without revealing
33
- * the secret middle.
34
- *
35
- * @param text - The value to redact. Strings, objects, primitives all OK.
36
- * @param opts.codeFile - When `true`, skips the parametric `key=value`
37
- * matcher so file content like `.env.example` placeholders is left
38
- * intact. Built-in pattern matches still apply.
39
- *
40
- * @example
41
- * console.log(`[bot] received: ${Security.redact(userText)}`);
42
- * // → "[bot] received: please remember sk-abc...xyz1"
43
- */
44
- static redact(text: unknown, opts?: {
45
- codeFile?: boolean;
46
- }): string;
47
- /**
48
- * Register a custom redaction pattern. Additive — built-in patterns
49
- * (OpenAI, Anthropic, GitHub PAT, AWS, etc.) cannot be removed.
50
- *
51
- * @param re - RegExp with `/g` flag. Throws if `/g` is missing
52
- * (without /g, only first match is replaced and the rest
53
- * leaks).
54
- *
55
- * Process-global mutable state. The SDK is designed for single-tenant
56
- * processes (Theo PaaS user runtime, local CLI). Multi-tenant
57
- * deployments running multiple SDK consumers in the same Node process
58
- * share this list — patterns added by tenant A apply to tenant B's
59
- * redactions. Acceptable for v1; future isolate-aware refactor would
60
- * thread patterns through a context if needed.
61
- *
62
- * @example
63
- * Security.addPattern(/MYORG-[A-Z0-9]{32}/g);
64
- * // → text containing "MYORG-AAAA...AAAA" now masks like a builtin.
65
- */
66
- static addPattern(re: RegExp): void;
67
- }
package/dist/task.d.ts DELETED
@@ -1,87 +0,0 @@
1
- /**
2
- * `Task` — observable async work registry (Adoption Roadmap gap #2,
3
- * ADRs D361-D374).
4
- *
5
- * Static facade delegating to the in-process `TaskRegistry` singleton.
6
- * The lifecycle of any task is the 5-state machine `queued | running |
7
- * finished | error | cancelled` (D362). Wrapping `Agent.send` /
8
- * `Agent.batch` / `Workflow.run` / `Cron` fires is opt-in via the
9
- * `{ task: true }` option on each (D363).
10
- *
11
- * @public
12
- */
13
- import type { TaskCancelResult, TaskEvent, TaskFilter, TaskHandle, TaskKind, TaskStoreOptions, TaskSubmitOptions } from "./types/task.js";
14
- export interface TaskWorkContext {
15
- readonly signal: AbortSignal;
16
- emit(payload: unknown): void;
17
- }
18
- export type TaskWorkFn<T> = (ctx: TaskWorkContext) => Promise<T> | T;
19
- /**
20
- * Registry-level configuration. May only be applied BEFORE the first
21
- * `Task.submit` of the process — see EC-13. Subsequent calls emit a
22
- * single stderr line and become no-ops.
23
- */
24
- export interface TaskConfigureOptions {
25
- readonly store?: TaskStoreOptions;
26
- readonly maxConcurrent?: number;
27
- readonly retentionMs?: number;
28
- }
29
- export declare class Task {
30
- private constructor();
31
- /**
32
- * Configure the registry. **Must be called before the first `submit`**
33
- * (EC-13). Available knobs: pluggable store (D364), concurrency cap
34
- * (D369), and retention (D373).
35
- */
36
- static configure(opts: TaskConfigureOptions): void;
37
- /**
38
- * Submit a unit of asynchronous work to the registry.
39
- *
40
- * The `work` function receives `{ signal, emit }` — `signal` is the
41
- * AbortSignal honored on cancel; `emit(payload)` produces a
42
- * `progress` event observable via `Task.subscribe`.
43
- *
44
- * Returns a `TaskHandle` in `state: "queued"`. Subsequent state
45
- * transitions are observable via `Task.subscribe(handle.id)` OR
46
- * polled via `Task.get(handle.id)`.
47
- *
48
- * **Idempotency (D367):** submitting twice with the same `id` returns
49
- * the existing handle without re-invoking work.
50
- *
51
- * **Grammar (D368):** user-supplied ids must match
52
- * `^[a-z0-9][a-z0-9_-]*$` and must not start with reserved prefixes
53
- * `wf-` / `b-` / `cron-`. Otherwise `InvalidTaskIdError` is thrown.
54
- *
55
- * **Pre-aborted signal (EC-4):** if `options.signal` is already
56
- * aborted, the task short-circuits to `cancelled` without acquiring
57
- * a semaphore slot and without invoking `work`.
58
- */
59
- static submit<T>(kind: TaskKind, work: TaskWorkFn<T>, options?: TaskSubmitOptions): Promise<TaskHandle>;
60
- /** Returns matching handles, capped at `filter.limit ?? 100`. */
61
- static list(filter?: TaskFilter): Promise<TaskHandle[]>;
62
- /** Returns a single handle by id, or `undefined` if unknown / evicted. */
63
- static get(id: string): Promise<TaskHandle | undefined>;
64
- /**
65
- * Idempotent cancel (D365). Returns:
66
- * - `{ cancelled: true, alreadyTerminal: false }` — transitioned
67
- * queued/running task to `cancelled`.
68
- * - `{ cancelled: false, alreadyTerminal: true }` — task already
69
- * terminal.
70
- * - `{ cancelled: false, alreadyTerminal: false }` — task unknown.
71
- *
72
- * Never throws.
73
- */
74
- static cancel(id: string, reason?: string): Promise<TaskCancelResult>;
75
- /**
76
- * Subscribe to a task's event stream. The returned `AsyncIterable<TaskEvent>`
77
- * starts by replaying buffered events (ring buffer cap 64, D372) and
78
- * then yields live events until a terminal event (finished / errored
79
- * / cancelled) is emitted, at which point it closes automatically.
80
- *
81
- * Calling `.return()` on the iterator (or `break` in a `for await`)
82
- * cleans up the subscriber callback (EC-10).
83
- *
84
- * Throws `TaskNotFoundError` if the id is unknown or has been evicted.
85
- */
86
- static subscribe(id: string): AsyncIterable<TaskEvent>;
87
- }
package/dist/theokit.d.ts DELETED
@@ -1,84 +0,0 @@
1
- import type { SDKProvider } from "./types/providers.js";
2
- import type { SDKModel, SDKRepository, SDKUser } from "./types/theokit.js";
3
- /**
4
- * Options shared by every `Theokit.*` request.
5
- *
6
- * @public
7
- */
8
- export interface TheokitRequestOptions {
9
- /** Override the `THEOKIT_API_KEY` env var for this call. */
10
- apiKey?: string;
11
- /**
12
- * Target a specific provider for catalog reads. When set to a provider
13
- * with `authType: "none"` (e.g. `"ollama"`, `"lmstudio"`, `"llamacpp"`),
14
- * `Theokit.models.list({ provider })` reads from the provider's local
15
- * `/v1/models` endpoint instead of the TheoCloud catalog. ADR D184.
16
- *
17
- * @public
18
- */
19
- provider?: string;
20
- }
21
- /**
22
- * Account-level and catalog reads. All methods accept an optional `apiKey`
23
- * and otherwise fall back to the `THEOKIT_API_KEY` environment variable.
24
- *
25
- * @public
26
- */
27
- export declare class Theokit {
28
- private constructor();
29
- /**
30
- * Return the user behind the current API key.
31
- *
32
- * @public
33
- */
34
- static me(options?: TheokitRequestOptions): Promise<SDKUser>;
35
- /**
36
- * Model catalog reads.
37
- *
38
- * @public
39
- */
40
- static readonly models: {
41
- list: (options?: TheokitRequestOptions) => Promise<SDKModel[]>;
42
- };
43
- /**
44
- * Connected GitHub repositories for the calling user's team. Cloud only.
45
- *
46
- * @public
47
- */
48
- static readonly repositories: {
49
- list: (options?: TheokitRequestOptions) => Promise<SDKRepository[]>;
50
- };
51
- /**
52
- * Provider catalog. Lists every provider known to the platform, including
53
- * plugin-registered ones, with capability and availability metadata.
54
- *
55
- * @public
56
- */
57
- static readonly providers: {
58
- list: (options?: TheokitRequestOptions) => Promise<SDKProvider[]>;
59
- };
60
- /**
61
- * Local introspection of bundled SDK assets (ADR D201). Unlike the
62
- * cloud-catalog `providers.list()` (which hits the TheoCloud HTTP API),
63
- * `inspect.*` reads the SDK's own bundled registries — useful for
64
- * tooling (e.g. `@theokit/cli`'s `theokit inspect`) that needs to know
65
- * what's available WITHOUT a network round-trip.
66
- *
67
- * @public
68
- */
69
- static readonly inspect: {
70
- builtinProviders: () => Array<{
71
- readonly name: string;
72
- readonly apiMode: string;
73
- readonly authType: string;
74
- readonly baseUrl: string;
75
- readonly aliases?: ReadonlyArray<string>;
76
- readonly envVars: ReadonlyArray<string>;
77
- }>;
78
- embeddingAdapters: () => Array<{
79
- readonly id: string;
80
- readonly transport: string;
81
- readonly defaultModel: string;
82
- }>;
83
- };
84
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * Shared `safePathJoin + assertNoSymlinkEscape` helper for built-in coding
3
- * tools (git-diff, run-vitest, list-dir, read-file, search-text). Returns a
4
- * pre-formatted `path_traversal` JSON string on failure or `null` on pass.
5
- *
6
- * @internal
7
- */
8
- export declare function checkPathScope(path: string | undefined, projectRoot: string): string | null;
@@ -1,28 +0,0 @@
1
- /**
2
- * Shared subprocess-watch helpers for built-in coding tools (git-diff,
3
- * run-vitest). Wires the on(close)/on(error) settle pattern in a single
4
- * place to eliminate the cross-file clone flagged by jscpd.
5
- *
6
- * @internal
7
- */
8
- /**
9
- * Settle gate — guarantees the supplied callback fires exactly once across
10
- * the close/error/timeout race. Clears the timer on settle.
11
- */
12
- interface SettleGate {
13
- /** True after first settle; subsequent calls are no-ops. */
14
- settled: () => boolean;
15
- /** Settle the gate, clear the timer, and call `onSettle()`. */
16
- fire: (onSettle: () => void) => void;
17
- }
18
- /**
19
- * Wire SIGKILL-on-timeout for a detached process group. Returns the settle
20
- * gate so caller listeners can short-circuit when the timeout already fired.
21
- */
22
- export declare function armTimeoutKill<T>(child: ChildProcess, timeoutMs: number, onTimeout: () => T, resolve: (value: T) => void): SettleGate;
23
- /**
24
- * Attach a close+error pair of listeners that resolve via the supplied
25
- * callbacks. Honors the gate so timeout-vs-close races settle exactly once.
26
- */
27
- export declare function attachChildSettlers<T>(child: ChildProcess, gate: SettleGate, onClose: (code: number | null) => T, onError: (err: Error) => T, resolve: (value: T) => void): void;
28
- export {};