@patronage/software-factory 1.0.0-alpha.23 → 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>;
@@ -475,6 +475,7 @@ declare function sweepHqSpoolOrphans(input: {
475
475
  //#region src/packages/review-prompt-sections/schema.d.ts
476
476
  declare const reviewPromptSectionSchema: z.ZodObject<{
477
477
  provenance: z.ZodEnum<{
478
+ "coding-standards": "coding-standards";
478
479
  "prior-review-ledger": "prior-review-ledger";
479
480
  "issue-review-focus": "issue-review-focus";
480
481
  }>;
@@ -485,6 +486,7 @@ type ReviewPromptSection = z.infer<typeof reviewPromptSectionSchema>;
485
486
  type ReviewPromptSectionProvenance = ReviewPromptSection["provenance"];
486
487
  declare const reviewPromptSectionsSchema: z.ZodArray<z.ZodObject<{
487
488
  provenance: z.ZodEnum<{
489
+ "coding-standards": "coding-standards";
488
490
  "prior-review-ledger": "prior-review-ledger";
489
491
  "issue-review-focus": "issue-review-focus";
490
492
  }>;
@@ -891,35 +893,108 @@ interface CheckoutRepository {
891
893
  owner: string;
892
894
  }
893
895
  //#endregion
894
- //#region src/follow-up.d.ts
895
- interface FactoryCliInvocation {
896
- /** Runtime arguments ending with the factory CLI entry module. */
897
- argvPrefix: string[];
898
- executable: string;
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;
899
975
  }
900
- declare const FactoryCliInvocationSchema: z.ZodType<FactoryCliInvocation>;
901
- interface FollowUpAction {
902
- /**
903
- * Machine-safe argv-style array for the obvious next action, e.g.
904
- * ["gh","pr","merge","513","--squash"]. Same shape and field name that
905
- * `factory:delegate --print` emits, so an orchestrating agent can spawn the
906
- * next command without reconstructing a shell string. argv[0] is the
907
- * executable; the rest are literal, already-split arguments.
908
- */
909
- argv: string[];
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;
910
990
  /**
911
- * Human-readable rendering of {@link argv} for logs and operators. Additive
912
- * to argv, never a substitute for it — argv is the source of truth.
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.
913
993
  */
914
- command: string;
994
+ mergedTreeSha: string;
995
+ /** The ref that proves the second parent is admitted content. */
996
+ upstreamRef: string;
915
997
  }
916
- /**
917
- * Build a {@link FollowUpAction} from a literal argv array. The `command`
918
- * string is derived from argv so the two never drift.
919
- */
920
- declare const followUpFromArgv: (argv: string[]) => FollowUpAction;
921
- /** Canonical zod schema for the optional follow-up field on JSON outputs. */
922
- declare const FollowUpActionSchema: z.ZodType<FollowUpAction>;
923
998
  //#endregion
924
999
  //#region src/diff-classification.d.ts
925
1000
  declare const DIFF_CLASSIFICATIONS: readonly ["docs/process-only", "trivial", "non-trivial"];
@@ -998,74 +1073,89 @@ declare const impactStampScopeDecision: ({
998
1073
  targetName: string;
999
1074
  }) => ImpactScopeDecision;
1000
1075
  //#endregion
1001
- //#region src/profile.d.ts
1002
- declare const DEFAULT_FACTORY_REPOSITORY = "unknown/unknown";
1003
- /** The one profile shape this build accepts (ADR 0023, #318, #351, #742). */
1004
- declare const PROFILE_SCHEMA_VERSION = 6;
1005
- declare const factoryProjectProfileSchema: z.ZodObject<{
1006
- $schema: z.ZodOptional<z.ZodString>;
1007
- extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1008
- hq: z.ZodOptional<z.ZodObject<{
1009
- enabled: z.ZodBoolean;
1010
- endpoint: z.ZodIntersection<z.ZodString, z.ZodString>;
1011
- }, z.core.$strict>>;
1012
- impact: z.ZodOptional<z.ZodObject<{
1013
- inert: z.ZodOptional<z.ZodArray<z.ZodString>>;
1014
- targets: z.ZodArray<z.ZodObject<{
1015
- importers: z.ZodArray<z.ZodString>;
1016
- name: z.ZodString;
1017
- paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
1018
- }, z.core.$strict>>;
1019
- }, z.core.$strict>>;
1020
- lifecycleContract: z.ZodOptional<z.ZodObject<{
1021
- command: z.ZodString;
1022
- jobName: z.ZodOptional<z.ZodString>;
1023
- }, z.core.$strict>>;
1024
- repository: z.ZodObject<{
1025
- name: z.ZodString;
1026
- owner: z.ZodString;
1027
- }, z.core.$strict>;
1028
- requiredChecks: z.ZodOptional<z.ZodArray<z.ZodObject<{
1029
- name: z.ZodString;
1030
- scope: z.ZodOptional<z.ZodObject<{
1031
- classifications: z.ZodArray<z.ZodEnum<{
1032
- "docs/process-only": "docs/process-only";
1033
- "non-trivial": "non-trivial";
1034
- }>>;
1035
- }, z.core.$strict>>;
1036
- }, z.core.$strict>>>;
1037
- review: z.ZodOptional<z.ZodObject<{
1038
- conditional: z.ZodArray<z.ZodObject<{
1039
- paths: z.ZodArray<z.ZodString>;
1040
- }, z.core.$strict>>;
1041
- }, z.core.$strict>>;
1042
- schemaVersion: z.ZodLiteral<6>;
1043
- verification: z.ZodObject<{
1044
- commands: z.ZodArray<z.ZodObject<{
1045
- command: z.ZodString;
1046
- description: z.ZodString;
1047
- impactTarget: z.ZodOptional<z.ZodString>;
1048
- name: z.ZodString;
1049
- requiredCheck: z.ZodOptional<z.ZodString>;
1050
- scope: z.ZodDefault<z.ZodEnum<{
1051
- trivial: "trivial";
1052
- "docs-only": "docs-only";
1053
- full: "full";
1054
- }>>;
1055
- }, z.core.$strip>>;
1056
- }, 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
+ }>>;
1057
1085
  }, z.core.$strict>;
1058
- type FactoryProjectProfile = z.infer<typeof factoryProjectProfileSchema>;
1059
- declare const resolveFactoryRepository: (profile?: Pick<FactoryProjectProfile, "repository"> | undefined) => string;
1060
- interface LoadProjectProfileInput {
1061
- cwd?: string;
1062
- profilePath?: string;
1086
+ type RequiredCheckScope = z.infer<typeof requiredCheckScopeSchema>;
1087
+ interface RequiredCheckScopeContext {
1088
+ catchUpRecognition?: CatchUpRecognition;
1089
+ classification: DiffClassification | undefined;
1090
+ impactStamp?: ImpactStamp;
1063
1091
  }
1064
- interface LoadProjectProfileResult {
1065
- path: string;
1066
- 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;
1067
1107
  }
1068
- declare function loadProjectProfile(input?: LoadProjectProfileInput): LoadProjectProfileResult;
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;
1128
+ }
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>;
1069
1159
  //#endregion
1070
1160
  //#region src/pr-verify-mode.d.ts
1071
1161
  /**
@@ -1219,8 +1309,8 @@ declare const mergeFreezeStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1219
1309
  generationId: z.ZodNumber;
1220
1310
  headSha: z.ZodString;
1221
1311
  outcome: z.ZodEnum<{
1222
- active: "active";
1223
1312
  stale: "stale";
1313
+ active: "active";
1224
1314
  }>;
1225
1315
  reason: z.ZodString;
1226
1316
  recordedAt: z.ZodISODateTime;
@@ -1382,9 +1472,9 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1382
1472
  mergeable: z.ZodString;
1383
1473
  requiredChecks: z.ZodEnum<{
1384
1474
  unknown: "unknown";
1385
- pending: "pending";
1386
1475
  passed: "passed";
1387
1476
  failed: "failed";
1477
+ pending: "pending";
1388
1478
  none: "none";
1389
1479
  }>;
1390
1480
  reviewDecision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -1450,8 +1540,8 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1450
1540
  "run-interior-cycle": "run-interior-cycle";
1451
1541
  }>;
1452
1542
  stage: z.ZodEnum<{
1453
- interior: "interior";
1454
1543
  gate: "gate";
1544
+ interior: "interior";
1455
1545
  "interior-complete": "interior-complete";
1456
1546
  }>;
1457
1547
  }, z.core.$strip>>;
@@ -1467,10 +1557,10 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1467
1557
  reviewedHeadSha: z.ZodOptional<z.ZodString>;
1468
1558
  reviewedPatchId: z.ZodOptional<z.ZodString>;
1469
1559
  status: z.ZodEnum<{
1470
- "not-required": "not-required";
1471
- stale: "stale";
1472
1560
  blocked: "blocked";
1561
+ "not-required": "not-required";
1473
1562
  current: "current";
1563
+ stale: "stale";
1474
1564
  missing: "missing";
1475
1565
  }>;
1476
1566
  }, z.core.$strip>;
@@ -1479,10 +1569,10 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1479
1569
  reviewedHeadSha: z.ZodOptional<z.ZodString>;
1480
1570
  reviewedPatchId: z.ZodOptional<z.ZodString>;
1481
1571
  status: z.ZodEnum<{
1482
- "not-required": "not-required";
1483
- stale: "stale";
1484
1572
  blocked: "blocked";
1573
+ "not-required": "not-required";
1485
1574
  current: "current";
1575
+ stale: "stale";
1486
1576
  missing: "missing";
1487
1577
  }>;
1488
1578
  }, z.core.$strip>>;
@@ -1600,23 +1690,6 @@ interface UpsertFactoryPrStatusCommentResult {
1600
1690
  }
1601
1691
  declare function upsertFactoryPrStatusComment(input: UpsertFactoryPrStatusCommentInput, dependencies?: UpsertFactoryPrStatusCommentDependencies): Promise<UpsertFactoryPrStatusCommentResult>;
1602
1692
  //#endregion
1603
- //#region src/catch-up-recognition-record.d.ts
1604
- interface CatchUpRecognition {
1605
- /** The ref the candidate targets, as the recognizing command resolved it. */
1606
- baseRef: string;
1607
- /** The live target tip at recognition time; the head's first parent. */
1608
- baseTipSha: string;
1609
- /** The head's second parent: the admitted base-side content merged in. */
1610
- mergedParentSha: string;
1611
- /**
1612
- * The tree `git merge-tree --write-tree` produced for the two parents. It
1613
- * equals the head's own tree; that equality is the faithfulness proof.
1614
- */
1615
- mergedTreeSha: string;
1616
- /** The ref that proves the second parent is admitted content. */
1617
- upstreamRef: string;
1618
- }
1619
- //#endregion
1620
1693
  //#region src/pr-verify-proof-contract.d.ts
1621
1694
  declare const SUPPORTED_PR_VERIFY_SCHEMA_VERSIONS: readonly [1, 2, 3, 4];
1622
1695
  type PrVerifySchemaVersion = (typeof SUPPORTED_PR_VERIFY_SCHEMA_VERSIONS)[number];
@@ -2126,6 +2199,14 @@ interface GitHubPullRequest {
2126
2199
  body: string;
2127
2200
  headRefName?: string;
2128
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;
2129
2210
  isDraft: boolean;
2130
2211
  mergeStateStatus: string;
2131
2212
  mergeable: string;
@@ -2185,6 +2266,13 @@ interface PrReadyProof {
2185
2266
  * waived demand reads to a human. Absent when there are none.
2186
2267
  */
2187
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;
2188
2276
  /** Committed profile blob evaluated by readiness. Required for merge. */
2189
2277
  profileBlobSha?: string;
2190
2278
  /** Checkout-relative committed profile path evaluated by readiness. */
@@ -2208,6 +2296,13 @@ interface PrReadyDependencies {
2208
2296
  * call plus the read-back that says what actually happened.
2209
2297
  */
2210
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;
2211
2306
  github?: {
2212
2307
  fetchClosingPullRequests?: (input: {
2213
2308
  issue: number;
@@ -2273,39 +2368,6 @@ declare function validatePrReadyProof(value: unknown): PrReadyProof;
2273
2368
  declare function readPrReadyProof(filePath: string): PrReadyProof;
2274
2369
  declare function runPrReady(args: PrReadyArgs, dependencies?: PrReadyDependencies): Promise<PrReadyProof>;
2275
2370
  //#endregion
2276
- //#region src/required-check-policy.d.ts
2277
- declare const EVIDENCE_CHECK_TYPES: readonly ["review", "verify"];
2278
- type EvidenceCheckType = (typeof EVIDENCE_CHECK_TYPES)[number];
2279
- declare const requiredCheckScopeSchema: z.ZodObject<{
2280
- classifications: z.ZodArray<z.ZodEnum<{
2281
- "docs/process-only": "docs/process-only";
2282
- trivial: "trivial";
2283
- "non-trivial": "non-trivial";
2284
- }>>;
2285
- }, z.core.$strict>;
2286
- type RequiredCheckScope = z.infer<typeof requiredCheckScopeSchema>;
2287
- interface RequiredCheckScopeContext {
2288
- catchUpRecognition?: CatchUpRecognition;
2289
- classification: DiffClassification | undefined;
2290
- impactStamp?: ImpactStamp;
2291
- }
2292
- interface ScopeDecision {
2293
- inScope: boolean;
2294
- reason: string;
2295
- }
2296
- declare const requiredCheckInScope: ({
2297
- context,
2298
- scope
2299
- }: {
2300
- context: RequiredCheckScopeContext;
2301
- scope?: RequiredCheckScope;
2302
- }) => ScopeDecision;
2303
- interface RequiredCheck {
2304
- name: string;
2305
- checkType: EvidenceCheckType;
2306
- scope?: RequiredCheckScope;
2307
- }
2308
- //#endregion
2309
2371
  //#region src/factory-session.d.ts
2310
2372
  declare const resolveAuthoringSessionIds: ({
2311
2373
  override,
@@ -2337,8 +2399,8 @@ declare const evidenceEnvelopeBaseSchema: z.ZodObject<{
2337
2399
  producer: z.ZodString;
2338
2400
  requestId: z.ZodOptional<z.ZodString>;
2339
2401
  rung: z.ZodOptional<z.ZodEnum<{
2340
- oracle: "oracle";
2341
2402
  "independent-model": "independent-model";
2403
+ oracle: "oracle";
2342
2404
  human: "human";
2343
2405
  }>>;
2344
2406
  schemaVersion: z.ZodLiteral<1>;
@@ -2364,8 +2426,8 @@ declare const evidenceEnvelopeSchema: z.ZodObject<{
2364
2426
  producer: z.ZodString;
2365
2427
  requestId: z.ZodOptional<z.ZodString>;
2366
2428
  rung: z.ZodOptional<z.ZodEnum<{
2367
- oracle: "oracle";
2368
2429
  "independent-model": "independent-model";
2430
+ oracle: "oracle";
2369
2431
  human: "human";
2370
2432
  }>>;
2371
2433
  schemaVersion: z.ZodLiteral<1>;
@@ -2467,10 +2529,10 @@ declare const loadEvidenceEnvelopes: (cwd: string) => LoadedEvidenceEnvelope[];
2467
2529
  //#region src/review-proof-applicability.d.ts
2468
2530
  declare const REVIEW_STATUS_VALUES: readonly ["not-required", "current", "stale", "missing", "blocked"];
2469
2531
  declare const reviewStatusSchema: z.ZodEnum<{
2470
- "not-required": "not-required";
2471
- stale: "stale";
2472
2532
  blocked: "blocked";
2533
+ "not-required": "not-required";
2473
2534
  current: "current";
2535
+ stale: "stale";
2474
2536
  missing: "missing";
2475
2537
  }>;
2476
2538
  type ReviewStatus = z.infer<typeof reviewStatusSchema>;
@@ -2585,8 +2647,8 @@ declare const boundaryCheckProofSchema: z.ZodObject<{
2585
2647
  wave: z.ZodString;
2586
2648
  }, z.core.$strip>>;
2587
2649
  demandedRung: z.ZodOptional<z.ZodEnum<{
2588
- oracle: "oracle";
2589
2650
  "independent-model": "independent-model";
2651
+ oracle: "oracle";
2590
2652
  human: "human";
2591
2653
  }>>;
2592
2654
  epicIssue: z.ZodNumber;
@@ -2601,8 +2663,8 @@ declare const boundaryCheckProofSchema: z.ZodObject<{
2601
2663
  commentUrl: z.ZodOptional<z.ZodString>;
2602
2664
  producer: z.ZodString;
2603
2665
  rung: z.ZodEnum<{
2604
- oracle: "oracle";
2605
2666
  "independent-model": "independent-model";
2667
+ oracle: "oracle";
2606
2668
  human: "human";
2607
2669
  }>;
2608
2670
  sessionId: z.ZodOptional<z.ZodString>;
@@ -2618,8 +2680,8 @@ declare const boundaryCheckProofSchema: z.ZodObject<{
2618
2680
  value: z.ZodString;
2619
2681
  }, z.core.$strip>>;
2620
2682
  status: z.ZodEnum<{
2621
- blocked: "blocked";
2622
2683
  ready: "ready";
2684
+ blocked: "blocked";
2623
2685
  }>;
2624
2686
  }, z.core.$strip>;
2625
2687
  type BoundaryCheckProofRecord = z.infer<typeof boundaryCheckProofSchema>;
@@ -2740,6 +2802,7 @@ type CatchUpRecognizer = (input: {
2740
2802
  //#endregion
2741
2803
  //#region src/pr-review.d.ts
2742
2804
  interface PrReviewArgs extends LoadProjectProfileInput {
2805
+ assemble?: boolean;
2743
2806
  base: string;
2744
2807
  cycle: number;
2745
2808
  dispositions?: string;
@@ -2754,10 +2817,18 @@ interface PrReviewGitDependencies {
2754
2817
  currentHeadSha: (cwd: string) => string;
2755
2818
  isAncestor: (cwd: string, ancestor: string, descendant: string) => boolean;
2756
2819
  recognizeCatchUp?: CatchUpRecognizer;
2820
+ repositoryRoot?: (cwd: string) => string;
2821
+ showFileAtRef?: (cwd: string, ref: string, absolutePath: string) => string | undefined;
2757
2822
  stablePatchId: (cwd: string, base: string) => string;
2758
2823
  statusPorcelain: (cwd: string) => string;
2759
2824
  }
2825
+ interface PrReviewIssueBodyInput {
2826
+ issue: number;
2827
+ owner: string;
2828
+ repo: string;
2829
+ }
2760
2830
  interface PrReviewDependencies {
2831
+ fetchIssueBody?: (input: PrReviewIssueBodyInput) => string;
2761
2832
  git?: PrReviewGitDependencies;
2762
2833
  hq?: HqIngestDependencies;
2763
2834
  }
@@ -3077,11 +3148,11 @@ declare const LegacyWorkerCloseoutStatusTraceEventSchema: z.ZodObject<{
3077
3148
  threadId: z.ZodOptional<z.ZodString>;
3078
3149
  workerId: z.ZodOptional<z.ZodString>;
3079
3150
  archiveStatus: z.ZodOptional<z.ZodEnum<{
3151
+ pending: "pending";
3080
3152
  unavailable: "unavailable";
3081
3153
  archived: "archived";
3082
3154
  skipped: "skipped";
3083
3155
  "not-applicable": "not-applicable";
3084
- pending: "pending";
3085
3156
  }>>;
3086
3157
  closeoutReason: z.ZodOptional<z.ZodString>;
3087
3158
  eventType: z.ZodLiteral<"worker-closeout-lessons">;
@@ -3254,8 +3325,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3254
3325
  sessionId: z.ZodOptional<z.ZodString>;
3255
3326
  }, z.core.$strict>>;
3256
3327
  stage: z.ZodEnum<{
3257
- interior: "interior";
3258
3328
  gate: "gate";
3329
+ interior: "interior";
3259
3330
  }>;
3260
3331
  usage: z.ZodOptional<z.ZodObject<{
3261
3332
  estimatedCostUsd: z.ZodOptional<z.ZodNumber>;
@@ -3307,8 +3378,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3307
3378
  sessionId: z.ZodOptional<z.ZodString>;
3308
3379
  }, z.core.$strict>>;
3309
3380
  stage: z.ZodEnum<{
3310
- interior: "interior";
3311
3381
  gate: "gate";
3382
+ interior: "interior";
3312
3383
  }>;
3313
3384
  usage: z.ZodOptional<z.ZodObject<{
3314
3385
  estimatedCostUsd: z.ZodOptional<z.ZodNumber>;
@@ -3351,8 +3422,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3351
3422
  sessionId: z.ZodOptional<z.ZodString>;
3352
3423
  }, z.core.$strict>>;
3353
3424
  stage: z.ZodEnum<{
3354
- interior: "interior";
3355
3425
  gate: "gate";
3426
+ interior: "interior";
3356
3427
  }>;
3357
3428
  usage: z.ZodOptional<z.ZodObject<{
3358
3429
  estimatedCostUsd: z.ZodOptional<z.ZodNumber>;
@@ -3382,7 +3453,7 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3382
3453
  staleRepeats: number;
3383
3454
  };
3384
3455
  observedAt: string;
3385
- stage: "interior" | "gate";
3456
+ stage: "gate" | "interior";
3386
3457
  issue?: number | undefined;
3387
3458
  pr?: number | undefined;
3388
3459
  threadId?: string | undefined;
@@ -3475,11 +3546,11 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3475
3546
  threadId: z.ZodOptional<z.ZodString>;
3476
3547
  workerId: z.ZodOptional<z.ZodString>;
3477
3548
  archiveStatus: z.ZodOptional<z.ZodEnum<{
3549
+ pending: "pending";
3478
3550
  unavailable: "unavailable";
3479
3551
  archived: "archived";
3480
3552
  skipped: "skipped";
3481
3553
  "not-applicable": "not-applicable";
3482
- pending: "pending";
3483
3554
  }>>;
3484
3555
  closeoutReason: z.ZodOptional<z.ZodString>;
3485
3556
  eventType: z.ZodLiteral<"worker-closeout-lessons">;
@@ -3516,11 +3587,11 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3516
3587
  }, z.core.$strict>], "lessonStatus">;
3517
3588
  readonly 2: z.ZodObject<{
3518
3589
  archiveStatus: z.ZodOptional<z.ZodEnum<{
3590
+ pending: "pending";
3519
3591
  unavailable: "unavailable";
3520
3592
  archived: "archived";
3521
3593
  skipped: "skipped";
3522
3594
  "not-applicable": "not-applicable";
3523
- pending: "pending";
3524
3595
  }>>;
3525
3596
  closeoutReason: z.ZodOptional<z.ZodString>;
3526
3597
  lessonStatus: z.ZodOptional<z.ZodEnum<{
@@ -3658,8 +3729,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3658
3729
  model: z.ZodString;
3659
3730
  tier: z.ZodEnum<{
3660
3731
  review: "review";
3661
- delegate: "delegate";
3662
3732
  oracle: "oracle";
3733
+ delegate: "delegate";
3663
3734
  workhorse: "workhorse";
3664
3735
  scout: "scout";
3665
3736
  }>;
@@ -3667,8 +3738,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3667
3738
  startedAt: z.ZodString;
3668
3739
  tier: z.ZodEnum<{
3669
3740
  review: "review";
3670
- delegate: "delegate";
3671
3741
  oracle: "oracle";
3742
+ delegate: "delegate";
3672
3743
  workhorse: "workhorse";
3673
3744
  scout: "scout";
3674
3745
  }>;
@@ -3737,8 +3808,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3737
3808
  model: z.ZodString;
3738
3809
  tier: z.ZodEnum<{
3739
3810
  review: "review";
3740
- delegate: "delegate";
3741
3811
  oracle: "oracle";
3812
+ delegate: "delegate";
3742
3813
  workhorse: "workhorse";
3743
3814
  scout: "scout";
3744
3815
  }>;
@@ -3746,8 +3817,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3746
3817
  startedAt: z.ZodString;
3747
3818
  tier: z.ZodEnum<{
3748
3819
  review: "review";
3749
- delegate: "delegate";
3750
3820
  oracle: "oracle";
3821
+ delegate: "delegate";
3751
3822
  workhorse: "workhorse";
3752
3823
  scout: "scout";
3753
3824
  }>;
@@ -3807,8 +3878,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3807
3878
  model: z.ZodString;
3808
3879
  tier: z.ZodEnum<{
3809
3880
  review: "review";
3810
- delegate: "delegate";
3811
3881
  oracle: "oracle";
3882
+ delegate: "delegate";
3812
3883
  workhorse: "workhorse";
3813
3884
  scout: "scout";
3814
3885
  }>;
@@ -3816,8 +3887,8 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3816
3887
  startedAt: z.ZodString;
3817
3888
  tier: z.ZodEnum<{
3818
3889
  review: "review";
3819
- delegate: "delegate";
3820
3890
  oracle: "oracle";
3891
+ delegate: "delegate";
3821
3892
  workhorse: "workhorse";
3822
3893
  scout: "scout";
3823
3894
  }>;
@@ -3866,11 +3937,11 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3866
3937
  engine: string;
3867
3938
  layerSource: "committedDefault" | "operatorSession" | "userConfig";
3868
3939
  model: string;
3869
- tier: "review" | "delegate" | "oracle" | "workhorse" | "scout";
3940
+ tier: "review" | "oracle" | "delegate" | "workhorse" | "scout";
3870
3941
  fallbackTier?: "delegate" | undefined;
3871
3942
  };
3872
3943
  startedAt: string;
3873
- tier: "review" | "delegate" | "oracle" | "workhorse" | "scout";
3944
+ tier: "review" | "oracle" | "delegate" | "workhorse" | "scout";
3874
3945
  tokenUsage: {
3875
3946
  source: "cursor-csv" | "codex-json" | "cursor-json" | "claude-json";
3876
3947
  status: "available";
@@ -4192,7 +4263,7 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
4192
4263
  draft: boolean;
4193
4264
  mergeStateStatus: string;
4194
4265
  mergeable: string;
4195
- requiredChecks: "unknown" | "pending" | "passed" | "failed" | "none";
4266
+ requiredChecks: "unknown" | "passed" | "failed" | "pending" | "none";
4196
4267
  unresolvedReviewThreads: number;
4197
4268
  reviewDecision?: string | null | undefined;
4198
4269
  };
@@ -4207,13 +4278,13 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
4207
4278
  reviews: {
4208
4279
  correctness: {
4209
4280
  required: boolean;
4210
- status: "not-required" | "stale" | "blocked" | "current" | "missing";
4281
+ status: "blocked" | "not-required" | "current" | "stale" | "missing";
4211
4282
  reviewedHeadSha?: string | undefined;
4212
4283
  reviewedPatchId?: string | undefined;
4213
4284
  };
4214
4285
  security?: {
4215
4286
  required: boolean;
4216
- status: "not-required" | "stale" | "blocked" | "current" | "missing";
4287
+ status: "blocked" | "not-required" | "current" | "stale" | "missing";
4217
4288
  reviewedHeadSha?: string | undefined;
4218
4289
  reviewedPatchId?: string | undefined;
4219
4290
  } | undefined;
@@ -4276,7 +4347,7 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
4276
4347
  interior: number;
4277
4348
  };
4278
4349
  nextAction: "run-gate-cycle" | "accept-nonblocking-findings" | "escalate-to-triage" | "ready-for-human" | "advance-to-gate" | "run-interior-cycle";
4279
- stage: "interior" | "gate" | "interior-complete";
4350
+ stage: "gate" | "interior" | "interior-complete";
4280
4351
  forcedTransition?: "gate-cap-exhausted" | "interior-cap-reached" | undefined;
4281
4352
  } | undefined;
4282
4353
  reviewRuns?: PrReviewResult[] | undefined;
@@ -4533,6 +4604,7 @@ declare const reviewFocusFromIssueBody: (body: string) => string | undefined;
4533
4604
  interface AssembleReviewPromptInput {
4534
4605
  base: string;
4535
4606
  changedFiles: string[];
4607
+ cwd?: string;
4536
4608
  headSha: string;
4537
4609
  issueFocus?: IssueReviewFocus;
4538
4610
  kind: PrReviewKind;
@@ -4540,6 +4612,13 @@ interface AssembleReviewPromptInput {
4540
4612
  priorLedgerEntries?: FindingLedgerEntry[];
4541
4613
  profile: FactoryProjectProfile;
4542
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
+ }
4543
4622
  interface AssembledReviewPrompt {
4544
4623
  prompt: string;
4545
4624
  sections: ReviewPromptSection[];
@@ -4547,13 +4626,14 @@ interface AssembledReviewPrompt {
4547
4626
  declare const assembleReviewPrompt: ({
4548
4627
  base,
4549
4628
  changedFiles,
4629
+ cwd,
4550
4630
  headSha,
4551
4631
  issueFocus,
4552
4632
  kind,
4553
4633
  patchId,
4554
4634
  priorLedgerEntries,
4555
4635
  profile
4556
- }: AssembleReviewPromptInput) => AssembledReviewPrompt;
4636
+ }: AssembleReviewPromptInput, dependencies?: AssembleReviewPromptDependencies) => AssembledReviewPrompt;
4557
4637
  //#endregion
4558
4638
  //#region src/review-ladder-trace.d.ts
4559
4639
  interface ReviewLadderTraceIdentity {