@patronage/software-factory 1.0.0-alpha.22 → 1.0.0-alpha.24

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
@@ -17,8 +17,8 @@ declare const boundaryManifestBaseSchema: z.ZodObject<{
17
17
  boundary: z.ZodString;
18
18
  closeout: z.ZodOptional<z.ZodObject<{
19
19
  review: z.ZodEnum<{
20
- oracle: "oracle";
21
20
  "independent-model": "independent-model";
21
+ oracle: "oracle";
22
22
  human: "human";
23
23
  }>;
24
24
  }, z.core.$loose>>;
@@ -26,8 +26,8 @@ declare const boundaryManifestBaseSchema: z.ZodObject<{
26
26
  integrationBranch: z.ZodOptional<z.ZodString>;
27
27
  schemaVersion: z.ZodLiteral<1>;
28
28
  topology: z.ZodEnum<{
29
- flagged: "flagged";
30
29
  "each-to-main": "each-to-main";
30
+ flagged: "flagged";
31
31
  stacked: "stacked";
32
32
  "each-to-epic": "each-to-epic";
33
33
  }>;
@@ -36,8 +36,8 @@ declare const boundaryManifestBaseSchema: z.ZodObject<{
36
36
  issues: z.ZodArray<z.ZodNumber>;
37
37
  name: z.ZodString;
38
38
  review: z.ZodEnum<{
39
- oracle: "oracle";
40
39
  "independent-model": "independent-model";
40
+ oracle: "oracle";
41
41
  human: "human";
42
42
  }>;
43
43
  }, z.core.$loose>>;
@@ -46,8 +46,8 @@ declare const boundaryManifestSchema: z.ZodObject<{
46
46
  boundary: z.ZodString;
47
47
  closeout: z.ZodOptional<z.ZodObject<{
48
48
  review: z.ZodEnum<{
49
- oracle: "oracle";
50
49
  "independent-model": "independent-model";
50
+ oracle: "oracle";
51
51
  human: "human";
52
52
  }>;
53
53
  }, z.core.$loose>>;
@@ -55,8 +55,8 @@ declare const boundaryManifestSchema: z.ZodObject<{
55
55
  integrationBranch: z.ZodOptional<z.ZodString>;
56
56
  schemaVersion: z.ZodLiteral<1>;
57
57
  topology: z.ZodEnum<{
58
- flagged: "flagged";
59
58
  "each-to-main": "each-to-main";
59
+ flagged: "flagged";
60
60
  stacked: "stacked";
61
61
  "each-to-epic": "each-to-epic";
62
62
  }>;
@@ -65,8 +65,8 @@ declare const boundaryManifestSchema: z.ZodObject<{
65
65
  issues: z.ZodArray<z.ZodNumber>;
66
66
  name: z.ZodString;
67
67
  review: z.ZodEnum<{
68
- oracle: "oracle";
69
68
  "independent-model": "independent-model";
69
+ oracle: "oracle";
70
70
  human: "human";
71
71
  }>;
72
72
  }, z.core.$loose>>;
@@ -151,8 +151,8 @@ declare const boundaryReviewProofBaseSchema: z.ZodObject<{
151
151
  }>;
152
152
  producer: z.ZodString;
153
153
  rung: z.ZodEnum<{
154
- oracle: "oracle";
155
154
  "independent-model": "independent-model";
155
+ oracle: "oracle";
156
156
  human: "human";
157
157
  }>;
158
158
  schemaVersion: z.ZodLiteral<1>;
@@ -195,8 +195,8 @@ declare const boundaryReviewProofSchema: z.ZodObject<{
195
195
  }>;
196
196
  producer: z.ZodString;
197
197
  rung: z.ZodEnum<{
198
- oracle: "oracle";
199
198
  "independent-model": "independent-model";
199
+ oracle: "oracle";
200
200
  human: "human";
201
201
  }>;
202
202
  schemaVersion: z.ZodLiteral<1>;
@@ -472,165 +472,529 @@ declare function sweepHqSpoolOrphans(input: {
472
472
  env?: NodeJS.ProcessEnv;
473
473
  }): Promise<HqSpoolOrphanSweep>;
474
474
  //#endregion
475
- //#region src/demand-waiver.d.ts
476
- declare const DEFAULT_DEMAND_WAIVER_PATH = ".factory-memory/demand-waivers.json";
477
- /** One recorded operator act: this demand, on this candidate, waived. */
478
- interface DemandWaiver {
479
- candidate: {
480
- headSha: string;
481
- pr: number;
475
+ //#region src/packages/review-prompt-sections/schema.d.ts
476
+ declare const reviewPromptSectionSchema: z.ZodObject<{
477
+ provenance: z.ZodEnum<{
478
+ "coding-standards": "coding-standards";
479
+ "prior-review-ledger": "prior-review-ledger";
480
+ "issue-review-focus": "issue-review-focus";
481
+ }>;
482
+ source: z.ZodString;
483
+ text: z.ZodString;
484
+ }, z.core.$strict>;
485
+ type ReviewPromptSection = z.infer<typeof reviewPromptSectionSchema>;
486
+ type ReviewPromptSectionProvenance = ReviewPromptSection["provenance"];
487
+ declare const reviewPromptSectionsSchema: z.ZodArray<z.ZodObject<{
488
+ provenance: z.ZodEnum<{
489
+ "coding-standards": "coding-standards";
490
+ "prior-review-ledger": "prior-review-ledger";
491
+ "issue-review-focus": "issue-review-focus";
492
+ }>;
493
+ source: z.ZodString;
494
+ text: z.ZodString;
495
+ }, z.core.$strict>>;
496
+ //#endregion
497
+ //#region src/review-ladder-policy.d.ts
498
+ type ReviewFindingSeverity = "critical" | "high" | "medium" | "low" | "unknown";
499
+ type ReviewFindingCategory = "correctness" | "safety" | "coordination" | "maintainability" | "unknown";
500
+ declare const REVIEW_SEVERITIES: readonly ["critical", "high", "medium", "low", "unknown"];
501
+ declare const resolveReviewFindingSeverity: (priority?: string) => ReviewFindingSeverity;
502
+ declare const resolveReviewFindingCategory: (category?: string) => ReviewFindingCategory;
503
+ declare const FINDING_DISPOSITIONS: readonly ["open", "fixed-in-thread", "follow-up-filed", "waived", "stale-repeat", "rerun-noise"];
504
+ type FindingDisposition = (typeof FINDING_DISPOSITIONS)[number];
505
+ interface ReviewFindingAttributes {
506
+ blockingAfterCap?: boolean;
507
+ category?: string;
508
+ citedSpan?: string;
509
+ file?: string;
510
+ prescribedAction?: string;
511
+ priority?: string;
512
+ supersedes?: {
513
+ file?: string;
514
+ title: string;
482
515
  };
483
- demand: string;
484
- /** The authenticated GitHub account that recorded the waiver. */
485
- operator: string;
486
- rationale: string;
487
- recordedAt: string;
488
- /** Optional audit metadata; never waiver authority. */
489
- session?: string;
516
+ title: string;
490
517
  }
491
- interface DemandWaiverStore {
492
- command: "patronage-factory demand:waive";
493
- schemaVersion: 1;
494
- waivers: DemandWaiver[];
518
+ type BlockingResolvableFinding = Pick<ReviewFindingAttributes, "blockingAfterCap" | "category" | "priority">;
519
+ declare const resolveFindingBlocking: (finding: BlockingResolvableFinding, disposition?: FindingDisposition) => boolean;
520
+ interface ReviewLadderPolicy {
521
+ gate: {
522
+ cap: number;
523
+ };
524
+ interior: {
525
+ cap: number;
526
+ };
495
527
  }
496
- declare const validateDemandWaiverStore: (value: unknown) => DemandWaiverStore;
497
- /**
498
- * A demand that was in force, was NOT met, and was waived by the operator.
499
- *
500
- * `unmetReasons` is required and non-empty: every reason the demand refused is
501
- * carried through verbatim. There is no field on this record that could say
502
- * "satisfied", and no code path constructs one without a refusal to carry.
503
- */
504
- interface WaivedDemand {
505
- demand: string;
506
- operator: string;
507
- rationale: string;
508
- recordedAt: string;
509
- session?: string;
510
- /** The demand's refusals at evaluation time, preserved verbatim. */
511
- unmetReasons: string[];
528
+ declare const resolveReviewLadderPolicy: () => ReviewLadderPolicy;
529
+ //#endregion
530
+ //#region src/review-ladder-ledger.d.ts
531
+ type LadderCycleStage = "interior" | "gate";
532
+ interface LadderCycleRef {
533
+ cycle: number;
534
+ stage: LadderCycleStage;
512
535
  }
513
- declare const waivedDemandSchema: z.ZodType<WaivedDemand>;
514
- /** The waivers that bind one candidate: same PR, same head. */
515
- declare const selectWaiversForCandidate: ({
516
- headSha,
517
- pr,
518
- waivers
519
- }: {
520
- headSha: string | undefined;
521
- pr: number;
522
- waivers: readonly DemandWaiver[];
523
- }) => DemandWaiver[];
524
- interface DemandOutcome {
525
- blockingReasons: string[];
526
- waived?: WaivedDemand;
536
+ type LadderFindingReport = ReviewFindingAttributes;
537
+ type DeclarableFindingDisposition = Exclude<FindingDisposition, "open" | "stale-repeat" | "rerun-noise">;
538
+ interface LadderDispositionDeclaration {
539
+ disposition: DeclarableFindingDisposition;
540
+ finding: {
541
+ file?: string;
542
+ title: string;
543
+ };
544
+ findingReport?: LadderFindingReport;
545
+ reference?: string;
527
546
  }
528
- /**
529
- * Fold one resolved demand's refusals through the operator's waivers.
530
- *
531
- * A satisfied demand (no refusals) stays satisfied and the waiver stays inert
532
- * — a waiver can only ever move a demand from *unmet-and-blocking* to
533
- * *unmet-and-waived*, never to met.
534
- */
535
- declare const applyDemandWaiver: ({
536
- demand,
537
- reasons,
538
- waivers
539
- }: {
540
- demand: string;
541
- reasons: readonly string[];
542
- waivers: readonly DemandWaiver[];
543
- }) => DemandOutcome;
544
- /** How a waived demand reads to a human. Never the word "satisfied". */
545
- declare const waivedDemandNotice: (waived: WaivedDemand) => string;
546
- interface DemandWaiverAuthorization {
547
- operator: string;
548
- session?: string;
547
+ interface FindingLedgerEntry extends ReviewFindingAttributes {
548
+ disposition: FindingDisposition;
549
+ firstFlagged: LadderCycleRef;
550
+ flagCount: number;
551
+ key: string;
552
+ lastFlagged: LadderCycleRef;
553
+ priorDisposition?: FindingDisposition;
554
+ reference?: string;
555
+ reopenedCount: number;
556
+ staleRepeatCount: number;
549
557
  }
550
- type AuthorizeDemandWaiverResult = {
551
- authorization: DemandWaiverAuthorization;
552
- refusals?: undefined;
553
- } | {
554
- authorization?: undefined;
555
- refusals: string[];
556
- };
557
- /**
558
- * Operator identity, `declaredBy`-style: a named human account, recorded on
559
- * the waiver and enforced here. Session is optional audit metadata only: it is
560
- * not credential-backed, so its absence or equality never authorizes or
561
- * refuses an operator act.
562
- */
563
- declare const authorizeDemandWaiver: ({
564
- authenticatedLogin,
565
- session
566
- }: {
567
- authenticatedLogin: string | undefined;
568
- session: string | undefined;
569
- }) => AuthorizeDemandWaiverResult;
570
- //#endregion
571
- //#region src/blocked-reasons.d.ts
572
- declare const blockedReasonSchema: z.ZodObject<{
573
- code: z.ZodString;
574
- detail: z.ZodString;
575
- }, z.core.$strip>;
576
- type BlockedReason = z.infer<typeof blockedReasonSchema>;
558
+ declare const findingKey: (finding: {
559
+ citedSpan?: string;
560
+ file?: string;
561
+ prescribedAction?: string;
562
+ title?: string;
563
+ }) => string;
564
+ declare const openLadderFindings: (ledger: FindingLedgerEntry[]) => FindingLedgerEntry[];
565
+ declare const blockingLadderFindings: (ledger: FindingLedgerEntry[]) => FindingLedgerEntry[];
566
+ declare const staleRepeatLadderFindings: (ledger: FindingLedgerEntry[]) => FindingLedgerEntry[];
567
+ declare const inferFixedInThreadDispositions: (ledger: FindingLedgerEntry[], findings: readonly LadderFindingReport[], options?: {
568
+ sameHeadAsPriorCycle?: boolean;
569
+ }) => LadderDispositionDeclaration[];
577
570
  //#endregion
578
- //#region src/arm-auto-merge.d.ts
579
- interface ArmAutoMergeInput {
580
- cwd: string;
581
- /** The validated PR head this arming is a compare-and-set against. */
582
- headSha: string;
583
- owner: string;
584
- pr: number;
585
- repo: string;
571
+ //#region src/review-ladder.d.ts
572
+ type ReviewLadderExecutedStage = "interior" | "gate";
573
+ interface LadderSessionAttribution {
574
+ orchestrationMode?: "autonomous" | "manual";
575
+ resumedSession?: boolean;
576
+ runtime?: string;
577
+ sessionId?: string;
586
578
  }
587
- /**
588
- * What the PR actually did, read back after the call — never inferred from the
589
- * exit code. `not-armed` is a failure: the candidate is admitted but nothing
590
- * will merge it, so it carries the detail and `pr:ready` emits a re-dispatch.
591
- */
592
- interface ArmAutoMergeOutcome {
593
- /** Why the arming did not take effect, or what the invocation reported. */
594
- detail?: string;
595
- headSha: string;
596
- outcome: "armed" | "merged" | "not-armed";
579
+ interface LadderUsageReport {
580
+ estimatedCostUsd?: number;
581
+ source?: string;
582
+ totalTokens?: number;
597
583
  }
598
- //#endregion
599
- //#region src/checkout-repository.d.ts
600
- interface CheckoutRepository {
601
- name: string;
602
- owner: string;
584
+ interface ReviewLadderCycle {
585
+ dispositions?: LadderDispositionDeclaration[];
586
+ engine?: string;
587
+ findings: LadderFindingReport[];
588
+ identity?: {
589
+ headSha: string;
590
+ patchId: string;
591
+ };
592
+ model?: string;
593
+ correlatedRerun?: boolean;
594
+ session?: LadderSessionAttribution;
595
+ stage: LadderCycleStage;
596
+ usage?: LadderUsageReport;
603
597
  }
604
- //#endregion
605
- //#region src/follow-up.d.ts
606
- interface FactoryCliInvocation {
607
- /** Runtime arguments ending with the factory CLI entry module. */
608
- argvPrefix: string[];
609
- executable: string;
598
+ interface LadderInteriorCapTransition {
599
+ cap: number;
600
+ kind: "interior-cap-reached";
610
601
  }
611
- declare const FactoryCliInvocationSchema: z.ZodType<FactoryCliInvocation>;
612
- interface FollowUpAction {
613
- /**
614
- * Machine-safe argv-style array for the obvious next action, e.g.
615
- * ["gh","pr","merge","513","--squash"]. Same shape and field name that
616
- * `factory:delegate --print` emits, so an orchestrating agent can spawn the
617
- * next command without reconstructing a shell string. argv[0] is the
618
- * executable; the rest are literal, already-split arguments.
619
- */
620
- argv: string[];
621
- /**
622
- * Human-readable rendering of {@link argv} for logs and operators. Additive
623
- * to argv, never a substitute for it — argv is the source of truth.
624
- */
625
- command: string;
602
+ interface LadderGateCapTransition {
603
+ blockingFindings: string[];
604
+ cap: number;
605
+ kind: "gate-cap-exhausted";
606
+ }
607
+ type LadderForcedTransition = LadderGateCapTransition | LadderInteriorCapTransition;
608
+ interface LadderRunInteriorCycleAction {
609
+ cycle: number;
610
+ kind: "run-interior-cycle";
611
+ }
612
+ type LadderGateNextAction = {
613
+ cycle: number;
614
+ kind: "run-gate-cycle";
615
+ } | {
616
+ kind: "accept-nonblocking-findings";
617
+ } | {
618
+ kind: "escalate-to-triage";
619
+ } | {
620
+ kind: "ready-for-human";
621
+ };
622
+ type LadderPosition = {
623
+ forcedTransition?: LadderGateCapTransition;
624
+ nextAction: LadderGateNextAction;
625
+ stage: "gate";
626
+ } | {
627
+ forcedTransition?: LadderInteriorCapTransition;
628
+ nextAction: {
629
+ kind: "advance-to-gate";
630
+ };
631
+ stage: "interior-complete";
632
+ } | {
633
+ forcedTransition?: never;
634
+ nextAction: LadderRunInteriorCycleAction;
635
+ stage: "interior";
636
+ };
637
+ type LadderNextAction = LadderPosition["nextAction"];
638
+ type ReviewLadderStage = LadderPosition["stage"];
639
+ interface ReviewLadderStageEvent {
640
+ cycle: number;
641
+ cyclesToClean?: number;
642
+ engine?: string;
643
+ findingsSummary: {
644
+ blocking: number;
645
+ bySeverity: Record<ReviewFindingSeverity, number>;
646
+ flagged: number;
647
+ open: number;
648
+ staleRepeats: number;
649
+ };
650
+ forcedTransition?: LadderForcedTransition["kind"];
651
+ model?: string;
652
+ payloadVersion: 1;
653
+ session?: LadderSessionAttribution;
654
+ stage: ReviewLadderExecutedStage;
655
+ type: "review-ladder-stage";
656
+ usage?: LadderUsageReport;
657
+ }
658
+ interface LadderDiagnostic {
659
+ code: "interior-cycles-unrecorded";
660
+ message: string;
661
+ }
662
+ type ReviewLadderEvaluation = LadderPosition & {
663
+ cycleCounts: {
664
+ gate: number;
665
+ interior: number;
666
+ };
667
+ diagnostics: LadderDiagnostic[];
668
+ event?: ReviewLadderStageEvent;
669
+ ledger: FindingLedgerEntry[];
670
+ unmatchedDispositions: LadderDispositionDeclaration[];
671
+ };
672
+ interface EvaluateReviewLadderInput {
673
+ cycles: ReviewLadderCycle[];
674
+ policy: ReviewLadderPolicy;
675
+ }
676
+ declare const evaluateReviewLadder: ({
677
+ cycles,
678
+ policy
679
+ }: EvaluateReviewLadderInput) => ReviewLadderEvaluation;
680
+ //#endregion
681
+ //#region src/pr-readiness/ladder-proof-state.d.ts
682
+ interface PrReviewLadderState {
683
+ cycles: ReviewLadderCycle[];
684
+ }
685
+ interface OpenCycleState {
686
+ autoBlockingFindings: number;
687
+ blockingEntries: ReviewFindingAttributes[];
688
+ openEntries: ReviewFindingAttributes[];
689
+ staleRepeatFindings?: number;
690
+ }
691
+ interface ReviewLadderSummaryState {
692
+ cycleCounts: {
693
+ gate: number;
694
+ interior: number;
695
+ };
696
+ forcedTransition?: LadderForcedTransition["kind"];
697
+ nextAction: LadderNextAction["kind"];
698
+ stage: ReviewLadderStage;
699
+ }
700
+ interface ReviewLadderSnapshot {
701
+ cycleState: OpenCycleState;
702
+ evaluation: ReviewLadderEvaluation;
703
+ ledger: FindingLedgerEntry[];
704
+ policyGateCap: number;
705
+ summary: ReviewLadderSummaryState;
706
+ }
707
+ type ReviewEpochMode = {
708
+ kind: "ladder";
709
+ ladder: PrReviewLadderState;
710
+ snapshot?: ReviewLadderSnapshot;
711
+ } | {
712
+ kind: "declared-window";
713
+ };
714
+ //#endregion
715
+ //#region src/pr-readiness/review-proof-types.d.ts
716
+ type PrReviewKind = "correctness" | "security";
717
+ type PrReviewMode = PrReviewKind | "all";
718
+ type PrReviewOutcome = "passed" | "failed" | "error";
719
+ interface PrReviewStageResolution {
720
+ model: string;
721
+ sessionId: string;
722
+ }
723
+ //#endregion
724
+ //#region src/pr-readiness/review-proof-shape.d.ts
725
+ interface PrReviewFinding extends ReviewFindingAttributes {
726
+ body: string;
727
+ category?: ReviewFindingCategory;
728
+ line?: number;
729
+ protocolFinding?: true;
730
+ }
731
+ interface PrReviewResult {
732
+ kind: PrReviewKind;
733
+ startedAt: string;
734
+ endedAt: string;
735
+ durationMs: number;
736
+ model?: string;
737
+ producer?: string;
738
+ rung?: EvidenceReviewRung;
739
+ sessionId?: string;
740
+ outcome: PrReviewOutcome;
741
+ issuesFlagged: number;
742
+ summary: string;
743
+ findings: PrReviewFinding[];
744
+ typedVerdict?: boolean;
745
+ verdictSource?: "footer" | "recovered";
746
+ promptSections?: ReviewPromptSection[];
747
+ }
748
+ interface PrReviewProof {
749
+ schemaVersion: 2;
750
+ findingProvenanceVersion: 1;
751
+ base: string;
752
+ headSha: string;
753
+ patchId: string;
754
+ reviewCycle?: number;
755
+ maxReviewCycles?: number;
756
+ changedFiles: string[];
757
+ cleanedPaths: string[];
758
+ ladder?: PrReviewLadderState;
759
+ reviewRequirement?: {
760
+ reason: "no-applicable-mode" | "faithful-merge";
761
+ status: "not-required";
762
+ };
763
+ reviews: PrReviewResult[];
764
+ }
765
+ //#endregion
766
+ //#region src/demand-waiver.d.ts
767
+ declare const DEFAULT_DEMAND_WAIVER_PATH = ".factory-memory/demand-waivers.json";
768
+ /** One recorded operator act: this demand, on this candidate, waived. */
769
+ interface DemandWaiver {
770
+ candidate: {
771
+ headSha: string;
772
+ pr: number;
773
+ };
774
+ demand: string;
775
+ /** The authenticated GitHub account that recorded the waiver. */
776
+ operator: string;
777
+ rationale: string;
778
+ recordedAt: string;
779
+ /** Optional audit metadata; never waiver authority. */
780
+ session?: string;
781
+ }
782
+ interface DemandWaiverStore {
783
+ command: "patronage-factory demand:waive";
784
+ schemaVersion: 1;
785
+ waivers: DemandWaiver[];
786
+ }
787
+ declare const validateDemandWaiverStore: (value: unknown) => DemandWaiverStore;
788
+ /**
789
+ * A demand that was in force, was NOT met, and was waived by the operator.
790
+ *
791
+ * `unmetReasons` is required and non-empty: every reason the demand refused is
792
+ * carried through verbatim. There is no field on this record that could say
793
+ * "satisfied", and no code path constructs one without a refusal to carry.
794
+ */
795
+ interface WaivedDemand {
796
+ demand: string;
797
+ operator: string;
798
+ rationale: string;
799
+ recordedAt: string;
800
+ session?: string;
801
+ /** The demand's refusals at evaluation time, preserved verbatim. */
802
+ unmetReasons: string[];
803
+ }
804
+ declare const waivedDemandSchema: z.ZodType<WaivedDemand>;
805
+ /** The waivers that bind one candidate: same PR, same head. */
806
+ declare const selectWaiversForCandidate: ({
807
+ headSha,
808
+ pr,
809
+ waivers
810
+ }: {
811
+ headSha: string | undefined;
812
+ pr: number;
813
+ waivers: readonly DemandWaiver[];
814
+ }) => DemandWaiver[];
815
+ interface DemandOutcome {
816
+ blockingReasons: string[];
817
+ waived?: WaivedDemand;
818
+ }
819
+ /**
820
+ * Fold one resolved demand's refusals through the operator's waivers.
821
+ *
822
+ * A satisfied demand (no refusals) stays satisfied and the waiver stays inert
823
+ * — a waiver can only ever move a demand from *unmet-and-blocking* to
824
+ * *unmet-and-waived*, never to met.
825
+ */
826
+ declare const applyDemandWaiver: ({
827
+ demand,
828
+ reasons,
829
+ waivers
830
+ }: {
831
+ demand: string;
832
+ reasons: readonly string[];
833
+ waivers: readonly DemandWaiver[];
834
+ }) => DemandOutcome;
835
+ /** How a waived demand reads to a human. Never the word "satisfied". */
836
+ declare const waivedDemandNotice: (waived: WaivedDemand) => string;
837
+ interface DemandWaiverAuthorization {
838
+ operator: string;
839
+ session?: string;
840
+ }
841
+ type AuthorizeDemandWaiverResult = {
842
+ authorization: DemandWaiverAuthorization;
843
+ refusals?: undefined;
844
+ } | {
845
+ authorization?: undefined;
846
+ refusals: string[];
847
+ };
848
+ /**
849
+ * Operator identity, `declaredBy`-style: a named human account, recorded on
850
+ * the waiver and enforced here. Session is optional audit metadata only: it is
851
+ * not credential-backed, so its absence or equality never authorizes or
852
+ * refuses an operator act.
853
+ */
854
+ declare const authorizeDemandWaiver: ({
855
+ authenticatedLogin,
856
+ session
857
+ }: {
858
+ authenticatedLogin: string | undefined;
859
+ session: string | undefined;
860
+ }) => AuthorizeDemandWaiverResult;
861
+ //#endregion
862
+ //#region src/blocked-reasons.d.ts
863
+ declare const blockedReasonSchema: z.ZodObject<{
864
+ code: z.ZodString;
865
+ detail: z.ZodString;
866
+ }, z.core.$strip>;
867
+ type BlockedReason = z.infer<typeof blockedReasonSchema>;
868
+ //#endregion
869
+ //#region src/arm-auto-merge.d.ts
870
+ interface ArmAutoMergeInput {
871
+ cwd: string;
872
+ /** The validated PR head this arming is a compare-and-set against. */
873
+ headSha: string;
874
+ owner: string;
875
+ pr: number;
876
+ repo: string;
626
877
  }
627
878
  /**
628
- * Build a {@link FollowUpAction} from a literal argv array. The `command`
629
- * string is derived from argv so the two never drift.
879
+ * What the PR actually did, read back after the call — never inferred from the
880
+ * exit code. `not-armed` is a failure: the candidate is admitted but nothing
881
+ * will merge it, so it carries the detail and `pr:ready` emits a re-dispatch.
630
882
  */
631
- declare const followUpFromArgv: (argv: string[]) => FollowUpAction;
632
- /** Canonical zod schema for the optional follow-up field on JSON outputs. */
633
- declare const FollowUpActionSchema: z.ZodType<FollowUpAction>;
883
+ interface ArmAutoMergeOutcome {
884
+ /** Why the arming did not take effect, or what the invocation reported. */
885
+ detail?: string;
886
+ headSha: string;
887
+ outcome: "armed" | "merged" | "not-armed";
888
+ }
889
+ //#endregion
890
+ //#region src/checkout-repository.d.ts
891
+ interface CheckoutRepository {
892
+ name: string;
893
+ owner: string;
894
+ }
895
+ //#endregion
896
+ //#region src/policy-resolution.d.ts
897
+ /** How a gate resolved the review policy it evaluated a candidate under. */
898
+ declare const policyResolutionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
899
+ basePolicyDigest: z.ZodString;
900
+ baseRefName: z.ZodString;
901
+ candidatePolicyDigest: z.ZodString;
902
+ effectiveDigest: z.ZodString;
903
+ policyBaseSha: z.ZodString;
904
+ reviewPolicyChanged: z.ZodBoolean;
905
+ status: z.ZodLiteral<"authoritative">;
906
+ }, z.core.$strict>, z.ZodObject<{
907
+ baseRefName: z.ZodString;
908
+ reason: z.ZodString;
909
+ status: z.ZodLiteral<"unresolved">;
910
+ }, z.core.$strict>], "status">;
911
+ type PolicyResolution = z.infer<typeof policyResolutionSchema>;
912
+ //#endregion
913
+ //#region src/profile.d.ts
914
+ declare const DEFAULT_FACTORY_REPOSITORY = "unknown/unknown";
915
+ /** The one profile shape this build accepts (ADR 0023, #318, #351, #742). */
916
+ declare const PROFILE_SCHEMA_VERSION = 6;
917
+ declare const factoryProjectProfileSchema: z.ZodObject<{
918
+ $schema: z.ZodOptional<z.ZodString>;
919
+ extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
920
+ hq: z.ZodOptional<z.ZodObject<{
921
+ enabled: z.ZodBoolean;
922
+ endpoint: z.ZodIntersection<z.ZodString, z.ZodString>;
923
+ }, z.core.$strict>>;
924
+ impact: z.ZodOptional<z.ZodObject<{
925
+ inert: z.ZodOptional<z.ZodArray<z.ZodString>>;
926
+ targets: z.ZodArray<z.ZodObject<{
927
+ importers: z.ZodArray<z.ZodString>;
928
+ name: z.ZodString;
929
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
930
+ }, z.core.$strict>>;
931
+ }, z.core.$strict>>;
932
+ lifecycleContract: z.ZodOptional<z.ZodObject<{
933
+ command: z.ZodString;
934
+ jobName: z.ZodOptional<z.ZodString>;
935
+ }, z.core.$strict>>;
936
+ repository: z.ZodObject<{
937
+ name: z.ZodString;
938
+ owner: z.ZodString;
939
+ }, z.core.$strict>;
940
+ requiredChecks: z.ZodOptional<z.ZodArray<z.ZodObject<{
941
+ name: z.ZodString;
942
+ scope: z.ZodOptional<z.ZodObject<{
943
+ classifications: z.ZodArray<z.ZodEnum<{
944
+ "docs/process-only": "docs/process-only";
945
+ "non-trivial": "non-trivial";
946
+ }>>;
947
+ }, z.core.$strict>>;
948
+ }, z.core.$strict>>>;
949
+ review: z.ZodOptional<z.ZodObject<{
950
+ conditional: z.ZodArray<z.ZodObject<{
951
+ paths: z.ZodArray<z.ZodString>;
952
+ }, z.core.$strict>>;
953
+ }, z.core.$strict>>;
954
+ schemaVersion: z.ZodLiteral<6>;
955
+ verification: z.ZodObject<{
956
+ commands: z.ZodArray<z.ZodObject<{
957
+ command: z.ZodString;
958
+ description: z.ZodString;
959
+ impactTarget: z.ZodOptional<z.ZodString>;
960
+ name: z.ZodString;
961
+ requiredCheck: z.ZodOptional<z.ZodString>;
962
+ scope: z.ZodDefault<z.ZodEnum<{
963
+ trivial: "trivial";
964
+ "docs-only": "docs-only";
965
+ full: "full";
966
+ }>>;
967
+ }, z.core.$strip>>;
968
+ }, z.core.$strip>;
969
+ }, z.core.$strict>;
970
+ type FactoryProjectProfile = z.infer<typeof factoryProjectProfileSchema>;
971
+ declare const resolveFactoryRepository: (profile?: Pick<FactoryProjectProfile, "repository"> | undefined) => string;
972
+ interface LoadProjectProfileInput {
973
+ cwd?: string;
974
+ profilePath?: string;
975
+ }
976
+ interface LoadProjectProfileResult {
977
+ path: string;
978
+ profile: FactoryProjectProfile;
979
+ }
980
+ declare function loadProjectProfile(input?: LoadProjectProfileInput): LoadProjectProfileResult;
981
+ //#endregion
982
+ //#region src/catch-up-recognition-record.d.ts
983
+ interface CatchUpRecognition {
984
+ /** The ref the candidate targets, as the recognizing command resolved it. */
985
+ baseRef: string;
986
+ /** The live target tip at recognition time; the head's first parent. */
987
+ baseTipSha: string;
988
+ /** The head's second parent: the admitted base-side content merged in. */
989
+ mergedParentSha: string;
990
+ /**
991
+ * The tree `git merge-tree --write-tree` produced for the two parents. It
992
+ * equals the head's own tree; that equality is the faithfulness proof.
993
+ */
994
+ mergedTreeSha: string;
995
+ /** The ref that proves the second parent is admitted content. */
996
+ upstreamRef: string;
997
+ }
634
998
  //#endregion
635
999
  //#region src/diff-classification.d.ts
636
1000
  declare const DIFF_CLASSIFICATIONS: readonly ["docs/process-only", "trivial", "non-trivial"];
@@ -650,7 +1014,7 @@ declare const impactStampSchema: z.ZodObject<{
650
1014
  }>;
651
1015
  inertPaths: z.ZodDefault<z.ZodArray<z.ZodString>>;
652
1016
  reasons: z.ZodArray<z.ZodString>;
653
- stampVersion: z.ZodLiteral<3>;
1017
+ stampVersion: z.ZodLiteral<4>;
654
1018
  targets: z.ZodArray<z.ZodObject<{
655
1019
  basis: z.ZodString;
656
1020
  impact: z.ZodEnum<{
@@ -658,6 +1022,7 @@ declare const impactStampSchema: z.ZodObject<{
658
1022
  "not-affected": "not-affected";
659
1023
  }>;
660
1024
  name: z.ZodString;
1025
+ subscribedPaths: z.ZodArray<z.ZodString>;
661
1026
  }, z.core.$strip>>;
662
1027
  unsubscribedPaths: z.ZodArray<z.ZodString>;
663
1028
  }, z.core.$strip>;
@@ -708,74 +1073,89 @@ declare const impactStampScopeDecision: ({
708
1073
  targetName: string;
709
1074
  }) => ImpactScopeDecision;
710
1075
  //#endregion
711
- //#region src/profile.d.ts
712
- declare const DEFAULT_FACTORY_REPOSITORY = "unknown/unknown";
713
- /** The one profile shape this build accepts (ADR 0023, #318, #351, #742). */
714
- declare const PROFILE_SCHEMA_VERSION = 6;
715
- declare const factoryProjectProfileSchema: z.ZodObject<{
716
- $schema: z.ZodOptional<z.ZodString>;
717
- extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
718
- hq: z.ZodOptional<z.ZodObject<{
719
- enabled: z.ZodBoolean;
720
- endpoint: z.ZodIntersection<z.ZodString, z.ZodString>;
721
- }, z.core.$strict>>;
722
- impact: z.ZodOptional<z.ZodObject<{
723
- inert: z.ZodOptional<z.ZodArray<z.ZodString>>;
724
- targets: z.ZodArray<z.ZodObject<{
725
- importers: z.ZodArray<z.ZodString>;
726
- name: z.ZodString;
727
- paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
728
- }, z.core.$strict>>;
729
- }, z.core.$strict>>;
730
- lifecycleContract: z.ZodOptional<z.ZodObject<{
731
- command: z.ZodString;
732
- jobName: z.ZodOptional<z.ZodString>;
733
- }, z.core.$strict>>;
734
- repository: z.ZodObject<{
735
- name: z.ZodString;
736
- owner: z.ZodString;
737
- }, z.core.$strict>;
738
- requiredChecks: z.ZodOptional<z.ZodArray<z.ZodObject<{
739
- name: z.ZodString;
740
- scope: z.ZodOptional<z.ZodObject<{
741
- classifications: z.ZodArray<z.ZodEnum<{
742
- "docs/process-only": "docs/process-only";
743
- "non-trivial": "non-trivial";
744
- }>>;
745
- }, z.core.$strict>>;
746
- }, z.core.$strict>>>;
747
- review: z.ZodOptional<z.ZodObject<{
748
- conditional: z.ZodArray<z.ZodObject<{
749
- paths: z.ZodArray<z.ZodString>;
750
- }, z.core.$strict>>;
751
- }, z.core.$strict>>;
752
- schemaVersion: z.ZodLiteral<6>;
753
- verification: z.ZodObject<{
754
- commands: z.ZodArray<z.ZodObject<{
755
- command: z.ZodString;
756
- description: z.ZodString;
757
- impactTarget: z.ZodOptional<z.ZodString>;
758
- name: z.ZodString;
759
- requiredCheck: z.ZodOptional<z.ZodString>;
760
- scope: z.ZodDefault<z.ZodEnum<{
761
- trivial: "trivial";
762
- "docs-only": "docs-only";
763
- full: "full";
764
- }>>;
765
- }, z.core.$strip>>;
766
- }, z.core.$strip>;
1076
+ //#region src/required-check-policy.d.ts
1077
+ declare const EVIDENCE_CHECK_TYPES: readonly ["review", "verify"];
1078
+ type EvidenceCheckType = (typeof EVIDENCE_CHECK_TYPES)[number];
1079
+ declare const requiredCheckScopeSchema: z.ZodObject<{
1080
+ classifications: z.ZodArray<z.ZodEnum<{
1081
+ "docs/process-only": "docs/process-only";
1082
+ trivial: "trivial";
1083
+ "non-trivial": "non-trivial";
1084
+ }>>;
767
1085
  }, z.core.$strict>;
768
- type FactoryProjectProfile = z.infer<typeof factoryProjectProfileSchema>;
769
- declare const resolveFactoryRepository: (profile?: Pick<FactoryProjectProfile, "repository"> | undefined) => string;
770
- interface LoadProjectProfileInput {
771
- cwd?: string;
772
- profilePath?: string;
1086
+ type RequiredCheckScope = z.infer<typeof requiredCheckScopeSchema>;
1087
+ interface RequiredCheckScopeContext {
1088
+ catchUpRecognition?: CatchUpRecognition;
1089
+ classification: DiffClassification | undefined;
1090
+ impactStamp?: ImpactStamp;
773
1091
  }
774
- interface LoadProjectProfileResult {
775
- path: string;
776
- profile: FactoryProjectProfile;
1092
+ interface ScopeDecision {
1093
+ inScope: boolean;
1094
+ reason: string;
1095
+ }
1096
+ declare const requiredCheckInScope: ({
1097
+ context,
1098
+ scope
1099
+ }: {
1100
+ context: RequiredCheckScopeContext;
1101
+ scope?: RequiredCheckScope;
1102
+ }) => ScopeDecision;
1103
+ interface RequiredCheck {
1104
+ name: string;
1105
+ checkType: EvidenceCheckType;
1106
+ scope?: RequiredCheckScope;
1107
+ }
1108
+ //#endregion
1109
+ //#region src/demand-resolution.d.ts
1110
+ /**
1111
+ * The two GitHub reads that make the base policy authoritative: the live tip of
1112
+ * a branch, and one file's content at an exact commit. Injectable so tests can
1113
+ * state what the authority says; an absent implementation is the real read, so
1114
+ * an unstated authority is a refusal rather than a silent pass.
1115
+ */
1116
+ interface BaseReviewPolicyAuthority {
1117
+ branchTipSha: (input: {
1118
+ branch: string;
1119
+ cwd: string;
1120
+ repository: CheckoutRepository;
1121
+ }) => string;
1122
+ profileContentAtRef: (input: {
1123
+ cwd: string;
1124
+ profilePath: string;
1125
+ ref: string;
1126
+ repository: CheckoutRepository;
1127
+ }) => string;
777
1128
  }
778
- declare function loadProjectProfile(input?: LoadProjectProfileInput): LoadProjectProfileResult;
1129
+ //#endregion
1130
+ //#region src/follow-up.d.ts
1131
+ interface FactoryCliInvocation {
1132
+ /** Runtime arguments ending with the factory CLI entry module. */
1133
+ argvPrefix: string[];
1134
+ executable: string;
1135
+ }
1136
+ declare const FactoryCliInvocationSchema: z.ZodType<FactoryCliInvocation>;
1137
+ interface FollowUpAction {
1138
+ /**
1139
+ * Machine-safe argv-style array for the obvious next action, e.g.
1140
+ * ["gh","pr","merge","513","--squash"]. Same shape and field name that
1141
+ * `factory:delegate --print` emits, so an orchestrating agent can spawn the
1142
+ * next command without reconstructing a shell string. argv[0] is the
1143
+ * executable; the rest are literal, already-split arguments.
1144
+ */
1145
+ argv: string[];
1146
+ /**
1147
+ * Human-readable rendering of {@link argv} for logs and operators. Additive
1148
+ * to argv, never a substitute for it — argv is the source of truth.
1149
+ */
1150
+ command: string;
1151
+ }
1152
+ /**
1153
+ * Build a {@link FollowUpAction} from a literal argv array. The `command`
1154
+ * string is derived from argv so the two never drift.
1155
+ */
1156
+ declare const followUpFromArgv: (argv: string[]) => FollowUpAction;
1157
+ /** Canonical zod schema for the optional follow-up field on JSON outputs. */
1158
+ declare const FollowUpActionSchema: z.ZodType<FollowUpAction>;
779
1159
  //#endregion
780
1160
  //#region src/pr-verify-mode.d.ts
781
1161
  /**
@@ -929,8 +1309,8 @@ declare const mergeFreezeStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
929
1309
  generationId: z.ZodNumber;
930
1310
  headSha: z.ZodString;
931
1311
  outcome: z.ZodEnum<{
932
- active: "active";
933
1312
  stale: "stale";
1313
+ active: "active";
934
1314
  }>;
935
1315
  reason: z.ZodString;
936
1316
  recordedAt: z.ZodISODateTime;
@@ -942,357 +1322,112 @@ declare const mergeFreezeStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
942
1322
  headSha: z.ZodString;
943
1323
  outcome: z.ZodLiteral<"inactive">;
944
1324
  reason: z.ZodString;
945
- recordedAt: z.ZodISODateTime;
946
- schemaVersion: z.ZodLiteral<1>;
947
- }, z.core.$strip>], "active">;
948
- type MergeFreezeState = z.infer<typeof mergeFreezeStateSchema>;
949
- /**
950
- * The write side of this contract lives in the generated merge-target push
951
- * Verify workflow (#356, ADR 0016 as amended; #429): it is the ONLY producer of
952
- * `patronage-factory/merge-freeze` generations. Its emitted `output.text`
953
- * payload must parse under this exact reader schema, which is what the
954
- * workflow's own tests assert through this export.
955
- */
956
- declare function validateMergeFreezeState(value: unknown): MergeFreezeState;
957
- interface MergeFreezeStoreInput {
958
- cwd: string;
959
- headSha: string;
960
- repository: CheckoutRepository;
961
- }
962
- interface MergeFreezeStore {
963
- read: (input: MergeFreezeStoreInput) => unknown;
964
- }
965
- /**
966
- * The freeze generation as a readiness decision needs to see it (#477).
967
- *
968
- * `read` above collapses three different situations into one refusal, because
969
- * merge time treated all of them as "do not merge". Readiness distinguishes
970
- * them: a settled generation is the writer's verdict, a **settling** one is the
971
- * window between a merge landing and its merge-target Verify completing (a
972
- * running generation, or a missing generation proven by the immediately prior
973
- * settled tip plus a current source-pinned verify run), and an **unreadable**
974
- * one is ambiguous, malformed, foreign-App, or unavailable state. Same
975
- * selection, same pinned App, same `started_at` ordering — only the reporting
976
- * is finer.
977
- */
978
- type MergeFreezeGeneration = {
979
- kind: "settled";
980
- state: MergeFreezeState;
981
- } | {
982
- kind: "settling";
983
- reason: string;
984
- running?: {
985
- headSha: string;
986
- id: number;
987
- };
988
- } | {
989
- kind: "unreadable";
990
- reason: string;
991
- };
992
- /** A merge-freeze reader that can also report the settle window (#477). */
993
- interface MergeFreezeAuthority extends MergeFreezeStore {
994
- readGeneration: (input: MergeFreezeStoreInput) => MergeFreezeGeneration;
995
- }
996
- //#endregion
997
- //#region src/pr-proof-io.d.ts
998
- interface ProofDescriptor<T> {
999
- label: string;
1000
- defaultPath: string;
1001
- schemaVersion: number;
1002
- parse: (raw: unknown) => T;
1003
- }
1004
- //#endregion
1005
- //#region src/packages/review-prompt-sections/schema.d.ts
1006
- declare const reviewPromptSectionSchema: z.ZodObject<{
1007
- provenance: z.ZodEnum<{
1008
- "prior-review-ledger": "prior-review-ledger";
1009
- "issue-review-focus": "issue-review-focus";
1010
- }>;
1011
- source: z.ZodString;
1012
- text: z.ZodString;
1013
- }, z.core.$strict>;
1014
- type ReviewPromptSection = z.infer<typeof reviewPromptSectionSchema>;
1015
- type ReviewPromptSectionProvenance = ReviewPromptSection["provenance"];
1016
- declare const reviewPromptSectionsSchema: z.ZodArray<z.ZodObject<{
1017
- provenance: z.ZodEnum<{
1018
- "prior-review-ledger": "prior-review-ledger";
1019
- "issue-review-focus": "issue-review-focus";
1020
- }>;
1021
- source: z.ZodString;
1022
- text: z.ZodString;
1023
- }, z.core.$strict>>;
1024
- //#endregion
1025
- //#region src/review-ladder-policy.d.ts
1026
- type ReviewFindingSeverity = "critical" | "high" | "medium" | "low" | "unknown";
1027
- type ReviewFindingCategory = "correctness" | "safety" | "coordination" | "maintainability" | "unknown";
1028
- declare const REVIEW_SEVERITIES: readonly ["critical", "high", "medium", "low", "unknown"];
1029
- declare const resolveReviewFindingSeverity: (priority?: string) => ReviewFindingSeverity;
1030
- declare const resolveReviewFindingCategory: (category?: string) => ReviewFindingCategory;
1031
- declare const FINDING_DISPOSITIONS: readonly ["open", "fixed-in-thread", "follow-up-filed", "waived", "stale-repeat", "rerun-noise"];
1032
- type FindingDisposition = (typeof FINDING_DISPOSITIONS)[number];
1033
- interface ReviewFindingAttributes {
1034
- blockingAfterCap?: boolean;
1035
- category?: string;
1036
- citedSpan?: string;
1037
- file?: string;
1038
- prescribedAction?: string;
1039
- priority?: string;
1040
- supersedes?: {
1041
- file?: string;
1042
- title: string;
1043
- };
1044
- title: string;
1045
- }
1046
- type BlockingResolvableFinding = Pick<ReviewFindingAttributes, "blockingAfterCap" | "category" | "priority">;
1047
- declare const resolveFindingBlocking: (finding: BlockingResolvableFinding, disposition?: FindingDisposition) => boolean;
1048
- interface ReviewLadderPolicy {
1049
- gate: {
1050
- cap: number;
1051
- };
1052
- interior: {
1053
- cap: number;
1054
- };
1055
- }
1056
- declare const resolveReviewLadderPolicy: () => ReviewLadderPolicy;
1057
- //#endregion
1058
- //#region src/review-ladder-ledger.d.ts
1059
- type LadderCycleStage = "interior" | "gate";
1060
- interface LadderCycleRef {
1061
- cycle: number;
1062
- stage: LadderCycleStage;
1063
- }
1064
- type LadderFindingReport = ReviewFindingAttributes;
1065
- type DeclarableFindingDisposition = Exclude<FindingDisposition, "open" | "stale-repeat" | "rerun-noise">;
1066
- interface LadderDispositionDeclaration {
1067
- disposition: DeclarableFindingDisposition;
1068
- finding: {
1069
- file?: string;
1070
- title: string;
1071
- };
1072
- findingReport?: LadderFindingReport;
1073
- reference?: string;
1074
- }
1075
- interface FindingLedgerEntry extends ReviewFindingAttributes {
1076
- disposition: FindingDisposition;
1077
- firstFlagged: LadderCycleRef;
1078
- flagCount: number;
1079
- key: string;
1080
- lastFlagged: LadderCycleRef;
1081
- priorDisposition?: FindingDisposition;
1082
- reference?: string;
1083
- reopenedCount: number;
1084
- staleRepeatCount: number;
1085
- }
1086
- declare const findingKey: (finding: {
1087
- citedSpan?: string;
1088
- file?: string;
1089
- prescribedAction?: string;
1090
- title?: string;
1091
- }) => string;
1092
- declare const openLadderFindings: (ledger: FindingLedgerEntry[]) => FindingLedgerEntry[];
1093
- declare const blockingLadderFindings: (ledger: FindingLedgerEntry[]) => FindingLedgerEntry[];
1094
- declare const staleRepeatLadderFindings: (ledger: FindingLedgerEntry[]) => FindingLedgerEntry[];
1095
- declare const inferFixedInThreadDispositions: (ledger: FindingLedgerEntry[], findings: readonly LadderFindingReport[], options?: {
1096
- sameHeadAsPriorCycle?: boolean;
1097
- }) => LadderDispositionDeclaration[];
1098
- //#endregion
1099
- //#region src/review-ladder.d.ts
1100
- type ReviewLadderExecutedStage = "interior" | "gate";
1101
- interface LadderSessionAttribution {
1102
- orchestrationMode?: "autonomous" | "manual";
1103
- resumedSession?: boolean;
1104
- runtime?: string;
1105
- sessionId?: string;
1106
- }
1107
- interface LadderUsageReport {
1108
- estimatedCostUsd?: number;
1109
- source?: string;
1110
- totalTokens?: number;
1111
- }
1112
- interface ReviewLadderCycle {
1113
- dispositions?: LadderDispositionDeclaration[];
1114
- engine?: string;
1115
- findings: LadderFindingReport[];
1116
- identity?: {
1117
- headSha: string;
1118
- patchId: string;
1119
- };
1120
- model?: string;
1121
- correlatedRerun?: boolean;
1122
- session?: LadderSessionAttribution;
1123
- stage: LadderCycleStage;
1124
- usage?: LadderUsageReport;
1125
- }
1126
- interface LadderInteriorCapTransition {
1127
- cap: number;
1128
- kind: "interior-cap-reached";
1129
- }
1130
- interface LadderGateCapTransition {
1131
- blockingFindings: string[];
1132
- cap: number;
1133
- kind: "gate-cap-exhausted";
1134
- }
1135
- type LadderForcedTransition = LadderGateCapTransition | LadderInteriorCapTransition;
1136
- interface LadderRunInteriorCycleAction {
1137
- cycle: number;
1138
- kind: "run-interior-cycle";
1139
- }
1140
- type LadderGateNextAction = {
1141
- cycle: number;
1142
- kind: "run-gate-cycle";
1143
- } | {
1144
- kind: "accept-nonblocking-findings";
1145
- } | {
1146
- kind: "escalate-to-triage";
1147
- } | {
1148
- kind: "ready-for-human";
1149
- };
1150
- type LadderPosition = {
1151
- forcedTransition?: LadderGateCapTransition;
1152
- nextAction: LadderGateNextAction;
1153
- stage: "gate";
1154
- } | {
1155
- forcedTransition?: LadderInteriorCapTransition;
1156
- nextAction: {
1157
- kind: "advance-to-gate";
1158
- };
1159
- stage: "interior-complete";
1160
- } | {
1161
- forcedTransition?: never;
1162
- nextAction: LadderRunInteriorCycleAction;
1163
- stage: "interior";
1164
- };
1165
- type LadderNextAction = LadderPosition["nextAction"];
1166
- type ReviewLadderStage = LadderPosition["stage"];
1167
- interface ReviewLadderStageEvent {
1168
- cycle: number;
1169
- cyclesToClean?: number;
1170
- engine?: string;
1171
- findingsSummary: {
1172
- blocking: number;
1173
- bySeverity: Record<ReviewFindingSeverity, number>;
1174
- flagged: number;
1175
- open: number;
1176
- staleRepeats: number;
1177
- };
1178
- forcedTransition?: LadderForcedTransition["kind"];
1179
- model?: string;
1180
- payloadVersion: 1;
1181
- session?: LadderSessionAttribution;
1182
- stage: ReviewLadderExecutedStage;
1183
- type: "review-ladder-stage";
1184
- usage?: LadderUsageReport;
1185
- }
1186
- interface LadderDiagnostic {
1187
- code: "interior-cycles-unrecorded";
1188
- message: string;
1189
- }
1190
- type ReviewLadderEvaluation = LadderPosition & {
1191
- cycleCounts: {
1192
- gate: number;
1193
- interior: number;
1194
- };
1195
- diagnostics: LadderDiagnostic[];
1196
- event?: ReviewLadderStageEvent;
1197
- ledger: FindingLedgerEntry[];
1198
- unmatchedDispositions: LadderDispositionDeclaration[];
1199
- };
1200
- interface EvaluateReviewLadderInput {
1201
- cycles: ReviewLadderCycle[];
1202
- policy: ReviewLadderPolicy;
1203
- }
1204
- declare const evaluateReviewLadder: ({
1205
- cycles,
1206
- policy
1207
- }: EvaluateReviewLadderInput) => ReviewLadderEvaluation;
1208
- //#endregion
1209
- //#region src/pr-readiness/ladder-proof-state.d.ts
1210
- interface PrReviewLadderState {
1211
- cycles: ReviewLadderCycle[];
1325
+ recordedAt: z.ZodISODateTime;
1326
+ schemaVersion: z.ZodLiteral<1>;
1327
+ }, z.core.$strip>], "active">;
1328
+ type MergeFreezeState = z.infer<typeof mergeFreezeStateSchema>;
1329
+ /**
1330
+ * The write side of this contract lives in the generated merge-target push
1331
+ * Verify workflow (#356, ADR 0016 as amended; #429): it is the ONLY producer of
1332
+ * `patronage-factory/merge-freeze` generations. Its emitted `output.text`
1333
+ * payload must parse under this exact reader schema, which is what the
1334
+ * workflow's own tests assert through this export.
1335
+ */
1336
+ declare function validateMergeFreezeState(value: unknown): MergeFreezeState;
1337
+ interface MergeFreezeStoreInput {
1338
+ cwd: string;
1339
+ headSha: string;
1340
+ repository: CheckoutRepository;
1212
1341
  }
1213
- interface OpenCycleState {
1214
- autoBlockingFindings: number;
1215
- blockingEntries: ReviewFindingAttributes[];
1216
- openEntries: ReviewFindingAttributes[];
1217
- staleRepeatFindings?: number;
1342
+ interface MergeFreezeStore {
1343
+ read: (input: MergeFreezeStoreInput) => unknown;
1218
1344
  }
1219
- interface ReviewLadderSummaryState {
1220
- cycleCounts: {
1221
- gate: number;
1222
- interior: number;
1223
- };
1224
- forcedTransition?: LadderForcedTransition["kind"];
1225
- nextAction: LadderNextAction["kind"];
1226
- stage: ReviewLadderStage;
1345
+ /**
1346
+ * The run identity that proves a generation is settling because it is running.
1347
+ */
1348
+ interface RunningMergeFreezeWitness {
1349
+ /** The base tip the running generation was created on. */
1350
+ headSha: string;
1351
+ /** The running `patronage-factory/merge-freeze` check-run id. */
1352
+ runId: number;
1227
1353
  }
1228
- interface ReviewLadderSnapshot {
1229
- cycleState: OpenCycleState;
1230
- evaluation: ReviewLadderEvaluation;
1231
- ledger: FindingLedgerEntry[];
1232
- policyGateCap: number;
1233
- summary: ReviewLadderSummaryState;
1354
+ /**
1355
+ * The evidence that a generation is settling because it is still owed (#521).
1356
+ */
1357
+ interface AwaitedMergeFreezeWitness {
1358
+ /** The base tip whose generation is awaited. */
1359
+ headSha: string;
1360
+ /** The immediate parent whose settled generation proves the writer runs. */
1361
+ parentSha: string;
1362
+ /** The source-pinned hosted verify run that owes the generation. */
1363
+ verifyRunId: number;
1364
+ /** That run's status. A completed run owes nothing, so it is not settling. */
1365
+ verifyStatus: "in_progress" | "queued";
1234
1366
  }
1235
- type ReviewEpochMode = {
1236
- kind: "ladder";
1237
- ladder: PrReviewLadderState;
1238
- snapshot?: ReviewLadderSnapshot;
1367
+ /**
1368
+ * The two settling phases, each with the witness that proves it (#890).
1369
+ *
1370
+ * `phase` replaces an optional `running` field that made one situation two:
1371
+ * the field's presence, not the situation, decided how readers behaved. Each
1372
+ * phase now carries exactly the witness its own rule needs.
1373
+ */
1374
+ type SettlingMergeFreezeGeneration = {
1375
+ kind: "settling";
1376
+ phase: "running-generation";
1377
+ reason: string;
1378
+ witness: RunningMergeFreezeWitness;
1239
1379
  } | {
1240
- kind: "declared-window";
1380
+ kind: "settling";
1381
+ phase: "awaiting-generation";
1382
+ reason: string;
1383
+ witness: AwaitedMergeFreezeWitness;
1241
1384
  };
1242
- //#endregion
1243
- //#region src/pr-readiness/review-proof-types.d.ts
1244
- type PrReviewKind = "correctness" | "security";
1245
- type PrReviewMode = PrReviewKind | "all";
1246
- type PrReviewOutcome = "passed" | "failed" | "error";
1247
- interface PrReviewStageResolution {
1248
- model: string;
1249
- sessionId: string;
1250
- }
1251
- //#endregion
1252
- //#region src/pr-readiness/review-proof-shape.d.ts
1253
- interface PrReviewFinding extends ReviewFindingAttributes {
1254
- body: string;
1255
- category?: ReviewFindingCategory;
1256
- line?: number;
1257
- protocolFinding?: true;
1385
+ /**
1386
+ * The freeze generation as a readiness decision needs to see it (#477).
1387
+ *
1388
+ * `read` below collapses every situation short of a verdict into one refusal,
1389
+ * because merge time treats all of them as "do not merge". Readiness
1390
+ * distinguishes them: a settled generation is the writer's verdict, a
1391
+ * **settling** one is the window between a merge landing and its merge-target
1392
+ * Verify completing, and an **unreadable** one is ambiguous, malformed,
1393
+ * foreign-App, or unavailable state. Same selection, same pinned App, same
1394
+ * `started_at` ordering — only the reporting is finer.
1395
+ */
1396
+ type MergeFreezeGeneration = {
1397
+ kind: "settled";
1398
+ state: MergeFreezeState;
1399
+ } | SettlingMergeFreezeGeneration | {
1400
+ kind: "unreadable";
1401
+ reason: string;
1402
+ };
1403
+ /** A merge-freeze reader that can also report the settle window (#477). */
1404
+ interface MergeFreezeAuthority extends MergeFreezeStore {
1405
+ readGeneration: (input: MergeFreezeStoreInput) => MergeFreezeGeneration;
1258
1406
  }
1259
- interface PrReviewResult {
1260
- kind: PrReviewKind;
1261
- startedAt: string;
1262
- endedAt: string;
1263
- durationMs: number;
1264
- model?: string;
1265
- producer?: string;
1266
- rung?: EvidenceReviewRung;
1267
- sessionId?: string;
1268
- outcome: PrReviewOutcome;
1269
- issuesFlagged: number;
1270
- summary: string;
1271
- findings: PrReviewFinding[];
1272
- typedVerdict?: boolean;
1273
- verdictSource?: "footer" | "recovered";
1274
- promptSections?: ReviewPromptSection[];
1407
+ interface GitHubCheckRunMergeFreezeApi {
1408
+ list: (input: MergeFreezeStoreInput & {
1409
+ name: string;
1410
+ }) => unknown;
1411
+ parent?: (input: MergeFreezeStoreInput) => unknown;
1275
1412
  }
1276
- interface PrReviewProof {
1277
- schemaVersion: 2;
1278
- findingProvenanceVersion: 1;
1279
- base: string;
1280
- headSha: string;
1281
- patchId: string;
1282
- reviewCycle?: number;
1283
- maxReviewCycles?: number;
1284
- changedFiles: string[];
1285
- cleanedPaths: string[];
1286
- ladder?: PrReviewLadderState;
1287
- reviewRequirement?: {
1288
- reason: "no-applicable-mode" | "faithful-merge";
1289
- status: "not-required";
1290
- };
1291
- reviews: PrReviewResult[];
1413
+ declare function createGitHubCheckRunMergeFreezeStore(api: GitHubCheckRunMergeFreezeApi): MergeFreezeAuthority;
1414
+ //#endregion
1415
+ //#region src/pr-proof-io.d.ts
1416
+ interface ProofDescriptor<T> {
1417
+ label: string;
1418
+ defaultPath: string;
1419
+ schemaVersion: number;
1420
+ parse: (raw: unknown) => T;
1292
1421
  }
1293
1422
  //#endregion
1294
1423
  //#region src/pr-readiness/readiness-ledger.d.ts
1295
- declare const SCHEMA_VERSION = 1;
1424
+ /**
1425
+ * Ledger schema version 2 (#894): `verification` is a tagged union on
1426
+ * `prVerify` and `externalChecks` no longer echoes `inScope`. Version 1
1427
+ * ledgers are not read — the pre-1.0 posture keeps one shape per contract, so
1428
+ * there is no compat reader here.
1429
+ */
1430
+ declare const SCHEMA_VERSION = 2;
1296
1431
  declare const READINESS_REPAIR_CODES: readonly ["undraft-pr", "await-post-undraft-checks"];
1297
1432
  declare const readinessRepairSchema: z.ZodObject<{
1298
1433
  action: z.ZodString;
@@ -1315,7 +1450,6 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1315
1450
  review: "review";
1316
1451
  verify: "verify";
1317
1452
  }>;
1318
- inScope: z.ZodBoolean;
1319
1453
  name: z.ZodString;
1320
1454
  reason: z.ZodOptional<z.ZodString>;
1321
1455
  scope: z.ZodOptional<z.ZodObject<{
@@ -1338,9 +1472,9 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1338
1472
  mergeable: z.ZodString;
1339
1473
  requiredChecks: z.ZodEnum<{
1340
1474
  unknown: "unknown";
1341
- pending: "pending";
1342
1475
  passed: "passed";
1343
1476
  failed: "failed";
1477
+ pending: "pending";
1344
1478
  none: "none";
1345
1479
  }>;
1346
1480
  reviewDecision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -1406,8 +1540,8 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1406
1540
  "run-interior-cycle": "run-interior-cycle";
1407
1541
  }>;
1408
1542
  stage: z.ZodEnum<{
1409
- interior: "interior";
1410
1543
  gate: "gate";
1544
+ interior: "interior";
1411
1545
  "interior-complete": "interior-complete";
1412
1546
  }>;
1413
1547
  }, z.core.$strip>>;
@@ -1425,8 +1559,8 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1425
1559
  status: z.ZodEnum<{
1426
1560
  blocked: "blocked";
1427
1561
  "not-required": "not-required";
1428
- stale: "stale";
1429
1562
  current: "current";
1563
+ stale: "stale";
1430
1564
  missing: "missing";
1431
1565
  }>;
1432
1566
  }, z.core.$strip>;
@@ -1437,26 +1571,35 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1437
1571
  status: z.ZodEnum<{
1438
1572
  blocked: "blocked";
1439
1573
  "not-required": "not-required";
1440
- stale: "stale";
1441
1574
  current: "current";
1575
+ stale: "stale";
1442
1576
  missing: "missing";
1443
1577
  }>;
1444
1578
  }, z.core.$strip>>;
1445
1579
  }, z.core.$strip>;
1446
- schemaVersion: z.ZodLiteral<1>;
1447
- verification: z.ZodObject<{
1580
+ schemaVersion: z.ZodLiteral<2>;
1581
+ verification: z.ZodDiscriminatedUnion<[z.ZodObject<{
1448
1582
  command: z.ZodLiteral<"patronage-factory pr:verify">;
1449
- docsOnlyDeltaAccepted: z.ZodOptional<z.ZodBoolean>;
1450
- docsOnlyVerifiedHeadSha: z.ZodOptional<z.ZodString>;
1451
- prVerify: z.ZodEnum<{
1452
- stale: "stale";
1453
- passed: "passed";
1454
- missing: "missing";
1455
- }>;
1456
- trivialDeltaAccepted: z.ZodOptional<z.ZodBoolean>;
1457
- trivialVerifiedHeadSha: z.ZodOptional<z.ZodString>;
1583
+ prVerify: z.ZodLiteral<"missing">;
1584
+ }, z.core.$strict>, z.ZodObject<{
1585
+ command: z.ZodLiteral<"patronage-factory pr:verify">;
1586
+ prVerify: z.ZodLiteral<"stale">;
1587
+ verifiedHeadSha: z.ZodString;
1588
+ }, z.core.$strict>, z.ZodObject<{
1589
+ command: z.ZodLiteral<"patronage-factory pr:verify">;
1590
+ prVerify: z.ZodLiteral<"passed-via-head">;
1591
+ verifiedHeadSha: z.ZodString;
1592
+ }, z.core.$strict>, z.ZodObject<{
1593
+ command: z.ZodLiteral<"patronage-factory pr:verify">;
1594
+ docsOnlyVerifiedHeadSha: z.ZodString;
1595
+ prVerify: z.ZodLiteral<"docs-only-delta">;
1458
1596
  verifiedHeadSha: z.ZodOptional<z.ZodString>;
1459
- }, z.core.$strip>;
1597
+ }, z.core.$strict>, z.ZodObject<{
1598
+ command: z.ZodLiteral<"patronage-factory pr:verify">;
1599
+ prVerify: z.ZodLiteral<"trivial-delta">;
1600
+ trivialVerifiedHeadSha: z.ZodString;
1601
+ verifiedHeadSha: z.ZodOptional<z.ZodString>;
1602
+ }, z.core.$strict>], "prVerify">;
1460
1603
  }, z.core.$strip>;
1461
1604
  type ReadinessRepair = z.infer<typeof readinessRepairSchema>;
1462
1605
  type ReadinessStatus = "ready" | "blocked";
@@ -1547,23 +1690,6 @@ interface UpsertFactoryPrStatusCommentResult {
1547
1690
  }
1548
1691
  declare function upsertFactoryPrStatusComment(input: UpsertFactoryPrStatusCommentInput, dependencies?: UpsertFactoryPrStatusCommentDependencies): Promise<UpsertFactoryPrStatusCommentResult>;
1549
1692
  //#endregion
1550
- //#region src/catch-up-recognition-record.d.ts
1551
- interface CatchUpRecognition {
1552
- /** The ref the candidate targets, as the recognizing command resolved it. */
1553
- baseRef: string;
1554
- /** The live target tip at recognition time; the head's first parent. */
1555
- baseTipSha: string;
1556
- /** The head's second parent: the admitted base-side content merged in. */
1557
- mergedParentSha: string;
1558
- /**
1559
- * The tree `git merge-tree --write-tree` produced for the two parents. It
1560
- * equals the head's own tree; that equality is the faithfulness proof.
1561
- */
1562
- mergedTreeSha: string;
1563
- /** The ref that proves the second parent is admitted content. */
1564
- upstreamRef: string;
1565
- }
1566
- //#endregion
1567
1693
  //#region src/pr-verify-proof-contract.d.ts
1568
1694
  declare const SUPPORTED_PR_VERIFY_SCHEMA_VERSIONS: readonly [1, 2, 3, 4];
1569
1695
  type PrVerifySchemaVersion = (typeof SUPPORTED_PR_VERIFY_SCHEMA_VERSIONS)[number];
@@ -2073,6 +2199,14 @@ interface GitHubPullRequest {
2073
2199
  body: string;
2074
2200
  headRefName?: string;
2075
2201
  headRefOid: string;
2202
+ /**
2203
+ * Whether the head branch lives in a different repository from the base
2204
+ * (#922). Required, not optional, for the reason `autoMergeRequest` is: the
2205
+ * trusted checkout names ONE repository, and for a fork PR that is not the
2206
+ * base repository. An implementation that omitted the field would silently
2207
+ * resolve base policy from whichever repository the checkout points at.
2208
+ */
2209
+ isCrossRepository: boolean;
2076
2210
  isDraft: boolean;
2077
2211
  mergeStateStatus: string;
2078
2212
  mergeable: string;
@@ -2132,6 +2266,13 @@ interface PrReadyProof {
2132
2266
  * waived demand reads to a human. Absent when there are none.
2133
2267
  */
2134
2268
  notices?: string[];
2269
+ /**
2270
+ * The policy identity readiness resolved review demand under (#922): the
2271
+ * base ref, its live tip, and the digests of the base, candidate, and merged
2272
+ * review policies. Optional on the wire and additive — this is a new record
2273
+ * on an unchanged contract, so no schema version moves.
2274
+ */
2275
+ policyResolution?: PolicyResolution;
2135
2276
  /** Committed profile blob evaluated by readiness. Required for merge. */
2136
2277
  profileBlobSha?: string;
2137
2278
  /** Checkout-relative committed profile path evaluated by readiness. */
@@ -2155,6 +2296,13 @@ interface PrReadyDependencies {
2155
2296
  * call plus the read-back that says what actually happened.
2156
2297
  */
2157
2298
  armAutoMerge?: (input: ArmAutoMergeInput) => ArmAutoMergeOutcome;
2299
+ /**
2300
+ * Reads the authoritative base review policy (#922): the profile committed at
2301
+ * the live tip of the PR's own base ref. Defaults to the real GitHub reads,
2302
+ * so an unstated authority refuses rather than falling back to candidate
2303
+ * policy — unreadable authority is never absent authority.
2304
+ */
2305
+ basePolicy?: BaseReviewPolicyAuthority;
2158
2306
  github?: {
2159
2307
  fetchClosingPullRequests?: (input: {
2160
2308
  issue: number;
@@ -2220,39 +2368,6 @@ declare function validatePrReadyProof(value: unknown): PrReadyProof;
2220
2368
  declare function readPrReadyProof(filePath: string): PrReadyProof;
2221
2369
  declare function runPrReady(args: PrReadyArgs, dependencies?: PrReadyDependencies): Promise<PrReadyProof>;
2222
2370
  //#endregion
2223
- //#region src/required-check-policy.d.ts
2224
- declare const EVIDENCE_CHECK_TYPES: readonly ["review", "verify"];
2225
- type EvidenceCheckType = (typeof EVIDENCE_CHECK_TYPES)[number];
2226
- declare const requiredCheckScopeSchema: z.ZodObject<{
2227
- classifications: z.ZodArray<z.ZodEnum<{
2228
- "docs/process-only": "docs/process-only";
2229
- trivial: "trivial";
2230
- "non-trivial": "non-trivial";
2231
- }>>;
2232
- }, z.core.$strict>;
2233
- type RequiredCheckScope = z.infer<typeof requiredCheckScopeSchema>;
2234
- interface RequiredCheckScopeContext {
2235
- catchUpRecognition?: CatchUpRecognition;
2236
- classification: DiffClassification | undefined;
2237
- impactStamp?: ImpactStamp;
2238
- }
2239
- interface ScopeDecision {
2240
- inScope: boolean;
2241
- reason: string;
2242
- }
2243
- declare const requiredCheckInScope: ({
2244
- context,
2245
- scope
2246
- }: {
2247
- context: RequiredCheckScopeContext;
2248
- scope?: RequiredCheckScope;
2249
- }) => ScopeDecision;
2250
- interface RequiredCheck {
2251
- name: string;
2252
- checkType: EvidenceCheckType;
2253
- scope?: RequiredCheckScope;
2254
- }
2255
- //#endregion
2256
2371
  //#region src/factory-session.d.ts
2257
2372
  declare const resolveAuthoringSessionIds: ({
2258
2373
  override,
@@ -2284,8 +2399,8 @@ declare const evidenceEnvelopeBaseSchema: z.ZodObject<{
2284
2399
  producer: z.ZodString;
2285
2400
  requestId: z.ZodOptional<z.ZodString>;
2286
2401
  rung: z.ZodOptional<z.ZodEnum<{
2287
- oracle: "oracle";
2288
2402
  "independent-model": "independent-model";
2403
+ oracle: "oracle";
2289
2404
  human: "human";
2290
2405
  }>>;
2291
2406
  schemaVersion: z.ZodLiteral<1>;
@@ -2311,8 +2426,8 @@ declare const evidenceEnvelopeSchema: z.ZodObject<{
2311
2426
  producer: z.ZodString;
2312
2427
  requestId: z.ZodOptional<z.ZodString>;
2313
2428
  rung: z.ZodOptional<z.ZodEnum<{
2314
- oracle: "oracle";
2315
2429
  "independent-model": "independent-model";
2430
+ oracle: "oracle";
2316
2431
  human: "human";
2317
2432
  }>>;
2318
2433
  schemaVersion: z.ZodLiteral<1>;
@@ -2392,7 +2507,6 @@ interface RequiredCheckOutcome {
2392
2507
  name: string;
2393
2508
  checkType: EvidenceCheckType;
2394
2509
  status: "satisfied" | "unmet" | "out-of-scope";
2395
- inScope: boolean;
2396
2510
  scopeReason: string;
2397
2511
  scope?: RequiredCheckScope;
2398
2512
  reason?: string;
@@ -2417,8 +2531,8 @@ declare const REVIEW_STATUS_VALUES: readonly ["not-required", "current", "stale"
2417
2531
  declare const reviewStatusSchema: z.ZodEnum<{
2418
2532
  blocked: "blocked";
2419
2533
  "not-required": "not-required";
2420
- stale: "stale";
2421
2534
  current: "current";
2535
+ stale: "stale";
2422
2536
  missing: "missing";
2423
2537
  }>;
2424
2538
  type ReviewStatus = z.infer<typeof reviewStatusSchema>;
@@ -2533,8 +2647,8 @@ declare const boundaryCheckProofSchema: z.ZodObject<{
2533
2647
  wave: z.ZodString;
2534
2648
  }, z.core.$strip>>;
2535
2649
  demandedRung: z.ZodOptional<z.ZodEnum<{
2536
- oracle: "oracle";
2537
2650
  "independent-model": "independent-model";
2651
+ oracle: "oracle";
2538
2652
  human: "human";
2539
2653
  }>>;
2540
2654
  epicIssue: z.ZodNumber;
@@ -2549,8 +2663,8 @@ declare const boundaryCheckProofSchema: z.ZodObject<{
2549
2663
  commentUrl: z.ZodOptional<z.ZodString>;
2550
2664
  producer: z.ZodString;
2551
2665
  rung: z.ZodEnum<{
2552
- oracle: "oracle";
2553
2666
  "independent-model": "independent-model";
2667
+ oracle: "oracle";
2554
2668
  human: "human";
2555
2669
  }>;
2556
2670
  sessionId: z.ZodOptional<z.ZodString>;
@@ -2566,8 +2680,8 @@ declare const boundaryCheckProofSchema: z.ZodObject<{
2566
2680
  value: z.ZodString;
2567
2681
  }, z.core.$strip>>;
2568
2682
  status: z.ZodEnum<{
2569
- blocked: "blocked";
2570
2683
  ready: "ready";
2684
+ blocked: "blocked";
2571
2685
  }>;
2572
2686
  }, z.core.$strip>;
2573
2687
  type BoundaryCheckProofRecord = z.infer<typeof boundaryCheckProofSchema>;
@@ -2688,6 +2802,7 @@ type CatchUpRecognizer = (input: {
2688
2802
  //#endregion
2689
2803
  //#region src/pr-review.d.ts
2690
2804
  interface PrReviewArgs extends LoadProjectProfileInput {
2805
+ assemble?: boolean;
2691
2806
  base: string;
2692
2807
  cycle: number;
2693
2808
  dispositions?: string;
@@ -2702,10 +2817,18 @@ interface PrReviewGitDependencies {
2702
2817
  currentHeadSha: (cwd: string) => string;
2703
2818
  isAncestor: (cwd: string, ancestor: string, descendant: string) => boolean;
2704
2819
  recognizeCatchUp?: CatchUpRecognizer;
2820
+ repositoryRoot?: (cwd: string) => string;
2821
+ showFileAtRef?: (cwd: string, ref: string, absolutePath: string) => string | undefined;
2705
2822
  stablePatchId: (cwd: string, base: string) => string;
2706
2823
  statusPorcelain: (cwd: string) => string;
2707
2824
  }
2825
+ interface PrReviewIssueBodyInput {
2826
+ issue: number;
2827
+ owner: string;
2828
+ repo: string;
2829
+ }
2708
2830
  interface PrReviewDependencies {
2831
+ fetchIssueBody?: (input: PrReviewIssueBodyInput) => string;
2709
2832
  git?: PrReviewGitDependencies;
2710
2833
  hq?: HqIngestDependencies;
2711
2834
  }
@@ -3025,11 +3148,11 @@ declare const LegacyWorkerCloseoutStatusTraceEventSchema: z.ZodObject<{
3025
3148
  threadId: z.ZodOptional<z.ZodString>;
3026
3149
  workerId: z.ZodOptional<z.ZodString>;
3027
3150
  archiveStatus: z.ZodOptional<z.ZodEnum<{
3151
+ pending: "pending";
3028
3152
  unavailable: "unavailable";
3029
3153
  archived: "archived";
3030
3154
  skipped: "skipped";
3031
3155
  "not-applicable": "not-applicable";
3032
- pending: "pending";
3033
3156
  }>>;
3034
3157
  closeoutReason: z.ZodOptional<z.ZodString>;
3035
3158
  eventType: z.ZodLiteral<"worker-closeout-lessons">;
@@ -3202,8 +3325,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3202
3325
  sessionId: z.ZodOptional<z.ZodString>;
3203
3326
  }, z.core.$strict>>;
3204
3327
  stage: z.ZodEnum<{
3205
- interior: "interior";
3206
3328
  gate: "gate";
3329
+ interior: "interior";
3207
3330
  }>;
3208
3331
  usage: z.ZodOptional<z.ZodObject<{
3209
3332
  estimatedCostUsd: z.ZodOptional<z.ZodNumber>;
@@ -3255,8 +3378,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3255
3378
  sessionId: z.ZodOptional<z.ZodString>;
3256
3379
  }, z.core.$strict>>;
3257
3380
  stage: z.ZodEnum<{
3258
- interior: "interior";
3259
3381
  gate: "gate";
3382
+ interior: "interior";
3260
3383
  }>;
3261
3384
  usage: z.ZodOptional<z.ZodObject<{
3262
3385
  estimatedCostUsd: z.ZodOptional<z.ZodNumber>;
@@ -3299,8 +3422,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3299
3422
  sessionId: z.ZodOptional<z.ZodString>;
3300
3423
  }, z.core.$strict>>;
3301
3424
  stage: z.ZodEnum<{
3302
- interior: "interior";
3303
3425
  gate: "gate";
3426
+ interior: "interior";
3304
3427
  }>;
3305
3428
  usage: z.ZodOptional<z.ZodObject<{
3306
3429
  estimatedCostUsd: z.ZodOptional<z.ZodNumber>;
@@ -3330,7 +3453,7 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3330
3453
  staleRepeats: number;
3331
3454
  };
3332
3455
  observedAt: string;
3333
- stage: "interior" | "gate";
3456
+ stage: "gate" | "interior";
3334
3457
  issue?: number | undefined;
3335
3458
  pr?: number | undefined;
3336
3459
  threadId?: string | undefined;
@@ -3423,11 +3546,11 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3423
3546
  threadId: z.ZodOptional<z.ZodString>;
3424
3547
  workerId: z.ZodOptional<z.ZodString>;
3425
3548
  archiveStatus: z.ZodOptional<z.ZodEnum<{
3549
+ pending: "pending";
3426
3550
  unavailable: "unavailable";
3427
3551
  archived: "archived";
3428
3552
  skipped: "skipped";
3429
3553
  "not-applicable": "not-applicable";
3430
- pending: "pending";
3431
3554
  }>>;
3432
3555
  closeoutReason: z.ZodOptional<z.ZodString>;
3433
3556
  eventType: z.ZodLiteral<"worker-closeout-lessons">;
@@ -3464,11 +3587,11 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3464
3587
  }, z.core.$strict>], "lessonStatus">;
3465
3588
  readonly 2: z.ZodObject<{
3466
3589
  archiveStatus: z.ZodOptional<z.ZodEnum<{
3590
+ pending: "pending";
3467
3591
  unavailable: "unavailable";
3468
3592
  archived: "archived";
3469
3593
  skipped: "skipped";
3470
3594
  "not-applicable": "not-applicable";
3471
- pending: "pending";
3472
3595
  }>>;
3473
3596
  closeoutReason: z.ZodOptional<z.ZodString>;
3474
3597
  lessonStatus: z.ZodOptional<z.ZodEnum<{
@@ -3606,8 +3729,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3606
3729
  model: z.ZodString;
3607
3730
  tier: z.ZodEnum<{
3608
3731
  review: "review";
3609
- delegate: "delegate";
3610
3732
  oracle: "oracle";
3733
+ delegate: "delegate";
3611
3734
  workhorse: "workhorse";
3612
3735
  scout: "scout";
3613
3736
  }>;
@@ -3615,8 +3738,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3615
3738
  startedAt: z.ZodString;
3616
3739
  tier: z.ZodEnum<{
3617
3740
  review: "review";
3618
- delegate: "delegate";
3619
3741
  oracle: "oracle";
3742
+ delegate: "delegate";
3620
3743
  workhorse: "workhorse";
3621
3744
  scout: "scout";
3622
3745
  }>;
@@ -3685,8 +3808,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3685
3808
  model: z.ZodString;
3686
3809
  tier: z.ZodEnum<{
3687
3810
  review: "review";
3688
- delegate: "delegate";
3689
3811
  oracle: "oracle";
3812
+ delegate: "delegate";
3690
3813
  workhorse: "workhorse";
3691
3814
  scout: "scout";
3692
3815
  }>;
@@ -3694,8 +3817,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3694
3817
  startedAt: z.ZodString;
3695
3818
  tier: z.ZodEnum<{
3696
3819
  review: "review";
3697
- delegate: "delegate";
3698
3820
  oracle: "oracle";
3821
+ delegate: "delegate";
3699
3822
  workhorse: "workhorse";
3700
3823
  scout: "scout";
3701
3824
  }>;
@@ -3755,8 +3878,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3755
3878
  model: z.ZodString;
3756
3879
  tier: z.ZodEnum<{
3757
3880
  review: "review";
3758
- delegate: "delegate";
3759
3881
  oracle: "oracle";
3882
+ delegate: "delegate";
3760
3883
  workhorse: "workhorse";
3761
3884
  scout: "scout";
3762
3885
  }>;
@@ -3764,8 +3887,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3764
3887
  startedAt: z.ZodString;
3765
3888
  tier: z.ZodEnum<{
3766
3889
  review: "review";
3767
- delegate: "delegate";
3768
3890
  oracle: "oracle";
3891
+ delegate: "delegate";
3769
3892
  workhorse: "workhorse";
3770
3893
  scout: "scout";
3771
3894
  }>;
@@ -3814,11 +3937,11 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3814
3937
  engine: string;
3815
3938
  layerSource: "committedDefault" | "operatorSession" | "userConfig";
3816
3939
  model: string;
3817
- tier: "review" | "delegate" | "oracle" | "workhorse" | "scout";
3940
+ tier: "review" | "oracle" | "delegate" | "workhorse" | "scout";
3818
3941
  fallbackTier?: "delegate" | undefined;
3819
3942
  };
3820
3943
  startedAt: string;
3821
- tier: "review" | "delegate" | "oracle" | "workhorse" | "scout";
3944
+ tier: "review" | "oracle" | "delegate" | "workhorse" | "scout";
3822
3945
  tokenUsage: {
3823
3946
  source: "cursor-csv" | "codex-json" | "cursor-json" | "claude-json";
3824
3947
  status: "available";
@@ -4140,7 +4263,7 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
4140
4263
  draft: boolean;
4141
4264
  mergeStateStatus: string;
4142
4265
  mergeable: string;
4143
- requiredChecks: "unknown" | "pending" | "passed" | "failed" | "none";
4266
+ requiredChecks: "unknown" | "passed" | "failed" | "pending" | "none";
4144
4267
  unresolvedReviewThreads: number;
4145
4268
  reviewDecision?: string | null | undefined;
4146
4269
  };
@@ -4155,30 +4278,42 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
4155
4278
  reviews: {
4156
4279
  correctness: {
4157
4280
  required: boolean;
4158
- status: "blocked" | "not-required" | "stale" | "current" | "missing";
4281
+ status: "blocked" | "not-required" | "current" | "stale" | "missing";
4159
4282
  reviewedHeadSha?: string | undefined;
4160
4283
  reviewedPatchId?: string | undefined;
4161
4284
  };
4162
4285
  security?: {
4163
4286
  required: boolean;
4164
- status: "blocked" | "not-required" | "stale" | "current" | "missing";
4287
+ status: "blocked" | "not-required" | "current" | "stale" | "missing";
4165
4288
  reviewedHeadSha?: string | undefined;
4166
4289
  reviewedPatchId?: string | undefined;
4167
4290
  } | undefined;
4168
4291
  };
4169
- schemaVersion: 1;
4292
+ schemaVersion: 2;
4170
4293
  verification: {
4171
4294
  command: "patronage-factory pr:verify";
4172
- prVerify: "stale" | "passed" | "missing";
4173
- docsOnlyDeltaAccepted?: boolean | undefined;
4174
- docsOnlyVerifiedHeadSha?: string | undefined;
4175
- trivialDeltaAccepted?: boolean | undefined;
4176
- trivialVerifiedHeadSha?: string | undefined;
4295
+ prVerify: "missing";
4296
+ } | {
4297
+ command: "patronage-factory pr:verify";
4298
+ prVerify: "stale";
4299
+ verifiedHeadSha: string;
4300
+ } | {
4301
+ command: "patronage-factory pr:verify";
4302
+ prVerify: "passed-via-head";
4303
+ verifiedHeadSha: string;
4304
+ } | {
4305
+ command: "patronage-factory pr:verify";
4306
+ docsOnlyVerifiedHeadSha: string;
4307
+ prVerify: "docs-only-delta";
4308
+ verifiedHeadSha?: string | undefined;
4309
+ } | {
4310
+ command: "patronage-factory pr:verify";
4311
+ prVerify: "trivial-delta";
4312
+ trivialVerifiedHeadSha: string;
4177
4313
  verifiedHeadSha?: string | undefined;
4178
4314
  };
4179
4315
  externalChecks?: {
4180
4316
  checkType: "review" | "verify";
4181
- inScope: boolean;
4182
4317
  name: string;
4183
4318
  scopeReason: string;
4184
4319
  status: "satisfied" | "unmet" | "out-of-scope";
@@ -4212,7 +4347,7 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
4212
4347
  interior: number;
4213
4348
  };
4214
4349
  nextAction: "run-gate-cycle" | "accept-nonblocking-findings" | "escalate-to-triage" | "ready-for-human" | "advance-to-gate" | "run-interior-cycle";
4215
- stage: "interior" | "gate" | "interior-complete";
4350
+ stage: "gate" | "interior" | "interior-complete";
4216
4351
  forcedTransition?: "gate-cap-exhausted" | "interior-cap-reached" | undefined;
4217
4352
  } | undefined;
4218
4353
  reviewRuns?: PrReviewResult[] | undefined;
@@ -4469,6 +4604,7 @@ declare const reviewFocusFromIssueBody: (body: string) => string | undefined;
4469
4604
  interface AssembleReviewPromptInput {
4470
4605
  base: string;
4471
4606
  changedFiles: string[];
4607
+ cwd?: string;
4472
4608
  headSha: string;
4473
4609
  issueFocus?: IssueReviewFocus;
4474
4610
  kind: PrReviewKind;
@@ -4476,6 +4612,13 @@ interface AssembleReviewPromptInput {
4476
4612
  priorLedgerEntries?: FindingLedgerEntry[];
4477
4613
  profile: FactoryProjectProfile;
4478
4614
  }
4615
+ interface AssembleReviewPromptGitDependencies {
4616
+ repositoryRoot: (cwd: string) => string;
4617
+ showFileAtRef: (cwd: string, ref: string, absolutePath: string) => string | undefined;
4618
+ }
4619
+ interface AssembleReviewPromptDependencies {
4620
+ git?: AssembleReviewPromptGitDependencies;
4621
+ }
4479
4622
  interface AssembledReviewPrompt {
4480
4623
  prompt: string;
4481
4624
  sections: ReviewPromptSection[];
@@ -4483,13 +4626,14 @@ interface AssembledReviewPrompt {
4483
4626
  declare const assembleReviewPrompt: ({
4484
4627
  base,
4485
4628
  changedFiles,
4629
+ cwd,
4486
4630
  headSha,
4487
4631
  issueFocus,
4488
4632
  kind,
4489
4633
  patchId,
4490
4634
  priorLedgerEntries,
4491
4635
  profile
4492
- }: AssembleReviewPromptInput) => AssembledReviewPrompt;
4636
+ }: AssembleReviewPromptInput, dependencies?: AssembleReviewPromptDependencies) => AssembledReviewPrompt;
4493
4637
  //#endregion
4494
4638
  //#region src/review-ladder-trace.d.ts
4495
4639
  interface ReviewLadderTraceIdentity {
@@ -4676,4 +4820,4 @@ interface CreateProgramOptions {
4676
4820
  declare function createProgram(options?: CreateProgramOptions): Command;
4677
4821
  declare function run(argv?: string[]): Promise<void>;
4678
4822
  //#endregion
4679
- export { type AppendFactoryTraceEventResult, type AssembledReviewPrompt, type BatteryCommandDisposition, type BatteryDisposition, type BoundaryCheckArgs, type BoundaryCheckDependencies, type BoundaryCheckProofRecord, type BuildEpicStructureEventInput, type CloudflareAccessServiceToken, type CompletedFactoryCheckSnapshot, CreateProgramOptions, DEFAULT_DEMAND_WAIVER_PATH, DEFAULT_FACTORY_REPOSITORY, DEFAULT_ROOT_SHARED_GLOBS, type DagDocument, type DemandWaiveArgs, type DemandWaiveDependencies, DemandWaiveRefusalError, type DemandWaiver, type DemandWaiverStore, EMPTY_TREE_OBJECT_HASH, EPIC_STRUCTURE_NODE_STATUSES, EPIC_STRUCTURE_SCHEMA_VERSION, type EpicStructureEvent, type EpicStructureGraphPayload, type EpicStructureNodeStatus, EpicStructureValidationError, type EvidenceEmitArgs, type EvidenceEmitDependencies, type EvidenceEmitResult, FACTORY_BASE_REF_ENV, FACTORY_CHANGED_FILES_ENV, FACTORY_CHANGED_FILES_FILE_ENV, type FactoryCliInvocation, FactoryCliInvocationSchema, type FactoryPrStatusCheckName, type FactoryPrStatusSources, 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 PlanFactoryPrStatusHudInput, type PrPublishArgs, type PrPublishDependencies, PrPublishFollowUpError, type PrPublishFollowUpOutcome, type PrPublishHandoff, type PrPublishResult, type PrReadyArgs, type PrReadyProof, type PresentFactoryPrStatusHudDependencies, type PresentFactoryPrStatusHudInput, type PreviewDisposition, type PreviewLifecyclePlan, type PreviewTargetPlan, type PublishEpicStructureArgs, type PublishEpicStructureResult, type PublishFollowUpPlan, REVIEW_FOCUS_SECTION, type ReadFactoryPrStatusSourcesDependencies, type ReadFactoryPrStatusSourcesInput, type RefreshFactoryPrStatusHudInput, type RenderFactoryPrStatusHudInput, 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 VerificationRunContext, type VerificationRunContextInput, type WaivedDemand, WorkerCheckoutGuardError, type WorkerCloseoutLessonsTraceEvent, appendReviewLadderStageTraceEvent, appendWithTraceSinks, applyDemandWaiver, assembleReviewPrompt, assertFactoryPrStatusIdentity, 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, createVerificationRunContext, doctorProjectProfile, epicStructureEventId, evaluateReviewLadder, evidenceEnvelopeFilename, findingKey, followUpFromArgv, impactStampScopeDecision, inferFixedInThreadDispositions, isProductionHqUrl, loadProjectProfile, normalizeIssueComments, openLadderFindings, planFactoryPrStatusHud, 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, presentFactoryPrStatusHud, previewLifecycleTargets, publishEpicStructure, readDemandWaivers, readFactoryPrStatusSources, readPrReadyProof, readPrReviewProof, refreshFactoryPrStatusHud, refreshFactoryPrStatusHudSafely, renderFactoryPrStatusHud, 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, validatePreviewLifecyclePlan, waivedDemandNotice, waivedDemandSchema, worktree_scratch_files_d_exports as worktreeScratchFiles };
4823
+ export { type AppendFactoryTraceEventResult, type AssembledReviewPrompt, type BatteryCommandDisposition, type BatteryDisposition, type BoundaryCheckArgs, type BoundaryCheckDependencies, type BoundaryCheckProofRecord, type BuildEpicStructureEventInput, type CloudflareAccessServiceToken, type CompletedFactoryCheckSnapshot, CreateProgramOptions, DEFAULT_DEMAND_WAIVER_PATH, DEFAULT_FACTORY_REPOSITORY, DEFAULT_ROOT_SHARED_GLOBS, type DagDocument, type DemandWaiveArgs, type DemandWaiveDependencies, DemandWaiveRefusalError, type DemandWaiver, type DemandWaiverStore, EMPTY_TREE_OBJECT_HASH, EPIC_STRUCTURE_NODE_STATUSES, EPIC_STRUCTURE_SCHEMA_VERSION, type EpicStructureEvent, type EpicStructureGraphPayload, type EpicStructureNodeStatus, EpicStructureValidationError, type EvidenceEmitArgs, type EvidenceEmitDependencies, type EvidenceEmitResult, FACTORY_BASE_REF_ENV, FACTORY_CHANGED_FILES_ENV, FACTORY_CHANGED_FILES_FILE_ENV, type FactoryCliInvocation, FactoryCliInvocationSchema, type FactoryPrStatusCheckName, type FactoryPrStatusSources, type FactoryProjectProfile, type FactoryTraceDiagnostic, type FactoryTraceEnvelope, type FactoryTraceEvent, type FindingDisposition, type FindingLedgerEntry, type FollowUpAction, FollowUpActionSchema, type GitHubCheckRunMergeFreezeApi, type ImpactScopeDecision, type ImpactScopeSurface, type IssueReviewFocus, type LadderDispositionDeclaration, MERGE_FREEZE_APP_SLUG, MERGE_FREEZE_CHECK_NAME, type MergeFreezeAuthority, type MergeFreezeGeneration, type MergeFreezeState, type MergeFreezeStoreInput, type PlanFactoryPrStatusHudInput, type PrPublishArgs, type PrPublishDependencies, PrPublishFollowUpError, type PrPublishFollowUpOutcome, type PrPublishHandoff, type PrPublishResult, type PrReadyArgs, type PrReadyProof, type PresentFactoryPrStatusHudDependencies, type PresentFactoryPrStatusHudInput, type PreviewDisposition, type PreviewLifecyclePlan, type PreviewTargetPlan, type PublishEpicStructureArgs, type PublishEpicStructureResult, type PublishFollowUpPlan, REVIEW_FOCUS_SECTION, type ReadFactoryPrStatusSourcesDependencies, type ReadFactoryPrStatusSourcesInput, type RefreshFactoryPrStatusHudInput, type RenderFactoryPrStatusHudInput, 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 VerificationRunContext, type VerificationRunContextInput, type WaivedDemand, WorkerCheckoutGuardError, type WorkerCloseoutLessonsTraceEvent, appendReviewLadderStageTraceEvent, appendWithTraceSinks, applyDemandWaiver, assembleReviewPrompt, assertFactoryPrStatusIdentity, 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, createGitHubCheckRunMergeFreezeStore, createLocalJsonlTraceSink, createProgram, createVerificationRunContext, doctorProjectProfile, epicStructureEventId, evaluateReviewLadder, evidenceEnvelopeFilename, findingKey, followUpFromArgv, impactStampScopeDecision, inferFixedInThreadDispositions, isProductionHqUrl, loadProjectProfile, normalizeIssueComments, openLadderFindings, planFactoryPrStatusHud, 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, presentFactoryPrStatusHud, previewLifecycleTargets, publishEpicStructure, readDemandWaivers, readFactoryPrStatusSources, readPrReadyProof, readPrReviewProof, refreshFactoryPrStatusHud, refreshFactoryPrStatusHudSafely, renderFactoryPrStatusHud, 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, validatePreviewLifecyclePlan, waivedDemandNotice, waivedDemandSchema, worktree_scratch_files_d_exports as worktreeScratchFiles };