@mastra/core 1.86.0-alpha.8 → 1.86.0-alpha.9

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 (459) hide show
  1. package/dist/_types/@internal_core@0.1.4/dist/knowledge-compat/index.d.ts +363 -0
  2. package/dist/a2a/index.cjs +1 -1
  3. package/dist/a2a/index.js +1 -1
  4. package/dist/agent/agent.d.ts +12 -0
  5. package/dist/agent/durable/index.cjs +1 -13
  6. package/dist/agent/durable/index.js +1 -13
  7. package/dist/agent/durable/preparation.d.ts +2 -0
  8. package/dist/agent/durable/utils/resolve-runtime.d.ts +9 -0
  9. package/dist/agent/durable/workflows/durable-loop-builder.d.ts +4 -0
  10. package/dist/agent/durable/workflows/finalize-run.d.ts +3 -1
  11. package/dist/agent/durable/workflows/steps/llm-execution.d.ts +1 -0
  12. package/dist/agent/index.cjs +3 -3
  13. package/dist/agent/index.js +3 -3
  14. package/dist/agent/message-list/index.cjs +1 -1
  15. package/dist/agent/message-list/index.js +1 -1
  16. package/dist/agent/message-list/message-list.d.ts +11 -0
  17. package/dist/agent/message-list/utils/provider-compat.d.ts +1 -0
  18. package/dist/agent/request-context-snapshot.d.ts +1 -1
  19. package/dist/agent/streams/types.d.ts +10 -0
  20. package/dist/agent/thread-stream-runtime.d.ts +5 -0
  21. package/dist/agent-builder/ee/index.cjs +1 -1
  22. package/dist/agent-builder/ee/index.js +1 -1
  23. package/dist/agent-controller/index.cjs +1 -1
  24. package/dist/agent-controller/index.js +1 -1
  25. package/dist/{agent-controller-DEPayioq.cjs → agent-controller-CrQ9OF80.cjs} +7 -7
  26. package/dist/{agent-controller-B7POPub5.js → agent-controller-SSlKzE6A.js} +7 -7
  27. package/dist/background-tasks/index.cjs +1 -1
  28. package/dist/background-tasks/index.js +1 -1
  29. package/dist/{background-tasks-7iftnRK_.cjs → background-tasks-BDrYBis-.cjs} +5 -3
  30. package/dist/{background-tasks-Cv1ecD6S.js → background-tasks-BnJfNLFo.js} +5 -3
  31. package/dist/browser/index.cjs +2 -2
  32. package/dist/browser/index.js +2 -2
  33. package/dist/{builder-Gg-xnX_E.js → builder-Cl-0BWkh.js} +2 -2
  34. package/dist/{builder-DuJBbQDH.cjs → builder-Cw8u3pPl.cjs} +2 -2
  35. package/dist/capabilities/302ai.json +204 -204
  36. package/dist/capabilities/abliteratedllm.json +30 -30
  37. package/dist/capabilities/above.json +21 -21
  38. package/dist/capabilities/adaption.json +15 -15
  39. package/dist/capabilities/adzuki.json +24 -24
  40. package/dist/capabilities/agentrouter.json +9 -9
  41. package/dist/capabilities/agnes.json +3 -3
  42. package/dist/capabilities/ai-router.json +8 -8
  43. package/dist/capabilities/aiand.json +31 -23
  44. package/dist/capabilities/aigrow.json +14 -14
  45. package/dist/capabilities/aimlapi.json +144 -147
  46. package/dist/capabilities/aipg.json +2 -2
  47. package/dist/capabilities/aixy.json +21 -21
  48. package/dist/capabilities/aki-io.json +10 -10
  49. package/dist/capabilities/alibaba-cn.json +136 -117
  50. package/dist/capabilities/alibaba-coding-plan-cn.json +7 -19
  51. package/dist/capabilities/alibaba-coding-plan.json +7 -19
  52. package/dist/capabilities/alibaba-token-plan-cn.json +49 -67
  53. package/dist/capabilities/alibaba-token-plan.json +50 -68
  54. package/dist/capabilities/alibaba.json +72 -119
  55. package/dist/capabilities/ambient.json +8 -8
  56. package/dist/capabilities/amd.json +10 -10
  57. package/dist/capabilities/anthropic.json +47 -47
  58. package/dist/capabilities/anyapi.json +19 -19
  59. package/dist/capabilities/apiko.json +5 -5
  60. package/dist/capabilities/arcee.json +11 -11
  61. package/dist/capabilities/augure.json +2 -2
  62. package/dist/capabilities/auriko.json +23 -23
  63. package/dist/capabilities/bailing.json +4 -4
  64. package/dist/capabilities/baseten.json +55 -25
  65. package/dist/capabilities/bee.json +4 -4
  66. package/dist/capabilities/berget.json +5 -5
  67. package/dist/capabilities/bothub.json +17 -17
  68. package/dist/capabilities/boundless.json +37 -37
  69. package/dist/capabilities/bumo.json +41 -41
  70. package/dist/capabilities/byteplus.json +26 -26
  71. package/dist/capabilities/cerebras.json +4 -4
  72. package/dist/capabilities/cheapaimodel.json +3 -3
  73. package/dist/capabilities/cheapest-token.json +30 -30
  74. package/dist/capabilities/chutes.json +10 -10
  75. package/dist/capabilities/cline-pass.json +39 -39
  76. package/dist/capabilities/cloudcode.json +9 -9
  77. package/dist/capabilities/cloudferro-sherlock.json +4 -4
  78. package/dist/capabilities/cloudflare-workers-ai.json +33 -33
  79. package/dist/capabilities/commandcode.json +139 -139
  80. package/dist/capabilities/concentrate.json +274 -274
  81. package/dist/capabilities/cortecs.json +108 -108
  82. package/dist/capabilities/crossmodel.json +189 -189
  83. package/dist/capabilities/crusoe.json +10 -10
  84. package/dist/capabilities/daoxe.json +9 -9
  85. package/dist/capabilities/databricks.json +315 -59
  86. package/dist/capabilities/deepinfra.json +90 -155
  87. package/dist/capabilities/deepseek.json +2 -2
  88. package/dist/capabilities/digitalocean.json +114 -114
  89. package/dist/capabilities/dothoosh.json +34 -34
  90. package/dist/capabilities/doubleword.json +28 -28
  91. package/dist/capabilities/edenai.json +433 -433
  92. package/dist/capabilities/empiriolabs.json +176 -176
  93. package/dist/capabilities/engy.json +17 -17
  94. package/dist/capabilities/entrim.json +6 -6
  95. package/dist/capabilities/evroc.json +13 -13
  96. package/dist/capabilities/ezkielyna.json +12 -12
  97. package/dist/capabilities/fastrouter.json +88 -88
  98. package/dist/capabilities/fireworks-ai.json +104 -41
  99. package/dist/capabilities/freemodel.json +20 -20
  100. package/dist/capabilities/friendli.json +9 -9
  101. package/dist/capabilities/frogbot.json +93 -93
  102. package/dist/capabilities/gisoo.json +19 -19
  103. package/dist/capabilities/gmicloud.json +21 -21
  104. package/dist/capabilities/google.json +55 -55
  105. package/dist/capabilities/graphn.json +11 -11
  106. package/dist/capabilities/greenpt.json +36 -36
  107. package/dist/capabilities/groq.json +9 -9
  108. package/dist/capabilities/helicone.json +83 -83
  109. package/dist/capabilities/hostinger-router.json +13 -13
  110. package/dist/capabilities/hpc-ai.json +8 -8
  111. package/dist/capabilities/huawei-maas.json +17 -17
  112. package/dist/capabilities/hubris.json +28 -28
  113. package/dist/capabilities/huggingface.json +200 -53
  114. package/dist/capabilities/humain.json +2 -2
  115. package/dist/capabilities/hyper.json +26 -26
  116. package/dist/capabilities/impossibl.json +127 -127
  117. package/dist/capabilities/inception.json +2 -2
  118. package/dist/capabilities/inceptron.json +8 -8
  119. package/dist/capabilities/inco.json +4 -4
  120. package/dist/capabilities/infer.json +14 -14
  121. package/dist/capabilities/inference-coop.json +15 -15
  122. package/dist/capabilities/inferenceapis.json +22 -22
  123. package/dist/capabilities/inferris.json +3 -3
  124. package/dist/capabilities/infersia.json +9 -9
  125. package/dist/capabilities/inferx.json +3 -3
  126. package/dist/capabilities/infomaniak.json +4 -4
  127. package/dist/capabilities/io-net.json +5 -5
  128. package/dist/capabilities/isoquant.json +4 -4
  129. package/dist/capabilities/iteracompute.json +51 -51
  130. package/dist/capabilities/jalapeno.json +12 -12
  131. package/dist/capabilities/jiekou.json +65 -65
  132. package/dist/capabilities/joingonka.json +4 -4
  133. package/dist/capabilities/jzstoken.json +54 -54
  134. package/dist/capabilities/keln.json +21 -28
  135. package/dist/capabilities/kenari.json +124 -121
  136. package/dist/capabilities/kilo.json +635 -636
  137. package/dist/capabilities/kimi-code-plan-cn.json +6 -6
  138. package/dist/capabilities/kimi-code-plan-global.json +6 -6
  139. package/dist/capabilities/kitani.json +4 -4
  140. package/dist/capabilities/klavo.json +13 -13
  141. package/dist/capabilities/korouter.json +31 -31
  142. package/dist/capabilities/kunavo.json +9 -9
  143. package/dist/capabilities/liquid.json +10 -10
  144. package/dist/capabilities/llmgateway-providers.json +909 -909
  145. package/dist/capabilities/llmgateway.json +333 -333
  146. package/dist/capabilities/llmtr.json +19 -19
  147. package/dist/capabilities/logits.json +2 -2
  148. package/dist/capabilities/longcat.json +1 -6
  149. package/dist/capabilities/lowrouter.json +52 -52
  150. package/dist/capabilities/lyceum.json +7 -7
  151. package/dist/capabilities/melious.json +16 -16
  152. package/dist/capabilities/merge-gateway.json +275 -275
  153. package/dist/capabilities/meta.json +9 -9
  154. package/dist/capabilities/minimax-cn-coding-plan.json +6 -6
  155. package/dist/capabilities/minimax-coding-plan.json +6 -6
  156. package/dist/capabilities/mistral.json +18 -18
  157. package/dist/capabilities/mixlayer.json +5 -5
  158. package/dist/capabilities/modal.json +13 -13
  159. package/dist/capabilities/model-oracle-ai.json +26 -26
  160. package/dist/capabilities/modelis.json +24 -24
  161. package/dist/capabilities/modelscope.json +2 -2
  162. package/dist/capabilities/modular.json +9 -9
  163. package/dist/capabilities/moneo.json +14 -14
  164. package/dist/capabilities/moonshotai-cn.json +6 -6
  165. package/dist/capabilities/moonshotai.json +6 -6
  166. package/dist/capabilities/morph.json +13 -13
  167. package/dist/capabilities/munito-eu.json +6 -6
  168. package/dist/capabilities/munito.json +10 -10
  169. package/dist/capabilities/nan.json +24 -24
  170. package/dist/capabilities/nano-gpt.json +577 -577
  171. package/dist/capabilities/nearai.json +82 -82
  172. package/dist/capabilities/nebius.json +29 -29
  173. package/dist/capabilities/neon.json +134 -134
  174. package/dist/capabilities/neuralwatt.json +43 -43
  175. package/dist/capabilities/nokeep.json +4 -4
  176. package/dist/capabilities/novita-ai.json +135 -135
  177. package/dist/capabilities/nvidia.json +38 -38
  178. package/dist/capabilities/oathbreaker.json +2 -2
  179. package/dist/capabilities/obscurify.json +26 -26
  180. package/dist/capabilities/oci.json +5 -5
  181. package/dist/capabilities/ofox.json +338 -338
  182. package/dist/capabilities/ollama-cloud.json +55 -55
  183. package/dist/capabilities/openai.json +48 -48
  184. package/dist/capabilities/opencode-go.json +81 -81
  185. package/dist/capabilities/openreason.json +5 -5
  186. package/dist/capabilities/openrouter.json +548 -563
  187. package/dist/capabilities/opper.json +23 -23
  188. package/dist/capabilities/orcarouter.json +212 -212
  189. package/dist/capabilities/outerlabs.json +30 -30
  190. package/dist/capabilities/ovhcloud.json +8 -8
  191. package/dist/capabilities/pareto.json +5 -5
  192. package/dist/capabilities/pendra.json +4 -4
  193. package/dist/capabilities/perplexity-agent.json +59 -59
  194. package/dist/capabilities/perplexity.json +2 -2
  195. package/dist/capabilities/phala.json +27 -27
  196. package/dist/capabilities/pioneer.json +24 -24
  197. package/dist/capabilities/poe.json +136 -136
  198. package/dist/capabilities/powerspring.json +14 -14
  199. package/dist/capabilities/primalabs.json +7 -7
  200. package/dist/capabilities/prime.json +108 -108
  201. package/dist/capabilities/privatemode-ai.json +12 -12
  202. package/dist/capabilities/proxystacks.json +6 -6
  203. package/dist/capabilities/qiniu-ai.json +15 -15
  204. package/dist/capabilities/refuseless.json +9 -9
  205. package/dist/capabilities/regolo-ai.json +6 -6
  206. package/dist/capabilities/requesty.json +171 -171
  207. package/dist/capabilities/ruapi.json +20 -20
  208. package/dist/capabilities/runcrate.json +16 -16
  209. package/dist/capabilities/runinfra.json +17 -17
  210. package/dist/capabilities/sakana.json +6 -6
  211. package/dist/capabilities/sambanova.json +6 -6
  212. package/dist/capabilities/sandbase.json +16 -16
  213. package/dist/capabilities/sarvam.json +12 -12
  214. package/dist/capabilities/scaleway.json +17 -17
  215. package/dist/capabilities/scnet-token-plan.json +8 -8
  216. package/dist/capabilities/scx-ai.json +29 -29
  217. package/dist/capabilities/sensenova.json +14 -14
  218. package/dist/capabilities/siliconflow-cn.json +61 -61
  219. package/dist/capabilities/siliconflow.json +57 -57
  220. package/dist/capabilities/snowflake-cortex.json +24 -24
  221. package/dist/capabilities/sokkan.json +10 -10
  222. package/dist/capabilities/sparrowcodes.json +24 -24
  223. package/dist/capabilities/standardcompute.json +89 -89
  224. package/dist/capabilities/steadyrouter.json +38 -38
  225. package/dist/capabilities/stepfun-ai-step-plan.json +7 -7
  226. package/dist/capabilities/stepfun-ai.json +16 -9
  227. package/dist/capabilities/stepfun-step-plan.json +16 -9
  228. package/dist/capabilities/stepfun.json +16 -9
  229. package/dist/capabilities/stepping-stone.json +18 -18
  230. package/dist/capabilities/subconscious.json +2 -2
  231. package/dist/capabilities/synthetic.json +12 -12
  232. package/dist/capabilities/synthorai.json +26 -26
  233. package/dist/capabilities/teamorouter.json +21 -21
  234. package/dist/capabilities/teapot-router.json +9 -9
  235. package/dist/capabilities/tencent-coding-plan.json +1 -23
  236. package/dist/capabilities/tencent-token-plan.json +57 -20
  237. package/dist/capabilities/tencent-tokenhub.json +182 -7
  238. package/dist/capabilities/tensorx.json +36 -36
  239. package/dist/capabilities/the-grid-ai.json +29 -29
  240. package/dist/capabilities/thinkingmachines.json +73 -56
  241. package/dist/capabilities/tinfoil.json +9 -9
  242. package/dist/capabilities/toapis.json +3 -3
  243. package/dist/capabilities/togetherai.json +61 -90
  244. package/dist/capabilities/tokengo.json +21 -21
  245. package/dist/capabilities/tokenify.json +9 -9
  246. package/dist/capabilities/trustedrouter.json +7 -7
  247. package/dist/capabilities/trustedtokens.json +14 -14
  248. package/dist/capabilities/umans-ai-coding-plan.json +13 -13
  249. package/dist/capabilities/umans-ai.json +10 -10
  250. package/dist/capabilities/uncensuredai.json +4 -4
  251. package/dist/capabilities/unrestricted.json +4 -4
  252. package/dist/capabilities/uplinkswitch.json +19 -19
  253. package/dist/capabilities/upstage.json +6 -6
  254. package/dist/capabilities/vancine.json +19 -19
  255. package/dist/capabilities/vercel.json +558 -537
  256. package/dist/capabilities/vivgrid.json +78 -78
  257. package/dist/capabilities/volcengine-coding-plan.json +26 -56
  258. package/dist/capabilities/volcengine.json +57 -62
  259. package/dist/capabilities/vultr.json +28 -28
  260. package/dist/capabilities/wafer.ai.json +18 -18
  261. package/dist/capabilities/wallaby.json +5 -5
  262. package/dist/capabilities/wally.json +14 -14
  263. package/dist/capabilities/wandb.json +20 -20
  264. package/dist/capabilities/watt.json +22 -22
  265. package/dist/capabilities/xai.json +4 -4
  266. package/dist/capabilities/xiaomi-token-plan-ams.json +2 -12
  267. package/dist/capabilities/xiaomi-token-plan-cn.json +2 -12
  268. package/dist/capabilities/xiaomi-token-plan-sgp.json +2 -12
  269. package/dist/capabilities/xiaomi.json +3 -25
  270. package/dist/capabilities/xpersona.json +11 -11
  271. package/dist/capabilities/xxapi.json +27 -27
  272. package/dist/capabilities/zai-coding-plan.json +14 -14
  273. package/dist/capabilities/zai.json +47 -24
  274. package/dist/capabilities/zenifra.json +24 -24
  275. package/dist/capabilities/zenmux.json +185 -185
  276. package/dist/capabilities/zerogpu.json +12 -12
  277. package/dist/capabilities/zhipuai-coding-plan.json +8 -8
  278. package/dist/capabilities/zhipuai.json +35 -20
  279. package/dist/capabilities/zro.json +7 -7
  280. package/dist/channels/index.cjs +2 -2
  281. package/dist/channels/index.js +2 -2
  282. package/dist/{channels-BRVCOutx.js → channels-Cz1y3W6u.js} +1 -1
  283. package/dist/{channels-MjTA9bFp.cjs → channels-DQg4v_gm.cjs} +1 -1
  284. package/dist/coding-agent/index.cjs +2 -2
  285. package/dist/coding-agent/index.js +2 -2
  286. package/dist/datasets/index.cjs +2 -2
  287. package/dist/datasets/index.js +2 -2
  288. package/dist/docs/SKILL.md +3 -2
  289. package/dist/docs/assets/SOURCE_MAP.json +895 -870
  290. package/dist/docs/references/docs-harness-background-tasks.md +4 -1
  291. package/dist/docs/references/docs-knowledge-importers.md +195 -0
  292. package/dist/docs/references/docs-knowledge-load-your-content.md +1 -1
  293. package/dist/docs/references/docs-knowledge-overview.md +1 -1
  294. package/dist/docs/references/docs-sandbox-filesystem.md +1 -1
  295. package/dist/docs/references/docs-signals-thread-streams.md +1 -1
  296. package/dist/docs/references/docs-studio-auth.md +54 -7
  297. package/dist/docs/references/integrations-auth-clerk.md +48 -4
  298. package/dist/docs/references/reference-agents-agent.md +1 -1
  299. package/dist/docs/references/reference-agents-durable-agent.md +10 -4
  300. package/dist/docs/references/reference-auth-clerk.md +21 -1
  301. package/dist/docs/references/reference-knowledge-knowledge-class.md +11 -4
  302. package/dist/docs/references/reference-memory-observational-memory.md +2 -2
  303. package/dist/docs/references/reference-streaming-ChunkType.md +2 -2
  304. package/dist/docs/references/reference-workspace-local-sandbox.md +2 -0
  305. package/dist/error/index.cjs +1 -1
  306. package/dist/error/index.js +1 -1
  307. package/dist/{error-C9d_24w-.js → error-BLwEXqOK.js} +2 -2
  308. package/dist/{error-BRQf2ku0.cjs → error-BdEvO8za.cjs} +2 -2
  309. package/dist/evals/index.cjs +1 -1
  310. package/dist/evals/index.js +1 -1
  311. package/dist/evals/scoreTraces/index.cjs +1 -1
  312. package/dist/evals/scoreTraces/index.js +1 -1
  313. package/dist/features/index.cjs +1 -0
  314. package/dist/features/index.js +1 -0
  315. package/dist/{filesystem-B5X-5G0x.js → filesystem-B8ad6kAW.js} +1 -1
  316. package/dist/{filesystem-BDSpwBke.cjs → filesystem-BB5YWXH-.cjs} +1 -1
  317. package/dist/{filesystem-DzM9pcQ8.js → filesystem-BDHUxbHn.js} +1 -1
  318. package/dist/{filesystem-B0AZrbj8.cjs → filesystem-BP5yz5LG.cjs} +1 -1
  319. package/dist/{filesystem-BsdkC311.js → filesystem-B_afSgYk.js} +1 -1
  320. package/dist/{filesystem-C-cyJfi1.cjs → filesystem-BaOJOc-V.cjs} +1 -1
  321. package/dist/{filesystem-B3s0WRud.js → filesystem-BhYgU8qg.js} +1 -1
  322. package/dist/{filesystem-DzfqVTO_.js → filesystem-CLBVmR5j.js} +1 -1
  323. package/dist/{filesystem-CEbD_77-.cjs → filesystem-Cgxc2a_-.cjs} +1 -1
  324. package/dist/{filesystem-Cv79mHRk.js → filesystem-ClBOBoDc.js} +1 -1
  325. package/dist/{filesystem-DsCQiBl2.cjs → filesystem-DVVecqZt.cjs} +1 -1
  326. package/dist/{filesystem-CUAgLugE.cjs → filesystem-Fpsu7e24.cjs} +1 -1
  327. package/dist/{filesystem-versioned-Bijb_p9l.js → filesystem-versioned-BL1ojJLo.js} +1 -1
  328. package/dist/{filesystem-versioned-DZGyPbNC.cjs → filesystem-versioned-BavRtYWJ.cjs} +1 -1
  329. package/dist/harness/index.cjs +1 -1
  330. package/dist/harness/index.js +1 -1
  331. package/dist/index.cjs +1 -1
  332. package/dist/index.js +1 -1
  333. package/dist/knowledge/config.d.ts +10 -0
  334. package/dist/knowledge/host-writes.d.ts +10 -0
  335. package/dist/knowledge/importers/conformance.d.ts +25 -0
  336. package/dist/knowledge/importers/define.d.ts +204 -0
  337. package/dist/knowledge/importers/host.d.ts +143 -0
  338. package/dist/knowledge/importers/index.d.ts +12 -0
  339. package/dist/knowledge/importers/local-host.d.ts +106 -0
  340. package/dist/knowledge/importers/manifest.d.ts +25 -0
  341. package/dist/knowledge/importers/runner.d.ts +61 -0
  342. package/dist/knowledge/importers/sink.d.ts +105 -0
  343. package/dist/knowledge/importers/types.d.ts +144 -0
  344. package/dist/knowledge/index.cjs +2715 -8
  345. package/dist/knowledge/index.d.ts +54 -4
  346. package/dist/knowledge/index.js +2692 -9
  347. package/dist/knowledge/instructions.d.ts +1 -1
  348. package/dist/knowledge/links.d.ts +8 -0
  349. package/dist/knowledge/pinned-state-processor.d.ts +5 -0
  350. package/dist/knowledge/pinned.d.ts +4 -1
  351. package/dist/knowledge/scope-runtime.d.ts +10 -0
  352. package/dist/llm/index.cjs +3 -3
  353. package/dist/llm/index.js +3 -3
  354. package/dist/llm/model/provider-types.generated.d.ts +7705 -7727
  355. package/dist/{llm-DmUucguC.cjs → llm-8Av3mSjD.cjs} +2 -2
  356. package/dist/{llm-Djd8Qzi0.js → llm-B5A5cwJr.js} +2 -2
  357. package/dist/loop/index.cjs +2 -2
  358. package/dist/loop/index.js +2 -2
  359. package/dist/{manager-CO_Xz2zR.js → manager-DfWQCJUK.js} +2 -2
  360. package/dist/{manager-D27PkIPo.cjs → manager-sv35JY-z.cjs} +2 -2
  361. package/dist/mastra/index.cjs +1 -1
  362. package/dist/mastra/index.js +1 -1
  363. package/dist/mastra/resolve-agent.d.ts +3 -1
  364. package/dist/{mastra-Ch00nEAJ.js → mastra-CigBrT7X.js} +17 -23
  365. package/dist/{mastra-qsVWpOTi.cjs → mastra-D4hvfuxX.cjs} +19 -25
  366. package/dist/memory/index.cjs +3 -3
  367. package/dist/memory/index.js +3 -3
  368. package/dist/{message-list-DPXPXvin.cjs → message-list-Cj0Sq_JP.cjs} +63 -8
  369. package/dist/{message-list-DEuRl82K.js → message-list-KRbg-TnI.js} +63 -8
  370. package/dist/{model-Do6DTJoj.cjs → model-BK93CMtl.cjs} +1 -1
  371. package/dist/{model-CW-mfGYA.js → model-CYtXw861.js} +1 -1
  372. package/dist/{netlify-DU32SDT6.cjs → netlify-BAnn3ouY.cjs} +1 -1
  373. package/dist/{netlify-DZSAbdve.js → netlify-CuI1ZrwR.js} +1 -1
  374. package/dist/notifications/index.cjs +1 -1
  375. package/dist/notifications/index.js +1 -1
  376. package/dist/processor-provider/index.cjs +1 -1
  377. package/dist/processor-provider/index.js +1 -1
  378. package/dist/processors/abort-signal-scope.d.ts +6 -0
  379. package/dist/processors/index.cjs +2 -2
  380. package/dist/processors/index.js +2 -2
  381. package/dist/{provider-registry-zGezZVsL.cjs → provider-registry-BwuI_IpT.cjs} +21696 -21828
  382. package/dist/{provider-registry-deA0x-Gd.js → provider-registry-CmQLzLF_.js} +21696 -21828
  383. package/dist/provider-registry.json +22300 -22417
  384. package/dist/{registry-generator-VvBfOKAD.js → registry-generator-C17V4WfG.js} +1 -1
  385. package/dist/{registry-generator-BkQ1AxZn.cjs → registry-generator-C_0ae7Ce.cjs} +1 -1
  386. package/dist/{rehydrate-DDYFpQsV.cjs → rehydrate-CDQ4dOYj.cjs} +2 -2
  387. package/dist/{rehydrate-BjLV643n.js → rehydrate-PnaVawGX.js} +2 -2
  388. package/dist/relevance/index.cjs +2 -2
  389. package/dist/relevance/index.js +2 -2
  390. package/dist/{run-registry-5Suldxz3.cjs → run-registry-BmckDVBk.cjs} +1156 -403
  391. package/dist/{run-registry-CGRPldLH.js → run-registry-BwEcwYlU.js} +1103 -404
  392. package/dist/{source-DDwx-87N.cjs → source-BVOi8Xhp.cjs} +1 -1
  393. package/dist/{source-Did_2XQc.js → source-fNa6u1kH.js} +1 -1
  394. package/dist/storage/domains/agents/index.cjs +1 -1
  395. package/dist/storage/domains/agents/index.js +1 -1
  396. package/dist/storage/domains/knowledge/base.d.ts +67 -0
  397. package/dist/storage/domains/knowledge/importers-inmemory.d.ts +146 -0
  398. package/dist/storage/domains/knowledge/importers.d.ts +287 -0
  399. package/dist/storage/domains/knowledge/index.d.ts +1 -0
  400. package/dist/storage/domains/knowledge/inmemory.d.ts +11 -0
  401. package/dist/storage/domains/knowledge/pages-inmemory.d.ts +12 -1
  402. package/dist/storage/domains/knowledge/pages.d.ts +1 -0
  403. package/dist/storage/domains/mcp-clients/index.cjs +1 -1
  404. package/dist/storage/domains/mcp-clients/index.js +1 -1
  405. package/dist/storage/domains/mcp-servers/index.cjs +1 -1
  406. package/dist/storage/domains/mcp-servers/index.js +1 -1
  407. package/dist/storage/domains/prompt-blocks/index.cjs +1 -1
  408. package/dist/storage/domains/prompt-blocks/index.js +1 -1
  409. package/dist/storage/domains/scorer-definitions/index.cjs +1 -1
  410. package/dist/storage/domains/scorer-definitions/index.js +1 -1
  411. package/dist/storage/domains/skills/index.cjs +1 -1
  412. package/dist/storage/domains/skills/index.js +1 -1
  413. package/dist/storage/domains/workspaces/index.cjs +1 -1
  414. package/dist/storage/domains/workspaces/index.js +1 -1
  415. package/dist/storage/index.cjs +15 -10
  416. package/dist/storage/index.js +11 -11
  417. package/dist/stream/base/output.d.ts +17 -0
  418. package/dist/stream/index.cjs +2 -2
  419. package/dist/stream/index.js +2 -2
  420. package/dist/stream/types.d.ts +5 -2
  421. package/dist/{stream-Dvy_0o14.cjs → stream-0kdqBOOn.cjs} +64 -9
  422. package/dist/{stream-Dpwx0whf.js → stream-D1y9GzoD.js} +29 -10
  423. package/dist/test-utils/llm-mock.cjs +1 -1
  424. package/dist/test-utils/llm-mock.js +1 -1
  425. package/dist/tool-loop-agent/index.cjs +1 -1
  426. package/dist/tool-loop-agent/index.js +1 -1
  427. package/dist/{tool-loop-agent-PbWrEj1k.js → tool-loop-agent-BdjWGVIb.js} +4 -4
  428. package/dist/{tool-loop-agent-UxOv3FoK.cjs → tool-loop-agent-kWaZAT6Q.cjs} +4 -4
  429. package/dist/{utils-BbMTlyBO.cjs → utils-BKUCaZ12.cjs} +1 -1
  430. package/dist/{utils-BnNi1BYM.js → utils-GHY3hmLx.js} +1 -1
  431. package/dist/utils.cjs +1 -1
  432. package/dist/utils.js +1 -1
  433. package/dist/{validate-HSBcm96b.js → validate-CB-q-R2F.js} +1 -1
  434. package/dist/{validate-Skps-cM3.cjs → validate-De92squ7.cjs} +1 -1
  435. package/dist/vector/index.cjs +2 -2
  436. package/dist/vector/index.js +2 -2
  437. package/dist/worker/index.cjs +1 -1
  438. package/dist/worker/index.js +1 -1
  439. package/dist/{worker-BNS5A3qP.cjs → worker-BbWPQuPR.cjs} +2 -2
  440. package/dist/{worker-DehaD4qD.js → worker-C3u_xzY2.js} +2 -2
  441. package/dist/{worker-BE-0DyKL.cjs → worker-CAKvQj9_.cjs} +2 -2
  442. package/dist/{worker-BKrKHZzU.js → worker-Kwm8EKcj.js} +2 -2
  443. package/dist/{workflow-BjUTwaK9.cjs → workflow-CSjXeNcR.cjs} +3 -3
  444. package/dist/{workflow-Bvw6yDjc.js → workflow-CVmI1Sw-.js} +3 -3
  445. package/dist/workflows/builder/index.cjs +1 -1
  446. package/dist/workflows/builder/index.js +1 -1
  447. package/dist/workflows/evented/index.cjs +1 -1
  448. package/dist/workflows/evented/index.js +1 -1
  449. package/dist/workflows/index.cjs +4 -4
  450. package/dist/workflows/index.js +4 -4
  451. package/dist/workspace/filesystem/filesystem.d.ts +5 -0
  452. package/dist/workspace/index.cjs +1 -1
  453. package/dist/workspace/index.js +1 -1
  454. package/dist/workspace/sandbox/local-sandbox.d.ts +16 -7
  455. package/dist/workspace/sandbox/native-sandbox/types.d.ts +11 -1
  456. package/dist/{workspace-C05xDH60.js → workspace-DY2Nxiyi.js} +75 -27
  457. package/dist/{workspace-D1OzzlLw.cjs → workspace-X2RHJZU9.cjs} +75 -27
  458. package/package.json +3 -3
  459. package/src/llm/model/provider-types.generated.d.ts +7705 -7727
@@ -1,5 +1,5 @@
1
1
  const require_deep_equal = require("./deep-equal-TMDmByBC.cjs");
2
- const require_filesystem_versioned = require("./filesystem-versioned-DZGyPbNC.cjs");
2
+ const require_filesystem_versioned = require("./filesystem-versioned-BavRtYWJ.cjs");
3
3
  // src/storage/domains/agents/base.ts
4
4
  var AgentsStorage = class extends require_filesystem_versioned.VersionedStorageDomain {
5
5
  listKey = "agents";
@@ -1,5 +1,5 @@
1
1
  import { t as deepEqual } from "./deep-equal-d1xU02ag.js";
2
- import { f as calculatePagination, m as normalizePerPage, n as SOURCE_CONTROL_AGENTS_DIR, o as VersionedStorageDomain, r as getSourceAgentFilePath, t as FilesystemVersionedHelpers } from "./filesystem-versioned-Bijb_p9l.js";
2
+ import { f as calculatePagination, m as normalizePerPage, n as SOURCE_CONTROL_AGENTS_DIR, o as VersionedStorageDomain, r as getSourceAgentFilePath, t as FilesystemVersionedHelpers } from "./filesystem-versioned-BL1ojJLo.js";
3
3
  // src/storage/domains/agents/base.ts
4
4
  var AgentsStorage = class extends VersionedStorageDomain {
5
5
  listKey = "agents";
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_source = require("../../../source-DDwx-87N.cjs");
2
+ const require_source = require("../../../source-BVOi8Xhp.cjs");
3
3
  exports.AgentsStorage = require_source.AgentsStorage;
4
4
  exports.FilesystemAgentsStorage = require_source.FilesystemAgentsStorage;
5
5
  exports.InMemoryAgentsStorage = require_source.InMemoryAgentsStorage;
@@ -1 +1 @@
1
- export { a as AgentsStorage, n as FilesystemAgentsStorage, i as InMemoryAgentsStorage, t as SourceAgentsSourceControl } from "../../../source-Did_2XQc.js";
1
+ export { a as AgentsStorage, n as FilesystemAgentsStorage, i as InMemoryAgentsStorage, t as SourceAgentsSourceControl } from "../../../source-fNa6u1kH.js";
@@ -1,5 +1,6 @@
1
1
  import type { KnowledgeScopeDeclarations } from '../../../knowledge/declarations.js';
2
2
  import { StorageDomain } from '../base.js';
3
+ import type { KnowledgeImportersStorage } from './importers.js';
3
4
  import type { KnowledgePageStore } from './pages.js';
4
5
  /** @experimental Knowledge APIs are experimental and may change without notice. */
5
6
  export declare const KNOWLEDGE_STORAGE_CONTRACT_VERSION: 4;
@@ -16,12 +17,32 @@ export interface KnowledgeStorageCapabilities {
16
17
  * pin kinds don't report it, and core refuses listing pins on them rather than store a page pin.
17
18
  */
18
19
  supportsPinKinds?: boolean;
20
+ /** The adapter implements {@link KnowledgeStorage.transaction}. */
21
+ supportsTransactions?: boolean;
22
+ /**
23
+ * The adapter enforces {@link KnowledgeTransactionOptions.deadlineAt}. Without it, the option is
24
+ * ignored and nothing bounds how long a transaction runs.
25
+ */
26
+ enforcesTransactionDeadline?: boolean;
19
27
  /**
20
28
  * `listPageActivity` accepts `since`, `until` and `before` (dated mode). Adapters without it don't
21
29
  * report it, and core refuses dated activity reads on them rather than return unbounded history.
22
30
  */
23
31
  supportsActivityDateRange?: boolean;
24
32
  }
33
+ /** @experimental */
34
+ export interface KnowledgeTransactionOptions {
35
+ /**
36
+ * Absolute time (epoch ms) by which the transaction's work must be done, on adapters with
37
+ * `enforcesTransactionDeadline`: waiting for a connection, every statement and every lock wait
38
+ * share it, and no new work starts once it has passed. Past it the transaction rolls back and
39
+ * fails with {@link KnowledgeTransactionDeadlineError}. It bounds when work starts and how long
40
+ * statements run, not every round trip: BEGIN, ROLLBACK and a COMMIT already sent can overrun
41
+ * it, so leave a margin. Ignored by a view's nested `transaction`, which shares the outer
42
+ * deadline.
43
+ */
44
+ deadlineAt?: number;
45
+ }
25
46
  /** @experimental Knowledge APIs are experimental and may change without notice. */
26
47
  export type KnowledgeSchemaInspection = {
27
48
  status: 'compatible';
@@ -70,6 +91,13 @@ export declare class KnowledgeSchemaResetRequiredError extends Error {
70
91
  export declare class KnowledgeUnsupportedCapabilityError extends Error {
71
92
  constructor(capability: string);
72
93
  }
94
+ /** A transaction ran past its `deadlineAt` and was rolled back; nothing in it was applied. Retrying is safe. */
95
+ export declare class KnowledgeTransactionDeadlineError extends Error {
96
+ readonly retryable = true;
97
+ constructor(options?: {
98
+ cause?: unknown;
99
+ });
100
+ }
73
101
  export declare function assertKnowledgeSchemaCompatible(inspection: KnowledgeSchemaInspection): void;
74
102
  export declare function parseKnowledgeWikilinks(text: string): string[];
75
103
  export declare function createKnowledgeUlid(now?: number): string;
@@ -81,6 +109,45 @@ export declare abstract class KnowledgeStorage extends StorageDomain implements
81
109
  /** Identifies the physical Knowledge backend and namespace used by this domain. */
82
110
  getStorageIsolationKey(): unknown;
83
111
  getCapabilities(): KnowledgeStorageCapabilities;
112
+ /**
113
+ * Runs `operation` against a view of this store whose reads and writes all belong to one
114
+ * transaction: it commits when `operation` resolves and rolls back when it throws, and no other
115
+ * connection sees its writes until it commits. A store method that fails inside the view undoes
116
+ * only its own writes, so the caller can catch it and go on. `transaction` on the view joins the
117
+ * same transaction the same way. Adapters in the same package can write their own tables through
118
+ * the view, so they commit with the page writes.
119
+ *
120
+ * Calls on this store (not the view) while `operation` runs are outside the transaction. Await
121
+ * calls on the view one at a time, as on a single connection.
122
+ *
123
+ * @experimental
124
+ */
125
+ transaction<T>(_operation: (tx: KnowledgeStorage) => Promise<T>, _options?: KnowledgeTransactionOptions): Promise<T>;
126
+ /**
127
+ * On a {@link transaction} view: locks the pages' rows against other writers until commit. A no-op
128
+ * on stores whose transactions already exclude every other writer (one write transaction at a
129
+ * time).
130
+ *
131
+ * @experimental
132
+ */
133
+ lockPages(_ids: string[]): Promise<void>;
134
+ /**
135
+ * On a {@link transaction} view: the ids of the live pages under `rootId` (not the root itself),
136
+ * locked so no page can be added under, moved out of or removed from that subtree until commit.
137
+ * A later {@link movePage} of `rootId` in the same transaction moves exactly these pages. Throws
138
+ * {@link KnowledgeMoveTooLargeError} past {@link MAX_KNOWLEDGE_MOVE_PAGES}. The default walks the
139
+ * children without locking, which holds on stores whose transactions exclude every other writer.
140
+ *
141
+ * @experimental
142
+ */
143
+ lockSubtree(rootId: string): Promise<string[]>;
144
+ /**
145
+ * Importer bookkeeping on the same database and namespace as the pages, or undefined when the
146
+ * adapter has none. On a {@link transaction} view it belongs to that transaction.
147
+ *
148
+ * @experimental
149
+ */
150
+ get importers(): KnowledgeImportersStorage | undefined;
84
151
  inspectSchema(): Promise<KnowledgeSchemaInspection>;
85
152
  dangerouslyReset(): Promise<void>;
86
153
  /**
@@ -0,0 +1,146 @@
1
+ import type { KnowledgeImporterBindingRecord, KnowledgeImporterFlushRecord, KnowledgeImporterNodeRecord, KnowledgeImporterPage, KnowledgeImporterRunChangeRecord, KnowledgeImporterRunRecord, KnowledgeImporterRunStartResult, KnowledgeImporterRunStatus, KnowledgeImporterWriterGuard } from './importers.js';
2
+ import { KnowledgeImportersStorage } from './importers.js';
3
+ interface State {
4
+ bindings: Map<string, KnowledgeImporterBindingRecord>;
5
+ nodes: Map<string, KnowledgeImporterNodeRecord>;
6
+ state: Map<string, Map<string, string>>;
7
+ runs: Map<string, KnowledgeImporterRunRecord>;
8
+ flushes: Map<string, KnowledgeImporterFlushRecord>;
9
+ changes: Map<string, {
10
+ order: number;
11
+ change: KnowledgeImporterRunChangeRecord;
12
+ }>;
13
+ guard: KnowledgeImporterWriterGuard;
14
+ order: number;
15
+ }
16
+ /**
17
+ * In-memory importer bookkeeping. One process, no locks: the owning store runs transactions one at
18
+ * a time and rolls them back by restoring {@link snapshot}.
19
+ */
20
+ export declare class InMemoryKnowledgeImportersStorage extends KnowledgeImportersStorage {
21
+ #private;
22
+ snapshot(): State;
23
+ restore(state: State): void;
24
+ init(): Promise<void>;
25
+ dangerouslyClearAll(): Promise<void>;
26
+ /** Part of the Knowledge store's reset: empties everything and moves the generation forward. */
27
+ clearOnReset(): void;
28
+ registerBinding(input: {
29
+ id: string;
30
+ importer: string;
31
+ target: string;
32
+ }): Promise<{
33
+ status: 'unchanged';
34
+ binding: {
35
+ id: string;
36
+ importer: string;
37
+ target: string;
38
+ anchorPageId: string | null;
39
+ createdAt: Date;
40
+ };
41
+ } | {
42
+ status: 'created';
43
+ binding: {
44
+ id: string;
45
+ importer: string;
46
+ target: string;
47
+ anchorPageId: null;
48
+ createdAt: Date;
49
+ };
50
+ }>;
51
+ getBinding(id: string): Promise<{
52
+ id: string;
53
+ importer: string;
54
+ target: string;
55
+ anchorPageId: string | null;
56
+ createdAt: Date;
57
+ } | null>;
58
+ setBindingAnchor(input: {
59
+ bindingId: string;
60
+ expected: string | null;
61
+ pageId: string | null;
62
+ }): Promise<boolean>;
63
+ listBindings(): Promise<{
64
+ id: string;
65
+ importer: string;
66
+ target: string;
67
+ anchorPageId: string | null;
68
+ createdAt: Date;
69
+ }[]>;
70
+ retireBinding(id: string): Promise<void>;
71
+ startRun(input: {
72
+ bindingId: string;
73
+ runId: string;
74
+ generation: number;
75
+ fireKey?: string;
76
+ deadlineAt?: Date;
77
+ }): Promise<KnowledgeImporterRunStartResult>;
78
+ getRun(runId: string): Promise<KnowledgeImporterRunRecord | null>;
79
+ listRuns(bindingId: string, options?: {
80
+ limit?: number;
81
+ }): Promise<KnowledgeImporterRunRecord[]>;
82
+ requestCancel(runId: string): Promise<KnowledgeImporterRunRecord | null>;
83
+ heartbeat(runId: string): Promise<KnowledgeImporterRunRecord | null>;
84
+ abandonRun(input: {
85
+ runId: string;
86
+ finish: unknown;
87
+ status?: 'failed' | 'canceled';
88
+ }): Promise<KnowledgeImporterRunRecord | null>;
89
+ /** Transactions run one at a time in memory, so a read is as good as a lock. */
90
+ lockRun(runId: string): Promise<KnowledgeImporterRunRecord | null>;
91
+ getFlush(runId: string, generation: number, seq: number): Promise<KnowledgeImporterFlushRecord | null>;
92
+ recordFlush(input: KnowledgeImporterFlushRecord & {
93
+ counts: Record<string, number>;
94
+ }): Promise<void>;
95
+ finishRun(input: {
96
+ runId: string;
97
+ generation: number;
98
+ lastSeq: number;
99
+ status: Exclude<KnowledgeImporterRunStatus, 'running' | 'skipped'>;
100
+ finish: unknown;
101
+ }): Promise<KnowledgeImporterRunRecord>;
102
+ getNode(bindingId: string, sourceId: string): Promise<KnowledgeImporterNodeRecord | null>;
103
+ getNodeByPage(pageId: string): Promise<KnowledgeImporterNodeRecord | null>;
104
+ saveNode(node: Omit<KnowledgeImporterNodeRecord, 'updatedAt'>): Promise<void>;
105
+ deleteNode(bindingId: string, sourceId: string): Promise<void>;
106
+ listNodes(bindingId: string, options?: {
107
+ after?: string;
108
+ limit?: number;
109
+ unsettled?: boolean;
110
+ }): Promise<KnowledgeImporterPage<KnowledgeImporterNodeRecord>>;
111
+ listLinkingNodes(bindingId: string, targetSourceIds: string[], options?: {
112
+ after?: string;
113
+ limit?: number;
114
+ }): Promise<KnowledgeImporterPage<string>>;
115
+ markLinkingNodesUnsettled(bindingId: string, targetSourceIds: string[]): Promise<void>;
116
+ findNodeByAlias(bindingId: string, alias: string): Promise<KnowledgeImporterNodeRecord | null>;
117
+ getState(bindingId: string): Promise<Record<string, string>>;
118
+ setState(bindingId: string, state: Record<string, string>): Promise<void>;
119
+ recordRunChange(change: KnowledgeImporterRunChangeRecord): Promise<void>;
120
+ listRunChanges(runId: string, options?: {
121
+ after?: string;
122
+ limit?: number;
123
+ }): Promise<KnowledgeImporterPage<KnowledgeImporterRunChangeRecord>>;
124
+ readWriterGuard(): Promise<{
125
+ activePath: string;
126
+ generation: number;
127
+ firstWriteAt: Date | null;
128
+ }>;
129
+ lockWriterGuard(_mode: 'share' | 'update'): Promise<{
130
+ activePath: string;
131
+ generation: number;
132
+ firstWriteAt: Date | null;
133
+ }>;
134
+ /** Transactions are serialized here, so holding one is the lock. */
135
+ markFirstWrite(): Promise<boolean>;
136
+ advanceWriterGuard(input: {
137
+ activePath: string;
138
+ generation: number;
139
+ }): Promise<{
140
+ activePath: string;
141
+ generation: number;
142
+ firstWriteAt: Date | null;
143
+ }>;
144
+ }
145
+ export {};
146
+ //# sourceMappingURL=importers-inmemory.d.ts.map
@@ -0,0 +1,287 @@
1
+ /**
2
+ * Importer bookkeeping a Knowledge store keeps next to its pages: bindings, the source-to-page node
3
+ * map, cursor state, runs, flush receipts, per-run changes and the writer guard. Reached through
4
+ * {@link KnowledgeStorage.importers}, so on a transaction view it writes in the same transaction as
5
+ * the page writes it records.
6
+ *
7
+ * Source IDs and state keys are opaque: stored and compared byte for byte, never case-folded.
8
+ *
9
+ * @experimental
10
+ */
11
+ export interface KnowledgeImporterBindingRecord {
12
+ id: string;
13
+ /** The importer definition's id. */
14
+ importer: string;
15
+ /** `<scope>#<path>`. */
16
+ target: string;
17
+ /**
18
+ * The page the first applying flush created at `target`, or null before that and after a rebind.
19
+ * The binding owns this page only while it is still live at `target`.
20
+ */
21
+ anchorPageId: string | null;
22
+ createdAt: Date;
23
+ }
24
+ export interface KnowledgeImporterNodeRecord {
25
+ bindingId: string;
26
+ sourceId: string;
27
+ pageId: string;
28
+ kind: string | null;
29
+ parentSourceId: string | null;
30
+ aliases: string[];
31
+ unresolvedLinks: string[];
32
+ /**
33
+ * The links the item declared, by target source ID, resolved or not. The store indexes them by
34
+ * target, so {@link KnowledgeImportersStorage.listLinkingNodes} finds the nodes linking to a page.
35
+ */
36
+ links: KnowledgeImporterNodeLink[];
37
+ /**
38
+ * The links section the sink appended to the page body, exactly as written, or null when it wrote
39
+ * none. Everything in the body before it is the source's own text, kept byte for byte.
40
+ */
41
+ linkSection: string | null;
42
+ /** The page was kept as a stub after the source removed it, because pages are nested under it. */
43
+ stub: boolean;
44
+ /**
45
+ * The page was already at the item's path when the binding first wrote the item, and the binding
46
+ * took it over. Removed from the source, it is kept as a stub, never deleted.
47
+ */
48
+ adopted: boolean;
49
+ /**
50
+ * The sink still owes this node follow-up work: it sits away from its source parent (which hadn't
51
+ * arrived), or it has links that didn't resolve. Settle passes visit only these.
52
+ */
53
+ unsettled: boolean;
54
+ updatedAt: Date;
55
+ }
56
+ export interface KnowledgeImporterNodeLink {
57
+ sourceId: string;
58
+ rel: string | null;
59
+ }
60
+ export type KnowledgeImporterRunStatus = 'running' | 'succeeded' | 'failed' | 'canceled' | 'skipped';
61
+ export interface KnowledgeImporterRunRecord {
62
+ id: string;
63
+ bindingId: string;
64
+ generation: number;
65
+ status: KnowledgeImporterRunStatus;
66
+ fireKey: string | null;
67
+ /** Flushes after this are refused. */
68
+ deadlineAt: Date | null;
69
+ cancelRequestedAt: Date | null;
70
+ /** Last heartbeat from the runner; null before the first. A host reclaims a run whose heartbeat is stale. */
71
+ heartbeatAt: Date | null;
72
+ /** 0 before the first flush. */
73
+ lastSeq: number;
74
+ /** The normalized finish request, compared on replay. Null while running. */
75
+ finish: unknown | null;
76
+ /** Summed from flush receipts. */
77
+ counts: Record<string, number>;
78
+ startedAt: Date;
79
+ completedAt: Date | null;
80
+ }
81
+ export interface KnowledgeImporterFlushRecord {
82
+ runId: string;
83
+ generation: number;
84
+ seq: number;
85
+ digest: string;
86
+ receipt: unknown;
87
+ }
88
+ export type KnowledgeImporterChangeKind = 'created' | 'updated' | 'moved' | 'removed' | 'stubbed';
89
+ export interface KnowledgeImporterRunChangeRecord {
90
+ runId: string;
91
+ sourceId: string;
92
+ pageId: string | null;
93
+ change: KnowledgeImporterChangeKind;
94
+ title: string;
95
+ path: string;
96
+ }
97
+ export interface KnowledgeImporterWriterGuard {
98
+ /** OSS hosts only ever write as `'new'`. */
99
+ activePath: string;
100
+ generation: number;
101
+ firstWriteAt: Date | null;
102
+ }
103
+ export type KnowledgeImporterRunStartResult = {
104
+ status: 'started';
105
+ run: KnowledgeImporterRunRecord;
106
+ }
107
+ /** Another run of the binding is going; this one was recorded as skipped. */
108
+ | {
109
+ status: 'skipped';
110
+ run: KnowledgeImporterRunRecord;
111
+ }
112
+ /** The fire key was already used; nothing new was recorded. */
113
+ | {
114
+ status: 'duplicate';
115
+ run: KnowledgeImporterRunRecord;
116
+ };
117
+ export interface KnowledgeImporterPage<T> {
118
+ items: T[];
119
+ /** Pass as `after` for the next page; null on the last. */
120
+ next: string | null;
121
+ }
122
+ /** A binding was registered again with a different importer or target. */
123
+ export declare class KnowledgeImporterBindingConflictError extends Error {
124
+ readonly bindingId: string;
125
+ constructor(bindingId: string);
126
+ }
127
+ /** A conditional run write found the run in another state (see each method). */
128
+ export declare class KnowledgeImporterRunStateError extends Error {
129
+ readonly runId: string;
130
+ /** `generation`: the run's own row; `stale_guard`: the writer guard has moved past the run. */
131
+ readonly reason: 'not_found' | 'not_running' | 'generation' | 'stale_guard' | 'seq';
132
+ constructor(runId: string,
133
+ /** `generation`: the run's own row; `stale_guard`: the writer guard has moved past the run. */
134
+ reason: 'not_found' | 'not_running' | 'generation' | 'stale_guard' | 'seq');
135
+ }
136
+ /** @experimental */
137
+ export declare abstract class KnowledgeImportersStorage {
138
+ /**
139
+ * Creates the importer tables if needed, in the same namespace as the store's pages: explicit
140
+ * provisioning, like `initKnowledge()`. Idempotent; never touches page tables. Whoever calls it
141
+ * automatically must skip it when storage init is disabled. No other method issues DDL: against
142
+ * unprovisioned tables they fail.
143
+ */
144
+ abstract init(): Promise<void>;
145
+ /** Deletes every importer row. Tests only. */
146
+ abstract dangerouslyClearAll(): Promise<void>;
147
+ /** `created` the first time, `unchanged` after; a different importer or target throws {@link KnowledgeImporterBindingConflictError}. */
148
+ abstract registerBinding(input: {
149
+ id: string;
150
+ importer: string;
151
+ target: string;
152
+ }): Promise<{
153
+ status: 'created' | 'unchanged';
154
+ binding: KnowledgeImporterBindingRecord;
155
+ }>;
156
+ abstract getBinding(id: string): Promise<KnowledgeImporterBindingRecord | null>;
157
+ /**
158
+ * Sets the binding's anchor to `pageId` only if it is currently `expected`; returns whether it did.
159
+ * False for a missing binding.
160
+ */
161
+ abstract setBindingAnchor(input: {
162
+ bindingId: string;
163
+ expected: string | null;
164
+ pageId: string | null;
165
+ }): Promise<boolean>;
166
+ abstract listBindings(): Promise<KnowledgeImporterBindingRecord[]>;
167
+ /**
168
+ * Forgets a binding: deletes its row with its nodes, their links, its state, and its runs with their
169
+ * flushes and changes. Pages are not touched; they stay as ordinary pages. No-op for an unknown id.
170
+ */
171
+ abstract retireBinding(id: string): Promise<void>;
172
+ /**
173
+ * Starts a run at the writer guard's generation. At most one run per binding is `running`; a
174
+ * second is recorded as `skipped`. A `fireKey` already used for the binding returns that run as
175
+ * `duplicate` and records nothing.
176
+ */
177
+ abstract startRun(input: {
178
+ bindingId: string;
179
+ runId: string;
180
+ generation: number;
181
+ fireKey?: string;
182
+ deadlineAt?: Date;
183
+ }): Promise<KnowledgeImporterRunStartResult>;
184
+ abstract getRun(runId: string): Promise<KnowledgeImporterRunRecord | null>;
185
+ /** Newest first. */
186
+ abstract listRuns(bindingId: string, options?: {
187
+ limit?: number;
188
+ }): Promise<KnowledgeImporterRunRecord[]>;
189
+ /** Sets `cancelRequestedAt` on a running run; returns the run, or null when none is running. */
190
+ abstract requestCancel(runId: string): Promise<KnowledgeImporterRunRecord | null>;
191
+ /** Sets `heartbeatAt` on a running run; returns the run (with any cancel request), or null when it isn't running. */
192
+ abstract heartbeat(runId: string): Promise<KnowledgeImporterRunRecord | null>;
193
+ /**
194
+ * Ends a running run as `failed` (or `status`) with `finish`, whatever its seq or generation: for a
195
+ * host reclaiming a run whose runner went away. Returns the run, or null when it wasn't running.
196
+ * Its later flushes and finish are refused as `not_running`.
197
+ */
198
+ abstract abandonRun(input: {
199
+ runId: string;
200
+ finish: unknown;
201
+ status?: 'failed' | 'canceled';
202
+ }): Promise<KnowledgeImporterRunRecord | null>;
203
+ /**
204
+ * The store's clock, which every run timestamp it writes (`startedAt`, `heartbeatAt`) comes from:
205
+ * a host compares leases against it rather than its own clock. Defaults to this process's clock,
206
+ * which is the store's own for an in-process store.
207
+ */
208
+ now(): Promise<Date>;
209
+ /**
210
+ * Inside a transaction: reads the run and locks its row until commit (take the writer guard lock
211
+ * first). Null when there's no such run.
212
+ */
213
+ abstract lockRun(runId: string): Promise<KnowledgeImporterRunRecord | null>;
214
+ abstract getFlush(runId: string, generation: number, seq: number): Promise<KnowledgeImporterFlushRecord | null>;
215
+ /**
216
+ * Records a flush and advances the run to `seq`, adding `counts`. Only when the run is `running`
217
+ * at `generation` with `lastSeq = seq - 1`, and the writer guard is still at `generation` (read
218
+ * under the lock the caller took with {@link lockWriterGuard}); otherwise throws
219
+ * {@link KnowledgeImporterRunStateError} and writes nothing.
220
+ */
221
+ abstract recordFlush(input: KnowledgeImporterFlushRecord & {
222
+ counts: Record<string, number>;
223
+ }): Promise<void>;
224
+ /**
225
+ * Ends a running run at `generation` whose `lastSeq` equals `lastSeq`, with the writer guard
226
+ * still at `generation`; otherwise throws
227
+ * {@link KnowledgeImporterRunStateError}.
228
+ */
229
+ abstract finishRun(input: {
230
+ runId: string;
231
+ generation: number;
232
+ lastSeq: number;
233
+ status: Exclude<KnowledgeImporterRunStatus, 'running' | 'skipped'>;
234
+ finish: unknown;
235
+ }): Promise<KnowledgeImporterRunRecord>;
236
+ abstract getNode(bindingId: string, sourceId: string): Promise<KnowledgeImporterNodeRecord | null>;
237
+ abstract getNodeByPage(pageId: string): Promise<KnowledgeImporterNodeRecord | null>;
238
+ /** Insert or replace by `(bindingId, sourceId)`. A page already mapped to another node throws. */
239
+ abstract saveNode(node: Omit<KnowledgeImporterNodeRecord, 'updatedAt'>): Promise<void>;
240
+ abstract deleteNode(bindingId: string, sourceId: string): Promise<void>;
241
+ /** Ordered by sourceId (byte order). `unsettled: true` lists only nodes with `unsettled` set. */
242
+ abstract listNodes(bindingId: string, options?: {
243
+ after?: string;
244
+ limit?: number;
245
+ unsettled?: boolean;
246
+ }): Promise<KnowledgeImporterPage<KnowledgeImporterNodeRecord>>;
247
+ abstract findNodeByAlias(bindingId: string, alias: string): Promise<KnowledgeImporterNodeRecord | null>;
248
+ /**
249
+ * The binding's nodes whose `links` name any of `targetSourceIds`, as source IDs, distinct, in byte
250
+ * order. Other bindings' nodes never appear.
251
+ */
252
+ abstract listLinkingNodes(bindingId: string, targetSourceIds: string[], options?: {
253
+ after?: string;
254
+ limit?: number;
255
+ }): Promise<KnowledgeImporterPage<string>>;
256
+ /** Sets `unsettled` on every node {@link listLinkingNodes} would list, in one statement. */
257
+ abstract markLinkingNodesUnsettled(bindingId: string, targetSourceIds: string[]): Promise<void>;
258
+ abstract getState(bindingId: string): Promise<Record<string, string>>;
259
+ /** Upserts the given keys; keys not given stay. */
260
+ abstract setState(bindingId: string, state: Record<string, string>): Promise<void>;
261
+ /** Insert or replace by `(runId, sourceId)`. */
262
+ abstract recordRunChange(change: KnowledgeImporterRunChangeRecord): Promise<void>;
263
+ /** In the order they were recorded. */
264
+ abstract listRunChanges(runId: string, options?: {
265
+ after?: string;
266
+ limit?: number;
267
+ }): Promise<KnowledgeImporterPage<KnowledgeImporterRunChangeRecord>>;
268
+ /** The guard row, created at generation 1, path `'new'` on first read. */
269
+ abstract readWriterGuard(): Promise<KnowledgeImporterWriterGuard>;
270
+ /**
271
+ * Inside a transaction: locks the guard row until commit, shared or exclusive, and returns it.
272
+ * Choose the mode before locking; never upgrade a held lock.
273
+ */
274
+ abstract lockWriterGuard(mode: 'share' | 'update'): Promise<KnowledgeImporterWriterGuard>;
275
+ /** Sets `firstWriteAt` if it is still null; returns whether this call set it. */
276
+ abstract markFirstWrite(): Promise<boolean>;
277
+ /**
278
+ * Moves the writer to `activePath` at a strictly higher generation and clears `firstWriteAt`.
279
+ * Call under `lockWriterGuard('update')` in the same transaction. Runs of older generations are
280
+ * then refused at their next flush or finish.
281
+ */
282
+ abstract advanceWriterGuard(input: {
283
+ activePath: string;
284
+ generation: number;
285
+ }): Promise<KnowledgeImporterWriterGuard>;
286
+ }
287
+ //# sourceMappingURL=importers.d.ts.map
@@ -2,4 +2,5 @@ export * from './base.js';
2
2
  export * from './inmemory.js';
3
3
  export * from './pages.js';
4
4
  export * from './legacy.js';
5
+ export * from './importers.js';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1,8 +1,10 @@
1
1
  import type { InMemoryDB } from '../inmemory-db.js';
2
2
  import { KnowledgeStorage } from './base.js';
3
+ import { InMemoryKnowledgeImportersStorage } from './importers-inmemory.js';
3
4
  import type { KnowledgePageStore } from './pages.js';
4
5
  export declare class InMemoryKnowledgeStorage extends KnowledgeStorage {
5
6
  #private;
7
+ get importers(): InMemoryKnowledgeImportersStorage;
6
8
  materializeScope(input: Parameters<KnowledgePageStore['materializeScope']>[0]): ReturnType<KnowledgePageStore['materializeScope']>;
7
9
  getScopesByAddress(input: Parameters<KnowledgePageStore['getScopesByAddress']>[0]): ReturnType<KnowledgePageStore['getScopesByAddress']>;
8
10
  listChildScopes(input: Parameters<KnowledgePageStore['listChildScopes']>[0]): ReturnType<KnowledgePageStore['listChildScopes']>;
@@ -41,12 +43,21 @@ export declare class InMemoryKnowledgeStorage extends KnowledgeStorage {
41
43
  constructor(_config: {
42
44
  db: InMemoryDB;
43
45
  });
46
+ /**
47
+ * In memory there is no second connection: transactions run one at a time and roll back by
48
+ * restoring a snapshot of pages and importer rows, and a read on this store (or a write from
49
+ * outside the transaction) while one runs sees and shares its state: an outside write made during
50
+ * a transaction that rolls back is rolled back with it. Each store call
51
+ * on the view, and each nested `transaction`, undoes its own writes when it fails.
52
+ */
53
+ transaction<T>(operation: (tx: KnowledgeStorage) => Promise<T>): Promise<T>;
44
54
  getCapabilities(): {
45
55
  readonly contractVersion: 4;
46
56
  readonly schemaVersion: 4;
47
57
  readonly supportsSchemaInspection: true;
48
58
  readonly supportsExplicitReset: true;
49
59
  readonly supportsPinKinds: true;
60
+ readonly supportsTransactions: true;
50
61
  readonly supportsActivityDateRange: true;
51
62
  };
52
63
  inspectSchema(): Promise<{
@@ -1,4 +1,4 @@
1
- import type { KnowledgeNote, KnowledgePage, KnowledgePageActivityEvent, KnowledgePageLinkCounts, KnowledgePageLinkEdge, KnowledgePageSearchHit, KnowledgePageStore, KnowledgePin, KnowledgePinKind } from './pages.js';
1
+ import type { KnowledgeNote, KnowledgePage, KnowledgePageActivityEvent, KnowledgePageBodyLink, KnowledgePageLinkCounts, KnowledgePageLinkEdge, KnowledgePageSearchHit, KnowledgePageStore, KnowledgePin, KnowledgePinKind } from './pages.js';
2
2
  type Store = KnowledgePageStore;
3
3
  /**
4
4
  * In-memory schema-4 page store: the reference implementation of {@link KnowledgePageStore} that the
@@ -6,8 +6,19 @@ type Store = KnowledgePageStore;
6
6
  *
7
7
  * @experimental
8
8
  */
9
+ export interface InMemoryKnowledgePageSnapshot {
10
+ pages: Map<string, KnowledgePage>;
11
+ notes: Map<string, KnowledgeNote>;
12
+ pins: Map<string, KnowledgePin>;
13
+ activity: KnowledgePageActivityEvent[];
14
+ bodyLinks: Map<string, KnowledgePageBodyLink[]>;
15
+ }
9
16
  export declare class InMemoryKnowledgePageStore implements KnowledgePageStore {
10
17
  #private;
18
+ /** A deep copy of every page, note, pin, body link and event, for {@link restore}. */
19
+ snapshot(): InMemoryKnowledgePageSnapshot;
20
+ /** Puts back what {@link snapshot} copied. */
21
+ restore(snapshot: InMemoryKnowledgePageSnapshot): void;
11
22
  /** Drops every page, note, pin, body link and event. */
12
23
  clear(): void;
13
24
  materializeScope(input: Parameters<Store['materializeScope']>[0]): Promise<{
@@ -286,6 +286,7 @@ export declare function assertKnowledgePageDescriptionWithinBound(description: s
286
286
  * @experimental
287
287
  */
288
288
  export declare function assertKnowledgeNoteTextWithinBound(text: string): void;
289
+ export { KnowledgeInvalidCursorError } from '../../../_types/@internal_core@0.1.4/dist/knowledge-compat/index.js';
289
290
  /** @experimental */
290
291
  export declare class KnowledgeMoveTooLargeError extends Error {
291
292
  readonly pageId: string;
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_filesystem = require("../../../filesystem-DsCQiBl2.cjs");
2
+ const require_filesystem = require("../../../filesystem-DVVecqZt.cjs");
3
3
  exports.FilesystemMCPClientsStorage = require_filesystem.FilesystemMCPClientsStorage;
4
4
  exports.InMemoryMCPClientsStorage = require_filesystem.InMemoryMCPClientsStorage;
5
5
  exports.MCPClientsStorage = require_filesystem.MCPClientsStorage;
@@ -1 +1 @@
1
- export { t as FilesystemMCPClientsStorage, n as InMemoryMCPClientsStorage, r as MCPClientsStorage } from "../../../filesystem-B5X-5G0x.js";
1
+ export { t as FilesystemMCPClientsStorage, n as InMemoryMCPClientsStorage, r as MCPClientsStorage } from "../../../filesystem-B8ad6kAW.js";
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_filesystem = require("../../../filesystem-BDSpwBke.cjs");
2
+ const require_filesystem = require("../../../filesystem-BB5YWXH-.cjs");
3
3
  exports.FilesystemMCPServersStorage = require_filesystem.FilesystemMCPServersStorage;
4
4
  exports.InMemoryMCPServersStorage = require_filesystem.InMemoryMCPServersStorage;
5
5
  exports.MCPServersStorage = require_filesystem.MCPServersStorage;
@@ -1 +1 @@
1
- export { t as FilesystemMCPServersStorage, n as InMemoryMCPServersStorage, r as MCPServersStorage } from "../../../filesystem-Cv79mHRk.js";
1
+ export { t as FilesystemMCPServersStorage, n as InMemoryMCPServersStorage, r as MCPServersStorage } from "../../../filesystem-ClBOBoDc.js";