@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,62 @@
1
+ // src/processors/plan-rejection-abort.ts
2
+ const PLAN_REJECTED_PREFIX = "Plan was not approved";
3
+ function resultText(result) {
4
+ if (typeof result === "string") return result;
5
+ if (result && typeof result === "object") {
6
+ const content = result.content;
7
+ if (typeof content === "string") return content;
8
+ }
9
+ return "";
10
+ }
11
+ function hasInlineFeedback(result) {
12
+ if (result && typeof result === "object") {
13
+ const submittedPlan = result.submittedPlan;
14
+ if (typeof submittedPlan?.feedback === "string" && submittedPlan.feedback.length > 0) return true;
15
+ }
16
+ return resultText(result).includes("\n\nUser feedback: ");
17
+ }
18
+ /**
19
+ * Returns true when the result is a `submit_plan` rejection that waits for the
20
+ * user's next message rather than carrying feedback to revise against.
21
+ */
22
+ function isRejectionWithoutFeedback(result) {
23
+ return resultText(result).startsWith(PLAN_REJECTED_PREFIX) && !hasInlineFeedback(result);
24
+ }
25
+ function isPlanRejection(inv) {
26
+ if (!inv || inv.state !== "result" || inv.toolName !== "submit_plan") return false;
27
+ return isRejectionWithoutFeedback(inv.result);
28
+ }
29
+ function isPlanRejectionResultPart(part) {
30
+ return part.type === "tool_result" && part.name === "submit_plan" && isRejectionWithoutFeedback(part.result);
31
+ }
32
+ var PlanRejectionAbortProcessor = class {
33
+ id = "plan-rejection-abort";
34
+ async processInputStep({ messages, stepNumber, abort }) {
35
+ if (stepNumber === 0) return void 0;
36
+ for (let i = messages.length - 1; i >= 0; i--) {
37
+ const msg = messages[i];
38
+ if (!msg || msg.role !== "assistant") continue;
39
+ const content = msg.content;
40
+ const parts = Array.isArray(content) ? content : Array.isArray(content?.parts) ? content.parts : [];
41
+ for (const part of parts) {
42
+ if (!part || typeof part !== "object") continue;
43
+ const p = part;
44
+ if (p.type === "tool-invocation" && isPlanRejection(p.toolInvocation)) {
45
+ abort("Plan rejected by user — no further response needed");
46
+ return;
47
+ }
48
+ if (isPlanRejectionResultPart(p)) {
49
+ abort("Plan rejected by user — no further response needed");
50
+ return;
51
+ }
52
+ }
53
+ const legacy = !Array.isArray(content) && Array.isArray(content?.toolInvocations) ? content.toolInvocations : [];
54
+ for (const inv of legacy) if (isPlanRejection(inv)) {
55
+ abort("Plan rejected by user — no further response needed");
56
+ return;
57
+ }
58
+ break;
59
+ }
60
+ }
61
+ };
62
+ export { PlanRejectionAbortProcessor };
@@ -0,0 +1,47 @@
1
+ import { createAmazonBedrock } from '@ai-sdk/amazon-bedrock';
2
+ import { MastraModelGateway } from '@mastra/core/llm';
3
+ import type { GatewayAuthRequest, GatewayAuthResult, GatewayLanguageModel, ProviderConfig } from '@mastra/core/llm';
4
+ type BedrockModel = ReturnType<ReturnType<typeof createAmazonBedrock>>;
5
+ type BedrockPrompt = Parameters<BedrockModel['doGenerate']>[0]['prompt'];
6
+ export declare function supportsBedrockPromptCaching(modelId: string): boolean;
7
+ export declare function addBedrockCachePoints(prompt: BedrockPrompt): BedrockPrompt;
8
+ export declare function withBedrockCache(model: BedrockModel): BedrockModel;
9
+ export declare const AMAZON_BEDROCK_GATEWAY_ID = "amazon-bedrock";
10
+ /**
11
+ * Whether AWS credentials look available for Bedrock.
12
+ *
13
+ * Amazon Bedrock authenticates with AWS SigV4 rather than a bearer API key, so
14
+ * this only governs whether Bedrock models are offered as "authenticated" in the
15
+ * picker. We look for the common signals (env vars, bearer token, a configured
16
+ * profile, or a shared credentials/config file) rather than resolving
17
+ * credentials here, since the auth checker must stay sync.
18
+ */
19
+ export declare function hasAwsCredentials(): boolean;
20
+ /**
21
+ * Standalone Amazon Bedrock gateway.
22
+ *
23
+ * Bedrock is resolved directly via AWS SigV4 (not through the model router) and
24
+ * its models are surfaced from the public models.dev catalog. It is exposed as
25
+ * its own gateway/provider (`amazon-bedrock/...`) rather than nested under the
26
+ * MastraCode gateway namespace.
27
+ */
28
+ export declare class AmazonBedrockGateway extends MastraModelGateway {
29
+ readonly id = "amazon-bedrock";
30
+ readonly name = "Amazon Bedrock";
31
+ shouldEnable(): boolean;
32
+ fetchProviders(): Promise<Record<string, ProviderConfig>>;
33
+ buildUrl(_modelId: string): string | undefined;
34
+ getApiKey(_modelId: string): Promise<string>;
35
+ resolveAuth(_request: GatewayAuthRequest): GatewayAuthResult | undefined;
36
+ resolveLanguageModel(args: {
37
+ modelId: string;
38
+ providerId: string;
39
+ apiKey: string;
40
+ headers?: Record<string, string>;
41
+ transport?: any;
42
+ responsesWebSocket?: any;
43
+ }): GatewayLanguageModel;
44
+ }
45
+ export declare function createAmazonBedrockGateway(): AmazonBedrockGateway;
46
+ export {};
47
+ //# sourceMappingURL=amazon-bedrock-gateway.d.ts.map
@@ -0,0 +1,142 @@
1
+ import { getBedrockModelCatalog } from "./amazon-bedrock.js";
2
+ import path from "path";
3
+ import { existsSync } from "fs";
4
+ import { MastraModelGateway } from "@mastra/core/llm";
5
+ import { createAmazonBedrock } from "@ai-sdk/amazon-bedrock";
6
+ import { fromNodeProviderChain } from "@aws-sdk/credential-providers";
7
+ // src/providers/amazon-bedrock-gateway.ts
8
+ const CLAUDE_3_CACHEABLE = /claude-3-7-sonnet|claude-3-5-sonnet-20241022|claude-3-5-haiku/;
9
+ function supportsBedrockPromptCaching(modelId) {
10
+ if (!modelId.includes("anthropic.claude")) return false;
11
+ return /anthropic\.claude-3-/.test(modelId) ? CLAUDE_3_CACHEABLE.test(modelId) : true;
12
+ }
13
+ function addBedrockCachePoints(prompt) {
14
+ const result = [...prompt];
15
+ const markCachePoint = (message) => ({
16
+ ...message,
17
+ providerOptions: {
18
+ ...message.providerOptions,
19
+ bedrock: {
20
+ ...message.providerOptions?.bedrock,
21
+ cachePoint: { type: "default" }
22
+ }
23
+ }
24
+ });
25
+ let lastSystemIndex = -1;
26
+ for (let index = result.length - 1; index >= 0; index--) if (result[index].role === "system") {
27
+ lastSystemIndex = index;
28
+ break;
29
+ }
30
+ if (lastSystemIndex >= 0) result[lastSystemIndex] = markCachePoint(result[lastSystemIndex]);
31
+ let lastNonSystemIndex = -1;
32
+ for (let index = result.length - 1; index >= 0; index--) if (result[index].role !== "system") {
33
+ lastNonSystemIndex = index;
34
+ break;
35
+ }
36
+ if (lastNonSystemIndex >= 0) result[lastNonSystemIndex] = markCachePoint(result[lastNonSystemIndex]);
37
+ return result;
38
+ }
39
+ function withBedrockCache(model) {
40
+ return new Proxy(model, { get(target, property, receiver) {
41
+ if (property === "doGenerate") return (options) => target.doGenerate({
42
+ ...options,
43
+ prompt: addBedrockCachePoints(options.prompt)
44
+ });
45
+ if (property === "doStream") return (options) => target.doStream({
46
+ ...options,
47
+ prompt: addBedrockCachePoints(options.prompt)
48
+ });
49
+ return Reflect.get(target, property, receiver);
50
+ } });
51
+ }
52
+ const AMAZON_BEDROCK_GATEWAY_ID = "amazon-bedrock";
53
+ /**
54
+ * Whether AWS credentials look available for Bedrock.
55
+ *
56
+ * Amazon Bedrock authenticates with AWS SigV4 rather than a bearer API key, so
57
+ * this only governs whether Bedrock models are offered as "authenticated" in the
58
+ * picker. We look for the common signals (env vars, bearer token, a configured
59
+ * profile, or a shared credentials/config file) rather than resolving
60
+ * credentials here, since the auth checker must stay sync.
61
+ */
62
+ function hasAwsCredentials() {
63
+ if (process.env.AWS_BEARER_TOKEN_BEDROCK || process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SECRET_ACCESS_KEY || process.env.AWS_SHARED_CREDENTIALS_FILE || process.env.AWS_CONFIG_FILE || process.env.AWS_PROFILE || process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI || process.env.AWS_CONTAINER_CREDENTIALS_FULL_URI || process.env.AWS_WEB_IDENTITY_TOKEN_FILE) return true;
64
+ const home = process.env.HOME || process.env.USERPROFILE;
65
+ if (home) {
66
+ const awsDir = path.join(home, ".aws");
67
+ const credentialsPath = process.env.AWS_SHARED_CREDENTIALS_FILE ?? path.join(awsDir, "credentials");
68
+ const configPath = process.env.AWS_CONFIG_FILE ?? path.join(awsDir, "config");
69
+ if (existsSync(credentialsPath) || existsSync(configPath)) return true;
70
+ }
71
+ return false;
72
+ }
73
+ /**
74
+ * Create an Amazon Bedrock model.
75
+ *
76
+ * Bedrock authenticates with AWS SigV4 rather than a bearer API key, so this
77
+ * resolves credentials through the standard AWS provider chain
78
+ * (`fromNodeProviderChain`): environment variables, shared `~/.aws` config and
79
+ * SSO profiles, and container/instance roles — the same resolution order the AWS
80
+ * CLI uses. The region falls back to `us-east-1` to match the AWS SDK default.
81
+ *
82
+ * When `AWS_BEARER_TOKEN_BEDROCK` is set, `@ai-sdk/amazon-bedrock` uses bearer
83
+ * auth instead and ignores the credential provider, so we leave that path to the
84
+ * SDK and only wire up SigV4 here.
85
+ */
86
+ function bedrockProvider(modelId, headers) {
87
+ const region = process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION || "us-east-1";
88
+ const model = createAmazonBedrock({
89
+ region,
90
+ credentialProvider: fromNodeProviderChain(),
91
+ headers
92
+ })(modelId);
93
+ return supportsBedrockPromptCaching(modelId) ? withBedrockCache(model) : model;
94
+ }
95
+ /**
96
+ * Standalone Amazon Bedrock gateway.
97
+ *
98
+ * Bedrock is resolved directly via AWS SigV4 (not through the model router) and
99
+ * its models are surfaced from the public models.dev catalog. It is exposed as
100
+ * its own gateway/provider (`amazon-bedrock/...`) rather than nested under the
101
+ * MastraCode gateway namespace.
102
+ */
103
+ var AmazonBedrockGateway = class extends MastraModelGateway {
104
+ id = AMAZON_BEDROCK_GATEWAY_ID;
105
+ name = "Amazon Bedrock";
106
+ shouldEnable() {
107
+ return hasAwsCredentials();
108
+ }
109
+ async fetchProviders() {
110
+ const providers = {};
111
+ try {
112
+ const bedrockModels = await getBedrockModelCatalog();
113
+ providers["amazon-bedrock"] = {
114
+ name: "Amazon Bedrock",
115
+ apiKeyEnvVar: "",
116
+ apiKeyHeader: "Authorization",
117
+ gateway: this.id,
118
+ models: bedrockModels.map((model) => model.id)
119
+ };
120
+ } catch (error) {
121
+ console.warn("Failed to load Amazon Bedrock model catalog:", error);
122
+ }
123
+ return providers;
124
+ }
125
+ buildUrl(_modelId) {}
126
+ async getApiKey(_modelId) {
127
+ return hasAwsCredentials() ? "aws-credential-chain" : "";
128
+ }
129
+ resolveAuth(_request) {
130
+ if (hasAwsCredentials()) return {
131
+ apiKey: "aws-credential-chain",
132
+ source: "gateway"
133
+ };
134
+ }
135
+ resolveLanguageModel(args) {
136
+ return bedrockProvider(args.modelId, args.headers);
137
+ }
138
+ };
139
+ function createAmazonBedrockGateway() {
140
+ return new AmazonBedrockGateway();
141
+ }
142
+ export { AMAZON_BEDROCK_GATEWAY_ID, AmazonBedrockGateway, addBedrockCachePoints, createAmazonBedrockGateway, hasAwsCredentials, supportsBedrockPromptCaching, withBedrockCache };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Amazon Bedrock model catalog.
3
+ *
4
+ * Bedrock is not part of mastracode's gateway-synced model router (it
5
+ * authenticates with AWS SigV4 rather than an API key / base URL, so it is
6
+ * resolved directly in `agents/model.ts`). To still offer Bedrock models in the
7
+ * `/models` picker and packs, we fetch the public models.dev catalog — the same
8
+ * source the model router uses — and expose the `amazon-bedrock` provider's
9
+ * model list. This mirrors the GitHub Copilot catalog approach.
10
+ */
11
+ export interface BedrockModelEntry {
12
+ id: string;
13
+ }
14
+ /** Reset the in-process Bedrock catalog cache (test seam). */
15
+ export declare function clearBedrockCatalogCache(): void;
16
+ /**
17
+ * Return the available Amazon Bedrock models.
18
+ *
19
+ * - Returns the cached list when a recent fetch succeeded.
20
+ * - On cache miss / expiry, fetches the models.dev catalog with a 5s timeout and
21
+ * caches it for an hour.
22
+ * - On fetch failure, returns a small hard-coded fallback (so packs still work
23
+ * offline) and caches that briefly to avoid hammering the network.
24
+ *
25
+ * Concurrent calls during a fetch share the inflight promise.
26
+ */
27
+ export declare function getBedrockModelCatalog(): Promise<BedrockModelEntry[]>;
28
+ //# sourceMappingURL=amazon-bedrock.d.ts.map
@@ -0,0 +1,99 @@
1
+ // src/providers/amazon-bedrock.ts
2
+ /**
3
+ * Amazon Bedrock model catalog.
4
+ *
5
+ * Bedrock is not part of mastracode's gateway-synced model router (it
6
+ * authenticates with AWS SigV4 rather than an API key / base URL, so it is
7
+ * resolved directly in `agents/model.ts`). To still offer Bedrock models in the
8
+ * `/models` picker and packs, we fetch the public models.dev catalog — the same
9
+ * source the model router uses — and expose the `amazon-bedrock` provider's
10
+ * model list. This mirrors the GitHub Copilot catalog approach.
11
+ */
12
+ const MODELS_DEV_API_URL = "https://models.dev/api.json";
13
+ const BEDROCK_PROVIDER_ID = "amazon-bedrock";
14
+ const CATALOG_TTL_MS = 36e5;
15
+ const CATALOG_FAILURE_TTL_MS = 6e4;
16
+ const CATALOG_FETCH_TIMEOUT_MS = 5e3;
17
+ /**
18
+ * True when the catalog entry asks for a transport this catalog cannot serve.
19
+ *
20
+ * Every id returned here is handed to `createAmazonBedrock()(modelId)` by
21
+ * `amazon-bedrock-gateway.ts`, i.e. the Converse API, unconditionally. A
22
+ * `provider` override in the catalog means the model wants a different endpoint
23
+ * and API shape: the nine `bedrock-mantle` models point at
24
+ * `https://bedrock-mantle.${AWS_REGION}.api.aws/openai/v1` with
25
+ * `shape: "responses"`. Advertising them makes them selectable in `/models` and
26
+ * in packs even though the request that follows cannot reach them.
27
+ *
28
+ * Filtering is deliberately conservative: it hides what is currently unusable
29
+ * rather than guessing at a transport. Routing these to Mantle properly is a
30
+ * separate change and a design call for the maintainers.
31
+ */
32
+ function needsUnsupportedTransport(entry) {
33
+ const provider = entry?.provider;
34
+ return Boolean(provider && (provider.npm || provider.api || provider.shape));
35
+ }
36
+ /**
37
+ * A small, stable fallback so Bedrock packs keep working offline or when
38
+ * models.dev is unreachable. Intentionally minimal — the live catalog is the
39
+ * source of truth and supersedes this within one fetch.
40
+ */
41
+ const BEDROCK_FALLBACK_MODELS = [
42
+ { id: "us.anthropic.claude-opus-4-6-v1" },
43
+ { id: "us.anthropic.claude-sonnet-4-5-20250929-v1:0" },
44
+ { id: "us.anthropic.claude-haiku-4-5-20251001-v1:0" }
45
+ ];
46
+ let catalogCache = null;
47
+ let inflightFetch = null;
48
+ /** Reset the in-process Bedrock catalog cache (test seam). */
49
+ function clearBedrockCatalogCache() {
50
+ catalogCache = null;
51
+ inflightFetch = null;
52
+ }
53
+ async function fetchBedrockModels(signal) {
54
+ const response = await fetch(MODELS_DEV_API_URL, { signal });
55
+ if (!response.ok) throw new Error(`models.dev returned ${response.status}`);
56
+ const models = (await response.json())[BEDROCK_PROVIDER_ID]?.models ?? {};
57
+ return Object.entries(models).filter(([, entry]) => !needsUnsupportedTransport(entry)).map(([id]) => id).sort().map((id) => ({ id }));
58
+ }
59
+ /**
60
+ * Return the available Amazon Bedrock models.
61
+ *
62
+ * - Returns the cached list when a recent fetch succeeded.
63
+ * - On cache miss / expiry, fetches the models.dev catalog with a 5s timeout and
64
+ * caches it for an hour.
65
+ * - On fetch failure, returns a small hard-coded fallback (so packs still work
66
+ * offline) and caches that briefly to avoid hammering the network.
67
+ *
68
+ * Concurrent calls during a fetch share the inflight promise.
69
+ */
70
+ async function getBedrockModelCatalog() {
71
+ if (catalogCache && Date.now() - catalogCache.fetchedAt < catalogCache.ttl) return catalogCache.models;
72
+ if (inflightFetch) return inflightFetch;
73
+ inflightFetch = (async () => {
74
+ const controller = new AbortController();
75
+ const timer = setTimeout(() => controller.abort(), CATALOG_FETCH_TIMEOUT_MS);
76
+ try {
77
+ const models = await fetchBedrockModels(controller.signal);
78
+ catalogCache = {
79
+ fetchedAt: Date.now(),
80
+ ttl: CATALOG_TTL_MS,
81
+ models
82
+ };
83
+ return models;
84
+ } catch (error) {
85
+ catalogCache = {
86
+ fetchedAt: Date.now(),
87
+ ttl: CATALOG_FAILURE_TTL_MS,
88
+ models: BEDROCK_FALLBACK_MODELS
89
+ };
90
+ console.warn("Failed to fetch live Amazon Bedrock models, using fallback list:", error instanceof Error ? error.message : error);
91
+ return BEDROCK_FALLBACK_MODELS;
92
+ } finally {
93
+ clearTimeout(timer);
94
+ inflightFetch = null;
95
+ }
96
+ })();
97
+ return inflightFetch;
98
+ }
99
+ export { clearBedrockCatalogCache, getBedrockModelCatalog };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * TTL for the main agent's Anthropic prompt-cache breakpoints.
3
+ * Observational memory's idle activation for Anthropic is set to the same value,
4
+ * so buffered observations don't activate while the cache is still warm.
5
+ */
6
+ export declare const ANTHROPIC_PROMPT_CACHE_TTL: '1h';
7
+ /**
8
+ * Which Anthropic prompt-cache breakpoints a model writes.
9
+ *
10
+ * - `conversation`: the last system message and the latest message, with
11
+ * {@link ANTHROPIC_PROMPT_CACHE_TTL}. For the main agent, whose next request
12
+ * extends the same conversation.
13
+ * - `system`: the last system message only, with a 5-minute TTL. For background
14
+ * calls (observer, reflector, thread titles) that share instructions across
15
+ * calls but send different content each time, so caching the content is a
16
+ * write that is never read.
17
+ */
18
+ export type AnthropicPromptCacheScope = 'conversation' | 'system';
19
+ //# sourceMappingURL=anthropic-prompt-cache.d.ts.map
@@ -0,0 +1,8 @@
1
+ // src/providers/anthropic-prompt-cache.ts
2
+ /**
3
+ * TTL for the main agent's Anthropic prompt-cache breakpoints.
4
+ * Observational memory's idle activation for Anthropic is set to the same value,
5
+ * so buffered observations don't activate while the cache is still warm.
6
+ */
7
+ const ANTHROPIC_PROMPT_CACHE_TTL = "1h";
8
+ export { ANTHROPIC_PROMPT_CACHE_TTL };
@@ -0,0 +1,5 @@
1
+ import type { ActiveThinkingLevel } from '../thinking.js';
2
+ export declare const ANTHROPIC_THINKING_BUDGET_TOKENS: Record<ActiveThinkingLevel, number>;
3
+ export declare function getAnthropicThinkingCapability(modelId: string): 'adaptive' | 'budget' | 'none';
4
+ export declare function supportsAnthropicXhighEffort(modelId: string): boolean;
5
+ //# sourceMappingURL=anthropic-thinking.d.ts.map
@@ -0,0 +1,22 @@
1
+ // src/providers/anthropic-thinking.ts
2
+ const ANTHROPIC_THINKING_BUDGET_TOKENS = {
3
+ low: 4096,
4
+ medium: 8192,
5
+ high: 16384,
6
+ xhigh: 24576,
7
+ max: 24576
8
+ };
9
+ const ANTHROPIC_XHIGH_EFFORT_RE = /claude-(?:opus-4-[78]|opus-5|sonnet-5|fable-5)/;
10
+ const ADAPTIVE_THINKING_RE = /claude-(?:sonnet-4-6|opus-4-[678]|opus-5|sonnet-5|fable-5)/;
11
+ const BUDGET_THINKING_RE = /claude-(?:3-7|sonnet-4|opus-4|haiku-4-5)/;
12
+ const NO_THINKING_RE = /claude-(?:instant|v?2(?:[-.:]|$)|3(?:[-.]|$)|3-5)/;
13
+ function getAnthropicThinkingCapability(modelId) {
14
+ if (ADAPTIVE_THINKING_RE.test(modelId)) return "adaptive";
15
+ if (BUDGET_THINKING_RE.test(modelId)) return "budget";
16
+ if (NO_THINKING_RE.test(modelId)) return "none";
17
+ return "adaptive";
18
+ }
19
+ function supportsAnthropicXhighEffort(modelId) {
20
+ return ANTHROPIC_XHIGH_EFFORT_RE.test(modelId);
21
+ }
22
+ export { ANTHROPIC_THINKING_BUDGET_TOKENS, getAnthropicThinkingCapability, supportsAnthropicXhighEffort };
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Claude Max OAuth Provider
3
+ *
4
+ * Uses OAuth tokens from AuthStorage to authenticate with Claude Max plan.
5
+ * The OAuth endpoint requires a specific system message to be present.
6
+ */
7
+ import type { MastraModelConfig } from '@mastra/core/llm';
8
+ import type { LanguageModelMiddleware } from 'ai';
9
+ import { AuthStorage } from '../auth/storage.js';
10
+ import type { CredentialStore } from '../auth/types.js';
11
+ import type { AnthropicPromptCacheScope } from './anthropic-prompt-cache.js';
12
+ import type { ThinkingLevel } from './openai-codex.js';
13
+ /**
14
+ * Get or create the shared AuthStorage instance
15
+ */
16
+ export declare function getAuthStorage(): AuthStorage;
17
+ /**
18
+ * Set a custom AuthStorage instance (useful for TUI integration)
19
+ */
20
+ export declare function setAuthStorage(storage: AuthStorage | undefined): void;
21
+ /**
22
+ * Middleware that injects the Claude Code identity system message
23
+ * Required for Claude Max OAuth authentication
24
+ */
25
+ export declare const claudeCodeMiddleware: LanguageModelMiddleware;
26
+ /**
27
+ * Prompt caching middleware for Anthropic
28
+ *
29
+ * Adds cache breakpoints at strategic locations:
30
+ * 1. Last system message (end of static instructions + dynamic memory)
31
+ * 2. Most recent user/assistant message (conversation context), `conversation` scope only
32
+ *
33
+ * This allows Anthropic to cache:
34
+ * - System prompts and instructions (rarely change)
35
+ * - Conversation history up to the last message
36
+ */
37
+ export declare const createPromptCacheMiddleware: (scope: AnthropicPromptCacheScope) => LanguageModelMiddleware;
38
+ /**
39
+ * Middleware that maps the session thinking level onto Anthropic extended
40
+ * thinking. Returns `undefined` (no middleware) when the level is `off` or the
41
+ * model doesn't support thinking, preserving the previous request shape.
42
+ *
43
+ * - Adaptive-era models (Sonnet 4.6+/Opus 4.6+): `thinking: adaptive` plus
44
+ * `output_config.effort`, the closest effort the model accepts.
45
+ * - Budget-era models (Claude 3.7 – Opus 4.5): `thinking: enabled` with a
46
+ * `budget_tokens` value derived from the level.
47
+ */
48
+ export declare function createAnthropicThinkingMiddleware(modelId: string, thinkingLevel?: ThinkingLevel): LanguageModelMiddleware | undefined;
49
+ /**
50
+ * Build a fetch function that handles Anthropic OAuth.
51
+ * Preserves non-auth headers from init (critical for gateway auth header to survive
52
+ * when used with the gateway). Strips `authorization` and `x-api-key`.
53
+ */
54
+ export declare function buildAnthropicOAuthFetch(opts?: {
55
+ authStorage?: CredentialStore;
56
+ }): typeof fetch;
57
+ /**
58
+ * Creates an Anthropic model using Claude Max OAuth authentication
59
+ * Uses OAuth tokens from AuthStorage (auto-refreshes when needed)
60
+ */
61
+ export declare function opencodeClaudeMaxProvider(modelId?: string, options?: {
62
+ headers?: Record<string, string>;
63
+ authStorage?: CredentialStore;
64
+ thinkingLevel?: ThinkingLevel;
65
+ promptCacheScope?: AnthropicPromptCacheScope;
66
+ }): MastraModelConfig;
67
+ //# sourceMappingURL=claude-max.d.ts.map