@patronage/software-factory 1.0.0-alpha.13 → 1.0.0-alpha.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,97 @@
1
1
  import { existsSync, readFileSync, rmSync } from "node:fs";
2
2
  import { Command } from "commander";
3
3
  import { z } from "zod";
4
- import { readFile } from "node:fs/promises";
5
4
 
5
+ //#region src/review-rungs.d.ts
6
+ declare const EVIDENCE_REVIEW_RUNGS: readonly ["independent-model", "oracle", "human"];
7
+ type EvidenceReviewRung = (typeof EVIDENCE_REVIEW_RUNGS)[number];
8
+ declare namespace boundary_manifest_d_exports {
9
+ export { BOUNDARY_CLOSEOUT_DEFAULT_RUNG, BOUNDARY_MANIFEST_SCHEMA_VERSION, BoundaryManifest, BoundaryManifestExtraction, BoundaryManifestParse, FACTORY_BOUNDARY_FENCE_LANG, boundaryManifestSchema, closeoutRungFor, extractBoundaryManifestBlock, manifestContentHash, parseBoundaryManifest, rungMeetsMinimum, specContentHash };
10
+ }
11
+ declare const FACTORY_BOUNDARY_FENCE_LANG = "factory-boundary";
12
+ declare const BOUNDARY_MANIFEST_SCHEMA_VERSION = 1;
13
+ declare const BOUNDARY_CLOSEOUT_DEFAULT_RUNG: EvidenceReviewRung;
14
+ declare const rungMeetsMinimum: (rung: EvidenceReviewRung, minimum: EvidenceReviewRung) => boolean;
15
+ declare const boundaryManifestBaseSchema: z.ZodObject<{
16
+ boundary: z.ZodString;
17
+ closeout: z.ZodOptional<z.ZodObject<{
18
+ review: z.ZodEnum<{
19
+ "independent-model": "independent-model";
20
+ oracle: "oracle";
21
+ human: "human";
22
+ }>;
23
+ }, z.core.$loose>>;
24
+ declaredBy: z.ZodString;
25
+ integrationBranch: z.ZodOptional<z.ZodString>;
26
+ schemaVersion: z.ZodLiteral<1>;
27
+ topology: z.ZodEnum<{
28
+ flagged: "flagged";
29
+ "each-to-main": "each-to-main";
30
+ stacked: "stacked";
31
+ "each-to-epic": "each-to-epic";
32
+ }>;
33
+ waves: z.ZodArray<z.ZodObject<{
34
+ autoMerge: z.ZodOptional<z.ZodBoolean>;
35
+ issues: z.ZodArray<z.ZodNumber>;
36
+ name: z.ZodString;
37
+ review: z.ZodEnum<{
38
+ "independent-model": "independent-model";
39
+ oracle: "oracle";
40
+ human: "human";
41
+ }>;
42
+ }, z.core.$loose>>;
43
+ }, z.core.$loose>;
44
+ declare const boundaryManifestSchema: z.ZodObject<{
45
+ boundary: z.ZodString;
46
+ closeout: z.ZodOptional<z.ZodObject<{
47
+ review: z.ZodEnum<{
48
+ "independent-model": "independent-model";
49
+ oracle: "oracle";
50
+ human: "human";
51
+ }>;
52
+ }, z.core.$loose>>;
53
+ declaredBy: z.ZodString;
54
+ integrationBranch: z.ZodOptional<z.ZodString>;
55
+ schemaVersion: z.ZodLiteral<1>;
56
+ topology: z.ZodEnum<{
57
+ flagged: "flagged";
58
+ "each-to-main": "each-to-main";
59
+ stacked: "stacked";
60
+ "each-to-epic": "each-to-epic";
61
+ }>;
62
+ waves: z.ZodArray<z.ZodObject<{
63
+ autoMerge: z.ZodOptional<z.ZodBoolean>;
64
+ issues: z.ZodArray<z.ZodNumber>;
65
+ name: z.ZodString;
66
+ review: z.ZodEnum<{
67
+ "independent-model": "independent-model";
68
+ oracle: "oracle";
69
+ human: "human";
70
+ }>;
71
+ }, z.core.$loose>>;
72
+ }, z.core.$loose>;
73
+ type BoundaryManifest = z.infer<typeof boundaryManifestBaseSchema>;
74
+ type BoundaryManifestExtraction = {
75
+ ok: true;
76
+ blockText: string;
77
+ } | {
78
+ ok: false;
79
+ error: string;
80
+ };
81
+ declare const extractBoundaryManifestBlock: (issueBody: string) => BoundaryManifestExtraction;
82
+ declare const manifestContentHash: (blockText: string) => string;
83
+ declare const specContentHash: (issueBody: string) => string;
84
+ type BoundaryManifestParse = {
85
+ ok: true;
86
+ manifest: BoundaryManifest;
87
+ manifestHash: string;
88
+ } | {
89
+ ok: false;
90
+ error: string;
91
+ };
92
+ declare const parseBoundaryManifest: (issueBody: string) => BoundaryManifestParse;
93
+ declare const closeoutRungFor: (manifest: BoundaryManifest) => EvidenceReviewRung;
94
+ //#endregion
6
95
  //#region src/github-issue-comments.d.ts
7
96
  interface GithubIssueCommentApi {
8
97
  body: string;
@@ -37,8 +126,8 @@ declare const boundaryReviewProofBaseSchema: z.ZodObject<{
37
126
  mergedSha: z.ZodOptional<z.ZodString>;
38
127
  pr: z.ZodNumber;
39
128
  state: z.ZodEnum<{
40
- open: "open";
41
129
  merged: "merged";
130
+ open: "open";
42
131
  }>;
43
132
  wave: z.ZodOptional<z.ZodString>;
44
133
  }, z.core.$loose>>;
@@ -61,8 +150,8 @@ declare const boundaryReviewProofBaseSchema: z.ZodObject<{
61
150
  }>;
62
151
  producer: z.ZodString;
63
152
  rung: z.ZodEnum<{
64
- oracle: "oracle";
65
153
  "independent-model": "independent-model";
154
+ oracle: "oracle";
66
155
  human: "human";
67
156
  }>;
68
157
  schemaVersion: z.ZodLiteral<1>;
@@ -81,8 +170,8 @@ declare const boundaryReviewProofSchema: z.ZodObject<{
81
170
  mergedSha: z.ZodOptional<z.ZodString>;
82
171
  pr: z.ZodNumber;
83
172
  state: z.ZodEnum<{
84
- open: "open";
85
173
  merged: "merged";
174
+ open: "open";
86
175
  }>;
87
176
  wave: z.ZodOptional<z.ZodString>;
88
177
  }, z.core.$loose>>;
@@ -105,8 +194,8 @@ declare const boundaryReviewProofSchema: z.ZodObject<{
105
194
  }>;
106
195
  producer: z.ZodString;
107
196
  rung: z.ZodEnum<{
108
- oracle: "oracle";
109
197
  "independent-model": "independent-model";
198
+ oracle: "oracle";
110
199
  human: "human";
111
200
  }>;
112
201
  schemaVersion: z.ZodLiteral<1>;
@@ -127,6 +216,22 @@ declare const selectBoundaryReviewProof: (comments: GithubIssueComment[], bounda
127
216
  declare const boundaryReviewProofAuthorsSeen: (comments: GithubIssueComment[], boundary: string) => string[];
128
217
  declare const undispositionedBlockingFindings: (proof: BoundaryReviewProof) => string[];
129
218
  //#endregion
219
+ //#region src/boundary-membership-graph.d.ts
220
+ /** The boundary-manifest wave demand that applies to one pull request. */
221
+ interface WaveReviewDemand {
222
+ autoMerge: boolean;
223
+ review: EvidenceReviewRung;
224
+ wave: string;
225
+ }
226
+ interface BoundaryPullRequestRef {
227
+ baseRefName?: string;
228
+ headRefOid?: string;
229
+ headRefName?: string;
230
+ mergeCommitOid?: string;
231
+ number: number;
232
+ state: "OPEN" | "CLOSED" | "MERGED";
233
+ }
234
+ //#endregion
130
235
  //#region src/hq-ingest-sink.d.ts
131
236
  interface HqIngestDependencies {
132
237
  /**
@@ -180,6 +285,15 @@ interface HqSpoolEntryOutcome {
180
285
  detail?: string;
181
286
  eventId: string;
182
287
  kind: string;
288
+ /**
289
+ * `true` when HQ refused the content as schema-invalid (HTTP 422, #739).
290
+ * The same bytes get the same verdict on every retry under the current
291
+ * ingest schema, so retrying without a schema change cannot succeed.
292
+ * Distinct from `undeliverable`: an HQ schema fix can still admit these
293
+ * bytes, so eviction is an operator decision (`hq:flush --evict-permanent`),
294
+ * never automatic.
295
+ */
296
+ permanent?: boolean;
183
297
  spool: string;
184
298
  /**
185
299
  * `undeliverable` is the one terminal verdict (#445). Every other status
@@ -197,6 +311,13 @@ interface HqSpoolFlushInput {
197
311
  clientSecret: string;
198
312
  /** The profile's HQ origin; entries recorded against another are refused. */
199
313
  endpoint: string;
314
+ /**
315
+ * Disposition schema-permanent rejections (HTTP 422) in place with the
316
+ * `.undeliverable` suffix instead of retaining them (#739). Operator
317
+ * opt-in: a later HQ schema fix can still admit the same bytes, so the
318
+ * drain never evicts on its own.
319
+ */
320
+ evictPermanentRejections?: boolean;
200
321
  /** Operator-named spool directories; replaces the default two locations. */
201
322
  explicitDirectories?: string[];
202
323
  repository: HqSpoolRepository;
@@ -512,10 +633,81 @@ declare const FollowUpActionSchema: z.ZodType<FollowUpAction>;
512
633
  declare const DIFF_CLASSIFICATIONS: readonly ["docs/process-only", "trivial", "non-trivial"];
513
634
  type DiffClassification = (typeof DIFF_CLASSIFICATIONS)[number];
514
635
  //#endregion
636
+ //#region src/impact-stamp.d.ts
637
+ /**
638
+ * The recorded stamp. `targets` satisfies the completeness invariant: every
639
+ * target the profile declares is present, each with its exact basis — never
640
+ * silently absent. `basis: "conservative"` means an unmodelled or unprovable
641
+ * input widened every target to full impact.
642
+ */
643
+ declare const impactStampSchema: z.ZodObject<{
644
+ basis: z.ZodEnum<{
645
+ "target-scoped": "target-scoped";
646
+ conservative: "conservative";
647
+ }>;
648
+ reasons: z.ZodArray<z.ZodString>;
649
+ stampVersion: z.ZodLiteral<3>;
650
+ targets: z.ZodArray<z.ZodObject<{
651
+ basis: z.ZodString;
652
+ impact: z.ZodEnum<{
653
+ affected: "affected";
654
+ "not-affected": "not-affected";
655
+ }>;
656
+ name: z.ZodString;
657
+ }, z.core.$strip>>;
658
+ unsubscribedPaths: z.ZodArray<z.ZodString>;
659
+ }, z.core.$strip>;
660
+ type ImpactStamp = z.infer<typeof impactStampSchema>;
661
+ /**
662
+ * The surfaces that consume the stamp. One classification, consumed
663
+ * everywhere (#430): every surface routes through
664
+ * {@link impactStampScopeDecision}, so no surface can be more trusting than
665
+ * another, and no surface re-derives path rules of its own. The value only
666
+ * selects the wording of the conservative floor a refusal falls back to.
667
+ */
668
+ declare const IMPACT_SCOPE_SURFACES: {
669
+ readonly demand: "full demand floor";
670
+ readonly "preview-lifecycle": "full preview-lifecycle floor";
671
+ readonly "verification-battery": "full verification-battery floor";
672
+ };
673
+ type ImpactScopeSurface = keyof typeof IMPACT_SCOPE_SURFACES;
674
+ interface ImpactScopeDecision {
675
+ reason: string;
676
+ /** True ⇒ this target's work is provably unreachable and may be released. */
677
+ scoped: boolean;
678
+ }
679
+ /**
680
+ * Whether a trusted stamp RELEASES one target-scoped unit of work — an
681
+ * external proof demand (#542 wave 2), a verification-battery command, or a
682
+ * preview (Alchemy) lifecycle stack (#430 wave 3).
683
+ *
684
+ * The only release path is a `target-scoped` stamp of exactly this build's
685
+ * stamp version whose target entry for exactly this name is provably
686
+ * `not-affected`. Every other input — no trusted stamp, an unknown stamp
687
+ * version, a conservative stamp, a name the stamp does not classify, or an
688
+ * `affected` verdict — keeps today's full-work floor. Work only ever gets
689
+ * released, never added or satisfied: this function can withdraw a demand, it
690
+ * can never certify one.
691
+ *
692
+ * Identity binding is the CALLER's precondition: pass only a stamp computed
693
+ * for, or read from a pr:verify proof bound to, the current candidate (see
694
+ * `trustedImpactStamp` in `pr-readiness/verification-proof.ts`); pass
695
+ * `undefined` otherwise.
696
+ */
697
+ declare const impactStampScopeDecision: ({
698
+ stamp,
699
+ surface,
700
+ targetName
701
+ }: {
702
+ stamp: ImpactStamp | undefined;
703
+ surface: ImpactScopeSurface;
704
+ targetName: string;
705
+ }) => ImpactScopeDecision;
706
+ //#endregion
515
707
  //#region src/profile.d.ts
516
708
  declare const DEFAULT_FACTORY_REPOSITORY = "unknown/unknown";
517
- /** The one profile shape this build accepts (ADR 0023, #318, #351). */
518
- declare const PROFILE_SCHEMA_VERSION = 5;
709
+ /** The one profile shape this build accepts (ADR 0023, #318, #351, #742). */
710
+ declare const PROFILE_SCHEMA_VERSION = 6;
519
711
  declare const factoryProjectProfileSchema: z.ZodObject<{
520
712
  $schema: z.ZodOptional<z.ZodString>;
521
713
  extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -524,18 +716,13 @@ declare const factoryProjectProfileSchema: z.ZodObject<{
524
716
  endpoint: z.ZodIntersection<z.ZodString, z.ZodString>;
525
717
  }, z.core.$strict>>;
526
718
  impact: z.ZodOptional<z.ZodObject<{
719
+ inert: z.ZodOptional<z.ZodArray<z.ZodString>>;
527
720
  targets: z.ZodArray<z.ZodObject<{
528
721
  importers: z.ZodArray<z.ZodString>;
529
722
  name: z.ZodString;
530
723
  paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
531
724
  }, z.core.$strict>>;
532
725
  }, z.core.$strict>>;
533
- proof: z.ZodObject<{
534
- classificationPolicy: z.ZodObject<{
535
- docsOnly: z.ZodDefault<z.ZodArray<z.ZodString>>;
536
- trivial: z.ZodDefault<z.ZodArray<z.ZodString>>;
537
- }, z.core.$strict>;
538
- }, z.core.$strict>;
539
726
  repository: z.ZodObject<{
540
727
  name: z.ZodString;
541
728
  owner: z.ZodString;
@@ -544,8 +731,8 @@ declare const factoryProjectProfileSchema: z.ZodObject<{
544
731
  name: z.ZodString;
545
732
  scope: z.ZodOptional<z.ZodObject<{
546
733
  classifications: z.ZodArray<z.ZodEnum<{
547
- trivial: "trivial";
548
734
  "docs/process-only": "docs/process-only";
735
+ trivial: "trivial";
549
736
  "non-trivial": "non-trivial";
550
737
  }>>;
551
738
  }, z.core.$strict>>;
@@ -555,7 +742,7 @@ declare const factoryProjectProfileSchema: z.ZodObject<{
555
742
  paths: z.ZodArray<z.ZodString>;
556
743
  }, z.core.$strict>>;
557
744
  }, z.core.$strict>>;
558
- schemaVersion: z.ZodLiteral<5>;
745
+ schemaVersion: z.ZodLiteral<6>;
559
746
  verification: z.ZodObject<{
560
747
  commands: z.ZodArray<z.ZodObject<{
561
748
  command: z.ZodString;
@@ -648,9 +835,7 @@ interface LoadUserConfigResult {
648
835
  //#endregion
649
836
  //#region src/github-check-runs.d.ts
650
837
  declare const FACTORY_CHECK_NAMES: {
651
- readonly boundary: "patronage-factory/boundary";
652
838
  readonly "pr-ready": "patronage-factory/pr-ready";
653
- readonly "pr-review": "patronage-factory/pr-review";
654
839
  readonly "pr-verify": "patronage-factory/pr-verify";
655
840
  };
656
841
  type FactoryCheckGate = keyof typeof FACTORY_CHECK_NAMES;
@@ -665,12 +850,6 @@ interface PublishFactoryCheckInput {
665
850
  * `hqLaneRefBaseUrlFromProfile` — the same source as the HQ gate sink.
666
851
  */
667
852
  hqLaneBaseUrl?: string;
668
- /**
669
- * Explicit issue/PR number for the HQ lane ref, used when the check run is not
670
- * PR-scoped (e.g. an epic boundary check keyed by its epic issue). Falls back
671
- * to `pr`, then to the checkout's PR, when omitted.
672
- */
673
- laneRefNumber?: number;
674
853
  owner: string;
675
854
  pr?: number;
676
855
  proof: unknown;
@@ -869,10 +1048,6 @@ interface ReviewLadderPolicy {
869
1048
  }
870
1049
  declare const resolveReviewLadderPolicy: () => ReviewLadderPolicy;
871
1050
  //#endregion
872
- //#region src/review-rungs.d.ts
873
- declare const EVIDENCE_REVIEW_RUNGS: readonly ["independent-model", "oracle", "human"];
874
- type EvidenceReviewRung = (typeof EVIDENCE_REVIEW_RUNGS)[number];
875
- //#endregion
876
1051
  //#region src/review-ladder-ledger.d.ts
877
1052
  type LadderCycleStage = "interior" | "gate";
878
1053
  interface LadderCycleRef {
@@ -1124,8 +1299,8 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1124
1299
  baseSha: z.ZodString;
1125
1300
  blockingReasons: z.ZodArray<z.ZodString>;
1126
1301
  classification: z.ZodEnum<{
1127
- trivial: "trivial";
1128
1302
  "docs/process-only": "docs/process-only";
1303
+ trivial: "trivial";
1129
1304
  "non-trivial": "non-trivial";
1130
1305
  }>;
1131
1306
  externalChecks: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -1138,8 +1313,8 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1138
1313
  reason: z.ZodOptional<z.ZodString>;
1139
1314
  scope: z.ZodOptional<z.ZodObject<{
1140
1315
  classifications: z.ZodArray<z.ZodEnum<{
1141
- trivial: "trivial";
1142
1316
  "docs/process-only": "docs/process-only";
1317
+ trivial: "trivial";
1143
1318
  "non-trivial": "non-trivial";
1144
1319
  }>>;
1145
1320
  }, z.core.$strict>>;
@@ -1156,9 +1331,9 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1156
1331
  mergeable: z.ZodString;
1157
1332
  requiredChecks: z.ZodEnum<{
1158
1333
  unknown: "unknown";
1159
- pending: "pending";
1160
1334
  passed: "passed";
1161
1335
  failed: "failed";
1336
+ pending: "pending";
1162
1337
  none: "none";
1163
1338
  }>;
1164
1339
  reviewDecision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -1241,9 +1416,9 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1241
1416
  reviewedHeadSha: z.ZodOptional<z.ZodString>;
1242
1417
  reviewedPatchId: z.ZodOptional<z.ZodString>;
1243
1418
  status: z.ZodEnum<{
1419
+ stale: "stale";
1244
1420
  blocked: "blocked";
1245
1421
  "not-required": "not-required";
1246
- stale: "stale";
1247
1422
  current: "current";
1248
1423
  missing: "missing";
1249
1424
  }>;
@@ -1253,9 +1428,9 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1253
1428
  reviewedHeadSha: z.ZodOptional<z.ZodString>;
1254
1429
  reviewedPatchId: z.ZodOptional<z.ZodString>;
1255
1430
  status: z.ZodEnum<{
1431
+ stale: "stale";
1256
1432
  blocked: "blocked";
1257
1433
  "not-required": "not-required";
1258
- stale: "stale";
1259
1434
  current: "current";
1260
1435
  missing: "missing";
1261
1436
  }>;
@@ -1505,84 +1680,13 @@ declare function validatePrReadyProof(value: unknown): PrReadyProof;
1505
1680
  declare function readPrReadyProof(filePath: string): PrReadyProof;
1506
1681
  declare function runPrReady(args: PrReadyArgs, dependencies?: PrReadyDependencies): Promise<PrReadyProof>;
1507
1682
  //#endregion
1508
- //#region src/impact-stamp.d.ts
1509
- /**
1510
- * The recorded stamp. `targets` satisfies the completeness invariant: every
1511
- * target the profile declares is present, each with its exact basis — never
1512
- * silently absent. `basis: "conservative"` means an unmodelled or unprovable
1513
- * input widened every target to full impact.
1514
- */
1515
- declare const impactStampSchema: z.ZodObject<{
1516
- basis: z.ZodEnum<{
1517
- "target-scoped": "target-scoped";
1518
- conservative: "conservative";
1519
- }>;
1520
- reasons: z.ZodArray<z.ZodString>;
1521
- stampVersion: z.ZodLiteral<3>;
1522
- targets: z.ZodArray<z.ZodObject<{
1523
- basis: z.ZodString;
1524
- impact: z.ZodEnum<{
1525
- affected: "affected";
1526
- "not-affected": "not-affected";
1527
- }>;
1528
- name: z.ZodString;
1529
- }, z.core.$strip>>;
1530
- unsubscribedPaths: z.ZodArray<z.ZodString>;
1531
- }, z.core.$strip>;
1532
- type ImpactStamp = z.infer<typeof impactStampSchema>;
1533
- /**
1534
- * The surfaces that consume the stamp. One classification, consumed
1535
- * everywhere (#430): every surface routes through
1536
- * {@link impactStampScopeDecision}, so no surface can be more trusting than
1537
- * another, and no surface re-derives path rules of its own. The value only
1538
- * selects the wording of the conservative floor a refusal falls back to.
1539
- */
1540
- declare const IMPACT_SCOPE_SURFACES: {
1541
- readonly demand: "full demand floor";
1542
- readonly "preview-lifecycle": "full preview-lifecycle floor";
1543
- readonly "verification-battery": "full verification-battery floor";
1544
- };
1545
- type ImpactScopeSurface = keyof typeof IMPACT_SCOPE_SURFACES;
1546
- interface ImpactScopeDecision {
1547
- reason: string;
1548
- /** True ⇒ this target's work is provably unreachable and may be released. */
1549
- scoped: boolean;
1550
- }
1551
- /**
1552
- * Whether a trusted stamp RELEASES one target-scoped unit of work — an
1553
- * external proof demand (#542 wave 2), a verification-battery command, or a
1554
- * preview (Alchemy) lifecycle stack (#430 wave 3).
1555
- *
1556
- * The only release path is a `target-scoped` stamp of exactly this build's
1557
- * stamp version whose target entry for exactly this name is provably
1558
- * `not-affected`. Every other input — no trusted stamp, an unknown stamp
1559
- * version, a conservative stamp, a name the stamp does not classify, or an
1560
- * `affected` verdict — keeps today's full-work floor. Work only ever gets
1561
- * released, never added or satisfied: this function can withdraw a demand, it
1562
- * can never certify one.
1563
- *
1564
- * Identity binding is the CALLER's precondition: pass only a stamp computed
1565
- * for, or read from a pr:verify proof bound to, the current candidate (see
1566
- * `trustedImpactStamp` in `pr-readiness/verification-proof.ts`); pass
1567
- * `undefined` otherwise.
1568
- */
1569
- declare const impactStampScopeDecision: ({
1570
- stamp,
1571
- surface,
1572
- targetName
1573
- }: {
1574
- stamp: ImpactStamp | undefined;
1575
- surface: ImpactScopeSurface;
1576
- targetName: string;
1577
- }) => ImpactScopeDecision;
1578
- //#endregion
1579
1683
  //#region src/required-check-policy.d.ts
1580
1684
  declare const EVIDENCE_CHECK_TYPES: readonly ["review", "verify"];
1581
1685
  type EvidenceCheckType = (typeof EVIDENCE_CHECK_TYPES)[number];
1582
1686
  declare const requiredCheckScopeSchema: z.ZodObject<{
1583
1687
  classifications: z.ZodArray<z.ZodEnum<{
1584
- trivial: "trivial";
1585
1688
  "docs/process-only": "docs/process-only";
1689
+ trivial: "trivial";
1586
1690
  "non-trivial": "non-trivial";
1587
1691
  }>>;
1588
1692
  }, z.core.$strict>;
@@ -1639,8 +1743,8 @@ declare const evidenceEnvelopeBaseSchema: z.ZodObject<{
1639
1743
  producer: z.ZodString;
1640
1744
  requestId: z.ZodOptional<z.ZodString>;
1641
1745
  rung: z.ZodOptional<z.ZodEnum<{
1642
- oracle: "oracle";
1643
1746
  "independent-model": "independent-model";
1747
+ oracle: "oracle";
1644
1748
  human: "human";
1645
1749
  }>>;
1646
1750
  schemaVersion: z.ZodLiteral<1>;
@@ -1666,8 +1770,8 @@ declare const evidenceEnvelopeSchema: z.ZodObject<{
1666
1770
  producer: z.ZodString;
1667
1771
  requestId: z.ZodOptional<z.ZodString>;
1668
1772
  rung: z.ZodOptional<z.ZodEnum<{
1669
- oracle: "oracle";
1670
1773
  "independent-model": "independent-model";
1774
+ oracle: "oracle";
1671
1775
  human: "human";
1672
1776
  }>>;
1673
1777
  schemaVersion: z.ZodLiteral<1>;
@@ -1770,9 +1874,9 @@ declare const loadEvidenceEnvelopes: (cwd: string) => LoadedEvidenceEnvelope[];
1770
1874
  //#region src/review-proof-applicability.d.ts
1771
1875
  declare const REVIEW_STATUS_VALUES: readonly ["not-required", "current", "stale", "missing", "blocked"];
1772
1876
  declare const reviewStatusSchema: z.ZodEnum<{
1877
+ stale: "stale";
1773
1878
  blocked: "blocked";
1774
1879
  "not-required": "not-required";
1775
- stale: "stale";
1776
1880
  current: "current";
1777
1881
  missing: "missing";
1778
1882
  }>;
@@ -1871,17 +1975,8 @@ declare const validatePrReviewResult: (value: unknown) => PrReviewResult;
1871
1975
  declare const validatePrReviewProof: (value: unknown) => PrReviewProof;
1872
1976
  declare const readPrReviewProof: (filePath: string) => PrReviewProof;
1873
1977
  declare const PR_REVIEW_PROOF_DESCRIPTOR: ProofDescriptor<PrReviewProof>;
1874
- declare namespace verification_proof_d_exports {
1875
- export { PrVerifyBaselineFullProof, PrVerifyCommandResult, PrVerifyExecutedCommand, PrVerifyNotRequiredCommand, PrVerifyProof, PrVerifySchemaVersion, ResolvedPrVerifyMode, SUPPORTED_PR_VERIFY_SCHEMA_VERSIONS, VerificationHeadShas, VerificationProofState, VerifiedHeadShas, prVerifyFullHeadShasForDiff, prVerifyProofHeadShas, readPrVerifyProof, resolveVerifyProofApplicability, trustedImpactStamp, validatePrVerifyProof, verificationProofApplicabilityFor, verificationProofBlockingReason, verificationProofForReadiness, verificationProofStateFor, verifyProofIdentityMatches, verifyProofPassed };
1876
- }
1877
- interface VerifiedHeadShas {
1878
- docsOnlyVerifiedHeadShas: string[];
1879
- trivialVerifiedHeadShas: string[];
1880
- verifiedHeadShas: string[];
1881
- }
1882
- type VerificationHeadShas = {
1883
- explicitFailure: true;
1884
- } | VerifiedHeadShas;
1978
+ //#endregion
1979
+ //#region src/pr-verify-proof-contract.d.ts
1885
1980
  declare const SUPPORTED_PR_VERIFY_SCHEMA_VERSIONS: readonly [1, 2, 3, 4];
1886
1981
  type PrVerifySchemaVersion = (typeof SUPPORTED_PR_VERIFY_SCHEMA_VERSIONS)[number];
1887
1982
  interface PrVerifyCommandResult {
@@ -1959,317 +2054,6 @@ interface PrVerifyProof {
1959
2054
  }
1960
2055
  type PrVerifyBaselineFullProof = NonNullable<PrVerifyProof["baselineFullProofs"]>[number];
1961
2056
  declare function validatePrVerifyProof(value: unknown): PrVerifyProof;
1962
- declare function readPrVerifyProof(filePath: string): PrVerifyProof;
1963
- declare const verifyProofPassed: (proof: PrVerifyProof) => boolean;
1964
- declare const prVerifyProofHeadShas: (proof: PrVerifyProof | undefined, creditedHeadSha?: string) => VerifiedHeadShas;
1965
- declare const verifyProofIdentityMatches: ({
1966
- currentIdentity,
1967
- proof
1968
- }: {
1969
- currentIdentity?: {
1970
- patchId: string;
1971
- mergeBaseSha?: string;
1972
- };
1973
- proof?: PrVerifyProof;
1974
- }) => boolean;
1975
- /**
1976
- * Wave-2 consumption (#542): the recorded impact stamp, released for demand
1977
- * resolution ONLY when it is identity-bound to the current candidate — the
1978
- * proof passed, and its recorded headSha AND patchId both name exactly this
1979
- * candidate (the same identities the proof already binds). Everything else —
1980
- * no proof, an aborted run, a stale head, a moved patch id, a pre-stamp proof
1981
- * — returns `undefined`, and the consumer keeps today's full-demand floor.
1982
- *
1983
- * Deliberately stricter than verify-once applicability (which tolerates a
1984
- * head-only or patch-id-only match): a stamp narrows external demands, so it
1985
- * is trusted only on an exact double binding, fail closed.
1986
- */
1987
- declare const trustedImpactStamp: ({
1988
- candidate,
1989
- proof
1990
- }: {
1991
- candidate: {
1992
- headSha: string;
1993
- patchId: string;
1994
- };
1995
- proof: PrVerifyProof | undefined;
1996
- }) => ImpactStamp | undefined;
1997
- declare const prVerifyFullHeadShasForDiff: ({
1998
- docsOnlyDeltaAcceptedSince,
1999
- files,
2000
- proof
2001
- }: {
2002
- docsOnlyDeltaAcceptedSince?: (baselineHeadSha: string) => boolean;
2003
- files: string[];
2004
- proof: PrVerifyProof;
2005
- }) => string[];
2006
- type VerificationProofState = {
2007
- kind: "typed-aborted";
2008
- proof: PrVerifyProof;
2009
- } | {
2010
- kind: "typed-missing";
2011
- path: string;
2012
- reason: "enoent" | "invalid";
2013
- message?: string;
2014
- } | {
2015
- kind: "typed";
2016
- headShas: VerifiedHeadShas;
2017
- proof: PrVerifyProof;
2018
- } | {
2019
- kind: "typed-diff-mismatch";
2020
- mode: ResolvedPrVerifyMode;
2021
- };
2022
- declare const verificationProofStateFor: ({
2023
- proof,
2024
- proofMatchesCurrentDiff,
2025
- proofPath
2026
- }: {
2027
- proof?: PrVerifyProof;
2028
- proofMatchesCurrentDiff?: boolean;
2029
- proofPath?: string;
2030
- }) => VerificationProofState;
2031
- declare const verificationProofApplicabilityFor: ({
2032
- docsOnlyDeltaAcceptedSince,
2033
- explicitProof,
2034
- files,
2035
- headSha,
2036
- currentIdentity,
2037
- proof,
2038
- proofPath,
2039
- proofReadError
2040
- }: {
2041
- docsOnlyDeltaAcceptedSince?: (baselineHeadSha: string) => boolean;
2042
- explicitProof: boolean;
2043
- files: string[];
2044
- headSha: string;
2045
- currentIdentity?: {
2046
- patchId: string;
2047
- mergeBaseSha?: string;
2048
- };
2049
- proof?: PrVerifyProof;
2050
- proofPath?: string;
2051
- proofReadError?: unknown;
2052
- }) => {
2053
- fullVerifiedHeadShas: never[];
2054
- verificationProof: VerificationProofState;
2055
- } | {
2056
- fullVerifiedHeadShas: string[];
2057
- verificationProof: {
2058
- headShas: VerifiedHeadShas;
2059
- kind: "typed";
2060
- proof: PrVerifyProof;
2061
- };
2062
- };
2063
- declare const resolveVerifyProofApplicability: ({
2064
- proofPath,
2065
- explicitProof,
2066
- docsOnlyDeltaAcceptedSince,
2067
- files,
2068
- headSha,
2069
- currentVerifyIdentityForBase,
2070
- preread
2071
- }: {
2072
- proofPath: string;
2073
- explicitProof: boolean;
2074
- docsOnlyDeltaAcceptedSince?: (baselineHeadSha: string) => boolean;
2075
- files: string[];
2076
- headSha: string;
2077
- currentVerifyIdentityForBase?: (base: string) => {
2078
- patchId: string;
2079
- mergeBaseSha?: string;
2080
- };
2081
- preread?: {
2082
- proof?: PrVerifyProof;
2083
- error?: unknown;
2084
- };
2085
- }) => {
2086
- fullVerifiedHeadShas: never[];
2087
- verificationProof: VerificationProofState;
2088
- } | {
2089
- fullVerifiedHeadShas: string[];
2090
- verificationProof: {
2091
- headShas: VerifiedHeadShas;
2092
- kind: "typed";
2093
- proof: PrVerifyProof;
2094
- };
2095
- };
2096
- declare const verificationProofForReadiness: (state: VerificationProofState) => VerificationHeadShas;
2097
- declare const verificationProofBlockingReason: (state: VerificationProofState) => string | undefined;
2098
- //#endregion
2099
- //#region src/retro-envelope.d.ts
2100
- /**
2101
- * Versioned retro envelope schema (epic #27 wave 2, issue #34).
2102
- *
2103
- * One envelope per lane, built at `factory:closeout` and delivered through the
2104
- * typed gate-sink as the `retro-envelope` ingest kind. Re-derived in TypeScript
2105
- * from the `spike/telemetry-layer2` S5 scratch schema (reference-only, never
2106
- * merged). This module is the single source of truth for the v1 wire shape
2107
- * and its bounds ({@link RETRO_ENVELOPE_WIRE_BOUNDS}) — producer and consumer
2108
- * alike. HQ imports these exports directly from the Worker-safe
2109
- * `@patronage/software-factory/schemas` subpath
2110
- * (`software-factory-hq/src/contracts/retro-schemas.ts`) instead of
2111
- * maintaining a parallel hand-written copy, so there is exactly one wire
2112
- * contract and no drift-detection machinery is needed (issue #350; formerly
2113
- * a hand-written twin plus a 767-line parity test, #46).
2114
- *
2115
- * DESIGN INVARIANT: cross-family token sums must be UNREPRESENTABLE.
2116
- *
2117
- * The two model families use different tokenizers, prices, and accounting
2118
- * conventions, so any token total that spans Claude and GPT is a lie:
2119
- *
2120
- * 1. There is no combined/total token field anywhere in the envelope.
2121
- * 2. `tokenFamilies` is strict — its only keys are `claude` and `gpt`; data
2122
- * cannot smuggle in a third "all"/"combined" slot.
2123
- * 3. The family BLOCKS are structurally different shapes with DIFFERENT keys
2124
- * (claude is a single flat block keyed on freshInput/cacheReadInput/
2125
- * cacheCreationInput; gpt is `{ roles: [...] }`). The exclusive input-tier
2126
- * COUNTS share no key name across families. The residual names shared
2127
- * between the claude block and a gpt ROLE entry are pinned to exactly
2128
- * {costUsd, model, output} (PR #32 advisory): `costUsd` is deliberate —
2129
- * USD is the one cross-family summable unit (rule 4); `model` is an
2130
- * unsummable label; `output` is the same name at DIFFERENT depths (lane
2131
- * block vs per-role entry), frozen by a tripwire test in
2132
- * `retro-envelope.test.ts` so the overlap cannot grow. Renaming `output`
2133
- * is a schemaVersion-2 wire change, deliberately not spent in v1.
2134
- * 4. Cost is per-family USD and nullable. Combined totals are allowed in USD
2135
- * only, and only as a projection-time sum of per-family USD.
2136
- *
2137
- * Field names also encode the S2/S3 reader lessons: Claude `freshInput` alone
2138
- * is not prompt size (true input context = freshInput + cacheReadInput +
2139
- * cacheCreationInput, requestId-deduped), and codex `inputInclusiveOfCache`
2140
- * already includes `cachedInput`, so `freshInputDerived` (inclusive − cached)
2141
- * is the only value safe to feed a per-token pricer.
2142
- *
2143
- * COMPLETENESS POSTURE: harvest may have no usable native log for a lane, so
2144
- * `tokenFamilies` may legitimately be absent. The closeout build gate demands
2145
- * a valid envelope, not available telemetry. A families-absent envelope keeps
2146
- * its operator-visible data gaps and is a replayable advisory HQ event, so it
2147
- * never substitutes unavailable usage with zero. The wire shape (field names,
2148
- * types, structure) stays byte-parity with HQ v1.
2149
- */
2150
- declare const RETRO_ENVELOPE_SCHEMA_VERSION = 1;
2151
- declare const retroEnvelopeV1Schema: z.ZodObject<{
2152
- agentRunId: z.ZodString;
2153
- archiveRef: z.ZodOptional<z.ZodString>;
2154
- cycles: z.ZodObject<{
2155
- gateRunsToFirstGreen: z.ZodNumber;
2156
- reviewerFixRounds: z.ZodNumber;
2157
- thermoFixRounds: z.ZodNumber;
2158
- }, z.core.$strict>;
2159
- dataGaps: z.ZodDefault<z.ZodArray<z.ZodString>>;
2160
- gates: z.ZodArray<z.ZodObject<{
2161
- cycle: z.ZodNumber;
2162
- duration: z.ZodNumber;
2163
- gate: z.ZodString;
2164
- outcome: z.ZodEnum<{
2165
- pass: "pass";
2166
- fail: "fail";
2167
- skip: "skip";
2168
- }>;
2169
- startedAt: z.ZodISODateTime;
2170
- }, z.core.$strict>>;
2171
- generatedAt: z.ZodISODateTime;
2172
- interventions: z.ZodObject<{
2173
- count: z.ZodNumber;
2174
- }, z.core.$strict>;
2175
- joinKeys: z.ZodObject<{
2176
- claudeSessionIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
2177
- codexThreadIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
2178
- }, z.core.$strict>;
2179
- kind: z.ZodLiteral<"retro-envelope">;
2180
- outcome: z.ZodOptional<z.ZodObject<{
2181
- status: z.ZodEnum<{
2182
- success: "success";
2183
- fail: "fail";
2184
- blocked: "blocked";
2185
- "ship-with-followups": "ship-with-followups";
2186
- }>;
2187
- verdict: z.ZodOptional<z.ZodString>;
2188
- }, z.core.$strict>>;
2189
- phases: z.ZodArray<z.ZodObject<{
2190
- at: z.ZodISODateTime;
2191
- deltaSec: z.ZodOptional<z.ZodNumber>;
2192
- name: z.ZodString;
2193
- }, z.core.$strict>>;
2194
- refs: z.ZodObject<{
2195
- branch: z.ZodOptional<z.ZodString>;
2196
- epic: z.ZodOptional<z.ZodString>;
2197
- headSha: z.ZodOptional<z.ZodString>;
2198
- issue: z.ZodOptional<z.ZodString>;
2199
- prNumber: z.ZodOptional<z.ZodNumber>;
2200
- }, z.core.$strict>;
2201
- repo: z.ZodObject<{
2202
- name: z.ZodString;
2203
- owner: z.ZodString;
2204
- }, z.core.$strict>;
2205
- schemaVersion: z.ZodLiteral<1>;
2206
- tokenFamilies: z.ZodObject<{
2207
- claude: z.ZodOptional<z.ZodObject<{
2208
- cacheCreationInput: z.ZodNumber;
2209
- cacheReadInput: z.ZodNumber;
2210
- costUsd: z.ZodNullable<z.ZodNumber>;
2211
- family: z.ZodLiteral<"claude">;
2212
- freshInput: z.ZodNumber;
2213
- model: z.ZodString;
2214
- output: z.ZodNumber;
2215
- requests: z.ZodNumber;
2216
- }, z.core.$strict>>;
2217
- gpt: z.ZodOptional<z.ZodObject<{
2218
- family: z.ZodLiteral<"gpt">;
2219
- roles: z.ZodArray<z.ZodObject<{
2220
- cachedInput: z.ZodNumber;
2221
- costUsd: z.ZodNullable<z.ZodNumber>;
2222
- freshInputDerived: z.ZodNumber;
2223
- inputInclusiveOfCache: z.ZodNumber;
2224
- model: z.ZodString;
2225
- output: z.ZodNumber;
2226
- reasoningOutput: z.ZodNumber;
2227
- role: z.ZodString;
2228
- threadId: z.ZodOptional<z.ZodString>;
2229
- }, z.core.$strict>>;
2230
- }, z.core.$strict>>;
2231
- }, z.core.$strict>;
2232
- wallClock: z.ZodObject<{
2233
- endTs: z.ZodISODateTime;
2234
- startTs: z.ZodISODateTime;
2235
- totalSec: z.ZodNumber;
2236
- }, z.core.$strict>;
2237
- }, z.core.$strict>;
2238
- type RetroEnvelope = z.infer<typeof retroEnvelopeV1Schema>;
2239
- /**
2240
- * Versioned payload validators, keyed by schema major. Unknown majors never
2241
- * reach these — {@link parseRetroEnvelope} returns them raw and marked
2242
- * degraded, mirroring HQ's ingest skew posture (stored raw, never dropped).
2243
- */
2244
- declare const RETRO_ENVELOPE_VALIDATORS: Record<number, z.ZodType<RetroEnvelope, unknown>>;
2245
- declare const SUPPORTED_RETRO_ENVELOPE_SCHEMA_VERSIONS: readonly number[];
2246
- /** The `schemaVersion` a candidate declares, or undefined when unreadable. */
2247
- declare const retroEnvelopeSchemaVersionOf: (candidate: unknown) => number | undefined;
2248
- type ParsedRetroEnvelope = {
2249
- disposition: "trusted";
2250
- envelope: RetroEnvelope;
2251
- schemaVersion: number;
2252
- } | {
2253
- disposition: "degraded";
2254
- raw: unknown;
2255
- schemaVersion: number | undefined;
2256
- };
2257
- /**
2258
- * Parses a candidate against the versioned validators. A recognized major is
2259
- * validated typed-only (throws on an invalid known-version payload); an unknown
2260
- * major is round-tripped RAW and marked degraded — the retained payload is the
2261
- * exact input object, never a coerced projection. Mirrors the HQ ingest seam so
2262
- * the two sides agree on the skew posture.
2263
- */
2264
- declare const parseRetroEnvelope: (candidate: unknown) => ParsedRetroEnvelope;
2265
- /**
2266
- * Whether harvest recorded at least one token family. This is an operator
2267
- * summary predicate, not a delivery gate: a families-absent envelope remains
2268
- * valid and replayable when its data gaps explain why telemetry is unavailable.
2269
- */
2270
- declare const isRetroEnvelopeWireComplete: (envelope: Pick<RetroEnvelope, "tokenFamilies">) => boolean;
2271
- /** Epic anchor for an envelope: refs.epic, else refs.issue, else the PR. */
2272
- declare const retroEpicReference: (refs: RetroEnvelope["refs"]) => string | undefined;
2273
2057
  //#endregion
2274
2058
  //#region src/schemas.d.ts
2275
2059
  declare const boundaryCheckProofSchema: z.ZodObject<{
@@ -2281,14 +2065,14 @@ declare const boundaryCheckProofSchema: z.ZodObject<{
2281
2065
  pr: z.ZodNumber;
2282
2066
  sha: z.ZodString;
2283
2067
  state: z.ZodEnum<{
2284
- open: "open";
2285
2068
  merged: "merged";
2069
+ open: "open";
2286
2070
  }>;
2287
2071
  wave: z.ZodString;
2288
2072
  }, z.core.$strip>>;
2289
2073
  demandedRung: z.ZodOptional<z.ZodEnum<{
2290
- oracle: "oracle";
2291
2074
  "independent-model": "independent-model";
2075
+ oracle: "oracle";
2292
2076
  human: "human";
2293
2077
  }>>;
2294
2078
  epicIssue: z.ZodNumber;
@@ -2303,8 +2087,8 @@ declare const boundaryCheckProofSchema: z.ZodObject<{
2303
2087
  commentUrl: z.ZodOptional<z.ZodString>;
2304
2088
  producer: z.ZodString;
2305
2089
  rung: z.ZodEnum<{
2306
- oracle: "oracle";
2307
2090
  "independent-model": "independent-model";
2091
+ oracle: "oracle";
2308
2092
  human: "human";
2309
2093
  }>;
2310
2094
  sessionId: z.ZodOptional<z.ZodString>;
@@ -2320,26 +2104,18 @@ declare const boundaryCheckProofSchema: z.ZodObject<{
2320
2104
  value: z.ZodString;
2321
2105
  }, z.core.$strip>>;
2322
2106
  status: z.ZodEnum<{
2323
- blocked: "blocked";
2324
2107
  ready: "ready";
2108
+ blocked: "blocked";
2325
2109
  }>;
2326
2110
  }, z.core.$strip>;
2327
2111
  type BoundaryCheckProofRecord = z.infer<typeof boundaryCheckProofSchema>;
2328
2112
  //#endregion
2329
2113
  //#region src/boundary-check.d.ts
2330
- interface BoundaryPullRequestRef {
2331
- baseRefName?: string;
2332
- headRefOid?: string;
2333
- headRefName?: string;
2334
- mergeCommitOid?: string;
2335
- number: number;
2336
- state: "OPEN" | "CLOSED" | "MERGED";
2337
- }
2338
2114
  interface BoundaryCheckGithub {
2339
2115
  fetchIssueBody: (repo: string, issue: number) => string;
2340
2116
  fetchIssueComments: (repo: string, issue: number) => GithubIssueComment[];
2341
2117
  fetchClosingPullRequests: (repo: string, issue: number) => BoundaryPullRequestRef[];
2342
- fetchPullRequest: (repo: string, pr: number) => BoundaryPullRequestRef;
2118
+ fetchPullRequest?: (repo: string, pr: number) => BoundaryPullRequestRef;
2343
2119
  }
2344
2120
  interface BoundaryCheckArgs {
2345
2121
  cwd?: string;
@@ -2404,79 +2180,199 @@ declare const runDemandWaive: (args: DemandWaiveArgs, dependencies?: DemandWaive
2404
2180
  //#region src/commands/demand-waive.d.ts
2405
2181
  type DemandWaiveAction = (args: DemandWaiveArgs) => DemandWaiver;
2406
2182
  //#endregion
2407
- //#region src/hq-credentials.d.ts
2183
+ //#region src/hq-flush.d.ts
2184
+ /**
2185
+ * Spool locations this run did not drain because they sit under an earlier
2186
+ * key for this repository. Reported, never drained: draining an older key's
2187
+ * events is an operator decision, made with `--dir`.
2188
+ */
2189
+ interface HqFlushOrphans {
2190
+ orphans: HqSpoolOrphan[];
2191
+ }
2192
+ type HqFlushResult = (HqFlushOrphans & {
2193
+ reason: string;
2194
+ /**
2195
+ * Events still spooled when the command gave up. Non-zero means the
2196
+ * skip retained work: the exit status says so, and no caller may read
2197
+ * the skip as "there was nothing to do".
2198
+ */
2199
+ retained: number;
2200
+ status: "skipped";
2201
+ }) | (HqFlushOrphans & HqSpoolFlushSummary & {
2202
+ endpoint: string;
2203
+ status: "flushed";
2204
+ });
2205
+ //#endregion
2206
+ //#region src/pr-review.d.ts
2207
+ interface PrReviewArgs extends LoadProjectProfileInput {
2208
+ base: string;
2209
+ cycle: number;
2210
+ dispositions?: string;
2211
+ findings?: string;
2212
+ issue?: number;
2213
+ mode: PrReviewMode;
2214
+ output?: string;
2215
+ verifyProof?: string;
2216
+ }
2217
+ interface PrReviewGitDependencies {
2218
+ changedFiles: (cwd: string, base: string) => string[];
2219
+ currentHeadSha: (cwd: string) => string;
2220
+ isAncestor: (cwd: string, ancestor: string, descendant: string) => boolean;
2221
+ stablePatchId: (cwd: string, base: string) => string;
2222
+ statusPorcelain: (cwd: string) => string;
2223
+ }
2224
+ interface PrReviewDependencies {
2225
+ git?: PrReviewGitDependencies;
2226
+ hq?: HqIngestDependencies;
2227
+ }
2228
+ declare function runPrReview(args: PrReviewArgs, dependencies?: PrReviewDependencies): Promise<PrReviewProof>;
2229
+ declare namespace verification_proof_d_exports {
2230
+ export { PrVerifyBaselineFullProof, PrVerifyCommandResult, PrVerifyExecutedCommand, PrVerifyNotRequiredCommand, PrVerifyProof, PrVerifySchemaVersion, ResolvedPrVerifyMode, SUPPORTED_PR_VERIFY_SCHEMA_VERSIONS, VerificationHeadShas, VerificationProofState, VerifiedHeadShas, prVerifyFullHeadShasForDiff, prVerifyProofHeadShas, readPrVerifyProof, resolveVerifyProofApplicability, trustedImpactStamp, validatePrVerifyProof, verificationProofApplicabilityFor, verificationProofBlockingReason, verificationProofForReadiness, verificationProofStateFor, verifyProofIdentityMatches, verifyProofPassed };
2231
+ }
2232
+ interface VerifiedHeadShas {
2233
+ docsOnlyVerifiedHeadShas: string[];
2234
+ trivialVerifiedHeadShas: string[];
2235
+ verifiedHeadShas: string[];
2236
+ }
2237
+ type VerificationHeadShas = {
2238
+ explicitFailure: true;
2239
+ } | VerifiedHeadShas;
2240
+ declare function readPrVerifyProof(filePath: string): PrVerifyProof;
2241
+ declare const verifyProofPassed: (proof: PrVerifyProof) => boolean;
2242
+ declare const prVerifyProofHeadShas: (proof: PrVerifyProof | undefined, creditedHeadSha?: string) => VerifiedHeadShas;
2243
+ declare const verifyProofIdentityMatches: ({
2244
+ currentIdentity,
2245
+ proof
2246
+ }: {
2247
+ currentIdentity?: {
2248
+ patchId: string;
2249
+ mergeBaseSha?: string;
2250
+ };
2251
+ proof?: PrVerifyProof;
2252
+ }) => boolean;
2408
2253
  /**
2409
- * Why a reference did not resolve. Each value names a different remedy, and
2410
- * none of them can be inferred from a value-or-nothing result:
2254
+ * Wave-2 consumption (#542): the recorded impact stamp, released for demand
2255
+ * resolution ONLY when it is identity-bound to the current candidate — the
2256
+ * proof passed, and its recorded headSha AND patchId both name exactly this
2257
+ * candidate (the same identities the proof already binds). Everything else —
2258
+ * no proof, an aborted run, a stale head, a moved patch id, a pre-stamp proof
2259
+ * — returns `undefined`, and the consumer keeps today's full-demand floor.
2411
2260
  *
2412
- * - `resolver-missing` no secret-manager binary on PATH.
2413
- * - `resolver-blocked` a binary exists but this session may not execute it
2414
- * (a sandbox denying exec). The command belongs outside the sandbox.
2415
- * - `resolver-timeout` — the probe expired: a desktop agent waiting on an
2416
- * approval nobody can give here.
2417
- * - `resolver-refused` — the binary ran and produced no value. Its store is
2418
- * unreachable from this session (a sandbox with no keychain access) or the
2419
- * reference is not readable. These two stay one status on purpose: telling
2420
- * them apart would mean reading resolver output.
2261
+ * Deliberately stricter than verify-once applicability (which tolerates a
2262
+ * head-only or patch-id-only match): a stamp narrows external demands, so it
2263
+ * is trusted only on an exact double binding, fail closed.
2421
2264
  */
2422
- type SecretResolutionFailure = "resolver-blocked" | "resolver-missing" | "resolver-refused" | "resolver-timeout";
2423
- /** A structured resolution outcome. The value travels only when resolved. */
2424
- type SecretResolution = {
2425
- status: "resolved";
2426
- value: string;
2265
+ declare const trustedImpactStamp: ({
2266
+ candidate,
2267
+ proof
2268
+ }: {
2269
+ candidate: {
2270
+ headSha: string;
2271
+ patchId: string;
2272
+ };
2273
+ proof: PrVerifyProof | undefined;
2274
+ }) => ImpactStamp | undefined;
2275
+ declare const prVerifyFullHeadShasForDiff: ({
2276
+ docsOnlyDeltaAcceptedSince,
2277
+ files,
2278
+ proof
2279
+ }: {
2280
+ docsOnlyDeltaAcceptedSince?: (baselineHeadSha: string) => boolean;
2281
+ files: string[];
2282
+ proof: PrVerifyProof;
2283
+ }) => string[];
2284
+ type VerificationProofState = {
2285
+ kind: "typed-aborted";
2286
+ proof: PrVerifyProof;
2287
+ } | {
2288
+ kind: "typed-missing";
2289
+ path: string;
2290
+ reason: "enoent" | "invalid";
2291
+ message?: string;
2292
+ } | {
2293
+ kind: "typed";
2294
+ headShas: VerifiedHeadShas;
2295
+ proof: PrVerifyProof;
2296
+ } | {
2297
+ kind: "typed-diff-mismatch";
2298
+ mode: ResolvedPrVerifyMode;
2299
+ };
2300
+ declare const verificationProofStateFor: ({
2301
+ proof,
2302
+ proofMatchesCurrentDiff,
2303
+ proofPath
2304
+ }: {
2305
+ proof?: PrVerifyProof;
2306
+ proofMatchesCurrentDiff?: boolean;
2307
+ proofPath?: string;
2308
+ }) => VerificationProofState;
2309
+ declare const verificationProofApplicabilityFor: ({
2310
+ docsOnlyDeltaAcceptedSince,
2311
+ explicitProof,
2312
+ files,
2313
+ headSha,
2314
+ currentIdentity,
2315
+ proof,
2316
+ proofPath,
2317
+ proofReadError
2318
+ }: {
2319
+ docsOnlyDeltaAcceptedSince?: (baselineHeadSha: string) => boolean;
2320
+ explicitProof: boolean;
2321
+ files: string[];
2322
+ headSha: string;
2323
+ currentIdentity?: {
2324
+ patchId: string;
2325
+ mergeBaseSha?: string;
2326
+ };
2327
+ proof?: PrVerifyProof;
2328
+ proofPath?: string;
2329
+ proofReadError?: unknown;
2330
+ }) => {
2331
+ fullVerifiedHeadShas: never[];
2332
+ verificationProof: VerificationProofState;
2427
2333
  } | {
2428
- status: SecretResolutionFailure;
2334
+ fullVerifiedHeadShas: string[];
2335
+ verificationProof: {
2336
+ headShas: VerifiedHeadShas;
2337
+ kind: "typed";
2338
+ proof: PrVerifyProof;
2339
+ };
2429
2340
  };
2430
- /** Resolves a secret reference. Injected so tests stay offline. */
2431
- type SecretReferenceResolver = (reference: string) => SecretResolution;
2432
- //#endregion
2433
- //#region src/hq-flush.d.ts
2434
- /**
2435
- * Spool locations this run did not drain because they sit under an earlier
2436
- * key for this repository. Reported, never drained: draining an older key's
2437
- * events is an operator decision, made with `--dir`.
2438
- */
2439
- interface HqFlushOrphans {
2440
- orphans: HqSpoolOrphan[];
2441
- }
2442
- type HqFlushResult = (HqFlushOrphans & {
2443
- reason: string;
2444
- /**
2445
- * Events still spooled when the command gave up. Non-zero means the
2446
- * skip retained work: the exit status says so, and no caller may read
2447
- * the skip as "there was nothing to do".
2448
- */
2449
- retained: number;
2450
- status: "skipped";
2451
- }) | (HqFlushOrphans & HqSpoolFlushSummary & {
2452
- endpoint: string;
2453
- status: "flushed";
2454
- });
2455
- //#endregion
2456
- //#region src/pr-review.d.ts
2457
- interface PrReviewArgs extends LoadProjectProfileInput {
2458
- base: string;
2459
- cycle: number;
2460
- dispositions?: string;
2461
- findings?: string;
2462
- issue?: number;
2463
- mode: PrReviewMode;
2464
- output?: string;
2465
- verifyProof?: string;
2466
- }
2467
- interface PrReviewGitDependencies {
2468
- changedFiles: (cwd: string, base: string) => string[];
2469
- currentHeadSha: (cwd: string) => string;
2470
- isAncestor: (cwd: string, ancestor: string, descendant: string) => boolean;
2471
- stablePatchId: (cwd: string, base: string) => string;
2472
- statusPorcelain: (cwd: string) => string;
2473
- }
2474
- interface PrReviewDependencies {
2475
- git?: PrReviewGitDependencies;
2476
- hq?: HqIngestDependencies;
2477
- publishCheckRun?: (input: PublishFactoryCheckInput) => void;
2478
- }
2479
- declare function runPrReview(args: PrReviewArgs, dependencies?: PrReviewDependencies): Promise<PrReviewProof>;
2341
+ declare const resolveVerifyProofApplicability: ({
2342
+ proofPath,
2343
+ explicitProof,
2344
+ docsOnlyDeltaAcceptedSince,
2345
+ files,
2346
+ headSha,
2347
+ currentVerifyIdentityForBase,
2348
+ preread
2349
+ }: {
2350
+ proofPath: string;
2351
+ explicitProof: boolean;
2352
+ docsOnlyDeltaAcceptedSince?: (baselineHeadSha: string) => boolean;
2353
+ files: string[];
2354
+ headSha: string;
2355
+ currentVerifyIdentityForBase?: (base: string) => {
2356
+ patchId: string;
2357
+ mergeBaseSha?: string;
2358
+ };
2359
+ preread?: {
2360
+ proof?: PrVerifyProof;
2361
+ error?: unknown;
2362
+ };
2363
+ }) => {
2364
+ fullVerifiedHeadShas: never[];
2365
+ verificationProof: VerificationProofState;
2366
+ } | {
2367
+ fullVerifiedHeadShas: string[];
2368
+ verificationProof: {
2369
+ headShas: VerifiedHeadShas;
2370
+ kind: "typed";
2371
+ proof: PrVerifyProof;
2372
+ };
2373
+ };
2374
+ declare const verificationProofForReadiness: (state: VerificationProofState) => VerificationHeadShas;
2375
+ declare const verificationProofBlockingReason: (state: VerificationProofState) => string | undefined;
2480
2376
  //#endregion
2481
2377
  //#region src/workspace-install-resolution.d.ts
2482
2378
  interface CleanInstallResolutionDependencies {
@@ -2769,11 +2665,11 @@ declare const LegacyWorkerCloseoutStatusTraceEventSchema: z.ZodObject<{
2769
2665
  threadId: z.ZodOptional<z.ZodString>;
2770
2666
  workerId: z.ZodOptional<z.ZodString>;
2771
2667
  archiveStatus: z.ZodOptional<z.ZodEnum<{
2668
+ pending: "pending";
2772
2669
  unavailable: "unavailable";
2773
2670
  archived: "archived";
2774
2671
  skipped: "skipped";
2775
2672
  "not-applicable": "not-applicable";
2776
- pending: "pending";
2777
2673
  }>>;
2778
2674
  closeoutReason: z.ZodOptional<z.ZodString>;
2779
2675
  eventType: z.ZodLiteral<"worker-closeout-lessons">;
@@ -3164,11 +3060,11 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3164
3060
  threadId: z.ZodOptional<z.ZodString>;
3165
3061
  workerId: z.ZodOptional<z.ZodString>;
3166
3062
  archiveStatus: z.ZodOptional<z.ZodEnum<{
3063
+ pending: "pending";
3167
3064
  unavailable: "unavailable";
3168
3065
  archived: "archived";
3169
3066
  skipped: "skipped";
3170
3067
  "not-applicable": "not-applicable";
3171
- pending: "pending";
3172
3068
  }>>;
3173
3069
  closeoutReason: z.ZodOptional<z.ZodString>;
3174
3070
  eventType: z.ZodLiteral<"worker-closeout-lessons">;
@@ -3205,11 +3101,11 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3205
3101
  }, z.core.$strict>], "lessonStatus">;
3206
3102
  readonly 2: z.ZodObject<{
3207
3103
  archiveStatus: z.ZodOptional<z.ZodEnum<{
3104
+ pending: "pending";
3208
3105
  unavailable: "unavailable";
3209
3106
  archived: "archived";
3210
3107
  skipped: "skipped";
3211
3108
  "not-applicable": "not-applicable";
3212
- pending: "pending";
3213
3109
  }>>;
3214
3110
  closeoutReason: z.ZodOptional<z.ZodString>;
3215
3111
  lessonStatus: z.ZodOptional<z.ZodEnum<{
@@ -3327,8 +3223,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3327
3223
  interiorCycle: z.ZodOptional<z.ZodNumber>;
3328
3224
  observedAt: z.ZodString;
3329
3225
  purpose: z.ZodEnum<{
3330
- review: "review";
3331
3226
  code: "code";
3227
+ review: "review";
3332
3228
  }>;
3333
3229
  slotResolution: z.ZodObject<{
3334
3230
  effort: z.ZodEnum<{
@@ -3346,18 +3242,18 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3346
3242
  }>;
3347
3243
  model: z.ZodString;
3348
3244
  tier: z.ZodEnum<{
3245
+ oracle: "oracle";
3349
3246
  review: "review";
3350
3247
  delegate: "delegate";
3351
- oracle: "oracle";
3352
3248
  workhorse: "workhorse";
3353
3249
  scout: "scout";
3354
3250
  }>;
3355
3251
  }, z.core.$strict>;
3356
3252
  startedAt: z.ZodString;
3357
3253
  tier: z.ZodEnum<{
3254
+ oracle: "oracle";
3358
3255
  review: "review";
3359
3256
  delegate: "delegate";
3360
- oracle: "oracle";
3361
3257
  workhorse: "workhorse";
3362
3258
  scout: "scout";
3363
3259
  }>;
@@ -3406,8 +3302,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3406
3302
  interiorCycle: z.ZodOptional<z.ZodNumber>;
3407
3303
  observedAt: z.ZodString;
3408
3304
  purpose: z.ZodEnum<{
3409
- review: "review";
3410
3305
  code: "code";
3306
+ review: "review";
3411
3307
  }>;
3412
3308
  slotResolution: z.ZodObject<{
3413
3309
  effort: z.ZodEnum<{
@@ -3425,18 +3321,18 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3425
3321
  }>;
3426
3322
  model: z.ZodString;
3427
3323
  tier: z.ZodEnum<{
3324
+ oracle: "oracle";
3428
3325
  review: "review";
3429
3326
  delegate: "delegate";
3430
- oracle: "oracle";
3431
3327
  workhorse: "workhorse";
3432
3328
  scout: "scout";
3433
3329
  }>;
3434
3330
  }, z.core.$strict>;
3435
3331
  startedAt: z.ZodString;
3436
3332
  tier: z.ZodEnum<{
3333
+ oracle: "oracle";
3437
3334
  review: "review";
3438
3335
  delegate: "delegate";
3439
- oracle: "oracle";
3440
3336
  workhorse: "workhorse";
3441
3337
  scout: "scout";
3442
3338
  }>;
@@ -3476,8 +3372,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3476
3372
  interiorCycle: z.ZodOptional<z.ZodNumber>;
3477
3373
  observedAt: z.ZodString;
3478
3374
  purpose: z.ZodEnum<{
3479
- review: "review";
3480
3375
  code: "code";
3376
+ review: "review";
3481
3377
  }>;
3482
3378
  slotResolution: z.ZodObject<{
3483
3379
  effort: z.ZodEnum<{
@@ -3495,18 +3391,18 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3495
3391
  }>;
3496
3392
  model: z.ZodString;
3497
3393
  tier: z.ZodEnum<{
3394
+ oracle: "oracle";
3498
3395
  review: "review";
3499
3396
  delegate: "delegate";
3500
- oracle: "oracle";
3501
3397
  workhorse: "workhorse";
3502
3398
  scout: "scout";
3503
3399
  }>;
3504
3400
  }, z.core.$strict>;
3505
3401
  startedAt: z.ZodString;
3506
3402
  tier: z.ZodEnum<{
3403
+ oracle: "oracle";
3507
3404
  review: "review";
3508
3405
  delegate: "delegate";
3509
- oracle: "oracle";
3510
3406
  workhorse: "workhorse";
3511
3407
  scout: "scout";
3512
3408
  }>;
@@ -3549,17 +3445,17 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3549
3445
  exitCode: number | null;
3550
3446
  harness: string;
3551
3447
  observedAt: string;
3552
- purpose: "review" | "code";
3448
+ purpose: "code" | "review";
3553
3449
  slotResolution: {
3554
3450
  effort: "high" | "low" | "medium" | "xhigh";
3555
3451
  engine: string;
3556
3452
  layerSource: "committedDefault" | "operatorSession" | "userConfig";
3557
3453
  model: string;
3558
- tier: "review" | "delegate" | "oracle" | "workhorse" | "scout";
3454
+ tier: "oracle" | "review" | "delegate" | "workhorse" | "scout";
3559
3455
  fallbackTier?: "delegate" | undefined;
3560
3456
  };
3561
3457
  startedAt: string;
3562
- tier: "review" | "delegate" | "oracle" | "workhorse" | "scout";
3458
+ tier: "oracle" | "review" | "delegate" | "workhorse" | "scout";
3563
3459
  tokenUsage: {
3564
3460
  source: "cursor-csv" | "codex-json" | "cursor-json" | "claude-json";
3565
3461
  status: "available";
@@ -3693,74 +3589,6 @@ declare const scanFactoryTraceDiagnostics: ({
3693
3589
  repoRoot,
3694
3590
  to
3695
3591
  }: ScanFactoryTraceDiagnosticsOptions) => FactoryTraceDiagnostic[];
3696
- //#endregion
3697
- //#region src/interior-telemetry/gate-timing.d.ts
3698
- declare const GATE_TIMING_SCHEMA_VERSION = 1;
3699
- type FactoryGateName = "boundary:check" | "factory:closeout" | "pr:ready" | "pr:review" | "pr:verify";
3700
- type GateTimingOutcome = "fail" | "pass";
3701
- interface GateTimingRecord {
3702
- agentRunId: string;
3703
- cycle: number;
3704
- durationMs: number;
3705
- gate: FactoryGateName;
3706
- outcome: GateTimingOutcome;
3707
- schemaVersion: typeof GATE_TIMING_SCHEMA_VERSION;
3708
- startedAt: string;
3709
- startOffsetMs: number;
3710
- }
3711
- //#endregion
3712
- //#region src/retro-envelope-builder.d.ts
3713
- /**
3714
- * Folds a lane's gate-timing ledger (`.factory-memory/gate-timing/<id>.jsonl`,
3715
- * wave-1 PR #33) into a versioned retro envelope at `factory:closeout`.
3716
- *
3717
- * STRUCTURAL INVARIANT (#677 repeat-class rule; PR #35 review cycles 1-2):
3718
- * telemetry CONTENT can never fail the closeout build gate. Every value that
3719
- * reaches the envelope passes through one sanitization seam that makes the
3720
- * output valid BY CONSTRUCTION:
3721
- *
3722
- * - strings are clamped to their wire bounds (truncated, with a data gap when
3723
- * truncation lost information);
3724
- * - numbers must be finite and within plausibility bounds BEFORE any derived
3725
- * arithmetic; an absurd value (1e16 ms duration, year-9999 timestamp) SKIPS
3726
- * its record with a data gap rather than clamping, because clamping would
3727
- * assert a measurement that never happened;
3728
- * - arrays are bounded to their schema maxima (gates[] keeps the most recent);
3729
- * - derived computations (wall clock, cycles) consume only sanitized inputs,
3730
- * so no ledger content can push them outside Date/Number safe ranges.
3731
- *
3732
- * Terminal backstop: the assembled candidate goes through a final schema
3733
- * parse; if that still fails, a minimal-valid envelope (clamped identity,
3734
- * empty gates, a data gap naming the failure) is built and returned instead.
3735
- * `buildRetroEnvelope` therefore never throws for content — the closeout gate
3736
- * can only fail on filesystem errors when persisting.
3737
- */
3738
- interface BuildRetroEnvelopeInput {
3739
- agentRunId: string;
3740
- /** Optional pointer (key/URL) to #8's durable proof archive — never payload. */
3741
- archiveRef?: string;
3742
- dataGaps?: string[];
3743
- generatedAt: Date;
3744
- interventions?: number;
3745
- /** Per-family session identities the lane already records. */
3746
- joinKeys?: {
3747
- claudeSessionIds?: string[];
3748
- codexThreadIds?: string[];
3749
- };
3750
- /** The lane's gate-timing ledger records, in append order. */
3751
- ledger: GateTimingRecord[];
3752
- outcome?: RetroEnvelope["outcome"];
3753
- phases?: RetroEnvelope["phases"];
3754
- refs: RetroEnvelope["refs"];
3755
- repo: RetroEnvelope["repo"];
3756
- /**
3757
- * Token families. They may be absent when native session data is unavailable
3758
- * (valid does not imply available telemetry). When present they satisfy the
3759
- * family invariants.
3760
- */
3761
- tokenFamilies?: RetroEnvelope["tokenFamilies"];
3762
- }
3763
- declare const buildRetroEnvelope: (input: BuildRetroEnvelopeInput) => RetroEnvelope;
3764
3592
  declare namespace comment_provenance_d_exports {
3765
3593
  export { SHA_MATCH_MIN_LENGTH, isBotLogin, sameHeadSha };
3766
3594
  }
@@ -3770,18 +3598,12 @@ declare const sameHeadSha: (left: string, right: string) => boolean;
3770
3598
  //#endregion
3771
3599
  //#region src/doctor-hq-checks.d.ts
3772
3600
  /**
3773
- * Two `doctor` checks that make silent HQ delivery failure loud (#394,
3774
- * epic #389 wave 2).
3775
- *
3776
- * Both consume #414's structured credential resolution rather than inventing
3777
- * a second classification: a sandboxed session that cannot reach the
3778
- * keychain is reported as "cannot resolve credentials here", never as
3779
- * "credentials are wrong" or a silent pass. Both name `psf hq:flush` and
3780
- * `psf pr:publish` as the commands that need a trusted local session.
3601
+ * The `doctor` check that makes silent HQ delivery failure loud (#394,
3602
+ * epic #389 wave 2): the local spool is empty, and no stranded evidence is
3603
+ * waiting under the spool root.
3781
3604
  *
3782
- * Advisory stays advisory: neither check can block anything but doctor's own
3783
- * exit status (epic #389 design decision 4). Absent credentials make the
3784
- * remote check a skip with a printed reason, never a silent pass.
3605
+ * Advisory stays advisory: this check can block nothing but doctor's own exit
3606
+ * status (epic #389 design decision 4).
3785
3607
  */
3786
3608
  type DoctorCheckStatus = "error" | "ok" | "warning";
3787
3609
  interface DoctorCheck {
@@ -3793,12 +3615,6 @@ interface HqSpoolCheckDependencies {
3793
3615
  countSpool?: typeof countHqSpoolWork;
3794
3616
  sweepOrphans?: typeof sweepHqSpoolOrphans;
3795
3617
  }
3796
- interface HqRetroReadbackCheckDependencies {
3797
- fetch?: typeof fetch;
3798
- readFile?: typeof readFile;
3799
- resolve?: SecretReferenceResolver;
3800
- timeoutMs?: number;
3801
- }
3802
3618
  //#endregion
3803
3619
  //#region src/doctor.d.ts
3804
3620
  interface DoctorReport {
@@ -3817,8 +3633,6 @@ interface DoctorProjectProfileInput extends LoadProjectProfileInput {
3817
3633
  base?: string;
3818
3634
  env?: NodeJS.ProcessEnv;
3819
3635
  /** Test seam for the local HQ spool check (#394); production never sets this. */
3820
- hqRetroReadbackDependencies?: HqRetroReadbackCheckDependencies;
3821
- /** Test seam for the remote HQ retro-envelope read-back check (#394). */
3822
3636
  hqSpoolDependencies?: HqSpoolCheckDependencies;
3823
3637
  /**
3824
3638
  * Append the read-only admission checklist (#292): every requirement this
@@ -3907,102 +3721,6 @@ declare const renderPrBodySections: ({
3907
3721
  reviewProof?: PrReviewProof;
3908
3722
  verifyProof?: PrVerifyProof;
3909
3723
  }) => string;
3910
- declare namespace boundary_manifest_d_exports {
3911
- export { BOUNDARY_CLOSEOUT_DEFAULT_RUNG, BOUNDARY_MANIFEST_SCHEMA_VERSION, BoundaryManifest, BoundaryManifestExtraction, BoundaryManifestParse, FACTORY_BOUNDARY_FENCE_LANG, boundaryManifestSchema, closeoutRungFor, extractBoundaryManifestBlock, manifestContentHash, parseBoundaryManifest, rungMeetsMinimum, specContentHash };
3912
- }
3913
- declare const FACTORY_BOUNDARY_FENCE_LANG = "factory-boundary";
3914
- declare const BOUNDARY_MANIFEST_SCHEMA_VERSION = 1;
3915
- declare const BOUNDARY_CLOSEOUT_DEFAULT_RUNG: EvidenceReviewRung;
3916
- declare const rungMeetsMinimum: (rung: EvidenceReviewRung, minimum: EvidenceReviewRung) => boolean;
3917
- declare const boundaryManifestBaseSchema: z.ZodObject<{
3918
- boundary: z.ZodString;
3919
- closeout: z.ZodOptional<z.ZodObject<{
3920
- review: z.ZodEnum<{
3921
- oracle: "oracle";
3922
- "independent-model": "independent-model";
3923
- human: "human";
3924
- }>;
3925
- }, z.core.$loose>>;
3926
- declaredBy: z.ZodString;
3927
- integrationBranch: z.ZodOptional<z.ZodString>;
3928
- prs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
3929
- schemaVersion: z.ZodLiteral<1>;
3930
- topology: z.ZodEnum<{
3931
- flagged: "flagged";
3932
- "each-to-main": "each-to-main";
3933
- stacked: "stacked";
3934
- "each-to-epic": "each-to-epic";
3935
- }>;
3936
- waves: z.ZodArray<z.ZodObject<{
3937
- autoMerge: z.ZodOptional<z.ZodBoolean>;
3938
- issues: z.ZodArray<z.ZodNumber>;
3939
- name: z.ZodString;
3940
- review: z.ZodEnum<{
3941
- oracle: "oracle";
3942
- "independent-model": "independent-model";
3943
- human: "human";
3944
- }>;
3945
- }, z.core.$loose>>;
3946
- }, z.core.$loose>;
3947
- declare const boundaryManifestSchema: z.ZodObject<{
3948
- boundary: z.ZodString;
3949
- closeout: z.ZodOptional<z.ZodObject<{
3950
- review: z.ZodEnum<{
3951
- oracle: "oracle";
3952
- "independent-model": "independent-model";
3953
- human: "human";
3954
- }>;
3955
- }, z.core.$loose>>;
3956
- declaredBy: z.ZodString;
3957
- integrationBranch: z.ZodOptional<z.ZodString>;
3958
- prs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
3959
- schemaVersion: z.ZodLiteral<1>;
3960
- topology: z.ZodEnum<{
3961
- flagged: "flagged";
3962
- "each-to-main": "each-to-main";
3963
- stacked: "stacked";
3964
- "each-to-epic": "each-to-epic";
3965
- }>;
3966
- waves: z.ZodArray<z.ZodObject<{
3967
- autoMerge: z.ZodOptional<z.ZodBoolean>;
3968
- issues: z.ZodArray<z.ZodNumber>;
3969
- name: z.ZodString;
3970
- review: z.ZodEnum<{
3971
- oracle: "oracle";
3972
- "independent-model": "independent-model";
3973
- human: "human";
3974
- }>;
3975
- }, z.core.$loose>>;
3976
- }, z.core.$loose>;
3977
- type BoundaryManifest = z.infer<typeof boundaryManifestBaseSchema>;
3978
- type BoundaryManifestExtraction = {
3979
- ok: true;
3980
- blockText: string;
3981
- } | {
3982
- ok: false;
3983
- error: string;
3984
- };
3985
- declare const extractBoundaryManifestBlock: (issueBody: string) => BoundaryManifestExtraction;
3986
- declare const manifestContentHash: (blockText: string) => string;
3987
- declare const specContentHash: (issueBody: string) => string;
3988
- type BoundaryManifestParse = {
3989
- ok: true;
3990
- manifest: BoundaryManifest;
3991
- manifestHash: string;
3992
- } | {
3993
- ok: false;
3994
- error: string;
3995
- };
3996
- declare const parseBoundaryManifest: (issueBody: string) => BoundaryManifestParse;
3997
- declare const closeoutRungFor: (manifest: BoundaryManifest) => EvidenceReviewRung;
3998
- //#endregion
3999
- //#region src/demand-resolution.d.ts
4000
- /** The boundary-manifest wave demand that applies to one pull request. */
4001
- interface WaveReviewDemand {
4002
- autoMerge: boolean;
4003
- review: EvidenceReviewRung;
4004
- wave: string;
4005
- }
4006
3724
  declare namespace readiness_evaluation_d_exports {
4007
3725
  export { CORRECTNESS_UNTYPED_REVIEW_BLOCKER_REASON, DRAFT_BLOCKER_REASON, EvaluationInput, ManagedReadinessLedger, PENDING_CHECKS_BLOCKER_REASON_PREFIX, READINESS_REPAIR_CODES, ReadinessRepair, ReadinessStatus, SCHEMA_VERSION, SECURITY_UNTYPED_REVIEW_BLOCKER_REASON, evaluateReadiness, managedReadinessLedgerSchema, readinessExitCode, readinessRepairSchema, validateManagedReadinessLedger };
4008
3726
  }
@@ -4054,12 +3772,12 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
4054
3772
  ledger: {
4055
3773
  baseSha: string;
4056
3774
  blockingReasons: string[];
4057
- classification: "trivial" | "docs/process-only" | "non-trivial";
3775
+ classification: "docs/process-only" | "trivial" | "non-trivial";
4058
3776
  github: {
4059
3777
  draft: boolean;
4060
3778
  mergeStateStatus: string;
4061
3779
  mergeable: string;
4062
- requiredChecks: "unknown" | "pending" | "passed" | "failed" | "none";
3780
+ requiredChecks: "unknown" | "passed" | "failed" | "pending" | "none";
4063
3781
  unresolvedReviewThreads: number;
4064
3782
  reviewDecision?: string | null | undefined;
4065
3783
  };
@@ -4074,13 +3792,13 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
4074
3792
  reviews: {
4075
3793
  correctness: {
4076
3794
  required: boolean;
4077
- status: "blocked" | "not-required" | "stale" | "current" | "missing";
3795
+ status: "stale" | "blocked" | "not-required" | "current" | "missing";
4078
3796
  reviewedHeadSha?: string | undefined;
4079
3797
  reviewedPatchId?: string | undefined;
4080
3798
  };
4081
3799
  security?: {
4082
3800
  required: boolean;
4083
- status: "blocked" | "not-required" | "stale" | "current" | "missing";
3801
+ status: "stale" | "blocked" | "not-required" | "current" | "missing";
4084
3802
  reviewedHeadSha?: string | undefined;
4085
3803
  reviewedPatchId?: string | undefined;
4086
3804
  } | undefined;
@@ -4103,7 +3821,7 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
4103
3821
  status: "satisfied" | "unmet" | "out-of-scope";
4104
3822
  reason?: string | undefined;
4105
3823
  scope?: {
4106
- classifications: ("trivial" | "docs/process-only" | "non-trivial")[];
3824
+ classifications: ("docs/process-only" | "trivial" | "non-trivial")[];
4107
3825
  } | undefined;
4108
3826
  }[] | undefined;
4109
3827
  mergeBaseSha?: string | undefined;
@@ -4652,4 +4370,4 @@ interface CreateProgramOptions {
4652
4370
  declare function createProgram(options?: CreateProgramOptions): Command;
4653
4371
  declare function run(argv?: string[]): Promise<void>;
4654
4372
  //#endregion
4655
- export { type AppendFactoryTraceEventResult, type AssembledReviewPrompt, type BatteryCommandDisposition, type BatteryDisposition, type BoundaryCheckArgs, type BoundaryCheckDependencies, type BoundaryCheckProofRecord, type BuildEpicStructureEventInput, type BuildRetroEnvelopeInput, type CloudflareAccessServiceToken, CreateProgramOptions, DEFAULT_DEMAND_WAIVER_PATH, DEFAULT_FACTORY_REPOSITORY, type DagDocument, type DemandWaiveArgs, type DemandWaiveDependencies, DemandWaiveRefusalError, type DemandWaiver, type DemandWaiverStore, EPIC_STRUCTURE_NODE_STATUSES, EPIC_STRUCTURE_SCHEMA_VERSION, type EpicStructureEvent, type EpicStructureGraphPayload, type EpicStructureNodeStatus, EpicStructureValidationError, type EvidenceEmitArgs, type EvidenceEmitDependencies, type EvidenceEmitResult, type FactoryCliInvocation, FactoryCliInvocationSchema, type FactoryProjectProfile, type FactoryTraceDiagnostic, type FactoryTraceEnvelope, type FactoryTraceEvent, type FindingDisposition, type FindingLedgerEntry, type FollowUpAction, FollowUpActionSchema, type ImpactScopeDecision, type ImpactScopeSurface, type IssueReviewFocus, type LadderDispositionDeclaration, MERGE_FREEZE_APP_SLUG, MERGE_FREEZE_CHECK_NAME, type MergeFreezeState, type ParsedRetroEnvelope, type PrPublishArgs, type PrPublishDependencies, PrPublishFollowUpError, type PrPublishFollowUpOutcome, type PrPublishHandoff, type PrPublishResult, type PrReadyArgs, type PrReadyProof, type PreviewDisposition, type PreviewLifecyclePlan, type PreviewTargetPlan, type PublishEpicStructureArgs, type PublishEpicStructureResult, type PublishFollowUpPlan, RETRO_ENVELOPE_SCHEMA_VERSION, RETRO_ENVELOPE_VALIDATORS, REVIEW_FOCUS_SECTION, type RetroEnvelope, type ReviewGateNotRequiredProof, type ReviewGateTraceIdentity, type ReviewLadderCycle, type ReviewLadderEvaluation, type ReviewLadderPolicy, type ReviewLadderStageEvent, type ReviewLadderTraceIdentity, type ReviewPromptSection, type ReviewPromptSectionProvenance, SUPPORTED_RETRO_ENVELOPE_SCHEMA_VERSIONS, type ScanFactoryTraceDiagnosticsOptions, type ScanFactoryTraceOptions, type ScanFactoryTraceResult, type ScopedOutCommand, type TraceMirrorDiagnostic, type TraceSink, type TraceWriteResult, type TraceWriteSinks, type VerificationBatteryPlan, type VerificationReuse, type WaivedDemand, WorkerCheckoutGuardError, type WorkerCloseoutLessonsTraceEvent, appendReviewLadderStageTraceEvent, appendWithTraceSinks, applyDemandWaiver, assembleReviewPrompt, assertWorkerCheckoutAllowed, authorizeDemandWaiver, batteryScopeSummaryLines, blockingLadderFindings, boundary_manifest_d_exports as boundaryManifest, boundary_review_proof_d_exports as boundaryReviewProof, buildEpicStructureEvent, buildEpicStructurePayload, buildEvidenceEnvelope, buildRetroEnvelope, buildReviewGateNotRequiredTraceEvent, buildReviewLadderStageTraceEvent, comment_provenance_d_exports as commentProvenance, createLocalJsonlTraceSink, createProgram, doctorProjectProfile, epicStructureEventId, evaluateReviewLadder, evidenceEnvelopeFilename, findingKey, followUpFromArgv, impactStampScopeDecision, inferFixedInThreadDispositions, isProductionHqUrl, isRetroEnvelopeWireComplete, loadProjectProfile, normalizeIssueComments, openLadderFindings, parseRetroEnvelope, planPreviewLifecycle, planPublishFollowUp, planVerificationBattery, readiness_evaluation_d_exports as prReadinessEvaluation, external_evidence_d_exports as prReadinessExternalEvidence, pr_body_renderer_d_exports as prReadinessPrBodyRenderer, proof_identity_d_exports as prReadinessProofIdentity, review_proof_d_exports as prReadinessReviewProof, status_check_rollup_d_exports as prReadinessStatusChecks, verification_proof_d_exports as prReadinessVerificationProof, previewLifecycleTargets, publishEpicStructure, readDemandWaivers, readPrReadyProof, readPrReviewProof, resolveFactoryRepository, resolveFindingBlocking, resolveReviewFindingCategory, resolveReviewFindingSeverity, resolveReviewLadderPolicy, resolveTraceWriteSinks, retroEnvelopeSchemaVersionOf, retroEnvelopeV1Schema, retroEpicReference, reviewCycleStateFor, reviewFocusFromIssueBody, reviewPromptSectionSchema, reviewPromptSectionsSchema, run, runBoundaryCheck, runDemandWaive, runEvidenceEmit, runPrPublish, runPrReady, runPrReview, runPrVerify, scanFactoryTraceDiagnostics, scanFactoryTraceEvents, selectWaiversForCandidate, staleRepeatLadderFindings, toFactoryTraceEnvelope, tryAppendReviewGateNotRequiredTraceEvent, tryAppendReviewLadderStageTraceEvent, validateBoundaryCheckProof, validateDagDocument, validateDemandWaiverStore, validateFactoryTraceEvent, validateMergeFreezeState, validatePrReadyProof, validatePrReviewProof, validatePrVerifyProof, waivedDemandNotice, waivedDemandSchema, worktree_scratch_files_d_exports as worktreeScratchFiles };
4373
+ export { type AppendFactoryTraceEventResult, type AssembledReviewPrompt, type BatteryCommandDisposition, type BatteryDisposition, type BoundaryCheckArgs, type BoundaryCheckDependencies, type BoundaryCheckProofRecord, type BuildEpicStructureEventInput, type CloudflareAccessServiceToken, CreateProgramOptions, DEFAULT_DEMAND_WAIVER_PATH, DEFAULT_FACTORY_REPOSITORY, type DagDocument, type DemandWaiveArgs, type DemandWaiveDependencies, DemandWaiveRefusalError, type DemandWaiver, type DemandWaiverStore, EPIC_STRUCTURE_NODE_STATUSES, EPIC_STRUCTURE_SCHEMA_VERSION, type EpicStructureEvent, type EpicStructureGraphPayload, type EpicStructureNodeStatus, EpicStructureValidationError, type EvidenceEmitArgs, type EvidenceEmitDependencies, type EvidenceEmitResult, type FactoryCliInvocation, FactoryCliInvocationSchema, type FactoryProjectProfile, type FactoryTraceDiagnostic, type FactoryTraceEnvelope, type FactoryTraceEvent, type FindingDisposition, type FindingLedgerEntry, type FollowUpAction, FollowUpActionSchema, type ImpactScopeDecision, type ImpactScopeSurface, type IssueReviewFocus, type LadderDispositionDeclaration, MERGE_FREEZE_APP_SLUG, MERGE_FREEZE_CHECK_NAME, type MergeFreezeState, type PrPublishArgs, type PrPublishDependencies, PrPublishFollowUpError, type PrPublishFollowUpOutcome, type PrPublishHandoff, type PrPublishResult, type PrReadyArgs, type PrReadyProof, type PreviewDisposition, type PreviewLifecyclePlan, type PreviewTargetPlan, type PublishEpicStructureArgs, type PublishEpicStructureResult, type PublishFollowUpPlan, REVIEW_FOCUS_SECTION, type ReviewGateNotRequiredProof, type ReviewGateTraceIdentity, type ReviewLadderCycle, type ReviewLadderEvaluation, type ReviewLadderPolicy, type ReviewLadderStageEvent, type ReviewLadderTraceIdentity, type ReviewPromptSection, type ReviewPromptSectionProvenance, type ScanFactoryTraceDiagnosticsOptions, type ScanFactoryTraceOptions, type ScanFactoryTraceResult, type ScopedOutCommand, type TraceMirrorDiagnostic, type TraceSink, type TraceWriteResult, type TraceWriteSinks, type VerificationBatteryPlan, type VerificationReuse, type WaivedDemand, WorkerCheckoutGuardError, type WorkerCloseoutLessonsTraceEvent, appendReviewLadderStageTraceEvent, appendWithTraceSinks, applyDemandWaiver, assembleReviewPrompt, assertWorkerCheckoutAllowed, authorizeDemandWaiver, batteryScopeSummaryLines, blockingLadderFindings, boundary_manifest_d_exports as boundaryManifest, boundary_review_proof_d_exports as boundaryReviewProof, buildEpicStructureEvent, buildEpicStructurePayload, buildEvidenceEnvelope, buildReviewGateNotRequiredTraceEvent, buildReviewLadderStageTraceEvent, comment_provenance_d_exports as commentProvenance, createLocalJsonlTraceSink, createProgram, doctorProjectProfile, epicStructureEventId, evaluateReviewLadder, evidenceEnvelopeFilename, findingKey, followUpFromArgv, impactStampScopeDecision, inferFixedInThreadDispositions, isProductionHqUrl, loadProjectProfile, normalizeIssueComments, openLadderFindings, planPreviewLifecycle, planPublishFollowUp, planVerificationBattery, readiness_evaluation_d_exports as prReadinessEvaluation, external_evidence_d_exports as prReadinessExternalEvidence, pr_body_renderer_d_exports as prReadinessPrBodyRenderer, proof_identity_d_exports as prReadinessProofIdentity, review_proof_d_exports as prReadinessReviewProof, status_check_rollup_d_exports as prReadinessStatusChecks, verification_proof_d_exports as prReadinessVerificationProof, previewLifecycleTargets, publishEpicStructure, readDemandWaivers, readPrReadyProof, readPrReviewProof, resolveFactoryRepository, resolveFindingBlocking, resolveReviewFindingCategory, resolveReviewFindingSeverity, resolveReviewLadderPolicy, resolveTraceWriteSinks, reviewCycleStateFor, reviewFocusFromIssueBody, reviewPromptSectionSchema, reviewPromptSectionsSchema, run, runBoundaryCheck, runDemandWaive, runEvidenceEmit, runPrPublish, runPrReady, runPrReview, runPrVerify, scanFactoryTraceDiagnostics, scanFactoryTraceEvents, selectWaiversForCandidate, staleRepeatLadderFindings, toFactoryTraceEnvelope, tryAppendReviewGateNotRequiredTraceEvent, tryAppendReviewLadderStageTraceEvent, validateBoundaryCheckProof, validateDagDocument, validateDemandWaiverStore, validateFactoryTraceEvent, validateMergeFreezeState, validatePrReadyProof, validatePrReviewProof, validatePrVerifyProof, waivedDemandNotice, waivedDemandSchema, worktree_scratch_files_d_exports as worktreeScratchFiles };