@prisma/composer 0.39.0-dev.3 → 0.39.0-dev.4

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 (82) hide show
  1. package/dist/{app-config-CxdIiCvU-7vQWECm1.d.mts → app-config-Ubi4CftJ-DUSDjI2i.d.mts} +58 -57
  2. package/dist/app-config-Ubi4CftJ-DUSDjI2i.d.mts.map +1 -0
  3. package/dist/{app-configuration-file-Cw9autUL-DebaEvDz.mjs → app-configuration-file-Bbfq5PR3-D4DUNKUM.mjs} +40 -40
  4. package/dist/app-configuration-file-Bbfq5PR3-D4DUNKUM.mjs.map +1 -0
  5. package/dist/config-BmRE_eTa.d.mts +1 -0
  6. package/dist/config.d.mts +3 -3
  7. package/dist/config.mjs +2 -2
  8. package/dist/control.d.mts +21 -8
  9. package/dist/control.d.mts.map +1 -1
  10. package/dist/control.mjs +3 -3
  11. package/dist/control.mjs.map +1 -1
  12. package/dist/converge-in-process-BBBeood8-C7VG5b35.d.mts +67 -0
  13. package/dist/converge-in-process-BBBeood8-C7VG5b35.d.mts.map +1 -0
  14. package/dist/deploy-BW_F4Y9W.d.mts +12 -0
  15. package/dist/deploy-BW_F4Y9W.d.mts.map +1 -0
  16. package/dist/{deploy-BzRRAmns.mjs → deploy-NArSOken.mjs} +65 -16
  17. package/dist/deploy-NArSOken.mjs.map +1 -0
  18. package/dist/deploy.d.mts +3 -3
  19. package/dist/deploy.mjs +3 -3
  20. package/dist/{deployment-summary-p88NV5m5-3Ga91LRH.d.mts → deployment-summary-6LgQDUuu-DtCvw9UQ.d.mts} +7 -4
  21. package/dist/deployment-summary-6LgQDUuu-DtCvw9UQ.d.mts.map +1 -0
  22. package/dist/{deployment-summary-B6rYxEZe-E4IIcngK.mjs → deployment-summary-YP7eMPJI-CQsj7BHh.mjs} +16 -44
  23. package/dist/deployment-summary-YP7eMPJI-CQsj7BHh.mjs.map +1 -0
  24. package/dist/{dev-current-D8GwJQex-C8F3EUBY.mjs → dev-current-Ce4Zhfiy-TY0NjkOZ.mjs} +5 -5
  25. package/dist/{dev-current-D8GwJQex-C8F3EUBY.mjs.map → dev-current-Ce4Zhfiy-TY0NjkOZ.mjs.map} +1 -1
  26. package/dist/{dist-BN9EXWWX.mjs → dist-BxtsHOfP.mjs} +2 -2
  27. package/dist/{dist-BN9EXWWX.mjs.map → dist-BxtsHOfP.mjs.map} +1 -1
  28. package/dist/{execute-deploy-destroy-1SIH5uAu-DVRY18xU.mjs → execute-deploy-destroy-D2Ok1xun-DuY58xzA.mjs} +272 -36
  29. package/dist/execute-deploy-destroy-D2Ok1xun-DuY58xzA.mjs.map +1 -0
  30. package/dist/{execute-dev-xPaS5SAl-BUeHjmYV.mjs → execute-dev-BBPgDWzf-BCSle0Mw.mjs} +10 -11
  31. package/dist/{execute-dev-xPaS5SAl-BUeHjmYV.mjs.map → execute-dev-BBPgDWzf-BCSle0Mw.mjs.map} +1 -1
  32. package/dist/{execute-dev-current-DsAsDBB1-DwfOidWf.mjs → execute-dev-current-DNIwPfcW-uOHywz_h.mjs} +4 -4
  33. package/dist/{execute-dev-current-DsAsDBB1-DwfOidWf.mjs.map → execute-dev-current-DNIwPfcW-uOHywz_h.mjs.map} +1 -1
  34. package/dist/{execute-log-Be9DYRI6-WnytA3d7.mjs → execute-log-CEH820Un-i9u7t1Bw.mjs} +4 -4
  35. package/dist/{execute-log-Be9DYRI6-WnytA3d7.mjs.map → execute-log-CEH820Un-i9u7t1Bw.mjs.map} +1 -1
  36. package/dist/{graph-K7VOpCAj-D6UHSltu.mjs → graph-C6Fqe2gn-DMa2udEA.mjs} +4 -4
  37. package/dist/graph-C6Fqe2gn-DMa2udEA.mjs.map +1 -0
  38. package/dist/http.mjs +2 -2
  39. package/dist/index.mjs +2 -2
  40. package/dist/internal-app-configuration-file.d.mts +4 -4
  41. package/dist/internal-app-configuration-file.d.mts.map +1 -1
  42. package/dist/internal-app-configuration-file.mjs +1 -1
  43. package/dist/internal-converge-contract.d.mts +14 -0
  44. package/dist/internal-converge-contract.d.mts.map +1 -0
  45. package/dist/internal-converge-contract.mjs +14 -0
  46. package/dist/internal-converge-contract.mjs.map +1 -0
  47. package/dist/internal-converge.d.mts +4 -0
  48. package/dist/internal-converge.mjs +228 -0
  49. package/dist/internal-converge.mjs.map +1 -0
  50. package/dist/local-target.d.mts +1 -1
  51. package/dist/nextjs-control.d.mts +3 -3
  52. package/dist/node-control.d.mts +3 -3
  53. package/dist/{preflight-transport-DJjTWvyH-CEJ9WlaN.mjs → preflight-transport-C7_3abXW-Bza_hn9G.mjs} +3 -39
  54. package/dist/preflight-transport-C7_3abXW-Bza_hn9G.mjs.map +1 -0
  55. package/dist/{redaction-CqdeMBKw-BECjU4HR.d.mts → redaction-CIaE4m9U-DJGrkcn3.d.mts} +7 -6
  56. package/dist/redaction-CIaE4m9U-DJGrkcn3.d.mts.map +1 -0
  57. package/dist/{redaction-C-NnlVUh-B1nJc6rb.mjs → redaction-CjMYXtGp-CEQ5z1PK.mjs} +17 -6
  58. package/dist/redaction-CjMYXtGp-CEQ5z1PK.mjs.map +1 -0
  59. package/dist/report.d.mts +3 -3
  60. package/dist/report.mjs +2 -2
  61. package/dist/report.mjs.map +1 -1
  62. package/dist/{run-alchemy-CyciV8i0-BxPAyrch.mjs → run-alchemy-BlYyc4Oh-mIzYC4lq.mjs} +3 -3
  63. package/dist/{run-alchemy-CyciV8i0-BxPAyrch.mjs.map → run-alchemy-BlYyc4Oh-mIzYC4lq.mjs.map} +1 -1
  64. package/dist/service-rpc.mjs +2 -2
  65. package/dist/{validate-environment-DyW59rJ7-u8hQkzuY.mjs → validate-environment-XwVDifWN-BhPOzWN8.mjs} +6 -6
  66. package/dist/{validate-environment-DyW59rJ7-u8hQkzuY.mjs.map → validate-environment-XwVDifWN-BhPOzWN8.mjs.map} +1 -1
  67. package/package.json +15 -13
  68. package/skills/prisma-composer-core-concepts/SKILL.md +9 -23
  69. package/src/exports/internal-converge-contract.ts +1 -0
  70. package/src/exports/internal-converge.ts +1 -0
  71. package/dist/app-config-CxdIiCvU-7vQWECm1.d.mts.map +0 -1
  72. package/dist/app-configuration-file-Cw9autUL-DebaEvDz.mjs.map +0 -1
  73. package/dist/config-BcT6edff.d.mts +0 -1
  74. package/dist/deploy-BzRRAmns.mjs.map +0 -1
  75. package/dist/deploy-D7NHGXag.d.mts +0 -2
  76. package/dist/deployment-summary-B6rYxEZe-E4IIcngK.mjs.map +0 -1
  77. package/dist/deployment-summary-p88NV5m5-3Ga91LRH.d.mts.map +0 -1
  78. package/dist/execute-deploy-destroy-1SIH5uAu-DVRY18xU.mjs.map +0 -1
  79. package/dist/graph-K7VOpCAj-D6UHSltu.mjs.map +0 -1
  80. package/dist/preflight-transport-DJjTWvyH-CEJ9WlaN.mjs.map +0 -1
  81. package/dist/redaction-C-NnlVUh-B1nJc6rb.mjs.map +0 -1
  82. package/dist/redaction-CqdeMBKw-BECjU4HR.d.mts.map +0 -1
@@ -1,18 +1,90 @@
1
- import { C as secretsKeys, _ as nodeAddresses } from "./graph-K7VOpCAj-D6UHSltu.mjs";
1
+ import { t as blindCast } from "./casts-DpaahrlC-C5XMnP9S.mjs";
2
+ import { C as secretsKeys, _ as nodeAddresses } from "./graph-C6Fqe2gn-DMa2udEA.mjs";
3
+ import { t as InternalError } from "./internal-error-Dfur7Zqt-D96dWHZK.mjs";
2
4
  import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
3
- import { c as preflightFindingsEnv, n as containerEnv, o as preflightEnv, s as preflightEnvVarName } from "./preflight-transport-DJjTWvyH-CEJ9WlaN.mjs";
4
- import { i as prepareSecondProcess, o as removeLeftoverAppConfigurationFiles, t as deployAppConfigurationFile } from "./app-configuration-file-Cw9autUL-DebaEvDz.mjs";
5
- import { c as toStructured, d as okVoid, l as notOk, s as requireContainerForEnvironment, u as ok } from "./dev-current-D8GwJQex-C8F3EUBY.mjs";
5
+ import { o as preflightEnvVarName, t as containerEnv } from "./preflight-transport-C7_3abXW-Bza_hn9G.mjs";
6
+ import { i as prepareSecondProcess, o as refuseSecretsInRootInput, s as removeLeftoverAppConfigurationFiles, t as deployAppConfigurationFile } from "./app-configuration-file-Bbfq5PR3-D4DUNKUM.mjs";
7
+ import "./deploy-NArSOken.mjs";
8
+ import { c as toStructured, d as okVoid, l as notOk, s as requireContainerForEnvironment, u as ok } from "./dev-current-Ce4Zhfiy-TY0NjkOZ.mjs";
6
9
  import { a as writeRunReport, i as toRunReport, r as resolveRunReportPath, t as RUN_REPORT_FILE_ENV } from "./run-report-CmBz2-xc-Cc8rV1CX.mjs";
7
- import "./deploy-BzRRAmns.mjs";
8
- import { c as redactThrown, l as redactUnsetPlatformVariable, o as redactError, s as redactSummary, t as SecretRedaction } from "./redaction-C-NnlVUh-B1nJc6rb.mjs";
9
- import { a as readEngineFailureCause, i as readDeploymentSummary, r as engineFailureFilePath, t as DEPLOYMENT_RESULT_FILE_ENV } from "./deployment-summary-B6rYxEZe-E4IIcngK.mjs";
10
- import { a as noComposerExportMessage, i as validateEnvironmentName, r as runPipeline } from "./validate-environment-DyW59rJ7-u8hQkzuY.mjs";
11
- import { n as reproduceCommand, r as spawnAlchemy, t as alchemyInvocation } from "./run-alchemy-CyciV8i0-BxPAyrch.mjs";
10
+ import { c as redactThrown, l as redactUnsetPlatformVariable, n as StreamRedactor, o as redactError, r as credentialLookingValues, s as redactSummary, t as SecretRedaction } from "./redaction-CjMYXtGp-CEQ5z1PK.mjs";
11
+ import { a as readEngineFailureCause, i as engineFailureFilePath, n as capFailureCause, o as toDeploymentSummary, s as withComposerAdvice, t as DEPLOYMENT_RESULT_FILE_ENV } from "./deployment-summary-YP7eMPJI-CQsj7BHh.mjs";
12
+ import { a as noComposerExportMessage, i as validateEnvironmentName, r as runPipeline } from "./validate-environment-XwVDifWN-BhPOzWN8.mjs";
13
+ import { n as reproduceCommand, r as spawnAlchemy, t as alchemyInvocation } from "./run-alchemy-BlYyc4Oh-mIzYC4lq.mjs";
14
+ import { createRequire } from "node:module";
12
15
  import * as path$1 from "node:path";
13
16
  import * as fs$1 from "node:fs";
17
+ import { pathToFileURL } from "node:url";
14
18
  import { randomUUID } from "node:crypto";
15
- //#region ../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-1SIH5uAu.mjs
19
+ //#region ../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-D2Ok1xun.mjs
20
+ var version = "0.39.0-dev.4";
21
+ const ENTRY = "@prisma/composer/internal/converge";
22
+ const CONTRACT_ENTRY = "@prisma/composer/internal/converge-contract";
23
+ /** The Composer version this host runs; every Composer package carries the same one. */
24
+ const HOST_COMPOSER_VERSION = version;
25
+ function unresolvable(appDir, detail, cause) {
26
+ return new CliStructuredError("DEPS.CONVERGE_UNRESOLVABLE", `Could not load the converge from the app's @prisma/composer in "${appDir}": ${detail}`, {
27
+ why: "`prisma deploy` runs the lowering and Alchemy from the app's own install of @prisma/composer, so the app, its extensions and Alchemy share one copy of alchemy.",
28
+ fix: "Install @prisma/composer in the app, at the same version as the Composer the `prisma` CLI runs.",
29
+ ...cause === void 0 ? {} : { cause }
30
+ });
31
+ }
32
+ function installedVersion(require) {
33
+ try {
34
+ const parsed = JSON.parse(fs$1.readFileSync(require.resolve("@prisma/composer/package.json"), "utf8"));
35
+ return typeof parsed === "object" && parsed !== null && "version" in parsed && typeof parsed.version === "string" ? parsed.version : void 0;
36
+ } catch {
37
+ return;
38
+ }
39
+ }
40
+ async function importFile(appDir, file) {
41
+ try {
42
+ return await import(pathToFileURL(file).href);
43
+ } catch (error) {
44
+ throw unresolvable(appDir, `${file} failed to load: ${error instanceof Error ? error.message : String(error)}`, error);
45
+ }
46
+ }
47
+ function contractMismatch(host, app) {
48
+ const appVersion = app.version ?? "an unknown version";
49
+ const update = app.contract < host.contract ? `Upgrade the app's @prisma/composer to a release that speaks converge contract ${host.contract}, such as ${host.version}.` : `Upgrade the \`prisma\` CLI to one that runs a Composer speaking converge contract ${app.contract}, such as ${appVersion}.`;
50
+ return new CliStructuredError("DEPS.CONVERGE_CONTRACT_MISMATCH", `The app's @prisma/composer ${appVersion} speaks converge contract ${app.contract}, and the \`prisma\` CLI's Composer ${host.version} speaks contract ${host.contract}.`, {
51
+ why: "Deploy calls the app's @prisma/composer from the CLI's Composer, and the two read each other's data only when they speak the same converge contract.",
52
+ fix: update
53
+ });
54
+ }
55
+ /**
56
+ * The app's `lower` and converge, from the install `appDir` resolves. Reads the app's
57
+ * converge contract before loading anything else. Raises
58
+ * DEPS.CONVERGE_UNRESOLVABLE when the install is missing or predates the
59
+ * in-process converge, and DEPS.CONVERGE_CONTRACT_MISMATCH when it speaks
60
+ * another contract than `host`.
61
+ */
62
+ async function loadAppConvergeEntry(appDir, host = {
63
+ contract: 2,
64
+ version: HOST_COMPOSER_VERSION
65
+ }) {
66
+ const require = createRequire(path$1.join(appDir, "package.json"));
67
+ let contractFile;
68
+ let file;
69
+ try {
70
+ contractFile = require.resolve(CONTRACT_ENTRY);
71
+ file = require.resolve(ENTRY);
72
+ } catch (error) {
73
+ throw unresolvable(appDir, `${CONTRACT_ENTRY} or ${ENTRY} does not resolve.`, error);
74
+ }
75
+ const { CONVERGE_CONTRACT: appContract } = await importFile(appDir, contractFile);
76
+ if (typeof appContract !== "number") throw unresolvable(appDir, `${contractFile} exports no CONVERGE_CONTRACT.`);
77
+ if (appContract !== host.contract) throw contractMismatch(host, {
78
+ contract: appContract,
79
+ version: installedVersion(require)
80
+ });
81
+ const { lower: appLower, convergeInProcess } = await importFile(appDir, file);
82
+ if (typeof appLower !== "function" || typeof convergeInProcess !== "function") throw unresolvable(appDir, `${file} exports no lower and convergeInProcess.`);
83
+ return blindCast({
84
+ lower: appLower,
85
+ converge: convergeInProcess
86
+ });
87
+ }
16
88
  /** Pipeline step 6: writes a regenerated-every-run, independently runnable stack module at `.prisma-composer/alchemy.run.ts`. */
17
89
  const GENERATED_DIR = ".prisma-composer";
18
90
  const GENERATED_FILE = "alchemy.run.ts";
@@ -104,7 +176,7 @@ function hasNoLocalDeployState(cwd) {
104
176
  */
105
177
  function deploySteps(onEvent) {
106
178
  const open = /* @__PURE__ */ new Map();
107
- const keyOf = (step) => step.name === "assemble-service" ? `${step.name}:${step.address}` : step.name;
179
+ const keyOf = (step) => step.name === "assemble-service" ? `${step.name}:${step.address}` : step.name === "apply-resource" ? `${step.name}:${step.resourceId}` : step.name;
108
180
  const emit = (event) => {
109
181
  try {
110
182
  onEvent?.(event);
@@ -143,6 +215,16 @@ function deploySteps(onEvent) {
143
215
  failOpen() {
144
216
  for (const { step } of [...open.values()].reverse()) finish(step, "failed");
145
217
  },
218
+ isOpen(step) {
219
+ return open.has(keyOf(step));
220
+ },
221
+ message(severity, text) {
222
+ emit({
223
+ kind: "message",
224
+ severity,
225
+ text
226
+ });
227
+ },
146
228
  emit
147
229
  };
148
230
  }
@@ -158,7 +240,8 @@ async function executeDeploy(input, deps, cwd) {
158
240
  reportId: input.reportId,
159
241
  reportPath: resolveRunReportPath(input.reportPath, process.env[RUN_REPORT_FILE_ENV], cwd),
160
242
  steps: deploySteps(input.onEvent),
161
- redaction: new SecretRedaction(process.env)
243
+ signal: input.signal,
244
+ redaction: deps.redaction ?? new SecretRedaction(process.env)
162
245
  });
163
246
  if (!outcome.ok) return outcome;
164
247
  return ok({ summary: outcome.value });
@@ -175,6 +258,7 @@ async function executeDestroy(input, deps, cwd) {
175
258
  reportId: void 0,
176
259
  reportPath: void 0,
177
260
  steps: deploySteps(void 0),
261
+ signal: void 0,
178
262
  redaction: new SecretRedaction(process.env)
179
263
  });
180
264
  if (!outcome.ok) return outcome;
@@ -213,8 +297,8 @@ async function attachReporters(reporters, containers, redaction) {
213
297
  }
214
298
  }));
215
299
  }
216
- /** Every session's contribution to the alchemy child's environment, so reporting that happens inside the apply can find the run. */
217
- function reporterChildEnv(reporters, redaction) {
300
+ /** Every session's contribution to the apply's environment, so reporting that happens inside the apply can find the run. */
301
+ function reporterEnv(reporters, redaction) {
218
302
  const env = {};
219
303
  for (const { extensionId, reporter } of reporters) try {
220
304
  Object.assign(env, reporter.childEnv());
@@ -228,9 +312,9 @@ function reporterChildEnv(reporters, redaction) {
228
312
  function truncate(value, limit) {
229
313
  return value.length <= limit ? value : `${value.slice(0, limit - 1)}…`;
230
314
  }
231
- /** An interrupted converge (the engine settled a Ctrl-C) — reported as `cancelled`, never as `failed`. */
315
+ /** An interrupted converge — reported as `cancelled`, never as `failed`. */
232
316
  function wasInterrupted(failure) {
233
- return typeof failure.meta?.["signal"] === "string";
317
+ return failure.code === "DEPLOY.INTERRUPTED" || typeof failure.meta?.["signal"] === "string";
234
318
  }
235
319
  /**
236
320
  * Ends every reporting session, whatever the run did. Sessions never reject
@@ -304,9 +388,10 @@ async function runStackPipeline(action, opts) {
304
388
  else opts.steps.fail({ name: "record" });
305
389
  return outcome;
306
390
  }
307
- /** The pipeline both actions share: validate, resolve containers, preflight,
308
- * write the stack file, run alchemy against it, then the destroy-only
309
- * teardown/removal suffix. The value is only ever a summary for deploy. */
391
+ /** The pipeline both actions share: validate, resolve containers, then for
392
+ * deploy preflight and the in-process converge, and for destroy the stack
393
+ * file, the alchemy child and the teardown/removal suffix. The value is only
394
+ * ever a summary for deploy. */
310
395
  async function runStackPipelineInner(action, opts, reporters) {
311
396
  const { entry, config: composerConfig, name, environment, cwd, onEvent, deps, steps } = opts;
312
397
  steps.start({ name: "prepare" });
@@ -317,6 +402,13 @@ async function runStackPipelineInner(action, opts, reporters) {
317
402
  if (CliStructuredError.is(error)) return notOk(error);
318
403
  throw error;
319
404
  }
405
+ let appConvergeEntry;
406
+ if (action === "deploy") {
407
+ const loaded = await prepareAppConvergeEntry(deps, path$1.dirname(path$1.resolve(cwd, composerConfig.file)));
408
+ if (!loaded.ok) return loaded;
409
+ appConvergeEntry = loaded.value;
410
+ }
411
+ const platformCredentials = deps.credentials;
320
412
  if (action === "destroy" && hasNoLocalDeployState(cwd)) onEvent?.({
321
413
  kind: "no-local-deploy-state",
322
414
  cwd
@@ -325,7 +417,8 @@ async function runStackPipelineInner(action, opts, reporters) {
325
417
  let containers;
326
418
  let alchemyStage;
327
419
  const preflightPayloads = /* @__PURE__ */ new Map();
328
- let preflightTransportEnv = {};
420
+ const unset = [];
421
+ const preflightTransportEnv = {};
329
422
  try {
330
423
  pipeline = await runPipeline(entry, name, environment, cwd, composerConfig, {
331
424
  runAssembler: deps.runAssembler,
@@ -359,6 +452,7 @@ async function runStackPipelineInner(action, opts, reporters) {
359
452
  steps.finish({ name: "assemble" });
360
453
  const { graph, name: resolvedName } = pipeline;
361
454
  const config = pipeline.configSource.value;
455
+ if (action === "deploy") refuseSecretsInRootInput(graph.appConfigurationRead, opts.redaction.knownSecrets, "A deploy sends every plain value Load read to the platform as plain configuration, and never sends a secret that way.");
362
456
  steps.start({ name: "connect" });
363
457
  if (action === "deploy") reporters.push(...await beginReporters(config.extensions, {
364
458
  appName: resolvedName,
@@ -366,7 +460,7 @@ async function runStackPipelineInner(action, opts, reporters) {
366
460
  environment,
367
461
  cwd,
368
462
  reportId: opts.reportId,
369
- credentials: deps.credentials
463
+ credentials: platformCredentials
370
464
  }, opts.redaction));
371
465
  containers = /* @__PURE__ */ new Map();
372
466
  for (const extension of config.extensions) {
@@ -376,14 +470,14 @@ async function runStackPipelineInner(action, opts, reporters) {
376
470
  const instance = await extension.container.ensure({
377
471
  appName: resolvedName,
378
472
  environment
379
- }, deps.credentials);
473
+ }, platformCredentials);
380
474
  requireContainerForEnvironment(action, extension.id, extension.container, instance, environment);
381
475
  containers.set(extension.id, instance);
382
476
  } else {
383
477
  const instance = await extension.container.locate({
384
478
  appName: resolvedName,
385
479
  environment
386
- }, deps.credentials);
480
+ }, platformCredentials);
387
481
  if (instance === void 0) throw new CliStructuredError("DEPLOY.TARGET_NOT_FOUND", `Nothing deployed for ${resolvedName} in the environment ${environment}.`, { fix: "Deploy it first." });
388
482
  requireContainerForEnvironment(action, extension.id, extension.container, instance, environment);
389
483
  containers.set(extension.id, instance);
@@ -395,7 +489,6 @@ async function runStackPipelineInner(action, opts, reporters) {
395
489
  await attachReporters(reporters, containers, opts.redaction);
396
490
  alchemyStage = containers.get(config.state.extension)?.alchemyStage ?? environment;
397
491
  steps.finish({ name: "connect" });
398
- const unset = [];
399
492
  if (action === "deploy") {
400
493
  steps.start({ name: "preflight" });
401
494
  let checked = 0;
@@ -412,7 +505,7 @@ async function runStackPipelineInner(action, opts, reporters) {
412
505
  environment,
413
506
  configuration: pipeline.configuration,
414
507
  secrets: pipeline.secrets,
415
- credentials: deps.credentials,
508
+ credentials: platformCredentials,
416
509
  report
417
510
  });
418
511
  if (payload !== void 0) preflightPayloads.set(extension.id, payload);
@@ -420,11 +513,6 @@ async function runStackPipelineInner(action, opts, reporters) {
420
513
  throw toStructured("DEPLOY.PREFLIGHT_FAILED", error);
421
514
  }
422
515
  }
423
- try {
424
- preflightTransportEnv = preflightEnv(preflightPayloads);
425
- } catch (error) {
426
- throw toStructured("DEPLOY.PREFLIGHT_FAILED", error);
427
- }
428
516
  steps.finish({ name: "preflight" }, {
429
517
  checked,
430
518
  unset: unset.length
@@ -434,12 +522,18 @@ async function runStackPipelineInner(action, opts, reporters) {
434
522
  findings: { unset }
435
523
  });
436
524
  }
437
- for (const extension of config.extensions) preflightTransportEnv[preflightEnvVarName(extension.id)] ??= "";
438
- Object.assign(preflightTransportEnv, preflightFindingsEnv({ unset }));
525
+ if (action === "destroy") for (const extension of config.extensions) preflightTransportEnv[preflightEnvVarName(extension.id)] = "";
439
526
  } catch (error) {
440
527
  if (CliStructuredError.is(error)) return notOk(error);
441
528
  throw error;
442
529
  }
530
+ if (appConvergeEntry !== void 0) return convergeDeploy(opts, pipeline, appConvergeEntry, {
531
+ containers,
532
+ stage: alchemyStage,
533
+ preflightPayloads,
534
+ findings: { unset },
535
+ env: reporterEnv(reporters, opts.redaction)
536
+ });
443
537
  let stackPath;
444
538
  const resultFilePath = path$1.join(cwd, ".prisma-composer", `deployment-result-${String(process.pid)}-${randomUUID()}.json`);
445
539
  let handover;
@@ -473,7 +567,7 @@ async function runStackPipelineInner(action, opts, reporters) {
473
567
  containerEnv: containerEnv(containers),
474
568
  preflightEnv: preflightTransportEnv,
475
569
  env: {
476
- ...reporterChildEnv(reporters, opts.redaction),
570
+ ...reporterEnv(reporters, opts.redaction),
477
571
  ...handover.env,
478
572
  [DEPLOYMENT_RESULT_FILE_ENV]: resultFilePath
479
573
  },
@@ -540,7 +634,7 @@ async function runStackPipelineInner(action, opts, reporters) {
540
634
  const instance = containers.get(extension.id);
541
635
  if (instance === void 0) continue;
542
636
  try {
543
- await extension.container.remove(instance, deps.credentials);
637
+ await extension.container.remove(instance, platformCredentials);
544
638
  } catch (error) {
545
639
  throw toStructured("DEPLOY.CONTAINER_REMOVE_FAILED", error);
546
640
  }
@@ -550,7 +644,6 @@ async function runStackPipelineInner(action, opts, reporters) {
550
644
  if (CliStructuredError.is(error)) return notOk(error);
551
645
  throw error;
552
646
  }
553
- if (action === "deploy") return ok(redactSummary(readDeploymentSummary(resultFilePath), opts.redaction));
554
647
  return ok(void 0);
555
648
  } finally {
556
649
  try {
@@ -560,7 +653,150 @@ async function runStackPipelineInner(action, opts, reporters) {
560
653
  handover?.removeFile();
561
654
  }
562
655
  }
656
+ /** Loaded before anything is created, so a missing or incompatible install fails first. */
657
+ async function prepareAppConvergeEntry(deps, appDir) {
658
+ try {
659
+ return ok(deps.appConvergeEntry ?? await loadAppConvergeEntry(appDir));
660
+ } catch (error) {
661
+ if (CliStructuredError.is(error)) return notOk(error);
662
+ throw error;
663
+ }
664
+ }
665
+ /** One Alchemy progress event as the deploy's step events: each resource is a step inside `apply`. */
666
+ function reportConvergeEvent(steps, event, redact) {
667
+ if (event.kind === "log") {
668
+ steps.message(event.severity, redact(withComposerAdvice(event.text)));
669
+ return;
670
+ }
671
+ const step = {
672
+ name: "apply-resource",
673
+ resourceId: event.fqn,
674
+ resourceType: event.resourceType,
675
+ status: event.status
676
+ };
677
+ switch (event.phase) {
678
+ case "running":
679
+ if (!steps.isOpen(step)) steps.start(step);
680
+ return;
681
+ case "done":
682
+ if (!steps.isOpen(step)) steps.start(step);
683
+ steps.finish(step);
684
+ return;
685
+ case "failed":
686
+ if (!steps.isOpen(step)) steps.start(step);
687
+ steps.fail(step);
688
+ if (event.message !== void 0) steps.message("warn", redact(`${event.fqn}: ${withComposerAdvice(event.message)}`));
689
+ return;
690
+ case "pending": return;
691
+ }
692
+ }
693
+ function reasonsText(reasons) {
694
+ return reasons.map(({ tag, message }) => tag === "Error" || tag === "Unknown" || message.startsWith(tag) ? message : `${tag}: ${message}`).join("\n");
695
+ }
696
+ /** The structured failure a converge that did not apply settles as. */
697
+ function convergeFailure(outcome, redact) {
698
+ switch (outcome.kind) {
699
+ case "interrupted": return new CliStructuredError("DEPLOY.INTERRUPTED", "The deploy was interrupted.", {
700
+ why: "It stopped while Alchemy planned or applied it. Resources it had already changed stay as they are.",
701
+ fix: "Deploy again to finish."
702
+ });
703
+ case "refused": return outcome.reason === "already-running" ? new CliStructuredError("DEPLOY.CONVERGE_RUNNING", "Another deploy is already running in this process.", {
704
+ why: "A deploy sets the process's environment and working directory while Alchemy runs, so two cannot overlap.",
705
+ fix: "Wait for the other deploy to finish, or run this one in its own process."
706
+ }) : new CliStructuredError("DEPLOY.WORKER_THREAD", "Deploy cannot run in a worker thread when its cwd is not the process working directory.", {
707
+ why: "Alchemy reads `.env` and keeps `.alchemy` in the working directory, and a worker thread cannot change it.",
708
+ fix: "Call deploy from the main thread, or with the process's working directory as its cwd."
709
+ });
710
+ case "failed": {
711
+ const cause = capFailureCause(redact(withComposerAdvice(reasonsText(outcome.reasons))));
712
+ return new CliStructuredError("DEPLOY.ENGINE_FAILED", `Alchemy could not deploy the app.\n${cause}`, { meta: {
713
+ engineCause: cause,
714
+ reasons: outcome.reasons.map(({ tag, message }) => ({
715
+ tag,
716
+ message: redact(message)
717
+ }))
718
+ } });
719
+ }
720
+ }
721
+ return new CliStructuredError("DEPLOY.ENGINE_FAILED", "The converge ended with an outcome this Composer does not know.");
722
+ }
723
+ /**
724
+ * Alchemy's terminal text as `info` messages, one per complete line, redacted. A secret split
725
+ * across writes or lines is still found, because the text passes through a `StreamRedactor`
726
+ * before it is cut into lines. `end` sends the last line that has no line break.
727
+ */
728
+ function interactionMessages(steps, redaction) {
729
+ const stream = new StreamRedactor(redaction.allValues());
730
+ let partial = "";
731
+ const send = (text, last) => {
732
+ const lines = (partial + text).split("\n");
733
+ partial = last ? "" : lines.pop() ?? "";
734
+ for (const line of lines) if (line.trim() !== "") steps.message("info", redaction.redact(line));
735
+ };
736
+ return {
737
+ push: (text) => send(stream.push(text), false),
738
+ end: () => send(stream.end(), true)
739
+ };
740
+ }
741
+ /**
742
+ * Deploy's converge: lowers the app with the containers and preflight
743
+ * payloads this run resolved, then plans and applies it in this process.
744
+ * The report hook runs inside the apply, here, so the summary comes back as
745
+ * a value.
746
+ */
747
+ async function convergeDeploy(opts, pipeline, entry, resolved) {
748
+ const { cwd, environment, steps } = opts;
749
+ const config = pipeline.configSource.value;
750
+ const env = resolved.env;
751
+ opts.redaction.addCredentialLookingValues(credentialLookingValues(env));
752
+ const redact = (text) => opts.redaction.redact(text);
753
+ let summary;
754
+ const root = pipeline.graph.root.node;
755
+ if (root.kind !== "module") throw new InternalError("runPipeline admitted a root that is not a module");
756
+ steps.start({ name: "apply" });
757
+ let stack;
758
+ try {
759
+ stack = entry.lower(root, config, {
760
+ name: pipeline.name,
761
+ environment,
762
+ appConfigurationRead: pipeline.graph.appConfigurationRead,
763
+ firstProcessNodeAddresses: nodeAddresses(pipeline.graph),
764
+ bundles: pipeline.assembled.bundles,
765
+ containers: resolved.containers,
766
+ preflightPayloads: resolved.preflightPayloads,
767
+ findings: resolved.findings,
768
+ credentials: opts.deps.credentials,
769
+ report: (result) => {
770
+ summary = toDeploymentSummary(result);
771
+ }
772
+ });
773
+ } catch (error) {
774
+ if (CliStructuredError.is(error)) return notOk(error);
775
+ return notOk(new CliStructuredError("DEPLOY.ENGINE_FAILED", redact(error instanceof Error ? error.message : String(error))));
776
+ }
777
+ const output = interactionMessages(steps, opts.redaction);
778
+ let outcome;
779
+ try {
780
+ outcome = await entry.converge({
781
+ operation: "deploy",
782
+ stack,
783
+ stage: resolved.stage,
784
+ cwd,
785
+ env,
786
+ signal: opts.signal,
787
+ onEvent: (event) => reportConvergeEvent(steps, event, redact),
788
+ output: (text) => output.push(text)
789
+ });
790
+ } catch (error) {
791
+ return notOk(new CliStructuredError("DEPLOY.ENGINE_FAILED", redact(`Alchemy could not deploy the app.\n${error instanceof Error ? error.message : String(error)}`)));
792
+ } finally {
793
+ output.end();
794
+ }
795
+ if (outcome.kind !== "applied") return notOk(convergeFailure(outcome, redact));
796
+ steps.finish({ name: "apply" });
797
+ return ok(redactSummary(summary, opts.redaction));
798
+ }
563
799
  //#endregion
564
800
  export { executeDeploy, executeDestroy };
565
801
 
566
- //# sourceMappingURL=execute-deploy-destroy-1SIH5uAu-DVRY18xU.mjs.map
802
+ //# sourceMappingURL=execute-deploy-destroy-D2Ok1xun-DuY58xzA.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute-deploy-destroy-D2Ok1xun-DuY58xzA.mjs","names":["fs","path"],"sources":["../../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-D2Ok1xun.mjs"],"sourcesContent":["import { i as runPipeline, t as validateEnvironmentName } from \"./validate-environment-XwVDifWN.mjs\";\nimport { i as noComposerExportMessage } from \"./composer-config-QKdY85G-.mjs\";\nimport { c as redactSummary, i as credentialLookingValues, l as redactThrown, n as SecretRedaction, r as StreamRedactor, s as redactError, u as redactUnsetPlatformVariable } from \"./redaction-CjMYXtGp.mjs\";\nimport { a as readEngineFailureCause, i as engineFailureFilePath, n as capFailureCause, o as toDeploymentSummary, s as withComposerAdvice, t as DEPLOYMENT_RESULT_FILE_ENV } from \"./deployment-summary-YP7eMPJI.mjs\";\nimport { i as prepareSecondProcess, o as removeLeftoverAppConfigurationFiles, s as refuseSecretsInRootInput, t as deployAppConfigurationFile } from \"./app-configuration-file-Bbfq5PR3.mjs\";\nimport { d as toStructured, u as requireContainerForEnvironment } from \"./dev-current-Ce4Zhfiy.mjs\";\nimport { a as writeRunReport, i as toRunReport, r as resolveRunReportPath, t as RUN_REPORT_FILE_ENV } from \"./run-report-CmBz2-xc.mjs\";\nimport \"./converge-contract-BjDlHXVU.mjs\";\nimport { i as spawnAlchemy, n as alchemyInvocation, r as reproduceCommand } from \"./run-alchemy-BlYyc4Oh.mjs\";\nimport { createRequire } from \"node:module\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { nodeAddresses, secretsKeys } from \"@internal/core/deploy\";\nimport { CliStructuredError, InternalError } from \"@internal/foundation/errors\";\nimport { pathToFileURL } from \"node:url\";\nimport { blindCast } from \"@internal/foundation/casts\";\nimport { containerEnv, preflightEnvVarName } from \"@internal/core/config\";\nimport { notOk, ok, okVoid } from \"@internal/foundation/result\";\nimport { randomUUID } from \"node:crypto\";\n//#region package.json\nvar version = \"0.39.0-dev.4\";\n//#endregion\n//#region src/app-converge.ts\nconst ENTRY = \"@prisma/composer/internal/converge\";\nconst CONTRACT_ENTRY = \"@prisma/composer/internal/converge-contract\";\n/** The Composer version this host runs; every Composer package carries the same one. */\nconst HOST_COMPOSER_VERSION = version;\nfunction unresolvable(appDir, detail, cause) {\n\treturn new CliStructuredError(\"DEPS.CONVERGE_UNRESOLVABLE\", `Could not load the converge from the app's @prisma/composer in \"${appDir}\": ${detail}`, {\n\t\twhy: \"`prisma deploy` runs the lowering and Alchemy from the app's own install of @prisma/composer, so the app, its extensions and Alchemy share one copy of alchemy.\",\n\t\tfix: \"Install @prisma/composer in the app, at the same version as the Composer the `prisma` CLI runs.\",\n\t\t...cause === void 0 ? {} : { cause }\n\t});\n}\nfunction installedVersion(require) {\n\ttry {\n\t\tconst parsed = JSON.parse(fs.readFileSync(require.resolve(\"@prisma/composer/package.json\"), \"utf8\"));\n\t\treturn typeof parsed === \"object\" && parsed !== null && \"version\" in parsed && typeof parsed.version === \"string\" ? parsed.version : void 0;\n\t} catch {\n\t\treturn;\n\t}\n}\nasync function importFile(appDir, file) {\n\ttry {\n\t\treturn await import(pathToFileURL(file).href);\n\t} catch (error) {\n\t\tthrow unresolvable(appDir, `${file} failed to load: ${error instanceof Error ? error.message : String(error)}`, error);\n\t}\n}\nfunction contractMismatch(host, app) {\n\tconst appVersion = app.version ?? \"an unknown version\";\n\tconst update = app.contract < host.contract ? `Upgrade the app's @prisma/composer to a release that speaks converge contract ${host.contract}, such as ${host.version}.` : `Upgrade the \\`prisma\\` CLI to one that runs a Composer speaking converge contract ${app.contract}, such as ${appVersion}.`;\n\treturn new CliStructuredError(\"DEPS.CONVERGE_CONTRACT_MISMATCH\", `The app's @prisma/composer ${appVersion} speaks converge contract ${app.contract}, and the \\`prisma\\` CLI's Composer ${host.version} speaks contract ${host.contract}.`, {\n\t\twhy: \"Deploy calls the app's @prisma/composer from the CLI's Composer, and the two read each other's data only when they speak the same converge contract.\",\n\t\tfix: update\n\t});\n}\n/**\n* The app's `lower` and converge, from the install `appDir` resolves. Reads the app's\n* converge contract before loading anything else. Raises\n* DEPS.CONVERGE_UNRESOLVABLE when the install is missing or predates the\n* in-process converge, and DEPS.CONVERGE_CONTRACT_MISMATCH when it speaks\n* another contract than `host`.\n*/\nasync function loadAppConvergeEntry(appDir, host = {\n\tcontract: 2,\n\tversion: HOST_COMPOSER_VERSION\n}) {\n\tconst require = createRequire(path.join(appDir, \"package.json\"));\n\tlet contractFile;\n\tlet file;\n\ttry {\n\t\tcontractFile = require.resolve(CONTRACT_ENTRY);\n\t\tfile = require.resolve(ENTRY);\n\t} catch (error) {\n\t\tthrow unresolvable(appDir, `${CONTRACT_ENTRY} or ${ENTRY} does not resolve.`, error);\n\t}\n\tconst { CONVERGE_CONTRACT: appContract } = await importFile(appDir, contractFile);\n\tif (typeof appContract !== \"number\") throw unresolvable(appDir, `${contractFile} exports no CONVERGE_CONTRACT.`);\n\tif (appContract !== host.contract) throw contractMismatch(host, {\n\t\tcontract: appContract,\n\t\tversion: installedVersion(require)\n\t});\n\tconst { lower: appLower, convergeInProcess } = await importFile(appDir, file);\n\tif (typeof appLower !== \"function\" || typeof convergeInProcess !== \"function\") throw unresolvable(appDir, `${file} exports no lower and convergeInProcess.`);\n\treturn blindCast({\n\t\tlower: appLower,\n\t\tconverge: convergeInProcess\n\t});\n}\n//#endregion\n//#region src/generate-stack.ts\n/** Pipeline step 6: writes a regenerated-every-run, independently runnable stack module at `.prisma-composer/alchemy.run.ts`. */\nconst GENERATED_DIR = \".prisma-composer\";\nconst GENERATED_FILE = \"alchemy.run.ts\";\n/** A relative import specifier from `.prisma-composer/alchemy.run.ts` to `target` (posix separators). */\nfunction relativeImportSpecifier(generatedDir, target) {\n\tconst rel = path.relative(generatedDir, target).split(path.sep).join(\"/\");\n\treturn rel.startsWith(\".\") ? rel : `./${rel}`;\n}\nfunction quote(value) {\n\treturn JSON.stringify(value);\n}\nfunction renderBundle(bundle) {\n\treturn `{ dir: ${quote(bundle.dir)}, entry: ${quote(bundle.entry)} }`;\n}\nfunction renderOptions(input) {\n\tconst lines = [];\n\tlines.push(` name: ${quote(input.name)},`);\n\tlines.push(` environment: ${quote(input.environment)},`);\n\tlines.push(\" appConfigurationRead: file.appConfigurationRead,\");\n\tlines.push(\" firstProcessNodeAddresses: file.nodeAddresses,\");\n\tlines.push(\" bundles: {\");\n\tfor (const [id, bundle] of Object.entries(input.assembled.bundles)) lines.push(` ${quote(id)}: ${renderBundle(bundle)},`);\n\tlines.push(\" },\");\n\tlines.push(\" report: report.deploymentReport,\");\n\treturn lines.join(\"\\n\");\n}\n/** Renders the stack module's source (tests assert on it without touching disk) — uses `//` headers, not a block comment, since a cwd path with a star-slash could close one early. */\nfunction renderStackFile(input) {\n\tconst generatedDir = path.join(input.cwd, GENERATED_DIR);\n\tconst appImport = relativeImportSpecifier(generatedDir, input.entryPath);\n\tconst configImport = relativeImportSpecifier(generatedDir, input.configFile);\n\treturn `// Generated by Composer's deploy and destroy operations — overwritten on every\n// run; do not edit by hand. Runnable from ${quote(input.cwd)} WITH the env the\n// CLI passes its child (the PRISMA_COMPOSER_CONTAINER_*/_PREFLIGHT_* vars and the app configuration file —\n// without them lower() refuses because no container is resolved), by the\n// command Composer starts, which a failed run prints:\n//\n// <node> <bin of the alchemy @prisma/composer depends on> deploy ${GENERATED_DIR}/${GENERATED_FILE} --yes --stage <stage>\n//\n// bisects a CLI bug from an Alchemy bug (deploy-cli.md § Implementation decisions).\n// It runs no config adapter: it reads what the first process's Load read from the app configuration file named in PRISMA_COMPOSER_APP_CONFIGURATION_FILE.\nimport { lower } from '@prisma/composer/deploy';\nimport * as report from '@prisma/composer/report';\nimport { readAppConfigurationFile } from '@prisma/composer/internal/app-configuration-file';\nimport prismaConfig from ${quote(configImport)};\nimport app from ${quote(appImport)};\n\nconst config = prismaConfig.composer;\nif (config === undefined) {\n throw new Error(${quote(noComposerExportMessage(input.configFile))});\n}\n\n// The app's own @prisma/composer may predate the failure recorder.\nreport.captureEngineFailure?.();\n\nconst file = readAppConfigurationFile(process.env);\n\nexport default lower(app, config, {\n${renderOptions(input)}\n});\n`;\n}\n/** Writes the stack file, returning its absolute path. */\nfunction writeStackFile(input) {\n\tconst generatedDir = path.join(input.cwd, GENERATED_DIR);\n\tfs.mkdirSync(generatedDir, { recursive: true });\n\tconst filePath = path.join(generatedDir, GENERATED_FILE);\n\tfs.writeFileSync(filePath, renderStackFile(input));\n\treturn filePath;\n}\nconst GENERATED_STACK_RELATIVE_PATH = path.join(GENERATED_DIR, GENERATED_FILE);\n//#endregion\n//#region src/operations/execute-deploy-destroy.ts\n/**\n* The deploy/destroy executor — main.ts's pipeline orchestration with argv,\n* console, and exit codes removed: typed inputs in, structured results out.\n* Reached only by lazy import from deploy.ts/destroy.ts — this module's\n* static graph transitively loads alchemy's provider tree, so the control\n* entry must never import it statically.\n*/\nconst ALCHEMY_STATE_DIR = \".alchemy\";\n/** Destroy guardrail (moved from main.ts): true when `<cwd>/.alchemy` is missing or empty — likely wrong directory or nothing deployed yet. */\nfunction hasNoLocalDeployState(cwd) {\n\tconst stateDir = path.join(cwd, ALCHEMY_STATE_DIR);\n\treturn !(fs.existsSync(stateDir) && fs.readdirSync(stateDir).length > 0);\n}\n/**\n* Times each deploy step for the host's `onEvent`. A step still open when the\n* run fails is closed as failed, innermost first. A host `onEvent` that throws\n* is the host's bug and cannot fail the deploy.\n*/\nfunction deploySteps(onEvent) {\n\tconst open = /* @__PURE__ */ new Map();\n\tconst keyOf = (step) => step.name === \"assemble-service\" ? `${step.name}:${step.address}` : step.name === \"apply-resource\" ? `${step.name}:${step.resourceId}` : step.name;\n\tconst emit = (event) => {\n\t\ttry {\n\t\t\tonEvent?.(event);\n\t\t} catch {}\n\t};\n\tconst finish = (step, outcome, data) => {\n\t\tconst entry = open.get(keyOf(step));\n\t\tif (entry === void 0) return;\n\t\topen.delete(keyOf(step));\n\t\tconst durationMs = Math.round(performance.now() - entry.startedAt);\n\t\temit({\n\t\t\tkind: \"step-finished\",\n\t\t\tstep,\n\t\t\toutcome,\n\t\t\tdurationMs,\n\t\t\tdata\n\t\t});\n\t};\n\treturn {\n\t\tstart(step) {\n\t\t\topen.set(keyOf(step), {\n\t\t\t\tstep,\n\t\t\t\tstartedAt: performance.now()\n\t\t\t});\n\t\t\temit({\n\t\t\t\tkind: \"step-started\",\n\t\t\t\tstep\n\t\t\t});\n\t\t},\n\t\tfinish(step, data) {\n\t\t\tfinish(step, \"ok\", data);\n\t\t},\n\t\tfail(step) {\n\t\t\tfinish(step, \"failed\");\n\t\t},\n\t\tfailOpen() {\n\t\t\tfor (const { step } of [...open.values()].reverse()) finish(step, \"failed\");\n\t\t},\n\t\tisOpen(step) {\n\t\t\treturn open.has(keyOf(step));\n\t\t},\n\t\tmessage(severity, text) {\n\t\t\temit({\n\t\t\t\tkind: \"message\",\n\t\t\t\tseverity,\n\t\t\t\ttext\n\t\t\t});\n\t\t},\n\t\temit\n\t};\n}\nasync function executeDeploy(input, deps, cwd) {\n\tconst outcome = await runStackPipeline(\"deploy\", {\n\t\tentry: input.entry,\n\t\tconfig: input.config,\n\t\tname: input.name,\n\t\tenvironment: input.environment ?? \"production\",\n\t\tcwd,\n\t\tonEvent: void 0,\n\t\tdeps,\n\t\treportId: input.reportId,\n\t\treportPath: resolveRunReportPath(input.reportPath, process.env[RUN_REPORT_FILE_ENV], cwd),\n\t\tsteps: deploySteps(input.onEvent),\n\t\tsignal: input.signal,\n\t\tredaction: deps.redaction ?? new SecretRedaction(process.env)\n\t});\n\tif (!outcome.ok) return outcome;\n\treturn ok({ summary: outcome.value });\n}\nasync function executeDestroy(input, deps, cwd) {\n\tconst outcome = await runStackPipeline(\"destroy\", {\n\t\tentry: input.entry,\n\t\tconfig: input.config,\n\t\tname: input.name,\n\t\tenvironment: input.environment,\n\t\tcwd,\n\t\tonEvent: input.onEvent,\n\t\tdeps,\n\t\treportId: void 0,\n\t\treportPath: void 0,\n\t\tsteps: deploySteps(void 0),\n\t\tsignal: void 0,\n\t\tredaction: new SecretRedaction(process.env)\n\t});\n\tif (!outcome.ok) return outcome;\n\treturn okVoid();\n}\n/**\n* Opens a session per extension that declares a reporter. A `begin` that\n* throws costs that extension its reporting and nothing else — the deploy\n* has not started, and refusing to run it because an observer failed would\n* invert the relationship.\n*/\nasync function beginReporters(extensions, context, redaction) {\n\treturn (await Promise.all(extensions.map(async (extension) => {\n\t\tif (extension.reporter === void 0) return void 0;\n\t\ttry {\n\t\t\tconst reporter = await extension.reporter.begin(context);\n\t\t\treturn reporter === void 0 ? void 0 : {\n\t\t\t\textensionId: extension.id,\n\t\t\t\treporter\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\t\tconsole.warn(`\\nCould not start deploy reporting for ${extension.id}: ${redaction.redact(detail)}`);\n\t\t\treturn;\n\t\t}\n\t}))).filter((entry) => entry !== void 0);\n}\n/** Hands each session its own extension's resolved container, so it can attach the run to what that container names. */\nasync function attachReporters(reporters, containers, redaction) {\n\tawait Promise.all(reporters.map(async ({ extensionId, reporter }) => {\n\t\ttry {\n\t\t\tawait reporter.attach({ container: containers.get(extensionId) });\n\t\t} catch (error) {\n\t\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\t\tconsole.warn(`\\nCould not attach this deploy to its project for ${extensionId}: ${redaction.redact(detail)}`);\n\t\t}\n\t}));\n}\n/** Every session's contribution to the apply's environment, so reporting that happens inside the apply can find the run. */\nfunction reporterEnv(reporters, redaction) {\n\tconst env = {};\n\tfor (const { extensionId, reporter } of reporters) try {\n\t\tObject.assign(env, reporter.childEnv());\n\t} catch (error) {\n\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\tconsole.warn(`\\nCould not pass deploy reporting into the apply for ${extensionId}: ${redaction.redact(detail)}`);\n\t}\n\treturn env;\n}\n/** `failingStep` is capped at 500 by the platform and `errorMessage` at 5000; truncating here keeps a long message from costing the whole report. */\nfunction truncate(value, limit) {\n\treturn value.length <= limit ? value : `${value.slice(0, limit - 1)}…`;\n}\n/** An interrupted converge — reported as `cancelled`, never as `failed`. */\nfunction wasInterrupted(failure) {\n\treturn failure.code === \"DEPLOY.INTERRUPTED\" || typeof failure.meta?.[\"signal\"] === \"string\";\n}\n/**\n* Ends every reporting session, whatever the run did. Sessions never reject\n* by contract, but a buggy one must not turn a converged deploy into a\n* failure — so this swallows anyway, and reports each session independently\n* so one bad implementation cannot silence another.\n*/\nasync function finishReporters(reporters, outcome, redaction) {\n\tconst entities = outcome.summary?.nodes.flatMap((node) => node.entities) ?? [];\n\tawait Promise.all(reporters.map(async ({ reporter }) => {\n\t\ttry {\n\t\t\tawait reporter.finish({\n\t\t\t\tok: outcome.ok,\n\t\t\t\tcancelled: outcome.cancelled,\n\t\t\t\tfailingStep: outcome.code === void 0 ? void 0 : truncate(outcome.code, 500),\n\t\t\t\terrorMessage: outcome.message === void 0 ? void 0 : truncate(outcome.message, 5e3),\n\t\t\t\tentities\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\t\tconsole.warn(`\\nCould not report this deploy's outcome: ${redaction.redact(detail)}`);\n\t\t}\n\t}));\n}\n/**\n* Owns the reporting sessions around the pipeline: the inner run opens them\n* once it knows which extensions are configured, and this closes them on\n* every exit path — a returned failure, a success, or a thrown defect — as\n* the `record` step, which also writes the run report.\n* Nothing here can change what the pipeline returns.\n*/\nasync function runStackPipeline(action, opts) {\n\tconst reporters = [];\n\tlet outcome;\n\ttry {\n\t\toutcome = await runStackPipelineInner(action, opts, reporters);\n\t} catch (error) {\n\t\topts.steps.failOpen();\n\t\topts.steps.start({ name: \"record\" });\n\t\tconst thrown = redactThrown(error, opts.redaction);\n\t\tawait finishReporters(reporters, {\n\t\t\tok: false,\n\t\t\tcancelled: false,\n\t\t\tcode: \"DEPLOY.UNEXPECTED\",\n\t\t\tmessage: thrown.message\n\t\t}, opts.redaction);\n\t\topts.steps.finish({ name: \"record\" });\n\t\tthrow thrown;\n\t}\n\tif (!outcome.ok) outcome = notOk(redactError(outcome.failure, opts.redaction));\n\tif (!outcome.ok) opts.steps.failOpen();\n\topts.steps.start({ name: \"record\" });\n\tawait finishReporters(reporters, outcome.ok ? {\n\t\tok: true,\n\t\tcancelled: false,\n\t\tsummary: outcome.value\n\t} : {\n\t\tok: false,\n\t\tcancelled: wasInterrupted(outcome.failure),\n\t\tcode: outcome.failure.code,\n\t\tmessage: outcome.failure.message\n\t}, opts.redaction);\n\tif (opts.reportPath === void 0 || writeRunReport(opts.reportPath, toRunReport({\n\t\tsummary: outcome.ok ? outcome.value : void 0,\n\t\tenvironment: opts.environment,\n\t\tfailure: outcome.ok ? void 0 : {\n\t\t\tcode: outcome.failure.code,\n\t\t\tmessage: outcome.failure.message\n\t\t}\n\t}))) opts.steps.finish({ name: \"record\" });\n\telse opts.steps.fail({ name: \"record\" });\n\treturn outcome;\n}\n/** The pipeline both actions share: validate, resolve containers, then for\n* deploy preflight and the in-process converge, and for destroy the stack\n* file, the alchemy child and the teardown/removal suffix. The value is only\n* ever a summary for deploy. */\nasync function runStackPipelineInner(action, opts, reporters) {\n\tconst { entry, config: composerConfig, name, environment, cwd, onEvent, deps, steps } = opts;\n\tsteps.start({ name: \"prepare\" });\n\tremoveLeftoverAppConfigurationFiles(cwd);\n\ttry {\n\t\tvalidateEnvironmentName(environment);\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\tlet appConvergeEntry;\n\tif (action === \"deploy\") {\n\t\tconst loaded = await prepareAppConvergeEntry(deps, path.dirname(path.resolve(cwd, composerConfig.file)));\n\t\tif (!loaded.ok) return loaded;\n\t\tappConvergeEntry = loaded.value;\n\t}\n\tconst platformCredentials = deps.credentials;\n\tif (action === \"destroy\" && hasNoLocalDeployState(cwd)) onEvent?.({\n\t\tkind: \"no-local-deploy-state\",\n\t\tcwd\n\t});\n\tlet pipeline;\n\tlet containers;\n\tlet alchemyStage;\n\tconst preflightPayloads = /* @__PURE__ */ new Map();\n\tconst unset = [];\n\tconst preflightTransportEnv = {};\n\ttry {\n\t\tpipeline = await runPipeline(entry, name, environment, cwd, composerConfig, {\n\t\t\trunAssembler: deps.runAssembler,\n\t\t\treadSecrets: action === \"deploy\",\n\t\t\tredaction: opts.redaction,\n\t\t\tonEvent: (event) => {\n\t\t\t\tswitch (event.kind) {\n\t\t\t\t\tcase \"loaded\":\n\t\t\t\t\t\tsteps.finish({ name: \"prepare\" });\n\t\t\t\t\t\tsteps.start({ name: \"assemble\" });\n\t\t\t\t\t\treturn;\n\t\t\t\t\tcase \"service-started\":\n\t\t\t\t\t\tsteps.start({\n\t\t\t\t\t\t\tname: \"assemble-service\",\n\t\t\t\t\t\t\taddress: event.address\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn;\n\t\t\t\t\tcase \"service-assembled\":\n\t\t\t\t\t\tsteps.finish({\n\t\t\t\t\t\t\tname: \"assemble-service\",\n\t\t\t\t\t\t\taddress: event.address\n\t\t\t\t\t\t}, event.data);\n\t\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}, action === \"destroy\" ? (error) => new CliStructuredError(\"DEPLOY.BUILD_REQUIRED\", error.message, {\n\t\t\twhy: \"destroy evaluates the same stack program as deploy, which packages the built artifacts — so the app must be built first.\",\n\t\t\tfix: \"Run the build, then retry the destroy.\",\n\t\t\tcause: error\n\t\t}) : void 0);\n\t\tsteps.finish({ name: \"assemble\" });\n\t\tconst { graph, name: resolvedName } = pipeline;\n\t\tconst config = pipeline.configSource.value;\n\t\tif (action === \"deploy\") refuseSecretsInRootInput(graph.appConfigurationRead, opts.redaction.knownSecrets, \"A deploy sends every plain value Load read to the platform as plain configuration, and never sends a secret that way.\");\n\t\tsteps.start({ name: \"connect\" });\n\t\tif (action === \"deploy\") reporters.push(...await beginReporters(config.extensions, {\n\t\t\tappName: resolvedName,\n\t\t\tgraph,\n\t\t\tenvironment,\n\t\t\tcwd,\n\t\t\treportId: opts.reportId,\n\t\t\tcredentials: platformCredentials\n\t\t}, opts.redaction));\n\t\tcontainers = /* @__PURE__ */ new Map();\n\t\tfor (const extension of config.extensions) {\n\t\t\tif (extension.container === void 0) continue;\n\t\t\ttry {\n\t\t\t\tif (action === \"deploy\") {\n\t\t\t\t\tconst instance = await extension.container.ensure({\n\t\t\t\t\t\tappName: resolvedName,\n\t\t\t\t\t\tenvironment\n\t\t\t\t\t}, platformCredentials);\n\t\t\t\t\trequireContainerForEnvironment(action, extension.id, extension.container, instance, environment);\n\t\t\t\t\tcontainers.set(extension.id, instance);\n\t\t\t\t} else {\n\t\t\t\t\tconst instance = await extension.container.locate({\n\t\t\t\t\t\tappName: resolvedName,\n\t\t\t\t\t\tenvironment\n\t\t\t\t\t}, platformCredentials);\n\t\t\t\t\tif (instance === void 0) throw new CliStructuredError(\"DEPLOY.TARGET_NOT_FOUND\", `Nothing deployed for ${resolvedName} in the environment ${environment}.`, { fix: \"Deploy it first.\" });\n\t\t\t\t\trequireContainerForEnvironment(action, extension.id, extension.container, instance, environment);\n\t\t\t\t\tcontainers.set(extension.id, instance);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tthrow toStructured(\"DEPLOY.CONTAINER_FAILED\", error);\n\t\t\t}\n\t\t}\n\t\tawait attachReporters(reporters, containers, opts.redaction);\n\t\talchemyStage = containers.get(config.state.extension)?.alchemyStage ?? environment;\n\t\tsteps.finish({ name: \"connect\" });\n\t\tif (action === \"deploy\") {\n\t\t\tsteps.start({ name: \"preflight\" });\n\t\t\tlet checked = 0;\n\t\t\tconst report = (reported) => {\n\t\t\t\tchecked += reported.checked;\n\t\t\t\tunset.push(...reported.unset.map((variable) => redactUnsetPlatformVariable(variable, opts.redaction)));\n\t\t\t};\n\t\t\tfor (const extension of config.extensions) {\n\t\t\t\tif (extension.preflight === void 0) continue;\n\t\t\t\ttry {\n\t\t\t\t\tconst payload = await extension.preflight({\n\t\t\t\t\t\tgraph,\n\t\t\t\t\t\tcontainer: containers.get(extension.id),\n\t\t\t\t\t\tenvironment,\n\t\t\t\t\t\tconfiguration: pipeline.configuration,\n\t\t\t\t\t\tsecrets: pipeline.secrets,\n\t\t\t\t\t\tcredentials: platformCredentials,\n\t\t\t\t\t\treport\n\t\t\t\t\t});\n\t\t\t\t\tif (payload !== void 0) preflightPayloads.set(extension.id, payload);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow toStructured(\"DEPLOY.PREFLIGHT_FAILED\", error);\n\t\t\t\t}\n\t\t\t}\n\t\t\tsteps.finish({ name: \"preflight\" }, {\n\t\t\t\tchecked,\n\t\t\t\tunset: unset.length\n\t\t\t});\n\t\t\tif (unset.length > 0) steps.emit({\n\t\t\t\tkind: \"preflight-findings\",\n\t\t\t\tfindings: { unset }\n\t\t\t});\n\t\t}\n\t\tif (action === \"destroy\") for (const extension of config.extensions) preflightTransportEnv[preflightEnvVarName(extension.id)] = \"\";\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\tif (appConvergeEntry !== void 0) return convergeDeploy(opts, pipeline, appConvergeEntry, {\n\t\tcontainers,\n\t\tstage: alchemyStage,\n\t\tpreflightPayloads,\n\t\tfindings: { unset },\n\t\tenv: reporterEnv(reporters, opts.redaction)\n\t});\n\tlet stackPath;\n\tconst resultFilePath = path.join(cwd, \".prisma-composer\", `deployment-result-${String(process.pid)}-${randomUUID()}.json`);\n\tlet handover;\n\ttry {\n\t\ttry {\n\t\t\thandover = prepareSecondProcess({\n\t\t\t\tfile: deployAppConfigurationFile(cwd, randomUUID()),\n\t\t\t\tappConfigurationRead: pipeline.graph.appConfigurationRead,\n\t\t\t\tplainVariableText: {},\n\t\t\t\tnodeAddresses: nodeAddresses(pipeline.graph),\n\t\t\t\tsecretsKeys: secretsKeys(pipeline.graph),\n\t\t\t\tknownSecrets: opts.redaction.knownSecrets\n\t\t\t});\n\t\t\tstackPath = writeStackFile({\n\t\t\t\tentryPath: pipeline.entryModule.path,\n\t\t\t\tcwd,\n\t\t\t\tconfigFile: pipeline.configSource.file,\n\t\t\t\tname: pipeline.name,\n\t\t\t\tenvironment,\n\t\t\t\tassembled: pipeline.assembled\n\t\t\t});\n\t\t\thandover.writeFile();\n\t\t} catch (error) {\n\t\t\treturn notOk(toStructured(\"DEPLOY.STACK_WRITE_FAILED\", error));\n\t\t}\n\t\tconst invocation = alchemyInvocation({\n\t\t\tcommand: action,\n\t\t\tstackFileRelativePath: GENERATED_STACK_RELATIVE_PATH,\n\t\t\tcwd,\n\t\t\tstage: alchemyStage,\n\t\t\tcontainerEnv: containerEnv(containers),\n\t\t\tpreflightEnv: preflightTransportEnv,\n\t\t\tenv: {\n\t\t\t\t...reporterEnv(reporters, opts.redaction),\n\t\t\t\t...handover.env,\n\t\t\t\t[DEPLOYMENT_RESULT_FILE_ENV]: resultFilePath\n\t\t\t},\n\t\t\tredactedValues: opts.redaction.allValues()\n\t\t});\n\t\tsteps.start({ name: \"apply\" });\n\t\tlet outcome;\n\t\ttry {\n\t\t\toutcome = await (deps.alchemy ?? spawnAlchemy)(invocation);\n\t\t} catch (error) {\n\t\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\t\treturn notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", error instanceof Error ? error.message : String(error), {\n\t\t\t\tcause: error,\n\t\t\t\tmeta: { diagnostics: {\n\t\t\t\t\texitCode: void 0,\n\t\t\t\t\tstackFilePath: stackPath,\n\t\t\t\t\treproduceCommand: reproduceCommand(invocation),\n\t\t\t\t\tcwd\n\t\t\t\t} }\n\t\t\t}));\n\t\t}\n\t\tconst reproduce = reproduceCommand(invocation, outcome);\n\t\tif (outcome.signal !== null) return notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", `alchemy ${action} was interrupted by ${outcome.signal}.`, { meta: {\n\t\t\tsignal: outcome.signal,\n\t\t\tdiagnostics: {\n\t\t\t\texitCode: void 0,\n\t\t\t\tsignal: outcome.signal,\n\t\t\t\tstackFilePath: stackPath,\n\t\t\t\treproduceCommand: reproduce,\n\t\t\t\tcwd\n\t\t\t}\n\t\t} }));\n\t\tconst status = outcome.exitCode ?? 1;\n\t\tif (status !== 0) {\n\t\t\tconst engineCause = readEngineFailureCause(resultFilePath, (text) => opts.redaction.redact(text));\n\t\t\tconst withCause = (sentence) => engineCause === void 0 ? sentence : `${sentence}\\n${engineCause}`;\n\t\t\treturn notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", withCause(`alchemy ${action} exited with status ${status}.`), { meta: {\n\t\t\t\texitCode: status,\n\t\t\t\t...engineCause !== void 0 ? { engineCause } : {},\n\t\t\t\tdiagnostics: {\n\t\t\t\t\texitCode: status,\n\t\t\t\t\tstackFilePath: stackPath,\n\t\t\t\t\treproduceCommand: reproduce,\n\t\t\t\t\tcwd\n\t\t\t\t}\n\t\t\t} }));\n\t\t}\n\t\tsteps.finish({ name: \"apply\" });\n\t\ttry {\n\t\t\tif (action === \"destroy\") {\n\t\t\t\tfor (const extension of pipeline.configSource.value.extensions) {\n\t\t\t\t\tif (extension.teardown === void 0) continue;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait extension.teardown({\n\t\t\t\t\t\t\tcontainer: containers.get(extension.id),\n\t\t\t\t\t\t\tenvironment\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow toStructured(\"DEPLOY.TEARDOWN_FAILED\", error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (const extension of pipeline.configSource.value.extensions) {\n\t\t\t\t\tif (extension.container === void 0) continue;\n\t\t\t\t\tconst instance = containers.get(extension.id);\n\t\t\t\t\tif (instance === void 0) continue;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait extension.container.remove(instance, platformCredentials);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow toStructured(\"DEPLOY.CONTAINER_REMOVE_FAILED\", error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\t\tthrow error;\n\t\t}\n\t\treturn ok(void 0);\n\t} finally {\n\t\ttry {\n\t\t\tfs.rmSync(resultFilePath, { force: true });\n\t\t\tfs.rmSync(engineFailureFilePath(resultFilePath), { force: true });\n\t\t} catch {}\n\t\thandover?.removeFile();\n\t}\n}\n/** Loaded before anything is created, so a missing or incompatible install fails first. */\nasync function prepareAppConvergeEntry(deps, appDir) {\n\ttry {\n\t\treturn ok(deps.appConvergeEntry ?? await loadAppConvergeEntry(appDir));\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n}\n/** One Alchemy progress event as the deploy's step events: each resource is a step inside `apply`. */\nfunction reportConvergeEvent(steps, event, redact) {\n\tif (event.kind === \"log\") {\n\t\tsteps.message(event.severity, redact(withComposerAdvice(event.text)));\n\t\treturn;\n\t}\n\tconst step = {\n\t\tname: \"apply-resource\",\n\t\tresourceId: event.fqn,\n\t\tresourceType: event.resourceType,\n\t\tstatus: event.status\n\t};\n\tswitch (event.phase) {\n\t\tcase \"running\":\n\t\t\tif (!steps.isOpen(step)) steps.start(step);\n\t\t\treturn;\n\t\tcase \"done\":\n\t\t\tif (!steps.isOpen(step)) steps.start(step);\n\t\t\tsteps.finish(step);\n\t\t\treturn;\n\t\tcase \"failed\":\n\t\t\tif (!steps.isOpen(step)) steps.start(step);\n\t\t\tsteps.fail(step);\n\t\t\tif (event.message !== void 0) steps.message(\"warn\", redact(`${event.fqn}: ${withComposerAdvice(event.message)}`));\n\t\t\treturn;\n\t\tcase \"pending\": return;\n\t}\n}\nfunction reasonsText(reasons) {\n\treturn reasons.map(({ tag, message }) => tag === \"Error\" || tag === \"Unknown\" || message.startsWith(tag) ? message : `${tag}: ${message}`).join(\"\\n\");\n}\n/** The structured failure a converge that did not apply settles as. */\nfunction convergeFailure(outcome, redact) {\n\tswitch (outcome.kind) {\n\t\tcase \"interrupted\": return new CliStructuredError(\"DEPLOY.INTERRUPTED\", \"The deploy was interrupted.\", {\n\t\t\twhy: \"It stopped while Alchemy planned or applied it. Resources it had already changed stay as they are.\",\n\t\t\tfix: \"Deploy again to finish.\"\n\t\t});\n\t\tcase \"refused\": return outcome.reason === \"already-running\" ? new CliStructuredError(\"DEPLOY.CONVERGE_RUNNING\", \"Another deploy is already running in this process.\", {\n\t\t\twhy: \"A deploy sets the process's environment and working directory while Alchemy runs, so two cannot overlap.\",\n\t\t\tfix: \"Wait for the other deploy to finish, or run this one in its own process.\"\n\t\t}) : new CliStructuredError(\"DEPLOY.WORKER_THREAD\", \"Deploy cannot run in a worker thread when its cwd is not the process working directory.\", {\n\t\t\twhy: \"Alchemy reads `.env` and keeps `.alchemy` in the working directory, and a worker thread cannot change it.\",\n\t\t\tfix: \"Call deploy from the main thread, or with the process's working directory as its cwd.\"\n\t\t});\n\t\tcase \"failed\": {\n\t\t\tconst cause = capFailureCause(redact(withComposerAdvice(reasonsText(outcome.reasons))));\n\t\t\treturn new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", `Alchemy could not deploy the app.\\n${cause}`, { meta: {\n\t\t\t\tengineCause: cause,\n\t\t\t\treasons: outcome.reasons.map(({ tag, message }) => ({\n\t\t\t\t\ttag,\n\t\t\t\t\tmessage: redact(message)\n\t\t\t\t}))\n\t\t\t} });\n\t\t}\n\t}\n\treturn new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", \"The converge ended with an outcome this Composer does not know.\");\n}\n/**\n* Alchemy's terminal text as `info` messages, one per complete line, redacted. A secret split\n* across writes or lines is still found, because the text passes through a `StreamRedactor`\n* before it is cut into lines. `end` sends the last line that has no line break.\n*/\nfunction interactionMessages(steps, redaction) {\n\tconst stream = new StreamRedactor(redaction.allValues());\n\tlet partial = \"\";\n\tconst send = (text, last) => {\n\t\tconst lines = (partial + text).split(\"\\n\");\n\t\tpartial = last ? \"\" : lines.pop() ?? \"\";\n\t\tfor (const line of lines) if (line.trim() !== \"\") steps.message(\"info\", redaction.redact(line));\n\t};\n\treturn {\n\t\tpush: (text) => send(stream.push(text), false),\n\t\tend: () => send(stream.end(), true)\n\t};\n}\n/**\n* Deploy's converge: lowers the app with the containers and preflight\n* payloads this run resolved, then plans and applies it in this process.\n* The report hook runs inside the apply, here, so the summary comes back as\n* a value.\n*/\nasync function convergeDeploy(opts, pipeline, entry, resolved) {\n\tconst { cwd, environment, steps } = opts;\n\tconst config = pipeline.configSource.value;\n\tconst env = resolved.env;\n\topts.redaction.addCredentialLookingValues(credentialLookingValues(env));\n\tconst redact = (text) => opts.redaction.redact(text);\n\tlet summary;\n\tconst root = pipeline.graph.root.node;\n\tif (root.kind !== \"module\") throw new InternalError(\"runPipeline admitted a root that is not a module\");\n\tsteps.start({ name: \"apply\" });\n\tlet stack;\n\ttry {\n\t\tstack = entry.lower(root, config, {\n\t\t\tname: pipeline.name,\n\t\t\tenvironment,\n\t\t\tappConfigurationRead: pipeline.graph.appConfigurationRead,\n\t\t\tfirstProcessNodeAddresses: nodeAddresses(pipeline.graph),\n\t\t\tbundles: pipeline.assembled.bundles,\n\t\t\tcontainers: resolved.containers,\n\t\t\tpreflightPayloads: resolved.preflightPayloads,\n\t\t\tfindings: resolved.findings,\n\t\t\tcredentials: opts.deps.credentials,\n\t\t\treport: (result) => {\n\t\t\t\tsummary = toDeploymentSummary(result);\n\t\t\t}\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\treturn notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", redact(error instanceof Error ? error.message : String(error))));\n\t}\n\tconst output = interactionMessages(steps, opts.redaction);\n\tlet outcome;\n\ttry {\n\t\toutcome = await entry.converge({\n\t\t\toperation: \"deploy\",\n\t\t\tstack,\n\t\t\tstage: resolved.stage,\n\t\t\tcwd,\n\t\t\tenv,\n\t\t\tsignal: opts.signal,\n\t\t\tonEvent: (event) => reportConvergeEvent(steps, event, redact),\n\t\t\toutput: (text) => output.push(text)\n\t\t});\n\t} catch (error) {\n\t\treturn notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", redact(`Alchemy could not deploy the app.\\n${error instanceof Error ? error.message : String(error)}`)));\n\t} finally {\n\t\toutput.end();\n\t}\n\tif (outcome.kind !== \"applied\") return notOk(convergeFailure(outcome, redact));\n\tsteps.finish({ name: \"apply\" });\n\treturn ok(redactSummary(summary, opts.redaction));\n}\n//#endregion\nexport { executeDeploy, executeDestroy };\n\n//# sourceMappingURL=execute-deploy-destroy-D2Ok1xun.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,IAAI,UAAU;AAGd,MAAM,QAAQ;AACd,MAAM,iBAAiB;;AAEvB,MAAM,wBAAwB;AAC9B,SAAS,aAAa,QAAQ,QAAQ,OAAO;CAC5C,OAAO,IAAI,mBAAmB,8BAA8B,mEAAmE,OAAO,KAAK,UAAU;EACpJ,KAAK;EACL,KAAK;EACL,GAAG,UAAU,KAAK,IAAI,CAAC,IAAI,EAAE,MAAM;CACpC,CAAC;AACF;AACA,SAA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} from "./graph-C6Fqe2gn-DMa2udEA.mjs";
2
2
  import { t as CliStructuredError } from "./errors-0e8IVwzi.mjs";
3
- import { c as preflightFindingsEnv, n as containerEnv, o as preflightEnv, s as preflightEnvVarName } from "./preflight-transport-DJjTWvyH-CEJ9WlaN.mjs";
3
+ import { a as preflightEnv, o as preflightEnvVarName, t as containerEnv } from "./preflight-transport-C7_3abXW-Bza_hn9G.mjs";
4
4
  import { i as devEnvironmentDir } from "./app-config-CErnR6NK-D9NgSBH4.mjs";
5
- import { i as prepareSecondProcess, n as devAppConfigurationFile, o as removeLeftoverAppConfigurationFiles } from "./app-configuration-file-Cw9autUL-DebaEvDz.mjs";
6
- import { c as toStructured, l as notOk, s as requireContainerForEnvironment, u as ok } from "./dev-current-D8GwJQex-C8F3EUBY.mjs";
7
- import "./deploy-BzRRAmns.mjs";
5
+ import { i as prepareSecondProcess, n as devAppConfigurationFile, s as removeLeftoverAppConfigurationFiles } from "./app-configuration-file-Bbfq5PR3-D4DUNKUM.mjs";
6
+ import "./deploy-NArSOken.mjs";
7
+ import { c as toStructured, l as notOk, s as requireContainerForEnvironment, u as ok } from "./dev-current-Ce4Zhfiy-TY0NjkOZ.mjs";
8
8
  import { r as resolveLocalTargets } from "./local-target-COdS1iNs.mjs";
9
- import { a as redactDevEvent, c as redactThrown, o as redactError, t as SecretRedaction } from "./redaction-C-NnlVUh-B1nJc6rb.mjs";
10
- import { a as noComposerExportMessage, i as validateEnvironmentName, r as runPipeline } from "./validate-environment-DyW59rJ7-u8hQkzuY.mjs";
11
- import { n as reproduceCommand, r as spawnAlchemy, t as alchemyInvocation } from "./run-alchemy-CyciV8i0-BxPAyrch.mjs";
9
+ import { a as redactDevEvent, c as redactThrown, o as redactError, t as SecretRedaction } from "./redaction-CjMYXtGp-CEQ5z1PK.mjs";
10
+ import { a as noComposerExportMessage, i as validateEnvironmentName, r as runPipeline } from "./validate-environment-XwVDifWN-BhPOzWN8.mjs";
11
+ import { n as reproduceCommand, r as spawnAlchemy, t as alchemyInvocation } from "./run-alchemy-BlYyc4Oh-mIzYC4lq.mjs";
12
12
  import { n as requireDevEnvironmentName, t as claimDevEnvironmentName } from "./dev-environment-name-6eEr5PW8-6sPgQZG3.mjs";
13
13
  import { t as withEmulatorRetry } from "./emulator-retry-CV8rl69G-BgUzkxc-.mjs";
14
14
  import * as path$1 from "node:path";
@@ -1665,7 +1665,7 @@ var esm_default = {
1665
1665
  FSWatcher
1666
1666
  };
1667
1667
  //#endregion
1668
- //#region ../../0-framework/3-tooling/cli/dist/execute-dev-xPaS5SAl.mjs
1668
+ //#region ../../0-framework/3-tooling/cli/dist/execute-dev-BBPgDWzf.mjs
1669
1669
  const readKey = (read) => JSON.stringify([
1670
1670
  read.reader,
1671
1671
  read.resource,
@@ -2005,7 +2005,6 @@ async function executeDevInner(input, deps, cwd, redaction) {
2005
2005
  throw toStructured("DEV.PREFLIGHT_FAILED", error);
2006
2006
  }
2007
2007
  for (const extension of config.extensions) preflightTransportEnv[preflightEnvVarName(extension.id)] ??= "";
2008
- Object.assign(preflightTransportEnv, preflightFindingsEnv({ unset: [] }));
2009
2008
  for (const [id, dev] of resolved) {
2010
2009
  if (dev.emulators === void 0) continue;
2011
2010
  try {
@@ -2353,4 +2352,4 @@ async function executeDevInner(input, deps, cwd, redaction) {
2353
2352
  //#endregion
2354
2353
  export { executeDev };
2355
2354
 
2356
- //# sourceMappingURL=execute-dev-xPaS5SAl-BUeHjmYV.mjs.map
2355
+ //# sourceMappingURL=execute-dev-BBPgDWzf-BCSle0Mw.mjs.map