@mastra/code-sdk 0.0.0-agent-tags-alpha-20261125185303

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 (407) hide show
  1. package/LICENSE.md +32 -0
  2. package/README.md +284 -0
  3. package/dist/acp/agent.d.ts +48 -0
  4. package/dist/acp/agent.js +414 -0
  5. package/dist/acp/errors.d.ts +3 -0
  6. package/dist/acp/errors.js +11 -0
  7. package/dist/acp/event-mapper.d.ts +28 -0
  8. package/dist/acp/event-mapper.js +274 -0
  9. package/dist/acp/index.d.ts +9 -0
  10. package/dist/acp/index.js +21 -0
  11. package/dist/acp/runtime.d.ts +5 -0
  12. package/dist/acp/runtime.js +91 -0
  13. package/dist/acp/server.d.ts +4 -0
  14. package/dist/acp/server.js +35 -0
  15. package/dist/acp/skills.d.ts +6 -0
  16. package/dist/acp/skills.js +30 -0
  17. package/dist/acp.d.ts +2 -0
  18. package/dist/acp.js +1 -0
  19. package/dist/agent-connections/messaging-processor.d.ts +17 -0
  20. package/dist/agent-connections/messaging-processor.js +131 -0
  21. package/dist/agent-connections/ownership.d.ts +24 -0
  22. package/dist/agent-connections/ownership.js +96 -0
  23. package/dist/agent-connections/registry.d.ts +20 -0
  24. package/dist/agent-connections/registry.js +167 -0
  25. package/dist/agent-connections/session-advertisement.d.ts +27 -0
  26. package/dist/agent-connections/session-advertisement.js +86 -0
  27. package/dist/agent-connections/signal-provider.d.ts +141 -0
  28. package/dist/agent-connections/signal-provider.js +35 -0
  29. package/dist/agent-connections/state-processor.d.ts +23 -0
  30. package/dist/agent-connections/state-processor.js +270 -0
  31. package/dist/agent-connections/thread-state.d.ts +41 -0
  32. package/dist/agent-connections/thread-state.js +157 -0
  33. package/dist/agent-connections/tools.d.ts +133 -0
  34. package/dist/agent-connections/tools.js +616 -0
  35. package/dist/agent-connections/types.d.ts +99 -0
  36. package/dist/agent-connections/types.js +4 -0
  37. package/dist/agent-connections/untrusted-text.d.ts +5 -0
  38. package/dist/agent-connections/untrusted-text.js +19 -0
  39. package/dist/agents/background-completion-events.d.ts +16 -0
  40. package/dist/agents/background-completion-events.js +16 -0
  41. package/dist/agents/background-completion.d.ts +22 -0
  42. package/dist/agents/background-completion.js +73 -0
  43. package/dist/agents/context-audit.d.ts +84 -0
  44. package/dist/agents/context-audit.js +115 -0
  45. package/dist/agents/credential-resolver.d.ts +74 -0
  46. package/dist/agents/credential-resolver.js +142 -0
  47. package/dist/agents/custom-provider-source.d.ts +35 -0
  48. package/dist/agents/custom-provider-source.js +22 -0
  49. package/dist/agents/fastembed-subprocess.d.ts +52 -0
  50. package/dist/agents/fastembed-subprocess.js +282 -0
  51. package/dist/agents/instructions.d.ts +42 -0
  52. package/dist/agents/instructions.js +69 -0
  53. package/dist/agents/mastracode-gateway.d.ts +85 -0
  54. package/dist/agents/mastracode-gateway.js +500 -0
  55. package/dist/agents/memory.d.ts +36 -0
  56. package/dist/agents/memory.js +248 -0
  57. package/dist/agents/model.d.ts +158 -0
  58. package/dist/agents/model.js +382 -0
  59. package/dist/agents/modes/build.d.ts +12 -0
  60. package/dist/agents/modes/build.js +33 -0
  61. package/dist/agents/modes/explore.d.ts +10 -0
  62. package/dist/agents/modes/explore.js +25 -0
  63. package/dist/agents/modes/plan.d.ts +8 -0
  64. package/dist/agents/modes/plan.js +43 -0
  65. package/dist/agents/prompts/agent-instructions.d.ts +122 -0
  66. package/dist/agents/prompts/agent-instructions.js +617 -0
  67. package/dist/agents/prompts/build.d.ts +12 -0
  68. package/dist/agents/prompts/build.js +73 -0
  69. package/dist/agents/prompts/fast.d.ts +5 -0
  70. package/dist/agents/prompts/fast.js +23 -0
  71. package/dist/agents/prompts/index.d.ts +61 -0
  72. package/dist/agents/prompts/index.js +141 -0
  73. package/dist/agents/prompts/model.d.ts +5 -0
  74. package/dist/agents/prompts/model.js +20 -0
  75. package/dist/agents/prompts/plan.d.ts +11 -0
  76. package/dist/agents/prompts/plan.js +132 -0
  77. package/dist/agents/prompts/tool-guidance.d.ts +18 -0
  78. package/dist/agents/prompts/tool-guidance.js +158 -0
  79. package/dist/agents/sandbox-filesystem.d.ts +232 -0
  80. package/dist/agents/sandbox-filesystem.js +851 -0
  81. package/dist/agents/subagents/execute.d.ts +3 -0
  82. package/dist/agents/subagents/execute.js +24 -0
  83. package/dist/agents/subagents/explore.d.ts +3 -0
  84. package/dist/agents/subagents/explore.js +15 -0
  85. package/dist/agents/subagents/index.d.ts +6 -0
  86. package/dist/agents/subagents/index.js +15 -0
  87. package/dist/agents/subagents/plan.d.ts +3 -0
  88. package/dist/agents/subagents/plan.js +15 -0
  89. package/dist/agents/thread-caveman-state.d.ts +17 -0
  90. package/dist/agents/thread-caveman-state.js +104 -0
  91. package/dist/agents/tool-availability.d.ts +17 -0
  92. package/dist/agents/tool-availability.js +134 -0
  93. package/dist/agents/tools.d.ts +37 -0
  94. package/dist/agents/tools.js +154 -0
  95. package/dist/agents/workflow-builder-agent.d.ts +2 -0
  96. package/dist/agents/workflow-builder-agent.js +79 -0
  97. package/dist/agents/workspace.d.ts +35 -0
  98. package/dist/agents/workspace.js +207 -0
  99. package/dist/analytics.d.ts +18 -0
  100. package/dist/analytics.js +159 -0
  101. package/dist/auth/account-rotation-processor.d.ts +210 -0
  102. package/dist/auth/account-rotation-processor.js +662 -0
  103. package/dist/auth/account-routing-context.d.ts +17 -0
  104. package/dist/auth/account-routing-context.js +38 -0
  105. package/dist/auth/authorization-input.d.ts +16 -0
  106. package/dist/auth/authorization-input.js +39 -0
  107. package/dist/auth/device-code.d.ts +93 -0
  108. package/dist/auth/device-code.js +126 -0
  109. package/dist/auth/index.d.ts +13 -0
  110. package/dist/auth/index.js +9 -0
  111. package/dist/auth/pkce.d.ts +13 -0
  112. package/dist/auth/pkce.js +29 -0
  113. package/dist/auth/provider-auth-error.d.ts +24 -0
  114. package/dist/auth/provider-auth-error.js +44 -0
  115. package/dist/auth/providers/anthropic.d.ts +40 -0
  116. package/dist/auth/providers/anthropic.js +117 -0
  117. package/dist/auth/providers/github-copilot.d.ts +154 -0
  118. package/dist/auth/providers/github-copilot.js +359 -0
  119. package/dist/auth/providers/kimi-coding.d.ts +38 -0
  120. package/dist/auth/providers/kimi-coding.js +225 -0
  121. package/dist/auth/providers/openai-codex.d.ts +141 -0
  122. package/dist/auth/providers/openai-codex.js +531 -0
  123. package/dist/auth/providers/xai.d.ts +64 -0
  124. package/dist/auth/providers/xai.js +223 -0
  125. package/dist/auth/storage.d.ts +222 -0
  126. package/dist/auth/storage.js +805 -0
  127. package/dist/auth/types.d.ts +164 -0
  128. package/dist/auth/types.js +1 -0
  129. package/dist/clipboard/index.d.ts +26 -0
  130. package/dist/clipboard/index.js +224 -0
  131. package/dist/constants.d.ts +29 -0
  132. package/dist/constants.js +34 -0
  133. package/dist/error-classification.d.ts +10 -0
  134. package/dist/error-classification.js +19 -0
  135. package/dist/evals/context-builder.d.ts +41 -0
  136. package/dist/evals/context-builder.js +156 -0
  137. package/dist/evals/index.d.ts +4 -0
  138. package/dist/evals/index.js +5 -0
  139. package/dist/evals/scorers/classify-command.d.ts +30 -0
  140. package/dist/evals/scorers/classify-command.js +61 -0
  141. package/dist/evals/scorers/efficiency.d.ts +44 -0
  142. package/dist/evals/scorers/efficiency.js +256 -0
  143. package/dist/evals/scorers/extract-tools.d.ts +25 -0
  144. package/dist/evals/scorers/extract-tools.js +57 -0
  145. package/dist/evals/scorers/index.d.ts +3 -0
  146. package/dist/evals/scorers/index.js +3 -0
  147. package/dist/evals/scorers/outcome.d.ts +49 -0
  148. package/dist/evals/scorers/outcome.js +360 -0
  149. package/dist/experimental-agent.d.ts +19 -0
  150. package/dist/experimental-agent.js +45 -0
  151. package/dist/factory/client.d.ts +44 -0
  152. package/dist/factory/client.js +110 -0
  153. package/dist/factory/remote-controller.d.ts +34 -0
  154. package/dist/factory/remote-controller.js +40 -0
  155. package/dist/factory/remote-session.d.ts +210 -0
  156. package/dist/factory/remote-session.js +415 -0
  157. package/dist/goal-manager.d.ts +114 -0
  158. package/dist/goal-manager.js +351 -0
  159. package/dist/goal-signal.d.ts +14 -0
  160. package/dist/goal-signal.js +14 -0
  161. package/dist/headless/cli.d.ts +55 -0
  162. package/dist/headless/cli.js +261 -0
  163. package/dist/headless/flags.d.ts +33 -0
  164. package/dist/headless/flags.js +207 -0
  165. package/dist/headless/format.d.ts +41 -0
  166. package/dist/headless/format.js +94 -0
  167. package/dist/headless/index.d.ts +25 -0
  168. package/dist/headless/index.js +6 -0
  169. package/dist/headless/policy.d.ts +17 -0
  170. package/dist/headless/policy.js +39 -0
  171. package/dist/headless/run-mc.d.ts +7 -0
  172. package/dist/headless/run-mc.js +438 -0
  173. package/dist/headless/types.d.ts +175 -0
  174. package/dist/headless/types.js +16 -0
  175. package/dist/hooks/config.d.ts +11 -0
  176. package/dist/hooks/config.js +77 -0
  177. package/dist/hooks/executor.d.ts +13 -0
  178. package/dist/hooks/executor.js +128 -0
  179. package/dist/hooks/index.d.ts +6 -0
  180. package/dist/hooks/index.js +5 -0
  181. package/dist/hooks/manager.d.ts +75 -0
  182. package/dist/hooks/manager.js +289 -0
  183. package/dist/hooks/types.d.ts +180 -0
  184. package/dist/hooks/types.js +5 -0
  185. package/dist/index.d.ts +537 -0
  186. package/dist/index.js +1399 -0
  187. package/dist/ipc/ipc-reporter.d.ts +14 -0
  188. package/dist/ipc/ipc-reporter.js +18 -0
  189. package/dist/knowledge-inspector.d.ts +139 -0
  190. package/dist/knowledge-inspector.js +533 -0
  191. package/dist/knowledge-scope-id.d.ts +7 -0
  192. package/dist/knowledge-scope-id.js +10 -0
  193. package/dist/knowledge-scope.d.ts +41 -0
  194. package/dist/knowledge-scope.js +85 -0
  195. package/dist/lsp/client.d.ts +56 -0
  196. package/dist/lsp/client.js +248 -0
  197. package/dist/lsp/index.d.ts +4 -0
  198. package/dist/lsp/index.js +4 -0
  199. package/dist/lsp/language.d.ts +9 -0
  200. package/dist/lsp/language.js +41 -0
  201. package/dist/lsp/manager.d.ts +34 -0
  202. package/dist/lsp/manager.js +79 -0
  203. package/dist/lsp/server.d.ts +27 -0
  204. package/dist/lsp/server.js +158 -0
  205. package/dist/lsp/workspace.d.ts +9 -0
  206. package/dist/lsp/workspace.js +52 -0
  207. package/dist/mcp/config.d.ts +77 -0
  208. package/dist/mcp/config.js +313 -0
  209. package/dist/mcp/index.d.ts +6 -0
  210. package/dist/mcp/index.js +3 -0
  211. package/dist/mcp/manager.d.ts +104 -0
  212. package/dist/mcp/manager.js +693 -0
  213. package/dist/mcp/state.d.ts +35 -0
  214. package/dist/mcp/state.js +94 -0
  215. package/dist/mcp/types.d.ts +139 -0
  216. package/dist/mcp/types.js +1 -0
  217. package/dist/onboarding/custom-packs.d.ts +7 -0
  218. package/dist/onboarding/custom-packs.js +17 -0
  219. package/dist/onboarding/custom-providers.d.ts +4 -0
  220. package/dist/onboarding/custom-providers.js +27 -0
  221. package/dist/onboarding/index.d.ts +5 -0
  222. package/dist/onboarding/index.js +3 -0
  223. package/dist/onboarding/om-settings.d.ts +47 -0
  224. package/dist/onboarding/om-settings.js +80 -0
  225. package/dist/onboarding/pack-activation.d.ts +43 -0
  226. package/dist/onboarding/pack-activation.js +105 -0
  227. package/dist/onboarding/packs.d.ts +106 -0
  228. package/dist/onboarding/packs.js +283 -0
  229. package/dist/onboarding/settings.d.ts +563 -0
  230. package/dist/onboarding/settings.js +1110 -0
  231. package/dist/permissions.d.ts +55 -0
  232. package/dist/permissions.js +139 -0
  233. package/dist/platform/index.d.ts +74 -0
  234. package/dist/platform/index.js +199 -0
  235. package/dist/plugin.d.ts +156 -0
  236. package/dist/plugin.js +27 -0
  237. package/dist/plugins/dependencies.d.ts +9 -0
  238. package/dist/plugins/dependencies.js +84 -0
  239. package/dist/plugins/install.d.ts +21 -0
  240. package/dist/plugins/install.js +187 -0
  241. package/dist/plugins/loader.d.ts +25 -0
  242. package/dist/plugins/loader.js +264 -0
  243. package/dist/plugins/manager.d.ts +115 -0
  244. package/dist/plugins/manager.js +507 -0
  245. package/dist/plugins/manifest.d.ts +14 -0
  246. package/dist/plugins/manifest.js +47 -0
  247. package/dist/plugins/package-link.d.ts +3 -0
  248. package/dist/plugins/package-link.js +58 -0
  249. package/dist/plugins/paths.d.ts +10 -0
  250. package/dist/plugins/paths.js +22 -0
  251. package/dist/plugins/registry.d.ts +8 -0
  252. package/dist/plugins/registry.js +109 -0
  253. package/dist/plugins/scaffold.d.ts +10 -0
  254. package/dist/plugins/scaffold.js +115 -0
  255. package/dist/plugins/signal-lane.d.ts +59 -0
  256. package/dist/plugins/signal-lane.js +163 -0
  257. package/dist/plugins/types.d.ts +95 -0
  258. package/dist/plugins/types.js +1 -0
  259. package/dist/process-memory-diagnostics.d.ts +136 -0
  260. package/dist/process-memory-diagnostics.js +497 -0
  261. package/dist/processors/plan-rejection-abort.d.ts +16 -0
  262. package/dist/processors/plan-rejection-abort.js +62 -0
  263. package/dist/providers/amazon-bedrock-gateway.d.ts +47 -0
  264. package/dist/providers/amazon-bedrock-gateway.js +142 -0
  265. package/dist/providers/amazon-bedrock.d.ts +28 -0
  266. package/dist/providers/amazon-bedrock.js +99 -0
  267. package/dist/providers/anthropic-prompt-cache.d.ts +19 -0
  268. package/dist/providers/anthropic-prompt-cache.js +8 -0
  269. package/dist/providers/anthropic-thinking.d.ts +5 -0
  270. package/dist/providers/anthropic-thinking.js +22 -0
  271. package/dist/providers/claude-max.d.ts +67 -0
  272. package/dist/providers/claude-max.js +232 -0
  273. package/dist/providers/github-copilot-gateway.d.ts +35 -0
  274. package/dist/providers/github-copilot-gateway.js +58 -0
  275. package/dist/providers/github-copilot.d.ts +60 -0
  276. package/dist/providers/github-copilot.js +320 -0
  277. package/dist/providers/google-thinking.d.ts +31 -0
  278. package/dist/providers/google-thinking.js +64 -0
  279. package/dist/providers/google-vertex-gateway.d.ts +23 -0
  280. package/dist/providers/google-vertex-gateway.js +49 -0
  281. package/dist/providers/google-vertex.d.ts +6 -0
  282. package/dist/providers/google-vertex.js +51 -0
  283. package/dist/providers/kimi-coding.d.ts +14 -0
  284. package/dist/providers/kimi-coding.js +80 -0
  285. package/dist/providers/model-ids.d.ts +53 -0
  286. package/dist/providers/model-ids.js +132 -0
  287. package/dist/providers/openai-codex.d.ts +114 -0
  288. package/dist/providers/openai-codex.js +427 -0
  289. package/dist/providers/provider-thinking.d.ts +23 -0
  290. package/dist/providers/provider-thinking.js +61 -0
  291. package/dist/providers/thinking-request.d.ts +14 -0
  292. package/dist/providers/thinking-request.js +87 -0
  293. package/dist/providers/xai.d.ts +33 -0
  294. package/dist/providers/xai.js +72 -0
  295. package/dist/schedules/index.d.ts +10 -0
  296. package/dist/schedules/index.js +6 -0
  297. package/dist/schedules/interval.d.ts +49 -0
  298. package/dist/schedules/interval.js +212 -0
  299. package/dist/schedules/prompt.d.ts +36 -0
  300. package/dist/schedules/prompt.js +36 -0
  301. package/dist/schedules/run-script.d.ts +8 -0
  302. package/dist/schedules/run-script.js +80 -0
  303. package/dist/schedules/scheduler.d.ts +101 -0
  304. package/dist/schedules/scheduler.js +167 -0
  305. package/dist/schedules/tools.d.ts +57 -0
  306. package/dist/schedules/tools.js +217 -0
  307. package/dist/schema.d.ts +499 -0
  308. package/dist/schema.js +131 -0
  309. package/dist/theme-palette.d.ts +17 -0
  310. package/dist/theme-palette.js +18 -0
  311. package/dist/thinking-catalog.d.ts +4 -0
  312. package/dist/thinking-catalog.js +13 -0
  313. package/dist/thinking.d.ts +37 -0
  314. package/dist/thinking.js +134 -0
  315. package/dist/tool-names.d.ts +77 -0
  316. package/dist/tool-names.js +53 -0
  317. package/dist/tools/index.d.ts +6 -0
  318. package/dist/tools/index.js +3 -0
  319. package/dist/tools/request-sandbox-access.d.ts +6 -0
  320. package/dist/tools/request-sandbox-access.js +80 -0
  321. package/dist/tools/utils.d.ts +20 -0
  322. package/dist/tools/utils.js +31 -0
  323. package/dist/tools/web-search.d.ts +116 -0
  324. package/dist/tools/web-search.js +158 -0
  325. package/dist/tools/workflows/create-workflow.d.ts +7 -0
  326. package/dist/tools/workflows/create-workflow.js +82 -0
  327. package/dist/tools/workflows/delete-workflow.d.ts +7 -0
  328. package/dist/tools/workflows/delete-workflow.js +18 -0
  329. package/dist/tools/workflows/ephemeral-memory.d.ts +28 -0
  330. package/dist/tools/workflows/ephemeral-memory.js +41 -0
  331. package/dist/tools/workflows/extract-json-schema.d.ts +12 -0
  332. package/dist/tools/workflows/extract-json-schema.js +19 -0
  333. package/dist/tools/workflows/get-workflow.d.ts +11 -0
  334. package/dist/tools/workflows/get-workflow.js +31 -0
  335. package/dist/tools/workflows/list-available-agents.d.ts +8 -0
  336. package/dist/tools/workflows/list-available-agents.js +29 -0
  337. package/dist/tools/workflows/list-available-classifiers.d.ts +19 -0
  338. package/dist/tools/workflows/list-available-classifiers.js +53 -0
  339. package/dist/tools/workflows/list-available-tools.d.ts +9 -0
  340. package/dist/tools/workflows/list-available-tools.js +37 -0
  341. package/dist/tools/workflows/list-available-workflows.d.ts +9 -0
  342. package/dist/tools/workflows/list-available-workflows.js +29 -0
  343. package/dist/tools/workflows/list-workflows.d.ts +9 -0
  344. package/dist/tools/workflows/list-workflows.js +30 -0
  345. package/dist/tools/workflows/run-workflow.d.ts +9 -0
  346. package/dist/tools/workflows/run-workflow.js +49 -0
  347. package/dist/tools/workflows/save-workflow.d.ts +1125 -0
  348. package/dist/tools/workflows/save-workflow.js +25 -0
  349. package/dist/tools/workflows/tool-ids.d.ts +16 -0
  350. package/dist/tools/workflows/tool-ids.js +17 -0
  351. package/dist/utils/binaries.d.ts +7 -0
  352. package/dist/utils/binaries.js +97 -0
  353. package/dist/utils/debug-log.d.ts +12 -0
  354. package/dist/utils/debug-log.js +56 -0
  355. package/dist/utils/discarding-scores-storage.d.ts +33 -0
  356. package/dist/utils/discarding-scores-storage.js +51 -0
  357. package/dist/utils/errors.d.ts +36 -0
  358. package/dist/utils/errors.js +215 -0
  359. package/dist/utils/gateway-sync.d.ts +26 -0
  360. package/dist/utils/gateway-sync.js +58 -0
  361. package/dist/utils/local-observability.d.ts +19 -0
  362. package/dist/utils/local-observability.js +54 -0
  363. package/dist/utils/maintenance-lock.d.ts +42 -0
  364. package/dist/utils/maintenance-lock.js +196 -0
  365. package/dist/utils/notification-dispatch.d.ts +74 -0
  366. package/dist/utils/notification-dispatch.js +128 -0
  367. package/dist/utils/open-url.d.ts +10 -0
  368. package/dist/utils/open-url.js +27 -0
  369. package/dist/utils/path-security.d.ts +2 -0
  370. package/dist/utils/path-security.js +7 -0
  371. package/dist/utils/plan-diff.d.ts +25 -0
  372. package/dist/utils/plan-diff.js +59 -0
  373. package/dist/utils/plans.d.ts +61 -0
  374. package/dist/utils/plans.js +120 -0
  375. package/dist/utils/project.d.ts +160 -0
  376. package/dist/utils/project.js +361 -0
  377. package/dist/utils/prune-cli.d.ts +24 -0
  378. package/dist/utils/prune-cli.js +124 -0
  379. package/dist/utils/signals-pubsub.d.ts +103 -0
  380. package/dist/utils/signals-pubsub.js +409 -0
  381. package/dist/utils/slash-command-loader.d.ts +52 -0
  382. package/dist/utils/slash-command-loader.js +139 -0
  383. package/dist/utils/slash-command-processor.d.ts +14 -0
  384. package/dist/utils/slash-command-processor.js +106 -0
  385. package/dist/utils/stdin-pipe.d.ts +33 -0
  386. package/dist/utils/stdin-pipe.js +93 -0
  387. package/dist/utils/storage-factory.d.ts +50 -0
  388. package/dist/utils/storage-factory.js +118 -0
  389. package/dist/utils/storage-maintenance.d.ts +121 -0
  390. package/dist/utils/storage-maintenance.js +352 -0
  391. package/dist/utils/thread-lock.d.ts +26 -0
  392. package/dist/utils/thread-lock.js +109 -0
  393. package/dist/utils/token-estimator.d.ts +3 -0
  394. package/dist/utils/token-estimator.js +19 -0
  395. package/dist/utils/update-check.d.ts +151 -0
  396. package/dist/utils/update-check.js +430 -0
  397. package/dist/utils/wake-session.d.ts +44 -0
  398. package/dist/utils/wake-session.js +83 -0
  399. package/dist/voice/stt-registry.d.ts +67 -0
  400. package/dist/voice/stt-registry.js +144 -0
  401. package/dist/voice/transcribe.d.ts +10 -0
  402. package/dist/voice/transcribe.js +75 -0
  403. package/dist/workflows/register-primitives.d.ts +52 -0
  404. package/dist/workflows/register-primitives.js +40 -0
  405. package/dist/workflows/service.d.ts +64 -0
  406. package/dist/workflows/service.js +50 -0
  407. package/package.json +117 -0
@@ -0,0 +1,164 @@
1
+ /**
2
+ * OAuth types for authentication providers
3
+ */
4
+ export interface OAuthCredentials {
5
+ refresh: string;
6
+ access: string;
7
+ expires: number;
8
+ [key: string]: unknown;
9
+ }
10
+ export type OAuthProviderId = string;
11
+ export interface OAuthAuthInfo {
12
+ url: string;
13
+ instructions?: string;
14
+ userCode?: string;
15
+ }
16
+ export interface OAuthPrompt {
17
+ message: string;
18
+ placeholder?: string;
19
+ allowEmpty?: boolean;
20
+ }
21
+ /**
22
+ * A selectable authentication mode for an OAuth provider.
23
+ * Providers that support multiple flows (e.g. browser callback vs. device code)
24
+ * advertise them via `OAuthProviderInterface.authModes`. The TUI shows a
25
+ * sub-selector when more than one mode is available so users don't need to
26
+ * discover the flow through environment variables.
27
+ */
28
+ export interface AuthMode {
29
+ id: string;
30
+ name: string;
31
+ description?: string;
32
+ }
33
+ export interface OAuthLoginCallbacks {
34
+ onAuth: (info: OAuthAuthInfo) => void;
35
+ onPrompt: (prompt: OAuthPrompt) => Promise<string>;
36
+ onProgress?: (message: string) => void;
37
+ onManualCodeInput?: () => Promise<string>;
38
+ signal?: AbortSignal;
39
+ /** Selected authentication mode id (matches one of `OAuthProviderInterface.authModes`). */
40
+ authMode?: string;
41
+ }
42
+ export interface OAuthProviderInterface {
43
+ readonly id: OAuthProviderId;
44
+ readonly name: string;
45
+ /** Whether this provider uses a local callback server (vs manual code paste) */
46
+ readonly usesCallbackServer?: boolean;
47
+ /**
48
+ * Optional list of selectable auth flows. When set with two or more entries,
49
+ * the TUI prompts the user to pick a mode before starting the login flow and
50
+ * forwards the choice via `OAuthLoginCallbacks.authMode`.
51
+ */
52
+ readonly authModes?: ReadonlyArray<AuthMode>;
53
+ /** Run the login flow, return credentials to persist */
54
+ login(callbacks: OAuthLoginCallbacks): Promise<OAuthCredentials>;
55
+ /** Refresh expired credentials, return updated credentials to persist */
56
+ refreshToken(credentials: OAuthCredentials): Promise<OAuthCredentials>;
57
+ /** Convert credentials to API key string for the provider */
58
+ getApiKey(credentials: OAuthCredentials): string;
59
+ /**
60
+ * Optional human-readable label for an account (e.g. the user's email),
61
+ * captured when the account is registered in the multi-account registry.
62
+ */
63
+ getAccountLabel?(credentials: OAuthCredentials): Promise<string | undefined>;
64
+ /**
65
+ * Optional stable identity for the *subscription* behind a set of
66
+ * credentials (e.g. a provider account id or an email), read from the
67
+ * credentials themselves — synchronous and local, so it can be used while
68
+ * deciding whether an added account is one we already hold. Must be the same
69
+ * value across refreshes and re-authorizations of one subscription, and
70
+ * different for two subscriptions of the same provider. Providers whose
71
+ * credentials carry no such identifier omit this; a re-authorization of an
72
+ * existing subscription is then indistinguishable from a new account.
73
+ */
74
+ getAccountIdentity?(credentials: OAuthCredentials): string | undefined;
75
+ }
76
+ export type ApiKeyCredential = {
77
+ type: 'api_key';
78
+ key: string;
79
+ };
80
+ export type OAuthCredential = {
81
+ type: 'oauth';
82
+ } & OAuthCredentials;
83
+ export type OAuthCredentialSnapshot = OAuthCredential & {
84
+ /** Non-secret registry identity for credential-scoped in-process caches. */
85
+ accountInstanceId?: string;
86
+ };
87
+ export type AuthCredential = ApiKeyCredential | OAuthCredential;
88
+ /**
89
+ * A registered OAuth account in a provider's multi-account registry.
90
+ *
91
+ * Registry entries live in auth.json under `accounts:<id>` keys (where `id` is
92
+ * `${providerId}:${sha256(refresh).slice(0,8)}`), separate from the provider's
93
+ * legacy slot. Exactly one entry per provider is `active`; its tokens are
94
+ * single-homed in the legacy slot, with this record mirroring them so a later
95
+ * activation moves fresh tokens back in.
96
+ */
97
+ export interface OAuthAccountRecord extends OAuthCredentials {
98
+ type: 'oauth-account';
99
+ id: string;
100
+ label: string;
101
+ /** ISO timestamp of when the account was added. */
102
+ addedAt: string;
103
+ active: boolean;
104
+ /**
105
+ * Stable provider-supplied identity for the subscription behind this account
106
+ * (an account id, an email) when the provider exposes one. Used to recognize
107
+ * that an added account is one we already hold; absent for providers whose
108
+ * credentials carry no such identifier.
109
+ */
110
+ identity?: string;
111
+ }
112
+ export type AuthStorageData = Record<string, AuthCredential | OAuthAccountRecord>;
113
+ /**
114
+ * The read surface model resolution and the OAuth fetch wrappers need from a
115
+ * credential source. `AuthStorage` satisfies it structurally (file-backed,
116
+ * server-global); deployed web injects a per-tenant implementation backed by
117
+ * the app database so each caller's own credentials are used.
118
+ */
119
+ export interface CredentialStore {
120
+ /** Whether model resolution may fall back to process environment credentials. */
121
+ readonly allowEnvironmentFallback?: boolean;
122
+ /**
123
+ * Whether `provider` may authenticate with credentials the server process
124
+ * supplies (an operator opt-in), even when `allowEnvironmentFallback` is
125
+ * false. Used by gateways whose auth is process-scoped by design, such as
126
+ * Amazon Bedrock's AWS credential chain.
127
+ */
128
+ allowsDeploymentCredentials?(provider: string): boolean;
129
+ /** Refresh any cached view (no-op for sources that are always fresh). */
130
+ reload(): void;
131
+ /** Credential in the provider's main slot (`anthropic`, `openai-codex`, …). */
132
+ get(provider: string): AuthCredential | undefined;
133
+ /** Dedicated stored API key for a provider, if any. */
134
+ getStoredApiKey(provider: string): string | undefined;
135
+ /**
136
+ * Ready-to-use key/token for a provider, refreshing expired OAuth
137
+ * credentials first. Implementations own refresh serialization.
138
+ */
139
+ getApiKey(provider: string, accountInstanceId?: string): Promise<string | undefined>;
140
+ /**
141
+ * Ready-to-use OAuth credential snapshot. Optional because deployed stores
142
+ * have no local account registry. Local wrappers use this to keep the access
143
+ * token and account-specific metadata from the same account.
144
+ */
145
+ getOAuthCredential?(provider: string, accountInstanceId?: string): Promise<OAuthCredentialSnapshot | undefined>;
146
+ /**
147
+ * Registered OAuth accounts for a provider, in insertion order. Optional so
148
+ * deployed per-tenant stores need no change.
149
+ */
150
+ listAccounts?(providerId: string): OAuthAccountRecord[];
151
+ /** The provider's active registry entry, if a registry exists. */
152
+ getActiveAccount?(providerId: string): OAuthAccountRecord | undefined;
153
+ /**
154
+ * Activate an account: rotate to the next instance (insertion order,
155
+ * wrapping once), or to `instanceId` when given. Moves the active tokens
156
+ * between the legacy slot and the registry entries. Returns the newly
157
+ * active record, or undefined when there is no other instance to rotate to
158
+ * (or `instanceId` is unknown).
159
+ */
160
+ activateAccount?(providerId: string, instanceId?: string): OAuthAccountRecord | undefined;
161
+ /** Remove one account from the registry (activating the next if it was active). */
162
+ removeAccount?(providerId: string, instanceId: string): void;
163
+ }
164
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Platform-specific clipboard image extraction.
3
+ *
4
+ * Checks the system clipboard for image data and returns it as base64.
5
+ * Uses synchronous execution (execSync) since this only runs on paste events.
6
+ */
7
+ export interface ClipboardImage {
8
+ data: string;
9
+ mimeType: string;
10
+ }
11
+ /**
12
+ * Read plain text from the system clipboard.
13
+ * Returns null if clipboard is empty or reading fails.
14
+ */
15
+ export declare function getClipboardText(): string | null;
16
+ /**
17
+ * Write plain text to the system clipboard.
18
+ * Returns true on success, false on failure.
19
+ */
20
+ export declare function setClipboardText(text: string): boolean;
21
+ /**
22
+ * Check the system clipboard for image data and return it as base64.
23
+ * Returns null if no image data is found or extraction fails.
24
+ */
25
+ export declare function getClipboardImage(): ClipboardImage | null;
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,224 @@
1
+ import { join } from "path";
2
+ import { readFileSync, unlinkSync } from "fs";
3
+ import { execSync } from "child_process";
4
+ import { tmpdir } from "os";
5
+ // src/clipboard/index.ts
6
+ /**
7
+ * Platform-specific clipboard image extraction.
8
+ *
9
+ * Checks the system clipboard for image data and returns it as base64.
10
+ * Uses synchronous execution (execSync) since this only runs on paste events.
11
+ */
12
+ /**
13
+ * Read plain text from the system clipboard.
14
+ * Returns null if clipboard is empty or reading fails.
15
+ */
16
+ function getClipboardText() {
17
+ try {
18
+ if (process.platform === "darwin") {
19
+ const text = execSync("pbpaste", {
20
+ encoding: "utf-8",
21
+ timeout: 3e3,
22
+ stdio: [
23
+ "pipe",
24
+ "pipe",
25
+ "pipe"
26
+ ]
27
+ });
28
+ return text.length > 0 ? text : null;
29
+ }
30
+ if (process.platform === "linux") try {
31
+ const text = execSync("xclip -selection clipboard -o", {
32
+ encoding: "utf-8",
33
+ timeout: 3e3,
34
+ stdio: [
35
+ "pipe",
36
+ "pipe",
37
+ "pipe"
38
+ ]
39
+ });
40
+ return text.length > 0 ? text : null;
41
+ } catch {
42
+ const text = execSync("wl-paste", {
43
+ encoding: "utf-8",
44
+ timeout: 3e3,
45
+ stdio: [
46
+ "pipe",
47
+ "pipe",
48
+ "pipe"
49
+ ]
50
+ });
51
+ return text.length > 0 ? text : null;
52
+ }
53
+ return null;
54
+ } catch {
55
+ return null;
56
+ }
57
+ }
58
+ /**
59
+ * Write plain text to the system clipboard.
60
+ * Returns true on success, false on failure.
61
+ */
62
+ function setClipboardText(text) {
63
+ try {
64
+ if (process.platform === "darwin") {
65
+ execSync("pbcopy", {
66
+ input: text,
67
+ timeout: 3e3,
68
+ stdio: [
69
+ "pipe",
70
+ "pipe",
71
+ "pipe"
72
+ ]
73
+ });
74
+ return true;
75
+ }
76
+ if (process.platform === "linux") try {
77
+ execSync("xclip -selection clipboard", {
78
+ input: text,
79
+ timeout: 3e3,
80
+ stdio: [
81
+ "pipe",
82
+ "pipe",
83
+ "pipe"
84
+ ]
85
+ });
86
+ return true;
87
+ } catch {
88
+ execSync("wl-copy", {
89
+ input: text,
90
+ timeout: 3e3,
91
+ stdio: [
92
+ "pipe",
93
+ "pipe",
94
+ "pipe"
95
+ ]
96
+ });
97
+ return true;
98
+ }
99
+ return false;
100
+ } catch {
101
+ return false;
102
+ }
103
+ }
104
+ /**
105
+ * Check the system clipboard for image data and return it as base64.
106
+ * Returns null if no image data is found or extraction fails.
107
+ */
108
+ function getClipboardImage() {
109
+ try {
110
+ if (process.platform === "darwin") return getMacClipboardImage();
111
+ if (process.platform === "linux") return getLinuxClipboardImage();
112
+ return null;
113
+ } catch {
114
+ return null;
115
+ }
116
+ }
117
+ function getMacClipboardImage() {
118
+ return tryReadMacClipboardImage({
119
+ coercion: "«class PNGf»",
120
+ extension: "png",
121
+ mimeType: "image/png"
122
+ }) ?? tryReadMacClipboardImage({
123
+ coercion: "TIFF picture",
124
+ extension: "tiff",
125
+ mimeType: "image/tiff"
126
+ }) ?? tryReadMacClipboardImage({
127
+ coercion: "«class TIFF»",
128
+ extension: "tiff",
129
+ mimeType: "image/tiff"
130
+ });
131
+ }
132
+ function tryReadMacClipboardImage({ coercion, extension, mimeType }) {
133
+ const tmpFile = join(tmpdir(), `mastra-clipboard-${Date.now()}.${extension}`);
134
+ try {
135
+ const script = `
136
+ set theImage to the clipboard as ${coercion}
137
+ set theFile to open for access POSIX file "${tmpFile}" with write permission
138
+ write theImage to theFile
139
+ close access theFile
140
+ `;
141
+ execSync(`osascript -e '${script.replace(/'/g, "'\\''")}'`, {
142
+ timeout: 5e3,
143
+ stdio: [
144
+ "pipe",
145
+ "pipe",
146
+ "pipe"
147
+ ]
148
+ });
149
+ const buffer = readFileSync(tmpFile);
150
+ if (!Buffer.isBuffer(buffer) || buffer.length === 0) return null;
151
+ return {
152
+ data: buffer.toString("base64"),
153
+ mimeType
154
+ };
155
+ } catch {
156
+ return null;
157
+ } finally {
158
+ try {
159
+ unlinkSync(tmpFile);
160
+ } catch {}
161
+ }
162
+ }
163
+ function getLinuxClipboardImage() {
164
+ return getLinuxClipboardImageXclip() ?? getLinuxClipboardImageWlPaste();
165
+ }
166
+ function getLinuxClipboardImageXclip() {
167
+ try {
168
+ if (!execSync("xclip -selection clipboard -target TARGETS -o", {
169
+ encoding: "utf-8",
170
+ timeout: 3e3,
171
+ stdio: [
172
+ "pipe",
173
+ "pipe",
174
+ "pipe"
175
+ ]
176
+ }).includes("image/png")) return null;
177
+ const buffer = execSync("xclip -selection clipboard -target image/png -o", {
178
+ timeout: 5e3,
179
+ stdio: [
180
+ "pipe",
181
+ "pipe",
182
+ "pipe"
183
+ ],
184
+ maxBuffer: 52428800
185
+ });
186
+ if (!Buffer.isBuffer(buffer) || buffer.length === 0) return null;
187
+ return {
188
+ data: buffer.toString("base64"),
189
+ mimeType: "image/png"
190
+ };
191
+ } catch {
192
+ return null;
193
+ }
194
+ }
195
+ function getLinuxClipboardImageWlPaste() {
196
+ try {
197
+ if (!execSync("wl-paste --list-types", {
198
+ encoding: "utf-8",
199
+ timeout: 3e3,
200
+ stdio: [
201
+ "pipe",
202
+ "pipe",
203
+ "pipe"
204
+ ]
205
+ }).includes("image/png")) return null;
206
+ const buffer = execSync("wl-paste --type image/png", {
207
+ timeout: 5e3,
208
+ stdio: [
209
+ "pipe",
210
+ "pipe",
211
+ "pipe"
212
+ ],
213
+ maxBuffer: 52428800
214
+ });
215
+ if (!Buffer.isBuffer(buffer) || buffer.length === 0) return null;
216
+ return {
217
+ data: buffer.toString("base64"),
218
+ mimeType: "image/png"
219
+ };
220
+ } catch {
221
+ return null;
222
+ }
223
+ }
224
+ export { getClipboardImage, getClipboardText, setClipboardText };
@@ -0,0 +1,29 @@
1
+ export declare const DEFAULT_CONFIG_DIR = ".mastracode";
2
+ /**
3
+ * Validate that a configDirName is a safe single directory name.
4
+ * Rejects absolute paths, path separators, and traversal components.
5
+ */
6
+ export declare function validateConfigDirName(configDirName: string): void;
7
+ export declare const MODEL_ROUTE_MAX_ENTRIES = 32;
8
+ export declare const MODEL_ROUTE_MAX_FIELD_LENGTH = 512;
9
+ export declare const DEFAULT_OM_MODEL_ID: string;
10
+ export declare const DEFAULT_OBS_THRESHOLD = 30000;
11
+ export declare const DEFAULT_REF_THRESHOLD = 40000;
12
+ /**
13
+ * Absolute token retention of the observation activation buffer
14
+ * (`observation.bufferActivation`) for non-resource OM. `@mastra/memory` requires
15
+ * the buffer to stay below `observation.messageTokens`, so a stored observation
16
+ * threshold at or below this value fails the next memory init.
17
+ */
18
+ export declare const OBSERVATION_ACTIVATION_TOKENS = 2000;
19
+ /**
20
+ * Smallest observation threshold the observer can actually run with: the
21
+ * activation buffer above must stay strictly below `observation.messageTokens`.
22
+ * A row saved before the settings route enforced that can hold a lower value, and
23
+ * `@mastra/memory` rejects the config at init — so reads take the value up to this
24
+ * floor rather than trusting the stored one.
25
+ */
26
+ export declare const MIN_OBSERVATION_THRESHOLD: number;
27
+ /** Id of the coding agent Mastra Code registers; Factory board phases run it. */
28
+ export declare const CODE_AGENT_ID = "code-agent";
29
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1,34 @@
1
+ import * as path$1 from "path";
2
+ // src/constants.ts
3
+ const DEFAULT_CONFIG_DIR = ".mastracode";
4
+ /**
5
+ * Validate that a configDirName is a safe single directory name.
6
+ * Rejects absolute paths, path separators, and traversal components.
7
+ */
8
+ function validateConfigDirName(configDirName) {
9
+ if (configDirName.trim().length === 0) throw new Error("configDirName must be a non-empty directory name");
10
+ if (path$1.isAbsolute(configDirName) || configDirName.includes("/") || configDirName.includes("\\") || configDirName === ".." || configDirName === ".") throw new Error(`configDirName must be a single directory name without path separators or traversal components, got: "${configDirName}"`);
11
+ }
12
+ const MODEL_ROUTE_MAX_ENTRIES = 32;
13
+ const MODEL_ROUTE_MAX_FIELD_LENGTH = 512;
14
+ const DEFAULT_OM_MODEL_ID = process.env.DEFAULT_OM_MODEL_ID ?? "google/gemini-3.5-flash";
15
+ const DEFAULT_OBS_THRESHOLD = 3e4;
16
+ const DEFAULT_REF_THRESHOLD = 4e4;
17
+ /**
18
+ * Absolute token retention of the observation activation buffer
19
+ * (`observation.bufferActivation`) for non-resource OM. `@mastra/memory` requires
20
+ * the buffer to stay below `observation.messageTokens`, so a stored observation
21
+ * threshold at or below this value fails the next memory init.
22
+ */
23
+ const OBSERVATION_ACTIVATION_TOKENS = 2e3;
24
+ /**
25
+ * Smallest observation threshold the observer can actually run with: the
26
+ * activation buffer above must stay strictly below `observation.messageTokens`.
27
+ * A row saved before the settings route enforced that can hold a lower value, and
28
+ * `@mastra/memory` rejects the config at init — so reads take the value up to this
29
+ * floor rather than trusting the stored one.
30
+ */
31
+ const MIN_OBSERVATION_THRESHOLD = 2001;
32
+ /** Id of the coding agent Mastra Code registers; Factory board phases run it. */
33
+ const CODE_AGENT_ID = "code-agent";
34
+ export { CODE_AGENT_ID, DEFAULT_CONFIG_DIR, DEFAULT_OBS_THRESHOLD, DEFAULT_OM_MODEL_ID, DEFAULT_REF_THRESHOLD, MIN_OBSERVATION_THRESHOLD, MODEL_ROUTE_MAX_ENTRIES, MODEL_ROUTE_MAX_FIELD_LENGTH, OBSERVATION_ACTIVATION_TOKENS, validateConfigDirName };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Checks whether an error is an ERR_STREAM_DESTROYED error, which is a
3
+ * non-fatal condition that occurs when code writes to a stream after it
4
+ * has been closed (e.g., client disconnect, cancelled LLM stream, LSP
5
+ * shutdown, killed subprocess).
6
+ *
7
+ * Walks the `.cause` chain up to a depth limit.
8
+ */
9
+ export declare function isStreamDestroyedError(err: unknown, depth?: number): boolean;
10
+ //# sourceMappingURL=error-classification.d.ts.map
@@ -0,0 +1,19 @@
1
+ // src/error-classification.ts
2
+ /**
3
+ * Checks whether an error is an ERR_STREAM_DESTROYED error, which is a
4
+ * non-fatal condition that occurs when code writes to a stream after it
5
+ * has been closed (e.g., client disconnect, cancelled LLM stream, LSP
6
+ * shutdown, killed subprocess).
7
+ *
8
+ * Walks the `.cause` chain up to a depth limit.
9
+ */
10
+ function isStreamDestroyedError(err, depth = 0) {
11
+ if (!err || depth > 5) return false;
12
+ const e = err;
13
+ if (e.code === "ERR_STREAM_DESTROYED") return true;
14
+ if (typeof e.message === "string" && e.message.includes("stream was destroyed")) return true;
15
+ if (e.cause && isStreamDestroyedError(e.cause, depth + 1)) return true;
16
+ if (Array.isArray(e.errors) && e.errors.some((inner) => isStreamDestroyedError(inner, depth + 1))) return true;
17
+ return false;
18
+ }
19
+ export { isStreamDestroyedError };
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Eval Context Builder for MastraCode
3
+ *
4
+ * Converts AgentController session data into scorer-compatible format.
5
+ * Supports both agent-type scorers (ScorerRunInputForAgent) and
6
+ * trajectory scorers (Trajectory).
7
+ */
8
+ import type { AgentController, Session } from '@mastra/core/agent-controller';
9
+ import type { ScorerRunInputForAgent, ScorerRunOutputForAgent, Trajectory } from '@mastra/core/evals';
10
+ export type MastraCodeEvalContext = {
11
+ /** Scorer-compatible agent input (messages, system prompt, etc.) */
12
+ agentInput: ScorerRunInputForAgent;
13
+ /** Scorer-compatible agent output (response messages) */
14
+ agentOutput: ScorerRunOutputForAgent;
15
+ /** Execution trajectory extracted from trace spans */
16
+ trajectory: Trajectory | undefined;
17
+ /** Request context with session metadata */
18
+ requestContext: Record<string, unknown>;
19
+ /** The thread ID this context was built from */
20
+ threadId: string;
21
+ /** The trace ID for observability linkage */
22
+ traceId: string | undefined;
23
+ };
24
+ export type BuildContextOptions = {
25
+ /** AgentController instance to extract data from */
26
+ controller: AgentController<any>;
27
+ /** Session whose state/model/thread is being evaluated */
28
+ session: Session<any>;
29
+ /** Thread ID to build context for (defaults to current thread) */
30
+ threadId?: string;
31
+ /** Limit messages to the last N turns (user+assistant pairs). Undefined = all messages */
32
+ lastNTurns?: number;
33
+ };
34
+ /**
35
+ * Build an evaluation context from a AgentController session.
36
+ *
37
+ * This extracts messages from storage, builds trajectory from trace spans,
38
+ * and packages everything into the format scorers expect.
39
+ */
40
+ export declare function buildEvalContext(options: BuildContextOptions): Promise<MastraCodeEvalContext>;
41
+ //# sourceMappingURL=context-builder.d.ts.map