void 0.23.0 → 0.25.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.
Files changed (169) hide show
  1. package/AGENTS_TEMPLATE.md +1 -1
  2. package/README.md +19 -106
  3. package/dist/{account-cmd-C84Ee8cO.mjs → account-cmd-DcR1ywt8.mjs} +5 -5
  4. package/dist/{auth-CSkdO2Bb.mjs → auth-7wuZ5ob8.mjs} +22 -49
  5. package/dist/auth-CdgZ9uag.mjs +2 -0
  6. package/dist/{auth-link-CioEg6uY.mjs → auth-link-Z6E5DYvM.mjs} +5 -6
  7. package/dist/{auth-router-BsR981d4.mjs → auth-router-BdM4avI8.mjs} +7 -7
  8. package/dist/{build-cmd-LzvNJORH.mjs → build-cmd-CEE7D-hM.mjs} +7 -8
  9. package/dist/{cache-C4MvnrMH.mjs → cache-TcZnBLtH.mjs} +6 -7
  10. package/dist/{cancel-deploy-abUxpP2n.mjs → cancel-deploy-CYoZmcmR.mjs} +4 -6
  11. package/dist/{cf-access-P0iZnu0q.mjs → cf-access-AHKBzmuu.mjs} +4 -48
  12. package/dist/{cf-access-DRsQRe6k.mjs → cf-access-TWNzXltp.mjs} +3 -11
  13. package/dist/cf-build-output-ChY6-XWP.mjs +2 -0
  14. package/dist/cli/cli.mjs +49 -46
  15. package/dist/cli/cloudflare-operation-process.mjs +16 -7
  16. package/dist/cli/env-schema-probe.mjs +3 -3
  17. package/dist/client-B4Me-9HE.mjs +2 -0
  18. package/dist/{client-RV8NVeB8.mjs → client-RsPo8wsP.mjs} +129 -33
  19. package/dist/{cloudflare-cmd-BcrVyTmJ.mjs → cloudflare-cmd-bhwCxAN6.mjs} +2 -2
  20. package/dist/{cloudflare-connect-B8uPZ4nx.mjs → cloudflare-connect-CuhRgk3k.mjs} +2 -2
  21. package/dist/{cloudflare-operations-AiWashgg.mjs → cloudflare-operations-BhbK6yTq.mjs} +1 -1
  22. package/dist/{cloudflare-operations-fxHb-byx.mjs → cloudflare-operations-CjaV4lZi.mjs} +2 -2
  23. package/dist/{connect-Bd4kJd9U.mjs → connect-DCvUmPXY.mjs} +13 -10
  24. package/dist/{create-project-Boczwj5r.mjs → create-project-C734I-Mu.mjs} +1 -1
  25. package/dist/{create-project-bMf6ffLZ.mjs → create-project-eAPgYq35.mjs} +13 -13
  26. package/dist/{db-8uG64XLl.mjs → db-C07GEdKF.mjs} +27 -30
  27. package/dist/{delete-NvbiyeJf.mjs → delete-pKMVsrpJ.mjs} +5 -6
  28. package/dist/deploy-BDu1vhSH.mjs +2 -0
  29. package/dist/{deploy-DzAIwqNU.mjs → deploy-DfsAe-T0.mjs} +9567 -9215
  30. package/dist/{dev-inbox-P0u4tM8Y.mjs → dev-inbox-D64ZKUod.mjs} +5 -6
  31. package/dist/{domain-y5Tvydvo.mjs → domain-D3uA9ize.mjs} +8 -8
  32. package/dist/{email-B3umsW75.mjs → email-z3o2cwjH.mjs} +8 -8
  33. package/dist/{env-BS6qYHDb.mjs → env-3Q8-_2IH.mjs} +7 -9
  34. package/dist/{env-types-C2_bIk_b.mjs → env-types-D5kds_OZ.mjs} +1 -1
  35. package/dist/{env-validation-DbTg7-ar.mjs → env-validation-cZBvGWaP.mjs} +1 -1
  36. package/dist/{env-validation-BPn7vk-V.mjs → env-validation-vBSQ8gw5.mjs} +3 -3
  37. package/dist/gen-ById9r2j.mjs +2 -0
  38. package/dist/{gen-B580--vC.mjs → gen-NjwoG9FK.mjs} +2 -4
  39. package/dist/{github-cmd-v45BdfKX.mjs → github-cmd-DquUq-b1.mjs} +15 -24
  40. package/dist/{headers-DWi2IXWx.mjs → headers-2rKda9Y6.mjs} +1 -1
  41. package/dist/help-DPGBwomV.mjs +2 -0
  42. package/dist/{help-daGKjXGk.mjs → help-DRZXC4fj.mjs} +8 -4
  43. package/dist/{inbound-aVHEUhKo.mjs → inbound-fRkqcXaC.mjs} +1 -1
  44. package/dist/index.d.mts +18 -14
  45. package/dist/index.mjs +2176 -2110
  46. package/dist/{info-B97bTX9N.mjs → info-BmA3_IFZ.mjs} +1 -3
  47. package/dist/{init-Bvy7zrBo.mjs → init-DT7yuuyl.mjs} +28 -27
  48. package/dist/{link-CDqqCjFl.mjs → link-CXOlqh2F.mjs} +6 -7
  49. package/dist/{list-CZj0dzKY.mjs → list-eEWVJEPn.mjs} +8 -9
  50. package/dist/{local-d1-2CMnpuW_.mjs → local-d1-Df4XpwhW.mjs} +1 -1
  51. package/dist/log-vqY3pqwI.mjs +29 -0
  52. package/dist/login-C98-sw79.mjs +2 -0
  53. package/dist/{login-UZKFM_u7.mjs → login-pWQHYVu2.mjs} +12 -10
  54. package/dist/{logs-CUZ6t9t3.mjs → logs-DnxVX7TR.mjs} +11 -13
  55. package/dist/migrate-CEu2X5DB.mjs +2 -0
  56. package/dist/{migrate-DHul7PRV.mjs → migrate-CV1on-yJ.mjs} +2 -4
  57. package/dist/{operator-args-CLgKGlwU.mjs → operator-args-CAVcmwUt.mjs} +12 -5
  58. package/dist/{operator-auth-8KnOVXVd.mjs → operator-auth-CkmTE3rt.mjs} +2 -2
  59. package/dist/{operator-client-DUwumHpQ.mjs → operator-client-LmwjxT6q.mjs} +3 -3
  60. package/dist/{operator-cmd-DBA6dl0m.mjs → operator-cmd-d-IEKgNk.mjs} +6 -6
  61. package/dist/{output-Dm_A4Tbv.mjs → output-BBsUwdyT.mjs} +22 -14
  62. package/dist/pages/client.d.mts +3 -0
  63. package/dist/pages/client.mjs +120 -29
  64. package/dist/pages/index.mjs +1 -1
  65. package/dist/{platform-args-BJdRtlLq.mjs → platform-args-Bzf8JPc2.mjs} +11 -3
  66. package/dist/platform-args-Cq6EjQro.mjs +2 -0
  67. package/dist/{platform-auth-config-B56E9YP1.mjs → platform-auth-config-0V0lA3pF.mjs} +7 -7
  68. package/dist/{platform-auth-protection-BDWO_aER.mjs → platform-auth-protection-DFeJ-JkK.mjs} +9 -9
  69. package/dist/{platform-auth-recovery-1gg4CSRe.mjs → platform-auth-recovery-ICy4muq6.mjs} +7 -7
  70. package/dist/{platform-cmd-Bt-1w6pY.mjs → platform-cmd-BPySFOew.mjs} +1 -1
  71. package/dist/{platform-cmd-DMcQStSc.mjs → platform-cmd-D7vSWMvV.mjs} +38 -28
  72. package/dist/platform-discovery-DDDUvnqp.mjs +27 -0
  73. package/dist/{platform-domain-BNkcz0OB.mjs → platform-domain-CUdY064e.mjs} +5 -5
  74. package/dist/{platform-lifecycle-BE6C_jxh.mjs → platform-lifecycle-BaUdTRPU.mjs} +1 -1
  75. package/dist/{platform-lifecycle-9OyBALhH.mjs → platform-lifecycle-Dm09JNkn.mjs} +4404 -3297
  76. package/dist/{platform-management-CjwLVQwN.mjs → platform-management-BSEc_ZeG.mjs} +48 -11
  77. package/dist/platform-management-Bp6aoH2C.mjs +2 -0
  78. package/dist/{platform-plans-config-BNGKGr4P.mjs → platform-plans-config-B0pOVQyW.mjs} +3 -3
  79. package/dist/{platform-recovery-D6KSpuFm.mjs → platform-recovery-WOZ95Uze.mjs} +4 -4
  80. package/dist/{platform-registry-QBa4DK32.mjs → platform-registry-KfNEF84O.mjs} +3 -3
  81. package/dist/{prepare-B5Mkic5u.mjs → prepare-39EvOhI6.mjs} +2 -4
  82. package/dist/prepare-CnjcTV2s.mjs +2 -0
  83. package/dist/{prepare-DOsL0CC9.mjs → prepare-DnaKBi--.mjs} +1 -1
  84. package/dist/{project-C0Fqu05O.mjs → project-BkbfDs0V.mjs} +15 -82
  85. package/dist/project-IOjBU8R6.mjs +2 -0
  86. package/dist/{project-cmd-CNzrqvBv.mjs → project-cmd-Bs5A392E.mjs} +21 -22
  87. package/dist/{project-team-DQOWPfQT.mjs → project-team-ohAWWaew.mjs} +8 -9
  88. package/dist/{project-token-CTDYU0Cc.mjs → project-token-CP01Jna6.mjs} +6 -9
  89. package/dist/{project-zero-trust-BNAkW-_0.mjs → project-zero-trust-BzkVgx35.mjs} +5 -6
  90. package/dist/prompts-6OSVA7DJ.mjs +2087 -0
  91. package/dist/prompts-ZAuJlyCj.mjs +2 -0
  92. package/dist/{provision-C4ORE7G7.mjs → provision-BEv0k-qz.mjs} +1 -1
  93. package/dist/{provision-CJFgTZY8.mjs → provision-Btj1jppf.mjs} +5 -7
  94. package/dist/{requests-MhxYnau8.mjs → requests-B3PBuGlX.mjs} +5 -6
  95. package/dist/{rollback-CJ6iSDoU.mjs → rollback-DDub9GsO.mjs} +9 -10
  96. package/dist/runtime/ai.mjs +3 -5
  97. package/dist/runtime/email/testing.mjs +2 -2
  98. package/dist/runtime/email.mjs +36 -18
  99. package/dist/runtime/remote/index.mjs +2 -2
  100. package/dist/runtime/routing.mjs +1 -1
  101. package/dist/{secret-Dli5fP0B.mjs → secret-3c72lY1U.mjs} +15 -16
  102. package/dist/{skills-D1II1Juz.mjs → skills-BPQUGClu.mjs} +1 -1
  103. package/dist/{subcommand-prompt-CY1C4fvl.mjs → subcommand-prompt-Dhom39bd.mjs} +40 -32
  104. package/dist/sveltekit.d.mts +1 -1
  105. package/dist/sveltekit.mjs +4 -9
  106. package/dist/{wrangler-7K-bW_DL.mjs → wrangler-DhUerFkW.mjs} +10 -15
  107. package/package.json +22 -23
  108. package/sandbox.Dockerfile +1 -1
  109. package/skills/void/SKILL.md +6 -1
  110. package/skills/void/docs/guide/ai.md +24 -86
  111. package/skills/void/docs/guide/auth.md +0 -2
  112. package/skills/void/docs/guide/database/d1.md +7 -7
  113. package/skills/void/docs/guide/deployment.md +58 -102
  114. package/skills/void/docs/guide/edge/headers.md +1 -1
  115. package/skills/void/docs/guide/email/domains.md +5 -1
  116. package/skills/void/docs/guide/email/sending.md +1 -1
  117. package/skills/void/docs/guide/env-vars.md +1 -5
  118. package/skills/void/docs/guide/index.md +19 -18
  119. package/skills/void/docs/guide/kv.md +0 -2
  120. package/skills/void/docs/guide/pages-routing/actions-and-forms.md +49 -47
  121. package/skills/void/docs/guide/pages-routing/overview.md +2 -2
  122. package/skills/void/docs/guide/platform/administration/email.md +0 -2
  123. package/skills/void/docs/guide/platform/administration/operations.md +11 -22
  124. package/skills/void/docs/guide/platform/administration/plans.md +1 -5
  125. package/skills/void/docs/guide/platform/administration/zero-trust.md +24 -9
  126. package/skills/void/docs/guide/platform/development/schema-ci.md +7 -1
  127. package/skills/void/docs/guide/platform/installation/ci.md +1 -1
  128. package/skills/void/docs/guide/platform/installation/credentials.md +10 -3
  129. package/skills/void/docs/guide/platform/installation/domains.md +8 -3
  130. package/skills/void/docs/guide/platform/installation/first-deployment.md +2 -2
  131. package/skills/void/docs/guide/platform/installation/maintenance.md +37 -5
  132. package/skills/void/docs/guide/platform/installation/prerequisites.md +87 -14
  133. package/skills/void/docs/guide/platform/installation/setup.md +80 -10
  134. package/skills/void/docs/guide/quickstart.md +37 -80
  135. package/skills/void/docs/guide/remote-dev.md +1 -1
  136. package/skills/void/docs/guide/sandboxes.md +36 -46
  137. package/skills/void/docs/guide/self-hosted-platform.md +20 -0
  138. package/skills/void/docs/guide/websockets.md +0 -2
  139. package/skills/void/docs/integrations/frameworks/overview.md +2 -2
  140. package/skills/void/docs/integrations/frameworks/sveltekit.md +40 -25
  141. package/skills/void/docs/integrations/nodejs-bun-deno.md +7 -2
  142. package/skills/void/docs/reference/api/resources.md +27 -0
  143. package/skills/void/docs/reference/api.md +1 -1
  144. package/skills/void/docs/reference/cli/auth.md +4 -3
  145. package/skills/void/docs/reference/cli/database.md +1 -1
  146. package/skills/void/docs/reference/cli/deploy.md +21 -1
  147. package/skills/void/docs/reference/cli/platform-installation.md +42 -27
  148. package/skills/void/docs/reference/cli/platform-operations.md +4 -8
  149. package/skills/void/docs/reference/cli/platform-zero-trust.md +14 -0
  150. package/skills/void/docs/reference/cli/platform.md +5 -0
  151. package/skills/void/docs/reference/config.md +1 -1
  152. package/skills/void/docs/reference/resource-inference.md +11 -8
  153. package/dist/auth-CCjt0hcq.mjs +0 -2
  154. package/dist/cf-build-output-_0HNWysu.mjs +0 -2
  155. package/dist/client-Cu7jWiF1.mjs +0 -2
  156. package/dist/deploy-bjXdFCtn.mjs +0 -2
  157. package/dist/dist-BuDuKZJv.mjs +0 -2
  158. package/dist/dist-CTBk70IR.mjs +0 -1310
  159. package/dist/gen-BVaUUumi.mjs +0 -2
  160. package/dist/help-DofyZuY7.mjs +0 -2
  161. package/dist/log-ChfPKsVd.mjs +0 -26
  162. package/dist/login-DYt_An22.mjs +0 -2
  163. package/dist/migrate-8_2u55MD.mjs +0 -2
  164. package/dist/platform-args-D3RXyR6h.mjs +0 -2
  165. package/dist/platform-management-CnyTdcWX.mjs +0 -2
  166. package/dist/prepare-cgvDMtSb.mjs +0 -2
  167. package/dist/project-BuUwfj6f.mjs +0 -2
  168. package/skills/void/docs/guide/env-migration.md +0 -109
  169. package/dist/{cf-build-output-BPqOT964.mjs → cf-build-output-U8o1Gl6X.mjs} +1 -1
package/dist/cli/cli.mjs CHANGED
@@ -1,11 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import { a as join } from "../dist-BVqXeR_h.mjs";
3
- import { j as log } from "../dist-CTBk70IR.mjs";
3
+ import { L as log } from "../prompts-6OSVA7DJ.mjs";
4
4
  import { n as getPackageDir } from "../agents-B_pX_HmQ.mjs";
5
5
  import { t as formatCloudflareUserMessage } from "../cloudflare-user-output-Q-k0QoNQ.mjs";
6
- import { i as printVoidHeader, n as printGlobalHelp, r as printHelpPage, t as getHelpPath } from "../help-daGKjXGk.mjs";
7
- import { r as OperatorClientError } from "../operator-client-DUwumHpQ.mjs";
8
- import { n as platformSubcommands, t as parsePlatformArgs } from "../platform-args-BJdRtlLq.mjs";
6
+ import { c as import_picocolors } from "../output-BBsUwdyT.mjs";
7
+ import { i as printVoidHeader, n as printGlobalHelp, r as printHelpPage, t as getHelpPath } from "../help-DRZXC4fj.mjs";
8
+ import { r as OperatorClientError } from "../operator-client-LmwjxT6q.mjs";
9
+ import { n as platformSubcommands, t as parsePlatformArgs } from "../platform-args-Bzf8JPc2.mjs";
9
10
  import { readFileSync } from "node:fs";
10
11
  import { parseArgs } from "node:util";
11
12
  //#region src/cli/account-args.ts
@@ -1612,7 +1613,7 @@ async function runSubcommandGroup(command, subcommands, parse, run) {
1612
1613
  const hasNamedSubcommand = args.slice(1).some((arg) => subcommands.some(({ name }) => name === arg));
1613
1614
  try {
1614
1615
  if ((!sub || sub.startsWith("-") && !hasNamedSubcommand) && process.stdin.isTTY) {
1615
- const { promptSubcommand } = await import("../subcommand-prompt-CY1C4fvl.mjs");
1616
+ const { promptSubcommand } = await import("../subcommand-prompt-Dhom39bd.mjs");
1616
1617
  if (command === "platform" && !sub) log.info("A Void platform lets a team deploy Void apps to a shared Cloudflare account.\nThis command sets up and manages platforms. Join with `void connect <url>`.\nDocs: https://void.cloud/guide/self-hosted-platform");
1617
1618
  const result = await promptSubcommand(command, subcommands);
1618
1619
  if (!result) process.exit(0);
@@ -1627,8 +1628,10 @@ async function runSubcommandGroup(command, subcommands, parse, run) {
1627
1628
  process.exit(1);
1628
1629
  }
1629
1630
  const message = formatCloudflareUserMessage(err instanceof Error ? err.message : String(err));
1630
- if (command === "platform") console.error(err instanceof OperatorClientError && err.details !== void 0 ? `${message}\nPartial result:\n${JSON.stringify(err.details, null, 2)}` : message);
1631
- else log.error(message);
1631
+ if (command === "platform") {
1632
+ const platformMessage = message.replace(/^platform:/, import_picocolors.default.bold(import_picocolors.default.red("platform:")));
1633
+ console.error(err instanceof OperatorClientError && err.details !== void 0 ? `${platformMessage}\nPartial result:\n${JSON.stringify(err.details, null, 2)}` : platformMessage);
1634
+ } else log.error(message);
1632
1635
  process.exit(1);
1633
1636
  }
1634
1637
  }
@@ -1652,7 +1655,7 @@ if (helpPath) {
1652
1655
  log.error(formatCloudflareUserMessage(err instanceof Error ? err.message : String(err)));
1653
1656
  process.exit(1);
1654
1657
  }
1655
- import("../deploy-bjXdFCtn.mjs").then(({ runDeploy }) => {
1658
+ import("../deploy-BDu1vhSH.mjs").then(({ runDeploy }) => {
1656
1659
  runDeploy(root, {
1657
1660
  projectSlug: deployArgs.projectSlug,
1658
1661
  dir: deployArgs.dir,
@@ -1670,26 +1673,26 @@ if (helpPath) {
1670
1673
  });
1671
1674
  } else if (command === "connect") (async () => {
1672
1675
  const parsed = parseConnectArgs(args.slice(1));
1673
- const { runConnectCommand } = await import("../connect-Bd4kJd9U.mjs");
1676
+ const { runConnectCommand } = await import("../connect-DCvUmPXY.mjs");
1674
1677
  await runConnectCommand(process.cwd(), parsed);
1675
1678
  })().catch((err) => {
1676
1679
  log.error(formatCloudflareUserMessage(err instanceof Error ? err.message : String(err)));
1677
1680
  process.exit(1);
1678
1681
  });
1679
- else if (command === "auth") runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (root, parsed) => import("../auth-router-BsR981d4.mjs").then(({ runAuthRouter }) => runAuthRouter(root, parsed)));
1680
- else if (command === "account") runSubcommandGroup("account", accountSubcommands, parseAccountArgs, (root, parsed) => import("../account-cmd-C84Ee8cO.mjs").then(({ runAccountCommand }) => runAccountCommand(root, parsed)));
1681
- else if (command === "platform") runSubcommandGroup("platform", platformSubcommands, parsePlatformArgs, (root, parsed) => import("../platform-cmd-Bt-1w6pY.mjs").then(({ runPlatformCommand }) => runPlatformCommand(root, parsed)));
1682
- else if (command === "cloudflare") runSubcommandGroup("cloudflare", cloudflareSubcommands, parseCloudflareArgs, (root, parsed) => import("../cloudflare-cmd-BcrVyTmJ.mjs").then(({ runCloudflareCommand }) => runCloudflareCommand(root, parsed)));
1683
- else if (command === "project") runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (root, parsed) => import("../project-cmd-CNzrqvBv.mjs").then(({ runProjectCommand }) => runProjectCommand(root, parsed)));
1684
- else if (command === "secret") runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (root, parsed) => import("../secret-Dli5fP0B.mjs").then(({ runSecretCommand }) => runSecretCommand(root, parsed)));
1685
- else if (command === "domain") runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (root, parsed) => import("../domain-y5Tvydvo.mjs").then(({ runDomainCommand }) => runDomainCommand(root, parsed)));
1686
- else if (command === "email") runSubcommandGroup("email", emailSubcommands, parseEmailArgs, (root, parsed) => import("../email-B3umsW75.mjs").then(({ runEmailCommand }) => runEmailCommand(root, parsed)));
1687
- else if (command === "db") runSubcommandGroup("db", dbSubcommands, parseDbArgs, (root, parsed) => import("../db-8uG64XLl.mjs").then(({ runDbCommand }) => runDbCommand(root, parsed)));
1688
- else if (command === "env") runSubcommandGroup("env", envSubcommands, parseEnvArgs, (root, parsed) => import("../env-BS6qYHDb.mjs").then(({ runEnvCommand }) => runEnvCommand(root, parsed)));
1689
- else if (command === "gen") runSubcommandGroup("gen", genSubcommands, parseGenArgs, (root, parsed) => import("../gen-BVaUUumi.mjs").then(({ runGenCommand }) => runGenCommand(root, parsed)));
1690
- else if (command === "github") runSubcommandGroup("github", githubSubcommands, parseGithubArgs, (root, parsed) => import("../github-cmd-v45BdfKX.mjs").then(({ runGithubCommand }) => runGithubCommand(root, parsed)));
1691
- else if (command === "build") runSubcommandGroup("build", buildSubcommands, parseBuildArgs, (root, parsed) => import("../build-cmd-LzvNJORH.mjs").then(({ runBuildCommand }) => runBuildCommand(root, parsed)));
1692
- else if (command === "info") import("../info-B97bTX9N.mjs").then(async ({ runInfoCommand }) => {
1682
+ else if (command === "auth") runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (root, parsed) => import("../auth-router-BdM4avI8.mjs").then(({ runAuthRouter }) => runAuthRouter(root, parsed)));
1683
+ else if (command === "account") runSubcommandGroup("account", accountSubcommands, parseAccountArgs, (root, parsed) => import("../account-cmd-DcR1ywt8.mjs").then(({ runAccountCommand }) => runAccountCommand(root, parsed)));
1684
+ else if (command === "platform") runSubcommandGroup("platform", platformSubcommands, parsePlatformArgs, (root, parsed) => import("../platform-cmd-BPySFOew.mjs").then(({ runPlatformCommand }) => runPlatformCommand(root, parsed)));
1685
+ else if (command === "cloudflare") runSubcommandGroup("cloudflare", cloudflareSubcommands, parseCloudflareArgs, (root, parsed) => import("../cloudflare-cmd-bhwCxAN6.mjs").then(({ runCloudflareCommand }) => runCloudflareCommand(root, parsed)));
1686
+ else if (command === "project") runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (root, parsed) => import("../project-cmd-Bs5A392E.mjs").then(({ runProjectCommand }) => runProjectCommand(root, parsed)));
1687
+ else if (command === "secret") runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (root, parsed) => import("../secret-3c72lY1U.mjs").then(({ runSecretCommand }) => runSecretCommand(root, parsed)));
1688
+ else if (command === "domain") runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (root, parsed) => import("../domain-D3uA9ize.mjs").then(({ runDomainCommand }) => runDomainCommand(root, parsed)));
1689
+ else if (command === "email") runSubcommandGroup("email", emailSubcommands, parseEmailArgs, (root, parsed) => import("../email-z3o2cwjH.mjs").then(({ runEmailCommand }) => runEmailCommand(root, parsed)));
1690
+ else if (command === "db") runSubcommandGroup("db", dbSubcommands, parseDbArgs, (root, parsed) => import("../db-C07GEdKF.mjs").then(({ runDbCommand }) => runDbCommand(root, parsed)));
1691
+ else if (command === "env") runSubcommandGroup("env", envSubcommands, parseEnvArgs, (root, parsed) => import("../env-3Q8-_2IH.mjs").then(({ runEnvCommand }) => runEnvCommand(root, parsed)));
1692
+ else if (command === "gen") runSubcommandGroup("gen", genSubcommands, parseGenArgs, (root, parsed) => import("../gen-ById9r2j.mjs").then(({ runGenCommand }) => runGenCommand(root, parsed)));
1693
+ else if (command === "github") runSubcommandGroup("github", githubSubcommands, parseGithubArgs, (root, parsed) => import("../github-cmd-DquUq-b1.mjs").then(({ runGithubCommand }) => runGithubCommand(root, parsed)));
1694
+ else if (command === "build") runSubcommandGroup("build", buildSubcommands, parseBuildArgs, (root, parsed) => import("../build-cmd-CEE7D-hM.mjs").then(({ runBuildCommand }) => runBuildCommand(root, parsed)));
1695
+ else if (command === "info") import("../info-BmA3_IFZ.mjs").then(async ({ runInfoCommand }) => {
1693
1696
  try {
1694
1697
  await runInfoCommand(process.cwd(), parseInfoArgs(args.slice(1)));
1695
1698
  } catch (err) {
@@ -1711,7 +1714,7 @@ else if (command === "prepare") {
1711
1714
  log.error(formatCloudflareUserMessage(err instanceof Error ? err.message : String(err)));
1712
1715
  process.exit(1);
1713
1716
  }
1714
- import("../prepare-B5Mkic5u.mjs").then(({ runPrepareCommand }) => {
1717
+ import("../prepare-39EvOhI6.mjs").then(({ runPrepareCommand }) => {
1715
1718
  runPrepareCommand(root, prepareArgs).catch((err) => {
1716
1719
  log.error(formatCloudflareUserMessage(err.message ?? String(err)));
1717
1720
  process.exit(1);
@@ -1719,7 +1722,7 @@ else if (command === "prepare") {
1719
1722
  });
1720
1723
  } else if (command === "init") {
1721
1724
  const root = process.cwd();
1722
- import("../init-Bvy7zrBo.mjs").then(({ runInitCommand, parseInitArgs }) => {
1725
+ import("../init-DT7yuuyl.mjs").then(({ runInitCommand, parseInitArgs }) => {
1723
1726
  let initArgs;
1724
1727
  try {
1725
1728
  initArgs = parseInitArgs(args.slice(1));
@@ -1737,7 +1740,7 @@ else if (command === "prepare") {
1737
1740
  log.error("migrate: This command takes no arguments.");
1738
1741
  process.exit(1);
1739
1742
  }
1740
- import("../migrate-8_2u55MD.mjs").then(({ runMigrateCommand }) => {
1743
+ import("../migrate-CEu2X5DB.mjs").then(({ runMigrateCommand }) => {
1741
1744
  runMigrateCommand(process.cwd()).catch((err) => {
1742
1745
  log.error(formatCloudflareUserMessage(err instanceof Error ? err.message : String(err)));
1743
1746
  process.exit(1);
@@ -1849,52 +1852,52 @@ else if (command === "prepare") {
1849
1852
  ];
1850
1853
  (async () => {
1851
1854
  printVoidHeader();
1852
- const { promptSubcommand } = await import("../subcommand-prompt-CY1C4fvl.mjs");
1855
+ const { promptSubcommand } = await import("../subcommand-prompt-Dhom39bd.mjs");
1853
1856
  const result = await promptSubcommand("", topLevelCommands);
1854
1857
  if (!result) process.exit(0);
1855
1858
  const cmd = result.subcommand;
1856
1859
  const root = process.cwd();
1857
1860
  switch (cmd) {
1858
1861
  case "connect": {
1859
- const { runConnectCommand } = await import("../connect-Bd4kJd9U.mjs");
1862
+ const { runConnectCommand } = await import("../connect-DCvUmPXY.mjs");
1860
1863
  await runConnectCommand(root, parseConnectArgs([]));
1861
1864
  return;
1862
1865
  }
1863
1866
  case "init": {
1864
- const { runInitCommand, parseInitArgs } = await import("../init-Bvy7zrBo.mjs");
1867
+ const { runInitCommand, parseInitArgs } = await import("../init-DT7yuuyl.mjs");
1865
1868
  await runInitCommand(root, parseInitArgs([]));
1866
1869
  return;
1867
1870
  }
1868
1871
  case "migrate": {
1869
- const { runMigrateCommand } = await import("../migrate-8_2u55MD.mjs");
1872
+ const { runMigrateCommand } = await import("../migrate-CEu2X5DB.mjs");
1870
1873
  await runMigrateCommand(root);
1871
1874
  return;
1872
1875
  }
1873
1876
  case "deploy": {
1874
- const { runDeploy } = await import("../deploy-bjXdFCtn.mjs");
1877
+ const { runDeploy } = await import("../deploy-BDu1vhSH.mjs");
1875
1878
  await runDeploy(root);
1876
1879
  return;
1877
1880
  }
1878
- case "auth": return runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (r, p) => import("../auth-router-BsR981d4.mjs").then(({ runAuthRouter }) => runAuthRouter(r, p)));
1879
- case "account": return runSubcommandGroup("account", accountSubcommands, parseAccountArgs, (r, p) => import("../account-cmd-C84Ee8cO.mjs").then(({ runAccountCommand }) => runAccountCommand(r, p)));
1880
- case "platform": return runSubcommandGroup("platform", platformSubcommands, parsePlatformArgs, (r, p) => import("../platform-cmd-Bt-1w6pY.mjs").then(({ runPlatformCommand }) => runPlatformCommand(r, p)));
1881
- case "cloudflare": return runSubcommandGroup("cloudflare", cloudflareSubcommands, parseCloudflareArgs, (r, p) => import("../cloudflare-cmd-BcrVyTmJ.mjs").then(({ runCloudflareCommand }) => runCloudflareCommand(r, p)));
1882
- case "project": return runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (r, p) => import("../project-cmd-CNzrqvBv.mjs").then(({ runProjectCommand }) => runProjectCommand(r, p)));
1883
- case "secret": return runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (r, p) => import("../secret-Dli5fP0B.mjs").then(({ runSecretCommand }) => runSecretCommand(r, p)));
1884
- case "domain": return runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (r, p) => import("../domain-y5Tvydvo.mjs").then(({ runDomainCommand }) => runDomainCommand(r, p)));
1885
- case "github": return runSubcommandGroup("github", githubSubcommands, parseGithubArgs, (r, p) => import("../github-cmd-v45BdfKX.mjs").then(({ runGithubCommand }) => runGithubCommand(r, p)));
1886
- case "build": return runSubcommandGroup("build", buildSubcommands, parseBuildArgs, (r, p) => import("../build-cmd-LzvNJORH.mjs").then(({ runBuildCommand }) => runBuildCommand(r, p)));
1887
- case "email": return runSubcommandGroup("email", emailSubcommands, parseEmailArgs, (r, p) => import("../email-B3umsW75.mjs").then(({ runEmailCommand }) => runEmailCommand(r, p)));
1888
- case "db": return runSubcommandGroup("db", dbSubcommands, parseDbArgs, (r, p) => import("../db-8uG64XLl.mjs").then(({ runDbCommand }) => runDbCommand(r, p)));
1889
- case "env": return runSubcommandGroup("env", envSubcommands, parseEnvArgs, (r, p) => import("../env-BS6qYHDb.mjs").then(({ runEnvCommand }) => runEnvCommand(r, p)));
1890
- case "gen": return runSubcommandGroup("gen", genSubcommands, parseGenArgs, (r, p) => import("../gen-BVaUUumi.mjs").then(({ runGenCommand }) => runGenCommand(r, p)));
1881
+ case "auth": return runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (r, p) => import("../auth-router-BdM4avI8.mjs").then(({ runAuthRouter }) => runAuthRouter(r, p)));
1882
+ case "account": return runSubcommandGroup("account", accountSubcommands, parseAccountArgs, (r, p) => import("../account-cmd-DcR1ywt8.mjs").then(({ runAccountCommand }) => runAccountCommand(r, p)));
1883
+ case "platform": return runSubcommandGroup("platform", platformSubcommands, parsePlatformArgs, (r, p) => import("../platform-cmd-BPySFOew.mjs").then(({ runPlatformCommand }) => runPlatformCommand(r, p)));
1884
+ case "cloudflare": return runSubcommandGroup("cloudflare", cloudflareSubcommands, parseCloudflareArgs, (r, p) => import("../cloudflare-cmd-bhwCxAN6.mjs").then(({ runCloudflareCommand }) => runCloudflareCommand(r, p)));
1885
+ case "project": return runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (r, p) => import("../project-cmd-Bs5A392E.mjs").then(({ runProjectCommand }) => runProjectCommand(r, p)));
1886
+ case "secret": return runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (r, p) => import("../secret-3c72lY1U.mjs").then(({ runSecretCommand }) => runSecretCommand(r, p)));
1887
+ case "domain": return runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (r, p) => import("../domain-D3uA9ize.mjs").then(({ runDomainCommand }) => runDomainCommand(r, p)));
1888
+ case "github": return runSubcommandGroup("github", githubSubcommands, parseGithubArgs, (r, p) => import("../github-cmd-DquUq-b1.mjs").then(({ runGithubCommand }) => runGithubCommand(r, p)));
1889
+ case "build": return runSubcommandGroup("build", buildSubcommands, parseBuildArgs, (r, p) => import("../build-cmd-CEE7D-hM.mjs").then(({ runBuildCommand }) => runBuildCommand(r, p)));
1890
+ case "email": return runSubcommandGroup("email", emailSubcommands, parseEmailArgs, (r, p) => import("../email-z3o2cwjH.mjs").then(({ runEmailCommand }) => runEmailCommand(r, p)));
1891
+ case "db": return runSubcommandGroup("db", dbSubcommands, parseDbArgs, (r, p) => import("../db-C07GEdKF.mjs").then(({ runDbCommand }) => runDbCommand(r, p)));
1892
+ case "env": return runSubcommandGroup("env", envSubcommands, parseEnvArgs, (r, p) => import("../env-3Q8-_2IH.mjs").then(({ runEnvCommand }) => runEnvCommand(r, p)));
1893
+ case "gen": return runSubcommandGroup("gen", genSubcommands, parseGenArgs, (r, p) => import("../gen-ById9r2j.mjs").then(({ runGenCommand }) => runGenCommand(r, p)));
1891
1894
  case "info": {
1892
- const { runInfoCommand } = await import("../info-B97bTX9N.mjs");
1895
+ const { runInfoCommand } = await import("../info-BmA3_IFZ.mjs");
1893
1896
  await runInfoCommand(root, parseInfoArgs([]));
1894
1897
  return;
1895
1898
  }
1896
1899
  case "prepare": {
1897
- const { runPrepareCommand } = await import("../prepare-B5Mkic5u.mjs");
1900
+ const { runPrepareCommand } = await import("../prepare-39EvOhI6.mjs");
1898
1901
  await runPrepareCommand(root, parsePrepareArgs([]));
1899
1902
  return;
1900
1903
  }
@@ -5,9 +5,9 @@ import { t as require_picocolors } from "../picocolors-BTps1_gs.mjs";
5
5
  import { copyFileSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
6
6
  import { fileURLToPath } from "node:url";
7
7
  import { tmpdir } from "node:os";
8
- import { spawn, spawnSync } from "node:child_process";
9
8
  import { parse } from "jsonc-parser";
10
9
  import { stripVTControlCharacters } from "node:util";
10
+ import { spawn, spawnSync } from "node:child_process";
11
11
  import { EnvHttpProxyAgent, fetch as fetch$1 } from "undici";
12
12
  import { getCloudflareAuthUseKeyringFromEnv } from "@cloudflare/workers-auth";
13
13
  import { createCfAuth, createCfProfileStore, readUserPreferences, setKeyringPreference } from "@cloudflare/workers-auth/cf";
@@ -114,7 +114,7 @@ function result(status, stdout = "", stderr = "", data) {
114
114
  ].includes(errorCode ?? 0) ? { failure: "not-found" } : {}
115
115
  };
116
116
  }
117
- function runCf(command, cwd = process.cwd()) {
117
+ function runCf(command, cwd = process.cwd(), bounds) {
118
118
  const env = cfEnvironment();
119
119
  env.CF_QUIET = "1";
120
120
  const child = spawnSync(process.execPath, [cf, ...command], {
@@ -123,7 +123,8 @@ function runCf(command, cwd = process.cwd()) {
123
123
  encoding: "utf8",
124
124
  shell: false,
125
125
  windowsHide: true,
126
- maxBuffer: 33554432,
126
+ maxBuffer: bounds?.maxOutputBytes ?? 33554432,
127
+ ...bounds ? { timeout: bounds.timeoutMs } : {},
127
128
  stdio: [
128
129
  "ignore",
129
130
  "pipe",
@@ -207,7 +208,10 @@ async function withBuildOutput(raw, sourceMain, action) {
207
208
  try {
208
209
  const main = "index.js";
209
210
  if (sourceMain) copyFileSync(sourceMain, join(scratch, main));
210
- else writeFileSync(join(scratch, main), "export default { fetch() { return new Response(\"\"); } };\n");
211
+ else {
212
+ const { VOID_SECRET_DRAFT_SOURCE } = await import("@void/deploy-cloudflare");
213
+ writeFileSync(join(scratch, main), VOID_SECRET_DRAFT_SOURCE);
214
+ }
211
215
  writeFileSync(join(scratch, "wrangler.json"), JSON.stringify({
212
216
  ...raw,
213
217
  main,
@@ -215,7 +219,7 @@ async function withBuildOutput(raw, sourceMain, action) {
215
219
  }), { mode: 384 });
216
220
  const accountId = process.env.CLOUDFLARE_ACCOUNT_ID ?? raw.account_id;
217
221
  if (typeof accountId !== "string" || !accountId) throw new Error("Cloudflare account is not pinned for Worker deployment.");
218
- const { prepareCfBuildOutput } = await import("../cf-build-output-_0HNWysu.mjs");
222
+ const { prepareCfBuildOutput } = await import("../cf-build-output-ChY6-XWP.mjs");
219
223
  const output = await prepareCfBuildOutput(scratch, accountId);
220
224
  if (!output) throw new Error("Could not prepare the Cloudflare Worker build output.");
221
225
  try {
@@ -845,11 +849,16 @@ async function workerHistory() {
845
849
  "get",
846
850
  versionId,
847
851
  "--worker-id",
848
- worker
849
- ]);
852
+ worker,
853
+ ...operation.includeSource ? ["--include", "modules"] : []
854
+ ], process.cwd(), operation.includeSource ? {
855
+ timeoutMs: 3e4,
856
+ maxOutputBytes: 1048576
857
+ } : void 0);
850
858
  if (called.status !== 0) return called;
851
859
  const version = object(parsedJson(called.stdout));
852
860
  if (version.id !== versionId || !Array.isArray(version.bindings)) throw new Error("Worker version bindings were malformed.");
861
+ if (operation.includeSource) return result(0, "", called.stderr, version);
853
862
  const resources = await readVersionResources(worker, versionId);
854
863
  return result(0, "", called.stderr, {
855
864
  ...version,
@@ -1,4 +1,4 @@
1
- import { t as findEnvFile } from "../env-types-C2_bIk_b.mjs";
1
+ import { t as findEnvFile } from "../env-types-D5kds_OZ.mjs";
2
2
  import { writeSync } from "node:fs";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { spawnSync } from "node:child_process";
@@ -169,7 +169,7 @@ function emitResult(result) {
169
169
  * facts. The import stays isolated because env.ts is arbitrary project code.
170
170
  */
171
171
  async function runFactsChild(root) {
172
- const { deriveSelfHostSchemaFacts, SelfHostSchemaError } = await import("../env-validation-DbTg7-ar.mjs");
172
+ const { deriveSelfHostSchemaFacts, SelfHostSchemaError } = await import("../env-validation-cZBvGWaP.mjs");
173
173
  try {
174
174
  emitResult({
175
175
  kind: "ok",
@@ -194,7 +194,7 @@ async function runFactsChild(root) {
194
194
  * fault → fail closed as a values-free schema error.
195
195
  */
196
196
  async function runValidateEmittedChild(root) {
197
- const { computeInvalidEmittedKeys, readEmittedWorkerVars, SelfHostSchemaError } = await import("../env-validation-DbTg7-ar.mjs");
197
+ const { computeInvalidEmittedKeys, readEmittedWorkerVars, SelfHostSchemaError } = await import("../env-validation-cZBvGWaP.mjs");
198
198
  const emitted = readEmittedWorkerVars(root);
199
199
  if (!emitted.ok) {
200
200
  emitResult({
@@ -0,0 +1,2 @@
1
+ import { r as PlatformClient } from "./client-RsPo8wsP.mjs";
2
+ export { PlatformClient };
@@ -1,9 +1,10 @@
1
1
  import { a as join } from "./dist-BVqXeR_h.mjs";
2
- import { t as cfAccessHeaders } from "./cf-access-DRsQRe6k.mjs";
3
- import { a as getApiUrl } from "./auth-CSkdO2Bb.mjs";
4
- import { s as normalizePlatformApiUrl } from "./platform-registry-QBa4DK32.mjs";
5
- import { i as isCloudflareAccessChallenge, n as ensurePlatformAccessToken, t as ensureCloudflaredToken } from "./cf-access-P0iZnu0q.mjs";
2
+ import { s as normalizePlatformApiUrl } from "./platform-registry-KfNEF84O.mjs";
3
+ import { t as cfAccessHeaders } from "./cf-access-TWNzXltp.mjs";
4
+ import { i as isCloudflareAccessChallenge, n as ensurePlatformAccessToken, t as ensureCloudflaredToken } from "./cf-access-AHKBzmuu.mjs";
5
+ import { a as getApiUrl } from "./auth-7wuZ5ob8.mjs";
6
6
  import { n as getPackageDir } from "./agents-B_pX_HmQ.mjs";
7
+ import { t as readPlatformDiscoveryResponse } from "./platform-discovery-DDDUvnqp.mjs";
7
8
  import { readFileSync } from "node:fs";
8
9
  import { stripVTControlCharacters } from "node:util";
9
10
  //#region src/cli/platform-errors.ts
@@ -106,6 +107,41 @@ function readCliVersion() {
106
107
  }
107
108
  }
108
109
  const VOID_CLI_VERSION = readCliVersion();
110
+ /** The oldest Void platform release this CLI supports. */
111
+ const MIN_PLATFORM_VERSION = "0.25.0";
112
+ const RELEASE_VERSION = /^(\d+)\.(\d+)\.(\d+)(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$/;
113
+ /**
114
+ * Version checks keyed by platform base URL. Every outcome (pass, inconclusive,
115
+ * or too old) is kept for the rest of the process, so polling commands probe
116
+ * discovery once.
117
+ */
118
+ const platformVersionChecks = /* @__PURE__ */ new Map();
119
+ /**
120
+ * Returns whether `version` is older than MIN_PLATFORM_VERSION, or null when
121
+ * it is not a release version. A prerelease sorts before its release.
122
+ */
123
+ function isOlderThanMinimumPlatform(version) {
124
+ const actual = RELEASE_VERSION.exec(version);
125
+ const minimum = RELEASE_VERSION.exec(MIN_PLATFORM_VERSION);
126
+ if (!actual) return null;
127
+ for (const part of [
128
+ 1,
129
+ 2,
130
+ 3
131
+ ]) {
132
+ const difference = Number(actual[part]) - Number(minimum[part]);
133
+ if (difference !== 0) return difference < 0;
134
+ }
135
+ return actual[4] !== void 0 && minimum[4] === void 0;
136
+ }
137
+ const UPGRADE_PLATFORM_ACTION = "Ask its administrator to upgrade the platform runtime with `void platform upgrade`.";
138
+ function assertSupportedPlatform(apiUrl, probe) {
139
+ if (probe.kind === "unknown") return;
140
+ if (probe.kind === "missing") throw new Error(`The Void platform at ${apiUrl} does not report its version, but this CLI requires ${MIN_PLATFORM_VERSION} or later. ${UPGRADE_PLATFORM_ACTION}`);
141
+ const { version } = probe;
142
+ if (version === "hosted" || isOlderThanMinimumPlatform(version) !== true) return;
143
+ throw new Error(`The Void platform at ${apiUrl} runs version ${version}, but this CLI requires ${MIN_PLATFORM_VERSION} or later. ${UPGRADE_PLATFORM_ACTION}`);
144
+ }
109
145
  /**
110
146
  * Detects the `cli_outdated` 426 response shape emitted by the platform's
111
147
  * `cliVersionGate` middleware. When present, callers should surface the
@@ -175,11 +211,20 @@ const DEPLOY_OBSERVATION_BACKOFF_MS = [
175
211
  ];
176
212
  const DEPLOY_EVENT_MAX_BYTES = 1048576;
177
213
  var DeploymentProtocolError = class extends Error {};
214
+ var DeploymentObservationTimeoutError = class extends Error {
215
+ constructor(deploymentId) {
216
+ super(`Timed out observing deployment ${deploymentId}. Inspect with \`void project status\`.`);
217
+ }
218
+ };
178
219
  function parseDeployEvent(value) {
179
220
  if (!value || typeof value !== "object" || !("event" in value) || typeof value.event !== "string") throw new DeploymentProtocolError("Invalid deployment event from platform.");
180
221
  const event = value;
181
222
  if (event.seq !== void 0 && (!Number.isSafeInteger(event.seq) || event.seq < 1)) throw new DeploymentProtocolError("Invalid deployment event sequence from platform.");
182
- if (event.event === "start" && typeof event.deploymentId !== "string" || event.event === "done" && (typeof event.deployment !== "string" || typeof event.url !== "string" || !Array.isArray(event.urls) || !event.urls.every((url) => typeof url === "string") || !Number.isSafeInteger(event.assets) || event.assets < 0 || !Number.isSafeInteger(event.workers) || event.workers < 0 || event.published !== void 0 && typeof event.published !== "boolean") || event.event === "error" && (typeof event.message !== "string" || typeof event.step !== "string")) throw new DeploymentProtocolError("Invalid deployment result from platform.");
223
+ if (event.event === "start" && typeof event.deploymentId !== "string" || event.event === "heartbeat" && (typeof event.step !== "string" || event.status !== void 0 && ![
224
+ "queued",
225
+ "running",
226
+ "recovering"
227
+ ].includes(event.status) || event.recoveryAt !== void 0 && (typeof event.recoveryAt !== "string" || !Number.isFinite(Date.parse(event.recoveryAt)))) || event.event === "done" && (typeof event.deployment !== "string" || typeof event.url !== "string" || !Array.isArray(event.urls) || !event.urls.every((url) => typeof url === "string") || !Number.isSafeInteger(event.assets) || event.assets < 0 || !Number.isSafeInteger(event.workers) || event.workers < 0 || event.published !== void 0 && typeof event.published !== "boolean") || event.event === "error" && (typeof event.message !== "string" || typeof event.step !== "string")) throw new DeploymentProtocolError("Invalid deployment result from platform.");
183
228
  return event;
184
229
  }
185
230
  /**
@@ -190,12 +235,20 @@ var PlatformClient = class {
190
235
  authHeaders;
191
236
  accessHeaders;
192
237
  cliLog;
238
+ checkPlatformVersion;
193
239
  apiUrl;
240
+ /**
241
+ * `checkPlatformVersion: false` skips the minimum platform version check.
242
+ * Only login uses it, so users can still sign in to an older platform.
243
+ */
194
244
  constructor(token, options) {
195
- if (typeof options === "string") this.baseUrl = normalizePlatformApiUrl(options);
196
- else {
245
+ if (typeof options === "string") {
246
+ this.baseUrl = normalizePlatformApiUrl(options);
247
+ this.checkPlatformVersion = true;
248
+ } else {
197
249
  this.baseUrl = normalizePlatformApiUrl(options?.apiUrl ?? getApiUrl(options?.root));
198
250
  this.cliLog = options?.cliLog;
251
+ this.checkPlatformVersion = options?.checkPlatformVersion !== false;
199
252
  }
200
253
  this.apiUrl = this.baseUrl;
201
254
  ensureCloudflaredToken(this.baseUrl);
@@ -207,6 +260,46 @@ var PlatformClient = class {
207
260
  }
208
261
  async request(url, options = {}) {
209
262
  if (new URL(url).origin !== this.baseUrl) throw new Error("Platform credentials cannot be sent to another origin.");
263
+ if (this.checkPlatformVersion) await this.ensureSupportedPlatform();
264
+ return this.send(url, options);
265
+ }
266
+ /**
267
+ * Checks the platform version once per process and base URL. Concurrent
268
+ * first requests share one check, and its outcome is kept for later requests.
269
+ */
270
+ ensureSupportedPlatform() {
271
+ const apiUrl = this.baseUrl;
272
+ const cached = platformVersionChecks.get(apiUrl);
273
+ if (cached) return cached;
274
+ const check = this.probePlatformVersion().then((probe) => assertSupportedPlatform(apiUrl, probe));
275
+ platformVersionChecks.set(apiUrl, check);
276
+ return check;
277
+ }
278
+ /** Reads the platform version from public discovery, without credentials. */
279
+ async probePlatformVersion() {
280
+ let response;
281
+ try {
282
+ response = await this.send(`${this.baseUrl}/.well-known/void-platform`, {
283
+ headers: { Accept: "application/json" },
284
+ signal: AbortSignal.timeout(15e3)
285
+ });
286
+ } catch {
287
+ return { kind: "unknown" };
288
+ }
289
+ if (response.status === 404) {
290
+ await response.body?.cancel();
291
+ return { kind: "missing" };
292
+ }
293
+ try {
294
+ return {
295
+ kind: "version",
296
+ version: (await readPlatformDiscoveryResponse(this.baseUrl, response)).platformVersion
297
+ };
298
+ } catch {
299
+ return { kind: "unknown" };
300
+ }
301
+ }
302
+ async send(url, options) {
210
303
  if (!this.accessHeaders["CF-Access-Client-Id"]) ensureCloudflaredToken(this.baseUrl);
211
304
  const send = () => {
212
305
  const currentAccessHeaders = cfAccessHeaders(process.env, this.baseUrl);
@@ -259,7 +352,6 @@ var PlatformClient = class {
259
352
  /** A lightweight project list for interactive linking. */
260
353
  async listProjectChoices() {
261
354
  const res = await this.request(`${this.baseUrl}/projects/choices`, { headers: { ...this.authHeaders } });
262
- if (res.status === 404) throw new Error("This platform does not support project lookup. Ask its administrator to upgrade the platform runtime.");
263
355
  if (!res.ok) await throwPlatformApiError("Failed to list project choices", res);
264
356
  return res.json();
265
357
  }
@@ -275,7 +367,6 @@ var PlatformClient = class {
275
367
  const url = new URL(`${this.baseUrl}/projects/resolve`);
276
368
  url.searchParams.set("slug", slug);
277
369
  const res = await this.request(url.toString(), { headers: { ...this.authHeaders } });
278
- if (res.status === 404) throw new Error("This platform does not support project lookup. Ask its administrator to upgrade the platform runtime.");
279
370
  if (!res.ok) await throwPlatformApiError("Failed to resolve project", res);
280
371
  return (await res.json()).project;
281
372
  }
@@ -589,22 +680,20 @@ var PlatformClient = class {
589
680
  throw new PlatformApiError("Deploy failed", res.status, body, isCloudflareAccessChallenge(res) ? void 0 : "deploy");
590
681
  }
591
682
  const receipt = res.headers.get("x-void-deployment-id");
592
- if (receipt !== null && !/^[A-Za-z0-9_-]{1,128}$/.test(receipt)) {
683
+ const observationDeadline = Date.now() + DEPLOY_OBSERVATION_DEADLINE_MS;
684
+ if (receipt === null || !/^[A-Za-z0-9_-]{1,128}$/.test(receipt)) {
593
685
  res.body?.cancel().catch(() => {});
594
- throw new Error("Invalid deployment receipt from platform.");
686
+ throw new Error(receipt === null ? "Platform returned no deployment receipt." : "Invalid deployment receipt from platform.");
595
687
  }
596
688
  let cursor = 0;
597
689
  let terminal = false;
598
690
  if (!res.body) {
599
- if (receipt) {
600
- yield {
601
- event: "start",
602
- deploymentId: receipt
603
- };
604
- yield* this.followDeploymentEvents(projectId, receipt, cursor);
605
- return;
606
- }
607
- throw new Error("Platform returned no deployment event stream.");
691
+ yield {
692
+ event: "start",
693
+ deploymentId: receipt
694
+ };
695
+ yield* this.followDeploymentEvents(projectId, receipt, cursor, observationDeadline);
696
+ return;
608
697
  }
609
698
  const reader = res.body.getReader();
610
699
  const decoder = new TextDecoder();
@@ -617,10 +706,11 @@ var PlatformClient = class {
617
706
  let streamFinished = false;
618
707
  let readTimer;
619
708
  const read = async () => {
620
- if (!receipt) return reader.read();
709
+ const remaining = observationDeadline - Date.now();
710
+ if (remaining <= 0) throw new DeploymentObservationTimeoutError(receipt);
621
711
  try {
622
712
  return await Promise.race([reader.read(), new Promise((_, reject) => {
623
- readTimer = setTimeout(() => reject(/* @__PURE__ */ new TypeError("Deployment event stream timed out.")), DEPLOY_OBSERVATION_TIMEOUT_MS);
713
+ readTimer = setTimeout(() => reject(Date.now() >= observationDeadline ? new DeploymentObservationTimeoutError(receipt) : /* @__PURE__ */ new TypeError("Deployment event stream timed out.")), Math.min(DEPLOY_OBSERVATION_TIMEOUT_MS, remaining));
624
714
  })]);
625
715
  } finally {
626
716
  clearTimeout(readTimer);
@@ -641,17 +731,18 @@ var PlatformClient = class {
641
731
  event: lastEventName,
642
732
  raw: line.slice(0, 200)
643
733
  });
644
- if (receipt && event.event === "start") return null;
734
+ if (event.event === "start") return null;
645
735
  terminal = event.event === "done" || event.event === "error";
646
736
  return event;
647
737
  };
648
738
  try {
649
- if (receipt) yield {
739
+ yield {
650
740
  event: "start",
651
741
  deploymentId: receipt
652
742
  };
653
743
  while (true) {
654
744
  const { done, value } = await read();
745
+ if (Date.now() >= observationDeadline) throw new DeploymentObservationTimeoutError(receipt);
655
746
  if (done) {
656
747
  streamFinished = true;
657
748
  buffer += decoder.decode();
@@ -688,28 +779,28 @@ var PlatformClient = class {
688
779
  eventCount,
689
780
  lastEvent: lastEventName
690
781
  });
691
- if (!receipt || err instanceof DeploymentProtocolError || err instanceof SyntaxError || err instanceof DOMException && err.name === "AbortError") throw err;
782
+ if (err instanceof DeploymentObservationTimeoutError || err instanceof DeploymentProtocolError || err instanceof SyntaxError || err instanceof DOMException && err.name === "AbortError") throw err;
692
783
  } finally {
693
784
  clearTimeout(readTimer);
694
785
  if (!streamFinished) reader.cancel().catch(() => {});
695
786
  reader.releaseLock();
696
787
  }
697
- if (receipt && !terminal) yield* this.followDeploymentEvents(projectId, receipt, cursor);
788
+ if (!terminal) yield* this.followDeploymentEvents(projectId, receipt, cursor, observationDeadline);
698
789
  }
699
- async *followDeploymentEvents(projectId, deploymentId, since) {
790
+ async *followDeploymentEvents(projectId, deploymentId, since, deadline) {
700
791
  let cursor = since;
701
792
  let failures = 0;
702
- const deadline = Date.now() + DEPLOY_OBSERVATION_DEADLINE_MS;
703
793
  while (Date.now() < deadline) {
704
794
  const url = `${this.baseUrl}/projects/${encodeURIComponent(projectId)}/deployments/${encodeURIComponent(deploymentId)}/events?since=${cursor}`;
705
795
  let page;
706
796
  try {
707
797
  const response = await this.request(url, {
708
798
  headers: { ...this.authHeaders },
709
- signal: AbortSignal.timeout(DEPLOY_OBSERVATION_TIMEOUT_MS)
799
+ signal: AbortSignal.timeout(Math.max(1, Math.min(DEPLOY_OBSERVATION_TIMEOUT_MS, deadline - Date.now())))
710
800
  });
711
801
  if (!response.ok) await throwPlatformApiError("Failed to observe deployment", response, "read");
712
802
  page = await response.json();
803
+ if (Date.now() >= deadline) throw new DeploymentObservationTimeoutError(deploymentId);
713
804
  } catch (err) {
714
805
  if (!(err instanceof TypeError || err instanceof DOMException && err.name === "TimeoutError" || err instanceof PlatformApiError && (err.status === 429 || err.status >= 500)) || failures >= DEPLOY_OBSERVATION_BACKOFF_MS.length) throw err;
715
806
  const delayMs = DEPLOY_OBSERVATION_BACKOFF_MS[failures++];
@@ -718,7 +809,7 @@ var PlatformClient = class {
718
809
  cursor,
719
810
  delayMs
720
811
  });
721
- await sleep(delayMs);
812
+ await sleep(Math.min(delayMs, Math.max(0, deadline - Date.now())));
722
813
  continue;
723
814
  }
724
815
  failures = 0;
@@ -734,9 +825,14 @@ var PlatformClient = class {
734
825
  if (event.event === "done" || event.event === "error") return;
735
826
  }
736
827
  if (page.terminal) throw new Error("Platform finished deployment without a terminal result.");
737
- await sleep(1e3);
828
+ if (page.heartbeat !== void 0) {
829
+ const heartbeat = parseDeployEvent(page.heartbeat);
830
+ if (heartbeat.event !== "heartbeat" || heartbeat.deploymentId !== void 0 && heartbeat.deploymentId !== deploymentId) throw new DeploymentProtocolError("Invalid deployment observation heartbeat.");
831
+ yield heartbeat;
832
+ }
833
+ await sleep(Math.min(1e3, Math.max(0, deadline - Date.now())));
738
834
  }
739
- throw new Error(`Timed out observing deployment ${deploymentId}. Inspect with \`void project status\`.`);
835
+ throw new DeploymentObservationTimeoutError(deploymentId);
740
836
  }
741
837
  async listSecrets(projectId) {
742
838
  const res = await this.request(`${this.baseUrl}/projects/${projectId}/secrets`, { headers: { ...this.authHeaders } });
@@ -1147,4 +1243,4 @@ function sleep(ms) {
1147
1243
  return new Promise((resolve) => setTimeout(resolve, ms));
1148
1244
  }
1149
1245
  //#endregion
1150
- export { readCliVersion as a, isExpiredTokenError as i, PlatformClient as n, parsePlatformErrorBody as o, isCliOutdatedError as r, platformErrorMessage as s, PlatformApiError as t };
1246
+ export { isExpiredTokenError as a, platformErrorMessage as c, isCliOutdatedError as i, PlatformApiError as n, readCliVersion as o, PlatformClient as r, parsePlatformErrorBody as s, MIN_PLATFORM_VERSION as t };
@@ -1,6 +1,6 @@
1
1
  import { t as basename } from "./dist-BVqXeR_h.mjs";
2
- import { y as readRootWranglerConfig } from "./wrangler-7K-bW_DL.mjs";
3
- import { j as log } from "./dist-CTBk70IR.mjs";
2
+ import { y as readRootWranglerConfig } from "./wrangler-DhUerFkW.mjs";
3
+ import { L as log } from "./prompts-6OSVA7DJ.mjs";
4
4
  import { a as parseCloudflareAuthSession, i as ensureCloudflareAuthentication, n as cloudflareCredentialOverrides, r as createBundledCloudflareAuthRunner } from "./cloudflare-auth-Qdc7tw8F.mjs";
5
5
  //#region src/cli/cloudflare-cmd.ts
6
6
  async function runCloudflareCommand(root, args) {
@@ -1,6 +1,6 @@
1
1
  import { a as join, t as basename } from "./dist-BVqXeR_h.mjs";
2
- import { A as writeProvisionedWranglerConfig, i as LATEST_KNOWN_COMPAT_DATE, y as readRootWranglerConfig } from "./wrangler-7K-bW_DL.mjs";
3
- import { I as select, W as isCancel, j as log } from "./dist-CTBk70IR.mjs";
2
+ import { A as writeProvisionedWranglerConfig, i as LATEST_KNOWN_COMPAT_DATE, y as readRootWranglerConfig } from "./wrangler-DhUerFkW.mjs";
3
+ import { K as select, L as log, tt as isCancel } from "./prompts-6OSVA7DJ.mjs";
4
4
  import { i as ensureCloudflareAuthentication, r as createBundledCloudflareAuthRunner } from "./cloudflare-auth-Qdc7tw8F.mjs";
5
5
  import { existsSync } from "node:fs";
6
6
  //#region src/cli/cloudflare-connect.ts
@@ -1,2 +1,2 @@
1
- import { _ as resolveCloudflareD1Context, b as tailCloudflareWorker, c as listCloudflareDomains, g as readCloudflareWorkerStatus, h as readCloudflareD1Migrations, l as listCloudflareSecrets, m as putCloudflareSecret, n as applyCloudflareD1Migrations, o as deleteCloudflareSecret, r as changeCloudflareDomain, s as executeCloudflareD1Sql, t as activateCloudflareExistingVersion, v as resolveCloudflareOperationContext, y as syncCloudflareSecrets } from "./cloudflare-operations-fxHb-byx.mjs";
1
+ import { _ as resolveCloudflareD1Context, b as tailCloudflareWorker, c as listCloudflareDomains, g as readCloudflareWorkerStatus, h as readCloudflareD1Migrations, l as listCloudflareSecrets, m as putCloudflareSecret, n as applyCloudflareD1Migrations, o as deleteCloudflareSecret, r as changeCloudflareDomain, s as executeCloudflareD1Sql, t as activateCloudflareExistingVersion, v as resolveCloudflareOperationContext, y as syncCloudflareSecrets } from "./cloudflare-operations-CjaV4lZi.mjs";
2
2
  export { activateCloudflareExistingVersion, applyCloudflareD1Migrations, changeCloudflareDomain, deleteCloudflareSecret, executeCloudflareD1Sql, listCloudflareDomains, listCloudflareSecrets, putCloudflareSecret, readCloudflareD1Migrations, readCloudflareWorkerStatus, resolveCloudflareD1Context, resolveCloudflareOperationContext, syncCloudflareSecrets, tailCloudflareWorker };
@@ -1,9 +1,9 @@
1
1
  import { a as join } from "./dist-BVqXeR_h.mjs";
2
2
  import { i as persistCloudflareConfig, r as materializeCloudflareConfig } from "./cloudflare-config-Bktvwtpf.mjs";
3
- import { C as readWranglerPublishedTrafficSnapshot, j as writeWranglerPublishedTrafficSnapshot, k as updateWranglerCustomDomain, x as readWranglerCustomDomains } from "./wrangler-7K-bW_DL.mjs";
3
+ import { C as readWranglerPublishedTrafficSnapshot, j as writeWranglerPublishedTrafficSnapshot, k as updateWranglerCustomDomain, x as readWranglerCustomDomains } from "./wrangler-DhUerFkW.mjs";
4
4
  import { r as scanWranglerDotenvKeys } from "./dotenv-VQxupEUv.mjs";
5
5
  import { t as createCloudflareProcessRunner } from "./cloudflare-process-B-wekeR6.mjs";
6
- import { _ as resolvePinnedApiBaseUrl, g as provisionEnv, r as assertNoTransportRedirectInProjectDotenv, s as deleteEnvVarCaseAware } from "./provision-CJFgTZY8.mjs";
6
+ import { _ as resolvePinnedApiBaseUrl, g as provisionEnv, r as assertNoTransportRedirectInProjectDotenv, s as deleteEnvVarCaseAware } from "./provision-Btj1jppf.mjs";
7
7
  import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
8
8
  import { tmpdir } from "node:os";
9
9
  import { deployCloudflareVersionTraffic, encodeCloudflareVersionMessage, parseCloudflareVersionMessage, parseRootWranglerConfig, readBindingFieldPresence, readCloudflareTriggerConfig, readWranglerTopLevelString, resolveD1MigrateTarget, stabilizeCloudflareVersionTriggers } from "@void/deploy-cloudflare";