@fjall/deploy-core 2.25.0 → 2.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/dist/.minified +1 -1
  2. package/dist/src/aws/index.d.ts +1 -1
  3. package/dist/src/aws/index.js +1 -1
  4. package/dist/src/aws/organisations/backup.d.ts +7 -2
  5. package/dist/src/aws/organisations/backup.js +2 -2
  6. package/dist/src/aws/organisations/index.d.ts +2 -2
  7. package/dist/src/aws/organisations/index.js +1 -1
  8. package/dist/src/aws/organisations/oidcProvider.d.ts +37 -0
  9. package/dist/src/aws/organisations/oidcProvider.js +1 -1
  10. package/dist/src/aws/organisations/organisation.d.ts +21 -0
  11. package/dist/src/aws/organisations/organisation.js +1 -1
  12. package/dist/src/aws/organisations/organisationalUnits.d.ts +15 -0
  13. package/dist/src/aws/organisations/organisationalUnits.js +1 -1
  14. package/dist/src/aws/utils/cloudformationEventHelpers.d.ts +45 -0
  15. package/dist/src/aws/utils/cloudformationEventHelpers.js +1 -1
  16. package/dist/src/aws/utils/cloudformationEventTypes.d.ts +1 -1
  17. package/dist/src/aws/utils/cloudformationEvents.d.ts +2 -1
  18. package/dist/src/aws/utils/cloudformationEvents.js +1 -1
  19. package/dist/src/aws/utils/stackStatus.js +1 -1
  20. package/dist/src/index.d.ts +13 -2
  21. package/dist/src/index.js +1 -1
  22. package/dist/src/orchestration/activeDeploymentGuard.d.ts +41 -0
  23. package/dist/src/orchestration/activeDeploymentGuard.js +8 -4
  24. package/dist/src/orchestration/application/applicationDeploy.d.ts +9 -0
  25. package/dist/src/orchestration/application/applicationDeploy.js +1 -1
  26. package/dist/src/orchestration/application/applicationDeployHelpers.d.ts +20 -3
  27. package/dist/src/orchestration/application/applicationDeployHelpers.js +3 -3
  28. package/dist/src/orchestration/application/applicationDestroy.js +1 -1
  29. package/dist/src/orchestration/application/approvalGate.d.ts +15 -1
  30. package/dist/src/orchestration/application/approvalGate.js +1 -1
  31. package/dist/src/orchestration/application/databaseEndpointReconcile.d.ts +77 -0
  32. package/dist/src/orchestration/application/databaseEndpointReconcile.js +1 -0
  33. package/dist/src/orchestration/application/deploySessionPolicy.d.ts +9 -1
  34. package/dist/src/orchestration/application/deploySessionPolicy.js +1 -1
  35. package/dist/src/orchestration/application/destructionGate.d.ts +164 -0
  36. package/dist/src/orchestration/application/destructionGate.js +5 -0
  37. package/dist/src/orchestration/application/dockerBuildHelper.js +1 -1
  38. package/dist/src/orchestration/application/ecrCacheRepository.d.ts +14 -0
  39. package/dist/src/orchestration/application/ecrCacheRepository.js +1 -0
  40. package/dist/src/orchestration/application/leaseGate.d.ts +30 -0
  41. package/dist/src/orchestration/application/leaseGate.js +1 -0
  42. package/dist/src/orchestration/application/plan/approvalToken.d.ts +15 -0
  43. package/dist/src/orchestration/application/plan/approvalToken.js +1 -1
  44. package/dist/src/orchestration/application/plan/changeSetEscalation.d.ts +46 -0
  45. package/dist/src/orchestration/application/plan/changeSetEscalation.js +1 -0
  46. package/dist/src/orchestration/application/plan/computeDeployPlan.d.ts +13 -0
  47. package/dist/src/orchestration/application/plan/computeDeployPlan.js +1 -1
  48. package/dist/src/orchestration/application/plan/index.d.ts +4 -1
  49. package/dist/src/orchestration/application/plan/index.js +1 -1
  50. package/dist/src/orchestration/application/plan/loadDeployPlan.d.ts +32 -0
  51. package/dist/src/orchestration/application/plan/loadDeployPlan.js +1 -0
  52. package/dist/src/orchestration/application/plan/pinnedNames.d.ts +31 -0
  53. package/dist/src/orchestration/application/plan/pinnedNames.js +1 -0
  54. package/dist/src/orchestration/application/plan/registryOverlay.d.ts +83 -0
  55. package/dist/src/orchestration/application/plan/registryOverlay.js +1 -0
  56. package/dist/src/orchestration/application/plan/renderDeployPlan.d.ts +4 -1
  57. package/dist/src/orchestration/application/plan/renderDeployPlan.js +1 -1
  58. package/dist/src/orchestration/application/plan/types.d.ts +31 -0
  59. package/dist/src/orchestration/application/plan/types.js +1 -0
  60. package/dist/src/orchestration/contextHelpers.d.ts +37 -1
  61. package/dist/src/orchestration/contextHelpers.js +1 -1
  62. package/dist/src/orchestration/drift/classifyDriftFailure.d.ts +31 -0
  63. package/dist/src/orchestration/drift/classifyDriftFailure.js +1 -0
  64. package/dist/src/orchestration/drift/detectStackDrift.d.ts +37 -0
  65. package/dist/src/orchestration/drift/detectStackDrift.js +1 -0
  66. package/dist/src/orchestration/drift/driftPreFlight.d.ts +73 -0
  67. package/dist/src/orchestration/drift/driftPreFlight.js +7 -0
  68. package/dist/src/orchestration/drift/driftProbe.d.ts +113 -0
  69. package/dist/src/orchestration/drift/driftProbe.js +1 -0
  70. package/dist/src/orchestration/drift/driftSuspectJournal.d.ts +40 -0
  71. package/dist/src/orchestration/drift/driftSuspectJournal.js +1 -0
  72. package/dist/src/orchestration/drift/preFlightGate.d.ts +44 -0
  73. package/dist/src/orchestration/drift/preFlightGate.js +2 -0
  74. package/dist/src/orchestration/index.d.ts +19 -0
  75. package/dist/src/orchestration/index.js +1 -1
  76. package/dist/src/orchestration/organisation/cascadeDestroyHelpers.d.ts +7 -0
  77. package/dist/src/orchestration/organisation/cascadeDestroyHelpers.js +1 -1
  78. package/dist/src/orchestration/organisation/cascadeHelpers.js +1 -1
  79. package/dist/src/orchestration/organisation/organisationDestroy.js +3 -3
  80. package/dist/src/orchestration/organisationDeploy/infraSteps.d.ts +8 -1
  81. package/dist/src/orchestration/organisationDeploy/infraSteps.js +1 -1
  82. package/dist/src/orchestration/organisationDeploy/orgCascadeDeploy.js +5 -5
  83. package/dist/src/orchestration/organisationDeploy/orgContext.d.ts +28 -2
  84. package/dist/src/orchestration/organisationDeploy/orgContext.js +1 -1
  85. package/dist/src/orchestration/organisationDeploy/singleComponentDeploy.js +1 -1
  86. package/dist/src/orchestration/remediation/driftRepairGate.d.ts +66 -0
  87. package/dist/src/orchestration/remediation/driftRepairGate.js +1 -0
  88. package/dist/src/orchestration/remediation/forensicsCapture.d.ts +49 -0
  89. package/dist/src/orchestration/remediation/forensicsCapture.js +1 -0
  90. package/dist/src/orchestration/remediation/forgetResource.d.ts +423 -0
  91. package/dist/src/orchestration/remediation/forgetResource.js +1 -0
  92. package/dist/src/orchestration/remediation/pinRemediation.d.ts +121 -0
  93. package/dist/src/orchestration/remediation/pinRemediation.js +1 -0
  94. package/dist/src/orchestration/remediation/postFailureRepairOffer.d.ts +77 -0
  95. package/dist/src/orchestration/remediation/postFailureRepairOffer.js +14 -0
  96. package/dist/src/orchestration/remediation/recreatePreFlight.d.ts +47 -0
  97. package/dist/src/orchestration/remediation/recreatePreFlight.js +1 -0
  98. package/dist/src/orchestration/remediation/recreateResource.d.ts +110 -0
  99. package/dist/src/orchestration/remediation/recreateResource.js +1 -0
  100. package/dist/src/orchestration/remediation/remediationJournal.d.ts +88 -0
  101. package/dist/src/orchestration/remediation/remediationJournal.js +2 -0
  102. package/dist/src/orchestration/remediation/removalUpdate.d.ts +135 -0
  103. package/dist/src/orchestration/remediation/removalUpdate.js +1 -0
  104. package/dist/src/orchestration/remediation/retainFlip.d.ts +294 -0
  105. package/dist/src/orchestration/remediation/retainFlip.js +1 -0
  106. package/dist/src/services/application/ApplicationStackService.d.ts +5 -3
  107. package/dist/src/services/application/ApplicationStackService.js +1 -1
  108. package/dist/src/services/application/applicationStackHelpers.d.ts +8 -6
  109. package/dist/src/services/application/applicationStackHelpers.js +3 -3
  110. package/dist/src/services/index.d.ts +2 -2
  111. package/dist/src/services/index.js +1 -1
  112. package/dist/src/services/infrastructure/CdkArgumentBuilder.js +1 -1
  113. package/dist/src/services/infrastructure/CdkEventMonitoring.d.ts +15 -0
  114. package/dist/src/services/infrastructure/CdkEventMonitoring.js +1 -1
  115. package/dist/src/services/infrastructure/CdkOutputAnalyser.d.ts +8 -0
  116. package/dist/src/services/infrastructure/CdkOutputAnalyser.js +2 -1
  117. package/dist/src/services/infrastructure/CdkService.js +3 -3
  118. package/dist/src/services/infrastructure/CdkServiceTypes.d.ts +7 -0
  119. package/dist/src/services/infrastructure/CfnRegistryService.d.ts +68 -0
  120. package/dist/src/services/infrastructure/CfnRegistryService.js +1 -0
  121. package/dist/src/services/infrastructure/CloudFormationService.d.ts +5 -2
  122. package/dist/src/services/infrastructure/CloudFormationService.js +1 -1
  123. package/dist/src/services/infrastructure/EcsServiceResolver.d.ts +23 -3
  124. package/dist/src/services/infrastructure/EcsServiceResolver.js +1 -1
  125. package/dist/src/services/infrastructure/cdkServiceHelpers.js +1 -1
  126. package/dist/src/services/infrastructure/cfnRegistrySeed.d.ts +10 -0
  127. package/dist/src/services/infrastructure/cfnRegistrySeed.js +1 -0
  128. package/dist/src/services/infrastructure/changeSetProbe.d.ts +88 -0
  129. package/dist/src/services/infrastructure/changeSetProbe.js +1 -0
  130. package/dist/src/services/infrastructure/index.d.ts +2 -0
  131. package/dist/src/services/infrastructure/index.js +1 -1
  132. package/dist/src/services/supporting/CdkContextBuilder.d.ts +1 -0
  133. package/dist/src/services/supporting/CdkContextBuilder.js +1 -1
  134. package/dist/src/types/callbackKeys.d.ts +1 -1
  135. package/dist/src/types/callbackKeys.js +1 -1
  136. package/dist/src/types/callbacks.d.ts +22 -0
  137. package/dist/src/types/config/entitlements.d.ts +9 -0
  138. package/dist/src/types/config/orgConfig.d.ts +6 -0
  139. package/dist/src/types/deployment/DeploymentTypes.d.ts +1 -0
  140. package/dist/src/types/deploymentEventSchema.d.ts +1 -0
  141. package/dist/src/types/deploymentEventSchema.js +1 -1
  142. package/dist/src/types/destruction.d.ts +212 -0
  143. package/dist/src/types/destruction.js +1 -0
  144. package/dist/src/types/drift.d.ts +72 -0
  145. package/dist/src/types/drift.js +1 -0
  146. package/dist/src/types/index.d.ts +8 -2
  147. package/dist/src/types/index.js +1 -1
  148. package/dist/src/types/params.d.ts +161 -0
  149. package/dist/src/types/remediation.d.ts +126 -0
  150. package/dist/src/types/remediation.js +1 -0
  151. package/package.json +5 -4
@@ -0,0 +1,212 @@
1
+ /**
2
+ * The destruction-ticket contract — the single cross-surface shape for the
3
+ * unconditional destruction gate (drift-remediation plan § 4.1). Declared ONCE
4
+ * here; the CLI and webapp re-export, never redeclare (coupled discriminated
5
+ * unions share a source at 2 occurrences).
6
+ *
7
+ * Consent semantics: exact, case-sensitive `{physicalName, verb}` pairs. No
8
+ * blanket flag exists or will exist — `autoApprove`, `skipConfirmation`,
9
+ * `force`, and approval tokens NEVER satisfy the gate.
10
+ */
11
+ import { z } from "zod";
12
+ export declare const RemediationVerbSchema: z.ZodEnum<{
13
+ abort: "abort";
14
+ forget: "forget";
15
+ recreate: "recreate";
16
+ pin: "pin";
17
+ repair: "repair";
18
+ }>;
19
+ export type RemediationVerb = z.infer<typeof RemediationVerbSchema>;
20
+ /**
21
+ * Canonical one-line meaning per verb (plan § 3) — the SSoT gloss every
22
+ * surface renders (coupled values, one home): the interactive ceremony's verb
23
+ * menu and the drift surface's verb list consume THIS record, never local
24
+ * prose. Exhaustive over the schema-derived union, so a verb addition fails
25
+ * typecheck here. Context-neutral wording — the same line must read correctly
26
+ * as a menu consequence and as a `verb (gloss)` parenthetical.
27
+ */
28
+ export declare const REMEDIATION_VERB_GLOSS: Readonly<Record<RemediationVerb, string>>;
29
+ export declare const DESTRUCTION_FINDINGS: readonly ["replacement-required", "pinned-name-replacement", "resource-deleted", "stack-deleted", "data-loss-delete"];
30
+ export declare const DestructionFindingSchema: z.ZodEnum<{
31
+ "replacement-required": "replacement-required";
32
+ "pinned-name-replacement": "pinned-name-replacement";
33
+ "resource-deleted": "resource-deleted";
34
+ "stack-deleted": "stack-deleted";
35
+ "data-loss-delete": "data-loss-delete";
36
+ }>;
37
+ export type DestructionFinding = z.infer<typeof DestructionFindingSchema>;
38
+ /**
39
+ * Ticket verdict provenance = the plan's replacement-verdict sources plus
40
+ * `drift-probe` (a resource-deleted row proven by a direct NotFound from the
41
+ * owning service — Phase 6 drift-repair tickets). Deliberately a superset:
42
+ * plan rows never claim `drift-probe`, and the plan union must not widen.
43
+ */
44
+ export declare const TICKET_VERDICT_SOURCES: readonly ["registry", "registry (change-set unverified)", "change-set", "cdk-spec (unverified)", "drift-probe"];
45
+ export declare const TicketVerdictSourceSchema: z.ZodEnum<{
46
+ registry: "registry";
47
+ "registry (change-set unverified)": "registry (change-set unverified)";
48
+ "change-set": "change-set";
49
+ "cdk-spec (unverified)": "cdk-spec (unverified)";
50
+ "drift-probe": "drift-probe";
51
+ }>;
52
+ export type TicketVerdictSource = z.infer<typeof TicketVerdictSourceSchema>;
53
+ export declare const DestructionTicketResourceSchema: z.ZodObject<{
54
+ stack: z.ZodString;
55
+ logicalId: z.ZodString;
56
+ resourceType: z.ZodString;
57
+ physicalName: z.ZodString;
58
+ finding: z.ZodEnum<{
59
+ "replacement-required": "replacement-required";
60
+ "pinned-name-replacement": "pinned-name-replacement";
61
+ "resource-deleted": "resource-deleted";
62
+ "stack-deleted": "stack-deleted";
63
+ "data-loss-delete": "data-loss-delete";
64
+ }>;
65
+ cause: z.ZodString;
66
+ offendingProperties: z.ZodArray<z.ZodString>;
67
+ verdictSource: z.ZodEnum<{
68
+ registry: "registry";
69
+ "registry (change-set unverified)": "registry (change-set unverified)";
70
+ "change-set": "change-set";
71
+ "cdk-spec (unverified)": "cdk-spec (unverified)";
72
+ "drift-probe": "drift-probe";
73
+ }>;
74
+ dataLossRisk: z.ZodBoolean;
75
+ verbs: z.ZodArray<z.ZodEnum<{
76
+ abort: "abort";
77
+ forget: "forget";
78
+ recreate: "recreate";
79
+ pin: "pin";
80
+ repair: "repair";
81
+ }>>;
82
+ }, z.core.$strict>;
83
+ export type DestructionTicketResource = z.infer<typeof DestructionTicketResourceSchema>;
84
+ export declare const DestructionTicketSchema: z.ZodObject<{
85
+ ticketDigest: z.ZodString;
86
+ resources: z.ZodArray<z.ZodObject<{
87
+ stack: z.ZodString;
88
+ logicalId: z.ZodString;
89
+ resourceType: z.ZodString;
90
+ physicalName: z.ZodString;
91
+ finding: z.ZodEnum<{
92
+ "replacement-required": "replacement-required";
93
+ "pinned-name-replacement": "pinned-name-replacement";
94
+ "resource-deleted": "resource-deleted";
95
+ "stack-deleted": "stack-deleted";
96
+ "data-loss-delete": "data-loss-delete";
97
+ }>;
98
+ cause: z.ZodString;
99
+ offendingProperties: z.ZodArray<z.ZodString>;
100
+ verdictSource: z.ZodEnum<{
101
+ registry: "registry";
102
+ "registry (change-set unverified)": "registry (change-set unverified)";
103
+ "change-set": "change-set";
104
+ "cdk-spec (unverified)": "cdk-spec (unverified)";
105
+ "drift-probe": "drift-probe";
106
+ }>;
107
+ dataLossRisk: z.ZodBoolean;
108
+ verbs: z.ZodArray<z.ZodEnum<{
109
+ abort: "abort";
110
+ forget: "forget";
111
+ recreate: "recreate";
112
+ pin: "pin";
113
+ repair: "repair";
114
+ }>>;
115
+ }, z.core.$strict>>;
116
+ }, z.core.$strict>;
117
+ export type DestructionTicket = z.infer<typeof DestructionTicketSchema>;
118
+ /** One named consent: the exact physical name plus the chosen verb. */
119
+ export declare const DestructionConsentSchema: z.ZodObject<{
120
+ physicalName: z.ZodString;
121
+ verb: z.ZodEnum<{
122
+ abort: "abort";
123
+ forget: "forget";
124
+ recreate: "recreate";
125
+ pin: "pin";
126
+ repair: "repair";
127
+ }>;
128
+ }, z.core.$strict>;
129
+ export type DestructionConsent = z.infer<typeof DestructionConsentSchema>;
130
+ /**
131
+ * Per-consent verdicts for the fail-closed report ([G6]): a consent either
132
+ * matched a pending resource with a legal verb, named a resource the ticket
133
+ * does not contain (surplus / misspelt — fail closed, never ignored), or
134
+ * named a real resource with an illegal verb.
135
+ */
136
+ export declare const CONSENT_VERDICTS: readonly ["matched", "unmatched", "wrong-verb"];
137
+ export type ConsentVerdict = (typeof CONSENT_VERDICTS)[number];
138
+ export interface ConsentVerdictRow {
139
+ physicalName: string;
140
+ verb: RemediationVerb;
141
+ verdict: ConsentVerdict;
142
+ /** Human detail for non-matched rows (e.g. the legal verbs). */
143
+ detail?: string;
144
+ }
145
+ /** The full consent evaluation — rendered as the per-name verdict table. */
146
+ export interface DestructionConsentReport {
147
+ /** One row per supplied consent, in supply order. */
148
+ rows: ConsentVerdictRow[];
149
+ /** Ticket physical names no consent covered. */
150
+ uncovered: string[];
151
+ /**
152
+ * Consents were minted against a different ticket digest (the plan changed
153
+ * between mint and apply) — every consent is treated as stale (TOCTOU).
154
+ */
155
+ digestMismatch: boolean;
156
+ /** On mismatch: the digest the consents were minted against. */
157
+ suppliedDigest?: string;
158
+ /** On mismatch: what the pending destructive changes digest to now. */
159
+ currentDigest?: string;
160
+ /** True only when every resource is covered by a matched consent. */
161
+ satisfied: boolean;
162
+ }
163
+ /**
164
+ * WHY the gate withheld — the structured outcome every surface branches on so
165
+ * a user who completed the ceremony is never told to consent again:
166
+ * - `awaiting-consent` — no consents were supplied at all
167
+ * - `declined` — the interactive ceremony was declined, or an
168
+ * abort verb was consented (operator withhold)
169
+ * - `consents-invalid` — consents were supplied but failed evaluation
170
+ * (mismatch, wrong verb, uncovered, stale digest)
171
+ * - `consent-not-executable` — consents fully satisfied the ticket, but a
172
+ * consented verb has no execution arm in this
173
+ * release (truthful withhold, reasons name it)
174
+ */
175
+ export declare const DestructionOutcomeSchema: z.ZodEnum<{
176
+ "awaiting-consent": "awaiting-consent";
177
+ declined: "declined";
178
+ "consents-invalid": "consents-invalid";
179
+ "consent-not-executable": "consent-not-executable";
180
+ }>;
181
+ export type DestructionOutcome = z.infer<typeof DestructionOutcomeSchema>;
182
+ /** What the interactive ceremony is asked to resolve. */
183
+ export interface DestructionConsentRequest {
184
+ target: string;
185
+ ticket: DestructionTicket;
186
+ }
187
+ /**
188
+ * The ceremony's answer: resolved consent pairs bound to the digest of the
189
+ * ticket the user actually saw, or an abort (decline). The pairs are
190
+ * re-evaluated engine-side against the live ticket — the resolution can never
191
+ * widen consent beyond what the `--remediate` flags could express.
192
+ */
193
+ export type DestructionConsentResolution = {
194
+ kind: "consents";
195
+ consents: readonly DestructionConsent[];
196
+ /** Digest of the ticket the ceremony displayed (TOCTOU binding). */
197
+ ticketDigest: string;
198
+ } | {
199
+ kind: "abort";
200
+ };
201
+ /**
202
+ * Interactive destruction-consent resolver — the injected-resolver mirror of
203
+ * the approval gate's `ApprovalGate` (types/approval.ts), for the
204
+ * UNCONDITIONAL destruction gate. Consent EVALUATION stays engine-side: the
205
+ * resolved pairs feed the same `evaluateDestructionConsents` + ticket-digest
206
+ * TOCTOU path the `--remediate` flags use, so a typed name that does not
207
+ * exactly match is rejected by the engine regardless of what the surface
208
+ * validated. Omitting the resolver leaves the gate fail-closed (withheld).
209
+ */
210
+ export interface DestructionConsentGate {
211
+ resolve(request: DestructionConsentRequest): Promise<DestructionConsentResolution>;
212
+ }
@@ -0,0 +1 @@
1
+ import{z as e}from"zod";import{REPLACEMENT_VERDICT_SOURCES as r}from"../orchestration/application/plan/types.js";const t=e.enum(["abort","pin","recreate","forget","repair"]),u={abort:"stop here \u2014 nothing is changed",pin:"accept the live value into your fjall config so the change disappears; non-destructive",recreate:"accept a new physical resource under this name \u2014 data survives only via snapshot or backup (none if the resource is already deleted and no backup exists)",forget:"stop managing the resource \u2014 the physical resource is never touched",repair:"report-only: forensics plus a manual runbook, nothing is mutated"},n=["replacement-required","pinned-name-replacement","resource-deleted","stack-deleted","data-loss-delete"],o=e.enum(n),c=[...r,"drift-probe"],s=e.enum(c),a=e.object({stack:e.string(),logicalId:e.string(),resourceType:e.string(),physicalName:e.string(),finding:o,cause:e.string(),offendingProperties:e.array(e.string()),verdictSource:s,dataLossRisk:e.boolean(),verbs:e.array(t)}).strict(),d=e.object({ticketDigest:e.string(),resources:e.array(a)}).strict(),m=e.object({physicalName:e.string().min(1,"Consent physical name cannot be empty"),verb:t}).strict(),h=["matched","unmatched","wrong-verb"],l=e.enum(["awaiting-consent","declined","consents-invalid","consent-not-executable"]);export{h as CONSENT_VERDICTS,n as DESTRUCTION_FINDINGS,m as DestructionConsentSchema,o as DestructionFindingSchema,l as DestructionOutcomeSchema,a as DestructionTicketResourceSchema,d as DestructionTicketSchema,u as REMEDIATION_VERB_GLOSS,t as RemediationVerbSchema,c as TICKET_VERDICT_SOURCES,s as TicketVerdictSourceSchema};
@@ -0,0 +1,72 @@
1
+ /**
2
+ * The Class 1 drift contract — out-of-band-deletion suspects, probe verdicts
3
+ * and the persisted suspect journal (drift-remediation plan § Phase 5).
4
+ * Declared ONCE here; the CLI re-exports, never redeclares (coupled
5
+ * discriminated unions share a source at 2 occurrences).
6
+ *
7
+ * Verdict semantics are fail-closed: only an authoritative NotFound from the
8
+ * service that owns the resource yields `confirmed-deleted`. Every other
9
+ * probe outcome (throttle, AccessDenied, network failure) stays `unconfirmed`
10
+ * and presentation is repair-only — no destructive verbs.
11
+ */
12
+ import { z } from "zod";
13
+ import { type RemediationVerb } from "./destruction.js";
14
+ export declare const DRIFT_VERDICTS: readonly ["confirmed-deleted", "present", "unconfirmed", "stack-missing"];
15
+ export declare const DriftVerdictSchema: z.ZodEnum<{
16
+ "confirmed-deleted": "confirmed-deleted";
17
+ present: "present";
18
+ unconfirmed: "unconfirmed";
19
+ "stack-missing": "stack-missing";
20
+ }>;
21
+ export type DriftVerdict = z.infer<typeof DriftVerdictSchema>;
22
+ export declare const DriftSuspectSchema: z.ZodObject<{
23
+ stackName: z.ZodString;
24
+ logicalId: z.ZodString;
25
+ resourceType: z.ZodString;
26
+ physicalId: z.ZodOptional<z.ZodString>;
27
+ failedStatus: z.ZodString;
28
+ statusReason: z.ZodString;
29
+ }, z.core.$strict>;
30
+ export type DriftSuspect = z.infer<typeof DriftSuspectSchema>;
31
+ export declare const DriftFindingSchema: z.ZodObject<{
32
+ verdict: z.ZodEnum<{
33
+ "confirmed-deleted": "confirmed-deleted";
34
+ present: "present";
35
+ unconfirmed: "unconfirmed";
36
+ "stack-missing": "stack-missing";
37
+ }>;
38
+ verdictDetail: z.ZodString;
39
+ probeMethod: z.ZodString;
40
+ verbs: z.ZodArray<z.ZodEnum<{
41
+ abort: "abort";
42
+ forget: "forget";
43
+ recreate: "recreate";
44
+ pin: "pin";
45
+ repair: "repair";
46
+ }>>;
47
+ stackName: z.ZodString;
48
+ logicalId: z.ZodString;
49
+ resourceType: z.ZodString;
50
+ physicalId: z.ZodOptional<z.ZodString>;
51
+ failedStatus: z.ZodString;
52
+ statusReason: z.ZodString;
53
+ }, z.core.$strict>;
54
+ export type DriftFinding = z.infer<typeof DriftFindingSchema>;
55
+ /** Legal verbs per verdict — single source for CLI presentation. */
56
+ export declare function verbsForDriftVerdict(verdict: DriftVerdict): RemediationVerb[];
57
+ export declare const DriftJournalRecordSchema: z.ZodObject<{
58
+ version: z.ZodLiteral<1>;
59
+ accountId: z.ZodString;
60
+ region: z.ZodString;
61
+ stackName: z.ZodString;
62
+ recordedAt: z.ZodString;
63
+ suspects: z.ZodArray<z.ZodObject<{
64
+ stackName: z.ZodString;
65
+ logicalId: z.ZodString;
66
+ resourceType: z.ZodString;
67
+ physicalId: z.ZodOptional<z.ZodString>;
68
+ failedStatus: z.ZodString;
69
+ statusReason: z.ZodString;
70
+ }, z.core.$strict>>;
71
+ }, z.core.$strict>;
72
+ export type DriftJournalRecord = z.infer<typeof DriftJournalRecordSchema>;
@@ -0,0 +1 @@
1
+ import{z as t}from"zod";import{RemediationVerbSchema as i}from"./destruction.js";const n=["confirmed-deleted","present","unconfirmed","stack-missing"],s=t.enum(n),e=t.object({stackName:t.string().min(1),logicalId:t.string().min(1),resourceType:t.string().min(1),physicalId:t.string().min(1).optional(),failedStatus:t.string().min(1),statusReason:t.string()}).strict(),a=t.object({...e.shape,verdict:s,verdictDetail:t.string(),probeMethod:t.string(),verbs:t.array(i)}).strict();function m(r){switch(r){case"confirmed-deleted":return["forget","recreate"];case"present":return[];case"unconfirmed":case"stack-missing":return["repair"]}}const d=t.object({version:t.literal(1),accountId:t.string().min(1),region:t.string().min(1),stackName:t.string().min(1),recordedAt:t.string().min(1),suspects:t.array(e)}).strict();export{n as DRIFT_VERDICTS,a as DriftFindingSchema,d as DriftJournalRecordSchema,e as DriftSuspectSchema,s as DriftVerdictSchema,m as verbsForDriftVerdict};
@@ -1,7 +1,7 @@
1
1
  export { DeploymentEventSchema, DEPLOYMENT_EVENT_TYPES, DEPLOYMENT_EVENT_RESOURCE_CATEGORIES, DEPLOYMENT_EVENT_STATUS_REASON_MAX, DEPLOYMENT_EVENT_ERROR_MESSAGE_MAX, DEPLOYMENT_EVENT_TRAIL_DETAIL_MAX, CASCADE_PHASES, CASCADE_ACCOUNT_STATUSES, toCascadePhase } from "./deploymentEventSchema.js";
2
2
  export type { DeploymentEvent, DeploymentEventType, DeploymentEventResourceCategory, DeploymentEventCascadePhase, DeploymentEventCascadeAccountStatus } from "./deploymentEventSchema.js";
3
3
  export type { AwsCredentials, DeployIdentity, ScopedBuildSecretSessionMinter } from "./credentials.js";
4
- export type { DeployCallbacks, StepCompleteStatus, StackCleanupPhase, CascadeAccountPhase, LogLevel, StackCleanupQuarantineDetail, StackCleanupRetainedBucketsDetail } from "./callbacks.js";
4
+ export type { DeployCallbacks, StepCompleteStatus, StackCleanupPhase, CascadeAccountPhase, LogLevel, StackCleanupQuarantineDetail, StackCleanupRetainedBucketsDetail, StackTarget } from "./callbacks.js";
5
5
  export { isQuarantineDetail, isRetainedBucketsDetail } from "./callbacks.js";
6
6
  export { DeployEventSchema, StepProgressSchema, DeployResourceSchema, PlanChangeSchema, PlanPropertyChangeSchema, ChangeCountsSchema, DEPLOY_EVENT_CONTRACT, DEPLOY_EVENT_CONTRACT_MAJOR, DEPLOY_EVENT_CONTRACT_MINOR, SUPPORTED_CONTRACT_MARKERS, DEPLOY_EVENT_ID_MAX, DEPLOY_EVENT_NAME_MAX, DEPLOY_EVENT_MESSAGE_MAX, DEPLOY_EVENT_STATUS_REASON_MAX, DEPLOY_EVENT_ERROR_MESSAGE_MAX, DEPLOY_EVENT_TRAIL_DETAIL_MAX, DEPLOY_EVENT_OUTPUT_MAX, DEPLOY_EVENT_ARN_MAX, DEPLOY_EVENT_URL_MAX, STEP_COMPLETE_STATUSES, LOG_LEVELS, STACK_CLEANUP_PHASES, CASCADE_ACCOUNT_PHASES, DEPLOY_RESULTS, DETECTION_PHASES, PHASE_STATUSES, BUILDERS, CASCADE_OUTCOME_RESULTS, PLAN_ACTIONS, REPLACEMENT_MODES, APPROVAL_KINDS, APPROVAL_DECISIONS, ALL_PROGRESS_KINDS } from "./deployEvent.js";
7
7
  export type { DeployEvent, ProgressKind, StepProgress, DeployResource, PlanChange, PlanPropertyChange, ChangeCounts, PlanAction, ReplacementMode, ApprovalKind, ApprovalDecision, DeployRunResult } from "./deployEvent.js";
@@ -10,8 +10,14 @@ export { parseDeployEvent, parseDeployContractVersion, type ParsedDeployEvent }
10
10
  export type { ProgressEvent, ProgressEventType, ResourceEvent, AwsAuthResult, CascadeDeploymentResult, CascadePhase, BuildPushStartEvent, BuildPushProgressEvent, BuildPushCompleteEvent, TaskDefRegisteredEvent, ECSCompleteEvent, MigrationsStartEvent, MigrationsCompleteEvent, TrailMigrationPhase, TrailMigrationStatus, TrailMigrationPhaseEvent } from "./events.js";
11
11
  export { TRAIL_MIGRATION_PHASES, TRAIL_MIGRATION_STATUSES } from "./events.js";
12
12
  export type { ApiClientInterface, EntitlementsData } from "./apiClient.js";
13
- export type { DeployParams, DeployOptions, DeploymentType, DeployResult, DestroyParams, DestroyOptions, DestroyResult } from "./params.js";
13
+ export type { DeployParams, DeployOptions, DatabaseEndpointRestartRequest, InfrastructureSource, DeploymentType, DeployResult, DestroyParams, DestroyOptions, DestroyResult, StackLeaseVerdict } from "./params.js";
14
14
  export type { ApprovalGate, ApprovalGatePlanDetail, ApprovalRequest, GateResolution } from "./approval.js";
15
+ export { RemediationVerbSchema, REMEDIATION_VERB_GLOSS, DestructionFindingSchema, DestructionTicketResourceSchema, DestructionTicketSchema, DestructionConsentSchema, DestructionOutcomeSchema, DESTRUCTION_FINDINGS, CONSENT_VERDICTS, TICKET_VERDICT_SOURCES, TicketVerdictSourceSchema } from "./destruction.js";
16
+ export type { RemediationVerb, DestructionFinding, DestructionTicketResource, DestructionTicket, DestructionConsent, ConsentVerdict, ConsentVerdictRow, DestructionConsentReport, DestructionConsentRequest, DestructionConsentResolution, DestructionConsentGate, DestructionOutcome, TicketVerdictSource } from "./destruction.js";
17
+ export { DRIFT_VERDICTS, DriftVerdictSchema, DriftSuspectSchema, DriftFindingSchema, DriftJournalRecordSchema, verbsForDriftVerdict } from "./drift.js";
18
+ export type { DriftVerdict, DriftSuspect, DriftFinding, DriftJournalRecord } from "./drift.js";
19
+ export { REMEDIATION_PHASES, RemediationPhaseSchema, RemediationTargetSchema, RemediationFlipProofSchema, RemediationJournalRecordSchema, RemediationVerbWithSurgerySchema, remediationPhaseRank, remediationPlaceholderPhysicalId, isRemediationPlaceholderPhysicalId } from "./remediation.js";
20
+ export type { RemediationPhase, RemediationTarget, RemediationFlipProof, RemediationJournalRecord, RemediationVerbWithSurgery } from "./remediation.js";
15
21
  export type { OrgConfig, ProviderAccount, RootAccessManagementMode, SSOSession } from "./config/orgConfig.js";
16
22
  export type { Entitlements } from "./config/entitlements.js";
17
23
  export type { StackOutput, StackOutputsRecord, DeploymentContext, StepOutput, ApplicationDeploymentContext, CallerIdentity } from "./deployment/index.js";
@@ -1 +1 @@
1
- import{DeploymentEventSchema as e,DEPLOYMENT_EVENT_TYPES as A,DEPLOYMENT_EVENT_RESOURCE_CATEGORIES as S,DEPLOYMENT_EVENT_STATUS_REASON_MAX as T,DEPLOYMENT_EVENT_ERROR_MESSAGE_MAX as t,DEPLOYMENT_EVENT_TRAIL_DETAIL_MAX as O,CASCADE_PHASES as P,CASCADE_ACCOUNT_STATUSES as r,toCascadePhase as N}from"./deploymentEventSchema.js";import{isQuarantineDetail as a,isRetainedBucketsDetail as R}from"./callbacks.js";import{DeployEventSchema as p,StepProgressSchema as D,DeployResourceSchema as C,PlanChangeSchema as i,PlanPropertyChangeSchema as l,ChangeCountsSchema as I,DEPLOY_EVENT_CONTRACT as M,DEPLOY_EVENT_CONTRACT_MAJOR as n,DEPLOY_EVENT_CONTRACT_MINOR as m,SUPPORTED_CONTRACT_MARKERS as s,DEPLOY_EVENT_ID_MAX as c,DEPLOY_EVENT_NAME_MAX as Y,DEPLOY_EVENT_MESSAGE_MAX as U,DEPLOY_EVENT_STATUS_REASON_MAX as V,DEPLOY_EVENT_ERROR_MESSAGE_MAX as f,DEPLOY_EVENT_TRAIL_DETAIL_MAX as x,DEPLOY_EVENT_OUTPUT_MAX as g,DEPLOY_EVENT_ARN_MAX as X,DEPLOY_EVENT_URL_MAX as h,STEP_COMPLETE_STATUSES as G,LOG_LEVELS as y,STACK_CLEANUP_PHASES as F,CASCADE_ACCOUNT_PHASES as d,DEPLOY_RESULTS as u,DETECTION_PHASES as K,PHASE_STATUSES as H,BUILDERS as k,CASCADE_OUTCOME_RESULTS as v,PLAN_ACTIONS as w,REPLACEMENT_MODES as B,APPROVAL_KINDS as b,APPROVAL_DECISIONS as j,ALL_PROGRESS_KINDS as J}from"./deployEvent.js";import{createDeployEmitter as q}from"./deployEmitter.js";import{parseDeployEvent as W,parseDeployContractVersion as Z}from"./deployEventParse.js";import{TRAIL_MIGRATION_PHASES as EE,TRAIL_MIGRATION_STATUSES as _E}from"./events.js";import{stubCallerIdentity as AE}from"./deployment/index.js";import{ProgressReporter as TE}from"./ProgressEvent.js";import{APPLICATION_STACKS as OE,ORGANISATION_TYPES as PE,APPLICATION_DEPLOY_ORDER as rE,APPLICATION_DESTROY_ORDER as NE,OPENNEXT_DEPLOY_ORDER as oE,OPENNEXT_DESTROY_ORDER as aE,PARALLEL_DEPLOY_GROUPS as RE,PARALLEL_DESTROY_GROUPS as LE,OPENNEXT_PARALLEL_GROUPS as pE,isApplicationOperation as DE,isOrganisationOperation as CE,getParallelDeployGroups as iE,getParallelDestroyGroups as lE,getApplicationDeployOrder as IE,getApplicationDestroyOrder as ME,getApplicationStackName as nE,getOrganisationStackName as mE,isApplicationStack as sE,getApplicationStepName as cE,getApplicationStepId as YE,toPascalCase as UE}from"./operations.js";import{PARALLEL_OPERATION_TYPES as fE}from"./deployment/index.js";import{isOpenNextPattern as gE,OPENNEXT_PATTERNS as XE}from"./detection/patternTypes.js";import{deriveResourcesFromManifestStacks as GE}from"./detection/patternDetection.js";import{STACK_NOT_FOUND_PATTERN as FE,STACK_FAILED_STATE_PATTERN as dE,CDK_NO_STACKS_MATCH as uE,INFRASTRUCTURE_FILENAME as KE}from"./constants.js";import{ApplicationError as kE,wrapApplicationError as vE}from"./application/index.js";import{FjallStateFileSchema as BE,readStateFile as bE,writeStateFile as jE,createEmptyState as JE,deleteStateFile as QE,updateTemplateHash as qE,getStateFilePath as zE,regionSuffix as WE}from"./config/FjallState.js";import{STEP_IDS as $E,STEP_NAMES as E_,INFRASTRUCTURE_STEP_NAMES as __,INFRA_STEP_NAME as e_}from"./stepDefinitions.js";export{J as ALL_PROGRESS_KINDS,rE as APPLICATION_DEPLOY_ORDER,NE as APPLICATION_DESTROY_ORDER,OE as APPLICATION_STACKS,j as APPROVAL_DECISIONS,b as APPROVAL_KINDS,kE as ApplicationError,k as BUILDERS,d as CASCADE_ACCOUNT_PHASES,r as CASCADE_ACCOUNT_STATUSES,v as CASCADE_OUTCOME_RESULTS,P as CASCADE_PHASES,uE as CDK_NO_STACKS_MATCH,I as ChangeCountsSchema,t as DEPLOYMENT_EVENT_ERROR_MESSAGE_MAX,S as DEPLOYMENT_EVENT_RESOURCE_CATEGORIES,T as DEPLOYMENT_EVENT_STATUS_REASON_MAX,O as DEPLOYMENT_EVENT_TRAIL_DETAIL_MAX,A as DEPLOYMENT_EVENT_TYPES,X as DEPLOY_EVENT_ARN_MAX,M as DEPLOY_EVENT_CONTRACT,n as DEPLOY_EVENT_CONTRACT_MAJOR,m as DEPLOY_EVENT_CONTRACT_MINOR,f as DEPLOY_EVENT_ERROR_MESSAGE_MAX,c as DEPLOY_EVENT_ID_MAX,U as DEPLOY_EVENT_MESSAGE_MAX,Y as DEPLOY_EVENT_NAME_MAX,g as DEPLOY_EVENT_OUTPUT_MAX,V as DEPLOY_EVENT_STATUS_REASON_MAX,x as DEPLOY_EVENT_TRAIL_DETAIL_MAX,h as DEPLOY_EVENT_URL_MAX,u as DEPLOY_RESULTS,K as DETECTION_PHASES,p as DeployEventSchema,C as DeployResourceSchema,e as DeploymentEventSchema,BE as FjallStateFileSchema,KE as INFRASTRUCTURE_FILENAME,__ as INFRASTRUCTURE_STEP_NAMES,e_ as INFRA_STEP_NAME,y as LOG_LEVELS,oE as OPENNEXT_DEPLOY_ORDER,aE as OPENNEXT_DESTROY_ORDER,pE as OPENNEXT_PARALLEL_GROUPS,XE as OPENNEXT_PATTERNS,PE as ORGANISATION_TYPES,RE as PARALLEL_DEPLOY_GROUPS,LE as PARALLEL_DESTROY_GROUPS,fE as PARALLEL_OPERATION_TYPES,H as PHASE_STATUSES,w as PLAN_ACTIONS,i as PlanChangeSchema,l as PlanPropertyChangeSchema,TE as ProgressReporter,B as REPLACEMENT_MODES,F as STACK_CLEANUP_PHASES,dE as STACK_FAILED_STATE_PATTERN,FE as STACK_NOT_FOUND_PATTERN,G as STEP_COMPLETE_STATUSES,$E as STEP_IDS,E_ as STEP_NAMES,s as SUPPORTED_CONTRACT_MARKERS,D as StepProgressSchema,EE as TRAIL_MIGRATION_PHASES,_E as TRAIL_MIGRATION_STATUSES,q as createDeployEmitter,JE as createEmptyState,QE as deleteStateFile,GE as deriveResourcesFromManifestStacks,IE as getApplicationDeployOrder,ME as getApplicationDestroyOrder,nE as getApplicationStackName,YE as getApplicationStepId,cE as getApplicationStepName,mE as getOrganisationStackName,iE as getParallelDeployGroups,lE as getParallelDestroyGroups,zE as getStateFilePath,DE as isApplicationOperation,sE as isApplicationStack,gE as isOpenNextPattern,CE as isOrganisationOperation,a as isQuarantineDetail,R as isRetainedBucketsDetail,Z as parseDeployContractVersion,W as parseDeployEvent,bE as readStateFile,WE as regionSuffix,AE as stubCallerIdentity,N as toCascadePhase,UE as toPascalCase,qE as updateTemplateHash,vE as wrapApplicationError,jE as writeStateFile};
1
+ import{DeploymentEventSchema as S,DEPLOYMENT_EVENT_TYPES as t,DEPLOYMENT_EVENT_RESOURCE_CATEGORIES as _,DEPLOYMENT_EVENT_STATUS_REASON_MAX as T,DEPLOYMENT_EVENT_ERROR_MESSAGE_MAX as r,DEPLOYMENT_EVENT_TRAIL_DETAIL_MAX as A,CASCADE_PHASES as a,CASCADE_ACCOUNT_STATUSES as o,toCascadePhase as i}from"./deploymentEventSchema.js";import{isQuarantineDetail as O,isRetainedBucketsDetail as P}from"./callbacks.js";import{DeployEventSchema as D,StepProgressSchema as c,DeployResourceSchema as p,PlanChangeSchema as m,PlanPropertyChangeSchema as L,ChangeCountsSchema as n,DEPLOY_EVENT_CONTRACT as C,DEPLOY_EVENT_CONTRACT_MAJOR as I,DEPLOY_EVENT_CONTRACT_MINOR as l,SUPPORTED_CONTRACT_MARKERS as s,DEPLOY_EVENT_ID_MAX as M,DEPLOY_EVENT_NAME_MAX as h,DEPLOY_EVENT_MESSAGE_MAX as d,DEPLOY_EVENT_STATUS_REASON_MAX as V,DEPLOY_EVENT_ERROR_MESSAGE_MAX as f,DEPLOY_EVENT_TRAIL_DETAIL_MAX as U,DEPLOY_EVENT_OUTPUT_MAX as Y,DEPLOY_EVENT_ARN_MAX as u,DEPLOY_EVENT_URL_MAX as g,STEP_COMPLETE_STATUSES as x,LOG_LEVELS as F,STACK_CLEANUP_PHASES as y,CASCADE_ACCOUNT_PHASES as G,DEPLOY_RESULTS as X,DETECTION_PHASES as K,PHASE_STATUSES as k,BUILDERS as H,CASCADE_OUTCOME_RESULTS as v,PLAN_ACTIONS as b,REPLACEMENT_MODES as B,APPROVAL_KINDS as J,APPROVAL_DECISIONS as w,ALL_PROGRESS_KINDS as j}from"./deployEvent.js";import{createDeployEmitter as W}from"./deployEmitter.js";import{parseDeployEvent as z,parseDeployContractVersion as Z}from"./deployEventParse.js";import{TRAIL_MIGRATION_PHASES as ee,TRAIL_MIGRATION_STATUSES as Ee}from"./events.js";import{RemediationVerbSchema as te,REMEDIATION_VERB_GLOSS as _e,DestructionFindingSchema as Te,DestructionTicketResourceSchema as re,DestructionTicketSchema as Ae,DestructionConsentSchema as ae,DestructionOutcomeSchema as oe,DESTRUCTION_FINDINGS as ie,CONSENT_VERDICTS as Re,TICKET_VERDICT_SOURCES as Oe,TicketVerdictSourceSchema as Pe}from"./destruction.js";import{DRIFT_VERDICTS as De,DriftVerdictSchema as ce,DriftSuspectSchema as pe,DriftFindingSchema as me,DriftJournalRecordSchema as Le,verbsForDriftVerdict as ne}from"./drift.js";import{REMEDIATION_PHASES as Ie,RemediationPhaseSchema as le,RemediationTargetSchema as se,RemediationFlipProofSchema as Me,RemediationJournalRecordSchema as he,RemediationVerbWithSurgerySchema as de,remediationPhaseRank as Ve,remediationPlaceholderPhysicalId as fe,isRemediationPlaceholderPhysicalId as Ue}from"./remediation.js";import{stubCallerIdentity as ue}from"./deployment/index.js";import{ProgressReporter as xe}from"./ProgressEvent.js";import{APPLICATION_STACKS as ye,ORGANISATION_TYPES as Ge,APPLICATION_DEPLOY_ORDER as Xe,APPLICATION_DESTROY_ORDER as Ke,OPENNEXT_DEPLOY_ORDER as ke,OPENNEXT_DESTROY_ORDER as He,PARALLEL_DEPLOY_GROUPS as ve,PARALLEL_DESTROY_GROUPS as be,OPENNEXT_PARALLEL_GROUPS as Be,isApplicationOperation as Je,isOrganisationOperation as we,getParallelDeployGroups as je,getParallelDestroyGroups as Qe,getApplicationDeployOrder as We,getApplicationDestroyOrder as qe,getApplicationStackName as ze,getOrganisationStackName as Ze,isApplicationStack as $e,getApplicationStepName as eE,getApplicationStepId as EE,toPascalCase as SE}from"./operations.js";import{PARALLEL_OPERATION_TYPES as _E}from"./deployment/index.js";import{isOpenNextPattern as rE,OPENNEXT_PATTERNS as AE}from"./detection/patternTypes.js";import{deriveResourcesFromManifestStacks as oE}from"./detection/patternDetection.js";import{STACK_NOT_FOUND_PATTERN as RE,STACK_FAILED_STATE_PATTERN as OE,CDK_NO_STACKS_MATCH as PE,INFRASTRUCTURE_FILENAME as NE}from"./constants.js";import{ApplicationError as cE,wrapApplicationError as pE}from"./application/index.js";import{FjallStateFileSchema as LE,readStateFile as nE,writeStateFile as CE,createEmptyState as IE,deleteStateFile as lE,updateTemplateHash as sE,getStateFilePath as ME,regionSuffix as hE}from"./config/FjallState.js";import{STEP_IDS as VE,STEP_NAMES as fE,INFRASTRUCTURE_STEP_NAMES as UE,INFRA_STEP_NAME as YE}from"./stepDefinitions.js";export{j as ALL_PROGRESS_KINDS,Xe as APPLICATION_DEPLOY_ORDER,Ke as APPLICATION_DESTROY_ORDER,ye as APPLICATION_STACKS,w as APPROVAL_DECISIONS,J as APPROVAL_KINDS,cE as ApplicationError,H as BUILDERS,G as CASCADE_ACCOUNT_PHASES,o as CASCADE_ACCOUNT_STATUSES,v as CASCADE_OUTCOME_RESULTS,a as CASCADE_PHASES,PE as CDK_NO_STACKS_MATCH,Re as CONSENT_VERDICTS,n as ChangeCountsSchema,r as DEPLOYMENT_EVENT_ERROR_MESSAGE_MAX,_ as DEPLOYMENT_EVENT_RESOURCE_CATEGORIES,T as DEPLOYMENT_EVENT_STATUS_REASON_MAX,A as DEPLOYMENT_EVENT_TRAIL_DETAIL_MAX,t as DEPLOYMENT_EVENT_TYPES,u as DEPLOY_EVENT_ARN_MAX,C as DEPLOY_EVENT_CONTRACT,I as DEPLOY_EVENT_CONTRACT_MAJOR,l as DEPLOY_EVENT_CONTRACT_MINOR,f as DEPLOY_EVENT_ERROR_MESSAGE_MAX,M as DEPLOY_EVENT_ID_MAX,d as DEPLOY_EVENT_MESSAGE_MAX,h as DEPLOY_EVENT_NAME_MAX,Y as DEPLOY_EVENT_OUTPUT_MAX,V as DEPLOY_EVENT_STATUS_REASON_MAX,U as DEPLOY_EVENT_TRAIL_DETAIL_MAX,g as DEPLOY_EVENT_URL_MAX,X as DEPLOY_RESULTS,ie as DESTRUCTION_FINDINGS,K as DETECTION_PHASES,De as DRIFT_VERDICTS,D as DeployEventSchema,p as DeployResourceSchema,S as DeploymentEventSchema,ae as DestructionConsentSchema,Te as DestructionFindingSchema,oe as DestructionOutcomeSchema,re as DestructionTicketResourceSchema,Ae as DestructionTicketSchema,me as DriftFindingSchema,Le as DriftJournalRecordSchema,pe as DriftSuspectSchema,ce as DriftVerdictSchema,LE as FjallStateFileSchema,NE as INFRASTRUCTURE_FILENAME,UE as INFRASTRUCTURE_STEP_NAMES,YE as INFRA_STEP_NAME,F as LOG_LEVELS,ke as OPENNEXT_DEPLOY_ORDER,He as OPENNEXT_DESTROY_ORDER,Be as OPENNEXT_PARALLEL_GROUPS,AE as OPENNEXT_PATTERNS,Ge as ORGANISATION_TYPES,ve as PARALLEL_DEPLOY_GROUPS,be as PARALLEL_DESTROY_GROUPS,_E as PARALLEL_OPERATION_TYPES,k as PHASE_STATUSES,b as PLAN_ACTIONS,m as PlanChangeSchema,L as PlanPropertyChangeSchema,xe as ProgressReporter,Ie as REMEDIATION_PHASES,_e as REMEDIATION_VERB_GLOSS,B as REPLACEMENT_MODES,Me as RemediationFlipProofSchema,he as RemediationJournalRecordSchema,le as RemediationPhaseSchema,se as RemediationTargetSchema,te as RemediationVerbSchema,de as RemediationVerbWithSurgerySchema,y as STACK_CLEANUP_PHASES,OE as STACK_FAILED_STATE_PATTERN,RE as STACK_NOT_FOUND_PATTERN,x as STEP_COMPLETE_STATUSES,VE as STEP_IDS,fE as STEP_NAMES,s as SUPPORTED_CONTRACT_MARKERS,c as StepProgressSchema,Oe as TICKET_VERDICT_SOURCES,ee as TRAIL_MIGRATION_PHASES,Ee as TRAIL_MIGRATION_STATUSES,Pe as TicketVerdictSourceSchema,W as createDeployEmitter,IE as createEmptyState,lE as deleteStateFile,oE as deriveResourcesFromManifestStacks,We as getApplicationDeployOrder,qe as getApplicationDestroyOrder,ze as getApplicationStackName,EE as getApplicationStepId,eE as getApplicationStepName,Ze as getOrganisationStackName,je as getParallelDeployGroups,Qe as getParallelDestroyGroups,ME as getStateFilePath,Je as isApplicationOperation,$e as isApplicationStack,rE as isOpenNextPattern,we as isOrganisationOperation,O as isQuarantineDetail,Ue as isRemediationPlaceholderPhysicalId,P as isRetainedBucketsDetail,Z as parseDeployContractVersion,z as parseDeployEvent,nE as readStateFile,hE as regionSuffix,Ve as remediationPhaseRank,fe as remediationPlaceholderPhysicalId,ue as stubCallerIdentity,i as toCascadePhase,SE as toPascalCase,sE as updateTemplateHash,ne as verbsForDriftVerdict,pE as wrapApplicationError,CE as writeStateFile};
@@ -6,7 +6,9 @@ import type { ApiClientInterface } from "./apiClient.js";
6
6
  import type { OrgConfig } from "./config/orgConfig.js";
7
7
  import type { DockerProvider } from "../orchestration/dockerInterface.js";
8
8
  import type { DomainDeployProvider } from "../orchestration/domainInterface.js";
9
+ import type { PinRemediationReport } from "../orchestration/remediation/pinRemediation.js";
9
10
  import type { ApprovalGate, ApprovalGatePlanDetail } from "./approval.js";
11
+ import type { DestructionConsent, DestructionConsentGate, DestructionOutcome, DestructionTicket } from "./destruction.js";
10
12
  import type { FailureAnalysis } from "@fjall/util/aws";
11
13
  import type { DockerBuildSecretRef } from "@fjall/util/manifest/schemas";
12
14
  export interface DeployParams {
@@ -76,6 +78,73 @@ export interface DeployParams {
76
78
  * the gate even when this is omitted.
77
79
  */
78
80
  approvalGate?: ApprovalGate;
81
+ /**
82
+ * Optional interactive destruction-consent resolver — the ceremony seam for
83
+ * the UNCONDITIONAL destruction gate (mirrors `approvalGate`'s injected-
84
+ * resolver mechanism). Consulted ONLY when the gate ticketed destructive
85
+ * rows and no `options.destructionConsents` were supplied; the returned
86
+ * pairs are re-evaluated engine-side (exact-match + digest TOCTOU), so the
87
+ * resolver can never widen consent beyond what the `--remediate` flags
88
+ * could. Omitted ⇒ the gate withholds fail-closed exactly as before. No
89
+ * flag can disengage the gate; this only changes HOW consent is obtained.
90
+ */
91
+ destructionConsentGate?: DestructionConsentGate;
92
+ /**
93
+ * The user's fjall infrastructure config source, consumed by the pin arm
94
+ * when a destructive change is consented with `pin`: the engine composes an
95
+ * edit-ready codemod against it and returns the result for surface-side
96
+ * write-back — the engine never writes the file. Absent (worker surfaces
97
+ * with no config checkout) the pin arm degrades to report-only outcomes
98
+ * carrying the exact config lines.
99
+ */
100
+ infrastructureSource?: InfrastructureSource;
101
+ /**
102
+ * Asked before the post-deploy database-endpoint reconcile restarts the
103
+ * application's ECS services (fires only when a deploy replaced the
104
+ * database — e.g. a snapshot restore — without also rolling a fresh image).
105
+ * Omitted ⇒ restart without asking: running containers are actively writing
106
+ * to the doomed old database, so automation surfaces (worker,
107
+ * non-interactive CLI) must not block on consent.
108
+ */
109
+ confirmDatabaseEndpointRestart?: (request: DatabaseEndpointRestartRequest) => Promise<boolean>;
110
+ /**
111
+ * Optional stack-boundary lease gate (§5.3). Invoked immediately before each
112
+ * stack's first mutating CloudFormation operation. The engine passes the
113
+ * stack name and the caller's shutdown signal; the resolver returns the lease
114
+ * verdict:
115
+ * - "denied" ⇒ the deployment's lease is gone (swept, superseded, adopted
116
+ * by another runner, or force-released). The engine aborts BEFORE
117
+ * starting that stack with a typed `LeaseDeniedError`; already-completed
118
+ * stacks stand.
119
+ * - "unknown" ⇒ the liveness probe could not reach the server. Fail OPEN
120
+ * and proceed — leases are a liveness signal, not a safety gate, and
121
+ * CloudFormation's own ClientRequestToken is the fencing backstop.
122
+ * - "ok" ⇒ proceed.
123
+ * Omitted ⇒ no gate (fully backward-compatible). The CLI wires this to the
124
+ * DeploymentTracker's on-demand heartbeat; the worker omits it.
125
+ */
126
+ assertLeaseForStack?: (stackName: string, abortSignal?: AbortSignal) => Promise<StackLeaseVerdict>;
127
+ }
128
+ /** Verdict of the stack-boundary lease gate (§5.3 heartbeat protocol). */
129
+ export type StackLeaseVerdict = "ok" | "denied" | "unknown";
130
+ /**
131
+ * The infrastructure config source handed to the pin arm — the surface that
132
+ * owns the config checkout supplies both halves so codemod diagnostics and
133
+ * the eventual write-back target the same file.
134
+ */
135
+ export interface InfrastructureSource {
136
+ content: string;
137
+ filePath: string;
138
+ }
139
+ /**
140
+ * Context handed to `confirmDatabaseEndpointRestart` so an interactive
141
+ * surface can render what changed and what a "yes" will restart.
142
+ */
143
+ export interface DatabaseEndpointRestartRequest {
144
+ appName: string;
145
+ /** Database-stack output keys whose value changed (e.g. `AppDbEndpoint`). */
146
+ changedOutputs: string[];
147
+ serviceCount: number;
79
148
  }
80
149
  export interface DeployOptions {
81
150
  /**
@@ -163,6 +232,22 @@ export interface DeployOptions {
163
232
  * validated through `DockerBuildSecretRefSchema` (CLI) before it reaches here.
164
233
  */
165
234
  flagBuildSecrets?: readonly DockerBuildSecretRef[];
235
+ /**
236
+ * Destruction-gate consents: exact, case-sensitive `{physicalName, verb}`
237
+ * pairs from the repeatable `--remediate <name>=<verb>` / `--allow-replace
238
+ * <name>` flags (or a surface's pre-authorisation). The unconditional gate
239
+ * fail-closes unless EVERY ticketed resource is covered; surplus, misspelt
240
+ * or wrong-verb consents fail closed with a verdict table. `autoApprove`,
241
+ * `skipConfirmation`, `force` and approval tokens never satisfy the gate.
242
+ */
243
+ destructionConsents?: readonly DestructionConsent[];
244
+ /**
245
+ * The `ticketDigest` the consents were minted against (webapp pre-auth /
246
+ * resumed runs). Re-verified against the digest recomputed at apply time;
247
+ * a mismatch fail-closes every consent (TOCTOU discipline). Flag-minted
248
+ * consents omit it — they are supplied at apply time by definition.
249
+ */
250
+ destructionConsentDigest?: string;
166
251
  }
167
252
  export type DeploymentType = "application" | "organisation";
168
253
  export interface DeployResult {
@@ -246,6 +331,73 @@ export interface DeployResult {
246
331
  * resume token never computed one).
247
332
  */
248
333
  planDetail?: ApprovalGatePlanDetail;
334
+ /**
335
+ * Destruction-gate: set when the unconditional gate withheld the deploy —
336
+ * the plan contained destructive rows without full named consent (or a
337
+ * consented verb has no execution arm yet). Nothing was mutated. Surfaces
338
+ * map this to exit code 4 (distinct from rejection/failure).
339
+ */
340
+ destructionPending?: boolean;
341
+ /**
342
+ * Destruction-gate: the ticket enumerating every destructive resource, its
343
+ * finding, cause and legal verbs. Present with `destructionPending`, and on
344
+ * an `awaitingApproval` plan-only result whose plan carries destructive
345
+ * rows (so a plan consumer can mint consents against `ticketDigest`).
346
+ */
347
+ destructionTicket?: DestructionTicket;
348
+ /**
349
+ * Destruction-gate: WHY the deploy was withheld. Present with
350
+ * `destructionPending`. Surfaces branch on this so a user who consented
351
+ * (`consent-not-executable`) or declined (`declined`) is never shown the
352
+ * generic "requires named consent" message or told to redo their consent.
353
+ */
354
+ destructionOutcome?: DestructionOutcome;
355
+ /**
356
+ * Destruction-gate: the halt/decline reason lines (identifier-only,
357
+ * pre-masked by construction) — e.g. "verb 'repair' is accepted vocabulary
358
+ * but not yet executable in this release for resource-deleted". Present
359
+ * with `destructionPending`; may be empty.
360
+ */
361
+ destructionHaltReasons?: string[];
362
+ /**
363
+ * Destruction-gate: a fresh approval token re-minted at withhold time for
364
+ * approval-gated runs, bound to the withheld run's assembly digest with the
365
+ * consent-ceremony TTL (`DESTRUCTION_RESUME_TTL_MS`). The original approval
366
+ * token's 15-minute TTL expires during a ceremony that can take hours; the
367
+ * consented re-queue MUST carry this token instead. Present with
368
+ * `destructionPending` only when the run was approval-gated. NOT a secret —
369
+ * digest-bound capability, same trust model as `approvalToken`.
370
+ */
371
+ destructionResumeToken?: string;
372
+ /**
373
+ * Destruction-gate: ISO expiry of `destructionResumeToken`. Present
374
+ * together with it.
375
+ */
376
+ destructionResumeExpiresAt?: string;
377
+ /**
378
+ * Pin arm: set when consented `pin` verb(s) ran the pre-bootstrap
379
+ * live-value probes and the deploy stopped for config write-back. Nothing
380
+ * was mutated — CloudFormation never ran. Surfaces render `pinReport` and
381
+ * re-run the deploy once the config change lands (the plan then carries no
382
+ * pinned rows). Distinct from `destructionPending` (consent withheld) —
383
+ * pin consent was GIVEN and its arm executed.
384
+ */
385
+ pinPending?: boolean;
386
+ /**
387
+ * Pin arm: per-resource outcomes, plus the composed `modifiedContent` when
388
+ * at least one target reached edit-ready. Present with `pinPending`. The
389
+ * surface that supplied `DeployParams.infrastructureSource` owns writing
390
+ * `modifiedContent` back to the config file.
391
+ */
392
+ pinReport?: PinRemediationReport;
393
+ /**
394
+ * Pin arm: count of consented NON-pin change(s) (e.g. recreate rows) the
395
+ * pin stop deferred — they did not run in this deploy and re-consent
396
+ * against the recomputed plan on the next one. Present with `pinPending`;
397
+ * 0 when the consent set was pure-pin. Surfaces MUST NOT claim "no
398
+ * --remediate needed" on the re-run when this is non-zero.
399
+ */
400
+ pinDeferredConsents?: number;
249
401
  }
250
402
  /**
251
403
  * Parameters for the destroy entry point.
@@ -283,6 +435,15 @@ export interface DestroyParams {
283
435
  * (mirrors DeployParams.abortSignal).
284
436
  */
285
437
  abortSignal?: AbortSignal;
438
+ /**
439
+ * Optional stack-boundary lease gate (§5.3) — the destroy twin of
440
+ * `DeployParams.assertLeaseForStack`, same resolver and verdict semantics:
441
+ * "denied" aborts BEFORE the stack's DeleteStack (already-destroyed stacks
442
+ * stand), "unknown" fails open, absent ⇒ no gate. Consulted immediately
443
+ * before each stack's DeleteStack; a parallel destroy group gates once on
444
+ * entry.
445
+ */
446
+ assertLeaseForStack?: DeployParams["assertLeaseForStack"];
286
447
  }
287
448
  export interface DestroyOptions {
288
449
  /** Skip interactive confirmation prompts */