@patronage/software-factory 1.0.0-alpha.47 → 1.0.0-alpha.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { Command } from "commander";
2
- import { existsSync, readFileSync, rmSync } from "node:fs";
3
- import { PreviewProofRegistration } from "@patronage/factory-ci";
4
2
  import { z } from "zod";
3
+ import { existsSync, readFileSync, rmSync } from "node:fs";
5
4
  /**
6
5
  * The opt-in broker permission set (#1360): `actions: read`, `checks: read`,
7
6
  * `contents: read`, `issues: read`, and `pull_requests: write` on the
@@ -75,8 +74,9 @@ interface FactoryAppAccessDependencies {
75
74
  /**
76
75
  * The GitHub calls a Cursor VM's own `gh` credential cannot make (#1327).
77
76
  * Cursor mints the VM token without `pull_requests: write` or `issues`, so on
78
- * a Cursor managed runtime pull request creation, body edits, issue reads,
79
- * and the PR status HUD's pull request read use the broker's admission token.
77
+ * a Cursor managed runtime pull request creation, body edits, the
78
+ * `factory:hold` label (#1653), issue reads, and the PR status HUD's pull
79
+ * request read use the broker's admission token.
80
80
  * Its scope is `actions: read`, `checks: read`, `contents: read`,
81
81
  * `issues: read`, and `pull_requests: write` (#1360, #1375, #1457).
82
82
  * Contents read supports creation's head and base ref reads; checks and
@@ -85,7 +85,7 @@ interface FactoryAppAccessDependencies {
85
85
  * retry with a different identity. Push, marking ready, arming auto-merge,
86
86
  * check-run writes, and other calls keep their own credential.
87
87
  */
88
- type AdmissionOperation = "create-pull-request" | "edit-pull-request-body" | "read-pull-request" | "read-issue" | "read-pull-request-for-status-hud";
88
+ type AdmissionOperation = "add-hold-label" | "create-pull-request" | "edit-pull-request-body" | "read-pull-request" | "read-issue" | "read-pull-request-for-status-hud";
89
89
  /** The one repository the admission token is minted for. */
90
90
  interface AdmissionRepository {
91
91
  owner: string;
@@ -1550,6 +1550,7 @@ declare const factoryProjectProfileSchema: z.ZodObject<{
1550
1550
  conditional: z.ZodArray<z.ZodObject<{
1551
1551
  paths: z.ZodArray<z.ZodString>;
1552
1552
  }, z.core.$strict>>;
1553
+ roundsWithoutWaiver: z.ZodOptional<z.ZodNumber>;
1553
1554
  }, z.core.$strict>>;
1554
1555
  schemaVersion: z.ZodLiteral<6>;
1555
1556
  verification: z.ZodObject<{
@@ -1760,6 +1761,13 @@ interface PrVerifyProof {
1760
1761
  * not move.
1761
1762
  */
1762
1763
  runner?: PrVerifyRunner;
1764
+ /**
1765
+ * `whole-tree` when every command saw the whole tree as its run context
1766
+ * (#1658): the empty-tree base ref and every tracked path. Absent means the
1767
+ * commands saw the diff and may have scoped themselves to it. Only a
1768
+ * whole-tree proof can stand in for a merge target's hosted battery.
1769
+ */
1770
+ runScope?: "whole-tree";
1763
1771
  startedAt: string;
1764
1772
  verificationCommands: PrVerifyCommandResult[];
1765
1773
  }
@@ -2063,6 +2071,11 @@ interface PrVerifyCheckPayload {
2063
2071
  proofSchemaVersion: number;
2064
2072
  /** `<owner>/<name>` the proof was produced for. */
2065
2073
  repository?: string;
2074
+ /**
2075
+ * `whole-tree` when every command saw the whole tree (#1658). The hosted
2076
+ * gate reuses a proof on a merge-target push only when it says so.
2077
+ */
2078
+ runScope?: "whole-tree";
2066
2079
  /** Version of *this* payload shape. */
2067
2080
  schemaVersion: typeof PR_VERIFY_CHECK_PAYLOAD_SCHEMA_VERSION;
2068
2081
  /** The proof's command-to-impact-target bindings used to validate releases. */
@@ -2281,7 +2294,7 @@ declare const isHostedVerifyCheck: (check: StatusCheckRollup) => boolean;
2281
2294
  * The workflow renames that job so the pinned `verify` context does not exist
2282
2295
  * while the candidate is a draft. The generator that emits the workflow owns
2283
2296
  * the literal; this is the reader's copy of it, and
2284
- * `software-factory-hq/alchemy/verify-workflow.test.ts` pins the two equal.
2297
+ * `software-factory-hq/workflow-tests/verify-workflow.test.ts` pins the two equal.
2285
2298
  */
2286
2299
  declare const HOSTED_VERIFY_DRAFT_CHECK_NAME = "verify (draft)";
2287
2300
  /**
@@ -2480,12 +2493,34 @@ type CandidatePullRequestLookup = {
2480
2493
  reason: string;
2481
2494
  status: "unavailable";
2482
2495
  };
2496
+ interface RunCommandResult {
2497
+ stderr: string;
2498
+ stdout: string;
2499
+ }
2500
+ declare function runCapture(command: string, args: string[], cwd: string, options?: {
2501
+ acceptableExitCodes?: readonly number[];
2502
+ /**
2503
+ * Variables for this one subprocess only, over the inherited environment.
2504
+ * The admission token rides here (#1327), never on `process.env`.
2505
+ */
2506
+ extraEnv?: Readonly<Record<string, string>>;
2507
+ /**
2508
+ * Overrides the default ten-minute bound for a command known to run
2509
+ * longer. Prefer this to raising the default for every caller.
2510
+ */
2511
+ timeoutMs?: number;
2512
+ }): RunCommandResult;
2483
2513
  interface HoldPullRequestInput {
2484
2514
  cwd: string;
2485
2515
  owner: string;
2486
2516
  pr: number;
2487
2517
  repo: string;
2488
2518
  }
2519
+ interface HoldPullRequestDependencies {
2520
+ /** Defaults to the process-wide admission credential. */
2521
+ admission?: AdmissionCredential | undefined;
2522
+ run?: typeof runCapture;
2523
+ }
2489
2524
  export declare const MERGE_FREEZE_CHECK_NAME = "patronage-factory/merge-freeze";
2490
2525
  /**
2491
2526
  * The Factory App's slug, as GitHub serves it on the runs the writer posts.
@@ -2640,6 +2675,60 @@ interface GitHubCheckRunMergeFreezeApi {
2640
2675
  }) => unknown;
2641
2676
  }
2642
2677
  export declare function createGitHubCheckRunMergeFreezeStore(api: GitHubCheckRunMergeFreezeApi): MergeFreezeAuthority;
2678
+ declare const localPreviewStageBrand: unique symbol;
2679
+ type LocalPreviewStage = string & {
2680
+ readonly [localPreviewStageBrand]: true;
2681
+ };
2682
+ /**
2683
+ * Preview-proof lifecycle: admit a disposable preview, register envelope-bound
2684
+ * proof at head, and record cleanup. One `transition` path owns those state
2685
+ * changes. Recovery (#766) re-enters cleanup through the same event. Hosted
2686
+ * inventory listing and cleanup-outcome persistence live in
2687
+ * `previewProofInventory`, which sits on the registration read model `resolve`
2688
+ * already returns.
2689
+ *
2690
+ * Proof sits entirely on one side of GitHub's draft/ready boundary
2691
+ * (paitronage#1089): a draft candidate cannot begin or register. Machine
2692
+ * evidence is the envelope at head (#355), never a PR comment. The SHA and
2693
+ * repository bind that proof (#1312): a detached HEAD or a branch name that
2694
+ * differs from the PR head is the same commit, and the registration records
2695
+ * `branch: "(detached)"`.
2696
+ */
2697
+ type PreviewProofCleanupStatus = "failed" | "passed" | "pending";
2698
+ interface PreviewProofRegistration {
2699
+ /**
2700
+ * Present only when the checkout is detached or its branch name is not the
2701
+ * PR head. The `(detached)` sentinel is on the lifecycle registration
2702
+ * `transition` returns, and `previewProofInventory` does not persist it.
2703
+ * It is not a branch to check out.
2704
+ */
2705
+ readonly branch?: "(detached)";
2706
+ readonly cleanup: {
2707
+ readonly evidence: readonly string[];
2708
+ readonly outcome: PreviewProofCleanupStatus;
2709
+ readonly runUrl?: string;
2710
+ };
2711
+ readonly convergence: {
2712
+ readonly detail: string;
2713
+ readonly status: "passed";
2714
+ };
2715
+ readonly headSha: string;
2716
+ readonly pr: number;
2717
+ readonly proof: {
2718
+ readonly check: string;
2719
+ readonly headSha: string;
2720
+ readonly mergeBaseSha: string;
2721
+ readonly patchId: string;
2722
+ };
2723
+ readonly smoke: {
2724
+ readonly detail: string;
2725
+ readonly outcome: "passed";
2726
+ };
2727
+ readonly source: "local-self-certified";
2728
+ readonly stack: string;
2729
+ readonly stage: LocalPreviewStage;
2730
+ readonly url: string;
2731
+ }
2643
2732
  /**
2644
2733
  * Read a branch tip from GitHub rather than a checkout's cached remote ref.
2645
2734
  * `gh` is injectable so a test can hand the real read a fake GitHub.
@@ -3202,7 +3291,7 @@ interface PrReadyDependencies {
3202
3291
  */
3203
3292
  armingPolicy?: ArmingPolicyReads;
3204
3293
  /** Applies `factory:hold` for `--hold` (#1513). Defaults to the REST call. */
3205
- holdPullRequest?: (input: HoldPullRequestInput) => Promise<void> | void;
3294
+ holdPullRequest?: (input: HoldPullRequestInput, dependencies?: HoldPullRequestDependencies) => Promise<void> | void;
3206
3295
  /**
3207
3296
  * Reads the authoritative base review policy (#922): the profile committed at
3208
3297
  * the live tip of the PR's own base ref. Defaults to the real GitHub reads,
@@ -3473,6 +3562,11 @@ interface PrVerifyGitDependencies {
3473
3562
  checkoutRepository?: (cwd: string) => CheckoutRepository;
3474
3563
  currentHeadSha: (cwd: string) => string;
3475
3564
  emptyTreeHash: (cwd: string) => string;
3565
+ /**
3566
+ * Every path tracked at `ref` (#1658). Optional so existing fakes stay
3567
+ * valid; absent, the run never claims `runScope: "whole-tree"`.
3568
+ */
3569
+ trackedFilesAt?: (cwd: string, ref: string) => string[];
3476
3570
  /** Bring `refs/heads/<refName>` from origin into the checkout (#1132). */
3477
3571
  fetchOriginRef?: (cwd: string, refName: string) => void;
3478
3572
  mergeBaseSha: (cwd: string, base: string) => string;
@@ -4102,402 +4196,6 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
4102
4196
  typeVersion: 1;
4103
4197
  }>];
4104
4198
  type FactoryTraceEvent = FactoryTraceEventFromDefinitions<typeof FACTORY_TRACE_EVENT_DEFINITIONS>;
4105
- declare const { appendFactoryTraceEventSchema: AppendFactoryTraceEventSchema, factoryTraceEventSchema: FactoryTraceEventSchema, payloadSchemaRegistry, payloadVersions: FACTORY_TRACE_PAYLOAD_VERSIONS, wirePayloadFor }: {
4106
- appendFactoryTraceEventSchema: z.ZodType<{
4107
- createdAt: string;
4108
- eventId: string;
4109
- issue?: number | undefined;
4110
- pr?: number | undefined;
4111
- repo: string;
4112
- schemaVersion: 1;
4113
- threadId?: string | undefined;
4114
- workerId?: string | undefined;
4115
- base: string;
4116
- changedFiles: string[];
4117
- headSha: string;
4118
- maxReviewCycles: number;
4119
- observedAt: string;
4120
- outcome: "not-required";
4121
- patchId: string;
4122
- reason: "faithful-merge" | "no-applicable-mode";
4123
- reviewCycle: number;
4124
- eventType: "review-gate";
4125
- typeVersion: 1;
4126
- } | {
4127
- createdAt: string;
4128
- eventId: string;
4129
- issue?: number | undefined;
4130
- pr?: number | undefined;
4131
- repo: string;
4132
- schemaVersion: 1;
4133
- threadId?: string | undefined;
4134
- workerId?: string | undefined;
4135
- cycle: number;
4136
- cyclesToClean?: number | undefined;
4137
- engine?: string | undefined;
4138
- findingsSummary: {
4139
- blocking: number;
4140
- bySeverity: {
4141
- critical: number;
4142
- high: number;
4143
- low: number;
4144
- medium: number;
4145
- unknown: number;
4146
- };
4147
- flagged: number;
4148
- open: number;
4149
- staleRepeats: number;
4150
- };
4151
- forcedTransition?: "gate-cap-exhausted" | "interior-cap-reached" | undefined;
4152
- headSha?: string | undefined;
4153
- model?: string | undefined;
4154
- observedAt: string;
4155
- patchId?: string | undefined;
4156
- session?: {
4157
- orchestrationMode?: "autonomous" | "manual" | undefined;
4158
- resumedSession?: boolean | undefined;
4159
- runtime?: string | undefined;
4160
- sessionId?: string | undefined;
4161
- } | undefined;
4162
- stage: "gate" | "interior";
4163
- usage?: {
4164
- estimatedCostUsd?: number | undefined;
4165
- source?: string | undefined;
4166
- totalTokens?: number | undefined;
4167
- } | undefined;
4168
- eventType: "review-ladder-stage";
4169
- typeVersion: 1;
4170
- }, unknown, z.core.$ZodTypeInternals<{
4171
- createdAt: string;
4172
- eventId: string;
4173
- issue?: number | undefined;
4174
- pr?: number | undefined;
4175
- repo: string;
4176
- schemaVersion: 1;
4177
- threadId?: string | undefined;
4178
- workerId?: string | undefined;
4179
- base: string;
4180
- changedFiles: string[];
4181
- headSha: string;
4182
- maxReviewCycles: number;
4183
- observedAt: string;
4184
- outcome: "not-required";
4185
- patchId: string;
4186
- reason: "faithful-merge" | "no-applicable-mode";
4187
- reviewCycle: number;
4188
- eventType: "review-gate";
4189
- typeVersion: 1;
4190
- } | {
4191
- createdAt: string;
4192
- eventId: string;
4193
- issue?: number | undefined;
4194
- pr?: number | undefined;
4195
- repo: string;
4196
- schemaVersion: 1;
4197
- threadId?: string | undefined;
4198
- workerId?: string | undefined;
4199
- cycle: number;
4200
- cyclesToClean?: number | undefined;
4201
- engine?: string | undefined;
4202
- findingsSummary: {
4203
- blocking: number;
4204
- bySeverity: {
4205
- critical: number;
4206
- high: number;
4207
- low: number;
4208
- medium: number;
4209
- unknown: number;
4210
- };
4211
- flagged: number;
4212
- open: number;
4213
- staleRepeats: number;
4214
- };
4215
- forcedTransition?: "gate-cap-exhausted" | "interior-cap-reached" | undefined;
4216
- headSha?: string | undefined;
4217
- model?: string | undefined;
4218
- observedAt: string;
4219
- patchId?: string | undefined;
4220
- session?: {
4221
- orchestrationMode?: "autonomous" | "manual" | undefined;
4222
- resumedSession?: boolean | undefined;
4223
- runtime?: string | undefined;
4224
- sessionId?: string | undefined;
4225
- } | undefined;
4226
- stage: "gate" | "interior";
4227
- usage?: {
4228
- estimatedCostUsd?: number | undefined;
4229
- source?: string | undefined;
4230
- totalTokens?: number | undefined;
4231
- } | undefined;
4232
- eventType: "review-ladder-stage";
4233
- typeVersion: 1;
4234
- }, unknown>>;
4235
- appendUnionSchemas: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>[];
4236
- definitionByKind: Record<string, {
4237
- emit: (event: {
4238
- createdAt: string;
4239
- eventId: string;
4240
- issue?: number | undefined;
4241
- pr?: number | undefined;
4242
- repo: string;
4243
- schemaVersion: 1;
4244
- threadId?: string | undefined;
4245
- workerId?: string | undefined;
4246
- base: string;
4247
- changedFiles: string[];
4248
- headSha: string;
4249
- maxReviewCycles: number;
4250
- observedAt: string;
4251
- outcome: "not-required";
4252
- patchId: string;
4253
- reason: "faithful-merge" | "no-applicable-mode";
4254
- reviewCycle: number;
4255
- eventType: "review-gate";
4256
- typeVersion: 1;
4257
- } | {
4258
- createdAt: string;
4259
- eventId: string;
4260
- issue?: number | undefined;
4261
- pr?: number | undefined;
4262
- repo: string;
4263
- schemaVersion: 1;
4264
- threadId?: string | undefined;
4265
- workerId?: string | undefined;
4266
- cycle: number;
4267
- cyclesToClean?: number | undefined;
4268
- engine?: string | undefined;
4269
- findingsSummary: {
4270
- blocking: number;
4271
- bySeverity: {
4272
- critical: number;
4273
- high: number;
4274
- low: number;
4275
- medium: number;
4276
- unknown: number;
4277
- };
4278
- flagged: number;
4279
- open: number;
4280
- staleRepeats: number;
4281
- };
4282
- forcedTransition?: "gate-cap-exhausted" | "interior-cap-reached" | undefined;
4283
- headSha?: string | undefined;
4284
- model?: string | undefined;
4285
- observedAt: string;
4286
- patchId?: string | undefined;
4287
- session?: {
4288
- orchestrationMode?: "autonomous" | "manual" | undefined;
4289
- resumedSession?: boolean | undefined;
4290
- runtime?: string | undefined;
4291
- sessionId?: string | undefined;
4292
- } | undefined;
4293
- stage: "gate" | "interior";
4294
- usage?: {
4295
- estimatedCostUsd?: number | undefined;
4296
- source?: string | undefined;
4297
- totalTokens?: number | undefined;
4298
- } | undefined;
4299
- eventType: "review-ladder-stage";
4300
- typeVersion: 1;
4301
- }) => unknown;
4302
- }>;
4303
- factoryTraceEventSchema: z.ZodType<{
4304
- createdAt: string;
4305
- eventId: string;
4306
- issue?: number | undefined;
4307
- pr?: number | undefined;
4308
- repo: string;
4309
- schemaVersion: 1;
4310
- threadId?: string | undefined;
4311
- workerId?: string | undefined;
4312
- base: string;
4313
- changedFiles: string[];
4314
- headSha: string;
4315
- maxReviewCycles: number;
4316
- observedAt: string;
4317
- outcome: "not-required";
4318
- patchId: string;
4319
- reason: "faithful-merge" | "no-applicable-mode";
4320
- reviewCycle: number;
4321
- eventType: "review-gate";
4322
- typeVersion: 1;
4323
- } | {
4324
- createdAt: string;
4325
- eventId: string;
4326
- issue?: number | undefined;
4327
- pr?: number | undefined;
4328
- repo: string;
4329
- schemaVersion: 1;
4330
- threadId?: string | undefined;
4331
- workerId?: string | undefined;
4332
- cycle: number;
4333
- cyclesToClean?: number | undefined;
4334
- engine?: string | undefined;
4335
- findingsSummary: {
4336
- blocking: number;
4337
- bySeverity: {
4338
- critical: number;
4339
- high: number;
4340
- low: number;
4341
- medium: number;
4342
- unknown: number;
4343
- };
4344
- flagged: number;
4345
- open: number;
4346
- staleRepeats: number;
4347
- };
4348
- forcedTransition?: "gate-cap-exhausted" | "interior-cap-reached" | undefined;
4349
- headSha?: string | undefined;
4350
- model?: string | undefined;
4351
- observedAt: string;
4352
- patchId?: string | undefined;
4353
- session?: {
4354
- orchestrationMode?: "autonomous" | "manual" | undefined;
4355
- resumedSession?: boolean | undefined;
4356
- runtime?: string | undefined;
4357
- sessionId?: string | undefined;
4358
- } | undefined;
4359
- stage: "gate" | "interior";
4360
- usage?: {
4361
- estimatedCostUsd?: number | undefined;
4362
- source?: string | undefined;
4363
- totalTokens?: number | undefined;
4364
- } | undefined;
4365
- eventType: "review-ladder-stage";
4366
- typeVersion: 1;
4367
- }, unknown, z.core.$ZodTypeInternals<{
4368
- createdAt: string;
4369
- eventId: string;
4370
- issue?: number | undefined;
4371
- pr?: number | undefined;
4372
- repo: string;
4373
- schemaVersion: 1;
4374
- threadId?: string | undefined;
4375
- workerId?: string | undefined;
4376
- base: string;
4377
- changedFiles: string[];
4378
- headSha: string;
4379
- maxReviewCycles: number;
4380
- observedAt: string;
4381
- outcome: "not-required";
4382
- patchId: string;
4383
- reason: "faithful-merge" | "no-applicable-mode";
4384
- reviewCycle: number;
4385
- eventType: "review-gate";
4386
- typeVersion: 1;
4387
- } | {
4388
- createdAt: string;
4389
- eventId: string;
4390
- issue?: number | undefined;
4391
- pr?: number | undefined;
4392
- repo: string;
4393
- schemaVersion: 1;
4394
- threadId?: string | undefined;
4395
- workerId?: string | undefined;
4396
- cycle: number;
4397
- cyclesToClean?: number | undefined;
4398
- engine?: string | undefined;
4399
- findingsSummary: {
4400
- blocking: number;
4401
- bySeverity: {
4402
- critical: number;
4403
- high: number;
4404
- low: number;
4405
- medium: number;
4406
- unknown: number;
4407
- };
4408
- flagged: number;
4409
- open: number;
4410
- staleRepeats: number;
4411
- };
4412
- forcedTransition?: "gate-cap-exhausted" | "interior-cap-reached" | undefined;
4413
- headSha?: string | undefined;
4414
- model?: string | undefined;
4415
- observedAt: string;
4416
- patchId?: string | undefined;
4417
- session?: {
4418
- orchestrationMode?: "autonomous" | "manual" | undefined;
4419
- resumedSession?: boolean | undefined;
4420
- runtime?: string | undefined;
4421
- sessionId?: string | undefined;
4422
- } | undefined;
4423
- stage: "gate" | "interior";
4424
- usage?: {
4425
- estimatedCostUsd?: number | undefined;
4426
- source?: string | undefined;
4427
- totalTokens?: number | undefined;
4428
- } | undefined;
4429
- eventType: "review-ladder-stage";
4430
- typeVersion: 1;
4431
- }, unknown>>;
4432
- payloadSchemaRegistry: Record<string, Record<number, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
4433
- payloadVersions: Record<string, readonly number[]>;
4434
- readUnionSchemas: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>[];
4435
- wirePayloadFor: (event: {
4436
- createdAt: string;
4437
- eventId: string;
4438
- issue?: number | undefined;
4439
- pr?: number | undefined;
4440
- repo: string;
4441
- schemaVersion: 1;
4442
- threadId?: string | undefined;
4443
- workerId?: string | undefined;
4444
- base: string;
4445
- changedFiles: string[];
4446
- headSha: string;
4447
- maxReviewCycles: number;
4448
- observedAt: string;
4449
- outcome: "not-required";
4450
- patchId: string;
4451
- reason: "faithful-merge" | "no-applicable-mode";
4452
- reviewCycle: number;
4453
- eventType: "review-gate";
4454
- typeVersion: 1;
4455
- } | {
4456
- createdAt: string;
4457
- eventId: string;
4458
- issue?: number | undefined;
4459
- pr?: number | undefined;
4460
- repo: string;
4461
- schemaVersion: 1;
4462
- threadId?: string | undefined;
4463
- workerId?: string | undefined;
4464
- cycle: number;
4465
- cyclesToClean?: number | undefined;
4466
- engine?: string | undefined;
4467
- findingsSummary: {
4468
- blocking: number;
4469
- bySeverity: {
4470
- critical: number;
4471
- high: number;
4472
- low: number;
4473
- medium: number;
4474
- unknown: number;
4475
- };
4476
- flagged: number;
4477
- open: number;
4478
- staleRepeats: number;
4479
- };
4480
- forcedTransition?: "gate-cap-exhausted" | "interior-cap-reached" | undefined;
4481
- headSha?: string | undefined;
4482
- model?: string | undefined;
4483
- observedAt: string;
4484
- patchId?: string | undefined;
4485
- session?: {
4486
- orchestrationMode?: "autonomous" | "manual" | undefined;
4487
- resumedSession?: boolean | undefined;
4488
- runtime?: string | undefined;
4489
- sessionId?: string | undefined;
4490
- } | undefined;
4491
- stage: "gate" | "interior";
4492
- usage?: {
4493
- estimatedCostUsd?: number | undefined;
4494
- source?: string | undefined;
4495
- totalTokens?: number | undefined;
4496
- } | undefined;
4497
- eventType: "review-ladder-stage";
4498
- typeVersion: 1;
4499
- }) => unknown;
4500
- };
4501
4199
  type FactoryTraceEnvelope = z.infer<typeof FactoryTraceEnvelopeCoreSchema>;
4502
4200
  interface TraceSink {
4503
4201
  append: (envelope: FactoryTraceEnvelope) => void;
@@ -4843,6 +4541,12 @@ interface EvaluationInput {
4843
4541
  */
4844
4542
  policyIdentityRefusals?: string[];
4845
4543
  reviewProof?: PrReviewProof;
4544
+ /**
4545
+ * The review-round limit the authoritative base policy declares (#1280,
4546
+ * #922), resolved at the command boundary. Absent ⇒
4547
+ * `REVIEW_ROUNDS_WITHOUT_WAIVER`.
4548
+ */
4549
+ reviewRoundsWithoutWaiver?: number;
4846
4550
  verificationProof?: VerificationProofState;
4847
4551
  docsOnlyVerifyBaselineHeadShas?: string[];
4848
4552
  externalRequiredChecks?: RequiredCheck[];
@@ -5366,16 +5070,34 @@ interface VerificationRunContextInput {
5366
5070
  */
5367
5071
  lockfileImporters?: readonly string[];
5368
5072
  tmpDir?: string;
5073
+ /**
5074
+ * #1658: every tracked path in the tree under verification. When the run
5075
+ * forces the full suite and no lockfile scoping applies, the changed-files
5076
+ * list handed to commands is this list, so a command that reads
5077
+ * FACTORY_CHANGED_FILES directly (rather than through `psf affected`)
5078
+ * still covers the whole tree. That is what lets the proof record
5079
+ * `runScope: "whole-tree"`. Absent, the run never claims whole-tree.
5080
+ */
5081
+ trackedFiles?: () => string[];
5369
5082
  }
5370
5083
  interface VerificationEnv {
5371
5084
  env: Record<string, string>;
5372
5085
  cleanup: () => void;
5373
5086
  }
5087
+ /**
5088
+ * #1658: whether every verification command saw the whole tree. A
5089
+ * `whole-tree` run hands commands the empty-tree base ref and every tracked
5090
+ * path, so no command can scope itself to the diff; anything else is
5091
+ * `diff-scoped`, whatever each command then chose to do with it.
5092
+ */
5093
+ type VerificationRunScope = "diff-scoped" | "whole-tree";
5374
5094
  interface VerificationRunContext {
5375
5095
  readonly baseRef: string;
5376
5096
  readonly changedFiles: string[];
5377
5097
  readonly forcesFullSuite: boolean;
5378
5098
  readonly fullSuiteReasons: string[];
5099
+ /** Absent reads as `diff-scoped` (#1658). */
5100
+ readonly runScope?: VerificationRunScope;
5379
5101
  buildEnv: () => VerificationEnv;
5380
5102
  runSummaryLines: () => string[];
5381
5103
  }