void 0.7.0 → 0.7.2

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 (168) hide show
  1. package/dist/agents-DqkFfc2c.mjs +151 -0
  2. package/dist/{auth-cmd-Dx8oPKZC.mjs → auth-cmd-Dk0acCT5.mjs} +2 -2
  3. package/dist/{better-auth-shared-C9_GHSkR.d.mts → better-auth-shared-CZsIpjey.d.mts} +1 -1
  4. package/dist/{cache-W82I8ihI.mjs → cache-DGSZ5Bh6.mjs} +2 -2
  5. package/dist/{cancel-deploy-BOBTqqh0.mjs → cancel-deploy-CrY3kt93.mjs} +1 -1
  6. package/dist/cli/cli.mjs +37 -177
  7. package/dist/{client-snXOjrp1.mjs → client-DCqnMpDt.mjs} +161 -18
  8. package/dist/{create-project-BIA15W7z.mjs → create-project-Bg88Kq_I.mjs} +3 -3
  9. package/dist/{db-DsRoMcfN.mjs → db-ClNu7vYQ.mjs} +13 -13
  10. package/dist/{delete-DAP6yDc7.mjs → delete-DXcX1yQZ.mjs} +2 -2
  11. package/dist/{deploy-BPKblFx6.mjs → deploy-BkjqNk9U.mjs} +888 -185
  12. package/dist/{domain-BGofcQ6I.mjs → domain-CDQhvYNZ.mjs} +1 -1
  13. package/dist/{env-CyG3tvU0.mjs → env-CnrQY2b6.mjs} +1 -1
  14. package/dist/{env-helpers-Dr9Y7RnE.d.mts → env-helpers-CbeM_7-k.d.mts} +1 -1
  15. package/dist/{gen-U0Ktr4Zd.mjs → gen-C0EY2k27.mjs} +1 -1
  16. package/dist/{handler-B0ds0OHJ.d.mts → handler-dKQWyF-G.d.mts} +3 -3
  17. package/dist/index.d.mts +3 -3
  18. package/dist/index.mjs +13 -12
  19. package/dist/{init-C7wS5iGP.mjs → init-CPny6w9D.mjs} +63 -28
  20. package/dist/{link-p2R6NbgN.mjs → link-eZ0aiHFK.mjs} +2 -2
  21. package/dist/{list-Bfel-QLc.mjs → list-ztyEz4TW.mjs} +2 -2
  22. package/dist/{login-CkcXUiIu.mjs → login-B5HHT32i.mjs} +1 -1
  23. package/dist/{logs-DmkrRvx6.mjs → logs-J4BN0LXd.mjs} +1 -1
  24. package/dist/{mcp-CaQzfeUi.mjs → mcp-Bdu9bnjR.mjs} +1 -1
  25. package/dist/{node-DDfXj10V.mjs → node-DFqMcZR1.mjs} +3 -3
  26. package/dist/pages/client.d.mts +1 -1
  27. package/dist/pages/client.mjs +3 -0
  28. package/dist/pages/head-client.d.mts +1 -1
  29. package/dist/pages/head.d.mts +1 -1
  30. package/dist/pages/index.d.mts +2 -2
  31. package/dist/pages/index.mjs +1 -1
  32. package/dist/pages/islands-plugin.d.mts +1 -1
  33. package/dist/pages/protocol.d.mts +2 -2
  34. package/dist/pages/protocol.mjs +23 -18
  35. package/dist/{prepare-BAtWufvm.mjs → prepare-DKkx-2Kt.mjs} +1 -1
  36. package/dist/{project-cmd-B7lQp3F3.mjs → project-cmd-DKiQYdSd.mjs} +8 -8
  37. package/dist/{protocol-BWzXs2A2.d.mts → protocol-CK4OFwfR.d.mts} +2 -2
  38. package/dist/{rollback-gyC59l7U.mjs → rollback-ZNvT8T54.mjs} +1 -1
  39. package/dist/{runner-6Ep3fNQu.mjs → runner-BUPRnMFN.mjs} +1 -1
  40. package/dist/runtime/ai.mjs +1 -1
  41. package/dist/runtime/auth.d.mts +1 -1
  42. package/dist/runtime/better-auth-pg.d.mts +1 -1
  43. package/dist/runtime/better-auth-pg.mjs +2 -2
  44. package/dist/runtime/better-auth.d.mts +1 -1
  45. package/dist/runtime/better-auth.mjs +2 -2
  46. package/dist/runtime/client.d.mts +2 -2
  47. package/dist/runtime/client.mjs +1 -1
  48. package/dist/runtime/env-helpers.d.mts +1 -1
  49. package/dist/runtime/env-public-client.d.mts +1 -1
  50. package/dist/runtime/env-public.d.mts +2 -2
  51. package/dist/runtime/env-public.mjs +1 -1
  52. package/dist/runtime/env.mjs +1 -1
  53. package/dist/runtime/fetch-stream.d.mts +1 -1
  54. package/dist/runtime/fetch-stream.mjs +1 -1
  55. package/dist/runtime/fetch.d.mts +1 -1
  56. package/dist/runtime/fetch.mjs +1 -1
  57. package/dist/runtime/handler.d.mts +1 -1
  58. package/dist/runtime/handler.mjs +1 -1
  59. package/dist/runtime/isr.mjs +1 -1
  60. package/dist/runtime/migration-handler.mjs +2 -2
  61. package/dist/runtime/validator.d.mts +1 -1
  62. package/dist/runtime/ws-server.d.mts +2 -2
  63. package/dist/runtime/ws.d.mts +3 -3
  64. package/dist/{secret-CeRSukgM.mjs → secret-BXHx515u.mjs} +2 -2
  65. package/dist/{skills-ipldjlKE.mjs → skills-CbuYOthf.mjs} +1 -1
  66. package/package.json +20 -20
  67. package/skills/void/docs/guide/deployment.md +4 -6
  68. package/skills/void/docs/index.md +3 -3
  69. package/skills/void/docs/node_modules/void/AGENTS.md +1 -1
  70. package/skills/void/docs/node_modules/void/node_modules/@types/node/README.md +1 -1
  71. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@types/node/README.md +1 -1
  72. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/AGENTS.md +15 -0
  73. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/README.md +208 -0
  74. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/build.md +21 -0
  75. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/fmt.md +18 -0
  76. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/index.md +31 -0
  77. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/lint.md +24 -0
  78. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/pack.md +17 -0
  79. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/run.md +249 -0
  80. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/staged.md +15 -0
  81. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/test.md +18 -0
  82. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/build.md +40 -0
  83. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/cache.md +119 -0
  84. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/check.md +44 -0
  85. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/ci.md +64 -0
  86. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/commit-hooks.md +51 -0
  87. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/create.md +88 -0
  88. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/dev.md +24 -0
  89. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/env.md +102 -0
  90. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/fmt.md +41 -0
  91. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/ide-integration.md +101 -0
  92. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/implode.md +23 -0
  93. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/index.md +128 -0
  94. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/install.md +147 -0
  95. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/lint.md +50 -0
  96. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/migrate.md +173 -0
  97. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/pack.md +61 -0
  98. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/run.md +324 -0
  99. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/test.md +35 -0
  100. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/troubleshooting.md +132 -0
  101. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/upgrade.md +49 -0
  102. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/vpx.md +66 -0
  103. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/why.md +39 -0
  104. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/index.md +12 -0
  105. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/team.md +35 -0
  106. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/templates/generator/README.md +35 -0
  107. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/templates/monorepo/README.md +29 -0
  108. package/skills/void/docs/node_modules/void/node_modules/vite-plus/AGENTS.md +15 -0
  109. package/skills/void/docs/node_modules/void/node_modules/vite-plus/README.md +208 -0
  110. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/build.md +21 -0
  111. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/fmt.md +18 -0
  112. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/index.md +31 -0
  113. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/lint.md +24 -0
  114. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/pack.md +17 -0
  115. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/run.md +249 -0
  116. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/staged.md +15 -0
  117. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/test.md +18 -0
  118. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/build.md +40 -0
  119. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/cache.md +119 -0
  120. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/check.md +44 -0
  121. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/ci.md +64 -0
  122. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/commit-hooks.md +51 -0
  123. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/create.md +88 -0
  124. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/dev.md +24 -0
  125. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/env.md +102 -0
  126. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/fmt.md +41 -0
  127. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/ide-integration.md +101 -0
  128. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/implode.md +23 -0
  129. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/index.md +128 -0
  130. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/install.md +147 -0
  131. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/lint.md +50 -0
  132. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/migrate.md +173 -0
  133. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/pack.md +61 -0
  134. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/run.md +324 -0
  135. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/test.md +35 -0
  136. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/troubleshooting.md +132 -0
  137. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/upgrade.md +49 -0
  138. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/vpx.md +66 -0
  139. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/why.md +39 -0
  140. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/index.md +12 -0
  141. package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/team.md +35 -0
  142. package/skills/void/docs/node_modules/void/node_modules/vite-plus/templates/generator/README.md +35 -0
  143. package/skills/void/docs/node_modules/void/node_modules/vite-plus/templates/monorepo/README.md +29 -0
  144. package/skills/void/docs/reference/cli.md +10 -7
  145. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/tsdown/README.md +0 -55
  146. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite/LICENSE.md +0 -2230
  147. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite/README.md +0 -20
  148. package/skills/void/docs/node_modules/void/node_modules/tsdown/README.md +0 -55
  149. package/skills/void/docs/node_modules/void/node_modules/vite/LICENSE.md +0 -2230
  150. package/skills/void/docs/node_modules/void/node_modules/vite/README.md +0 -20
  151. /package/dist/{auth-BdsJ0Aff.d.mts → auth-DrfOTMmr.d.mts} +0 -0
  152. /package/dist/{auth-migrations-BAtAck2g.mjs → auth-migrations-BwLPwRgH.mjs} +0 -0
  153. /package/dist/{better-auth-shared-CdYmQGry.mjs → better-auth-shared-APuDaPqW.mjs} +0 -0
  154. /package/dist/{defer-DcxEsVH1.mjs → defer-2ARBu8Et.mjs} +0 -0
  155. /package/dist/{drizzle-NnudE_UN.mjs → drizzle-C-NRqGhx.mjs} +0 -0
  156. /package/dist/{env-raw-BDL4TvdN.mjs → env-raw-DtfQ9E31.mjs} +0 -0
  157. /package/dist/{fetch-error-BQ8sZ5Nd.mjs → fetch-error-CEr0ACTl.mjs} +0 -0
  158. /package/dist/{fetch-error-CVZ5CGA-.d.mts → fetch-error-DflegrF3.d.mts} +0 -0
  159. /package/dist/{head-P-egrtFE.d.mts → head-CZGAunBV.d.mts} +0 -0
  160. /package/dist/{headers-DCXc7mDs.mjs → headers-YVkHjOyq.mjs} +0 -0
  161. /package/dist/{preset-D4I73kT4.mjs → preset-DFvePt0l.mjs} +0 -0
  162. /package/dist/{project-slug-CKam8lF9.mjs → project-slug-KRvHQEQI.mjs} +0 -0
  163. /package/dist/{resolve-project-Br5BR03U.mjs → resolve-project-DdjLQ2tB.mjs} +0 -0
  164. /package/dist/{runner-pg-D0wWHYnr.mjs → runner-pg-BI6f6Ncm.mjs} +0 -0
  165. /package/dist/{standard-schema-9CRjx-uR.d.mts → standard-schema-BfGDWXff.d.mts} +0 -0
  166. /package/dist/{subcommand-prompt-BKjuNAPb.mjs → subcommand-prompt-BMS1TNG5.mjs} +0 -0
  167. /package/dist/{types-mHOEwpW4.d.mts → types-AdKzPp2C.d.mts} +0 -0
  168. /package/dist/{yarn-pnp-BFqMV_bl.mjs → yarn-pnp-6LD6_3Ej.mjs} +0 -0
@@ -3,6 +3,7 @@ import { a as join } from "./pathe.M-eThtNZ-D-kmWkCS.mjs";
3
3
  import { s as import_picocolors } from "./output-BwlcIYSR.mjs";
4
4
  import { t as isVoidInternalStaging } from "./project-TqORyHn8.mjs";
5
5
  import { t as cfAccessHeaders } from "./cf-access-Dee5cXxL.mjs";
6
+ import { r as getPackageDir } from "./agents-DqkFfc2c.mjs";
6
7
  import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
7
8
  import { homedir } from "node:os";
8
9
  import { Entry } from "@napi-rs/keyring";
@@ -265,9 +266,34 @@ function isGatedHost(apiUrl) {
265
266
  var client_exports = /* @__PURE__ */ __exportAll({
266
267
  PlatformApiError: () => PlatformApiError,
267
268
  PlatformClient: () => PlatformClient,
269
+ isCliOutdatedError: () => isCliOutdatedError,
268
270
  isExpiredTokenError: () => isExpiredTokenError,
269
- parsePlatformErrorBody: () => parsePlatformErrorBody
271
+ parsePlatformErrorBody: () => parsePlatformErrorBody,
272
+ readCliVersion: () => readCliVersion
270
273
  });
274
+ /**
275
+ * Current CLI version. Sent as `X-Void-CLI-Version` on every platform
276
+ * request so the platform's CLI-version gate can refuse stale CLIs
277
+ * cleanly (HTTP 426 + `cli_outdated`) instead of letting a wire
278
+ * mismatch surface as an opaque parse error.
279
+ *
280
+ * Resolved once per process. Returns `null` when package.json can't be
281
+ * read or has no `version` string — the ctor then OMITS the header
282
+ * entirely. We deliberately do NOT send a placeholder string like
283
+ * "unknown": the platform treats present-but-unparseable headers as a
284
+ * stale-CLI signal and would 426 the request, bricking the CLI on any
285
+ * packaging error. Missing-header is the documented pass-through path.
286
+ */
287
+ function readCliVersion() {
288
+ try {
289
+ const pkgPath = join(getPackageDir(), "package.json");
290
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
291
+ return typeof pkg.version === "string" ? pkg.version : null;
292
+ } catch {
293
+ return null;
294
+ }
295
+ }
296
+ const VOID_CLI_VERSION = readCliVersion();
271
297
  function parsePlatformErrorBody(body) {
272
298
  try {
273
299
  const parsed = JSON.parse(body);
@@ -277,16 +303,29 @@ function parsePlatformErrorBody(body) {
277
303
  return null;
278
304
  }
279
305
  }
306
+ /**
307
+ * Detects the `cli_outdated` 426 response shape emitted by the platform's
308
+ * `cliVersionGate` middleware. When present, callers should surface the
309
+ * server's `message` field verbatim — it already includes upgrade
310
+ * instructions — rather than the default `<action>: <status> <body>`
311
+ * which would dump raw JSON at the user.
312
+ */
313
+ function isCliOutdatedError(err) {
314
+ if (!(err instanceof PlatformApiError)) return false;
315
+ if (err.status !== 426) return false;
316
+ return parsePlatformErrorBody(err.body)?.error === "cli_outdated";
317
+ }
280
318
  var PlatformApiError = class extends Error {
281
319
  status;
282
320
  body;
283
321
  code;
284
322
  constructor(action, status, body) {
285
- super(`${action}: ${status} ${body}`);
323
+ const parsed = parsePlatformErrorBody(body);
324
+ const message = status === 426 && parsed?.error === "cli_outdated" && parsed.message ? parsed.message : `${action}: ${status} ${body}`;
325
+ super(message);
286
326
  this.name = "PlatformApiError";
287
327
  this.status = status;
288
328
  this.body = body;
289
- const parsed = parsePlatformErrorBody(body);
290
329
  this.code = parsed?.error ?? parsed?.message;
291
330
  }
292
331
  };
@@ -303,12 +342,17 @@ function isExpiredTokenError(error) {
303
342
  var PlatformClient = class {
304
343
  baseUrl;
305
344
  authHeaders;
345
+ cliLog;
306
346
  constructor(token, options) {
307
347
  if (typeof options === "string") this.baseUrl = options;
308
- else this.baseUrl = options?.apiUrl ?? getApiUrl(options?.root);
348
+ else {
349
+ this.baseUrl = options?.apiUrl ?? getApiUrl(options?.root);
350
+ this.cliLog = options?.cliLog;
351
+ }
309
352
  ensureCloudflaredToken(this.baseUrl);
310
353
  this.authHeaders = {
311
354
  Authorization: `Bearer ${token}`,
355
+ ...VOID_CLI_VERSION !== null && { "X-Void-CLI-Version": VOID_CLI_VERSION },
312
356
  ...cfAccessHeaders(process.env)
313
357
  };
314
358
  }
@@ -394,26 +438,125 @@ var PlatformClient = class {
394
438
  };
395
439
  }
396
440
  }
397
- async *deploy(projectId, formData) {
398
- const res = await fetch(`${this.baseUrl}/projects/${projectId}/deploy`, {
441
+ /**
442
+ * Request presigned R2 PUT URLs for a batch of assets. Each entry carries
443
+ * both `blake3` (storage key) and `md5` (wire-level integrity primitive)
444
+ * so the platform can sign a PUT URL that R2 enforces against the bytes
445
+ * the CLI is about to upload. See design doc 0068 for the full protocol.
446
+ */
447
+ async requestUploadUrls(projectId, assets) {
448
+ const url = `${this.baseUrl}/projects/${projectId}/deploy/upload-urls`;
449
+ this.cliLog?.info("upload_urls_post", {
450
+ url,
451
+ assetCount: assets.length
452
+ });
453
+ const res = await fetch(url, {
454
+ method: "POST",
455
+ headers: {
456
+ "Content-Type": "application/json",
457
+ ...this.authHeaders
458
+ },
459
+ body: JSON.stringify({ assets })
460
+ });
461
+ const cfRay = res.headers.get("cf-ray");
462
+ const cfCacheStatus = res.headers.get("cf-cache-status");
463
+ this.cliLog?.info("upload_urls_response", {
464
+ status: res.status,
465
+ cfRay,
466
+ cfCacheStatus
467
+ });
468
+ if (!res.ok) await throwPlatformApiError("Failed to request upload URLs", res);
469
+ return (await res.json()).urls;
470
+ }
471
+ /**
472
+ * Manifest-only (direct-to-R2) deploy. POSTs a JSON body containing the
473
+ * deploy manifest, asset manifest (no asset bytes), and any worker module
474
+ * bytes (base64-encoded). Streams an NDJSON response that the caller can
475
+ * apply with the existing `applyDeployEvent` machinery.
476
+ */
477
+ async *finalizeDeploy(projectId, payload) {
478
+ const url = `${this.baseUrl}/projects/${projectId}/deploy`;
479
+ yield* this.streamDeployRequest(url, {
399
480
  method: "POST",
400
- headers: { ...this.authHeaders },
401
- body: formData
481
+ headers: {
482
+ "Content-Type": "application/json",
483
+ ...this.authHeaders
484
+ },
485
+ body: JSON.stringify(payload)
486
+ });
487
+ }
488
+ /**
489
+ * POST + NDJSON-stream-reader used by `finalizeDeploy()`. Captures
490
+ * `cf-ray` + `cf-cache-status` for postmortem correlation.
491
+ */
492
+ async *streamDeployRequest(url, init) {
493
+ const cliLog = this.cliLog;
494
+ cliLog?.info("deploy_post", { url });
495
+ let res;
496
+ try {
497
+ res = await fetch(url, init);
498
+ } catch (err) {
499
+ cliLog?.error("deploy_fetch_rejected", err, { url });
500
+ throw err;
501
+ }
502
+ const cfRay = res.headers.get("cf-ray");
503
+ const cfCacheStatus = res.headers.get("cf-cache-status");
504
+ cliLog?.info("deploy_response", {
505
+ status: res.status,
506
+ cfRay,
507
+ cfCacheStatus,
508
+ contentType: res.headers.get("content-type")
402
509
  });
403
510
  if (!res.ok) await throwPlatformApiError("Deploy failed", res);
404
511
  const reader = res.body.getReader();
405
512
  const decoder = new TextDecoder();
406
513
  let buffer = "";
407
- while (true) {
408
- const { done, value } = await reader.read();
409
- if (done) break;
410
- buffer += decoder.decode(value, { stream: true });
411
- let newlineIdx;
412
- while ((newlineIdx = buffer.indexOf("\n")) !== -1) {
413
- const line = buffer.slice(0, newlineIdx);
414
- buffer = buffer.slice(newlineIdx + 1);
415
- if (line.trim()) yield JSON.parse(line);
514
+ let bytesRead = 0;
515
+ let firstByteAt = null;
516
+ const startedAt = Date.now();
517
+ let eventCount = 0;
518
+ let lastEventName = "<none>";
519
+ try {
520
+ while (true) {
521
+ const { done, value } = await reader.read();
522
+ if (done) {
523
+ cliLog?.info("deploy_stream_eof", {
524
+ bytesRead,
525
+ eventCount,
526
+ lastEvent: lastEventName
527
+ });
528
+ break;
529
+ }
530
+ if (firstByteAt === null) {
531
+ firstByteAt = Date.now() - startedAt;
532
+ cliLog?.info("deploy_stream_ttfb", { ttfbMs: firstByteAt });
533
+ }
534
+ bytesRead += value.byteLength;
535
+ buffer += decoder.decode(value, { stream: true });
536
+ let newlineIdx;
537
+ while ((newlineIdx = buffer.indexOf("\n")) !== -1) {
538
+ const line = buffer.slice(0, newlineIdx);
539
+ buffer = buffer.slice(newlineIdx + 1);
540
+ if (line.trim()) {
541
+ const event = JSON.parse(line);
542
+ eventCount++;
543
+ lastEventName = event.event ?? "<no-event-field>";
544
+ cliLog?.info("deploy_event", {
545
+ eventCount,
546
+ event: lastEventName,
547
+ raw: line.slice(0, 200)
548
+ });
549
+ yield event;
550
+ }
551
+ }
416
552
  }
553
+ } catch (err) {
554
+ cliLog?.error("deploy_stream_error", err, {
555
+ bytesRead,
556
+ eventCount,
557
+ lastEvent: lastEventName
558
+ });
559
+ throw err;
417
560
  }
418
561
  }
419
562
  async listSecrets(projectId) {
@@ -562,4 +705,4 @@ var PlatformClient = class {
562
705
  }
563
706
  };
564
707
  //#endregion
565
- export { parsePlatformErrorBody as a, getTokenSource as c, runLogin as d, saveToken as f, isExpiredTokenError as i, isStagingMode as l, PlatformClient as n, getSiteDomain as o, client_exports as r, getToken as s, PlatformApiError as t, removeToken as u };
708
+ export { isExpiredTokenError as a, getToken as c, removeToken as d, runLogin as f, isCliOutdatedError as i, getTokenSource as l, PlatformClient as n, parsePlatformErrorBody as o, saveToken as p, client_exports as r, getSiteDomain as s, PlatformApiError as t, isStagingMode as u };
@@ -1,9 +1,9 @@
1
1
  import { s as import_picocolors } from "./output-BwlcIYSR.mjs";
2
2
  import { _ as me, c as R, i as Ee, l as Re, x as q } from "./dist-Dayj3gCK.mjs";
3
3
  import { a as writeProjectConfig } from "./project-TqORyHn8.mjs";
4
- import { o as getSiteDomain, t as PlatformApiError } from "./client-snXOjrp1.mjs";
5
- import { n as validateProjectSlug } from "./project-slug-CKam8lF9.mjs";
6
- import { n as inferDefaultSlug } from "./resolve-project-Br5BR03U.mjs";
4
+ import { s as getSiteDomain, t as PlatformApiError } from "./client-DCqnMpDt.mjs";
5
+ import { n as validateProjectSlug } from "./project-slug-KRvHQEQI.mjs";
6
+ import { n as inferDefaultSlug } from "./resolve-project-DdjLQ2tB.mjs";
7
7
  //#region src/cli/prompt.ts
8
8
  async function promptProjectSetupAction(message = "Set up a Void project:", options = {}) {
9
9
  const result = await Ee({
@@ -2,12 +2,12 @@ import { a as join, o as relative, r as extname, s as resolve } from "./pathe.M-
2
2
  import { i as dim, n as cliTitle, s as import_picocolors } from "./output-BwlcIYSR.mjs";
3
3
  import { c as R, g as ge, y as ye } from "./dist-Dayj3gCK.mjs";
4
4
  import { r as readProjectConfig } from "./project-TqORyHn8.mjs";
5
- import { n as PlatformClient, s as getToken } from "./client-snXOjrp1.mjs";
5
+ import { c as getToken, n as PlatformClient } from "./client-DCqnMpDt.mjs";
6
6
  import { c as getDatabaseDialect, f as readConfig } from "./config-BIa9HwVX.mjs";
7
7
  import { n as detectFramework } from "./plugin-inference-oZ6Ybu2_.mjs";
8
8
  import { a as writeJournal, i as stripSqlExt, r as readJournal, t as collectMigrations } from "./collect-CjeZgz5D.mjs";
9
9
  import { n as listDrizzleArtifacts, r as validateMigrations, t as assertJournalCoherence } from "./validate-CaMavMxu.mjs";
10
- import { formatTimestamp } from "./gen-U0Ktr4Zd.mjs";
10
+ import { formatTimestamp } from "./gen-C0EY2k27.mjs";
11
11
  import { existsSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
12
12
  import { fileURLToPath, pathToFileURL } from "node:url";
13
13
  import { execFileSync } from "node:child_process";
@@ -100,7 +100,7 @@ async function runPush(root, dialect) {
100
100
  else {
101
101
  const { mkdirSync } = await import("node:fs");
102
102
  const { dirname } = await import("node:path");
103
- const { getMiniflareDatabasePath } = await import("./runner-6Ep3fNQu.mjs");
103
+ const { getMiniflareDatabasePath } = await import("./runner-BUPRnMFN.mjs");
104
104
  const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
105
105
  mkdirSync(dirname(dbPath), { recursive: true });
106
106
  configPath = writeDrizzleConfig(root, dbPath);
@@ -157,7 +157,7 @@ async function runStatus(root, dialect) {
157
157
  localApplied = [];
158
158
  }
159
159
  else {
160
- const { getMiniflareDatabasePath, getAppliedMigrations } = await import("./runner-6Ep3fNQu.mjs");
160
+ const { getMiniflareDatabasePath, getAppliedMigrations } = await import("./runner-BUPRnMFN.mjs");
161
161
  localApplied = await getAppliedMigrations(getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local"));
162
162
  }
163
163
  const localSet = new Set(localApplied.map((m) => m.name));
@@ -215,7 +215,7 @@ async function resetDatabase(root, dialect) {
215
215
  });
216
216
  return migrations.length;
217
217
  }
218
- const { getMiniflareDatabasePath, runMigrations } = await import("./runner-6Ep3fNQu.mjs");
218
+ const { getMiniflareDatabasePath, runMigrations } = await import("./runner-BUPRnMFN.mjs");
219
219
  const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
220
220
  rmSync(dbPath, { force: true });
221
221
  rmSync(dbPath + "-wal", { force: true });
@@ -242,7 +242,7 @@ async function runSeed(root, file, dialect) {
242
242
  ye("Done.");
243
243
  return;
244
244
  }
245
- const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-6Ep3fNQu.mjs");
245
+ const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-BUPRnMFN.mjs");
246
246
  const db = await openSqliteDatabase(getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local"));
247
247
  try {
248
248
  db.exec(sql);
@@ -265,7 +265,7 @@ async function runExecute(root, command, file, dialect) {
265
265
  ye("Done.");
266
266
  return;
267
267
  }
268
- const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-6Ep3fNQu.mjs");
268
+ const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-BUPRnMFN.mjs");
269
269
  const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
270
270
  if (!existsSync(dbPath)) {
271
271
  R.error("No local database found. Run `void dev` first.");
@@ -362,7 +362,7 @@ async function runMigrate(root, dialect, remote) {
362
362
  return;
363
363
  }
364
364
  if (dialect === "postgresql") {
365
- const { applyPgMigrations } = await import("./runner-pg-D0wWHYnr.mjs");
365
+ const { applyPgMigrations } = await import("./runner-pg-BI6f6Ncm.mjs");
366
366
  const applied = await withPgClient(root, async (client) => {
367
367
  let existingRows = [];
368
368
  try {
@@ -386,7 +386,7 @@ async function runMigrate(root, dialect, remote) {
386
386
  ye("Done.");
387
387
  return;
388
388
  }
389
- const { getMiniflareDatabasePath, getAppliedMigrations, runMigrations } = await import("./runner-6Ep3fNQu.mjs");
389
+ const { getMiniflareDatabasePath, getAppliedMigrations, runMigrations } = await import("./runner-BUPRnMFN.mjs");
390
390
  const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
391
391
  try {
392
392
  const existingRows = await getAppliedMigrations(dbPath);
@@ -421,7 +421,7 @@ async function runStudio(root, dialect) {
421
421
  return;
422
422
  }
423
423
  const { writeDrizzleConfig } = await import("./config-BzM9Dy7T.mjs").then((n) => n.t);
424
- const { getMiniflareDatabasePath } = await import("./runner-6Ep3fNQu.mjs");
424
+ const { getMiniflareDatabasePath } = await import("./runner-BUPRnMFN.mjs");
425
425
  const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
426
426
  if (!existsSync(dbPath)) {
427
427
  R.error("No local database found. Run `void dev` first.");
@@ -637,7 +637,7 @@ async function runRenameMigrations(root, dialect) {
637
637
  process.exit(1);
638
638
  }
639
639
  else {
640
- const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-6Ep3fNQu.mjs");
640
+ const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-BUPRnMFN.mjs");
641
641
  const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
642
642
  if (existsSync(dbPath)) try {
643
643
  const db = await openSqliteDatabase(dbPath);
@@ -715,7 +715,7 @@ async function runExport(root, args, dialect) {
715
715
  } else process.stdout.write(output);
716
716
  return;
717
717
  }
718
- const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-6Ep3fNQu.mjs");
718
+ const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-BUPRnMFN.mjs");
719
719
  const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
720
720
  if (!existsSync(dbPath)) {
721
721
  R.error("No local database found. Run `void dev` first.");
@@ -842,7 +842,7 @@ async function runSeedModule(root, seedPath, dialect) {
842
842
  return;
843
843
  }
844
844
  const { drizzle } = await import("drizzle-orm/better-sqlite3");
845
- const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-6Ep3fNQu.mjs");
845
+ const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-BUPRnMFN.mjs");
846
846
  const sqlite = await openSqliteDatabase(getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local"));
847
847
  try {
848
848
  const options = getDrizzleSchemaOptions(schema);
@@ -1,8 +1,8 @@
1
1
  import { n as cliTitle, r as createSpinner } from "./output-BwlcIYSR.mjs";
2
2
  import { _ as me, c as R, g as ge, l as Re, u as Se, x as q, y as ye } from "./dist-Dayj3gCK.mjs";
3
3
  import { i as removeProjectConfig, r as readProjectConfig } from "./project-TqORyHn8.mjs";
4
- import { n as PlatformClient, s as getToken } from "./client-snXOjrp1.mjs";
5
- import { r as resolveProjectBySlug } from "./resolve-project-Br5BR03U.mjs";
4
+ import { c as getToken, n as PlatformClient } from "./client-DCqnMpDt.mjs";
5
+ import { r as resolveProjectBySlug } from "./resolve-project-DdjLQ2tB.mjs";
6
6
  //#region src/cli/delete.ts
7
7
  async function runDeleteCommand(root, slug, options) {
8
8
  console.log();