@mastra/deployer-sandbox 0.0.0-aggregate-trace-20261015182851

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 (389) hide show
  1. package/LICENSE.md +32 -0
  2. package/README.md +65 -0
  3. package/dist/alias.d.ts +10 -0
  4. package/dist/alias.d.ts.map +1 -0
  5. package/dist/client/index.cjs +174 -0
  6. package/dist/client/index.cjs.map +1 -0
  7. package/dist/client/index.d.ts +98 -0
  8. package/dist/client/index.d.ts.map +1 -0
  9. package/dist/client/index.js +171 -0
  10. package/dist/client/index.js.map +1 -0
  11. package/dist/deployer.d.ts +57 -0
  12. package/dist/deployer.d.ts.map +1 -0
  13. package/dist/engine.d.ts +34 -0
  14. package/dist/engine.d.ts.map +1 -0
  15. package/dist/index.cjs +989 -0
  16. package/dist/index.cjs.map +1 -0
  17. package/dist/index.d.ts +8 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +979 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/manifest.d.ts +7 -0
  22. package/dist/manifest.d.ts.map +1 -0
  23. package/dist/shared-DhnF9P1K.cjs +195 -0
  24. package/dist/shared-DhnF9P1K.cjs.map +1 -0
  25. package/dist/shared-MNp_lXYR.js +118 -0
  26. package/dist/shared-MNp_lXYR.js.map +1 -0
  27. package/dist/shared.d.ts +63 -0
  28. package/dist/shared.d.ts.map +1 -0
  29. package/dist/studio/assets/CodeDiff.es-B6m0Qn7_.js +298 -0
  30. package/dist/studio/assets/CommitMono-400-Regular-DzkyLZ26.woff2 +0 -0
  31. package/dist/studio/assets/CommitMono-700-Regular-DmOSN4kd.woff2 +0 -0
  32. package/dist/studio/assets/MonaSans-VariableFont_wdth-wght-CX-7s9jm.ttf +0 -0
  33. package/dist/studio/assets/abap-BdImnpbu.js +1 -0
  34. package/dist/studio/assets/actionscript-3-B3316cI-.js +1 -0
  35. package/dist/studio/assets/ada-bCR0ucgS.js +1 -0
  36. package/dist/studio/assets/ahk-CsyLZFj1.js +1 -0
  37. package/dist/studio/assets/ahk2-8Zs4aa1G.js +1 -0
  38. package/dist/studio/assets/andromeeda-C4gqWexZ.js +1 -0
  39. package/dist/studio/assets/angular-html-DA-rfuFy.js +1 -0
  40. package/dist/studio/assets/angular-ts-BrjP3tb8.js +1 -0
  41. package/dist/studio/assets/apache-Pmp26Uib.js +1 -0
  42. package/dist/studio/assets/apex-DhZFqWV2.js +1 -0
  43. package/dist/studio/assets/apl-CORt7UWP.js +1 -0
  44. package/dist/studio/assets/applescript-Co6uUVPk.js +1 -0
  45. package/dist/studio/assets/ara-BRHolxvo.js +1 -0
  46. package/dist/studio/assets/asciidoc-CSVQ5wI8.js +1 -0
  47. package/dist/studio/assets/asm-D_Q5rh1f.js +1 -0
  48. package/dist/studio/assets/astro-HNnZUWAn.js +1 -0
  49. package/dist/studio/assets/aurora-x-D-2ljcwZ.js +1 -0
  50. package/dist/studio/assets/awk-DMzUqQB5.js +1 -0
  51. package/dist/studio/assets/ayu-dark-DYE7WIF3.js +1 -0
  52. package/dist/studio/assets/ayu-light-BA47KaF1.js +1 -0
  53. package/dist/studio/assets/ayu-mirage-32ctXXKs.js +1 -0
  54. package/dist/studio/assets/babel-lWBcy2sH.js +16 -0
  55. package/dist/studio/assets/ballerina-BFfxhgS-.js +1 -0
  56. package/dist/studio/assets/bash-atvbtKCR.js +1 -0
  57. package/dist/studio/assets/bat-CickPsom.js +1 -0
  58. package/dist/studio/assets/beancount-k_qm7-4y.js +1 -0
  59. package/dist/studio/assets/berry-uYugtg8r.js +1 -0
  60. package/dist/studio/assets/bibtex-CHM0blh-.js +1 -0
  61. package/dist/studio/assets/bicep-Bmn6On1c.js +1 -0
  62. package/dist/studio/assets/bird2-Bx8U0n9b.js +1 -0
  63. package/dist/studio/assets/blade-2xfisSek.js +1 -0
  64. package/dist/studio/assets/bsl-DlhNcFeZ.js +1 -0
  65. package/dist/studio/assets/c-BIGW1oBm.js +1 -0
  66. package/dist/studio/assets/c3-Dp5svz6Z.js +1 -0
  67. package/dist/studio/assets/cadence-Bv_4Rxtq.js +1 -0
  68. package/dist/studio/assets/cairo-KRGpt6FW.js +1 -0
  69. package/dist/studio/assets/catppuccin-frappe-CZL1YF0i.js +1 -0
  70. package/dist/studio/assets/catppuccin-latte-DH-8KZSZ.js +1 -0
  71. package/dist/studio/assets/catppuccin-macchiato-B7yYVSCf.js +1 -0
  72. package/dist/studio/assets/catppuccin-mocha-Ct7hS0mc.js +1 -0
  73. package/dist/studio/assets/chapel-DTp_pixX.js +1 -0
  74. package/dist/studio/assets/clarity-Dn5IMItf.js +1 -0
  75. package/dist/studio/assets/clojure-P80f7IUj.js +1 -0
  76. package/dist/studio/assets/cmake-D1j8_8rp.js +1 -0
  77. package/dist/studio/assets/cobol-nBiQ_Alo.js +1 -0
  78. package/dist/studio/assets/codeowners-Bp6g37R7.js +1 -0
  79. package/dist/studio/assets/codeql-DsOJ9woJ.js +1 -0
  80. package/dist/studio/assets/coffee-Ch7k5sss.js +1 -0
  81. package/dist/studio/assets/common-lisp-Cg-RD9OK.js +1 -0
  82. package/dist/studio/assets/coq-C7JzOVbR.js +1 -0
  83. package/dist/studio/assets/core-C4YeT6I6.js +2 -0
  84. package/dist/studio/assets/cpp-BMRokrvK.js +1 -0
  85. package/dist/studio/assets/crystal-DGywbUpC.js +1 -0
  86. package/dist/studio/assets/csharp-DSvCPggb.js +1 -0
  87. package/dist/studio/assets/css-BPhBrDlE.js +1 -0
  88. package/dist/studio/assets/css-CLj8gQPS.js +1 -0
  89. package/dist/studio/assets/csv-fuZLfV_i.js +1 -0
  90. package/dist/studio/assets/cue-D82EKSYY.js +1 -0
  91. package/dist/studio/assets/cypher-COkxafJQ.js +1 -0
  92. package/dist/studio/assets/d-85-TOEBH.js +1 -0
  93. package/dist/studio/assets/dark-plus-C3mMm8J8.js +1 -0
  94. package/dist/studio/assets/dart-bE4Kk8sk.js +1 -0
  95. package/dist/studio/assets/dax-CEL-wOlO.js +1 -0
  96. package/dist/studio/assets/desktop-BmXAJ9_W.js +1 -0
  97. package/dist/studio/assets/diff-BgYniUM_.js +1 -0
  98. package/dist/studio/assets/diff-D97Zzqfu.js +1 -0
  99. package/dist/studio/assets/docker-BcOcwvcX.js +1 -0
  100. package/dist/studio/assets/dotenv-Da5cRb03.js +1 -0
  101. package/dist/studio/assets/dracula-BzJJZx-M.js +1 -0
  102. package/dist/studio/assets/dracula-soft-BXkSAIEj.js +1 -0
  103. package/dist/studio/assets/dream-maker-BtqSS_iP.js +1 -0
  104. package/dist/studio/assets/edge-FbVlp4U3.js +1 -0
  105. package/dist/studio/assets/elixir-CkH2-t6x.js +1 -0
  106. package/dist/studio/assets/elm-DbKCFpqz.js +1 -0
  107. package/dist/studio/assets/emacs-lisp-C_m_b--Z.js +1 -0
  108. package/dist/studio/assets/engine-compile-CUTZfOIo.js +137 -0
  109. package/dist/studio/assets/engine-javascript-DSQaR0Yq.js +1 -0
  110. package/dist/studio/assets/erb-DXfck5VN.js +1 -0
  111. package/dist/studio/assets/erlang-DsQrWhSR.js +1 -0
  112. package/dist/studio/assets/estree-Dd9JfUIE.js +44 -0
  113. package/dist/studio/assets/everforest-dark-BgDCqdQA.js +1 -0
  114. package/dist/studio/assets/everforest-light-C8M2exoo.js +1 -0
  115. package/dist/studio/assets/fennel-BYunw83y.js +1 -0
  116. package/dist/studio/assets/fish-BvzEVeQv.js +1 -0
  117. package/dist/studio/assets/fluent-C4IJs8-o.js +1 -0
  118. package/dist/studio/assets/fortran-fixed-form-CkoXwp7k.js +1 -0
  119. package/dist/studio/assets/fortran-free-form-BxgE0vQu.js +1 -0
  120. package/dist/studio/assets/fsharp-CXgrBDvD.js +1 -0
  121. package/dist/studio/assets/gdresource-TyuKm33G.js +1 -0
  122. package/dist/studio/assets/gdscript-DqcFQ5yU.js +1 -0
  123. package/dist/studio/assets/gdshader-DkwncUOv.js +1 -0
  124. package/dist/studio/assets/genie-D0YGMca9.js +1 -0
  125. package/dist/studio/assets/gherkin-DyxjwDmM.js +1 -0
  126. package/dist/studio/assets/git-commit-F4YmCXRG.js +1 -0
  127. package/dist/studio/assets/git-rebase-r7XF79zn.js +1 -0
  128. package/dist/studio/assets/github-dark-DHJKELXO.js +1 -0
  129. package/dist/studio/assets/github-dark-default-Cuk6v7N8.js +1 -0
  130. package/dist/studio/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
  131. package/dist/studio/assets/github-dark-high-contrast-E3gJ1_iC.js +1 -0
  132. package/dist/studio/assets/github-dark-vbPMK5nw.js +1 -0
  133. package/dist/studio/assets/github-light-CBO01_j6.js +1 -0
  134. package/dist/studio/assets/github-light-DAi9KRSo.js +1 -0
  135. package/dist/studio/assets/github-light-default-D7oLnXFd.js +1 -0
  136. package/dist/studio/assets/github-light-high-contrast-BfjtVDDH.js +1 -0
  137. package/dist/studio/assets/gleam-BspZqrRM.js +1 -0
  138. package/dist/studio/assets/glimmer-js-ByusRIyA.js +1 -0
  139. package/dist/studio/assets/glimmer-ts-BfAWNZQY.js +1 -0
  140. package/dist/studio/assets/glsl-DplSGwfg.js +1 -0
  141. package/dist/studio/assets/gn-n2N0HUVH.js +1 -0
  142. package/dist/studio/assets/gnuplot-DdkO51Og.js +1 -0
  143. package/dist/studio/assets/go-C27-OAKa.js +1 -0
  144. package/dist/studio/assets/graphql-ChdNCCLP.js +1 -0
  145. package/dist/studio/assets/groovy-gcz8RCvz.js +1 -0
  146. package/dist/studio/assets/gruvbox-dark-hard-CFHQjOhq.js +1 -0
  147. package/dist/studio/assets/gruvbox-dark-medium-GsRaNv29.js +1 -0
  148. package/dist/studio/assets/gruvbox-dark-soft-CVdnzihN.js +1 -0
  149. package/dist/studio/assets/gruvbox-light-hard-CH1njM8p.js +1 -0
  150. package/dist/studio/assets/gruvbox-light-medium-DRw_LuNl.js +1 -0
  151. package/dist/studio/assets/gruvbox-light-soft-hJgmCMqR.js +1 -0
  152. package/dist/studio/assets/hack-BWmVpMyf.js +1 -0
  153. package/dist/studio/assets/haml-D5jkg6IW.js +1 -0
  154. package/dist/studio/assets/handlebars-BpdQsYii.js +1 -0
  155. package/dist/studio/assets/haskell-Df6bDoY_.js +1 -0
  156. package/dist/studio/assets/haxe-CfZj7gIn.js +1 -0
  157. package/dist/studio/assets/hcl-BWvSN4gD.js +1 -0
  158. package/dist/studio/assets/hjson-D5-asLiD.js +1 -0
  159. package/dist/studio/assets/hlsl-D3lLCCz7.js +1 -0
  160. package/dist/studio/assets/horizon-BUw7H-hv.js +1 -0
  161. package/dist/studio/assets/horizon-bright-CUuTKBJd.js +1 -0
  162. package/dist/studio/assets/houston-DnULxvSX.js +1 -0
  163. package/dist/studio/assets/html-C2L_23MC.js +1 -0
  164. package/dist/studio/assets/html-derivative-DlHx6ybY.js +1 -0
  165. package/dist/studio/assets/html-pp8916En.js +1 -0
  166. package/dist/studio/assets/http-jrhK8wxY.js +1 -0
  167. package/dist/studio/assets/hurl-irOxFIW8.js +1 -0
  168. package/dist/studio/assets/hxml-2-FPmUDs.js +1 -0
  169. package/dist/studio/assets/hy-DFXneXwc.js +1 -0
  170. package/dist/studio/assets/imba-DGztddWO.js +1 -0
  171. package/dist/studio/assets/index-2BQyy0xI.js +1 -0
  172. package/dist/studio/assets/index-B_Bs5aGL.js +11 -0
  173. package/dist/studio/assets/index-DYf6UNXG.js +2 -0
  174. package/dist/studio/assets/index-yUiD89B4.js +1 -0
  175. package/dist/studio/assets/ini-BEwlwnbL.js +1 -0
  176. package/dist/studio/assets/java-CylS5w8V.js +1 -0
  177. package/dist/studio/assets/javascript-wDzz0qaB.js +1 -0
  178. package/dist/studio/assets/javascript-ySlJ1b_l.js +1 -0
  179. package/dist/studio/assets/jinja-f2NsQr07.js +1 -0
  180. package/dist/studio/assets/jison-wvAkD_A8.js +1 -0
  181. package/dist/studio/assets/json-BQoSv7ci.js +1 -0
  182. package/dist/studio/assets/json-Cp-IABpG.js +1 -0
  183. package/dist/studio/assets/json5-C9tS-k6U.js +1 -0
  184. package/dist/studio/assets/jsonc-Des-eS-w.js +1 -0
  185. package/dist/studio/assets/jsonl-DcaNXYhu.js +1 -0
  186. package/dist/studio/assets/jsonnet-DFQXde-d.js +1 -0
  187. package/dist/studio/assets/jssm-C2t-YnRu.js +1 -0
  188. package/dist/studio/assets/jsx-BAng5TT0.js +1 -0
  189. package/dist/studio/assets/jsx-g9-lgVsj.js +1 -0
  190. package/dist/studio/assets/julia-5Bft2YPA.js +1 -0
  191. package/dist/studio/assets/just-Cwhn7H3k.js +1 -0
  192. package/dist/studio/assets/kanagawa-dragon-BuwD2xS4.js +1 -0
  193. package/dist/studio/assets/kanagawa-lotus-C3DzagqV.js +1 -0
  194. package/dist/studio/assets/kanagawa-wave-DFGoQZhC.js +1 -0
  195. package/dist/studio/assets/kdl-DV7GczEv.js +1 -0
  196. package/dist/studio/assets/kotlin-BdnUsdx6.js +1 -0
  197. package/dist/studio/assets/kusto-wEQ09or8.js +1 -0
  198. package/dist/studio/assets/laserwave-DUszq2jm.js +1 -0
  199. package/dist/studio/assets/latex-D5pSuvFb.js +1 -0
  200. package/dist/studio/assets/lean-BZvkOJ9d.js +1 -0
  201. package/dist/studio/assets/less-B1dDrJ26.js +1 -0
  202. package/dist/studio/assets/light-plus-B7mTdjB0.js +1 -0
  203. package/dist/studio/assets/liquid-C0sCDyMI.js +1 -0
  204. package/dist/studio/assets/livekit-client.esm-CKIgC2IJ.js +39 -0
  205. package/dist/studio/assets/llvm-BZoOZj88.js +1 -0
  206. package/dist/studio/assets/log-2UxHyX5q.js +1 -0
  207. package/dist/studio/assets/logo-BtOb2qkB.js +1 -0
  208. package/dist/studio/assets/lua-BaeVxFsk.js +1 -0
  209. package/dist/studio/assets/luau-BnpPk5vE.js +1 -0
  210. package/dist/studio/assets/main-BK_HdEcA.js +743 -0
  211. package/dist/studio/assets/make-CHLpvVh8.js +1 -0
  212. package/dist/studio/assets/markdown-Cvjx9yec.js +1 -0
  213. package/dist/studio/assets/markdown-UIAJJxZW.js +1 -0
  214. package/dist/studio/assets/marko-DjSrsDqO.js +1 -0
  215. package/dist/studio/assets/material-theme-D5KoaKCx.js +1 -0
  216. package/dist/studio/assets/material-theme-darker-BfHTSMKl.js +1 -0
  217. package/dist/studio/assets/material-theme-lighter-B0m2ddpp.js +1 -0
  218. package/dist/studio/assets/material-theme-ocean-CyktbL80.js +1 -0
  219. package/dist/studio/assets/material-theme-palenight-Csfq5Kiy.js +1 -0
  220. package/dist/studio/assets/matlab-D7o27uSR.js +1 -0
  221. package/dist/studio/assets/mdc-D1_yUvq7.js +1 -0
  222. package/dist/studio/assets/mdx-Cmh6b_Ma.js +1 -0
  223. package/dist/studio/assets/mermaid-CQcHuHx7.js +1 -0
  224. package/dist/studio/assets/min-dark-CafNBF8u.js +1 -0
  225. package/dist/studio/assets/min-light-CTRr51gU.js +1 -0
  226. package/dist/studio/assets/mipsasm-CKIfxQSi.js +1 -0
  227. package/dist/studio/assets/mojo-DJz3ZmWd.js +1 -0
  228. package/dist/studio/assets/monokai-BRVnQi9A.js +1 -0
  229. package/dist/studio/assets/moonbit-CHtswR0a.js +1 -0
  230. package/dist/studio/assets/move-el3G9tDJ.js +1 -0
  231. package/dist/studio/assets/narrat-DRg8JJMk.js +1 -0
  232. package/dist/studio/assets/nextflow-C-mBbutL.js +1 -0
  233. package/dist/studio/assets/nextflow-groovy-vE_lwT2v.js +1 -0
  234. package/dist/studio/assets/nginx-BpAMiNFr.js +1 -0
  235. package/dist/studio/assets/night-owl-C39BiMTA.js +1 -0
  236. package/dist/studio/assets/night-owl-light-CMTm3GFP.js +1 -0
  237. package/dist/studio/assets/nim-BIad80T-.js +1 -0
  238. package/dist/studio/assets/nix-CwoSXNpI.js +1 -0
  239. package/dist/studio/assets/nord-Ddv68eIx.js +1 -0
  240. package/dist/studio/assets/nsis-BlV79W_Q.js +1 -0
  241. package/dist/studio/assets/nushell-D3jzshHO.js +1 -0
  242. package/dist/studio/assets/objective-c-DXmwc3jG.js +1 -0
  243. package/dist/studio/assets/objective-cpp-CLxacb5B.js +1 -0
  244. package/dist/studio/assets/ocaml-C0hk2d4L.js +1 -0
  245. package/dist/studio/assets/odin-BBf5iR-q.js +1 -0
  246. package/dist/studio/assets/one-dark-pro-DVMEJ2y_.js +1 -0
  247. package/dist/studio/assets/one-light-C3Wv6jpd.js +1 -0
  248. package/dist/studio/assets/openscad-C4EeE6gA.js +1 -0
  249. package/dist/studio/assets/org-DM6o9KBp.js +1 -0
  250. package/dist/studio/assets/pascal-D93ZcfNL.js +1 -0
  251. package/dist/studio/assets/perl-B9cMNwum.js +1 -0
  252. package/dist/studio/assets/php-Csjmro_R.js +1 -0
  253. package/dist/studio/assets/pierre-dark-CyvmCCZW.js +1 -0
  254. package/dist/studio/assets/pierre-dark-protanopia-deuteranopia-Rgc0TwpF.js +1 -0
  255. package/dist/studio/assets/pierre-dark-soft-BHGpRqa4.js +1 -0
  256. package/dist/studio/assets/pierre-dark-tritanopia-Beq2gCRQ.js +1 -0
  257. package/dist/studio/assets/pierre-dark-vibrant-BWBVywrn.js +1 -0
  258. package/dist/studio/assets/pierre-light-480U9XYS.js +1 -0
  259. package/dist/studio/assets/pierre-light-protanopia-deuteranopia-CaVOBURG.js +1 -0
  260. package/dist/studio/assets/pierre-light-soft-CVdyfjmI.js +1 -0
  261. package/dist/studio/assets/pierre-light-tritanopia-B4_gpKOM.js +1 -0
  262. package/dist/studio/assets/pierre-light-vibrant-DdTDNdfJ.js +1 -0
  263. package/dist/studio/assets/pkl-u5AG7uiY.js +1 -0
  264. package/dist/studio/assets/plastic-3e1v2bzS.js +1 -0
  265. package/dist/studio/assets/plsql-ChMvpjG-.js +1 -0
  266. package/dist/studio/assets/po-BTJTHyun.js +1 -0
  267. package/dist/studio/assets/poimandres-CS3Unz2-.js +1 -0
  268. package/dist/studio/assets/polar-C0HS_06l.js +1 -0
  269. package/dist/studio/assets/postcss-CXtECtnM.js +1 -0
  270. package/dist/studio/assets/powerquery-CEu0bR-o.js +1 -0
  271. package/dist/studio/assets/powershell-BmBUJMz7.js +1 -0
  272. package/dist/studio/assets/preload-helper-PPVm8Dsz.js +1 -0
  273. package/dist/studio/assets/prisma-Vru482bI.js +1 -0
  274. package/dist/studio/assets/prolog-CbFg5uaA.js +1 -0
  275. package/dist/studio/assets/proto-C7zT0LnQ.js +1 -0
  276. package/dist/studio/assets/pug-DKIMFp6K.js +1 -0
  277. package/dist/studio/assets/puppet-BMWR74SV.js +1 -0
  278. package/dist/studio/assets/purescript-CklMAg4u.js +1 -0
  279. package/dist/studio/assets/python-B6aJPvgy.js +1 -0
  280. package/dist/studio/assets/python-DhUJRlN_.js +1 -0
  281. package/dist/studio/assets/qml-3beO22l8.js +1 -0
  282. package/dist/studio/assets/qmldir-C8lEn-DE.js +1 -0
  283. package/dist/studio/assets/qss-IeuSbFQv.js +1 -0
  284. package/dist/studio/assets/r-Cf5RLm7j.js +1 -0
  285. package/dist/studio/assets/racket-BqYA7rlc.js +1 -0
  286. package/dist/studio/assets/raku-DXvB9xmW.js +1 -0
  287. package/dist/studio/assets/razor-BjBPvh-w.js +1 -0
  288. package/dist/studio/assets/rbs-CpoqiR4B.js +1 -0
  289. package/dist/studio/assets/red-hvxz__6c.js +1 -0
  290. package/dist/studio/assets/reg-C-SQnVFl.js +1 -0
  291. package/dist/studio/assets/regexp-CDVJQ6XC.js +1 -0
  292. package/dist/studio/assets/rel-C3B-1QV4.js +1 -0
  293. package/dist/studio/assets/riscv-BM1_JUlF.js +1 -0
  294. package/dist/studio/assets/ron-D8l8udqQ.js +1 -0
  295. package/dist/studio/assets/rose-pine-5qJOZa0Y.js +1 -0
  296. package/dist/studio/assets/rose-pine-dawn-zx0QlTCp.js +1 -0
  297. package/dist/studio/assets/rose-pine-moon-C9pEdX9L.js +1 -0
  298. package/dist/studio/assets/rosmsg-BJDFO7_C.js +1 -0
  299. package/dist/studio/assets/rst-bs7f0vWN.js +1 -0
  300. package/dist/studio/assets/ruby-C0TQ7zu5.js +1 -0
  301. package/dist/studio/assets/rust-B1yitclQ.js +1 -0
  302. package/dist/studio/assets/sas-DEy46yEz.js +1 -0
  303. package/dist/studio/assets/sass-Cj5Yp3dK.js +1 -0
  304. package/dist/studio/assets/scala-CqE71os6.js +1 -0
  305. package/dist/studio/assets/scheme-C98Dy4si.js +1 -0
  306. package/dist/studio/assets/scss-D5BDwBP9.js +1 -0
  307. package/dist/studio/assets/sdbl-DVxCFoDh.js +1 -0
  308. package/dist/studio/assets/shaderlab-Dg9Lc6iA.js +1 -0
  309. package/dist/studio/assets/shell-CjFT_Tl9.js +1 -0
  310. package/dist/studio/assets/shellscript-Yzrsuije.js +1 -0
  311. package/dist/studio/assets/shellsession-BADoaaVG.js +1 -0
  312. package/dist/studio/assets/slack-dark-BthQWCQV.js +1 -0
  313. package/dist/studio/assets/slack-ochin-DqwNpetd.js +1 -0
  314. package/dist/studio/assets/smalltalk-BOQMe2GC.js +1 -0
  315. package/dist/studio/assets/smithy-cds9vsN8.js +1 -0
  316. package/dist/studio/assets/snazzy-light-Bw305WKR.js +1 -0
  317. package/dist/studio/assets/solarized-dark-CpvCGNkr.js +1 -0
  318. package/dist/studio/assets/solarized-light-Dlz6yCKv.js +1 -0
  319. package/dist/studio/assets/solidity-DijEV5ha.js +1 -0
  320. package/dist/studio/assets/soy-8wufbnw4.js +1 -0
  321. package/dist/studio/assets/sparql-rVzFXLq3.js +1 -0
  322. package/dist/studio/assets/splunk-BtCnVYZw.js +1 -0
  323. package/dist/studio/assets/sql-COK4E0Yg.js +1 -0
  324. package/dist/studio/assets/sql-CRqJ_cUM.js +1 -0
  325. package/dist/studio/assets/ssh-config-_ykCGR6B.js +1 -0
  326. package/dist/studio/assets/standalone-Dfz2oS5J.js +29 -0
  327. package/dist/studio/assets/stata-DI20mbqo.js +1 -0
  328. package/dist/studio/assets/style-aYaSm1a5.css +1 -0
  329. package/dist/studio/assets/stylus-BEDo0Tqx.js +1 -0
  330. package/dist/studio/assets/surrealql-Cjom0U5J.js +1 -0
  331. package/dist/studio/assets/svelte-Cy7k_4gC.js +1 -0
  332. package/dist/studio/assets/swift-C2oV4EkX.js +1 -0
  333. package/dist/studio/assets/synthwave-84-CbfX1IO0.js +1 -0
  334. package/dist/studio/assets/system-verilog-0hqHdDBg.js +1 -0
  335. package/dist/studio/assets/systemd-4A_iFExJ.js +1 -0
  336. package/dist/studio/assets/talonscript-CkByrt1z.js +1 -0
  337. package/dist/studio/assets/tasl-QIJgUcNo.js +1 -0
  338. package/dist/studio/assets/tcl-dwOrl1Do.js +1 -0
  339. package/dist/studio/assets/templ-DhtptRzy.js +1 -0
  340. package/dist/studio/assets/terraform-BETggiCN.js +1 -0
  341. package/dist/studio/assets/tex-D96PA37w.js +1 -0
  342. package/dist/studio/assets/tokyo-night-hegEt444.js +1 -0
  343. package/dist/studio/assets/toml-vGWfd6FD.js +1 -0
  344. package/dist/studio/assets/ts-tags-D351s5mN.js +1 -0
  345. package/dist/studio/assets/tsv-B_m7g4N7.js +1 -0
  346. package/dist/studio/assets/tsx-B6W0miNI.js +1 -0
  347. package/dist/studio/assets/tsx-COt5Ahok.js +1 -0
  348. package/dist/studio/assets/turtle-BsS91CYL.js +1 -0
  349. package/dist/studio/assets/twig-27uCiNez.js +1 -0
  350. package/dist/studio/assets/typescript-BPQ3VLAy.js +1 -0
  351. package/dist/studio/assets/typescript-Dj6nwHGl.js +1 -0
  352. package/dist/studio/assets/typespec-CAFt9gP4.js +1 -0
  353. package/dist/studio/assets/typst-BUadGCkm.js +1 -0
  354. package/dist/studio/assets/v-BGw2Nkan.js +1 -0
  355. package/dist/studio/assets/vala-CsfeWuGM.js +1 -0
  356. package/dist/studio/assets/vb-Cu-pLBUe.js +1 -0
  357. package/dist/studio/assets/verilog-nZwndyjY.js +1 -0
  358. package/dist/studio/assets/vesper-DRje8inN.js +1 -0
  359. package/dist/studio/assets/vhdl-CeAyd5Ju.js +1 -0
  360. package/dist/studio/assets/viml-CJc9bBzg.js +1 -0
  361. package/dist/studio/assets/vitesse-black-Bkuqu6BP.js +1 -0
  362. package/dist/studio/assets/vitesse-dark-D0r3Knsf.js +1 -0
  363. package/dist/studio/assets/vitesse-light-CVO1_9PV.js +1 -0
  364. package/dist/studio/assets/vue-BqiEGhQt.js +1 -0
  365. package/dist/studio/assets/vue-html-AaS7Mt5G.js +1 -0
  366. package/dist/studio/assets/vue-vine-BoDAl6tE.js +1 -0
  367. package/dist/studio/assets/vyper-CDx5xZoG.js +1 -0
  368. package/dist/studio/assets/wasm-CG6Dc4jp.js +1 -0
  369. package/dist/studio/assets/wasm-MzD3tlZU.js +1 -0
  370. package/dist/studio/assets/wenyan-BV7otONQ.js +1 -0
  371. package/dist/studio/assets/wgsl-Dx-B1_4e.js +1 -0
  372. package/dist/studio/assets/wikitext-BhOHFoWU.js +1 -0
  373. package/dist/studio/assets/wit-5i3qLPDT.js +1 -0
  374. package/dist/studio/assets/wolfram-lXgVvXCa.js +1 -0
  375. package/dist/studio/assets/xml-DGRTSKzu.js +1 -0
  376. package/dist/studio/assets/xml-sdJ4AIDG.js +1 -0
  377. package/dist/studio/assets/xsl-CtQFsRM5.js +1 -0
  378. package/dist/studio/assets/yaml-Buea-lGh.js +1 -0
  379. package/dist/studio/assets/yaml-CVw76BM1.js +1 -0
  380. package/dist/studio/assets/zenscript-DVFEvuxE.js +1 -0
  381. package/dist/studio/assets/zig-VOosw3JB.js +1 -0
  382. package/dist/studio/index.html +108 -0
  383. package/dist/studio/mastra-dark-tile.svg +26 -0
  384. package/dist/studio/routes-manifest.json +25 -0
  385. package/dist/types.d.ts +254 -0
  386. package/dist/types.d.ts.map +1 -0
  387. package/dist/worker.d.ts +5 -0
  388. package/dist/worker.d.ts.map +1 -0
  389. package/package.json +79 -0
package/LICENSE.md ADDED
@@ -0,0 +1,32 @@
1
+ Portions of this software are licensed as follows:
2
+
3
+ - All content that resides under any directory named `ee/` within this
4
+ repository, including but not limited to:
5
+ - `@mastra/core/auth/ee`
6
+ - `@mastra/core/agent-builder/ee`
7
+ - `@mastra/editor/ee`
8
+
9
+ is licensed under the license defined in [`ee/LICENSE`](https://github.com/mastra-ai/mastra/blob/main/ee/LICENSE).
10
+
11
+ - All third-party components incorporated into the Mastra Software are
12
+ licensed under the original license provided by the owner of the
13
+ applicable component.
14
+
15
+ - Content outside of the above-mentioned directories or restrictions is
16
+ available under the "Apache License 2.0" as defined below.
17
+
18
+ # Apache License 2.0
19
+
20
+ Copyright (c) 2025 Kepler Software, Inc.
21
+
22
+ Licensed under the Apache License, Version 2.0 (the "License");
23
+ you may not use this file except in compliance with the License.
24
+ You may obtain a copy of the License at
25
+
26
+ http://www.apache.org/licenses/LICENSE-2.0
27
+
28
+ Unless required by applicable law or agreed to in writing, software
29
+ distributed under the License is distributed on an "AS IS" BASIS,
30
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31
+ See the License for the specific language governing permissions and
32
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # @mastra/deployer-sandbox
2
+
3
+ Deploy a full Mastra server or a non-HTTP worker into a workspace sandbox. It is intended for ephemeral previews, CI smoke deployments, isolated jobs, agent-built application verification, and untrusted tenant environments rather than permanent production hosting.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @mastra/deployer-sandbox
9
+ ```
10
+
11
+ Install a workspace sandbox provider separately. The examples below use `@mastra/vercel`.
12
+
13
+ ## Usage
14
+
15
+ ```typescript
16
+ // src/mastra/index.ts
17
+ import { Mastra } from '@mastra/core/mastra';
18
+ import { SandboxDeployer } from '@mastra/deployer-sandbox';
19
+ import { VercelSandbox } from '@mastra/vercel';
20
+
21
+ const deployer = new SandboxDeployer({
22
+ sandbox: new VercelSandbox({
23
+ sandboxName: 'my-preview',
24
+ timeout: 2_400_000,
25
+ ports: [4111],
26
+ }),
27
+ });
28
+
29
+ export const mastra = new Mastra({ deployer });
30
+ ```
31
+
32
+ Running `mastra build` bundles the project and deploys it into the sandbox, then prints the API and Studio URLs.
33
+
34
+ ## Documentation
35
+
36
+ Server deployments require a `WorkspaceSandbox` implementation with command execution and networking support. The sandbox name is the deployment identity, so subsequent processes can reconnect to the same deployment with the server-only `@mastra/deployer-sandbox/client` export:
37
+
38
+ ```typescript
39
+ import { getDeployment } from '@mastra/deployer-sandbox/client';
40
+ import { VercelSandbox } from '@mastra/vercel';
41
+
42
+ const deployment = await getDeployment({
43
+ sandbox: new VercelSandbox({ sandboxName: 'my-preview', ports: [4111] }),
44
+ });
45
+
46
+ console.log(deployment.status, deployment.url);
47
+ await deployment.stop(); // Resumable snapshot stop
48
+ await deployment.destroy(); // Permanent deletion
49
+ ```
50
+
51
+ Use `deployToSandbox()` for one-shot programmatic deployments of a prebuilt `.mastra/output` directory. Pass `wake: true` to `getDeployment()` when a stopped server should be resumed and health-checked before it is returned.
52
+
53
+ The package also supports non-HTTP workers through `deployWorkerToSandbox()`. Workers only require command execution and can receive bounded input through stdin or a staged file. Their handles expose status checks, separate offset-based stdout and stderr reads, cancellation, snapshot stop, relaunch, and permanent destruction. `attachWorkerDeployment()` reconstructs a handle from persisted sandbox and execution IDs after a supervisor restart.
54
+
55
+ Dependency installation is serialized and cached from the artifact's package manifest and lockfile. Worker cancellation sends TERM before KILL when necessary, while server health checks surface startup logs when a deployment fails to become ready.
56
+
57
+ - [Sandbox deployment documentation](https://mastra.ai/docs/deployment/sandbox)
58
+
59
+ ## Changelog
60
+
61
+ See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/deployers/sandbox/CHANGELOG.md) for version history and release notes.
62
+
63
+ ## Support
64
+
65
+ We have an [open community Discord](https://discord.gg/mastra-ai). Come and say hello and let us know if you have any questions or need any help getting things running.
@@ -0,0 +1,10 @@
1
+ import type { SandboxAliasOptions } from './types.js';
2
+ /**
3
+ * Upsert a Vercel Edge Config item so a stable key always points at the
4
+ * current sandbox URL. Used for Tier 3 routing: apps read the key from Edge
5
+ * Config (e.g. in middleware) instead of hardcoding the rotating sandbox URL.
6
+ */
7
+ export declare function updateEdgeConfigAlias(options: SandboxAliasOptions & {
8
+ url: string;
9
+ }): Promise<void>;
10
+ //# sourceMappingURL=alias.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alias.d.ts","sourceRoot":"","sources":["../src/alias.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,mBAAmB,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA6BzG"}
@@ -0,0 +1,174 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_shared = require("../shared-DhnF9P1K.cjs");
3
+ let _mastra_core_workspace = require("@mastra/core/workspace");
4
+ //#region src/client/index.ts
5
+ /**
6
+ * Runtime resolver + routing helpers for sandbox deployments.
7
+ *
8
+ * SERVER-ONLY. This module resolves sandbox URLs using provider credentials
9
+ * (e.g. VERCEL_TOKEN) — importing it in the browser would ship those
10
+ * credentials to the client. Use the proxy/handler patterns instead so the
11
+ * browser only ever talks to your own domain.
12
+ */
13
+ function assertServerOnly() {
14
+ if (typeof globalThis.window !== "undefined") throw new Error("@mastra/deployer-sandbox/client is server-only: resolving a sandbox requires provider credentials that must never reach the browser. Proxy requests through your own backend instead (see createSandboxHandler / createSandboxProxy).");
15
+ }
16
+ /**
17
+ * Resolve (and optionally wake) a sandbox deployment.
18
+ *
19
+ * With `wake: false` (default) the sandbox is not started: the URL is resolved
20
+ * only if the sandbox is already running in this process, otherwise
21
+ * `{ url: null, status: 'stopped' | 'unknown' }` is returned and the caller
22
+ * decides whether to wake.
23
+ *
24
+ * With `wake: true` the sandbox is started (providers resume by identity,
25
+ * e.g. name), the server is relaunched if it is not answering, and the
26
+ * deployment is returned once healthy.
27
+ */
28
+ async function getDeployment(options) {
29
+ assertServerOnly();
30
+ const { sandbox, port = require_shared.DEFAULT_PORT, wake = false, healthCheckPath = "/api", healthCheckTimeoutMs = 6e4 } = options;
31
+ const handle = (url, status, expiresAt) => ({
32
+ url,
33
+ status,
34
+ expiresAt,
35
+ stop: async () => {
36
+ await sandbox.stop?.();
37
+ },
38
+ destroy: async () => {
39
+ await sandbox.destroy?.();
40
+ },
41
+ logs: async (lines) => require_shared.tailServerLog(sandbox, await require_shared.resolveRemoteDir(sandbox, options.remoteDir), lines)
42
+ });
43
+ if (!wake) {
44
+ const url = (0, _mastra_core_workspace.supportsNetworking)(sandbox) ? await sandbox.networking.getPortUrl(port) : null;
45
+ if (!url) return handle(null, "stopped");
46
+ return handle(url, await require_shared.waitForHealthy(url, {
47
+ path: healthCheckPath,
48
+ timeoutMs: 3e3,
49
+ intervalMs: 1e3
50
+ }) ? "running" : "stopped");
51
+ }
52
+ await sandbox.start?.();
53
+ if (!(0, _mastra_core_workspace.supportsNetworking)(sandbox)) throw new Error(`Sandbox provider "${sandbox.provider}" does not support networking (public port URLs).`);
54
+ const url = await sandbox.networking.getPortUrl(port);
55
+ if (!url) throw new Error(`Sandbox provider "${sandbox.provider}" did not expose a public URL for port ${port}. Make sure the port is declared when constructing the sandbox (e.g. \`ports: [${port}]\`).`);
56
+ let healthy = await require_shared.waitForHealthy(url, {
57
+ path: healthCheckPath,
58
+ timeoutMs: 3e3,
59
+ intervalMs: 1e3
60
+ });
61
+ if (!healthy) {
62
+ const remoteDir = await require_shared.resolveRemoteDir(sandbox, options.remoteDir);
63
+ await require_shared.killPreviousServer(sandbox, remoteDir);
64
+ await require_shared.launchServer(sandbox, remoteDir);
65
+ healthy = await require_shared.waitForHealthy(url, {
66
+ path: healthCheckPath,
67
+ timeoutMs: healthCheckTimeoutMs,
68
+ intervalMs: 1e3
69
+ });
70
+ }
71
+ if (!healthy) {
72
+ const log = await require_shared.resolveRemoteDir(sandbox, options.remoteDir).then((dir) => require_shared.tailServerLog(sandbox, dir)).catch(() => "");
73
+ throw new Error(`Woke sandbox but the Mastra server did not become healthy at ${url}${healthCheckPath}.` + (log ? `\n\nServer log:\n${log}` : ""));
74
+ }
75
+ return handle(url, "running", (await require_shared.getInfoSafe(sandbox))?.timeoutAt);
76
+ }
77
+ /**
78
+ * Framework-free route-handler proxy (fetch `Request` → `Response`). Mount it
79
+ * as a catch-all API route; the browser only ever sees your own domain, and
80
+ * the sandbox URL (which rotates across resumes) stays server-side.
81
+ */
82
+ function createSandboxHandler(options) {
83
+ assertServerOnly();
84
+ let cachedUrl = null;
85
+ const forward = async (request, baseUrl) => {
86
+ const incoming = new URL(request.url);
87
+ const target = new URL(incoming.pathname + incoming.search, baseUrl);
88
+ const headers = new Headers(request.headers);
89
+ headers.delete("host");
90
+ if (options.secret) headers.set("x-mastra-sandbox-secret", options.secret);
91
+ const response = await fetch(target, {
92
+ method: request.method,
93
+ headers,
94
+ body: request.body,
95
+ duplex: "half",
96
+ redirect: "manual"
97
+ });
98
+ const location = response.headers.get("location");
99
+ if (location) {
100
+ const resolved = new URL(location, target);
101
+ if (resolved.origin === new URL(baseUrl).origin) {
102
+ const rewritten = new URL(resolved.pathname + resolved.search + resolved.hash, incoming.origin);
103
+ const responseHeaders = new Headers(response.headers);
104
+ responseHeaders.set("location", rewritten.toString());
105
+ return new Response(response.body, {
106
+ status: response.status,
107
+ statusText: response.statusText,
108
+ headers: responseHeaders
109
+ });
110
+ }
111
+ }
112
+ return response;
113
+ };
114
+ return async (request) => {
115
+ cachedUrl ??= options.resolve();
116
+ try {
117
+ return await forward(request, await cachedUrl);
118
+ } catch (error) {
119
+ cachedUrl = null;
120
+ if (![
121
+ "GET",
122
+ "HEAD",
123
+ "OPTIONS"
124
+ ].includes(request.method)) throw error;
125
+ cachedUrl = options.resolve();
126
+ try {
127
+ return await forward(request, await cachedUrl);
128
+ } catch (retryError) {
129
+ cachedUrl = null;
130
+ throw retryError;
131
+ }
132
+ }
133
+ };
134
+ }
135
+ /**
136
+ * Next.js middleware helper for Tier 3 routing: reads the current sandbox URL
137
+ * from Edge Config (kept fresh by the deployer's `alias` option) and rewrites
138
+ * the request to it. Returns `undefined` when no URL is configured so the
139
+ * request falls through.
140
+ *
141
+ * ```typescript
142
+ * // middleware.ts
143
+ * export const middleware = createSandboxProxy({ key: 'my-preview' });
144
+ * export const config = { matcher: '/api/:path*' };
145
+ * ```
146
+ */
147
+ function createSandboxProxy(options) {
148
+ assertServerOnly();
149
+ return async (request) => {
150
+ const connection = options.edgeConfig ?? process.env.EDGE_CONFIG;
151
+ if (!connection) throw new Error("createSandboxProxy requires an Edge Config connection string (EDGE_CONFIG).");
152
+ const conn = new URL(connection);
153
+ const token = conn.searchParams.get("token");
154
+ const itemUrl = new URL(`${conn.origin}${conn.pathname}/item/${encodeURIComponent(options.key)}`);
155
+ const res = await fetch(itemUrl, { headers: { Authorization: `Bearer ${token}` } });
156
+ if (!res.ok) return;
157
+ const sandboxUrl = await res.json();
158
+ if (typeof sandboxUrl !== "string" || !sandboxUrl) return;
159
+ const incoming = new URL(request.url);
160
+ const target = new URL(incoming.pathname + incoming.search, sandboxUrl);
161
+ const headers = new Headers({ "x-middleware-rewrite": target.toString() });
162
+ if (options.secret) {
163
+ headers.set("x-middleware-request-x-mastra-sandbox-secret", options.secret);
164
+ headers.set("x-middleware-override-headers", "x-mastra-sandbox-secret");
165
+ }
166
+ return new Response(null, { headers });
167
+ };
168
+ }
169
+ //#endregion
170
+ exports.createSandboxHandler = createSandboxHandler;
171
+ exports.createSandboxProxy = createSandboxProxy;
172
+ exports.getDeployment = getDeployment;
173
+
174
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["DEFAULT_PORT","tailServerLog","resolveRemoteDir","waitForHealthy","killPreviousServer","launchServer","getInfoSafe"],"sources":["../../src/client/index.ts"],"sourcesContent":["/**\n * Runtime resolver + routing helpers for sandbox deployments.\n *\n * SERVER-ONLY. This module resolves sandbox URLs using provider credentials\n * (e.g. VERCEL_TOKEN) — importing it in the browser would ship those\n * credentials to the client. Use the proxy/handler patterns instead so the\n * browser only ever talks to your own domain.\n */\nimport { supportsNetworking } from '@mastra/core/workspace';\nimport type { WorkspaceSandbox } from '@mastra/core/workspace';\nimport {\n DEFAULT_PORT,\n getInfoSafe,\n killPreviousServer,\n launchServer,\n resolveRemoteDir,\n tailServerLog,\n waitForHealthy,\n} from '../shared';\n\nfunction assertServerOnly(): void {\n if (typeof (globalThis as { window?: unknown }).window !== 'undefined') {\n throw new Error(\n '@mastra/deployer-sandbox/client is server-only: resolving a sandbox requires provider credentials ' +\n 'that must never reach the browser. Proxy requests through your own backend instead ' +\n '(see createSandboxHandler / createSandboxProxy).',\n );\n }\n}\n\nexport type DeploymentStatus = 'running' | 'stopped' | 'unknown';\n\nexport interface GetDeploymentOptions {\n /**\n * The sandbox to resolve. Provider construction is identity — e.g.\n * `new VercelSandbox({ sandboxName: 'my-preview', ports: [4111] })` resolves\n * the same sandbox from any process.\n */\n sandbox: WorkspaceSandbox;\n /** Port the Mastra server listens on. Defaults to 4111. */\n port?: number;\n /**\n * Wake the sandbox when it is not running. Waking starts (resumes) the\n * sandbox and, only if the server is not answering, relaunches it from the\n * recorded launch script — some providers (e.g. E2B) resume processes on\n * wake, others (e.g. Vercel) restore just the filesystem. Defaults to false.\n */\n wake?: boolean;\n /** Directory the app was deployed into. Defaults to `$HOME/mastra-app` resolved inside the sandbox. */\n remoteDir?: string;\n /** Path polled for health. Defaults to `/api`. */\n healthCheckPath?: string;\n /** Max time to wait for health after a wake, in ms. Defaults to 60000. */\n healthCheckTimeoutMs?: number;\n}\n\nexport interface ResolvedDeployment {\n /** Public URL of the Mastra server, or null when it could not be resolved without waking. */\n url: string | null;\n status: DeploymentStatus;\n /** When the sandbox will auto-shutdown (when known). */\n expiresAt?: Date;\n stop(): Promise<void>;\n destroy(): Promise<void>;\n logs(lines?: number): Promise<string>;\n}\n\n/**\n * Resolve (and optionally wake) a sandbox deployment.\n *\n * With `wake: false` (default) the sandbox is not started: the URL is resolved\n * only if the sandbox is already running in this process, otherwise\n * `{ url: null, status: 'stopped' | 'unknown' }` is returned and the caller\n * decides whether to wake.\n *\n * With `wake: true` the sandbox is started (providers resume by identity,\n * e.g. name), the server is relaunched if it is not answering, and the\n * deployment is returned once healthy.\n */\nexport async function getDeployment(options: GetDeploymentOptions): Promise<ResolvedDeployment> {\n assertServerOnly();\n\n const {\n sandbox,\n port = DEFAULT_PORT,\n wake = false,\n healthCheckPath = '/api',\n healthCheckTimeoutMs = 60_000,\n } = options;\n\n const handle = (url: string | null, status: DeploymentStatus, expiresAt?: Date): ResolvedDeployment => ({\n url,\n status,\n expiresAt,\n stop: async () => {\n await sandbox.stop?.();\n },\n destroy: async () => {\n await sandbox.destroy?.();\n },\n // Resolved lazily — reading logs requires a running sandbox anyway.\n logs: async (lines?: number) => tailServerLog(sandbox, await resolveRemoteDir(sandbox, options.remoteDir), lines),\n });\n\n if (!wake) {\n // Resolve without starting the sandbox (starting can resume billing).\n const url = supportsNetworking(sandbox) ? await sandbox.networking.getPortUrl(port) : null;\n if (!url) {\n return handle(null, 'stopped');\n }\n const healthy = await waitForHealthy(url, { path: healthCheckPath, timeoutMs: 3_000, intervalMs: 1_000 });\n return handle(url, healthy ? 'running' : 'stopped');\n }\n\n await sandbox.start?.();\n\n if (!supportsNetworking(sandbox)) {\n throw new Error(`Sandbox provider \"${sandbox.provider}\" does not support networking (public port URLs).`);\n }\n const url = await sandbox.networking.getPortUrl(port);\n if (!url) {\n throw new Error(\n `Sandbox provider \"${sandbox.provider}\" did not expose a public URL for port ${port}. ` +\n `Make sure the port is declared when constructing the sandbox (e.g. \\`ports: [${port}]\\`).`,\n );\n }\n\n // Some providers (e.g. Vercel) restore the filesystem but not processes on\n // resume, while others (e.g. E2B) resume processes too — relaunch the server\n // from the recorded launch script only when it is not answering.\n let healthy = await waitForHealthy(url, { path: healthCheckPath, timeoutMs: 3_000, intervalMs: 1_000 });\n if (!healthy) {\n const remoteDir = await resolveRemoteDir(sandbox, options.remoteDir);\n await killPreviousServer(sandbox, remoteDir);\n await launchServer(sandbox, remoteDir);\n healthy = await waitForHealthy(url, { path: healthCheckPath, timeoutMs: healthCheckTimeoutMs, intervalMs: 1_000 });\n }\n if (!healthy) {\n const log = await resolveRemoteDir(sandbox, options.remoteDir)\n .then(dir => tailServerLog(sandbox, dir))\n .catch(() => '');\n throw new Error(\n `Woke sandbox but the Mastra server did not become healthy at ${url}${healthCheckPath}.` +\n (log ? `\\n\\nServer log:\\n${log}` : ''),\n );\n }\n\n const info = await getInfoSafe(sandbox);\n return handle(url, 'running', info?.timeoutAt);\n}\n\n// =============================================================================\n// Tier 3 helpers\n// =============================================================================\n\nexport interface CreateSandboxHandlerOptions {\n /**\n * Resolve the current sandbox URL. Called once, cached, and re-invoked when\n * a forwarded request fails at the network level (e.g. the sandbox rotated\n * its URL or went to sleep). Typically wraps `getDeployment`:\n *\n * ```typescript\n * createSandboxHandler({\n * resolve: async () => {\n * const dep = await getDeployment({ sandbox, wake: true });\n * return dep.url!;\n * },\n * });\n * ```\n */\n resolve: () => Promise<string>;\n /** Shared secret attached as the `x-mastra-sandbox-secret` header on forwarded requests. */\n secret?: string;\n}\n\n/**\n * Framework-free route-handler proxy (fetch `Request` → `Response`). Mount it\n * as a catch-all API route; the browser only ever sees your own domain, and\n * the sandbox URL (which rotates across resumes) stays server-side.\n */\nexport function createSandboxHandler(options: CreateSandboxHandlerOptions): (request: Request) => Promise<Response> {\n assertServerOnly();\n\n let cachedUrl: Promise<string> | null = null;\n\n const forward = async (request: Request, baseUrl: string): Promise<Response> => {\n const incoming = new URL(request.url);\n const target = new URL(incoming.pathname + incoming.search, baseUrl);\n\n const headers = new Headers(request.headers);\n headers.delete('host');\n if (options.secret) {\n headers.set('x-mastra-sandbox-secret', options.secret);\n }\n\n const response = await fetch(target, {\n method: request.method,\n headers,\n body: request.body,\n // duplex is required by Node's fetch for streamed request bodies\n duplex: 'half',\n redirect: 'manual',\n } as RequestInit);\n\n // Redirects are passed through manually — rewrite sandbox-host Locations\n // onto the incoming origin so the rotating sandbox URL never reaches the\n // browser (and subsequent requests keep flowing through this handler).\n const location = response.headers.get('location');\n if (location) {\n const resolved = new URL(location, target);\n if (resolved.origin === new URL(baseUrl).origin) {\n const rewritten = new URL(resolved.pathname + resolved.search + resolved.hash, incoming.origin);\n const responseHeaders = new Headers(response.headers);\n responseHeaders.set('location', rewritten.toString());\n return new Response(response.body, {\n status: response.status,\n statusText: response.statusText,\n headers: responseHeaders,\n });\n }\n }\n\n return response;\n };\n\n return async (request: Request): Promise<Response> => {\n cachedUrl ??= options.resolve();\n\n try {\n return await forward(request, await cachedUrl);\n } catch (error) {\n // Connection-level failure: the sandbox may have rotated its URL or gone\n // to sleep. Drop the cached URL so the next request re-resolves, and\n // retry once — but only for idempotent, bodyless methods. A failed\n // connection doesn't prove a write never landed, and a streamed body is\n // already consumed.\n cachedUrl = null;\n if (!['GET', 'HEAD', 'OPTIONS'].includes(request.method)) {\n throw error;\n }\n cachedUrl = options.resolve();\n try {\n return await forward(request, await cachedUrl);\n } catch (retryError) {\n cachedUrl = null;\n throw retryError;\n }\n }\n };\n}\n\nexport interface CreateSandboxProxyOptions {\n /** Edge Config item key that holds the current sandbox URL. */\n key: string;\n /**\n * Edge Config connection string (`https://edge-config.vercel.com/ecfg_...?token=...`).\n * Defaults to `process.env.EDGE_CONFIG`.\n */\n edgeConfig?: string;\n /** Shared secret attached as the `x-mastra-sandbox-secret` header on the rewrite. */\n secret?: string;\n}\n\n/**\n * Next.js middleware helper for Tier 3 routing: reads the current sandbox URL\n * from Edge Config (kept fresh by the deployer's `alias` option) and rewrites\n * the request to it. Returns `undefined` when no URL is configured so the\n * request falls through.\n *\n * ```typescript\n * // middleware.ts\n * export const middleware = createSandboxProxy({ key: 'my-preview' });\n * export const config = { matcher: '/api/:path*' };\n * ```\n */\nexport function createSandboxProxy(\n options: CreateSandboxProxyOptions,\n): (request: Request) => Promise<Response | undefined> {\n // Reads (and would transmit) the Edge Config bearer token — same\n // server-only contract as the rest of this module.\n assertServerOnly();\n\n return async (request: Request): Promise<Response | undefined> => {\n const connection = options.edgeConfig ?? process.env.EDGE_CONFIG;\n if (!connection) {\n throw new Error('createSandboxProxy requires an Edge Config connection string (EDGE_CONFIG).');\n }\n\n const conn = new URL(connection);\n const token = conn.searchParams.get('token');\n const itemUrl = new URL(`${conn.origin}${conn.pathname}/item/${encodeURIComponent(options.key)}`);\n\n const res = await fetch(itemUrl, { headers: { Authorization: `Bearer ${token}` } });\n if (!res.ok) {\n return undefined;\n }\n const sandboxUrl: unknown = await res.json();\n if (typeof sandboxUrl !== 'string' || !sandboxUrl) {\n return undefined;\n }\n\n const incoming = new URL(request.url);\n const target = new URL(incoming.pathname + incoming.search, sandboxUrl);\n\n // A Response with the x-middleware-rewrite header is how Next.js\n // middleware expresses a rewrite (NextResponse.rewrite does the same) —\n // this keeps the helper free of a next dependency.\n const headers = new Headers({ 'x-middleware-rewrite': target.toString() });\n if (options.secret) {\n headers.set('x-middleware-request-x-mastra-sandbox-secret', options.secret);\n headers.set('x-middleware-override-headers', 'x-mastra-sandbox-secret');\n }\n return new Response(null, { headers });\n };\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,SAAS,mBAAyB;CAChC,IAAI,OAAQ,WAAoC,WAAW,aACzD,MAAM,IAAI,MACR,uOAGF;AAEJ;;;;;;;;;;;;;AAmDA,eAAsB,cAAc,SAA4D;CAC9F,iBAAiB;CAEjB,MAAM,EACJ,SACA,OAAOA,eAAAA,cACP,OAAO,OACP,kBAAkB,QAClB,uBAAuB,QACrB;CAEJ,MAAM,UAAU,KAAoB,QAA0B,eAA0C;EACtG;EACA;EACA;EACA,MAAM,YAAY;GAChB,MAAM,QAAQ,OAAO;EACvB;EACA,SAAS,YAAY;GACnB,MAAM,QAAQ,UAAU;EAC1B;EAEA,MAAM,OAAO,UAAmBC,eAAAA,cAAc,SAAS,MAAMC,eAAAA,iBAAiB,SAAS,QAAQ,SAAS,GAAG,KAAK;CAClH;CAEA,IAAI,CAAC,MAAM;EAET,MAAM,OAAA,GAAA,uBAAA,mBAAA,CAAyB,OAAO,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;AACF;;;;;;;;;;;;;AA0BA,SAAgB,mBACd,SACqD;CAGrD,iBAAiB;CAEjB,OAAO,OAAO,YAAoD;EAChE,MAAM,aAAa,QAAQ,cAAc,QAAQ,IAAI;EACrD,IAAI,CAAC,YACH,MAAM,IAAI,MAAM,6EAA6E;EAG/F,MAAM,OAAO,IAAI,IAAI,UAAU;EAC/B,MAAM,QAAQ,KAAK,aAAa,IAAI,OAAO;EAC3C,MAAM,UAAU,IAAI,IAAI,GAAG,KAAK,SAAS,KAAK,SAAS,QAAQ,mBAAmB,QAAQ,GAAG,GAAG;EAEhG,MAAM,MAAM,MAAM,MAAM,SAAS,EAAE,SAAS,EAAE,eAAe,UAAU,QAAQ,EAAE,CAAC;EAClF,IAAI,CAAC,IAAI,IACP;EAEF,MAAM,aAAsB,MAAM,IAAI,KAAK;EAC3C,IAAI,OAAO,eAAe,YAAY,CAAC,YACrC;EAGF,MAAM,WAAW,IAAI,IAAI,QAAQ,GAAG;EACpC,MAAM,SAAS,IAAI,IAAI,SAAS,WAAW,SAAS,QAAQ,UAAU;EAKtE,MAAM,UAAU,IAAI,QAAQ,EAAE,wBAAwB,OAAO,SAAS,EAAE,CAAC;EACzE,IAAI,QAAQ,QAAQ;GAClB,QAAQ,IAAI,gDAAgD,QAAQ,MAAM;GAC1E,QAAQ,IAAI,iCAAiC,yBAAyB;EACxE;EACA,OAAO,IAAI,SAAS,MAAM,EAAE,QAAQ,CAAC;CACvC;AACF"}
@@ -0,0 +1,98 @@
1
+ import type { WorkspaceSandbox } from '@mastra/core/workspace';
2
+ export type DeploymentStatus = 'running' | 'stopped' | 'unknown';
3
+ export interface GetDeploymentOptions {
4
+ /**
5
+ * The sandbox to resolve. Provider construction is identity — e.g.
6
+ * `new VercelSandbox({ sandboxName: 'my-preview', ports: [4111] })` resolves
7
+ * the same sandbox from any process.
8
+ */
9
+ sandbox: WorkspaceSandbox;
10
+ /** Port the Mastra server listens on. Defaults to 4111. */
11
+ port?: number;
12
+ /**
13
+ * Wake the sandbox when it is not running. Waking starts (resumes) the
14
+ * sandbox and, only if the server is not answering, relaunches it from the
15
+ * recorded launch script — some providers (e.g. E2B) resume processes on
16
+ * wake, others (e.g. Vercel) restore just the filesystem. Defaults to false.
17
+ */
18
+ wake?: boolean;
19
+ /** Directory the app was deployed into. Defaults to `$HOME/mastra-app` resolved inside the sandbox. */
20
+ remoteDir?: string;
21
+ /** Path polled for health. Defaults to `/api`. */
22
+ healthCheckPath?: string;
23
+ /** Max time to wait for health after a wake, in ms. Defaults to 60000. */
24
+ healthCheckTimeoutMs?: number;
25
+ }
26
+ export interface ResolvedDeployment {
27
+ /** Public URL of the Mastra server, or null when it could not be resolved without waking. */
28
+ url: string | null;
29
+ status: DeploymentStatus;
30
+ /** When the sandbox will auto-shutdown (when known). */
31
+ expiresAt?: Date;
32
+ stop(): Promise<void>;
33
+ destroy(): Promise<void>;
34
+ logs(lines?: number): Promise<string>;
35
+ }
36
+ /**
37
+ * Resolve (and optionally wake) a sandbox deployment.
38
+ *
39
+ * With `wake: false` (default) the sandbox is not started: the URL is resolved
40
+ * only if the sandbox is already running in this process, otherwise
41
+ * `{ url: null, status: 'stopped' | 'unknown' }` is returned and the caller
42
+ * decides whether to wake.
43
+ *
44
+ * With `wake: true` the sandbox is started (providers resume by identity,
45
+ * e.g. name), the server is relaunched if it is not answering, and the
46
+ * deployment is returned once healthy.
47
+ */
48
+ export declare function getDeployment(options: GetDeploymentOptions): Promise<ResolvedDeployment>;
49
+ export interface CreateSandboxHandlerOptions {
50
+ /**
51
+ * Resolve the current sandbox URL. Called once, cached, and re-invoked when
52
+ * a forwarded request fails at the network level (e.g. the sandbox rotated
53
+ * its URL or went to sleep). Typically wraps `getDeployment`:
54
+ *
55
+ * ```typescript
56
+ * createSandboxHandler({
57
+ * resolve: async () => {
58
+ * const dep = await getDeployment({ sandbox, wake: true });
59
+ * return dep.url!;
60
+ * },
61
+ * });
62
+ * ```
63
+ */
64
+ resolve: () => Promise<string>;
65
+ /** Shared secret attached as the `x-mastra-sandbox-secret` header on forwarded requests. */
66
+ secret?: string;
67
+ }
68
+ /**
69
+ * Framework-free route-handler proxy (fetch `Request` → `Response`). Mount it
70
+ * as a catch-all API route; the browser only ever sees your own domain, and
71
+ * the sandbox URL (which rotates across resumes) stays server-side.
72
+ */
73
+ export declare function createSandboxHandler(options: CreateSandboxHandlerOptions): (request: Request) => Promise<Response>;
74
+ export interface CreateSandboxProxyOptions {
75
+ /** Edge Config item key that holds the current sandbox URL. */
76
+ key: string;
77
+ /**
78
+ * Edge Config connection string (`https://edge-config.vercel.com/ecfg_...?token=...`).
79
+ * Defaults to `process.env.EDGE_CONFIG`.
80
+ */
81
+ edgeConfig?: string;
82
+ /** Shared secret attached as the `x-mastra-sandbox-secret` header on the rewrite. */
83
+ secret?: string;
84
+ }
85
+ /**
86
+ * Next.js middleware helper for Tier 3 routing: reads the current sandbox URL
87
+ * from Edge Config (kept fresh by the deployer's `alias` option) and rewrites
88
+ * the request to it. Returns `undefined` when no URL is configured so the
89
+ * request falls through.
90
+ *
91
+ * ```typescript
92
+ * // middleware.ts
93
+ * export const middleware = createSandboxProxy({ key: 'my-preview' });
94
+ * export const config = { matcher: '/api/:path*' };
95
+ * ```
96
+ */
97
+ export declare function createSandboxProxy(options: CreateSandboxProxyOptions): (request: Request) => Promise<Response | undefined>;
98
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAqB/D,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAEjE,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,OAAO,EAAE,gBAAgB,CAAC;IAC1B,2DAA2D;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,IAAI,CAAC,E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,GAAG,SAAS,CAAC,CAqCrD"}
@@ -0,0 +1,171 @@
1
+ import { c as launchServer, f as tailServerLog, l as resolveRemoteDir, o as getInfoSafe, p as waitForHealthy, s as killPreviousServer, t as DEFAULT_PORT } from "../shared-MNp_lXYR.js";
2
+ import { supportsNetworking } from "@mastra/core/workspace";
3
+ //#region src/client/index.ts
4
+ /**
5
+ * Runtime resolver + routing helpers for sandbox deployments.
6
+ *
7
+ * SERVER-ONLY. This module resolves sandbox URLs using provider credentials
8
+ * (e.g. VERCEL_TOKEN) — importing it in the browser would ship those
9
+ * credentials to the client. Use the proxy/handler patterns instead so the
10
+ * browser only ever talks to your own domain.
11
+ */
12
+ function assertServerOnly() {
13
+ if (typeof globalThis.window !== "undefined") throw new Error("@mastra/deployer-sandbox/client is server-only: resolving a sandbox requires provider credentials that must never reach the browser. Proxy requests through your own backend instead (see createSandboxHandler / createSandboxProxy).");
14
+ }
15
+ /**
16
+ * Resolve (and optionally wake) a sandbox deployment.
17
+ *
18
+ * With `wake: false` (default) the sandbox is not started: the URL is resolved
19
+ * only if the sandbox is already running in this process, otherwise
20
+ * `{ url: null, status: 'stopped' | 'unknown' }` is returned and the caller
21
+ * decides whether to wake.
22
+ *
23
+ * With `wake: true` the sandbox is started (providers resume by identity,
24
+ * e.g. name), the server is relaunched if it is not answering, and the
25
+ * deployment is returned once healthy.
26
+ */
27
+ async function getDeployment(options) {
28
+ assertServerOnly();
29
+ const { sandbox, port = DEFAULT_PORT, wake = false, healthCheckPath = "/api", healthCheckTimeoutMs = 6e4 } = options;
30
+ const handle = (url, status, expiresAt) => ({
31
+ url,
32
+ status,
33
+ expiresAt,
34
+ stop: async () => {
35
+ await sandbox.stop?.();
36
+ },
37
+ destroy: async () => {
38
+ await sandbox.destroy?.();
39
+ },
40
+ logs: async (lines) => tailServerLog(sandbox, await resolveRemoteDir(sandbox, options.remoteDir), lines)
41
+ });
42
+ if (!wake) {
43
+ const url = supportsNetworking(sandbox) ? await sandbox.networking.getPortUrl(port) : null;
44
+ if (!url) return handle(null, "stopped");
45
+ return handle(url, await waitForHealthy(url, {
46
+ path: healthCheckPath,
47
+ timeoutMs: 3e3,
48
+ intervalMs: 1e3
49
+ }) ? "running" : "stopped");
50
+ }
51
+ await sandbox.start?.();
52
+ if (!supportsNetworking(sandbox)) throw new Error(`Sandbox provider "${sandbox.provider}" does not support networking (public port URLs).`);
53
+ const url = await sandbox.networking.getPortUrl(port);
54
+ if (!url) throw new Error(`Sandbox provider "${sandbox.provider}" did not expose a public URL for port ${port}. Make sure the port is declared when constructing the sandbox (e.g. \`ports: [${port}]\`).`);
55
+ let healthy = await waitForHealthy(url, {
56
+ path: healthCheckPath,
57
+ timeoutMs: 3e3,
58
+ intervalMs: 1e3
59
+ });
60
+ if (!healthy) {
61
+ const remoteDir = await resolveRemoteDir(sandbox, options.remoteDir);
62
+ await killPreviousServer(sandbox, remoteDir);
63
+ await launchServer(sandbox, remoteDir);
64
+ healthy = await waitForHealthy(url, {
65
+ path: healthCheckPath,
66
+ timeoutMs: healthCheckTimeoutMs,
67
+ intervalMs: 1e3
68
+ });
69
+ }
70
+ if (!healthy) {
71
+ const log = await resolveRemoteDir(sandbox, options.remoteDir).then((dir) => tailServerLog(sandbox, dir)).catch(() => "");
72
+ throw new Error(`Woke sandbox but the Mastra server did not become healthy at ${url}${healthCheckPath}.` + (log ? `\n\nServer log:\n${log}` : ""));
73
+ }
74
+ return handle(url, "running", (await getInfoSafe(sandbox))?.timeoutAt);
75
+ }
76
+ /**
77
+ * Framework-free route-handler proxy (fetch `Request` → `Response`). Mount it
78
+ * as a catch-all API route; the browser only ever sees your own domain, and
79
+ * the sandbox URL (which rotates across resumes) stays server-side.
80
+ */
81
+ function createSandboxHandler(options) {
82
+ assertServerOnly();
83
+ let cachedUrl = null;
84
+ const forward = async (request, baseUrl) => {
85
+ const incoming = new URL(request.url);
86
+ const target = new URL(incoming.pathname + incoming.search, baseUrl);
87
+ const headers = new Headers(request.headers);
88
+ headers.delete("host");
89
+ if (options.secret) headers.set("x-mastra-sandbox-secret", options.secret);
90
+ const response = await fetch(target, {
91
+ method: request.method,
92
+ headers,
93
+ body: request.body,
94
+ duplex: "half",
95
+ redirect: "manual"
96
+ });
97
+ const location = response.headers.get("location");
98
+ if (location) {
99
+ const resolved = new URL(location, target);
100
+ if (resolved.origin === new URL(baseUrl).origin) {
101
+ const rewritten = new URL(resolved.pathname + resolved.search + resolved.hash, incoming.origin);
102
+ const responseHeaders = new Headers(response.headers);
103
+ responseHeaders.set("location", rewritten.toString());
104
+ return new Response(response.body, {
105
+ status: response.status,
106
+ statusText: response.statusText,
107
+ headers: responseHeaders
108
+ });
109
+ }
110
+ }
111
+ return response;
112
+ };
113
+ return async (request) => {
114
+ cachedUrl ??= options.resolve();
115
+ try {
116
+ return await forward(request, await cachedUrl);
117
+ } catch (error) {
118
+ cachedUrl = null;
119
+ if (![
120
+ "GET",
121
+ "HEAD",
122
+ "OPTIONS"
123
+ ].includes(request.method)) throw error;
124
+ cachedUrl = options.resolve();
125
+ try {
126
+ return await forward(request, await cachedUrl);
127
+ } catch (retryError) {
128
+ cachedUrl = null;
129
+ throw retryError;
130
+ }
131
+ }
132
+ };
133
+ }
134
+ /**
135
+ * Next.js middleware helper for Tier 3 routing: reads the current sandbox URL
136
+ * from Edge Config (kept fresh by the deployer's `alias` option) and rewrites
137
+ * the request to it. Returns `undefined` when no URL is configured so the
138
+ * request falls through.
139
+ *
140
+ * ```typescript
141
+ * // middleware.ts
142
+ * export const middleware = createSandboxProxy({ key: 'my-preview' });
143
+ * export const config = { matcher: '/api/:path*' };
144
+ * ```
145
+ */
146
+ function createSandboxProxy(options) {
147
+ assertServerOnly();
148
+ return async (request) => {
149
+ const connection = options.edgeConfig ?? process.env.EDGE_CONFIG;
150
+ if (!connection) throw new Error("createSandboxProxy requires an Edge Config connection string (EDGE_CONFIG).");
151
+ const conn = new URL(connection);
152
+ const token = conn.searchParams.get("token");
153
+ const itemUrl = new URL(`${conn.origin}${conn.pathname}/item/${encodeURIComponent(options.key)}`);
154
+ const res = await fetch(itemUrl, { headers: { Authorization: `Bearer ${token}` } });
155
+ if (!res.ok) return;
156
+ const sandboxUrl = await res.json();
157
+ if (typeof sandboxUrl !== "string" || !sandboxUrl) return;
158
+ const incoming = new URL(request.url);
159
+ const target = new URL(incoming.pathname + incoming.search, sandboxUrl);
160
+ const headers = new Headers({ "x-middleware-rewrite": target.toString() });
161
+ if (options.secret) {
162
+ headers.set("x-middleware-request-x-mastra-sandbox-secret", options.secret);
163
+ headers.set("x-middleware-override-headers", "x-mastra-sandbox-secret");
164
+ }
165
+ return new Response(null, { headers });
166
+ };
167
+ }
168
+ //#endregion
169
+ export { createSandboxHandler, createSandboxProxy, getDeployment };
170
+
171
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/client/index.ts"],"sourcesContent":["/**\n * Runtime resolver + routing helpers for sandbox deployments.\n *\n * SERVER-ONLY. This module resolves sandbox URLs using provider credentials\n * (e.g. VERCEL_TOKEN) — importing it in the browser would ship those\n * credentials to the client. Use the proxy/handler patterns instead so the\n * browser only ever talks to your own domain.\n */\nimport { supportsNetworking } from '@mastra/core/workspace';\nimport type { WorkspaceSandbox } from '@mastra/core/workspace';\nimport {\n DEFAULT_PORT,\n getInfoSafe,\n killPreviousServer,\n launchServer,\n resolveRemoteDir,\n tailServerLog,\n waitForHealthy,\n} from '../shared';\n\nfunction assertServerOnly(): void {\n if (typeof (globalThis as { window?: unknown }).window !== 'undefined') {\n throw new Error(\n '@mastra/deployer-sandbox/client is server-only: resolving a sandbox requires provider credentials ' +\n 'that must never reach the browser. Proxy requests through your own backend instead ' +\n '(see createSandboxHandler / createSandboxProxy).',\n );\n }\n}\n\nexport type DeploymentStatus = 'running' | 'stopped' | 'unknown';\n\nexport interface GetDeploymentOptions {\n /**\n * The sandbox to resolve. Provider construction is identity — e.g.\n * `new VercelSandbox({ sandboxName: 'my-preview', ports: [4111] })` resolves\n * the same sandbox from any process.\n */\n sandbox: WorkspaceSandbox;\n /** Port the Mastra server listens on. Defaults to 4111. */\n port?: number;\n /**\n * Wake the sandbox when it is not running. Waking starts (resumes) the\n * sandbox and, only if the server is not answering, relaunches it from the\n * recorded launch script — some providers (e.g. E2B) resume processes on\n * wake, others (e.g. Vercel) restore just the filesystem. Defaults to false.\n */\n wake?: boolean;\n /** Directory the app was deployed into. Defaults to `$HOME/mastra-app` resolved inside the sandbox. */\n remoteDir?: string;\n /** Path polled for health. Defaults to `/api`. */\n healthCheckPath?: string;\n /** Max time to wait for health after a wake, in ms. Defaults to 60000. */\n healthCheckTimeoutMs?: number;\n}\n\nexport interface ResolvedDeployment {\n /** Public URL of the Mastra server, or null when it could not be resolved without waking. */\n url: string | null;\n status: DeploymentStatus;\n /** When the sandbox will auto-shutdown (when known). */\n expiresAt?: Date;\n stop(): Promise<void>;\n destroy(): Promise<void>;\n logs(lines?: number): Promise<string>;\n}\n\n/**\n * Resolve (and optionally wake) a sandbox deployment.\n *\n * With `wake: false` (default) the sandbox is not started: the URL is resolved\n * only if the sandbox is already running in this process, otherwise\n * `{ url: null, status: 'stopped' | 'unknown' }` is returned and the caller\n * decides whether to wake.\n *\n * With `wake: true` the sandbox is started (providers resume by identity,\n * e.g. name), the server is relaunched if it is not answering, and the\n * deployment is returned once healthy.\n */\nexport async function getDeployment(options: GetDeploymentOptions): Promise<ResolvedDeployment> {\n assertServerOnly();\n\n const {\n sandbox,\n port = DEFAULT_PORT,\n wake = false,\n healthCheckPath = '/api',\n healthCheckTimeoutMs = 60_000,\n } = options;\n\n const handle = (url: string | null, status: DeploymentStatus, expiresAt?: Date): ResolvedDeployment => ({\n url,\n status,\n expiresAt,\n stop: async () => {\n await sandbox.stop?.();\n },\n destroy: async () => {\n await sandbox.destroy?.();\n },\n // Resolved lazily — reading logs requires a running sandbox anyway.\n logs: async (lines?: number) => tailServerLog(sandbox, await resolveRemoteDir(sandbox, options.remoteDir), lines),\n });\n\n if (!wake) {\n // Resolve without starting the sandbox (starting can resume billing).\n const url = supportsNetworking(sandbox) ? await sandbox.networking.getPortUrl(port) : null;\n if (!url) {\n return handle(null, 'stopped');\n }\n const healthy = await waitForHealthy(url, { path: healthCheckPath, timeoutMs: 3_000, intervalMs: 1_000 });\n return handle(url, healthy ? 'running' : 'stopped');\n }\n\n await sandbox.start?.();\n\n if (!supportsNetworking(sandbox)) {\n throw new Error(`Sandbox provider \"${sandbox.provider}\" does not support networking (public port URLs).`);\n }\n const url = await sandbox.networking.getPortUrl(port);\n if (!url) {\n throw new Error(\n `Sandbox provider \"${sandbox.provider}\" did not expose a public URL for port ${port}. ` +\n `Make sure the port is declared when constructing the sandbox (e.g. \\`ports: [${port}]\\`).`,\n );\n }\n\n // Some providers (e.g. Vercel) restore the filesystem but not processes on\n // resume, while others (e.g. E2B) resume processes too — relaunch the server\n // from the recorded launch script only when it is not answering.\n let healthy = await waitForHealthy(url, { path: healthCheckPath, timeoutMs: 3_000, intervalMs: 1_000 });\n if (!healthy) {\n const remoteDir = await resolveRemoteDir(sandbox, options.remoteDir);\n await killPreviousServer(sandbox, remoteDir);\n await launchServer(sandbox, remoteDir);\n healthy = await waitForHealthy(url, { path: healthCheckPath, timeoutMs: healthCheckTimeoutMs, intervalMs: 1_000 });\n }\n if (!healthy) {\n const log = await resolveRemoteDir(sandbox, options.remoteDir)\n .then(dir => tailServerLog(sandbox, dir))\n .catch(() => '');\n throw new Error(\n `Woke sandbox but the Mastra server did not become healthy at ${url}${healthCheckPath}.` +\n (log ? `\\n\\nServer log:\\n${log}` : ''),\n );\n }\n\n const info = await getInfoSafe(sandbox);\n return handle(url, 'running', info?.timeoutAt);\n}\n\n// =============================================================================\n// Tier 3 helpers\n// =============================================================================\n\nexport interface CreateSandboxHandlerOptions {\n /**\n * Resolve the current sandbox URL. Called once, cached, and re-invoked when\n * a forwarded request fails at the network level (e.g. the sandbox rotated\n * its URL or went to sleep). Typically wraps `getDeployment`:\n *\n * ```typescript\n * createSandboxHandler({\n * resolve: async () => {\n * const dep = await getDeployment({ sandbox, wake: true });\n * return dep.url!;\n * },\n * });\n * ```\n */\n resolve: () => Promise<string>;\n /** Shared secret attached as the `x-mastra-sandbox-secret` header on forwarded requests. */\n secret?: string;\n}\n\n/**\n * Framework-free route-handler proxy (fetch `Request` → `Response`). Mount it\n * as a catch-all API route; the browser only ever sees your own domain, and\n * the sandbox URL (which rotates across resumes) stays server-side.\n */\nexport function createSandboxHandler(options: CreateSandboxHandlerOptions): (request: Request) => Promise<Response> {\n assertServerOnly();\n\n let cachedUrl: Promise<string> | null = null;\n\n const forward = async (request: Request, baseUrl: string): Promise<Response> => {\n const incoming = new URL(request.url);\n const target = new URL(incoming.pathname + incoming.search, baseUrl);\n\n const headers = new Headers(request.headers);\n headers.delete('host');\n if (options.secret) {\n headers.set('x-mastra-sandbox-secret', options.secret);\n }\n\n const response = await fetch(target, {\n method: request.method,\n headers,\n body: request.body,\n // duplex is required by Node's fetch for streamed request bodies\n duplex: 'half',\n redirect: 'manual',\n } as RequestInit);\n\n // Redirects are passed through manually — rewrite sandbox-host Locations\n // onto the incoming origin so the rotating sandbox URL never reaches the\n // browser (and subsequent requests keep flowing through this handler).\n const location = response.headers.get('location');\n if (location) {\n const resolved = new URL(location, target);\n if (resolved.origin === new URL(baseUrl).origin) {\n const rewritten = new URL(resolved.pathname + resolved.search + resolved.hash, incoming.origin);\n const responseHeaders = new Headers(response.headers);\n responseHeaders.set('location', rewritten.toString());\n return new Response(response.body, {\n status: response.status,\n statusText: response.statusText,\n headers: responseHeaders,\n });\n }\n }\n\n return response;\n };\n\n return async (request: Request): Promise<Response> => {\n cachedUrl ??= options.resolve();\n\n try {\n return await forward(request, await cachedUrl);\n } catch (error) {\n // Connection-level failure: the sandbox may have rotated its URL or gone\n // to sleep. Drop the cached URL so the next request re-resolves, and\n // retry once — but only for idempotent, bodyless methods. A failed\n // connection doesn't prove a write never landed, and a streamed body is\n // already consumed.\n cachedUrl = null;\n if (!['GET', 'HEAD', 'OPTIONS'].includes(request.method)) {\n throw error;\n }\n cachedUrl = options.resolve();\n try {\n return await forward(request, await cachedUrl);\n } catch (retryError) {\n cachedUrl = null;\n throw retryError;\n }\n }\n };\n}\n\nexport interface CreateSandboxProxyOptions {\n /** Edge Config item key that holds the current sandbox URL. */\n key: string;\n /**\n * Edge Config connection string (`https://edge-config.vercel.com/ecfg_...?token=...`).\n * Defaults to `process.env.EDGE_CONFIG`.\n */\n edgeConfig?: string;\n /** Shared secret attached as the `x-mastra-sandbox-secret` header on the rewrite. */\n secret?: string;\n}\n\n/**\n * Next.js middleware helper for Tier 3 routing: reads the current sandbox URL\n * from Edge Config (kept fresh by the deployer's `alias` option) and rewrites\n * the request to it. Returns `undefined` when no URL is configured so the\n * request falls through.\n *\n * ```typescript\n * // middleware.ts\n * export const middleware = createSandboxProxy({ key: 'my-preview' });\n * export const config = { matcher: '/api/:path*' };\n * ```\n */\nexport function createSandboxProxy(\n options: CreateSandboxProxyOptions,\n): (request: Request) => Promise<Response | undefined> {\n // Reads (and would transmit) the Edge Config bearer token — same\n // server-only contract as the rest of this module.\n assertServerOnly();\n\n return async (request: Request): Promise<Response | undefined> => {\n const connection = options.edgeConfig ?? process.env.EDGE_CONFIG;\n if (!connection) {\n throw new Error('createSandboxProxy requires an Edge Config connection string (EDGE_CONFIG).');\n }\n\n const conn = new URL(connection);\n const token = conn.searchParams.get('token');\n const itemUrl = new URL(`${conn.origin}${conn.pathname}/item/${encodeURIComponent(options.key)}`);\n\n const res = await fetch(itemUrl, { headers: { Authorization: `Bearer ${token}` } });\n if (!res.ok) {\n return undefined;\n }\n const sandboxUrl: unknown = await res.json();\n if (typeof sandboxUrl !== 'string' || !sandboxUrl) {\n return undefined;\n }\n\n const incoming = new URL(request.url);\n const target = new URL(incoming.pathname + incoming.search, sandboxUrl);\n\n // A Response with the x-middleware-rewrite header is how Next.js\n // middleware expresses a rewrite (NextResponse.rewrite does the same) —\n // this keeps the helper free of a next dependency.\n const headers = new Headers({ 'x-middleware-rewrite': target.toString() });\n if (options.secret) {\n headers.set('x-middleware-request-x-mastra-sandbox-secret', options.secret);\n headers.set('x-middleware-override-headers', 'x-mastra-sandbox-secret');\n }\n return new Response(null, { headers });\n };\n}\n"],"mappings":";;;;;;;;;;;AAoBA,SAAS,mBAAyB;CAChC,IAAI,OAAQ,WAAoC,WAAW,aACzD,MAAM,IAAI,MACR,uOAGF;AAEJ;;;;;;;;;;;;;AAmDA,eAAsB,cAAc,SAA4D;CAC9F,iBAAiB;CAEjB,MAAM,EACJ,SACA,OAAO,cACP,OAAO,OACP,kBAAkB,QAClB,uBAAuB,QACrB;CAEJ,MAAM,UAAU,KAAoB,QAA0B,eAA0C;EACtG;EACA;EACA;EACA,MAAM,YAAY;GAChB,MAAM,QAAQ,OAAO;EACvB;EACA,SAAS,YAAY;GACnB,MAAM,QAAQ,UAAU;EAC1B;EAEA,MAAM,OAAO,UAAmB,cAAc,SAAS,MAAM,iBAAiB,SAAS,QAAQ,SAAS,GAAG,KAAK;CAClH;CAEA,IAAI,CAAC,MAAM;EAET,MAAM,MAAM,mBAAmB,OAAO,IAAI,MAAM,QAAQ,WAAW,WAAW,IAAI,IAAI;EACtF,IAAI,CAAC,KACH,OAAO,OAAO,MAAM,SAAS;EAG/B,OAAO,OAAO,KAAK,MADG,eAAe,KAAK;GAAE,MAAM;GAAiB,WAAW;GAAO,YAAY;EAAM,CAAC,IAC3E,YAAY,SAAS;CACpD;CAEA,MAAM,QAAQ,QAAQ;CAEtB,IAAI,CAAC,mBAAmB,OAAO,GAC7B,MAAM,IAAI,MAAM,qBAAqB,QAAQ,SAAS,kDAAkD;CAE1G,MAAM,MAAM,MAAM,QAAQ,WAAW,WAAW,IAAI;CACpD,IAAI,CAAC,KACH,MAAM,IAAI,MACR,qBAAqB,QAAQ,SAAS,yCAAyC,KAAK,iFACF,KAAK,MACzF;CAMF,IAAI,UAAU,MAAM,eAAe,KAAK;EAAE,MAAM;EAAiB,WAAW;EAAO,Y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