@mastra/core 1.86.0-alpha.7 → 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 (509) 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 +72 -1
  5. package/dist/agent/agent.types.d.ts +30 -2
  6. package/dist/agent/durable/create-evented-agent.d.ts +6 -0
  7. package/dist/agent/durable/durable-agent.d.ts +1 -15
  8. package/dist/agent/durable/index.cjs +7 -26
  9. package/dist/agent/durable/index.js +7 -26
  10. package/dist/agent/durable/preparation.d.ts +2 -0
  11. package/dist/agent/durable/utils/resolve-runtime.d.ts +9 -0
  12. package/dist/agent/durable/workflows/durable-loop-builder.d.ts +4 -0
  13. package/dist/agent/durable/workflows/finalize-run.d.ts +3 -1
  14. package/dist/agent/durable/workflows/steps/llm-execution.d.ts +1 -0
  15. package/dist/agent/index.cjs +3 -3
  16. package/dist/agent/index.js +3 -3
  17. package/dist/agent/message-list/index.cjs +1 -1
  18. package/dist/agent/message-list/index.js +1 -1
  19. package/dist/agent/message-list/message-list.d.ts +11 -0
  20. package/dist/agent/message-list/utils/provider-compat.d.ts +1 -0
  21. package/dist/agent/request-context-snapshot.d.ts +1 -1
  22. package/dist/agent/streams/types.d.ts +10 -0
  23. package/dist/agent/thread-stream-runtime.d.ts +5 -0
  24. package/dist/agent/types.d.ts +25 -0
  25. package/dist/agent-builder/ee/index.cjs +1 -1
  26. package/dist/agent-builder/ee/index.js +1 -1
  27. package/dist/agent-controller/index.cjs +1 -1
  28. package/dist/agent-controller/index.js +1 -1
  29. package/dist/{agent-controller-K5vHtqfO.cjs → agent-controller-CrQ9OF80.cjs} +8 -8
  30. package/dist/{agent-controller-Cf3_IuY8.js → agent-controller-SSlKzE6A.js} +8 -8
  31. package/dist/background-tasks/index.cjs +1 -1
  32. package/dist/background-tasks/index.js +1 -1
  33. package/dist/{background-tasks-DqnQMfuf.cjs → background-tasks-BDrYBis-.cjs} +5 -3
  34. package/dist/{background-tasks-BgpX1P_s.js → background-tasks-BnJfNLFo.js} +5 -3
  35. package/dist/browser/index.cjs +2 -2
  36. package/dist/browser/index.js +2 -2
  37. package/dist/{builder-x295GDL6.js → builder-Cl-0BWkh.js} +2 -2
  38. package/dist/{builder-D8Osghdo.cjs → builder-Cw8u3pPl.cjs} +2 -2
  39. package/dist/capabilities/302ai.json +192 -192
  40. package/dist/capabilities/abliteratedllm.json +34 -34
  41. package/dist/capabilities/abliteration-ai.json +11 -11
  42. package/dist/capabilities/above.json +17 -17
  43. package/dist/capabilities/adaption.json +12 -12
  44. package/dist/capabilities/adzuki.json +30 -30
  45. package/dist/capabilities/agentrouter.json +10 -10
  46. package/dist/capabilities/agnes.json +4 -4
  47. package/dist/capabilities/ai-router.json +9 -9
  48. package/dist/capabilities/aiand.json +19 -11
  49. package/dist/capabilities/aigrow.json +11 -11
  50. package/dist/capabilities/aimlapi.json +146 -149
  51. package/dist/capabilities/aipg.json +2 -2
  52. package/dist/capabilities/aixy.json +14 -14
  53. package/dist/capabilities/aki-io.json +11 -11
  54. package/dist/capabilities/alibaba-cn.json +128 -109
  55. package/dist/capabilities/alibaba-coding-plan-cn.json +7 -19
  56. package/dist/capabilities/alibaba-coding-plan.json +7 -19
  57. package/dist/capabilities/alibaba-token-plan-cn.json +49 -67
  58. package/dist/capabilities/alibaba-token-plan.json +51 -69
  59. package/dist/capabilities/alibaba.json +71 -118
  60. package/dist/capabilities/ambient.json +14 -14
  61. package/dist/capabilities/amd.json +11 -11
  62. package/dist/capabilities/anthropic.json +48 -48
  63. package/dist/capabilities/anyapi.json +18 -18
  64. package/dist/capabilities/apiko.json +2 -2
  65. package/dist/capabilities/arcee.json +10 -10
  66. package/dist/capabilities/augure.json +6 -6
  67. package/dist/capabilities/auriko.json +20 -20
  68. package/dist/capabilities/bailing.json +5 -5
  69. package/dist/capabilities/baseten.json +46 -16
  70. package/dist/capabilities/bee.json +5 -5
  71. package/dist/capabilities/berget.json +4 -4
  72. package/dist/capabilities/bothub.json +16 -16
  73. package/dist/capabilities/boundless.json +36 -36
  74. package/dist/capabilities/bumo.json +40 -40
  75. package/dist/capabilities/byteplus.json +32 -32
  76. package/dist/capabilities/cerebras.json +4 -4
  77. package/dist/capabilities/cheapaimodel.json +5 -5
  78. package/dist/capabilities/cheapest-token.json +24 -24
  79. package/dist/capabilities/chutes.json +9 -9
  80. package/dist/capabilities/cline-pass.json +37 -37
  81. package/dist/capabilities/cloudcode.json +4 -4
  82. package/dist/capabilities/cloudflare-workers-ai.json +24 -24
  83. package/dist/capabilities/commandcode.json +152 -152
  84. package/dist/capabilities/concentrate.json +290 -266
  85. package/dist/capabilities/cortecs.json +105 -105
  86. package/dist/capabilities/crossmodel.json +160 -160
  87. package/dist/capabilities/crusoe.json +10 -10
  88. package/dist/capabilities/daoxe.json +7 -7
  89. package/dist/capabilities/databricks.json +318 -62
  90. package/dist/capabilities/deepinfra.json +73 -129
  91. package/dist/capabilities/deepseek.json +2 -2
  92. package/dist/capabilities/digitalocean.json +114 -114
  93. package/dist/capabilities/dothoosh.json +28 -28
  94. package/dist/capabilities/doubleword.json +24 -24
  95. package/dist/capabilities/edenai.json +458 -458
  96. package/dist/capabilities/empiriolabs.json +166 -166
  97. package/dist/capabilities/engy.json +20 -20
  98. package/dist/capabilities/evroc.json +8 -8
  99. package/dist/capabilities/ezkielyna.json +8 -8
  100. package/dist/capabilities/fastrouter.json +85 -85
  101. package/dist/capabilities/fireworks-ai.json +107 -44
  102. package/dist/capabilities/freemodel.json +23 -23
  103. package/dist/capabilities/friendli.json +9 -9
  104. package/dist/capabilities/frogbot.json +94 -94
  105. package/dist/capabilities/gisoo.json +16 -16
  106. package/dist/capabilities/gmicloud.json +17 -17
  107. package/dist/capabilities/google.json +57 -57
  108. package/dist/capabilities/graphn.json +10 -10
  109. package/dist/capabilities/greenpt.json +36 -36
  110. package/dist/capabilities/groq.json +2 -2
  111. package/dist/capabilities/helicone.json +68 -68
  112. package/dist/capabilities/hopper.json +2 -2
  113. package/dist/capabilities/hostinger-router.json +12 -12
  114. package/dist/capabilities/hpc-ai.json +13 -13
  115. package/dist/capabilities/huawei-maas.json +17 -17
  116. package/dist/capabilities/hubris.json +30 -30
  117. package/dist/capabilities/huggingface.json +193 -37
  118. package/dist/capabilities/hyper.json +23 -23
  119. package/dist/capabilities/impossibl.json +140 -140
  120. package/dist/capabilities/inception.json +2 -2
  121. package/dist/capabilities/inceptron.json +4 -4
  122. package/dist/capabilities/inco.json +3 -3
  123. package/dist/capabilities/infer.json +15 -15
  124. package/dist/capabilities/inferall.json +10 -10
  125. package/dist/capabilities/inference-coop.json +9 -9
  126. package/dist/capabilities/inferenceapis.json +9 -9
  127. package/dist/capabilities/inferris.json +3 -3
  128. package/dist/capabilities/infersia.json +2 -2
  129. package/dist/capabilities/inferx.json +3 -3
  130. package/dist/capabilities/infomaniak.json +4 -4
  131. package/dist/capabilities/io-net.json +2 -2
  132. package/dist/capabilities/isoquant.json +4 -4
  133. package/dist/capabilities/iteracompute.json +60 -60
  134. package/dist/capabilities/jad-ai.json +3 -3
  135. package/dist/capabilities/jalapeno.json +12 -12
  136. package/dist/capabilities/jiekou.json +63 -63
  137. package/dist/capabilities/jzstoken.json +50 -50
  138. package/dist/capabilities/keln.json +14 -21
  139. package/dist/capabilities/kenari.json +123 -120
  140. package/dist/capabilities/kilo.json +622 -647
  141. package/dist/capabilities/kimi-code-plan-cn.json +5 -5
  142. package/dist/capabilities/kimi-code-plan-global.json +5 -5
  143. package/dist/capabilities/kitani.json +6 -6
  144. package/dist/capabilities/klavo.json +18 -18
  145. package/dist/capabilities/korouter.json +29 -29
  146. package/dist/capabilities/kunavo.json +10 -10
  147. package/dist/capabilities/liquid.json +11 -11
  148. package/dist/capabilities/lithosai.json +2 -2
  149. package/dist/capabilities/llmgateway-providers.json +932 -905
  150. package/dist/capabilities/llmgateway.json +336 -336
  151. package/dist/capabilities/llmtr.json +22 -22
  152. package/dist/capabilities/logits.json +2 -2
  153. package/dist/capabilities/longcat.json +2 -7
  154. package/dist/capabilities/lowrouter.json +54 -54
  155. package/dist/capabilities/lyceum.json +12 -12
  156. package/dist/capabilities/melious.json +13 -13
  157. package/dist/capabilities/merge-gateway.json +260 -260
  158. package/dist/capabilities/meta.json +7 -7
  159. package/dist/capabilities/mistral.json +20 -20
  160. package/dist/capabilities/mixlayer.json +4 -4
  161. package/dist/capabilities/modal.json +10 -10
  162. package/dist/capabilities/model-oracle-ai.json +25 -25
  163. package/dist/capabilities/modelis.json +20 -20
  164. package/dist/capabilities/modular.json +6 -6
  165. package/dist/capabilities/moneo.json +16 -16
  166. package/dist/capabilities/moonshotai-cn.json +7 -7
  167. package/dist/capabilities/moonshotai.json +7 -7
  168. package/dist/capabilities/morph.json +11 -11
  169. package/dist/capabilities/munito-eu.json +6 -6
  170. package/dist/capabilities/munito.json +6 -6
  171. package/dist/capabilities/nan.json +27 -27
  172. package/dist/capabilities/nano-gpt.json +578 -578
  173. package/dist/capabilities/nearai.json +84 -84
  174. package/dist/capabilities/nebius.json +37 -28
  175. package/dist/capabilities/neon.json +126 -126
  176. package/dist/capabilities/neuralwatt.json +41 -41
  177. package/dist/capabilities/nokeep.json +4 -4
  178. package/dist/capabilities/novita-ai.json +154 -154
  179. package/dist/capabilities/nvidia.json +35 -35
  180. package/dist/capabilities/oathbreaker.json +2 -2
  181. package/dist/capabilities/obscurify.json +32 -32
  182. package/dist/capabilities/oci.json +7 -7
  183. package/dist/capabilities/ofox.json +357 -357
  184. package/dist/capabilities/ollama-cloud.json +56 -56
  185. package/dist/capabilities/openai.json +51 -51
  186. package/dist/capabilities/opencode-go.json +85 -84
  187. package/dist/capabilities/openrouter.json +542 -567
  188. package/dist/capabilities/opper.json +30 -24
  189. package/dist/capabilities/orcarouter.json +236 -236
  190. package/dist/capabilities/outerlabs.json +32 -32
  191. package/dist/capabilities/ovhcloud.json +7 -7
  192. package/dist/capabilities/pareto.json +6 -6
  193. package/dist/capabilities/pendra.json +4 -4
  194. package/dist/capabilities/perplexity-agent.json +61 -61
  195. package/dist/capabilities/phala.json +34 -34
  196. package/dist/capabilities/pioneer.json +30 -30
  197. package/dist/capabilities/poe.json +136 -136
  198. package/dist/capabilities/powerspring.json +13 -13
  199. package/dist/capabilities/primalabs.json +10 -10
  200. package/dist/capabilities/prime.json +124 -107
  201. package/dist/capabilities/privatemode-ai.json +14 -14
  202. package/dist/capabilities/proxystacks.json +6 -6
  203. package/dist/capabilities/qiniu-ai.json +16 -16
  204. package/dist/capabilities/refuseless.json +6 -6
  205. package/dist/capabilities/regolo-ai.json +6 -6
  206. package/dist/capabilities/requesty.json +172 -172
  207. package/dist/capabilities/ruapi.json +17 -17
  208. package/dist/capabilities/runcrate.json +5 -5
  209. package/dist/capabilities/runinfra.json +13 -13
  210. package/dist/capabilities/sakana.json +6 -6
  211. package/dist/capabilities/sambanova.json +9 -9
  212. package/dist/capabilities/sandbase.json +27 -27
  213. package/dist/capabilities/sarvam.json +12 -12
  214. package/dist/capabilities/scaleway.json +14 -14
  215. package/dist/capabilities/scnet-token-plan.json +9 -9
  216. package/dist/capabilities/scx-ai.json +26 -26
  217. package/dist/capabilities/sensenova.json +12 -12
  218. package/dist/capabilities/siliconflow-cn.json +49 -49
  219. package/dist/capabilities/siliconflow.json +46 -46
  220. package/dist/capabilities/snowflake-cortex.json +20 -20
  221. package/dist/capabilities/sokkan.json +7 -7
  222. package/dist/capabilities/sparrowcodes.json +25 -25
  223. package/dist/capabilities/standardcompute.json +102 -102
  224. package/dist/capabilities/steadyrouter.json +40 -40
  225. package/dist/capabilities/stepfun-ai-step-plan.json +6 -6
  226. package/dist/capabilities/stepfun-ai.json +15 -8
  227. package/dist/capabilities/stepfun-step-plan.json +15 -8
  228. package/dist/capabilities/stepfun.json +15 -8
  229. package/dist/capabilities/stepping-stone.json +16 -16
  230. package/dist/capabilities/synthetic.json +13 -13
  231. package/dist/capabilities/synthorai.json +19 -19
  232. package/dist/capabilities/teamorouter.json +24 -24
  233. package/dist/capabilities/teapot-router.json +13 -13
  234. package/dist/capabilities/tencent-coding-plan.json +1 -23
  235. package/dist/capabilities/tencent-token-plan.json +60 -23
  236. package/dist/capabilities/tencent-tokenhub.json +182 -7
  237. package/dist/capabilities/tensorx.json +50 -50
  238. package/dist/capabilities/tenstorrent.json +6 -6
  239. package/dist/capabilities/the-grid-ai.json +28 -28
  240. package/dist/capabilities/thinkingmachines.json +72 -55
  241. package/dist/capabilities/tinfoil.json +13 -13
  242. package/dist/capabilities/toapis.json +2 -2
  243. package/dist/capabilities/togetherai.json +54 -83
  244. package/dist/capabilities/tokengo.json +25 -25
  245. package/dist/capabilities/tokenify.json +9 -9
  246. package/dist/capabilities/trustedrouter.json +4 -4
  247. package/dist/capabilities/trustedtokens.json +17 -17
  248. package/dist/capabilities/umans-ai-coding-plan.json +13 -13
  249. package/dist/capabilities/umans-ai.json +10 -10
  250. package/dist/capabilities/unrestricted.json +6 -6
  251. package/dist/capabilities/uplinkswitch.json +21 -21
  252. package/dist/capabilities/upstage.json +4 -4
  253. package/dist/capabilities/vancine.json +23 -23
  254. package/dist/capabilities/vercel.json +540 -527
  255. package/dist/capabilities/vivgrid.json +80 -80
  256. package/dist/capabilities/volcengine-coding-plan.json +24 -54
  257. package/dist/capabilities/volcengine.json +55 -60
  258. package/dist/capabilities/vultr.json +24 -24
  259. package/dist/capabilities/wafer.ai.json +19 -19
  260. package/dist/capabilities/wallaby.json +5 -5
  261. package/dist/capabilities/wally.json +11 -11
  262. package/dist/capabilities/wandb.json +21 -21
  263. package/dist/capabilities/watt.json +24 -24
  264. package/dist/capabilities/xai.json +7 -7
  265. package/dist/capabilities/xiaomi-token-plan-ams.json +2 -12
  266. package/dist/capabilities/xiaomi-token-plan-cn.json +2 -12
  267. package/dist/capabilities/xiaomi-token-plan-sgp.json +2 -12
  268. package/dist/capabilities/xiaomi.json +3 -25
  269. package/dist/capabilities/xpersona.json +13 -13
  270. package/dist/capabilities/xxapi.json +31 -31
  271. package/dist/capabilities/zai-coding-plan.json +18 -18
  272. package/dist/capabilities/zai.json +49 -26
  273. package/dist/capabilities/zenifra.json +26 -26
  274. package/dist/capabilities/zenmux.json +205 -205
  275. package/dist/capabilities/zerogpu.json +11 -11
  276. package/dist/capabilities/zhipuai-coding-plan.json +6 -6
  277. package/dist/capabilities/zhipuai.json +39 -24
  278. package/dist/capabilities/zro.json +6 -6
  279. package/dist/channels/index.cjs +2 -2
  280. package/dist/channels/index.js +2 -2
  281. package/dist/{channels-Dx4jiXeK.js → channels-Cz1y3W6u.js} +1 -1
  282. package/dist/{channels-q6qnuRNV.cjs → channels-DQg4v_gm.cjs} +1 -1
  283. package/dist/coding-agent/index.cjs +2 -2
  284. package/dist/coding-agent/index.js +2 -2
  285. package/dist/datasets/dataset.d.ts +13 -6
  286. package/dist/datasets/experiment/durable.d.ts +16 -0
  287. package/dist/datasets/experiment/index.d.ts +2 -1
  288. package/dist/datasets/experiment/item.d.ts +26 -4
  289. package/dist/datasets/experiment/retries.d.ts +18 -0
  290. package/dist/datasets/experiment/types.d.ts +18 -0
  291. package/dist/datasets/experiment/workflow-id.d.ts +7 -0
  292. package/dist/datasets/experiment/workflow.d.ts +74 -0
  293. package/dist/datasets/index.cjs +3 -2
  294. package/dist/datasets/index.d.ts +2 -1
  295. package/dist/datasets/index.js +3 -3
  296. package/dist/docs/SKILL.md +4 -3
  297. package/dist/docs/assets/SOURCE_MAP.json +928 -903
  298. package/dist/docs/references/docs-deployment-workers.md +1 -1
  299. package/dist/docs/references/docs-evals-experiments.md +29 -1
  300. package/dist/docs/references/docs-harness-background-tasks.md +4 -1
  301. package/dist/docs/references/docs-harness-durable-agents.md +9 -5
  302. package/dist/docs/references/docs-knowledge-agents-and-tools.md +1 -0
  303. package/dist/docs/references/docs-knowledge-importers.md +195 -0
  304. package/dist/docs/references/docs-knowledge-load-your-content.md +2 -2
  305. package/dist/docs/references/docs-knowledge-overview.md +1 -1
  306. package/dist/docs/references/docs-mastra-platform-observability-overview.md +1 -1
  307. package/dist/docs/references/docs-sandbox-filesystem.md +1 -1
  308. package/dist/docs/references/docs-server-pubsub.md +51 -8
  309. package/dist/docs/references/docs-signals-running-across-processes.md +2 -0
  310. package/dist/docs/references/docs-signals-thread-streams.md +1 -1
  311. package/dist/docs/references/docs-studio-auth.md +54 -7
  312. package/dist/docs/references/docs-workflows-overview.md +1 -1
  313. package/dist/docs/references/docs-workflows-scheduled-workflows.md +1 -1
  314. package/dist/docs/references/integrations-auth-clerk.md +48 -4
  315. package/dist/docs/references/integrations-channels-slack.md +4 -2
  316. package/dist/docs/references/integrations.md +6 -0
  317. package/dist/docs/references/reference-agents-agent.md +3 -1
  318. package/dist/docs/references/reference-agents-channels.md +116 -27
  319. package/dist/docs/references/reference-agents-durable-agent.md +12 -4
  320. package/dist/docs/references/reference-auth-clerk.md +21 -1
  321. package/dist/docs/references/reference-datasets-runExperimentItem.md +13 -1
  322. package/dist/docs/references/reference-datasets-startExperimentAsync.md +3 -1
  323. package/dist/docs/references/reference-editor-mastra-editor.md +3 -1
  324. package/dist/docs/references/reference-knowledge-knowledge-class.md +13 -6
  325. package/dist/docs/references/reference-knowledge-knowledge-tools.md +43 -20
  326. package/dist/docs/references/reference-memory-observational-memory.md +2 -2
  327. package/dist/docs/references/reference-processors-moderation-processor.md +2 -2
  328. package/dist/docs/references/reference-pubsub-base.md +5 -1
  329. package/dist/docs/references/reference-pubsub-event-emitter.md +2 -0
  330. package/dist/docs/references/reference-pubsub-redis-streams.md +1 -1
  331. package/dist/docs/references/reference-pubsub-unix-socket-pubsub.md +2 -0
  332. package/dist/docs/references/reference-streaming-ChunkType.md +3 -3
  333. package/dist/docs/references/reference-workers-overview.md +1 -1
  334. package/dist/docs/references/reference-workflows-run-methods-start.md +23 -0
  335. package/dist/docs/references/reference-workflows-run-methods-timeTravel.md +4 -0
  336. package/dist/docs/references/reference-workflows-run.md +1 -1
  337. package/dist/docs/references/reference-workspace-local-sandbox.md +2 -0
  338. package/dist/error/index.cjs +1 -1
  339. package/dist/error/index.js +1 -1
  340. package/dist/{error-C9d_24w-.js → error-BLwEXqOK.js} +2 -2
  341. package/dist/{error-BRQf2ku0.cjs → error-BdEvO8za.cjs} +2 -2
  342. package/dist/evals/index.cjs +1 -1
  343. package/dist/evals/index.js +1 -1
  344. package/dist/evals/scoreTraces/index.cjs +1 -1
  345. package/dist/evals/scoreTraces/index.js +1 -1
  346. package/dist/events/caching-pubsub.d.ts +1 -0
  347. package/dist/events/event-emitter/index.d.ts +12 -5
  348. package/dist/events/index.cjs +15 -1
  349. package/dist/events/index.js +15 -1
  350. package/dist/events/pubsub.d.ts +29 -0
  351. package/dist/events/reach.d.ts +11 -0
  352. package/dist/events/unix-socket-pubsub.d.ts +14 -0
  353. package/dist/features/index.cjs +1 -0
  354. package/dist/features/index.js +1 -0
  355. package/dist/{filesystem-B5X-5G0x.js → filesystem-B8ad6kAW.js} +1 -1
  356. package/dist/{filesystem-BDSpwBke.cjs → filesystem-BB5YWXH-.cjs} +1 -1
  357. package/dist/{filesystem-DzM9pcQ8.js → filesystem-BDHUxbHn.js} +1 -1
  358. package/dist/{filesystem-B0AZrbj8.cjs → filesystem-BP5yz5LG.cjs} +1 -1
  359. package/dist/{filesystem-BsdkC311.js → filesystem-B_afSgYk.js} +1 -1
  360. package/dist/{filesystem-C-cyJfi1.cjs → filesystem-BaOJOc-V.cjs} +1 -1
  361. package/dist/{filesystem-B3s0WRud.js → filesystem-BhYgU8qg.js} +1 -1
  362. package/dist/{filesystem-DzfqVTO_.js → filesystem-CLBVmR5j.js} +1 -1
  363. package/dist/{filesystem-CEbD_77-.cjs → filesystem-Cgxc2a_-.cjs} +1 -1
  364. package/dist/{filesystem-Cv79mHRk.js → filesystem-ClBOBoDc.js} +1 -1
  365. package/dist/{filesystem-DsCQiBl2.cjs → filesystem-DVVecqZt.cjs} +1 -1
  366. package/dist/{filesystem-CUAgLugE.cjs → filesystem-Fpsu7e24.cjs} +1 -1
  367. package/dist/{filesystem-versioned-Bijb_p9l.js → filesystem-versioned-BL1ojJLo.js} +1 -1
  368. package/dist/{filesystem-versioned-DZGyPbNC.cjs → filesystem-versioned-BavRtYWJ.cjs} +1 -1
  369. package/dist/harness/index.cjs +1 -1
  370. package/dist/harness/index.js +1 -1
  371. package/dist/index.cjs +1 -1
  372. package/dist/index.js +1 -1
  373. package/dist/knowledge/config.d.ts +10 -0
  374. package/dist/knowledge/host-writes.d.ts +10 -0
  375. package/dist/knowledge/importers/conformance.d.ts +25 -0
  376. package/dist/knowledge/importers/define.d.ts +204 -0
  377. package/dist/knowledge/importers/host.d.ts +143 -0
  378. package/dist/knowledge/importers/index.d.ts +12 -0
  379. package/dist/knowledge/importers/local-host.d.ts +106 -0
  380. package/dist/knowledge/importers/manifest.d.ts +25 -0
  381. package/dist/knowledge/importers/runner.d.ts +61 -0
  382. package/dist/knowledge/importers/sink.d.ts +105 -0
  383. package/dist/knowledge/importers/types.d.ts +144 -0
  384. package/dist/knowledge/index.cjs +2715 -8
  385. package/dist/knowledge/index.d.ts +54 -4
  386. package/dist/knowledge/index.js +2692 -9
  387. package/dist/knowledge/instructions.d.ts +1 -1
  388. package/dist/knowledge/links.d.ts +8 -0
  389. package/dist/knowledge/pinned-state-processor.d.ts +5 -0
  390. package/dist/knowledge/pinned.d.ts +4 -1
  391. package/dist/knowledge/scope-runtime.d.ts +10 -0
  392. package/dist/llm/index.cjs +3 -3
  393. package/dist/llm/index.js +3 -3
  394. package/dist/llm/model/provider-types.generated.d.ts +7812 -7831
  395. package/dist/llm/model/shared.types.d.ts +31 -0
  396. package/dist/{llm-CsQuqKPc.cjs → llm-8Av3mSjD.cjs} +2 -2
  397. package/dist/{llm-DnXK3Pmw.js → llm-B5A5cwJr.js} +2 -2
  398. package/dist/loop/index.cjs +2 -2
  399. package/dist/loop/index.js +2 -2
  400. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +2 -2
  401. package/dist/{manager-BsghM-UL.js → manager-DfWQCJUK.js} +460 -94
  402. package/dist/{manager-DwFnIrI6.cjs → manager-sv35JY-z.cjs} +476 -92
  403. package/dist/mastra/index.cjs +1 -1
  404. package/dist/mastra/index.d.ts +13 -0
  405. package/dist/mastra/index.js +1 -1
  406. package/dist/mastra/resolve-agent.d.ts +3 -1
  407. package/dist/{mastra-B8i1UDZs.js → mastra-CigBrT7X.js} +32 -23
  408. package/dist/{mastra-Cn5NC6Es.cjs → mastra-D4hvfuxX.cjs} +34 -25
  409. package/dist/memory/index.cjs +3 -3
  410. package/dist/memory/index.js +3 -3
  411. package/dist/{message-list-DPXPXvin.cjs → message-list-Cj0Sq_JP.cjs} +63 -8
  412. package/dist/{message-list-DEuRl82K.js → message-list-KRbg-TnI.js} +63 -8
  413. package/dist/{model-CNPfry_X.cjs → model-BK93CMtl.cjs} +1 -1
  414. package/dist/{model-CsOcWMUt.js → model-CYtXw861.js} +1 -1
  415. package/dist/{netlify-C-83Fxus.cjs → netlify-BAnn3ouY.cjs} +1 -1
  416. package/dist/{netlify-C-OpNSGp.js → netlify-CuI1ZrwR.js} +1 -1
  417. package/dist/notifications/index.cjs +1 -1
  418. package/dist/notifications/index.js +1 -1
  419. package/dist/{output-helpers-JL-HeCbT.cjs → output-helpers-1Zu4Vt9C.cjs} +68 -25
  420. package/dist/{output-helpers-D4II19No.js → output-helpers-CedRCE17.js} +69 -26
  421. package/dist/processor-provider/index.cjs +1 -1
  422. package/dist/processor-provider/index.js +1 -1
  423. package/dist/processors/abort-signal-scope.d.ts +6 -0
  424. package/dist/processors/index.cjs +2 -2
  425. package/dist/processors/index.js +2 -2
  426. package/dist/{provider-registry-9O-H9osy.cjs → provider-registry-BwuI_IpT.cjs} +21690 -21811
  427. package/dist/{provider-registry-RZ8EgSe8.js → provider-registry-CmQLzLF_.js} +21690 -21811
  428. package/dist/provider-registry.json +22113 -22215
  429. package/dist/{registry-generator-e8sltJls.js → registry-generator-C17V4WfG.js} +1 -1
  430. package/dist/{registry-generator-DxCX-FiO.cjs → registry-generator-C_0ae7Ce.cjs} +1 -1
  431. package/dist/{rehydrate-B-wrAN7C.cjs → rehydrate-CDQ4dOYj.cjs} +2 -2
  432. package/dist/{rehydrate-D3fPgJwp.js → rehydrate-PnaVawGX.js} +2 -2
  433. package/dist/relevance/index.cjs +2 -2
  434. package/dist/relevance/index.js +2 -2
  435. package/dist/{run-registry-5_LQBGn_.cjs → run-registry-BmckDVBk.cjs} +1698 -497
  436. package/dist/{run-registry-DC03XLeZ.js → run-registry-BwEcwYlU.js} +1614 -467
  437. package/dist/{source-DDwx-87N.cjs → source-BVOi8Xhp.cjs} +1 -1
  438. package/dist/{source-Did_2XQc.js → source-fNa6u1kH.js} +1 -1
  439. package/dist/storage/domains/agents/index.cjs +1 -1
  440. package/dist/storage/domains/agents/index.js +1 -1
  441. package/dist/storage/domains/knowledge/base.d.ts +72 -0
  442. package/dist/storage/domains/knowledge/importers-inmemory.d.ts +146 -0
  443. package/dist/storage/domains/knowledge/importers.d.ts +287 -0
  444. package/dist/storage/domains/knowledge/index.d.ts +1 -0
  445. package/dist/storage/domains/knowledge/inmemory.d.ts +12 -0
  446. package/dist/storage/domains/knowledge/pages-inmemory.d.ts +12 -1
  447. package/dist/storage/domains/knowledge/pages.d.ts +25 -7
  448. package/dist/storage/domains/mcp-clients/index.cjs +1 -1
  449. package/dist/storage/domains/mcp-clients/index.js +1 -1
  450. package/dist/storage/domains/mcp-servers/index.cjs +1 -1
  451. package/dist/storage/domains/mcp-servers/index.js +1 -1
  452. package/dist/storage/domains/prompt-blocks/index.cjs +1 -1
  453. package/dist/storage/domains/prompt-blocks/index.js +1 -1
  454. package/dist/storage/domains/scorer-definitions/index.cjs +1 -1
  455. package/dist/storage/domains/scorer-definitions/index.js +1 -1
  456. package/dist/storage/domains/skills/index.cjs +1 -1
  457. package/dist/storage/domains/skills/index.js +1 -1
  458. package/dist/storage/domains/workspaces/index.cjs +1 -1
  459. package/dist/storage/domains/workspaces/index.js +1 -1
  460. package/dist/storage/index.cjs +15 -10
  461. package/dist/storage/index.js +11 -11
  462. package/dist/stream/base/output.d.ts +59 -15
  463. package/dist/stream/index.cjs +2 -2
  464. package/dist/stream/index.js +2 -2
  465. package/dist/stream/types.d.ts +24 -2
  466. package/dist/{stream-4aNIw_TQ.cjs → stream-0kdqBOOn.cjs} +64 -9
  467. package/dist/{stream-CJUm6EAH.js → stream-D1y9GzoD.js} +29 -10
  468. package/dist/test-utils/llm-mock.cjs +1 -1
  469. package/dist/test-utils/llm-mock.js +1 -1
  470. package/dist/tool-loop-agent/index.cjs +1 -1
  471. package/dist/tool-loop-agent/index.js +1 -1
  472. package/dist/{tool-loop-agent-FEEwHfmg.js → tool-loop-agent-BdjWGVIb.js} +4 -4
  473. package/dist/{tool-loop-agent-Dn0QCB9n.cjs → tool-loop-agent-kWaZAT6Q.cjs} +4 -4
  474. package/dist/tools/types.d.ts +27 -1
  475. package/dist/{utils-DY01hxVd.cjs → utils-BKUCaZ12.cjs} +1 -1
  476. package/dist/{utils-Bd_y1_a-.js → utils-GHY3hmLx.js} +1 -1
  477. package/dist/utils.cjs +1 -1
  478. package/dist/utils.js +1 -1
  479. package/dist/{validate-CX0yQo_q.js → validate-CB-q-R2F.js} +1 -1
  480. package/dist/{validate-CuB_1Zd3.cjs → validate-De92squ7.cjs} +1 -1
  481. package/dist/vector/index.cjs +2 -2
  482. package/dist/vector/index.js +2 -2
  483. package/dist/worker/index.cjs +1 -1
  484. package/dist/worker/index.js +1 -1
  485. package/dist/{worker-CbaSmip-.cjs → worker-BbWPQuPR.cjs} +2 -2
  486. package/dist/{worker-B80xkcKG.js → worker-C3u_xzY2.js} +2 -2
  487. package/dist/{worker-GsGIxPMa.cjs → worker-CAKvQj9_.cjs} +2 -2
  488. package/dist/{worker-DSEfMPmq.js → worker-Kwm8EKcj.js} +2 -2
  489. package/dist/{workflow-CnBPXTpv.cjs → workflow-CSjXeNcR.cjs} +4 -4
  490. package/dist/{workflow-CZHY_C85.js → workflow-CVmI1Sw-.js} +4 -4
  491. package/dist/workflows/builder/index.cjs +1 -1
  492. package/dist/workflows/builder/index.js +1 -1
  493. package/dist/workflows/evented/index.cjs +1 -1
  494. package/dist/workflows/evented/index.js +1 -1
  495. package/dist/workflows/evented/setup-warning.d.ts +18 -0
  496. package/dist/workflows/evented/workflow-event-processor/run-status.d.ts +37 -0
  497. package/dist/workflows/evented/workflow.d.ts +10 -0
  498. package/dist/workflows/index.cjs +4 -4
  499. package/dist/workflows/index.js +4 -4
  500. package/dist/workflows/workflow.d.ts +6 -1
  501. package/dist/workspace/filesystem/filesystem.d.ts +5 -0
  502. package/dist/workspace/index.cjs +1 -1
  503. package/dist/workspace/index.js +1 -1
  504. package/dist/workspace/sandbox/local-sandbox.d.ts +16 -7
  505. package/dist/workspace/sandbox/native-sandbox/types.d.ts +11 -1
  506. package/dist/{workspace-D7TIleIt.js → workspace-DY2Nxiyi.js} +235 -34
  507. package/dist/{workspace-D2drutNg.cjs → workspace-X2RHJZU9.cjs} +235 -34
  508. package/package.json +7 -7
  509. package/src/llm/model/provider-types.generated.d.ts +7812 -7831
@@ -0,0 +1,106 @@
1
+ import type { KnowledgeStorage } from '../../storage/domains/knowledge/base.js';
2
+ import type { KnowledgeImporterRunStatus } from '../../storage/domains/knowledge/importers.js';
3
+ import type { KnowledgeHostWriter } from '../host-writes.js';
4
+ import type { KnowledgeImporterHost, KnowledgeImporterRunBinding, KnowledgeImporterRunStart, KnowledgeImporterStartRunOptions } from './host.js';
5
+ import type { KnowledgeImporterRunReceipt } from './types.js';
6
+ /** @experimental */
7
+ export interface LocalKnowledgeImporterHostOptions {
8
+ /**
9
+ * The bindings this host applies flushes for: a list, or a function read at each run start, so a
10
+ * host that keeps bindings in its own config picks up changes without a new host.
11
+ */
12
+ bindings: readonly KnowledgeImporterRunBinding[] | (() => Promise<readonly KnowledgeImporterRunBinding[]>);
13
+ /** Recorded as the writer of imported pages. Default `importer:<bindingId>`. */
14
+ author?: (binding: KnowledgeImporterRunBinding) => string;
15
+ /**
16
+ * How long one flush may spend in its transaction, from the wait for a connection to the last
17
+ * statement, before it rolls back and the runner resends it. Also capped by the run's deadline.
18
+ * Enforced only on stores with `enforcesTransactionDeadline` (PostgreSQL); COMMIT itself isn't
19
+ * bounded. Default 45 seconds, under the runner's 60-second host-call timeout.
20
+ */
21
+ flushBudgetMs?: number;
22
+ /**
23
+ * A running run whose last heartbeat (or start, before its first) is older than this is taken
24
+ * to have lost its runner: the next start of its binding ends it as `failed` (`stopped`) and
25
+ * starts. A run past its deadline is reclaimed the same way. Default 5 minutes.
26
+ */
27
+ staleRunAfterMs?: number;
28
+ /**
29
+ * Wall-clock budget for one flush's settle slice; it stops before the next node once this has
30
+ * passed. Default 10 seconds, well inside `flushBudgetMs`. Settle work is also capped at 200
31
+ * nodes examined and 50 moves per flush.
32
+ */
33
+ settleBudgetMs?: number;
34
+ /**
35
+ * Strict liveness for a host whose runners live elsewhere (r352 S1). A run is live only while
36
+ * `store.now() < (heartbeatAt ?? startedAt) + leaseMs` and before its deadline, by the store's
37
+ * clock; a heartbeat, a new flush or a finish that finds it otherwise is refused as
38
+ * `run_not_active` and writes nothing, and a lapsed run is never revived. Each flush transaction
39
+ * is cut off at the lease end too. Replaces `staleRunAfterMs`. Unset: the in-process rules
40
+ * (`staleRunAfterMs` reclaim at the next start).
41
+ */
42
+ leaseMs?: number;
43
+ }
44
+ /** Start options of a service host: a claim admitted in the run's start transaction (r352 S4). @experimental */
45
+ export interface KnowledgeImporterServiceStartOptions extends KnowledgeImporterStartRunOptions {
46
+ /**
47
+ * The writer generation the claim was issued for. The start is refused (`stale_generation`)
48
+ * unless it is the current one and the active write path is `'new'`.
49
+ */
50
+ generation?: number;
51
+ /**
52
+ * Called inside the start transaction, under the writer guard and before the scope is
53
+ * materialized and the run row written, with the transaction-bound storage. Throw to refuse the
54
+ * start: everything rolls back, the caller's own writes through `tx` included. A start that
55
+ * finds another run of the binding going rolls back the same way and reports `skipped`.
56
+ */
57
+ admit?: (tx: KnowledgeStorage) => Promise<void>;
58
+ }
59
+ /**
60
+ * A {@link KnowledgeImporterHost} for a service that applies flushes for runners elsewhere: it can
61
+ * also cancel runs and end those whose lease or deadline passed. @experimental
62
+ */
63
+ export interface KnowledgeImporterServiceHost extends KnowledgeImporterHost {
64
+ startRun(bindingId: string, options?: KnowledgeImporterServiceStartOptions): Promise<KnowledgeImporterRunStart>;
65
+ /**
66
+ * Asks a running run to stop: its heartbeat answers `cancel: true` and its new flushes are
67
+ * refused. A finish admitted afterwards is recorded as canceled. No-op on an ended run.
68
+ */
69
+ requestCancel(runId: string): Promise<{
70
+ status: KnowledgeImporterRunStatus;
71
+ } | null>;
72
+ /**
73
+ * Ends every running run past its lease (`leaseMs`, else `staleRunAfterMs`) or deadline, by the
74
+ * store's clock: `canceled` when a cancel was requested, otherwise `failed` with
75
+ * `lease_expired` or `deadline_exceeded`. Safe to call from a schedule and from several workers.
76
+ */
77
+ expireRuns(): Promise<{
78
+ expired: string[];
79
+ }>;
80
+ /**
81
+ * Forgets a binding the app deleted: its tracking, cursor state and runs. Its pages stay where
82
+ * they are as ordinary pages; nothing reserves its target, so any binding can write there next,
83
+ * taking over the pages it finds at its items' paths. A run of it still going is refused at its
84
+ * next flush. No-op for a binding that was never stored.
85
+ */
86
+ retireBinding(bindingId: string): Promise<void>;
87
+ /**
88
+ * A run's status and, once it ended, the receipt its finish stored (the app's, or the host's for a
89
+ * run it ended), with the chaining decision schedulers act on. Null for an unknown run. An ended run
90
+ * with no stored finish reads as `receipt: null`; this host always stores one, so that is for a host
91
+ * that ends runs itself.
92
+ */
93
+ readRun(runId: string): Promise<{
94
+ status: KnowledgeImporterRunStatus;
95
+ receipt: KnowledgeImporterRunReceipt | null;
96
+ } | null>;
97
+ }
98
+ /**
99
+ * A {@link KnowledgeImporterHost} over the app's own Knowledge storage: each flush is one storage
100
+ * transaction holding its page writes, node map, state, run changes and receipt. Embeds run after
101
+ * commit; a failed embed is a warning and never fails the flush.
102
+ *
103
+ * @internal Reached through `Knowledge`; the writer is Knowledge's own.
104
+ */
105
+ export declare function createLocalKnowledgeImporterHost(writer: KnowledgeHostWriter, options: LocalKnowledgeImporterHostOptions): KnowledgeImporterServiceHost;
106
+ //# sourceMappingURL=local-host.d.ts.map
@@ -0,0 +1,25 @@
1
+ import type { JSONSchema7 } from 'json-schema';
2
+ /**
3
+ * What a host shows for an importer class: its form and its credential slots. Plain JSON, so a UI
4
+ * or another process (hosted Knowledge) can render it without the importer's code.
5
+ *
6
+ * @experimental
7
+ */
8
+ export interface KnowledgeImporterManifest {
9
+ id: string;
10
+ label: string;
11
+ description?: string;
12
+ /** An http(s) URL or a `data:image/` URI. */
13
+ iconUrl?: string;
14
+ /** Draft-07 JSON Schema of the settings as a binding supplies them (the schema's input side). */
15
+ settingsSchema: JSONSchema7;
16
+ credentials: Record<string, {
17
+ description: string;
18
+ secret: boolean;
19
+ }>;
20
+ }
21
+ /** The settings schema of an importer with no settings: an empty object. */
22
+ export declare const EMPTY_KNOWLEDGE_IMPORTER_SETTINGS_SCHEMA: JSONSchema7;
23
+ /** Every `$ref` in a schema, so a manifest can refuse ones that point outside the schema. */
24
+ export declare function jsonSchemaRefs(schema: unknown, refs?: string[]): string[];
25
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1,61 @@
1
+ import { KnowledgeImporterBase } from './define.js';
2
+ import type { KnowledgeImporterClass } from './define.js';
3
+ import type { KnowledgeImporterHost, KnowledgeImporterStartRunOptions } from './host.js';
4
+ import type { KnowledgeImporterRunReceipt } from './types.js';
5
+ /** @experimental */
6
+ export interface RunKnowledgeImportOptions {
7
+ /**
8
+ * The app's importers. An instance runs when its binding is the run's binding; a class is
9
+ * constructed from the binding the host returns (a host that keeps bindings itself, as hosted
10
+ * Knowledge does).
11
+ */
12
+ importers: readonly (KnowledgeImporterBase | KnowledgeImporterClass)[];
13
+ host: KnowledgeImporterHost;
14
+ bindingId: string;
15
+ start?: KnowledgeImporterStartRunOptions;
16
+ /** No new pass starts after this. Default 25 minutes. */
17
+ budgetMs?: number;
18
+ /** After the budget, how long a running pass may take before the run is stopped. Default 3 minutes. */
19
+ graceMs?: number;
20
+ /** Most `import` passes in one run. Default 200. */
21
+ maxPasses?: number;
22
+ /** Ops per flush. Default 200. */
23
+ bufferSize?: number;
24
+ /** Default 30 seconds. */
25
+ heartbeatMs?: number;
26
+ /** Resends of one flush or finish after a 5xx or network error. Default 8. */
27
+ maxRetries?: number;
28
+ /**
29
+ * How long one call to the host may take before it counts as a lost ack (retryable: it may have
30
+ * committed). Default 60 seconds.
31
+ */
32
+ hostCallTimeoutMs?: number;
33
+ retryDelayMs?: (attempt: number) => number;
34
+ /** The source fetch handed to the importer. Default the platform fetch. */
35
+ fetch?: (input: string | URL, init?: RequestInit) => Promise<Response>;
36
+ }
37
+ /** @experimental */
38
+ export type RunKnowledgeImportResult = KnowledgeImporterRunReceipt
39
+ /** Another run of the binding was going. */
40
+ | {
41
+ status: 'skipped';
42
+ runId: string;
43
+ }
44
+ /**
45
+ * The host couldn't be reached to record the end. The run stays open on the host until its
46
+ * liveness check ends it; nothing more is written for it.
47
+ */
48
+ | {
49
+ status: 'unfinished';
50
+ runId: string;
51
+ lastSeq: number;
52
+ };
53
+ /**
54
+ * Runs one import: starts a run on the host, calls the importer's `import` in passes, sends its items
55
+ * in numbered flushes, and records how the run ended. Every write goes through `host`; the runner
56
+ * never touches storage. Failures end the run with a fixed code; no exception text leaves the app.
57
+ *
58
+ * @experimental
59
+ */
60
+ export declare function runKnowledgeImport(options: RunKnowledgeImportOptions): Promise<RunKnowledgeImportResult>;
61
+ //# sourceMappingURL=runner.d.ts.map
@@ -0,0 +1,105 @@
1
+ import type { KnowledgeStorage } from '../../storage/domains/knowledge/base.js';
2
+ import type { KnowledgeImporterBindingRecord, KnowledgeImporterChangeKind, KnowledgeImportersStorage } from '../../storage/domains/knowledge/importers.js';
3
+ import type { KnowledgePage, KnowledgeProvenance } from '../../storage/domains/knowledge/pages.js';
4
+ import type { KnowledgeImportCounts, KnowledgeImportRefusal, KnowledgeImportRefusalReason, KnowledgeImporterOp } from './types.js';
5
+ /**
6
+ * Applies one flush's ops to pages and the node map, on a transaction view. Pages are found by id
7
+ * through the node map: the binding tracks its anchor (the folder at its target) and the pages its
8
+ * nodes point at. A page already at a new item's path is taken over by that item's node, whoever
9
+ * wrote it, and kept as a stub rather than deleted when the item is removed.
10
+ *
11
+ * @internal
12
+ */
13
+ /** The body a page keeps when its item is gone at the source but pages are still nested under it. */
14
+ export declare const REMOVED_PARENT_BODY = "Removed from the source. Kept because pages are still nested under it.";
15
+ export declare const REMOVED_FOLDER_BODY = "Removed from the source. Kept because another importer writes under it.";
16
+ export declare const REMOVED_ADOPTED_BODY = "Removed from the source. Kept because the page was here before the import.";
17
+ /** Heads the note that keeps the body a page had before an importer took it over. */
18
+ export declare const ORIGINAL_BODY_NOTE = "The body this page had before an importer took it over:\n\n";
19
+ /** Embedding work for after commit. */
20
+ export type KnowledgeImportEmbedJob = {
21
+ kind: 'index';
22
+ pageId: string;
23
+ } | {
24
+ kind: 'remove';
25
+ pageId: string;
26
+ };
27
+ export interface KnowledgeImportChange {
28
+ sourceId: string;
29
+ pageId: string | null;
30
+ change: KnowledgeImporterChangeKind;
31
+ title: string;
32
+ path: string;
33
+ }
34
+ export interface KnowledgeImportSinkResult {
35
+ counts: Omit<KnowledgeImportCounts, 'refused'>;
36
+ refused: KnowledgeImportRefusal[];
37
+ changes: KnowledgeImportChange[];
38
+ embeds: KnowledgeImportEmbedJob[];
39
+ /** Whether any op wrote a page or the node map: an empty or all-refused flush applies nothing. */
40
+ applied: boolean;
41
+ /** Present when the flush ran a settle slice. */
42
+ settle?: KnowledgeImportSettleResult;
43
+ }
44
+ /** Bounds for one settle slice (O3 §C, §C′): a slice never drains everything. */
45
+ export interface KnowledgeImportSettleBudget {
46
+ /** The unsettled node to start after: where the last slice stopped. Null starts a pass. */
47
+ after: string | null;
48
+ /** Unsettled nodes examined at most. */
49
+ candidates: number;
50
+ /** Page moves at most. */
51
+ moves: number;
52
+ /** Epoch ms: the slice stops before the next candidate once this has passed. */
53
+ until: number;
54
+ /** Called as the slice starts, so a host can tell a timeout while settling from one before it. */
55
+ onStart?: () => void;
56
+ }
57
+ export interface KnowledgeImportSettleResult {
58
+ /** The pass isn't through the binding's unsettled nodes: another slice should run. */
59
+ pending: boolean;
60
+ /** Where the next slice starts; null when the pass ended and the next one starts over. */
61
+ cursor: string | null;
62
+ /** Moves and relinks this slice landed. */
63
+ settled: number;
64
+ /** The slice ran from the first unsettled node, so it saw every repair queued before it started. */
65
+ fromStart: boolean;
66
+ }
67
+ /**
68
+ * Host state key another binding's flush sets, to a fresh value, when it queues link repairs on
69
+ * this binding's pages. Those pages may sort before this binding's saved settle cursor, so its next
70
+ * slice starts the pass over when the value differs from {@link KNOWLEDGE_IMPORT_SETTLE_SEEN_KEY}.
71
+ * The binding's own flushes never write this key, so a flush that read the state earlier can't undo it.
72
+ */
73
+ export declare const KNOWLEDGE_IMPORT_SETTLE_RESTART_KEY = "mastra:settle:restart";
74
+ /** The {@link KNOWLEDGE_IMPORT_SETTLE_RESTART_KEY} value the binding's settling last started over for. */
75
+ export declare const KNOWLEDGE_IMPORT_SETTLE_SEEN_KEY = "mastra:settle:seen";
76
+ /** A per-item refusal: its savepoint rolls back and the flush goes on. */
77
+ export declare class KnowledgeImportRefusalError extends Error {
78
+ readonly reason: KnowledgeImportRefusalReason;
79
+ constructor(reason: KnowledgeImportRefusalReason);
80
+ }
81
+ /** Splits `<scope>#<path>`; throws on a target the sink can't own. */
82
+ export declare function parseKnowledgeImportTarget(target: string): {
83
+ scope: string;
84
+ path: string[];
85
+ };
86
+ /**
87
+ * A reversible page key for a source ID: `/`, `#`, `%`, `:` and `~` become `~` and two hex digits,
88
+ * and an empty ID is `~`. As Platform's sink, so imported paths match.
89
+ */
90
+ export declare function knowledgeImportKey(sourceId: string): string;
91
+ export interface KnowledgeImportSinkInput {
92
+ /** A transaction view. */
93
+ storage: KnowledgeStorage;
94
+ importers: KnowledgeImportersStorage;
95
+ binding: KnowledgeImporterBindingRecord;
96
+ /** The scope page of the binding's target, materialized before the flush. */
97
+ scope: KnowledgePage;
98
+ runId: string;
99
+ ops: KnowledgeImporterOp[];
100
+ provenance: KnowledgeProvenance;
101
+ /** Run one settle slice after the ops. */
102
+ settle?: KnowledgeImportSettleBudget;
103
+ }
104
+ export declare function applyKnowledgeImportFlush(input: KnowledgeImportSinkInput): Promise<KnowledgeImportSinkResult>;
105
+ //# sourceMappingURL=sink.d.ts.map
@@ -0,0 +1,144 @@
1
+ /**
2
+ * The importer contract: what an importer writes (items) and what its runner sends a host (flushes).
3
+ * Items name things by `sourceId`, the source's own stable ID. They never name pages or paths;
4
+ * the host's sink decides where an item lands and refuses what the binding doesn't own.
5
+ */
6
+ /** A link from an item to another item of the same binding, resolved through the node map. */
7
+ export interface KnowledgeImportLink {
8
+ sourceId: string;
9
+ rel?: string;
10
+ }
11
+ /** Puts an item in the tree before its body is fetched (search skips it until the body lands). */
12
+ export interface KnowledgeImportDeclaration {
13
+ /** Stable ID at the source, never the title. */
14
+ sourceId: string;
15
+ kind?: string;
16
+ title: string;
17
+ /** The parent's `sourceId`, or null/absent for the binding's target top. */
18
+ parent?: string | null;
19
+ /** Where the item waits while `parent` hasn't arrived: a holding item's `sourceId`. */
20
+ fallbackParent?: string;
21
+ }
22
+ /**
23
+ * One item with its content. A re-upsert whose title, description and body match the page writes
24
+ * nothing; otherwise the item's fields replace the page's, including edits someone made in Knowledge.
25
+ */
26
+ export interface KnowledgeImportItem extends KnowledgeImportDeclaration {
27
+ description?: string;
28
+ body: string;
29
+ links?: KnowledgeImportLink[];
30
+ /** Other refs (URLs, keys) that resolve links to this item. They never change placement. */
31
+ aliases?: string[];
32
+ }
33
+ /** A buffered importer call, as sent in a flush. */
34
+ export type KnowledgeImporterOp = {
35
+ op: 'upsert';
36
+ item: KnowledgeImportItem;
37
+ } | {
38
+ op: 'declare';
39
+ item: KnowledgeImportDeclaration;
40
+ }
41
+ /** Only on a positive signal from the source (archived, trashed); never because an item was missing. */
42
+ | {
43
+ op: 'remove';
44
+ sourceId: string;
45
+ };
46
+ /** Staged `ctx.state.set` values. They commit with the ops of the same flush, or not at all. */
47
+ export type KnowledgeImporterState = Record<string, string>;
48
+ /** Why the sink refused one op. The rest of the flush still commits. */
49
+ export type KnowledgeImportRefusalReason =
50
+ /** Another page took the item's path at the same moment, or the page found there changed before it was locked. */
51
+ 'occupied'
52
+ /** The item's page or the pages on the way to it changed while the flush waited, or Knowledge refused the write (a move too large, for example). */
53
+ | 'conflict'
54
+ /** The op names something the binding can't hold (bad parent, malformed item). */
55
+ | 'invalid';
56
+ export interface KnowledgeImportRefusal {
57
+ sourceId: string;
58
+ reason: KnowledgeImportRefusalReason;
59
+ }
60
+ export interface KnowledgeImportCounts {
61
+ created: number;
62
+ updated: number;
63
+ unchanged: number;
64
+ moved: number;
65
+ removed: number;
66
+ stubbed: number;
67
+ refused: number;
68
+ }
69
+ /** What a host applied for one flush. A replay of the same flush returns the stored receipt. */
70
+ export interface KnowledgeImporterFlushReceipt extends Omit<KnowledgeImportCounts, 'refused'> {
71
+ seq: number;
72
+ refused: KnowledgeImportRefusal[];
73
+ /**
74
+ * The host has settle work left: pages to move under parents that arrived since, or links that
75
+ * now resolve. The runner sends empty flushes (`ops: []`) while this is true and its budget
76
+ * allows; each does one bounded slice. Stored with the receipt, so a replay returns the same value.
77
+ */
78
+ pending?: boolean;
79
+ }
80
+ /** One numbered batch from the runner. All or nothing. */
81
+ export interface KnowledgeImporterFlush {
82
+ runId: string;
83
+ generation: number;
84
+ /** Exactly the host's last committed seq + 1. */
85
+ seq: number;
86
+ /** `knowledgeImporterFlushDigest({ ops, state })`. The host recomputes it and refuses a mismatch. */
87
+ digest: string;
88
+ ops: KnowledgeImporterOp[];
89
+ state?: KnowledgeImporterState;
90
+ }
91
+ export type KnowledgeImporterRunOutcome = 'succeeded' | 'failed' | 'canceled';
92
+ /**
93
+ * Failure codes an importer run can finish with. Fixed codes, no free text: a host may store and
94
+ * show them, so an app's exception text never leaves the app's own logs.
95
+ */
96
+ export type KnowledgeImporterErrorCode = 'source_auth_failed' | 'source_unreachable' | 'source_rate_limited' | 'source_bad_response' | 'source_not_found' | 'settings_invalid' | 'credential_missing' | 'importer_missing_from_deploy' | 'importer_error'
97
+ /** Hard deadline reached; the cursor stays behind what didn't land. */
98
+ | 'stopped'
99
+ /** Recorded by a host that ended the run: its runner stopped renewing the lease. */
100
+ | 'lease_expired'
101
+ /** Recorded by a host that ended the run: the run's deadline passed before it finished. */
102
+ | 'deadline_exceeded';
103
+ export interface KnowledgeImporterRunError {
104
+ code: KnowledgeImporterErrorCode;
105
+ retryable?: boolean;
106
+ /** The source's HTTP status, when the failure was a source response. */
107
+ httpStatus?: number;
108
+ }
109
+ export interface KnowledgeImporterFinishRequest {
110
+ runId: string;
111
+ generation: number;
112
+ outcome: KnowledgeImporterRunOutcome;
113
+ /** Only `succeeded` with backlog is chained into another run. */
114
+ backlog: boolean;
115
+ /** The last seq the runner had a receipt for; must equal the host's committed seq. */
116
+ lastSeq: number;
117
+ error?: KnowledgeImporterRunError;
118
+ }
119
+ /** What a host recorded when a run ended. Counts are summed from flush receipts, never sent by the runner. */
120
+ export interface KnowledgeImporterRunReceipt {
121
+ runId: string;
122
+ outcome: KnowledgeImporterRunOutcome;
123
+ backlog: boolean;
124
+ lastSeq: number;
125
+ error: {
126
+ code: KnowledgeImporterErrorCode;
127
+ retryable: boolean | null;
128
+ httpStatus: number | null;
129
+ } | null;
130
+ counts: KnowledgeImportCounts;
131
+ /**
132
+ * The host's decision to start another run right away: the app's `backlog`, or settle work left
133
+ * after this run's settle flushes made progress. Schedulers chain on this, never on `backlog`.
134
+ * Stored with the finish; a replay returns the same value.
135
+ */
136
+ chain: boolean;
137
+ /**
138
+ * The items the host refused in this run, as the runner received them in flush receipts: the first
139
+ * 100, in order. `counts.refused` has the total. Set by the runner, not stored by the host, so a
140
+ * receipt read back from the host has none.
141
+ */
142
+ refused?: KnowledgeImportRefusal[];
143
+ }
144
+ //# sourceMappingURL=types.d.ts.map