alchemy 2.0.0-beta.62 → 2.0.0-beta.63

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 (489) hide show
  1. package/README.md +12 -12
  2. package/bin/exec.js +1959 -70
  3. package/bin/exec.js.map +1 -1
  4. package/lib/AWS/AuthProvider.js +1 -1
  5. package/lib/AWS/AuthProvider.js.map +1 -1
  6. package/lib/AWS/EC2/hosted.d.ts.map +1 -1
  7. package/lib/AWS/EC2/hosted.js +2 -1
  8. package/lib/AWS/EC2/hosted.js.map +1 -1
  9. package/lib/AWS/ECS/Task.d.ts.map +1 -1
  10. package/lib/AWS/ECS/Task.js +2 -1
  11. package/lib/AWS/ECS/Task.js.map +1 -1
  12. package/lib/AWS/Lambda/Function.d.ts.map +1 -1
  13. package/lib/AWS/Lambda/Function.js +13 -40
  14. package/lib/AWS/Lambda/Function.js.map +1 -1
  15. package/lib/AWS/Lambda/MicrovmRuntimeContext.d.ts.map +1 -1
  16. package/lib/AWS/Lambda/MicrovmRuntimeContext.js +9 -21
  17. package/lib/AWS/Lambda/MicrovmRuntimeContext.js.map +1 -1
  18. package/lib/Action.d.ts +8 -0
  19. package/lib/Action.d.ts.map +1 -1
  20. package/lib/Action.js +16 -5
  21. package/lib/Action.js.map +1 -1
  22. package/lib/ActionRuntimeContext.d.ts +14 -0
  23. package/lib/ActionRuntimeContext.d.ts.map +1 -0
  24. package/lib/ActionRuntimeContext.js +56 -0
  25. package/lib/ActionRuntimeContext.js.map +1 -0
  26. package/lib/Apply.d.ts.map +1 -1
  27. package/lib/Apply.js +40 -6
  28. package/lib/Apply.js.map +1 -1
  29. package/lib/Auth/AuthProvider.d.ts +3 -3
  30. package/lib/Auth/AuthProvider.d.ts.map +1 -1
  31. package/lib/Auth/AuthProvider.js +1 -1
  32. package/lib/Auth/AuthProvider.js.map +1 -1
  33. package/lib/Auth/Lock.d.ts.map +1 -1
  34. package/lib/Auth/Lock.js +5 -2
  35. package/lib/Auth/Lock.js.map +1 -1
  36. package/lib/Bundle/PurePlugin.d.ts.map +1 -1
  37. package/lib/Bundle/PurePlugin.js +26 -1
  38. package/lib/Bundle/PurePlugin.js.map +1 -1
  39. package/lib/Bundle/Vite.d.ts +2 -0
  40. package/lib/Bundle/Vite.d.ts.map +1 -1
  41. package/lib/Bundle/Vite.js +24 -1
  42. package/lib/Bundle/Vite.js.map +1 -1
  43. package/lib/Cli/LoggingCli.d.ts.map +1 -1
  44. package/lib/Cli/LoggingCli.js +7 -4
  45. package/lib/Cli/LoggingCli.js.map +1 -1
  46. package/lib/Cli/commands/_shared.d.ts +19 -0
  47. package/lib/Cli/commands/_shared.d.ts.map +1 -1
  48. package/lib/Cli/commands/_shared.js +22 -0
  49. package/lib/Cli/commands/_shared.js.map +1 -1
  50. package/lib/Cli/commands/login.d.ts +7 -3
  51. package/lib/Cli/commands/login.d.ts.map +1 -1
  52. package/lib/Cli/commands/login.js +70 -12
  53. package/lib/Cli/commands/login.js.map +1 -1
  54. package/lib/Cli/commands/profile.d.ts.map +1 -1
  55. package/lib/Cli/commands/profile.js +7 -20
  56. package/lib/Cli/commands/profile.js.map +1 -1
  57. package/lib/Cloudflare/AI/LanguageModel.js +21 -4
  58. package/lib/Cloudflare/AI/LanguageModel.js.map +1 -1
  59. package/lib/Cloudflare/AI/QuerySearchLocal.d.ts +37 -0
  60. package/lib/Cloudflare/AI/QuerySearchLocal.d.ts.map +1 -0
  61. package/lib/Cloudflare/AI/QuerySearchLocal.js +53 -0
  62. package/lib/Cloudflare/AI/QuerySearchLocal.js.map +1 -0
  63. package/lib/Cloudflare/AI/QuerySearchNamespaceLocal.d.ts +35 -0
  64. package/lib/Cloudflare/AI/QuerySearchNamespaceLocal.d.ts.map +1 -0
  65. package/lib/Cloudflare/AI/QuerySearchNamespaceLocal.js +47 -0
  66. package/lib/Cloudflare/AI/QuerySearchNamespaceLocal.js.map +1 -0
  67. package/lib/Cloudflare/AI/SearchHttpClient.d.ts +34 -0
  68. package/lib/Cloudflare/AI/SearchHttpClient.d.ts.map +1 -0
  69. package/lib/Cloudflare/AI/SearchHttpClient.js +262 -0
  70. package/lib/Cloudflare/AI/SearchHttpClient.js.map +1 -0
  71. package/lib/Cloudflare/AI/index.d.ts +2 -0
  72. package/lib/Cloudflare/AI/index.d.ts.map +1 -1
  73. package/lib/Cloudflare/AI/index.js +2 -0
  74. package/lib/Cloudflare/AI/index.js.map +1 -1
  75. package/lib/Cloudflare/Auth/AuthProvider.js +1 -1
  76. package/lib/Cloudflare/Auth/AuthProvider.js.map +1 -1
  77. package/lib/Cloudflare/Containers/ContainerBundle.d.ts.map +1 -1
  78. package/lib/Cloudflare/Containers/ContainerBundle.js +11 -1
  79. package/lib/Cloudflare/Containers/ContainerBundle.js.map +1 -1
  80. package/lib/Cloudflare/Containers/ContainerPlatform.d.ts.map +1 -1
  81. package/lib/Cloudflare/Containers/ContainerPlatform.js +12 -33
  82. package/lib/Cloudflare/Containers/ContainerPlatform.js.map +1 -1
  83. package/lib/Cloudflare/D1/QueryDatabaseHttpClient.d.ts +24 -0
  84. package/lib/Cloudflare/D1/QueryDatabaseHttpClient.d.ts.map +1 -0
  85. package/lib/Cloudflare/D1/QueryDatabaseHttpClient.js +106 -0
  86. package/lib/Cloudflare/D1/QueryDatabaseHttpClient.js.map +1 -0
  87. package/lib/Cloudflare/D1/QueryDatabaseLocal.d.ts +38 -0
  88. package/lib/Cloudflare/D1/QueryDatabaseLocal.d.ts.map +1 -0
  89. package/lib/Cloudflare/D1/QueryDatabaseLocal.js +54 -0
  90. package/lib/Cloudflare/D1/QueryDatabaseLocal.js.map +1 -0
  91. package/lib/Cloudflare/D1/index.d.ts +1 -0
  92. package/lib/Cloudflare/D1/index.d.ts.map +1 -1
  93. package/lib/Cloudflare/D1/index.js +1 -0
  94. package/lib/Cloudflare/D1/index.js.map +1 -1
  95. package/lib/Cloudflare/DNS/DnsHttp.d.ts +16 -1
  96. package/lib/Cloudflare/DNS/DnsHttp.d.ts.map +1 -1
  97. package/lib/Cloudflare/DNS/DnsHttp.js +6 -1
  98. package/lib/Cloudflare/DNS/DnsHttp.js.map +1 -1
  99. package/lib/Cloudflare/DNS/DnsLocal.d.ts +22 -0
  100. package/lib/Cloudflare/DNS/DnsLocal.d.ts.map +1 -0
  101. package/lib/Cloudflare/DNS/DnsLocal.js +31 -0
  102. package/lib/Cloudflare/DNS/DnsLocal.js.map +1 -0
  103. package/lib/Cloudflare/DNS/ReadDnsHttp.d.ts +3 -3
  104. package/lib/Cloudflare/DNS/ReadDnsHttp.d.ts.map +1 -1
  105. package/lib/Cloudflare/DNS/ReadDnsHttp.js +3 -4
  106. package/lib/Cloudflare/DNS/ReadDnsHttp.js.map +1 -1
  107. package/lib/Cloudflare/DNS/ReadDnsLocal.d.ts +32 -0
  108. package/lib/Cloudflare/DNS/ReadDnsLocal.d.ts.map +1 -0
  109. package/lib/Cloudflare/DNS/ReadDnsLocal.js +35 -0
  110. package/lib/Cloudflare/DNS/ReadDnsLocal.js.map +1 -0
  111. package/lib/Cloudflare/DNS/ReadWriteDnsHttp.d.ts +3 -3
  112. package/lib/Cloudflare/DNS/ReadWriteDnsHttp.d.ts.map +1 -1
  113. package/lib/Cloudflare/DNS/ReadWriteDnsHttp.js +4 -4
  114. package/lib/Cloudflare/DNS/ReadWriteDnsHttp.js.map +1 -1
  115. package/lib/Cloudflare/DNS/ReadWriteDnsLocal.d.ts +40 -0
  116. package/lib/Cloudflare/DNS/ReadWriteDnsLocal.d.ts.map +1 -0
  117. package/lib/Cloudflare/DNS/ReadWriteDnsLocal.js +43 -0
  118. package/lib/Cloudflare/DNS/ReadWriteDnsLocal.js.map +1 -0
  119. package/lib/Cloudflare/DNS/WriteDnsHttp.d.ts +3 -3
  120. package/lib/Cloudflare/DNS/WriteDnsHttp.d.ts.map +1 -1
  121. package/lib/Cloudflare/DNS/WriteDnsHttp.js +3 -4
  122. package/lib/Cloudflare/DNS/WriteDnsHttp.js.map +1 -1
  123. package/lib/Cloudflare/DNS/WriteDnsLocal.d.ts +38 -0
  124. package/lib/Cloudflare/DNS/WriteDnsLocal.d.ts.map +1 -0
  125. package/lib/Cloudflare/DNS/WriteDnsLocal.js +41 -0
  126. package/lib/Cloudflare/DNS/WriteDnsLocal.js.map +1 -0
  127. package/lib/Cloudflare/DNS/index.d.ts +3 -0
  128. package/lib/Cloudflare/DNS/index.d.ts.map +1 -1
  129. package/lib/Cloudflare/DNS/index.js +3 -0
  130. package/lib/Cloudflare/DNS/index.js.map +1 -1
  131. package/lib/Cloudflare/Flagship/ReadFlagsHttpClient.d.ts +27 -0
  132. package/lib/Cloudflare/Flagship/ReadFlagsHttpClient.d.ts.map +1 -0
  133. package/lib/Cloudflare/Flagship/ReadFlagsHttpClient.js +86 -0
  134. package/lib/Cloudflare/Flagship/ReadFlagsHttpClient.js.map +1 -0
  135. package/lib/Cloudflare/Flagship/ReadFlagsLocal.d.ts +41 -0
  136. package/lib/Cloudflare/Flagship/ReadFlagsLocal.d.ts.map +1 -0
  137. package/lib/Cloudflare/Flagship/ReadFlagsLocal.js +57 -0
  138. package/lib/Cloudflare/Flagship/ReadFlagsLocal.js.map +1 -0
  139. package/lib/Cloudflare/Flagship/index.d.ts +1 -0
  140. package/lib/Cloudflare/Flagship/index.d.ts.map +1 -1
  141. package/lib/Cloudflare/Flagship/index.js +1 -0
  142. package/lib/Cloudflare/Flagship/index.js.map +1 -1
  143. package/lib/Cloudflare/KV/NamespaceHttp.d.ts +16 -1
  144. package/lib/Cloudflare/KV/NamespaceHttp.d.ts.map +1 -1
  145. package/lib/Cloudflare/KV/NamespaceHttp.js +8 -2
  146. package/lib/Cloudflare/KV/NamespaceHttp.js.map +1 -1
  147. package/lib/Cloudflare/KV/NamespaceLocal.d.ts +22 -0
  148. package/lib/Cloudflare/KV/NamespaceLocal.d.ts.map +1 -0
  149. package/lib/Cloudflare/KV/NamespaceLocal.js +32 -0
  150. package/lib/Cloudflare/KV/NamespaceLocal.js.map +1 -0
  151. package/lib/Cloudflare/KV/ReadNamespaceHttp.d.ts +2 -2
  152. package/lib/Cloudflare/KV/ReadNamespaceHttp.d.ts.map +1 -1
  153. package/lib/Cloudflare/KV/ReadNamespaceHttp.js +5 -6
  154. package/lib/Cloudflare/KV/ReadNamespaceHttp.js.map +1 -1
  155. package/lib/Cloudflare/KV/ReadNamespaceLocal.d.ts +27 -0
  156. package/lib/Cloudflare/KV/ReadNamespaceLocal.d.ts.map +1 -0
  157. package/lib/Cloudflare/KV/ReadNamespaceLocal.js +30 -0
  158. package/lib/Cloudflare/KV/ReadNamespaceLocal.js.map +1 -0
  159. package/lib/Cloudflare/KV/ReadWriteNamespaceHttp.d.ts +3 -3
  160. package/lib/Cloudflare/KV/ReadWriteNamespaceHttp.d.ts.map +1 -1
  161. package/lib/Cloudflare/KV/ReadWriteNamespaceHttp.js +6 -6
  162. package/lib/Cloudflare/KV/ReadWriteNamespaceHttp.js.map +1 -1
  163. package/lib/Cloudflare/KV/ReadWriteNamespaceLocal.d.ts +34 -0
  164. package/lib/Cloudflare/KV/ReadWriteNamespaceLocal.d.ts.map +1 -0
  165. package/lib/Cloudflare/KV/ReadWriteNamespaceLocal.js +37 -0
  166. package/lib/Cloudflare/KV/ReadWriteNamespaceLocal.js.map +1 -0
  167. package/lib/Cloudflare/KV/WriteNamespaceHttp.d.ts +2 -2
  168. package/lib/Cloudflare/KV/WriteNamespaceHttp.d.ts.map +1 -1
  169. package/lib/Cloudflare/KV/WriteNamespaceHttp.js +5 -6
  170. package/lib/Cloudflare/KV/WriteNamespaceHttp.js.map +1 -1
  171. package/lib/Cloudflare/KV/WriteNamespaceLocal.d.ts +27 -0
  172. package/lib/Cloudflare/KV/WriteNamespaceLocal.d.ts.map +1 -0
  173. package/lib/Cloudflare/KV/WriteNamespaceLocal.js +30 -0
  174. package/lib/Cloudflare/KV/WriteNamespaceLocal.js.map +1 -0
  175. package/lib/Cloudflare/KV/index.d.ts +3 -0
  176. package/lib/Cloudflare/KV/index.d.ts.map +1 -1
  177. package/lib/Cloudflare/KV/index.js +3 -0
  178. package/lib/Cloudflare/KV/index.js.map +1 -1
  179. package/lib/Cloudflare/Queues/QueueHttp.d.ts +20 -1
  180. package/lib/Cloudflare/Queues/QueueHttp.d.ts.map +1 -1
  181. package/lib/Cloudflare/Queues/QueueHttp.js +2 -2
  182. package/lib/Cloudflare/Queues/QueueHttp.js.map +1 -1
  183. package/lib/Cloudflare/Queues/WriteQueueHttp.d.ts +9 -3
  184. package/lib/Cloudflare/Queues/WriteQueueHttp.d.ts.map +1 -1
  185. package/lib/Cloudflare/Queues/WriteQueueHttp.js +11 -6
  186. package/lib/Cloudflare/Queues/WriteQueueHttp.js.map +1 -1
  187. package/lib/Cloudflare/Queues/WriteQueueLocal.d.ts +36 -0
  188. package/lib/Cloudflare/Queues/WriteQueueLocal.d.ts.map +1 -0
  189. package/lib/Cloudflare/Queues/WriteQueueLocal.js +51 -0
  190. package/lib/Cloudflare/Queues/WriteQueueLocal.js.map +1 -0
  191. package/lib/Cloudflare/Queues/index.d.ts +1 -0
  192. package/lib/Cloudflare/Queues/index.d.ts.map +1 -1
  193. package/lib/Cloudflare/Queues/index.js +1 -0
  194. package/lib/Cloudflare/Queues/index.js.map +1 -1
  195. package/lib/Cloudflare/R2/BucketHttp.d.ts +15 -1
  196. package/lib/Cloudflare/R2/BucketHttp.d.ts.map +1 -1
  197. package/lib/Cloudflare/R2/BucketHttp.js +3 -3
  198. package/lib/Cloudflare/R2/BucketHttp.js.map +1 -1
  199. package/lib/Cloudflare/R2/BucketLocal.d.ts +21 -0
  200. package/lib/Cloudflare/R2/BucketLocal.d.ts.map +1 -0
  201. package/lib/Cloudflare/R2/BucketLocal.js +32 -0
  202. package/lib/Cloudflare/R2/BucketLocal.js.map +1 -0
  203. package/lib/Cloudflare/R2/ReadBucketHttp.d.ts +2 -2
  204. package/lib/Cloudflare/R2/ReadBucketHttp.d.ts.map +1 -1
  205. package/lib/Cloudflare/R2/ReadBucketHttp.js +4 -4
  206. package/lib/Cloudflare/R2/ReadBucketHttp.js.map +1 -1
  207. package/lib/Cloudflare/R2/ReadBucketLocal.d.ts +27 -0
  208. package/lib/Cloudflare/R2/ReadBucketLocal.d.ts.map +1 -0
  209. package/lib/Cloudflare/R2/ReadBucketLocal.js +30 -0
  210. package/lib/Cloudflare/R2/ReadBucketLocal.js.map +1 -0
  211. package/lib/Cloudflare/R2/ReadWriteBucketHttp.d.ts +2 -2
  212. package/lib/Cloudflare/R2/ReadWriteBucketHttp.d.ts.map +1 -1
  213. package/lib/Cloudflare/R2/ReadWriteBucketHttp.js +5 -4
  214. package/lib/Cloudflare/R2/ReadWriteBucketHttp.js.map +1 -1
  215. package/lib/Cloudflare/R2/ReadWriteBucketLocal.d.ts +30 -0
  216. package/lib/Cloudflare/R2/ReadWriteBucketLocal.d.ts.map +1 -0
  217. package/lib/Cloudflare/R2/ReadWriteBucketLocal.js +33 -0
  218. package/lib/Cloudflare/R2/ReadWriteBucketLocal.js.map +1 -0
  219. package/lib/Cloudflare/R2/WriteBucketHttp.d.ts +2 -2
  220. package/lib/Cloudflare/R2/WriteBucketHttp.d.ts.map +1 -1
  221. package/lib/Cloudflare/R2/WriteBucketHttp.js +4 -4
  222. package/lib/Cloudflare/R2/WriteBucketHttp.js.map +1 -1
  223. package/lib/Cloudflare/R2/WriteBucketLocal.d.ts +27 -0
  224. package/lib/Cloudflare/R2/WriteBucketLocal.d.ts.map +1 -0
  225. package/lib/Cloudflare/R2/WriteBucketLocal.js +30 -0
  226. package/lib/Cloudflare/R2/WriteBucketLocal.js.map +1 -0
  227. package/lib/Cloudflare/R2/index.d.ts +3 -0
  228. package/lib/Cloudflare/R2/index.d.ts.map +1 -1
  229. package/lib/Cloudflare/R2/index.js +3 -0
  230. package/lib/Cloudflare/R2/index.js.map +1 -1
  231. package/lib/Cloudflare/StateStore/Api.d.ts +2 -0
  232. package/lib/Cloudflare/Tunnel/ReadTunnel.d.ts +3 -3
  233. package/lib/Cloudflare/Tunnel/ReadTunnel.d.ts.map +1 -1
  234. package/lib/Cloudflare/Tunnel/ReadTunnel.js +7 -8
  235. package/lib/Cloudflare/Tunnel/ReadTunnel.js.map +1 -1
  236. package/lib/Cloudflare/Tunnel/ReadTunnelLocal.d.ts +29 -0
  237. package/lib/Cloudflare/Tunnel/ReadTunnelLocal.d.ts.map +1 -0
  238. package/lib/Cloudflare/Tunnel/ReadTunnelLocal.js +30 -0
  239. package/lib/Cloudflare/Tunnel/ReadTunnelLocal.js.map +1 -0
  240. package/lib/Cloudflare/Tunnel/ReadWriteTunnel.d.ts +3 -3
  241. package/lib/Cloudflare/Tunnel/ReadWriteTunnel.d.ts.map +1 -1
  242. package/lib/Cloudflare/Tunnel/ReadWriteTunnel.js +4 -4
  243. package/lib/Cloudflare/Tunnel/ReadWriteTunnel.js.map +1 -1
  244. package/lib/Cloudflare/Tunnel/ReadWriteTunnelLocal.d.ts +35 -0
  245. package/lib/Cloudflare/Tunnel/ReadWriteTunnelLocal.d.ts.map +1 -0
  246. package/lib/Cloudflare/Tunnel/ReadWriteTunnelLocal.js +36 -0
  247. package/lib/Cloudflare/Tunnel/ReadWriteTunnelLocal.js.map +1 -0
  248. package/lib/Cloudflare/Tunnel/TunnelBinding.d.ts +17 -1
  249. package/lib/Cloudflare/Tunnel/TunnelBinding.d.ts.map +1 -1
  250. package/lib/Cloudflare/Tunnel/TunnelBinding.js +7 -1
  251. package/lib/Cloudflare/Tunnel/TunnelBinding.js.map +1 -1
  252. package/lib/Cloudflare/Tunnel/TunnelLocalBinding.d.ts +19 -0
  253. package/lib/Cloudflare/Tunnel/TunnelLocalBinding.d.ts.map +1 -0
  254. package/lib/Cloudflare/Tunnel/TunnelLocalBinding.js +29 -0
  255. package/lib/Cloudflare/Tunnel/TunnelLocalBinding.js.map +1 -0
  256. package/lib/Cloudflare/Tunnel/WarpConnector.d.ts +3 -3
  257. package/lib/Cloudflare/Tunnel/WarpConnector.d.ts.map +1 -1
  258. package/lib/Cloudflare/Tunnel/WarpConnector.js +7 -4
  259. package/lib/Cloudflare/Tunnel/WarpConnector.js.map +1 -1
  260. package/lib/Cloudflare/Tunnel/WriteTunnel.d.ts +3 -3
  261. package/lib/Cloudflare/Tunnel/WriteTunnel.d.ts.map +1 -1
  262. package/lib/Cloudflare/Tunnel/WriteTunnel.js +7 -8
  263. package/lib/Cloudflare/Tunnel/WriteTunnel.js.map +1 -1
  264. package/lib/Cloudflare/Tunnel/WriteTunnelLocal.d.ts +29 -0
  265. package/lib/Cloudflare/Tunnel/WriteTunnelLocal.d.ts.map +1 -0
  266. package/lib/Cloudflare/Tunnel/WriteTunnelLocal.js +30 -0
  267. package/lib/Cloudflare/Tunnel/WriteTunnelLocal.js.map +1 -0
  268. package/lib/Cloudflare/Tunnel/index.d.ts +3 -0
  269. package/lib/Cloudflare/Tunnel/index.d.ts.map +1 -1
  270. package/lib/Cloudflare/Tunnel/index.js +3 -0
  271. package/lib/Cloudflare/Tunnel/index.js.map +1 -1
  272. package/lib/Cloudflare/Vectorize/SearchIndexHttpClient.d.ts +30 -0
  273. package/lib/Cloudflare/Vectorize/SearchIndexHttpClient.d.ts.map +1 -0
  274. package/lib/Cloudflare/Vectorize/SearchIndexHttpClient.js +100 -0
  275. package/lib/Cloudflare/Vectorize/SearchIndexHttpClient.js.map +1 -0
  276. package/lib/Cloudflare/Vectorize/SearchIndexLocal.d.ts +42 -0
  277. package/lib/Cloudflare/Vectorize/SearchIndexLocal.d.ts.map +1 -0
  278. package/lib/Cloudflare/Vectorize/SearchIndexLocal.js +58 -0
  279. package/lib/Cloudflare/Vectorize/SearchIndexLocal.js.map +1 -0
  280. package/lib/Cloudflare/Vectorize/index.d.ts +1 -0
  281. package/lib/Cloudflare/Vectorize/index.d.ts.map +1 -1
  282. package/lib/Cloudflare/Vectorize/index.js +1 -0
  283. package/lib/Cloudflare/Vectorize/index.js.map +1 -1
  284. package/lib/Cloudflare/Workers/BrowserHttpClient.d.ts +32 -0
  285. package/lib/Cloudflare/Workers/BrowserHttpClient.d.ts.map +1 -0
  286. package/lib/Cloudflare/Workers/BrowserHttpClient.js +100 -0
  287. package/lib/Cloudflare/Workers/BrowserHttpClient.js.map +1 -0
  288. package/lib/Cloudflare/Workers/BrowserLocal.d.ts +37 -0
  289. package/lib/Cloudflare/Workers/BrowserLocal.d.ts.map +1 -0
  290. package/lib/Cloudflare/Workers/BrowserLocal.js +53 -0
  291. package/lib/Cloudflare/Workers/BrowserLocal.js.map +1 -0
  292. package/lib/Cloudflare/Workers/ConfigProvider.d.ts +8 -0
  293. package/lib/Cloudflare/Workers/ConfigProvider.d.ts.map +1 -1
  294. package/lib/Cloudflare/Workers/ConfigProvider.js +10 -1
  295. package/lib/Cloudflare/Workers/ConfigProvider.js.map +1 -1
  296. package/lib/Cloudflare/Workers/DurableObject.d.ts +137 -3
  297. package/lib/Cloudflare/Workers/DurableObject.d.ts.map +1 -1
  298. package/lib/Cloudflare/Workers/DurableObject.js +141 -6
  299. package/lib/Cloudflare/Workers/DurableObject.js.map +1 -1
  300. package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts +2 -185
  301. package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts.map +1 -1
  302. package/lib/Cloudflare/Workers/Vite.d.ts.map +1 -1
  303. package/lib/Cloudflare/Workers/Vite.js +81 -2
  304. package/lib/Cloudflare/Workers/Vite.js.map +1 -1
  305. package/lib/Cloudflare/Workers/Worker.d.ts +15 -1
  306. package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
  307. package/lib/Cloudflare/Workers/Worker.js.map +1 -1
  308. package/lib/Cloudflare/Workers/WorkerAsyncBindings.d.ts.map +1 -1
  309. package/lib/Cloudflare/Workers/WorkerAsyncBindings.js +2 -1
  310. package/lib/Cloudflare/Workers/WorkerAsyncBindings.js.map +1 -1
  311. package/lib/Cloudflare/Workers/WorkerBinding.d.ts +22 -1
  312. package/lib/Cloudflare/Workers/WorkerBinding.d.ts.map +1 -1
  313. package/lib/Cloudflare/Workers/WorkerBinding.js.map +1 -1
  314. package/lib/Cloudflare/Workers/WorkerBridge.d.ts.map +1 -1
  315. package/lib/Cloudflare/Workers/WorkerBridge.js +7 -2
  316. package/lib/Cloudflare/Workers/WorkerBridge.js.map +1 -1
  317. package/lib/Cloudflare/Workers/WorkerProvider.d.ts +81 -0
  318. package/lib/Cloudflare/Workers/WorkerProvider.d.ts.map +1 -1
  319. package/lib/Cloudflare/Workers/WorkerProvider.js +450 -61
  320. package/lib/Cloudflare/Workers/WorkerProvider.js.map +1 -1
  321. package/lib/Cloudflare/Workers/WorkerRuntimeContext.d.ts.map +1 -1
  322. package/lib/Cloudflare/Workers/WorkerRuntimeContext.js +11 -37
  323. package/lib/Cloudflare/Workers/WorkerRuntimeContext.js.map +1 -1
  324. package/lib/Cloudflare/Workers/index.d.ts +1 -0
  325. package/lib/Cloudflare/Workers/index.d.ts.map +1 -1
  326. package/lib/Cloudflare/Workers/index.js +1 -0
  327. package/lib/Cloudflare/Workers/index.js.map +1 -1
  328. package/lib/Diff.d.ts +16 -0
  329. package/lib/Diff.d.ts.map +1 -1
  330. package/lib/Diff.js +33 -0
  331. package/lib/Diff.js.map +1 -1
  332. package/lib/GitHub/Secrets.d.ts +1 -1
  333. package/lib/GitHub/Secrets.js +1 -1
  334. package/lib/GitHub/Variables.d.ts +1 -1
  335. package/lib/GitHub/Variables.js +1 -1
  336. package/lib/Local/RpcSerialization.d.ts.map +1 -1
  337. package/lib/Local/RpcSerialization.js +6 -2
  338. package/lib/Local/RpcSerialization.js.map +1 -1
  339. package/lib/Local/RpcSpawner.d.ts.map +1 -1
  340. package/lib/Local/RpcSpawner.js +14 -8
  341. package/lib/Local/RpcSpawner.js.map +1 -1
  342. package/lib/Neon/AuthProvider.js +1 -1
  343. package/lib/Neon/AuthProvider.js.map +1 -1
  344. package/lib/Plan.d.ts.map +1 -1
  345. package/lib/Plan.js +11 -4
  346. package/lib/Plan.js.map +1 -1
  347. package/lib/Planetscale/Database.d.ts +2 -1
  348. package/lib/Planetscale/Database.d.ts.map +1 -1
  349. package/lib/Planetscale/MySQL/MySQLClusterSize.d.ts +41 -3
  350. package/lib/Planetscale/MySQL/MySQLClusterSize.d.ts.map +1 -1
  351. package/lib/Planetscale/MySQL/MySQLClusterSize.js +88 -11
  352. package/lib/Planetscale/MySQL/MySQLClusterSize.js.map +1 -1
  353. package/lib/Planetscale/MySQL/MySQLDatabase.d.ts +14 -0
  354. package/lib/Planetscale/MySQL/MySQLDatabase.d.ts.map +1 -1
  355. package/lib/Planetscale/MySQL/MySQLDatabase.js +24 -11
  356. package/lib/Planetscale/MySQL/MySQLDatabase.js.map +1 -1
  357. package/lib/Platform.d.ts.map +1 -1
  358. package/lib/Platform.js +11 -1
  359. package/lib/Platform.js.map +1 -1
  360. package/lib/Runtime.d.ts +23 -0
  361. package/lib/Runtime.d.ts.map +1 -1
  362. package/lib/Runtime.js +83 -0
  363. package/lib/Runtime.js.map +1 -1
  364. package/lib/RuntimeContext.d.ts +46 -0
  365. package/lib/RuntimeContext.d.ts.map +1 -1
  366. package/lib/RuntimeContext.js +60 -0
  367. package/lib/RuntimeContext.js.map +1 -1
  368. package/lib/Server/Process.d.ts +1 -1
  369. package/lib/Server/Process.d.ts.map +1 -1
  370. package/lib/Server/Process.js +8 -8
  371. package/lib/Server/Process.js.map +1 -1
  372. package/lib/Stack.js +1 -1
  373. package/lib/Stack.js.map +1 -1
  374. package/lib/State/HttpStateApi.d.ts +10 -10
  375. package/lib/Test/Alchemy.d.ts +74 -0
  376. package/lib/Test/Alchemy.d.ts.map +1 -0
  377. package/lib/Test/Alchemy.js +143 -0
  378. package/lib/Test/Alchemy.js.map +1 -0
  379. package/lib/Util/cached-function.d.ts +1 -1
  380. package/lib/Util/cached-function.d.ts.map +1 -1
  381. package/lib/Util/cached-function.js +2 -2
  382. package/lib/Util/cached-function.js.map +1 -1
  383. package/lib/Util/proxy-chain.js +3 -0
  384. package/lib/Util/proxy-chain.js.map +1 -1
  385. package/package.json +10 -10
  386. package/src/AWS/AuthProvider.ts +1 -1
  387. package/src/AWS/EC2/hosted.ts +2 -1
  388. package/src/AWS/ECS/Task.ts +2 -1
  389. package/src/AWS/Lambda/Function.ts +13 -47
  390. package/src/AWS/Lambda/MicrovmRuntimeContext.ts +11 -38
  391. package/src/Action.ts +39 -6
  392. package/src/ActionRuntimeContext.ts +68 -0
  393. package/src/Apply.ts +46 -8
  394. package/src/Auth/AuthProvider.ts +1 -1
  395. package/src/Auth/Lock.ts +5 -2
  396. package/src/Bundle/PurePlugin.ts +34 -1
  397. package/src/Bundle/Vite.ts +51 -1
  398. package/src/Cli/LoggingCli.ts +7 -4
  399. package/src/Cli/commands/_shared.ts +52 -0
  400. package/src/Cli/commands/login.ts +90 -14
  401. package/src/Cli/commands/profile.ts +7 -41
  402. package/src/Cloudflare/AI/LanguageModel.ts +25 -5
  403. package/src/Cloudflare/AI/QuerySearchLocal.ts +66 -0
  404. package/src/Cloudflare/AI/QuerySearchNamespaceLocal.ts +60 -0
  405. package/src/Cloudflare/AI/SearchHttpClient.ts +423 -0
  406. package/src/Cloudflare/AI/index.ts +2 -0
  407. package/src/Cloudflare/Auth/AuthProvider.ts +1 -1
  408. package/src/Cloudflare/Containers/ContainerBundle.ts +11 -1
  409. package/src/Cloudflare/Containers/ContainerPlatform.ts +14 -52
  410. package/src/Cloudflare/D1/QueryDatabaseHttpClient.ts +176 -0
  411. package/src/Cloudflare/D1/QueryDatabaseLocal.ts +66 -0
  412. package/src/Cloudflare/D1/index.ts +1 -0
  413. package/src/Cloudflare/DNS/DnsHttp.ts +24 -2
  414. package/src/Cloudflare/DNS/DnsLocal.ts +41 -0
  415. package/src/Cloudflare/DNS/ReadDnsHttp.ts +4 -5
  416. package/src/Cloudflare/DNS/ReadDnsLocal.ts +38 -0
  417. package/src/Cloudflare/DNS/ReadWriteDnsHttp.ts +5 -5
  418. package/src/Cloudflare/DNS/ReadWriteDnsLocal.ts +46 -0
  419. package/src/Cloudflare/DNS/WriteDnsHttp.ts +4 -5
  420. package/src/Cloudflare/DNS/WriteDnsLocal.ts +44 -0
  421. package/src/Cloudflare/DNS/index.ts +3 -0
  422. package/src/Cloudflare/Flagship/ReadFlagsHttpClient.ts +183 -0
  423. package/src/Cloudflare/Flagship/ReadFlagsLocal.ts +69 -0
  424. package/src/Cloudflare/Flagship/index.ts +1 -0
  425. package/src/Cloudflare/KV/NamespaceHttp.ts +25 -2
  426. package/src/Cloudflare/KV/NamespaceLocal.ts +42 -0
  427. package/src/Cloudflare/KV/ReadNamespaceHttp.ts +7 -6
  428. package/src/Cloudflare/KV/ReadNamespaceLocal.ts +35 -0
  429. package/src/Cloudflare/KV/ReadWriteNamespaceHttp.ts +11 -6
  430. package/src/Cloudflare/KV/ReadWriteNamespaceLocal.ts +42 -0
  431. package/src/Cloudflare/KV/WriteNamespaceHttp.ts +7 -6
  432. package/src/Cloudflare/KV/WriteNamespaceLocal.ts +35 -0
  433. package/src/Cloudflare/KV/index.ts +3 -0
  434. package/src/Cloudflare/Queues/QueueHttp.ts +24 -2
  435. package/src/Cloudflare/Queues/WriteQueueHttp.ts +16 -7
  436. package/src/Cloudflare/Queues/WriteQueueLocal.ts +64 -0
  437. package/src/Cloudflare/Queues/index.ts +1 -0
  438. package/src/Cloudflare/R2/BucketHttp.ts +20 -3
  439. package/src/Cloudflare/R2/BucketLocal.ts +47 -0
  440. package/src/Cloudflare/R2/ReadBucketHttp.ts +10 -5
  441. package/src/Cloudflare/R2/ReadBucketLocal.ts +33 -0
  442. package/src/Cloudflare/R2/ReadWriteBucketHttp.ts +11 -5
  443. package/src/Cloudflare/R2/ReadWriteBucketLocal.ts +36 -0
  444. package/src/Cloudflare/R2/WriteBucketHttp.ts +10 -5
  445. package/src/Cloudflare/R2/WriteBucketLocal.ts +33 -0
  446. package/src/Cloudflare/R2/index.ts +3 -0
  447. package/src/Cloudflare/Tunnel/ReadTunnel.ts +8 -9
  448. package/src/Cloudflare/Tunnel/ReadTunnelLocal.ts +33 -0
  449. package/src/Cloudflare/Tunnel/ReadWriteTunnel.ts +5 -5
  450. package/src/Cloudflare/Tunnel/ReadWriteTunnelLocal.ts +39 -0
  451. package/src/Cloudflare/Tunnel/TunnelBinding.ts +26 -2
  452. package/src/Cloudflare/Tunnel/TunnelLocalBinding.ts +38 -0
  453. package/src/Cloudflare/Tunnel/WarpConnector.ts +8 -5
  454. package/src/Cloudflare/Tunnel/WriteTunnel.ts +8 -9
  455. package/src/Cloudflare/Tunnel/WriteTunnelLocal.ts +33 -0
  456. package/src/Cloudflare/Tunnel/index.ts +3 -0
  457. package/src/Cloudflare/Vectorize/SearchIndexHttpClient.ts +183 -0
  458. package/src/Cloudflare/Vectorize/SearchIndexLocal.ts +70 -0
  459. package/src/Cloudflare/Vectorize/index.ts +1 -0
  460. package/src/Cloudflare/Workers/BrowserHttpClient.ts +201 -0
  461. package/src/Cloudflare/Workers/BrowserLocal.ts +65 -0
  462. package/src/Cloudflare/Workers/ConfigProvider.ts +15 -1
  463. package/src/Cloudflare/Workers/DurableObject.ts +227 -6
  464. package/src/Cloudflare/Workers/Vite.ts +93 -11
  465. package/src/Cloudflare/Workers/Worker.ts +19 -1
  466. package/src/Cloudflare/Workers/WorkerAsyncBindings.ts +6 -5
  467. package/src/Cloudflare/Workers/WorkerBinding.ts +20 -1
  468. package/src/Cloudflare/Workers/WorkerBridge.ts +12 -2
  469. package/src/Cloudflare/Workers/WorkerProvider.ts +664 -117
  470. package/src/Cloudflare/Workers/WorkerRuntimeContext.ts +14 -45
  471. package/src/Cloudflare/Workers/index.ts +1 -0
  472. package/src/Diff.ts +33 -0
  473. package/src/GitHub/Secrets.ts +1 -1
  474. package/src/GitHub/Variables.ts +1 -1
  475. package/src/Local/RpcSerialization.ts +6 -2
  476. package/src/Local/RpcSpawner.ts +21 -8
  477. package/src/Neon/AuthProvider.ts +1 -1
  478. package/src/Plan.ts +17 -4
  479. package/src/Planetscale/Database.ts +2 -1
  480. package/src/Planetscale/MySQL/MySQLClusterSize.ts +120 -21
  481. package/src/Planetscale/MySQL/MySQLDatabase.ts +84 -44
  482. package/src/Platform.ts +12 -3
  483. package/src/Runtime.ts +92 -0
  484. package/src/RuntimeContext.ts +79 -0
  485. package/src/Server/Process.ts +11 -18
  486. package/src/Stack.ts +1 -1
  487. package/src/Test/Alchemy.ts +282 -0
  488. package/src/Util/cached-function.ts +5 -5
  489. package/src/Util/proxy-chain.ts +3 -0
@@ -0,0 +1,65 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Layer from "effect/Layer";
3
+ import type * as HttpClient from "effect/unstable/http/HttpClient";
4
+ import { CloudflareEnvironment } from "../CloudflareEnvironment.ts";
5
+ import type { Credentials } from "../Credentials.ts";
6
+ import { Browser } from "./Browser.ts";
7
+ import type { BrowserBinding } from "./BrowserBinding.ts";
8
+ import {
9
+ type BrowserAuth,
10
+ makeHttpBrowserClient,
11
+ } from "./BrowserHttpClient.ts";
12
+
13
+ /**
14
+ * Local implementation of the {@link Browser} binding — drives Cloudflare
15
+ * Browser Rendering over its REST data-plane (`/accounts/{id}/browser-rendering/*`)
16
+ * using the **current credentials** instead of a native Worker binding
17
+ * (`BrowserBinding`).
18
+ *
19
+ * Provide it on an {@link Action} (or any deploy-time Effect) to run the JSON
20
+ * quick actions — `content`, `markdown`, `scrape`, `links`, `snapshot`,
21
+ * `json` — with the same client you'd use inside a Worker; no Worker host, no
22
+ * `host.bind`, no minted token:
23
+ *
24
+ * @example Convert a page to Markdown from an Action
25
+ * ```typescript
26
+ * const Scrape = Alchemy.Action(
27
+ * "Scrape",
28
+ * Effect.gen(function* () {
29
+ * const browser = yield* Cloudflare.Browser("BROWSER");
30
+ * return Effect.fn(function* () {
31
+ * const { result } = yield* browser.markdown({
32
+ * url: "https://example.com",
33
+ * });
34
+ * return result;
35
+ * });
36
+ * }).pipe(Effect.provide(Cloudflare.Workers.BrowserLocal)),
37
+ * );
38
+ * ```
39
+ *
40
+ * `raw`, `fetch`, and the binary actions (`screenshot`/`pdf`) have no
41
+ * Cloudflare REST equivalent and die — see {@link makeHttpBrowserClient}.
42
+ */
43
+ export const BrowserLocal = Layer.effect(
44
+ Browser,
45
+ Effect.gen(function* () {
46
+ // Account + credentials are ambient during stack-eval (the stack's
47
+ // providers layer). Capture the full context so the REST ops run with the
48
+ // current credentials — no `host.bind`, no minted token.
49
+ const { accountId } = yield* yield* CloudflareEnvironment;
50
+ const context = yield* Effect.context<
51
+ Credentials | HttpClient.HttpClient
52
+ >();
53
+ const auth: BrowserAuth = {
54
+ authorize: (eff) => eff.pipe(Effect.provideContext(context)),
55
+ accountId,
56
+ };
57
+
58
+ return Effect.fn(function* (_binding: BrowserBinding) {
59
+ // Browser Rendering is account-scoped; the binding carries no cloud
60
+ // resource id, so nothing to resolve — the client only needs the account
61
+ // + injected auth.
62
+ return makeHttpBrowserClient(auth);
63
+ });
64
+ }),
65
+ );
@@ -1,9 +1,23 @@
1
1
  import * as ConfigProvider from "effect/ConfigProvider";
2
2
  import * as Effect from "effect/Effect";
3
3
 
4
+ import { reifyBoundConfigProvider } from "../../Runtime.ts";
4
5
  import cloudflare_workers from "./cloudflare_workers.ts";
5
6
 
7
+ /**
8
+ * A `ConfigProvider` backed by the running Worker's environment.
9
+ *
10
+ * Values that were auto-bound by the deploy-time `Config` interceptor
11
+ * arrive in the env as `{"_tag":"Redacted","value":...}` markers; they are
12
+ * reified back to their raw source value before `Config` schemas decode
13
+ * them, matching the provider the Worker bridge installs by default.
14
+ */
6
15
  export const WorkerConfigProvider = () =>
7
16
  cloudflare_workers.pipe(
8
- Effect.map(({ env }) => ConfigProvider.fromUnknown(env)),
17
+ Effect.map(({ env }) =>
18
+ reifyBoundConfigProvider(
19
+ ConfigProvider.fromUnknown(env),
20
+ env as Record<string, unknown>,
21
+ ),
22
+ ),
9
23
  );
@@ -22,7 +22,12 @@ import {
22
22
  } from "./DurableObjectState.ts";
23
23
  import { makeRpcStub } from "./Rpc.ts";
24
24
  import { type WebSocket } from "./WebSocket.ts";
25
- import { Worker, WorkerEnvironment, type WorkerServices } from "./Worker.ts";
25
+ import {
26
+ isWorker,
27
+ Worker,
28
+ WorkerEnvironment,
29
+ type WorkerServices,
30
+ } from "./Worker.ts";
26
31
 
27
32
  export interface DurableObjectExport {
28
33
  readonly kind: "durableObject";
@@ -62,6 +67,8 @@ export interface DurableObjectLike<Shape = any> {
62
67
  /** @internal phantom */
63
68
  scriptName?: Input<string>;
64
69
  /** @internal phantom */
70
+ transferredFrom?: DurableObjectTransferSource | DurableObjectTransferSource[];
71
+ /** @internal phantom */
65
72
  Shape?: Shape;
66
73
  }
67
74
 
@@ -108,6 +115,98 @@ export type DurableObjectServices =
108
115
  | WorkerEnvironment
109
116
  | PlatformServices;
110
117
 
118
+ /**
119
+ * A reference to the Worker that previously hosted a Durable Object class,
120
+ * accepted by {@link DurableObjectProps.transferredFrom}:
121
+ *
122
+ * - the Worker's **logical id** (same stack + stage) or **physical script
123
+ * name** (cross-stack) as a string
124
+ * - the Worker **resource** (`const b = yield* Cloudflare.Worker(...)`)
125
+ * - the Worker **class** (`transferredFrom: WorkerA`)
126
+ * - a **thunk** of any of the above (`() => WorkerA`) — use this for
127
+ * forward references and import cycles; it is evaluated lazily at plan
128
+ * time, after all modules have loaded
129
+ * - a string `Output` (e.g. a cross-stack `stackRef`'s worker name)
130
+ *
131
+ * Every form is normalized at plan time to a plain identifier: a Worker
132
+ * reference contributes its logical id, and a same-stack `workerName`
133
+ * Output contributes its source resource's logical id rather than the
134
+ * Output itself. Keeping the former host's *value* out of the binding data
135
+ * matters — consuming its Output would add a dependency edge from the new
136
+ * host onto the former host, inverting the deploy order the transfer
137
+ * requires (the new host must upload first).
138
+ */
139
+ export type DurableObjectTransferSource =
140
+ | Input<string>
141
+ | Worker
142
+ | Effect.Effect<Worker, any, any>
143
+ | (() => DurableObjectTransferSource);
144
+
145
+ const resolveTransferSourceRef = (
146
+ source: DurableObjectTransferSource,
147
+ depth = 0,
148
+ ): Input<string> => {
149
+ if (typeof source === "string") {
150
+ return source;
151
+ }
152
+ // A Worker resource — contribute its logical id.
153
+ if (isWorker(source)) {
154
+ return source.LogicalId;
155
+ }
156
+ // A Worker platform class — carries its logical id statically. (On an
157
+ // Output proxy this property access yields another Output, never a
158
+ // string, so the check cannot misfire there.)
159
+ const logicalId = (source as { LogicalId?: unknown }).LogicalId;
160
+ if (typeof logicalId === "string") {
161
+ return logicalId;
162
+ }
163
+ // A same-stack Output on a Worker (e.g. `b.workerName`): take the
164
+ // identity from its provenance, not the value.
165
+ if (Output.isPropExpr(source)) {
166
+ const expr = (source as Output.PropExpr<any, any>).expr;
167
+ if (Output.isResourceExpr(expr) && isWorker(expr.src)) {
168
+ return expr.src.LogicalId;
169
+ }
170
+ }
171
+ if (Output.isResourceExpr(source) && isWorker(source.src)) {
172
+ return source.src.LogicalId;
173
+ }
174
+ if (Output.isOutput(source)) {
175
+ // No local resource to take identity from (e.g. a cross-stack
176
+ // `stackRef`) — the engine resolves the string at deploy time.
177
+ return source as Input<string>;
178
+ }
179
+ if (typeof source === "function" && depth < 8) {
180
+ return resolveTransferSourceRef(
181
+ (source as () => DurableObjectTransferSource)(),
182
+ depth + 1,
183
+ );
184
+ }
185
+ throw new Error(
186
+ "Invalid transferredFrom entry: pass the former host's logical id or script name, its Worker class or resource, a thunk of one of those, or a string Output.",
187
+ );
188
+ };
189
+
190
+ /**
191
+ * Normalize a `transferredFrom` declaration to plain host identifiers at
192
+ * plan time. See {@link DurableObjectTransferSource} for the accepted forms
193
+ * and why Worker references reduce to logical ids instead of Outputs.
194
+ *
195
+ * @internal
196
+ */
197
+ export const normalizeTransferredFrom = (
198
+ value:
199
+ | DurableObjectTransferSource
200
+ | readonly DurableObjectTransferSource[]
201
+ | undefined,
202
+ ): Input<string>[] | undefined =>
203
+ value === undefined
204
+ ? undefined
205
+ : (Array.isArray(value)
206
+ ? (value as readonly DurableObjectTransferSource[])
207
+ : [value as DurableObjectTransferSource]
208
+ ).map((source) => resolveTransferSourceRef(source));
209
+
111
210
  export interface DurableObjectProps {
112
211
  /**
113
212
  * Name of the exported `DurableObject` class.
@@ -120,6 +219,31 @@ export interface DurableObjectProps {
120
219
  * namespace is hosted by the Worker that declares the binding.
121
220
  */
122
221
  scriptName?: Input<string> | undefined;
222
+ /**
223
+ * The Worker(s) that previously hosted this Durable Object class. When one
224
+ * of them still holds the namespace, the deploy performs Cloudflare's
225
+ * data-preserving `transferred_classes` migration, moving the namespace —
226
+ * including all stored objects — from that script to this Worker.
227
+ *
228
+ * Each entry names a former host — see
229
+ * {@link DurableObjectTransferSource} for the accepted forms: a string
230
+ * (Worker logical id in this stack + stage, or physical script name for
231
+ * cross-stack moves), the Worker class or resource itself, or a thunk
232
+ * (`() => WorkerA`) for forward references. Moving a class is always
233
+ * declared this way — there is no inference. A list is a host *history*:
234
+ * as the class moves again, append the previous host so stages that lag
235
+ * behind (or skipped an intermediate release) still transfer from
236
+ * wherever their namespace currently lives.
237
+ *
238
+ * When no listed host holds the namespace — a fresh stage, or every
239
+ * transfer already completed — the property is inert and the class is
240
+ * created fresh (or left as-is), so it is safe to leave in place
241
+ * indefinitely.
242
+ */
243
+ transferredFrom?:
244
+ | DurableObjectTransferSource
245
+ | DurableObjectTransferSource[]
246
+ | undefined;
123
247
  // environment?: string | undefined;
124
248
  // sqlite?: boolean | undefined;
125
249
  // namespaceId?: string | undefined;
@@ -133,6 +257,7 @@ export interface DurableObjectClass extends Effect.Effect<
133
257
  <Self, Shape>(): {
134
258
  <Name extends string>(
135
259
  name: Name,
260
+ props?: Pick<DurableObjectProps, "transferredFrom">,
136
261
  ): Effect.Effect<DurableObject<Self>, never, Worker | Self> & {
137
262
  new (_: never): Shape & {
138
263
  /** @internal */
@@ -787,6 +912,85 @@ export class DurableObjectScope extends Context.Service<
787
912
  * });
788
913
  * ```
789
914
  *
915
+ * @section Moving a Class Between Workers
916
+ * A Durable Object class can move from one Worker to another with its
917
+ * data intact. The move is always **declared** — a class that disappears
918
+ * from one worker and appears on another is otherwise ambiguous between
919
+ * "transfer the data" and "delete it, start fresh", so Alchemy never
920
+ * guesses (removing a DO deletes it; that is the default). Declare
921
+ * `transferredFrom` on the Durable Object at its **new host**, naming the
922
+ * former host, and the new host's deploy ships Cloudflare's
923
+ * data-preserving `transferred_classes` migration. The former host's
924
+ * deploy converges on its own — no delete migration is emitted for a
925
+ * class that moved away.
926
+ *
927
+ * Each `transferredFrom` entry is either the former host's Worker
928
+ * **logical id** (same stack + stage, resolved via alchemy's ownership
929
+ * tags) or its **physical script name** (required for cross-stack moves).
930
+ * When no listed host holds the namespace — a fresh stage, or the
931
+ * transfer already completed — the declaration is inert, so it is safe to
932
+ * leave in place indefinitely.
933
+ *
934
+ * @example Move a class from WorkerB to WorkerA
935
+ * ```typescript
936
+ * // BEFORE: worker-b hosts the class
937
+ * const b = yield* Cloudflare.Worker("WorkerB", {
938
+ * main: "./src/worker-b.ts", // exports MyDOClass
939
+ * bindings: {
940
+ * MyDO: Cloudflare.DurableObject("MyDO", { className: "MyDOClass" }),
941
+ * },
942
+ * });
943
+ *
944
+ * // AFTER: worker-a hosts it and declares where it came from;
945
+ * // worker-b keeps a cross-script reference.
946
+ * const a = yield* Cloudflare.Worker("WorkerA", {
947
+ * main: "./src/worker-a.ts", // now exports MyDOClass
948
+ * bindings: {
949
+ * MyDO: Cloudflare.DurableObject("MyDO", {
950
+ * className: "MyDOClass",
951
+ * transferredFrom: "WorkerB", // logical id (or its script name)
952
+ * }),
953
+ * },
954
+ * });
955
+ * const b = yield* Cloudflare.Worker("WorkerB", {
956
+ * main: "./src/worker-b.ts", // no longer exports MyDOClass
957
+ * bindings: {
958
+ * MyDO: Cloudflare.DurableObject("MyDO", {
959
+ * className: "MyDOClass",
960
+ * scriptName: a.workerName,
961
+ * }),
962
+ * },
963
+ * });
964
+ * ```
965
+ *
966
+ * Forgetting the declaration is safe: when the former host still
967
+ * references the class cross-script, its deploy fails before any upload
968
+ * with `DurableObjectTransferRequired`, telling you exactly what to
969
+ * declare — data is never silently destroyed or forked.
970
+ *
971
+ * @example Chained moves keep the host history
972
+ * ```typescript
973
+ * // The class moved WorkerB → WorkerA last release and WorkerA →
974
+ * // WorkerC this release. Keep the full history so a stage that lagged
975
+ * // behind (or skipped the intermediate release) still transfers from
976
+ * // wherever its namespace currently lives.
977
+ * Cloudflare.DurableObject("MyDO", {
978
+ * className: "MyDOClass",
979
+ * transferredFrom: ["WorkerB", "WorkerA"],
980
+ * })
981
+ * ```
982
+ *
983
+ * Two rules for multi-worker migrations:
984
+ *
985
+ * - **Pure moves (the former host drops the DO entirely, keeping no
986
+ * cross-script reference) must be two deploys**: first add the class to
987
+ * the new host with `transferredFrom` and deploy; then remove it from
988
+ * the former host and deploy. In a single deploy nothing orders the
989
+ * transfer before the former host's delete.
990
+ * - **Cross-stack moves deploy the new host's stack first**, naming the
991
+ * former host by physical script name; the former host's stack deploys
992
+ * after and converges.
993
+ *
790
994
  * @section Adopting an Existing Durable Object
791
995
  * When you adopt a Worker that already exists on Cloudflare — created
792
996
  * outside Alchemy via Wrangler, the dashboard, or the raw API — its
@@ -796,7 +1000,8 @@ export class DurableObjectScope extends Context.Service<
796
1000
  * a worker with no Alchemy ownership tags as `Unowned`.
797
1001
  *
798
1002
  * Alchemy normally tracks which class backs each binding through an
799
- * `alchemy:do:<logicalId>:<className>` tag it writes on the script. A
1003
+ * `alchemy:dos:` metadata tag it writes on the script (mapping each
1004
+ * binding's logical id to its class name). A
800
1005
  * foreign worker has no such tag, so on the **adopting deploy** Alchemy
801
1006
  * falls back to matching your binding to the live class **by binding
802
1007
  * name**. The class is then reused in place — not recreated — so
@@ -807,7 +1012,7 @@ export class DurableObjectScope extends Context.Service<
807
1012
  * binding's `className` must match the class that already exists on the
808
1013
  * worker.** You cannot rename the class in the same deploy that adopts
809
1014
  * it. Once the deploy completes, Alchemy owns the worker and has written
810
- * the `alchemy:do:` tag, so subsequent renames are driven by logical id
1015
+ * the `alchemy:dos:` tag, so subsequent renames are driven by logical id
811
1016
  * and work normally.
812
1017
  *
813
1018
  * @example Adopting a worker whose `Counter` class already exists
@@ -868,18 +1073,23 @@ export const DurableObject: DurableObjectClass = taggedFunction(
868
1073
  const propsOrImpl = args[1];
869
1074
  const tag = Context.Service(namespace);
870
1075
 
871
- const binding = (scriptName?: Input<string>) =>
1076
+ const binding = (
1077
+ scriptName?: Input<string>,
1078
+ transferredFrom?:
1079
+ | DurableObjectTransferSource
1080
+ | DurableObjectTransferSource[],
1081
+ ) =>
872
1082
  Effect.gen(function* () {
873
1083
  const worker = yield* Worker;
874
1084
 
875
1085
  yield* worker.bind`${namespace}`({
876
- // TODO(sam): automate class migrations, probably in the provider
877
1086
  bindings: [
878
1087
  {
879
1088
  type: "durable_object_namespace",
880
1089
  name: namespace,
881
1090
  className: namespace,
882
1091
  scriptName,
1092
+ transferredFrom: normalizeTransferredFrom(transferredFrom),
883
1093
  },
884
1094
  ],
885
1095
  });
@@ -932,6 +1142,16 @@ export const DurableObject: DurableObjectClass = taggedFunction(
932
1142
  };
933
1143
  });
934
1144
 
1145
+ // Class-form declarations (`DurableObject<Self>()("Name", props?)`) can
1146
+ // carry `transferredFrom` so the host's local binding drives a
1147
+ // data-preserving transfer migration.
1148
+ const classProps =
1149
+ isClassForm && !Effect.isEffect(propsOrImpl)
1150
+ ? (propsOrImpl as
1151
+ | Pick<DurableObjectProps, "transferredFrom">
1152
+ | undefined)
1153
+ : undefined;
1154
+
935
1155
  const make = Effect.fn(function* (
936
1156
  impl: Effect.Effect<
937
1157
  Effect.Effect<DurableObjectShape>,
@@ -944,7 +1164,7 @@ export const DurableObject: DurableObjectClass = taggedFunction(
944
1164
  // `DurableObjectScope` to the user's constructor effect
945
1165
  // and also return it so a `Layer.effect(tag, make(impl))` Layer
946
1166
  // resolves the tag to a concrete namespace value.
947
- const self = yield* binding();
1167
+ const self = yield* binding(undefined, classProps?.transferredFrom);
948
1168
  const phase = yield* ALCHEMY_PHASE;
949
1169
  const constructor = impl.pipe(
950
1170
  Effect.provide(Layer.succeed(DurableObjectScope, self as any)),
@@ -979,6 +1199,7 @@ export const DurableObject: DurableObjectClass = taggedFunction(
979
1199
  name: namespace,
980
1200
  className: (args[1] as DurableObjectProps)?.className || namespace,
981
1201
  scriptName: (args[1] as DurableObjectProps)?.scriptName,
1202
+ transferredFrom: (args[1] as DurableObjectProps)?.transferredFrom,
982
1203
  };
983
1204
  } else if (Effect.isEffect(propsOrImpl)) {
984
1205
  // inline Effect DO
@@ -1,6 +1,7 @@
1
1
  import cloudflare, {
2
2
  type CloudflareVitePluginOptions,
3
3
  } from "@distilled.cloud/cloudflare-vite-plugin";
4
+ import * as ConsoleService from "effect/Console";
4
5
  import * as Effect from "effect/Effect";
5
6
  import * as Redacted from "effect/Redacted";
6
7
  import { createRequire } from "node:module";
@@ -9,6 +10,73 @@ import { pathToFileURL } from "node:url";
9
10
  import type * as vite from "vite";
10
11
  import { viteBuildOutputPlugin } from "../../Bundle/Vite.ts";
11
12
 
13
+ /**
14
+ * Route Vite's logger through the ambient Effect `Console` service instead of
15
+ * its default stdout logger. Under the CLI this is the global console
16
+ * (identical output); under environments that override the Console — e.g.
17
+ * alchemy-test's per-test buffering console — the build output is captured
18
+ * with the test instead of leaking to the terminal.
19
+ */
20
+ const makeViteLogger = (console: ConsoleService.Console): vite.Logger => {
21
+ const loggedErrors = new WeakSet<object>();
22
+ let hasWarned = false;
23
+ return {
24
+ info: (msg) => console.log(msg),
25
+ warn: (msg) => {
26
+ hasWarned = true;
27
+ console.warn(msg);
28
+ },
29
+ warnOnce: (msg) => {
30
+ hasWarned = true;
31
+ console.warn(msg);
32
+ },
33
+ error: (msg, options) => {
34
+ if (options?.error != null) loggedErrors.add(options.error);
35
+ console.error(msg);
36
+ },
37
+ clearScreen: () => {},
38
+ hasErrorLogged: (error) => loggedErrors.has(error),
39
+ get hasWarned() {
40
+ return hasWarned;
41
+ },
42
+ };
43
+ };
44
+
45
+ /**
46
+ * Signals to the app's own Vite config that Alchemy is injecting its
47
+ * resource-aware Cloudflare plugin into this build/dev run.
48
+ *
49
+ * Apps that also build standalone (plain `vite build` in CI, no Alchemy)
50
+ * need the Cloudflare plugin in their `vite.config.ts`. Without a guard,
51
+ * an Alchemy-orchestrated run instantiates that config-file instance
52
+ * *alongside* the injected one: two same-named plugin stacks whose
53
+ * cross-plugin API lookups resolve by name, and — in dev — two workerd
54
+ * runtimes, only one of which carries the Worker's bindings. Guarding on
55
+ * this variable lets the config-file instance stand down:
56
+ *
57
+ * ```ts
58
+ * // vite.config.ts
59
+ * process.env.ALCHEMY_CLOUDFLARE_VITE_INJECTED === "1"
60
+ * ? null
61
+ * : cloudflare({ ... })
62
+ * ```
63
+ *
64
+ * The variable is set process-locally by `viteDev`/`viteBuild`, so it is
65
+ * correct regardless of which process hosts Vite (`alchemy dev` runs the
66
+ * dev server in the spawned local-provider host, not in the process that
67
+ * evaluates the user's alchemy.run.ts — an env variable set there never
68
+ * reaches the config).
69
+ *
70
+ * Contract: the value is `"1"` while the process is Alchemy-orchestrated;
71
+ * absence means not injected. It is deliberately never unset — Vite
72
+ * re-evaluates the app config on dev-server restarts long after
73
+ * `viteDev` returned, and concurrent `viteBuild`s in one process would
74
+ * race a save/restore. A process that ran an Alchemy build never also
75
+ * runs a standalone (non-Alchemy) Vite build, so the flag staying set is
76
+ * correct for the process lifetime.
77
+ */
78
+ const ALCHEMY_CLOUDFLARE_VITE_INJECTED = "ALCHEMY_CLOUDFLARE_VITE_INJECTED";
79
+
12
80
  export const viteDev = (
13
81
  rootDir: string = process.cwd(),
14
82
  env: Record<string, unknown>,
@@ -16,17 +84,21 @@ export const viteDev = (
16
84
  serverOptions: vite.ServerOptions,
17
85
  ) =>
18
86
  Effect.acquireRelease(
19
- Effect.promise(async () => {
20
- const vite = await loadVite(rootDir);
21
- const devServer = await vite.createServer({
22
- root: rootDir,
23
- define: getDefine(env),
24
- plugins: [cloudflare(pluginOptions)],
25
- server: serverOptions,
26
- });
27
- await devServer.listen();
28
- return devServer;
29
- }),
87
+ ConsoleService.consoleWith((console) =>
88
+ Effect.promise(async () => {
89
+ process.env[ALCHEMY_CLOUDFLARE_VITE_INJECTED] = "1";
90
+ const vite = await loadVite(rootDir);
91
+ const devServer = await vite.createServer({
92
+ root: rootDir,
93
+ define: getDefine(env),
94
+ plugins: [cloudflare(pluginOptions)],
95
+ server: serverOptions,
96
+ customLogger: makeViteLogger(console),
97
+ });
98
+ await devServer.listen();
99
+ return devServer;
100
+ }),
101
+ ),
30
102
  (devServer) =>
31
103
  Effect.promise(async () => {
32
104
  await devServer.close();
@@ -42,13 +114,23 @@ export const viteBuild = (
42
114
  const outputPlugin = yield* viteBuildOutputPlugin({
43
115
  entryEnvironment: pluginOptions.viteEnvironments?.entry ?? "ssr",
44
116
  });
117
+ const console = yield* ConsoleService.Console;
45
118
  yield* Effect.promise(async () => {
119
+ process.env[ALCHEMY_CLOUDFLARE_VITE_INJECTED] = "1";
46
120
  const vite = await loadVite(rootDir);
47
121
  const builder = await vite.createBuilder(
48
122
  {
49
123
  root: rootDir,
50
124
  define: getDefine(env),
51
125
  plugins: [cloudflare(pluginOptions), outputPlugin.plugin],
126
+ customLogger: makeViteLogger(console),
127
+ // Disables the NATIVE rolldown progress reporter ("transforming…",
128
+ // "rendering chunks…", "computing gzip size…"): it prints from
129
+ // Rust straight to fd 1 and cannot be intercepted from JS — vite
130
+ // only enables it when logLevel >= info. Info-level build
131
+ // summaries are suppressed with it; warnings and errors still
132
+ // reach the customLogger above.
133
+ logLevel: "warn",
52
134
  },
53
135
  // This is the `useLegacyBuilder` option. The Vite CLI implementation uses `null` here.
54
136
  // Originally we used `undefined` here, but this caused the static site build to fail.
@@ -585,7 +585,24 @@ export interface ViteOptions {
585
585
  *
586
586
  * @see {@link MemoOptions}
587
587
  */
588
- memo?: MemoOptions;
588
+ memo?: MemoOptions & {
589
+ /**
590
+ * Configure additional workspaces to hash.
591
+ * By default, auto-detects workspaces during Vite build, then hashes all
592
+ * non-gitignored files in the workspace plus the nearest lockfile.
593
+ * @default "auto"
594
+ */
595
+ workspaces?:
596
+ | "auto"
597
+ | Array<
598
+ MemoOptions & {
599
+ /**
600
+ * The working directory to hash, relative to the Vite root.
601
+ */
602
+ cwd: string;
603
+ }
604
+ >;
605
+ };
589
606
  /**
590
607
  * Selects which Vite environments make up the deployed Worker, for
591
608
  * frameworks that build more than one (e.g. React Server Components).
@@ -632,6 +649,7 @@ export type Worker<Bindings extends WorkerBindings = any> = Resource<
632
649
  assets: string | undefined;
633
650
  bundle: string | undefined;
634
651
  input: string | undefined;
652
+ additionalWorkspaces: string[] | undefined;
635
653
  // Hash of the deploy-time metadata surface (compatibility, env,
636
654
  // bindings, asset config, limits, observability, ...) so metadata-only
637
655
  // edits trigger an update (#745). Optional: state written before this
@@ -1,4 +1,3 @@
1
- import type { PutScriptRequest } from "@distilled.cloud/cloudflare/workers";
2
1
  import * as Effect from "effect/Effect";
3
2
  import * as Redacted from "effect/Redacted";
4
3
  import type { InputProps } from "../../Input.ts";
@@ -26,7 +25,10 @@ import { isWorkflowLike, WorkflowResource } from "../Workflows/Workflow.ts";
26
25
  import { makeWorkflowName } from "../Workflows/WorkflowName.ts";
27
26
  import { isAssets } from "./Assets.ts";
28
27
  import { isBrowser } from "./Browser.ts";
29
- import { isDurableObjectLike } from "./DurableObject.ts";
28
+ import {
29
+ isDurableObjectLike,
30
+ normalizeTransferredFrom,
31
+ } from "./DurableObject.ts";
30
32
  import { isRateLimit } from "./RateLimit.ts";
31
33
  import { isVersionMetadata } from "./VersionMetadata.ts";
32
34
  import type { WorkerBindingProps } from "./Worker.ts";
@@ -98,9 +100,7 @@ export const bindWorkerAsyncBindings = Effect.fn(function* (
98
100
  }
99
101
  });
100
102
 
101
- type BindingSpec = InputProps<
102
- Exclude<PutScriptRequest["metadata"]["bindings"], undefined>[number]
103
- >;
103
+ type BindingSpec = InputProps<WorkerBinding>;
104
104
 
105
105
  const toBinding = (
106
106
  bindingName: string,
@@ -181,6 +181,7 @@ const toBinding = (
181
181
  name: bindingName,
182
182
  className: binding.className ?? binding.name,
183
183
  scriptName: binding.scriptName,
184
+ transferredFrom: normalizeTransferredFrom(binding.transferredFrom),
184
185
  };
185
186
  } else if (isWorkflowLike(binding)) {
186
187
  return {
@@ -31,11 +31,30 @@ import type { VersionMetadataBinding } from "./VersionMetadataBinding.ts";
31
31
  import { Worker, WorkerEnvironment } from "./Worker.ts";
32
32
  import type { WorkerLoader } from "./WorkerLoader.ts";
33
33
 
34
- export type WorkerBinding = Exclude<
34
+ type DistilledWorkerBinding = Exclude<
35
35
  workers.PutScriptRequest["metadata"]["bindings"],
36
36
  undefined
37
37
  >[number];
38
38
 
39
+ /**
40
+ * The `durable_object_namespace` metadata binding extended with alchemy-only
41
+ * transfer metadata. `transferredFrom` names the Worker(s) — by logical id in
42
+ * this stack + stage, or by physical script name — that previously hosted the
43
+ * class, so the provider can drive Cloudflare's data-preserving
44
+ * `transferred_classes` migration. It is stripped from the binding before the
45
+ * script upload — Cloudflare never sees it.
46
+ */
47
+ export type DurableObjectNamespaceWorkerBinding = Extract<
48
+ DistilledWorkerBinding,
49
+ { type: "durable_object_namespace" }
50
+ > & {
51
+ transferredFrom?: string | string[];
52
+ };
53
+
54
+ export type WorkerBinding =
55
+ | Exclude<DistilledWorkerBinding, { type: "durable_object_namespace" }>
56
+ | DurableObjectNamespaceWorkerBinding;
57
+
39
58
  export type WorkerSettingsBinding = Exclude<
40
59
  workers.GetScriptScriptAndVersionSettingResponse["bindings"],
41
60
  null | undefined
@@ -13,7 +13,10 @@ import * as Scope from "effect/Scope";
13
13
  import * as Stream from "effect/Stream";
14
14
  import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
15
15
  import * as EffectHttp from "effect/unstable/http/HttpEffect";
16
- import { makeEntrypointLayer } from "../../Runtime.ts";
16
+ import {
17
+ makeEntrypointLayer,
18
+ reifyBoundConfigProvider,
19
+ } from "../../Runtime.ts";
17
20
  import { Self } from "../../Self.ts";
18
21
  import { Stack } from "../../Stack.ts";
19
22
  import { CloudflareEnvironment } from "../CloudflareEnvironment.ts";
@@ -270,7 +273,14 @@ const getSharedBuild = (
270
273
  ConfigProvider.ConfigProvider,
271
274
  ConfigProvider.orElse(
272
275
  ConfigProvider.fromUnknown({ ALCHEMY_PHASE: "runtime" }),
273
- ConfigProvider.fromUnknown(env),
276
+ // Auto-bound `Config` values arrive in `env` as
277
+ // `{"_tag":"Redacted","value":...}` markers; reify them so a
278
+ // `Config` re-read inside a request handler decodes the raw
279
+ // source value instead of the marker JSON.
280
+ reifyBoundConfigProvider(
281
+ ConfigProvider.fromUnknown(env),
282
+ env as Record<string, unknown>,
283
+ ),
274
284
  ),
275
285
  ),
276
286
  ),