void 0.20.2 → 0.21.0
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.
- package/README.md +2 -2
- package/dist/agents-gni4eqBu.mjs +111 -0
- package/dist/auth-3sGB0zJ1.mjs +22 -0
- package/dist/{auth-DPl6kck4.mjs → auth-B9_D6ygs.mjs} +6 -241
- package/dist/auth-CAw7zHqj.mjs +2 -0
- package/dist/auth-client-BWBT8HLp.mjs +6 -0
- package/dist/auth-client-Bawdj38n.d.mts +7 -0
- package/dist/auth-client-react-7GFffu8R.d.mts +7 -0
- package/dist/auth-client-react-CMLwT2xI.mjs +6 -0
- package/dist/auth-client-solid-DyTFL4cq.d.mts +7 -0
- package/dist/auth-client-solid-UoreJWZG.mjs +6 -0
- package/dist/auth-client-svelte-Cv_WvrRk.mjs +6 -0
- package/dist/auth-client-svelte-zetW0KIH.d.mts +7 -0
- package/dist/auth-client-vue-CFk7Xbv3.mjs +6 -0
- package/dist/auth-client-vue-bChShbQP.d.mts +7 -0
- package/dist/{auth-cmd-gniL2fNt.mjs → auth-cmd-MkBG2u1f.mjs} +5 -5
- package/dist/{auth-link-NZdjCmSc.mjs → auth-link-Devmv96E.mjs} +5 -5
- package/dist/{better-auth-shared-DSCeohOK.d.mts → better-auth-shared-BoVwA5Vm.d.mts} +1 -6
- package/dist/{better-auth-shared-CYw1T3k4.mjs → better-auth-shared-syGYYmnY.mjs} +1 -1
- package/dist/{build-cmd-sI18tX_O.mjs → build-cmd-DsBGwtfs.mjs} +6 -4
- package/dist/{cache-IHn5MwBC.mjs → cache-BMw8eMyF.mjs} +6 -4
- package/dist/{cancel-deploy-C5qTOdLi.mjs → cancel-deploy-B3_s9NIN.mjs} +5 -3
- package/dist/cf-access-rAZxzMkL.mjs +181 -0
- package/dist/cf-build-output-CTdlo6Rt.mjs +520 -0
- package/dist/cli/cf-compat.d.mts +1 -0
- package/dist/cli/cf-compat.mjs +934 -0
- package/dist/cli/cli.mjs +61 -38
- package/dist/cli/env-schema-probe.mjs +3 -3
- package/dist/client-DAAivdid.mjs +2 -0
- package/dist/{client-dHfSJvAN.mjs → client-PdAJ-F0t.mjs} +148 -89
- package/dist/{cloudflare-auth-6M5llVPC.mjs → cloudflare-auth-BCmTc1X_.mjs} +13 -44
- package/dist/{cloudflare-cmd-4RPGN3KB.mjs → cloudflare-cmd-D6PrKn7o.mjs} +4 -7
- package/dist/{cloudflare-connect-t1UU5svD.mjs → cloudflare-connect-DloREDlc.mjs} +6 -6
- package/dist/cloudflare-operations-BHNJVDbN.mjs +2 -0
- package/dist/{cloudflare-operations-BzWnlC1_.mjs → cloudflare-operations-CPEdHYhM.mjs} +37 -39
- package/dist/cloudflare-user-output-Q-k0QoNQ.mjs +20 -0
- package/dist/collect-DAUItMDS.mjs +2 -0
- package/dist/collect-DXHNWHcT.mjs +48 -0
- package/dist/config--T87TD8T.mjs +2 -0
- package/dist/{config-NOG_U1aK.mjs → config-BSe70f4T.mjs} +4 -6
- package/dist/config-DDIFxQYx.mjs +2 -0
- package/dist/{config-uNGuFsI2.mjs → config-Dxr6cTXn.mjs} +22 -37
- package/dist/config-DywxBLQC.d.mts +185 -0
- package/dist/config-entry.d.mts +6 -0
- package/dist/config-entry.mjs +7 -0
- package/dist/config-uP7ZDtVZ.mjs +21 -0
- package/dist/config-write-y3CBI_ux.mjs +60 -0
- package/dist/{connect-Bfk31O_8.mjs → connect-BvC9kolB.mjs} +8 -6
- package/dist/{create-project-Bk9Z0-Jg.mjs → create-project-C9lQhRzj.mjs} +9 -25
- package/dist/create-project-CI-17RVJ.mjs +2 -0
- package/dist/database-provider-Cx525bwX.mjs +6 -0
- package/dist/database-provider.mjs +1 -5
- package/dist/{db-BkRoptAt.mjs → db-R7IQgOv5.mjs} +48 -44
- package/dist/{delete-DouASY9P.mjs → delete-CghI_NXn.mjs} +6 -4
- package/dist/deploy-CYPymbtG.mjs +2 -0
- package/dist/{deploy-DTaWUS1S.mjs → deploy-H968Lo4T.mjs} +765 -197
- package/dist/discover-BBzDZe_o.mjs +2 -0
- package/dist/{discover-xvfrgJeo.mjs → discover-C4O6YxVS.mjs} +3 -8
- package/dist/{dist-BrsS7cai.mjs → dist-4WkAWhWx.mjs} +1 -15
- package/dist/{dist-m40_XgNh.mjs → dist-Bn8Kodjp.mjs} +1 -1
- package/dist/dist-C5fND3R0.mjs +2 -0
- package/dist/dist-D7-nEOXi.mjs +2 -0
- package/dist/{output-B0cfNSx5.mjs → dist-Dn6nn2IU.mjs} +3 -926
- package/dist/{domain-1RhhOVrC.mjs → domain-CITt8lC-.mjs} +7 -5
- package/dist/{route-types-Da-DpyUp.mjs → drizzle-Beb2Am5S.mjs} +1 -280
- package/dist/{email-Ce6SQq-i.mjs → email-C5kaZXzJ.mjs} +2 -2
- package/dist/{email-C-lGh51B.mjs → email-_8VmyX7V.mjs} +14 -12
- package/dist/{entry-DU3oDoQ3.mjs → entry-DdRFGK0y.mjs} +2 -2
- package/dist/{env-DJHsPE7Z.mjs → env-DV4r3nHz.mjs} +9 -7
- package/dist/{env-DBKmK4vc.mjs → env-DX_v-Q-v.mjs} +1 -1
- package/dist/env-Yz4HcvHs.mjs +78 -0
- package/dist/env-helpers--wFmQ_5Q.mjs +136 -0
- package/dist/{env-types-BNPhro-M.mjs → env-types-CWDtqHgw.mjs} +6 -2
- package/dist/{env-validation-CF6KvTRf.mjs → env-validation-BsFEXps5.mjs} +19 -28
- package/dist/env-validation-DIDGM7h4.mjs +2 -0
- package/dist/fetch-CXDChK7B.mjs +18 -0
- package/dist/fetch-_SeGZao9.d.mts +57 -0
- package/dist/fetch-stream-AOByI7Ki.mjs +81 -0
- package/dist/fetch-stream-Bjf0hoZb.d.mts +49 -0
- package/dist/gen-BBiIZw6g.mjs +2 -0
- package/dist/{gen-B_wPnVTK.mjs → gen-CFOEEc-t.mjs} +13 -11
- package/dist/{generate-RTK8_kK1.mjs → generate-C0VY6RVf.mjs} +2 -2
- package/dist/{github-cmd-PW7ZnWTp.mjs → github-cmd-jYjha2LO.mjs} +18 -22
- package/dist/{handler-D1hLsObx.d.mts → handler-BXJTXd02.d.mts} +6 -1
- package/dist/handler-DghKr6dU.mjs +150 -0
- package/dist/head-D_QRR5Yd.mjs +112 -0
- package/dist/head-client-DzmJGN4C.mjs +90 -0
- package/dist/{headers-BAHwgHdW.mjs → headers-B_HBMgi0.mjs} +2 -2
- package/dist/{help-CwOX-zmI.mjs → help-C46mnlUS.mjs} +17 -12
- package/dist/help-CS_nAsWu.mjs +2 -0
- package/dist/index.d.mts +2 -20
- package/dist/index.mjs +116 -60
- package/dist/{init-BWZ7q5Z4.mjs → init-CSXmvxKu.mjs} +49 -50
- package/dist/{link-Rmvu2Wl_.mjs → link-DxMOALXk.mjs} +7 -5
- package/dist/{list-DEE2S6mY.mjs → list-0wQs0oYg.mjs} +7 -5
- package/dist/live-CB1y5IuC.mjs +411 -0
- package/dist/live-CKiJilLr.d.mts +105 -0
- package/dist/local-d1-DzykTWY8.mjs +104 -0
- package/dist/{login-Uvferzmm.mjs → login-CKk5NX4d.mjs} +6 -11
- package/dist/login-Ch9cgWRF.mjs +2 -0
- package/dist/{logs-27FenuiC.mjs → logs-hxWBSoej.mjs} +6 -4
- package/dist/migrate-CLty4mZR.mjs +2 -0
- package/dist/migrate-DcW8F2W8.mjs +285 -0
- package/dist/migration-handler-DM4clYj5.d.mts +51 -0
- package/dist/{neon-DHwd2zvC.mjs → neon-n74ta1Pr.mjs} +1 -1
- package/dist/{node-Ez5KW5rn.mjs → node-Cupyf7-s.mjs} +6 -6
- package/dist/{operator-auth-B3e08unv.mjs → operator-auth-BkVgJqv-.mjs} +2 -2
- package/dist/{operator-client-LUZnlnYk.mjs → operator-client-A0iex2yi.mjs} +2 -1
- package/dist/{operator-cmd-CjOTmAYE.mjs → operator-cmd-BEUYhaHB.mjs} +6 -6
- package/dist/output-urU86XeT.mjs +146 -0
- package/dist/{package-json-CPoWX79C.mjs → package-json-iCbMg5XF.mjs} +1 -1
- package/dist/pages/client.d.mts +5 -2
- package/dist/pages/client.mjs +5 -3
- package/dist/pages/head-client.mjs +1 -89
- package/dist/pages/head.mjs +1 -111
- package/dist/pages/index.d.mts +2 -3
- package/dist/pages/index.mjs +7 -7
- package/dist/pages/islands-plugin.mjs +2 -2
- package/dist/pages/prefetch.d.mts +2 -30
- package/dist/pages/prefetch.mjs +1 -89
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +3 -3
- package/dist/pages/serialize.d.mts +2 -9
- package/dist/pages/serialize.mjs +1 -13
- package/dist/plan-BEZ8VJW0.mjs +256 -0
- package/dist/plan-DpuOr14e.mjs +2 -0
- package/dist/{platform-auth-config-DrbQXXiW.mjs → platform-auth-config-Df6yVw-e.mjs} +6 -6
- package/dist/{platform-auth-protection-Bhtvp0B_.mjs → platform-auth-protection-Jb0yftay.mjs} +7 -5
- package/dist/{platform-auth-recovery-CeOKGVeJ.mjs → platform-auth-recovery-DmRyIfW0.mjs} +6 -5
- package/dist/platform-cmd-C9Vt7m-d.mjs +2 -0
- package/dist/{platform-cmd-BFhieCdV.mjs → platform-cmd-DRxCOTwy.mjs} +8 -5
- package/dist/{platform-domain-C74PULqV.mjs → platform-domain-IjiXgrXJ.mjs} +4 -3
- package/dist/{platform-lifecycle-BwAIgz-t.mjs → platform-lifecycle-BquAaU-5.mjs} +263 -56
- package/dist/platform-lifecycle-CuJIZNvA.mjs +2 -0
- package/dist/{platform-management-COogu_Se.mjs → platform-management-CCQKGsq4.mjs} +12 -7
- package/dist/platform-management-Cgyed0WY.mjs +2 -0
- package/dist/{platform-recovery-ewqLefp1.mjs → platform-recovery-DS8ih1SW.mjs} +3 -3
- package/dist/platform-registry-BJbgZLS1.mjs +431 -0
- package/dist/{plugin-inference-BDRfZngg.mjs → plugin-inference-DsvtJLll.mjs} +4 -4
- package/dist/prefetch-Bsc_Pb6c.mjs +90 -0
- package/dist/prefetch-Ce6la4EI.d.mts +31 -0
- package/dist/{prepare-blNRQvQl.mjs → prepare-CaUxODOU.mjs} +3 -2
- package/dist/prepare-D4CkM3_v.mjs +2 -0
- package/dist/{prepare-CtDJjoOj.mjs → prepare-pcWcxSCh.mjs} +13 -11
- package/dist/prerender-render-Cf_WDE9W.mjs +111 -0
- package/dist/prerender-render.mjs +1 -110
- package/dist/{preset-lAy0B0BQ.mjs → preset-Dowh9tTt.mjs} +16 -118
- package/dist/project-BEBFDFLz.mjs +2 -0
- package/dist/project-CWNIPoXc.mjs +209 -0
- package/dist/{project-cmd-DmZK9Hxf.mjs → project-cmd-2lN--YAX.mjs} +18 -16
- package/dist/{project-paths-SK8nMHPp.mjs → project-paths-CKQ-Q5JS.mjs} +47 -14
- package/dist/project-slug-23TpquG4.mjs +8 -0
- package/dist/project-slug-DofjTFd-.mjs +2 -0
- package/dist/{project-team-D8jOJMUJ.mjs → project-team-Dapn9HZn.mjs} +9 -5
- package/dist/{project-token-DA34bf-C.mjs → project-token-C90v9SJK.mjs} +6 -4
- package/dist/{project-tsconfig-Ql2XsSQp.mjs → project-tsconfig-CwfqUnVp.mjs} +2 -2
- package/dist/{protocol-C-pqYJjE.d.mts → protocol-ZH3jP4a7.d.mts} +1 -1
- package/dist/providers-BNKRacMr.d.mts +7 -0
- package/dist/provision-CNgEBkVA.mjs +3 -0
- package/dist/{provision-CSJOjjQk.mjs → provision-Cck2m3jJ.mjs} +11 -25
- package/dist/queues-BWKt1Xo4.d.mts +7 -0
- package/dist/{requests-CUExwGQQ.mjs → requests-CzX46I0i.mjs} +5 -3
- package/dist/resolve-project-BTotl8Nn.mjs +2 -0
- package/dist/{resolve-project--Vxawf7z.mjs → resolve-project-Xvis70DG.mjs} +2 -8
- package/dist/response-Tn7rU0MV.mjs +30 -0
- package/dist/{rollback-CDNGU1gr.mjs → rollback-BEeyc73H.mjs} +6 -4
- package/dist/{rolldown-runtime-rQ84J-ij.mjs → rolldown-runtime-DXIUcv95.mjs} +1 -10
- package/dist/route-types-Id82-veQ.mjs +280 -0
- package/dist/{local-d1-D2I6Ox5F.mjs → runner-BGVsGgkb.mjs} +6 -114
- package/dist/runner-CQs_cDSG.mjs +2 -0
- package/dist/runner-mysql-1o47achK.mjs +2 -0
- package/dist/{runner-mysql-7BPUNGmL.mjs → runner-mysql-BhwMk2Bm.mjs} +2 -9
- package/dist/{runner-pg-BkEza-dX.mjs → runner-pg-CJ_JeGF6.mjs} +2 -9
- package/dist/runner-pg-D7z01mQS.mjs +2 -0
- package/dist/runtime/ai.mjs +1 -1
- package/dist/runtime/auth-client-react.d.mts +2 -6
- package/dist/runtime/auth-client-react.mjs +1 -5
- package/dist/runtime/auth-client-solid.d.mts +2 -6
- package/dist/runtime/auth-client-solid.mjs +1 -5
- package/dist/runtime/auth-client-svelte.d.mts +2 -6
- package/dist/runtime/auth-client-svelte.mjs +1 -5
- package/dist/runtime/auth-client-vue.d.mts +2 -6
- package/dist/runtime/auth-client-vue.mjs +1 -5
- package/dist/runtime/auth-client.d.mts +2 -6
- package/dist/runtime/auth-client.mjs +1 -5
- package/dist/runtime/auth.mjs +1 -21
- package/dist/runtime/better-auth-mysql.d.mts +1 -1
- package/dist/runtime/better-auth-mysql.mjs +1 -1
- package/dist/runtime/better-auth-pg.d.mts +1 -1
- package/dist/runtime/better-auth-pg.mjs +1 -1
- package/dist/runtime/better-auth.d.mts +1 -1
- package/dist/runtime/better-auth.mjs +1 -1
- package/dist/runtime/client-react.d.mts +3 -3
- package/dist/runtime/client-react.mjs +3 -3
- package/dist/runtime/client-solid.d.mts +3 -3
- package/dist/runtime/client-solid.mjs +3 -3
- package/dist/runtime/client-svelte.d.mts +3 -3
- package/dist/runtime/client-svelte.mjs +3 -3
- package/dist/runtime/client-vue.d.mts +3 -3
- package/dist/runtime/client-vue.mjs +3 -3
- package/dist/runtime/client.d.mts +3 -3
- package/dist/runtime/client.mjs +3 -3
- package/dist/runtime/db.mjs +1 -1
- package/dist/runtime/durable.mjs +1 -1
- package/dist/runtime/email/testing.mjs +1 -1
- package/dist/runtime/env-helpers.mjs +1 -135
- package/dist/runtime/env-public-client.mjs +1 -1
- package/dist/runtime/env-public.mjs +2 -2
- package/dist/runtime/env.mjs +1 -77
- package/dist/runtime/fetch-stream.d.mts +2 -49
- package/dist/runtime/fetch-stream.mjs +2 -80
- package/dist/runtime/fetch.d.mts +2 -57
- package/dist/runtime/fetch.mjs +2 -17
- package/dist/runtime/handler.d.mts +1 -1
- package/dist/runtime/handler.mjs +1 -149
- package/dist/runtime/kv.mjs +1 -1
- package/dist/runtime/live-client.d.mts +1 -1
- package/dist/runtime/live-server.mjs +2 -2
- package/dist/runtime/live.d.mts +2 -104
- package/dist/runtime/live.mjs +1 -410
- package/dist/runtime/migration-handler-mysql.d.mts +1 -1
- package/dist/runtime/migration-handler-pg.d.mts +1 -1
- package/dist/runtime/migration-handler.d.mts +2 -50
- package/dist/runtime/queues.d.mts +2 -6
- package/dist/runtime/queues.mjs +1 -1
- package/dist/runtime/remote/index.mjs +49 -8
- package/dist/runtime/response.mjs +1 -29
- package/dist/runtime/sandbox.d.mts +4 -56
- package/dist/runtime/sandbox.mjs +82 -221
- package/dist/runtime/sse.mjs +1 -171
- package/dist/runtime/storage.mjs +1 -1
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/validator.mjs +1 -71
- package/dist/runtime/ws-server.d.mts +2 -2
- package/dist/runtime/ws-server.mjs +2 -2
- package/dist/runtime/ws.d.mts +2 -121
- package/dist/{scan-CpK-57ug.mjs → scan-DJbooZm2.mjs} +3 -3
- package/dist/{scan-BMH4rzlv.mjs → scan-DdDvRCU1.mjs} +8 -26
- package/dist/{secret-Bzzi2e9E.mjs → secret-wnTel5Yw.mjs} +8 -6
- package/dist/serialize-BPvnNQuA.mjs +14 -0
- package/dist/serialize-CfSwWfF2.d.mts +10 -0
- package/dist/{skills-C0RvGjeE.mjs → skills-B-690E7h.mjs} +3 -2
- package/dist/sse-BaC1jXko.mjs +172 -0
- package/dist/{subcommand-prompt-Bmyn5Rlc.mjs → subcommand-prompt-Gj3VzLIh.mjs} +2 -1
- package/dist/sveltekit.d.mts +2 -1
- package/dist/sveltekit.mjs +3 -2
- package/dist/validate-DqJ33oHj.mjs +2 -0
- package/dist/validate-qNhV00PD.mjs +180 -0
- package/dist/validator-BTOu0fB0.mjs +72 -0
- package/dist/{wrangler--imS8n0d.mjs → wrangler-D01qs6VB.mjs} +259 -71
- package/dist/ws-BwcqizuH.d.mts +122 -0
- package/dist/{yarn-pnp-DxSInkzL.mjs → yarn-pnp-CVEc3gE7.mjs} +1 -1
- package/package.json +19 -8
- package/skills/void/SKILL.md +7 -5
- package/skills/void/docs/guide/ai.md +3 -3
- package/skills/void/docs/guide/app-types.md +12 -11
- package/skills/void/docs/guide/auth.md +2 -2
- package/skills/void/docs/guide/database/d1.md +1 -1
- package/skills/void/docs/guide/database/mysql.md +1 -1
- package/skills/void/docs/guide/database/postgresql.md +3 -3
- package/skills/void/docs/guide/deployment.md +16 -16
- package/skills/void/docs/guide/durable-state.md +2 -2
- package/skills/void/docs/guide/edge/headers.md +3 -3
- package/skills/void/docs/guide/edge/prerendering.md +1 -1
- package/skills/void/docs/guide/edge/redirects.md +4 -4
- package/skills/void/docs/guide/edge/revalidation.md +6 -6
- package/skills/void/docs/guide/edge/rewrites.md +28 -27
- package/skills/void/docs/guide/edge/static-assets.md +1 -1
- package/skills/void/docs/guide/email.md +27 -25
- package/skills/void/docs/guide/env-migration.md +1 -1
- package/skills/void/docs/guide/index.md +1 -1
- package/skills/void/docs/guide/pages-routing/head.md +1 -1
- package/skills/void/docs/guide/platform/administration/access.md +171 -0
- package/skills/void/docs/guide/platform/administration/email.md +121 -0
- package/skills/void/docs/guide/platform/administration/operations.md +97 -0
- package/skills/void/docs/guide/platform/administration/projects.md +56 -0
- package/skills/void/docs/guide/platform/development/local.md +119 -0
- package/skills/void/docs/guide/platform/development/runtime.md +124 -0
- package/skills/void/docs/guide/platform/development/schema-ci.md +95 -0
- package/skills/void/docs/guide/platform/installation/ci.md +58 -0
- package/skills/void/docs/guide/platform/installation/credentials.md +90 -0
- package/skills/void/docs/guide/platform/installation/domains.md +68 -0
- package/skills/void/docs/guide/platform/installation/first-deployment.md +82 -0
- package/skills/void/docs/guide/platform/installation/maintenance.md +137 -0
- package/skills/void/docs/guide/platform/installation/prerequisites.md +88 -0
- package/skills/void/docs/guide/platform/installation/setup.md +169 -0
- package/skills/void/docs/guide/platform/installation/uninstall.md +54 -0
- package/skills/void/docs/guide/platform-administration.md +6 -414
- package/skills/void/docs/guide/platform-development.md +5 -316
- package/skills/void/docs/guide/project-collaboration.md +1 -1
- package/skills/void/docs/guide/remote-dev.md +2 -2
- package/skills/void/docs/guide/sandboxes.md +10 -25
- package/skills/void/docs/guide/self-hosted-platform.md +11 -694
- package/skills/void/docs/guide/ssg.md +1 -1
- package/skills/void/docs/guide/websockets.md +1 -1
- package/skills/void/docs/integrations/cloudflare.md +86 -84
- package/skills/void/docs/integrations/frameworks/analog.md +14 -9
- package/skills/void/docs/integrations/frameworks/astro.md +14 -10
- package/skills/void/docs/integrations/frameworks/nuxt.md +14 -9
- package/skills/void/docs/integrations/frameworks/overview.md +35 -29
- package/skills/void/docs/integrations/frameworks/react-router.md +1 -1
- package/skills/void/docs/integrations/frameworks/sveltekit.md +33 -30
- package/skills/void/docs/integrations/frameworks/tanstack-start.md +1 -1
- package/skills/void/docs/integrations/nodejs-bun-deno.md +5 -5
- package/skills/void/docs/reference/api.md +55 -38
- package/skills/void/docs/reference/cli.md +60 -34
- package/skills/void/docs/reference/config.md +57 -34
- package/skills/void/docs/reference/resource-inference.md +10 -10
- package/skills/void/docs/reference/structure.md +2 -2
- package/dist/validate-tBBN_dXH.mjs +0 -505
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MigrationEntry } from "
|
|
1
|
+
import { t as MigrationEntry } from "../migration-handler-DM4clYj5.mjs";
|
|
2
2
|
//#region src/runtime/migration-handler-mysql.d.ts
|
|
3
3
|
export declare function createMigrationHandler(env: Record<string, unknown>, migrations: Array<MigrationEntry>, _dialect: "sqlite" | "postgresql" | "mysql", runAuthMigrations?: () => Promise<void>): (request: Request) => Promise<Response>;
|
|
4
4
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MigrationEntry } from "
|
|
1
|
+
import { t as MigrationEntry } from "../migration-handler-DM4clYj5.mjs";
|
|
2
2
|
//#region src/runtime/migration-handler-pg.d.ts
|
|
3
3
|
export declare function createMigrationHandler(env: Record<string, unknown>, migrations: Array<MigrationEntry>, _dialect: "sqlite" | "postgresql" | "mysql", runAuthMigrations?: () => Promise<void>): (request: Request) => Promise<Response>;
|
|
4
4
|
//#endregion
|
|
@@ -1,50 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
name: string;
|
|
4
|
-
sql: string;
|
|
5
|
-
};
|
|
6
|
-
export type MigrationResult = {
|
|
7
|
-
name: string;
|
|
8
|
-
applied: boolean;
|
|
9
|
-
durationMs: number;
|
|
10
|
-
error?: string;
|
|
11
|
-
status?: "applied" | "skipped" | "failed";
|
|
12
|
-
stability?: "stable" | "legacy";
|
|
13
|
-
};
|
|
14
|
-
export type MigrationResponse = {
|
|
15
|
-
ok: boolean;
|
|
16
|
-
migrations: Array<MigrationResult>;
|
|
17
|
-
error?: string;
|
|
18
|
-
protocolVersion?: 2;
|
|
19
|
-
attemptId?: string;
|
|
20
|
-
confirmedApplied?: Array<string>;
|
|
21
|
-
confirmedSkipped?: Array<string>;
|
|
22
|
-
stability?: "stable" | "legacy";
|
|
23
|
-
warnings?: Array<string>;
|
|
24
|
-
};
|
|
25
|
-
type MigrationExecutionPlan = {
|
|
26
|
-
name: string;
|
|
27
|
-
dialect: "sqlite";
|
|
28
|
-
classifierVersion: number;
|
|
29
|
-
sqlHash: string;
|
|
30
|
-
planHash: string;
|
|
31
|
-
stability: "stable" | "legacy";
|
|
32
|
-
warnings?: Array<string>;
|
|
33
|
-
} & ({
|
|
34
|
-
kind: "single-statement";
|
|
35
|
-
} | {
|
|
36
|
-
kind: "breakpoint-framed";
|
|
37
|
-
statements: Array<string>;
|
|
38
|
-
} | {
|
|
39
|
-
kind: "legacy-unsplit-multi-statement";
|
|
40
|
-
allowLegacy: boolean;
|
|
41
|
-
});
|
|
42
|
-
type MigrationPlanBundle = {
|
|
43
|
-
protocolVersion: 2;
|
|
44
|
-
classifierVersion: number;
|
|
45
|
-
migrationListHash: string;
|
|
46
|
-
destructiveValidation: "passed";
|
|
47
|
-
plans: Array<MigrationExecutionPlan>;
|
|
48
|
-
};
|
|
49
|
-
export declare function createMigrationHandler(env: Record<string, unknown>, migrations: Array<MigrationEntry> | undefined, _dialect: "sqlite" | "postgresql" | "mysql", runAuthMigrations?: () => Promise<void>, planBundle?: MigrationPlanBundle): (request: Request) => Promise<Response>;
|
|
50
|
-
//#endregion
|
|
1
|
+
import { i as createMigrationHandler, n as MigrationResponse, r as MigrationResult, t as MigrationEntry } from "../migration-handler-DM4clYj5.mjs";
|
|
2
|
+
export { MigrationEntry, MigrationResponse, MigrationResult, createMigrationHandler };
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface QueueMap {}
|
|
4
|
-
/** Typed queue producers — resolves `QUEUE_*` bindings from the active runtime environment. */
|
|
5
|
-
export declare const queues: QueueMap;
|
|
6
|
-
//#endregion
|
|
1
|
+
import { n as queues, t as QueueMap } from "../queues-BWKt1Xo4.mjs";
|
|
2
|
+
export { QueueMap, queues };
|
package/dist/runtime/queues.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { requireRuntimeBinding } from "
|
|
1
|
+
import { a as requireRuntimeBinding } from "../env-Yz4HcvHs.mjs";
|
|
2
2
|
//#region src/runtime/queues.ts
|
|
3
3
|
/** Typed queue producers — resolves `QUEUE_*` bindings from the active runtime environment. */
|
|
4
4
|
const queues = new Proxy({}, { get(_, name) {
|
|
@@ -1,6 +1,53 @@
|
|
|
1
1
|
import { t as cfAccessHeaders } from "../../cf-access-DRsQRe6k.mjs";
|
|
2
2
|
import { n as serializeR2Conditional } from "../../r2-conditions-D1Wk8i7b.mjs";
|
|
3
3
|
//#region src/runtime/remote/client.ts
|
|
4
|
+
function readableMessage(value) {
|
|
5
|
+
if (typeof value !== "string") return;
|
|
6
|
+
const text = value.replace(/(?:\u001b\]|\u009d)[\s\S]*?(?:\u0007|\u001b\\|\u009c|$)/g, "").replace(/(?:\u001b\[|\u009b)[0-?]*[ -/]*[@-~]/g, "").replace(/[\u0000-\u001f\u007f-\u009f]/g, " ").trim();
|
|
7
|
+
if (!text || /^[{[]/.test(text) || /<\/?[a-z!][^>]*>/i.test(text)) return;
|
|
8
|
+
return text.length > 500 ? `${text.slice(0, 500)}…` : text;
|
|
9
|
+
}
|
|
10
|
+
function isGenericPermissionMessage(message) {
|
|
11
|
+
return /^(?:(?:HTTP\s*)?(?:401|403)\s*[:-]?\s*)?(?:forbidden|unauthorized|access denied|permission denied|invalid or expired token)[.!]?$/i.test(message);
|
|
12
|
+
}
|
|
13
|
+
async function proxyError(response) {
|
|
14
|
+
const reader = response.body?.getReader();
|
|
15
|
+
const decoder = new TextDecoder();
|
|
16
|
+
let text = "";
|
|
17
|
+
let remaining = 16384;
|
|
18
|
+
try {
|
|
19
|
+
while (reader && remaining > 0) {
|
|
20
|
+
const { done, value } = await reader.read();
|
|
21
|
+
if (done) break;
|
|
22
|
+
text += decoder.decode(value.subarray(0, remaining), { stream: true });
|
|
23
|
+
remaining -= value.byteLength;
|
|
24
|
+
}
|
|
25
|
+
text += decoder.decode();
|
|
26
|
+
} catch {} finally {
|
|
27
|
+
await reader?.cancel().catch(() => {});
|
|
28
|
+
reader?.releaseLock();
|
|
29
|
+
}
|
|
30
|
+
let message;
|
|
31
|
+
let error;
|
|
32
|
+
try {
|
|
33
|
+
const body = JSON.parse(text);
|
|
34
|
+
if (body && typeof body === "object" && !Array.isArray(body)) {
|
|
35
|
+
const payload = body;
|
|
36
|
+
message = readableMessage(payload.message);
|
|
37
|
+
error = readableMessage(payload.error);
|
|
38
|
+
}
|
|
39
|
+
} catch {
|
|
40
|
+
if (!response.headers.get("content-type")?.includes("text/html")) error = readableMessage(text);
|
|
41
|
+
}
|
|
42
|
+
if (message && isGenericPermissionMessage(message)) message = void 0;
|
|
43
|
+
if (!message && error && !isGenericPermissionMessage(error)) message = error;
|
|
44
|
+
if (!message) {
|
|
45
|
+
if (response.status === 401) message = "Remote access could not be authenticated. Sign in to the connected platform again, or restart the build to obtain a fresh prerender token.";
|
|
46
|
+
else if (response.status === 403) message = "Remote access could not be authorized. Check the selected platform and project, then ask a project admin or owner to confirm your access. If your access is correct, retry shortly.";
|
|
47
|
+
else message = error ?? "The remote service returned an unreadable error. Retry the request.";
|
|
48
|
+
}
|
|
49
|
+
return /* @__PURE__ */ new Error(`remote: Proxy request failed with ${response.status}: ${message}`);
|
|
50
|
+
}
|
|
4
51
|
/**
|
|
5
52
|
* HTTP client for the remote bindings proxy (proxy.void.cloud).
|
|
6
53
|
*
|
|
@@ -37,10 +84,7 @@ var ProxyClient = class {
|
|
|
37
84
|
}),
|
|
38
85
|
redirect: "manual"
|
|
39
86
|
});
|
|
40
|
-
if (!res.ok)
|
|
41
|
-
const text = await res.text().catch(() => res.statusText);
|
|
42
|
-
throw new Error(`remote: Proxy request failed with ${res.status}: '${text}'.`);
|
|
43
|
-
}
|
|
87
|
+
if (!res.ok) throw await proxyError(res);
|
|
44
88
|
return res;
|
|
45
89
|
}
|
|
46
90
|
/**
|
|
@@ -66,10 +110,7 @@ var ProxyClient = class {
|
|
|
66
110
|
body,
|
|
67
111
|
redirect: "manual"
|
|
68
112
|
});
|
|
69
|
-
if (!res.ok)
|
|
70
|
-
const text = await res.text().catch(() => res.statusText);
|
|
71
|
-
throw new Error(`remote: Proxy request failed with ${res.status}: '${text}'.`);
|
|
72
|
-
}
|
|
113
|
+
if (!res.ok) throw await proxyError(res);
|
|
73
114
|
return res;
|
|
74
115
|
}
|
|
75
116
|
};
|
|
@@ -1,30 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Tracks responses created by convertReturnValue (as opposed to responses
|
|
4
|
-
* explicitly constructed by user code). Used by handlePageGet to decide
|
|
5
|
-
* whether a Response should be passed through or unwrapped as page props.
|
|
6
|
-
*/
|
|
7
|
-
const convertedResponses = /* @__PURE__ */ new WeakSet();
|
|
8
|
-
/** Returns true if the value is a Response that was created by convertReturnValue. */
|
|
9
|
-
function isConvertedResponse(value) {
|
|
10
|
-
return value instanceof Response && convertedResponses.has(value);
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Convert a handler's return value to a Web Response.
|
|
14
|
-
*
|
|
15
|
-
* - Response → passthrough
|
|
16
|
-
* - null/undefined → 204 No Content
|
|
17
|
-
* - string → text/html
|
|
18
|
-
* - object/array → JSON
|
|
19
|
-
*/
|
|
20
|
-
function convertReturnValue(value) {
|
|
21
|
-
if (value instanceof Response) return value;
|
|
22
|
-
let response;
|
|
23
|
-
if (value === null || value === void 0) response = new Response(null, { status: 204 });
|
|
24
|
-
else if (typeof value === "string") response = new Response(value, { headers: { "Content-Type": "text/html; charset=utf-8" } });
|
|
25
|
-
else response = Response.json(value);
|
|
26
|
-
convertedResponses.add(response);
|
|
27
|
-
return response;
|
|
28
|
-
}
|
|
29
|
-
//#endregion
|
|
1
|
+
import { n as isConvertedResponse, t as convertReturnValue } from "../response-Tn7rU0MV.mjs";
|
|
30
2
|
export { convertReturnValue, isConvertedResponse };
|
|
@@ -3,80 +3,28 @@ import { Sandbox, SandboxOptions } from "@cloudflare/sandbox";
|
|
|
3
3
|
//#region src/runtime/sandbox.d.ts
|
|
4
4
|
export declare const DEFAULT_SANDBOX_ID = "default";
|
|
5
5
|
export declare const DEFAULT_SANDBOX_BINDING = "SANDBOX";
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const SANDBOX_GATE_BINDING = "__VOID_PROXY";
|
|
8
|
-
export declare const HEARTBEAT_MS: number;
|
|
6
|
+
export declare const SANDBOX_SERVICE_BINDING = "__VOID_SANDBOX";
|
|
9
7
|
export type VoidSandboxOptions = SandboxOptions & {
|
|
10
8
|
binding?: string;
|
|
11
9
|
};
|
|
12
|
-
export type SandboxUsageEvent = Readonly<{
|
|
13
|
-
requests: 0;
|
|
14
|
-
responseBytes: 0;
|
|
15
|
-
userId?: string;
|
|
16
|
-
projectId?: string;
|
|
17
|
-
slug?: string;
|
|
18
|
-
sandboxRuntimeSeconds: number;
|
|
19
|
-
sandboxInstanceId: string;
|
|
20
|
-
}>;
|
|
21
|
-
/**
|
|
22
|
-
* Thrown by `getSandbox()` when the platform gate denies a new acquire because
|
|
23
|
-
* the user has hit a concurrency or runtime budget cap. Surface this to the
|
|
24
|
-
* caller so they can render a friendly error; do not retry transparently.
|
|
25
|
-
*/
|
|
26
10
|
export declare class SandboxLimitError extends Error {
|
|
27
11
|
override readonly name = "SandboxLimitError";
|
|
28
12
|
readonly reason: "concurrency" | "runtime_budget";
|
|
29
13
|
constructor(reason: "concurrency" | "runtime_budget", message?: string);
|
|
30
14
|
}
|
|
31
|
-
/** Managed platform Sandbox is unavailable or its activation gate cannot be verified. */
|
|
32
15
|
export declare class SandboxUnavailableError extends Error {
|
|
33
16
|
override readonly name = "SandboxUnavailableError";
|
|
34
17
|
constructor(message?: string);
|
|
35
18
|
}
|
|
36
19
|
export declare function __setSandboxBindingName(bindingName: string): void;
|
|
37
20
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* the usage queue, and notifies the gate when the container stops.
|
|
41
|
-
*
|
|
42
|
-
* Generated code from `void inference` wires user `Sandbox` subclasses to
|
|
43
|
-
* extend this class on platform deploys so per-tenant accounting works
|
|
44
|
-
* without user opt-in. On local dev (no usage-queue / gate bindings), all
|
|
45
|
-
* overrides degrade to no-ops and the sandbox behaves like the upstream
|
|
46
|
-
* `Sandbox` class.
|
|
21
|
+
* Retained for generated native/local Worker entries. Managed deployments host
|
|
22
|
+
* the platform-owned Sandbox class in a separate Worker and never use this DO.
|
|
47
23
|
*/
|
|
48
24
|
export declare class VoidPlatformSandbox<Env = unknown> extends Sandbox<Env> {
|
|
49
25
|
override onStart(): Promise<void>;
|
|
50
|
-
override alarm(alarmProps?: AlarmInvocationInfo): Promise<void>;
|
|
51
|
-
override onStop(): Promise<void>;
|
|
52
|
-
override onActivityExpired(): Promise<void>;
|
|
53
|
-
private flushFinal;
|
|
54
26
|
}
|
|
55
|
-
/**
|
|
56
|
-
* Resolve the platform-provided sandbox stub for the given id, optionally
|
|
57
|
-
* coordinating with the platform gate to enforce per-user concurrency and
|
|
58
|
-
* runtime budgets.
|
|
59
|
-
*
|
|
60
|
-
* When the gate binding (`__VOID_PROXY` by default) is present AND the
|
|
61
|
-
* platform's `__PROJECT_ID` + `__VOID_PROXY_TOKEN` identity vars are
|
|
62
|
-
* available, we POST to `https://gate/sandbox/acquire` with the HMAC-signed
|
|
63
|
-
* body the shared proxy auth middleware expects. A `409` response means the
|
|
64
|
-
* user has exceeded a budget — we throw `SandboxLimitError` so the caller
|
|
65
|
-
* can render a clear message. Any other non-OK status (or a thrown transport
|
|
66
|
-
* error from the service binding) fails closed before returning a usable
|
|
67
|
-
* managed stub.
|
|
68
|
-
*
|
|
69
|
-
* When all reserved platform identity bindings are absent, this is a native
|
|
70
|
-
* Cloudflare or local deployment and returns the upstream stub directly.
|
|
71
|
-
*
|
|
72
|
-
* The stub is constructed BEFORE calling the gate so we can pass its opaque,
|
|
73
|
-
* namespace-specific Durable Object id (`stub.id.toString()`) as `sandboxId`.
|
|
74
|
-
* The same id is available as `ctx.id.toString()` inside lifecycle hooks, so
|
|
75
|
-
* acquire, heartbeat, and release use one globally unique instance identity
|
|
76
|
-
* even when separate projects or deployments both request the name `default`.
|
|
77
|
-
* Constructing the stub does NOT start a container — that only happens on
|
|
78
|
-
* the first method call against the stub.
|
|
79
|
-
*/
|
|
27
|
+
/** Resolve an isolated Sandbox on the current deployment. Starts on first use. */
|
|
80
28
|
export declare function getSandbox<T extends Sandbox = Sandbox>(id?: string, options?: VoidSandboxOptions): Promise<T>;
|
|
81
29
|
export declare const sandbox: {
|
|
82
30
|
get: typeof getSandbox;
|
package/dist/runtime/sandbox.mjs
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import { a as getRawRuntimeEnv } from "../env-raw-Cx8ElDdj.mjs";
|
|
2
|
-
import { requireRuntimeBinding } from "
|
|
2
|
+
import { a as requireRuntimeBinding } from "../env-Yz4HcvHs.mjs";
|
|
3
3
|
import { Sandbox, getSandbox as getSandbox$1 } from "@cloudflare/sandbox";
|
|
4
4
|
//#region src/runtime/sandbox.ts
|
|
5
5
|
const DEFAULT_SANDBOX_ID = "default";
|
|
6
6
|
const DEFAULT_SANDBOX_BINDING = "SANDBOX";
|
|
7
|
-
const
|
|
8
|
-
const SANDBOX_GATE_BINDING = "__VOID_PROXY";
|
|
9
|
-
const HEARTBEAT_MS = 3e5;
|
|
10
|
-
/**
|
|
11
|
-
* Thrown by `getSandbox()` when the platform gate denies a new acquire because
|
|
12
|
-
* the user has hit a concurrency or runtime budget cap. Surface this to the
|
|
13
|
-
* caller so they can render a friendly error; do not retry transparently.
|
|
14
|
-
*/
|
|
7
|
+
const SANDBOX_SERVICE_BINDING = "__VOID_SANDBOX";
|
|
15
8
|
var SandboxLimitError = class extends Error {
|
|
16
9
|
name = "SandboxLimitError";
|
|
17
10
|
reason;
|
|
@@ -20,7 +13,6 @@ var SandboxLimitError = class extends Error {
|
|
|
20
13
|
this.reason = reason;
|
|
21
14
|
}
|
|
22
15
|
};
|
|
23
|
-
/** Managed platform Sandbox is unavailable or its activation gate cannot be verified. */
|
|
24
16
|
var SandboxUnavailableError = class extends Error {
|
|
25
17
|
name = "SandboxUnavailableError";
|
|
26
18
|
constructor(message = "Managed Sandbox is unavailable on this Void platform.") {
|
|
@@ -31,233 +23,102 @@ let sandboxBindingName = DEFAULT_SANDBOX_BINDING;
|
|
|
31
23
|
function __setSandboxBindingName(bindingName) {
|
|
32
24
|
sandboxBindingName = bindingName;
|
|
33
25
|
}
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
userId: runtimeEnv.__VOID_USER_ID,
|
|
40
|
-
projectId: runtimeEnv.__PROJECT_ID,
|
|
41
|
-
slug: runtimeEnv.__VOID_PROJECT_SLUG
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
function getSandboxInstanceId(ctx) {
|
|
45
|
-
return ctx.id.toString();
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Flush the accumulated runtime delta to the usage queue. No-op when the
|
|
49
|
-
* usage-queue binding is not bound (e.g. local dev without the platform
|
|
50
|
-
* proxy). Errors are swallowed and logged — usage emission must never crash
|
|
51
|
-
* the sandbox lifecycle.
|
|
52
|
-
*/
|
|
53
|
-
async function emitRuntimeSeconds(ctx, sandboxRuntimeSeconds) {
|
|
54
|
-
if (sandboxRuntimeSeconds <= 0) return;
|
|
55
|
-
const queue = getRawRuntimeEnv()[SANDBOX_USAGE_QUEUE_BINDING];
|
|
56
|
-
if (!queue) return;
|
|
57
|
-
const event = {
|
|
58
|
-
requests: 0,
|
|
59
|
-
responseBytes: 0,
|
|
60
|
-
sandboxRuntimeSeconds,
|
|
61
|
-
sandboxInstanceId: getSandboxInstanceId(ctx),
|
|
62
|
-
...getUsageContext()
|
|
63
|
-
};
|
|
64
|
-
try {
|
|
65
|
-
await queue.send(event);
|
|
66
|
-
} catch (error) {
|
|
67
|
-
console.error("[void/sandbox] failed to emit usage event:", error);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
function isManagedPlatformSandbox(runtimeEnv) {
|
|
71
|
-
return [
|
|
72
|
-
SANDBOX_GATE_BINDING,
|
|
73
|
-
"__PROJECT_ID",
|
|
74
|
-
"__VOID_PROXY_TOKEN",
|
|
75
|
-
"__VOID_USER_ID",
|
|
76
|
-
"__VOID_PROJECT_SLUG"
|
|
77
|
-
].some((binding) => runtimeEnv[binding] !== void 0);
|
|
26
|
+
function rethrowSandboxError(error) {
|
|
27
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
28
|
+
for (const reason of ["concurrency", "runtime_budget"]) if (message.includes(`VOID_SANDBOX_${reason}`)) throw new SandboxLimitError(reason);
|
|
29
|
+
if (message.includes("VOID_SANDBOX_unavailable")) throw new SandboxUnavailableError();
|
|
30
|
+
throw error;
|
|
78
31
|
}
|
|
79
|
-
function
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
gate,
|
|
87
|
-
projectId,
|
|
88
|
-
aiToken
|
|
32
|
+
function managedClient(capability) {
|
|
33
|
+
const call = async (target, operation, args) => {
|
|
34
|
+
try {
|
|
35
|
+
return decodeManagedResult(await target.invoke(operation, prepareManagedArgs(operation, args)));
|
|
36
|
+
} catch (error) {
|
|
37
|
+
rethrowSandboxError(error);
|
|
38
|
+
}
|
|
89
39
|
};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
40
|
+
return new Proxy(Object.create(null), { get(_target, property) {
|
|
41
|
+
if (typeof property !== "string" || property === "then") return;
|
|
42
|
+
if (property === "tunnels") return new Proxy(Object.create(null), { get(_tunnels, method) {
|
|
43
|
+
if (typeof method !== "string" || method === "then") return;
|
|
44
|
+
return (...args) => call(capability, "tunnels", [method, ...args]);
|
|
45
|
+
} });
|
|
46
|
+
return (...args) => call(capability, property, args);
|
|
47
|
+
} });
|
|
48
|
+
function decodeManagedResult(value) {
|
|
49
|
+
if (Array.isArray(value)) return value.map(decodeManagedResult);
|
|
50
|
+
if (!value || typeof value !== "object") return value;
|
|
51
|
+
const record = value;
|
|
52
|
+
if (record.__voidSandboxType === "process") {
|
|
53
|
+
const { capability: processCapability, __voidSandboxType: _type, ...snapshot } = value;
|
|
54
|
+
return Object.assign(snapshot, {
|
|
55
|
+
kill: (...args) => call(processCapability, "kill", args),
|
|
56
|
+
getStatus: (...args) => call(processCapability, "getStatus", args),
|
|
57
|
+
getLogs: (...args) => call(processCapability, "getLogs", args),
|
|
58
|
+
waitForLog: (...args) => call(processCapability, "waitForLog", args),
|
|
59
|
+
waitForPort: (...args) => call(processCapability, "waitForPort", args),
|
|
60
|
+
waitForExit: (...args) => call(processCapability, "waitForExit", args)
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (record.__voidSandboxType === "session") {
|
|
64
|
+
const session = value;
|
|
65
|
+
return new Proxy({ id: session.id }, { get(target, property) {
|
|
66
|
+
if (property === "id") return target.id;
|
|
67
|
+
if (typeof property !== "string" || property === "then") return;
|
|
68
|
+
return (...args) => call(session.capability, property, args);
|
|
69
|
+
} });
|
|
70
|
+
}
|
|
71
|
+
return value;
|
|
108
72
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
73
|
+
function prepareManagedArgs(operation, args) {
|
|
74
|
+
if (operation !== "startProcess") return args;
|
|
75
|
+
const [command, options, ...rest] = args;
|
|
76
|
+
if (!options || typeof options !== "object" || Array.isArray(options)) return args;
|
|
77
|
+
const onStart = options.onStart;
|
|
78
|
+
if (typeof onStart !== "function") return args;
|
|
79
|
+
return [
|
|
80
|
+
command,
|
|
81
|
+
{
|
|
82
|
+
...options,
|
|
83
|
+
onStart: (process) => onStart(decodeManagedResult(process))
|
|
84
|
+
},
|
|
85
|
+
...rest
|
|
86
|
+
];
|
|
112
87
|
}
|
|
113
|
-
if (!response.ok) throw new SandboxUnavailableError(`Managed Sandbox activation was rejected by the platform gate (HTTP ${response.status}).`);
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Release notification to the gate so it can drop the active lease counter.
|
|
117
|
-
* Returns the in-flight fetch as a Promise (errors swallowed) so callers can
|
|
118
|
-
* route it through `ctx.waitUntil()` and keep it alive past lifecycle
|
|
119
|
-
* teardown. Failure is silent — the gate maintains its own TTL fallback.
|
|
120
|
-
*/
|
|
121
|
-
function notifyGateRelease(ctx) {
|
|
122
|
-
const identity = resolveGateIdentity();
|
|
123
|
-
if (!identity) return Promise.resolve();
|
|
124
|
-
const sandboxId = getSandboxInstanceId(ctx);
|
|
125
|
-
return identity.gate.fetch("https://gate/sandbox/release", {
|
|
126
|
-
method: "POST",
|
|
127
|
-
headers: { "content-type": "application/json" },
|
|
128
|
-
body: JSON.stringify({
|
|
129
|
-
projectId: identity.projectId,
|
|
130
|
-
aiToken: identity.aiToken,
|
|
131
|
-
sandboxId
|
|
132
|
-
})
|
|
133
|
-
}).then(() => void 0).catch(() => {});
|
|
134
88
|
}
|
|
135
89
|
/**
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
* sessions whose `acquiredAt` ages past the threshold between acquire and
|
|
139
|
-
* release, letting new acquires exceed `sandboxMaxConcurrentInstances`. The
|
|
140
|
-
* 5 min heartbeat sits well inside the sweep window, so each successful
|
|
141
|
-
* refresh resets the stale clock. Returns the in-flight fetch as a Promise
|
|
142
|
-
* (errors swallowed) so callers can route it through `ctx.waitUntil()` and
|
|
143
|
-
* keep the alarm path itself off the critical path — a failed refresh just
|
|
144
|
-
* means the slot ages out naturally, which matches the pre-existing failure
|
|
145
|
-
* mode if the gate goes down entirely.
|
|
146
|
-
*/
|
|
147
|
-
function notifyGateRefresh(ctx) {
|
|
148
|
-
const identity = resolveGateIdentity();
|
|
149
|
-
if (!identity) return Promise.resolve();
|
|
150
|
-
const sandboxId = getSandboxInstanceId(ctx);
|
|
151
|
-
return identity.gate.fetch("https://gate/sandbox/refresh", {
|
|
152
|
-
method: "POST",
|
|
153
|
-
headers: { "content-type": "application/json" },
|
|
154
|
-
body: JSON.stringify({
|
|
155
|
-
projectId: identity.projectId,
|
|
156
|
-
aiToken: identity.aiToken,
|
|
157
|
-
sandboxId
|
|
158
|
-
})
|
|
159
|
-
}).then(() => void 0).catch(() => {});
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Sandbox variant that participates in Void platform metering: it records
|
|
163
|
-
* container runtime seconds into DO storage, emits periodic heartbeats to
|
|
164
|
-
* the usage queue, and notifies the gate when the container stops.
|
|
165
|
-
*
|
|
166
|
-
* Generated code from `void inference` wires user `Sandbox` subclasses to
|
|
167
|
-
* extend this class on platform deploys so per-tenant accounting works
|
|
168
|
-
* without user opt-in. On local dev (no usage-queue / gate bindings), all
|
|
169
|
-
* overrides degrade to no-ops and the sandbox behaves like the upstream
|
|
170
|
-
* `Sandbox` class.
|
|
90
|
+
* Retained for generated native/local Worker entries. Managed deployments host
|
|
91
|
+
* the platform-owned Sandbox class in a separate Worker and never use this DO.
|
|
171
92
|
*/
|
|
172
93
|
var VoidPlatformSandbox = class extends Sandbox {
|
|
173
94
|
async onStart() {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
const orphanedAnchor = stored.get(STORAGE_KEY_LAST_FLUSH_TS) ?? stored.get(STORAGE_KEY_START_TS);
|
|
178
|
-
if (orphanedAnchor !== void 0 && orphanedAnchor < now) {
|
|
179
|
-
const sandboxRuntimeSeconds = (now - orphanedAnchor) / 1e3;
|
|
180
|
-
await emitRuntimeSeconds(this.ctx, sandboxRuntimeSeconds);
|
|
181
|
-
await this.ctx.storage.delete([STORAGE_KEY_START_TS, STORAGE_KEY_LAST_FLUSH_TS]);
|
|
182
|
-
}
|
|
183
|
-
try {
|
|
184
|
-
await super.onStart();
|
|
185
|
-
} catch (err) {
|
|
186
|
-
this.ctx.waitUntil(notifyGateRelease(this.ctx));
|
|
187
|
-
throw err;
|
|
188
|
-
}
|
|
189
|
-
const startedAt = Date.now();
|
|
190
|
-
await this.ctx.storage.put({
|
|
191
|
-
[STORAGE_KEY_START_TS]: startedAt,
|
|
192
|
-
[STORAGE_KEY_LAST_FLUSH_TS]: startedAt
|
|
193
|
-
});
|
|
194
|
-
await this.ctx.storage.setAlarm(startedAt + HEARTBEAT_MS);
|
|
195
|
-
}
|
|
196
|
-
async alarm(alarmProps) {
|
|
197
|
-
await super.alarm(alarmProps);
|
|
198
|
-
const lastFlush = await this.ctx.storage.get(STORAGE_KEY_LAST_FLUSH_TS);
|
|
199
|
-
if (typeof lastFlush !== "number") return;
|
|
200
|
-
const now = Date.now();
|
|
201
|
-
const sandboxRuntimeSeconds = Math.max(0, (now - lastFlush) / 1e3);
|
|
202
|
-
await emitRuntimeSeconds(this.ctx, sandboxRuntimeSeconds);
|
|
203
|
-
this.ctx.waitUntil(notifyGateRefresh(this.ctx));
|
|
204
|
-
await Promise.all([this.ctx.storage.put(STORAGE_KEY_LAST_FLUSH_TS, now), this.ctx.storage.setAlarm(now + HEARTBEAT_MS)]);
|
|
205
|
-
}
|
|
206
|
-
async onStop() {
|
|
207
|
-
await this.flushFinal();
|
|
208
|
-
this.ctx.waitUntil(notifyGateRelease(this.ctx));
|
|
209
|
-
await super.onStop();
|
|
210
|
-
}
|
|
211
|
-
async onActivityExpired() {
|
|
212
|
-
await this.flushFinal();
|
|
213
|
-
this.ctx.waitUntil(notifyGateRelease(this.ctx));
|
|
214
|
-
await super.onActivityExpired();
|
|
215
|
-
}
|
|
216
|
-
async flushFinal() {
|
|
217
|
-
const lastFlush = await this.ctx.storage.get(STORAGE_KEY_LAST_FLUSH_TS);
|
|
218
|
-
if (typeof lastFlush === "number") {
|
|
219
|
-
const sandboxRuntimeSeconds = Math.max(0, (Date.now() - lastFlush) / 1e3);
|
|
220
|
-
await emitRuntimeSeconds(this.ctx, sandboxRuntimeSeconds);
|
|
221
|
-
}
|
|
222
|
-
await this.ctx.storage.delete(STORAGE_KEY_START_TS);
|
|
223
|
-
await this.ctx.storage.delete(STORAGE_KEY_LAST_FLUSH_TS);
|
|
95
|
+
const env = this.env;
|
|
96
|
+
if (env.__PROJECT_ID !== void 0 || env.__VOID_PROXY !== void 0) throw new SandboxUnavailableError("Managed Sandboxes require the platform Sandbox controller. Redeploy this application.");
|
|
97
|
+
await super.onStart();
|
|
224
98
|
}
|
|
225
99
|
};
|
|
226
|
-
/**
|
|
227
|
-
* Resolve the platform-provided sandbox stub for the given id, optionally
|
|
228
|
-
* coordinating with the platform gate to enforce per-user concurrency and
|
|
229
|
-
* runtime budgets.
|
|
230
|
-
*
|
|
231
|
-
* When the gate binding (`__VOID_PROXY` by default) is present AND the
|
|
232
|
-
* platform's `__PROJECT_ID` + `__VOID_PROXY_TOKEN` identity vars are
|
|
233
|
-
* available, we POST to `https://gate/sandbox/acquire` with the HMAC-signed
|
|
234
|
-
* body the shared proxy auth middleware expects. A `409` response means the
|
|
235
|
-
* user has exceeded a budget — we throw `SandboxLimitError` so the caller
|
|
236
|
-
* can render a clear message. Any other non-OK status (or a thrown transport
|
|
237
|
-
* error from the service binding) fails closed before returning a usable
|
|
238
|
-
* managed stub.
|
|
239
|
-
*
|
|
240
|
-
* When all reserved platform identity bindings are absent, this is a native
|
|
241
|
-
* Cloudflare or local deployment and returns the upstream stub directly.
|
|
242
|
-
*
|
|
243
|
-
* The stub is constructed BEFORE calling the gate so we can pass its opaque,
|
|
244
|
-
* namespace-specific Durable Object id (`stub.id.toString()`) as `sandboxId`.
|
|
245
|
-
* The same id is available as `ctx.id.toString()` inside lifecycle hooks, so
|
|
246
|
-
* acquire, heartbeat, and release use one globally unique instance identity
|
|
247
|
-
* even when separate projects or deployments both request the name `default`.
|
|
248
|
-
* Constructing the stub does NOT start a container — that only happens on
|
|
249
|
-
* the first method call against the stub.
|
|
250
|
-
*/
|
|
100
|
+
/** Resolve an isolated Sandbox on the current deployment. Starts on first use. */
|
|
251
101
|
async function getSandbox(id = DEFAULT_SANDBOX_ID, options) {
|
|
252
102
|
const { binding = sandboxBindingName, ...sandboxOptions } = options ?? {};
|
|
253
|
-
const
|
|
254
|
-
const
|
|
103
|
+
const runtimeEnv = getRawRuntimeEnv();
|
|
104
|
+
const service = runtimeEnv[SANDBOX_SERVICE_BINDING];
|
|
105
|
+
if (service) {
|
|
106
|
+
if (binding !== sandboxBindingName) throw new SandboxUnavailableError(`Managed Sandbox binding ${binding} is unavailable.`);
|
|
107
|
+
try {
|
|
108
|
+
return managedClient(await service.getSandbox(id, {
|
|
109
|
+
normalizeId: true,
|
|
110
|
+
...sandboxOptions
|
|
111
|
+
}));
|
|
112
|
+
} catch (error) {
|
|
113
|
+
rethrowSandboxError(error);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (runtimeEnv.__PROJECT_ID !== void 0 || runtimeEnv.__VOID_PROXY !== void 0) throw new SandboxUnavailableError("This deployment has no managed Sandbox controller. Redeploy this application.");
|
|
117
|
+
return getSandbox$1(requireRuntimeBinding(binding), id, {
|
|
255
118
|
normalizeId: true,
|
|
256
119
|
...sandboxOptions
|
|
257
120
|
});
|
|
258
|
-
await acquireManagedSandbox(stub.id.toString());
|
|
259
|
-
return stub;
|
|
260
121
|
}
|
|
261
122
|
const sandbox = { get: getSandbox };
|
|
262
123
|
//#endregion
|
|
263
|
-
export { DEFAULT_SANDBOX_BINDING, DEFAULT_SANDBOX_ID,
|
|
124
|
+
export { DEFAULT_SANDBOX_BINDING, DEFAULT_SANDBOX_ID, SANDBOX_SERVICE_BINDING, Sandbox, SandboxLimitError, SandboxUnavailableError, VoidPlatformSandbox, __setSandboxBindingName, getSandbox, sandbox };
|