@patronage/software-factory 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTEXT.md +39 -0
- package/LICENSE +21 -0
- package/README.md +55 -0
- package/dist/chunk-DrSxFLj_.js +14 -0
- package/dist/index.d.ts +4338 -0
- package/dist/index.js +15468 -0
- package/dist/review-prompts/correctness.md +1 -0
- package/dist/review-prompts/security/SKILL.md +80 -0
- package/dist/review-prompts/security/references/github-workflows.md +186 -0
- package/dist/review-prompts/security/references/javascript-typescript.md +69 -0
- package/dist/review-prompts/security/references/python.md +70 -0
- package/dist/review-prompts/thermo.md +9 -0
- package/dist/schemas.d.ts +1430 -0
- package/dist/schemas.js +771 -0
- package/package.json +89 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4338 @@
|
|
|
1
|
+
import { existsSync, readFileSync, rmSync } from "node:fs";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/github-issue-comments.d.ts
|
|
6
|
+
interface GithubIssueCommentApi {
|
|
7
|
+
author_association?: string;
|
|
8
|
+
body: string;
|
|
9
|
+
created_at: string;
|
|
10
|
+
html_url: string;
|
|
11
|
+
node_id: string;
|
|
12
|
+
updated_at: string;
|
|
13
|
+
user?: {
|
|
14
|
+
login?: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
interface GithubIssueComment {
|
|
18
|
+
author: {
|
|
19
|
+
login?: string;
|
|
20
|
+
};
|
|
21
|
+
authorAssociation?: string;
|
|
22
|
+
body: string;
|
|
23
|
+
createdAt: string;
|
|
24
|
+
id: string;
|
|
25
|
+
updatedAt: string;
|
|
26
|
+
url: string;
|
|
27
|
+
}
|
|
28
|
+
declare const normalizeIssueComments: (value: GithubIssueCommentApi[] | GithubIssueCommentApi[][]) => GithubIssueComment[];
|
|
29
|
+
declare namespace boundary_review_proof_d_exports {
|
|
30
|
+
export { BOUNDARY_REVIEW_PROOF_KIND, BoundaryReviewProof, BoundaryReviewProofComment, boundaryReviewProofSchema, selectBoundaryReviewProof, undispositionedBlockingFindings };
|
|
31
|
+
}
|
|
32
|
+
declare const BOUNDARY_REVIEW_PROOF_KIND = "boundary-review-proof";
|
|
33
|
+
declare const boundaryReviewProofBaseSchema: z.ZodObject<{
|
|
34
|
+
boundary: z.ZodString;
|
|
35
|
+
coveredSet: z.ZodArray<z.ZodObject<{
|
|
36
|
+
headSha: z.ZodOptional<z.ZodString>;
|
|
37
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
mergedSha: z.ZodOptional<z.ZodString>;
|
|
39
|
+
pr: z.ZodNumber;
|
|
40
|
+
state: z.ZodEnum<{
|
|
41
|
+
open: "open";
|
|
42
|
+
merged: "merged";
|
|
43
|
+
}>;
|
|
44
|
+
wave: z.ZodOptional<z.ZodString>;
|
|
45
|
+
}, z.core.$loose>>;
|
|
46
|
+
dispositions: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
47
|
+
findings: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
48
|
+
blockingAfterCap: z.ZodOptional<z.ZodBoolean>;
|
|
49
|
+
category: z.ZodOptional<z.ZodString>;
|
|
50
|
+
disposition: z.ZodOptional<z.ZodString>;
|
|
51
|
+
title: z.ZodString;
|
|
52
|
+
}, z.core.$loose>>>;
|
|
53
|
+
kind: z.ZodLiteral<"boundary-review-proof">;
|
|
54
|
+
manifestHash: z.ZodObject<{
|
|
55
|
+
algo: z.ZodLiteral<"sha256">;
|
|
56
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
57
|
+
value: z.ZodString;
|
|
58
|
+
}, z.core.$loose>;
|
|
59
|
+
outcome: z.ZodEnum<{
|
|
60
|
+
pass: "pass";
|
|
61
|
+
fail: "fail";
|
|
62
|
+
}>;
|
|
63
|
+
producer: z.ZodString;
|
|
64
|
+
rung: z.ZodEnum<{
|
|
65
|
+
oracle: "oracle";
|
|
66
|
+
"independent-model": "independent-model";
|
|
67
|
+
human: "human";
|
|
68
|
+
}>;
|
|
69
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
70
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
71
|
+
specHash: z.ZodOptional<z.ZodObject<{
|
|
72
|
+
algo: z.ZodLiteral<"sha256">;
|
|
73
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
74
|
+
value: z.ZodString;
|
|
75
|
+
}, z.core.$loose>>;
|
|
76
|
+
}, z.core.$loose>;
|
|
77
|
+
declare const boundaryReviewProofSchema: z.ZodObject<{
|
|
78
|
+
boundary: z.ZodString;
|
|
79
|
+
coveredSet: z.ZodArray<z.ZodObject<{
|
|
80
|
+
headSha: z.ZodOptional<z.ZodString>;
|
|
81
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
82
|
+
mergedSha: z.ZodOptional<z.ZodString>;
|
|
83
|
+
pr: z.ZodNumber;
|
|
84
|
+
state: z.ZodEnum<{
|
|
85
|
+
open: "open";
|
|
86
|
+
merged: "merged";
|
|
87
|
+
}>;
|
|
88
|
+
wave: z.ZodOptional<z.ZodString>;
|
|
89
|
+
}, z.core.$loose>>;
|
|
90
|
+
dispositions: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
91
|
+
findings: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
92
|
+
blockingAfterCap: z.ZodOptional<z.ZodBoolean>;
|
|
93
|
+
category: z.ZodOptional<z.ZodString>;
|
|
94
|
+
disposition: z.ZodOptional<z.ZodString>;
|
|
95
|
+
title: z.ZodString;
|
|
96
|
+
}, z.core.$loose>>>;
|
|
97
|
+
kind: z.ZodLiteral<"boundary-review-proof">;
|
|
98
|
+
manifestHash: z.ZodObject<{
|
|
99
|
+
algo: z.ZodLiteral<"sha256">;
|
|
100
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
101
|
+
value: z.ZodString;
|
|
102
|
+
}, z.core.$loose>;
|
|
103
|
+
outcome: z.ZodEnum<{
|
|
104
|
+
pass: "pass";
|
|
105
|
+
fail: "fail";
|
|
106
|
+
}>;
|
|
107
|
+
producer: z.ZodString;
|
|
108
|
+
rung: z.ZodEnum<{
|
|
109
|
+
oracle: "oracle";
|
|
110
|
+
"independent-model": "independent-model";
|
|
111
|
+
human: "human";
|
|
112
|
+
}>;
|
|
113
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
114
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
115
|
+
specHash: z.ZodOptional<z.ZodObject<{
|
|
116
|
+
algo: z.ZodLiteral<"sha256">;
|
|
117
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
118
|
+
value: z.ZodString;
|
|
119
|
+
}, z.core.$loose>>;
|
|
120
|
+
}, z.core.$loose>;
|
|
121
|
+
type BoundaryReviewProof = z.infer<typeof boundaryReviewProofBaseSchema>;
|
|
122
|
+
interface BoundaryReviewProofComment {
|
|
123
|
+
proof: BoundaryReviewProof;
|
|
124
|
+
commentId?: string | number;
|
|
125
|
+
commentUrl?: string;
|
|
126
|
+
}
|
|
127
|
+
declare const selectBoundaryReviewProof: (comments: GithubIssueComment[], boundary: string, declaredBy: string) => BoundaryReviewProofComment | undefined;
|
|
128
|
+
declare const undispositionedBlockingFindings: (proof: BoundaryReviewProof) => string[];
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/hq-ingest-sink.d.ts
|
|
131
|
+
interface HqIngestDependencies {
|
|
132
|
+
/**
|
|
133
|
+
* @deprecated Custom persistence seam. It receives an immutable spool-file
|
|
134
|
+
* target and one complete JSON event; production never appends legacy JSONL.
|
|
135
|
+
*/
|
|
136
|
+
appendJournal?: (target: string, row: string) => Promise<void> | void;
|
|
137
|
+
diagnostic?: (line: string) => Promise<void> | void;
|
|
138
|
+
env?: NodeJS.ProcessEnv;
|
|
139
|
+
fetch?: typeof fetch;
|
|
140
|
+
now?: () => Date;
|
|
141
|
+
randomUUID?: () => string;
|
|
142
|
+
/**
|
|
143
|
+
* Ceiling for persisting a failure after the transport leg (default
|
|
144
|
+
* `HQ_JOURNAL_FLUSH_BUDGET_MS`). Injectable for the same reason as
|
|
145
|
+
* `timeoutMs`: see the note there.
|
|
146
|
+
*/
|
|
147
|
+
journalFlushBudgetMs?: number;
|
|
148
|
+
/** @deprecated Legacy sidecars are now streamed directly; retained for API compatibility. */
|
|
149
|
+
sidecarReclaimMs?: number;
|
|
150
|
+
/**
|
|
151
|
+
* Setup budget for callers that own the process lifetime — honored AS GIVEN,
|
|
152
|
+
* above the `DEFAULT_HQ_INGEST_TIMEOUT_MS` ceiling that clamps `timeoutMs`.
|
|
153
|
+
*
|
|
154
|
+
* Exists because the budgets are wall-clock while the work they bound is real
|
|
155
|
+
* `fsync`. On a loaded CI runner the 750ms setup budget expires, the event is
|
|
156
|
+
* discarded as `held`, and assertions expecting `deferred` fail. `timeoutMs`
|
|
157
|
+
* is deliberately clamped DOWNWARD, so it offered no lever to widen — which
|
|
158
|
+
* left skipping the tests in CI (`itCiSensitive`) as the only available fix,
|
|
159
|
+
* buying green runs at the cost of running LESS coverage in CI than locally
|
|
160
|
+
* (#225).
|
|
161
|
+
*
|
|
162
|
+
* This is separate from `timeoutMs` rather than a relaxation of it: the
|
|
163
|
+
* clamp is a real invariant (a gate command must not be made to hang by a
|
|
164
|
+
* large requested timeout) and is preserved. Use this only where the caller
|
|
165
|
+
* controls process exit — tests, and tooling that is not a gate.
|
|
166
|
+
*/
|
|
167
|
+
setupBudgetMs?: number;
|
|
168
|
+
timeoutMs?: number;
|
|
169
|
+
transportTimeoutMs?: number;
|
|
170
|
+
}
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/checkout-repository.d.ts
|
|
173
|
+
interface CheckoutRepository {
|
|
174
|
+
name: string;
|
|
175
|
+
owner: string;
|
|
176
|
+
}
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/follow-up.d.ts
|
|
179
|
+
interface FactoryCliInvocation {
|
|
180
|
+
/** Runtime arguments ending with the factory CLI entry module. */
|
|
181
|
+
argvPrefix: string[];
|
|
182
|
+
executable: string;
|
|
183
|
+
}
|
|
184
|
+
declare const FactoryCliInvocationSchema: z.ZodType<FactoryCliInvocation>;
|
|
185
|
+
interface FollowUpAction {
|
|
186
|
+
/**
|
|
187
|
+
* Machine-safe argv-style array for the obvious next action, e.g.
|
|
188
|
+
* ["gh","pr","merge","513","--squash"]. Same shape and field name that
|
|
189
|
+
* `factory:delegate --print` emits, so an orchestrating agent can spawn the
|
|
190
|
+
* next command without reconstructing a shell string. argv[0] is the
|
|
191
|
+
* executable; the rest are literal, already-split arguments.
|
|
192
|
+
*/
|
|
193
|
+
argv: string[];
|
|
194
|
+
/**
|
|
195
|
+
* Human-readable rendering of {@link argv} for logs and operators. Additive
|
|
196
|
+
* to argv, never a substitute for it — argv is the source of truth.
|
|
197
|
+
*/
|
|
198
|
+
command: string;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Build a {@link FollowUpAction} from a literal argv array. The `command`
|
|
202
|
+
* string is derived from argv so the two never drift.
|
|
203
|
+
*/
|
|
204
|
+
declare const followUpFromArgv: (argv: string[]) => FollowUpAction;
|
|
205
|
+
/** Canonical zod schema for the optional follow-up field on JSON outputs. */
|
|
206
|
+
declare const FollowUpActionSchema: z.ZodType<FollowUpAction>;
|
|
207
|
+
//#endregion
|
|
208
|
+
//#region src/github-client.d.ts
|
|
209
|
+
interface GithubPullRequestReview {
|
|
210
|
+
author: {
|
|
211
|
+
login?: string;
|
|
212
|
+
};
|
|
213
|
+
body: string;
|
|
214
|
+
/** GraphQL `PullRequestReview.lastEditedAt` — REST's `/pulls/reviews` has no equivalent (#843). */
|
|
215
|
+
lastEditedAt?: string;
|
|
216
|
+
state: string;
|
|
217
|
+
submittedAt?: string;
|
|
218
|
+
url: string;
|
|
219
|
+
}
|
|
220
|
+
//#endregion
|
|
221
|
+
//#region src/pr-readiness/handled-human-comments.d.ts
|
|
222
|
+
declare const HANDLED_COMMENTS_PAYLOAD_KIND: "handled-human-comments";
|
|
223
|
+
/**
|
|
224
|
+
* Authenticated producer of the durable handled set. Recorded on the readiness
|
|
225
|
+
* ledger; unverifiable producers are ignored on read (fail closed).
|
|
226
|
+
*/
|
|
227
|
+
type HandledCommentsProducerMode = "app" | "commit-status";
|
|
228
|
+
interface HandledCommentsProducer {
|
|
229
|
+
/** App id (stringified) or GitHub login, depending on mode. */
|
|
230
|
+
identity: string;
|
|
231
|
+
mode: HandledCommentsProducerMode;
|
|
232
|
+
}
|
|
233
|
+
interface HandledCommentsCheckPayload {
|
|
234
|
+
clearedAt?: string;
|
|
235
|
+
handledCommentUrls: string[];
|
|
236
|
+
kind: typeof HANDLED_COMMENTS_PAYLOAD_KIND;
|
|
237
|
+
pr: number;
|
|
238
|
+
schemaVersion: 1;
|
|
239
|
+
sessionId?: string;
|
|
240
|
+
}
|
|
241
|
+
//#endregion
|
|
242
|
+
//#region src/diff-classification.d.ts
|
|
243
|
+
declare const DIFF_CLASSIFICATIONS: readonly ["docs/process-only", "trivial", "non-trivial"];
|
|
244
|
+
type DiffClassification = (typeof DIFF_CLASSIFICATIONS)[number];
|
|
245
|
+
//#endregion
|
|
246
|
+
//#region src/profile.d.ts
|
|
247
|
+
declare const DEFAULT_FACTORY_REPOSITORY = "unknown/unknown";
|
|
248
|
+
/** The one profile shape this build accepts (ADR 0023, #318). */
|
|
249
|
+
declare const PROFILE_SCHEMA_VERSION = 3;
|
|
250
|
+
declare const factoryProjectProfileSchema: z.ZodObject<{
|
|
251
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
252
|
+
env: z.ZodOptional<z.ZodObject<{
|
|
253
|
+
required: z.ZodArray<z.ZodString>;
|
|
254
|
+
}, z.core.$strict>>;
|
|
255
|
+
extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
256
|
+
hq: z.ZodOptional<z.ZodObject<{
|
|
257
|
+
enabled: z.ZodBoolean;
|
|
258
|
+
endpoint: z.ZodIntersection<z.ZodString, z.ZodString>;
|
|
259
|
+
}, z.core.$strict>>;
|
|
260
|
+
project: z.ZodObject<{
|
|
261
|
+
key: z.ZodString;
|
|
262
|
+
}, z.core.$strict>;
|
|
263
|
+
proof: z.ZodObject<{
|
|
264
|
+
classificationPolicy: z.ZodObject<{
|
|
265
|
+
docsOnly: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
266
|
+
trivial: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
267
|
+
}, z.core.$strict>;
|
|
268
|
+
}, z.core.$strict>;
|
|
269
|
+
repository: z.ZodObject<{
|
|
270
|
+
defaultBranch: z.ZodString;
|
|
271
|
+
name: z.ZodString;
|
|
272
|
+
owner: z.ZodString;
|
|
273
|
+
}, z.core.$strict>;
|
|
274
|
+
requiredChecks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
275
|
+
checkType: z.ZodEnum<{
|
|
276
|
+
review: "review";
|
|
277
|
+
verify: "verify";
|
|
278
|
+
}>;
|
|
279
|
+
name: z.ZodString;
|
|
280
|
+
scope: z.ZodOptional<z.ZodObject<{
|
|
281
|
+
classifications: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
282
|
+
trivial: "trivial";
|
|
283
|
+
"docs/process-only": "docs/process-only";
|
|
284
|
+
"non-trivial": "non-trivial";
|
|
285
|
+
}>>>;
|
|
286
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
287
|
+
}, z.core.$strict>>;
|
|
288
|
+
}, z.core.$strict>>>;
|
|
289
|
+
review: z.ZodObject<{
|
|
290
|
+
conditional: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
291
|
+
modes: z.ZodArray<z.ZodEnum<{
|
|
292
|
+
correctness: "correctness";
|
|
293
|
+
security: "security";
|
|
294
|
+
}>>;
|
|
295
|
+
paths: z.ZodArray<z.ZodString>;
|
|
296
|
+
}, z.core.$strict>>>;
|
|
297
|
+
defaultMaxCycles: z.ZodNumber;
|
|
298
|
+
docsOnlyBypass: z.ZodOptional<z.ZodBoolean>;
|
|
299
|
+
ladder: z.ZodOptional<z.ZodObject<{
|
|
300
|
+
gate: z.ZodOptional<z.ZodObject<{
|
|
301
|
+
cap: z.ZodNumber;
|
|
302
|
+
}, z.core.$strict>>;
|
|
303
|
+
}, z.core.$strict>>;
|
|
304
|
+
modes: z.ZodArray<z.ZodEnum<{
|
|
305
|
+
correctness: "correctness";
|
|
306
|
+
security: "security";
|
|
307
|
+
}>>;
|
|
308
|
+
standingChecklist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
309
|
+
}, z.core.$strict>;
|
|
310
|
+
schemaVersion: z.ZodLiteral<3>;
|
|
311
|
+
verification: z.ZodObject<{
|
|
312
|
+
commands: z.ZodArray<z.ZodObject<{
|
|
313
|
+
command: z.ZodString;
|
|
314
|
+
description: z.ZodString;
|
|
315
|
+
name: z.ZodString;
|
|
316
|
+
requiredCheck: z.ZodOptional<z.ZodString>;
|
|
317
|
+
scope: z.ZodDefault<z.ZodEnum<{
|
|
318
|
+
trivial: "trivial";
|
|
319
|
+
"docs-only": "docs-only";
|
|
320
|
+
full: "full";
|
|
321
|
+
}>>;
|
|
322
|
+
}, z.core.$strip>>;
|
|
323
|
+
}, z.core.$strip>;
|
|
324
|
+
}, z.core.$strict>;
|
|
325
|
+
type FactoryProjectProfile = z.infer<typeof factoryProjectProfileSchema>;
|
|
326
|
+
declare const resolveFactoryRepository: (profile?: Pick<FactoryProjectProfile, "repository"> | undefined) => string;
|
|
327
|
+
/**
|
|
328
|
+
* Whether a pure docs/process diff may skip independent review. Opt-in: absent
|
|
329
|
+
* config means review is required (#318, ADR 0023).
|
|
330
|
+
*/
|
|
331
|
+
declare const resolveDocsOnlyReviewBypass: (profile: Pick<FactoryProjectProfile, "review">) => boolean;
|
|
332
|
+
interface LoadProjectProfileInput {
|
|
333
|
+
cwd?: string;
|
|
334
|
+
profilePath?: string;
|
|
335
|
+
}
|
|
336
|
+
interface LoadProjectProfileResult {
|
|
337
|
+
path: string;
|
|
338
|
+
profile: FactoryProjectProfile;
|
|
339
|
+
}
|
|
340
|
+
declare function loadProjectProfile(input?: LoadProjectProfileInput): LoadProjectProfileResult;
|
|
341
|
+
//#endregion
|
|
342
|
+
//#region src/pr-verify-mode.d.ts
|
|
343
|
+
/**
|
|
344
|
+
* The verification mode `pr:verify` resolved for a run.
|
|
345
|
+
*
|
|
346
|
+
* Canonically declared here rather than inside `pr-readiness/` so that modules
|
|
347
|
+
* on either side of that boundary — the readiness proof shape and the durable
|
|
348
|
+
* check-run payload — can name the same union without importing each other.
|
|
349
|
+
*/
|
|
350
|
+
type ResolvedPrVerifyMode = "docs-only" | "trivial" | "full";
|
|
351
|
+
//#endregion
|
|
352
|
+
//#region src/pr-verify-status.d.ts
|
|
353
|
+
type CommitStatusState = "failure" | "pending" | "success";
|
|
354
|
+
interface PostCommitStatusInput {
|
|
355
|
+
context?: string;
|
|
356
|
+
cwd: string;
|
|
357
|
+
description: string;
|
|
358
|
+
owner: string;
|
|
359
|
+
repo: string;
|
|
360
|
+
sha: string;
|
|
361
|
+
state: CommitStatusState;
|
|
362
|
+
/**
|
|
363
|
+
* Drop this mirror's own failure diagnostic because the caller has already
|
|
364
|
+
* reported the same cause. Set only on the pre-push path, where the status
|
|
365
|
+
* POST 422s for exactly the reason the pre-push notice gives and a trailing
|
|
366
|
+
* "unable to post ... status" line would put back the false-defect reading
|
|
367
|
+
* that notice exists to remove (#316).
|
|
368
|
+
*
|
|
369
|
+
* Deliberately a field on the request rather than a second, quieter poster:
|
|
370
|
+
* an injected `PostCommitStatus` double sees the flag, so the branch is
|
|
371
|
+
* assertable instead of collapsing to the same closure under test.
|
|
372
|
+
*/
|
|
373
|
+
suppressFailureDiagnostic?: boolean;
|
|
374
|
+
targetUrl: string;
|
|
375
|
+
}
|
|
376
|
+
type PostCommitStatus = (input: PostCommitStatusInput) => void;
|
|
377
|
+
//#endregion
|
|
378
|
+
//#region src/user-config.d.ts
|
|
379
|
+
declare const githubAppConfigSchema: z.ZodObject<{
|
|
380
|
+
appId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
381
|
+
installationId: z.ZodOptional<z.ZodNumber>;
|
|
382
|
+
privateKeyPath: z.ZodString;
|
|
383
|
+
}, z.core.$strip>;
|
|
384
|
+
type GithubAppConfig = z.infer<typeof githubAppConfigSchema>;
|
|
385
|
+
declare const factoryUserConfigSchema: z.ZodObject<{
|
|
386
|
+
githubApp: z.ZodOptional<z.ZodObject<{
|
|
387
|
+
appId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
388
|
+
installationId: z.ZodOptional<z.ZodNumber>;
|
|
389
|
+
privateKeyPath: z.ZodString;
|
|
390
|
+
}, z.core.$strip>>;
|
|
391
|
+
hqAllowedOrigins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
392
|
+
schemaVersion: z.ZodLiteral<2>;
|
|
393
|
+
}, z.core.$strip>;
|
|
394
|
+
type FactoryUserConfig = z.infer<typeof factoryUserConfigSchema>;
|
|
395
|
+
interface LoadUserConfigResult {
|
|
396
|
+
path: string;
|
|
397
|
+
config: FactoryUserConfig;
|
|
398
|
+
ignoredKeys?: string[];
|
|
399
|
+
}
|
|
400
|
+
//#endregion
|
|
401
|
+
//#region src/github-check-runs.d.ts
|
|
402
|
+
declare const FACTORY_CHECK_NAMES: {
|
|
403
|
+
readonly boundary: "patronage-factory/boundary";
|
|
404
|
+
readonly "pr-ready": "patronage-factory/pr-ready";
|
|
405
|
+
readonly "pr-review": "patronage-factory/pr-review";
|
|
406
|
+
readonly "pr-verify": "patronage-factory/pr-verify";
|
|
407
|
+
};
|
|
408
|
+
type FactoryCheckGate = keyof typeof FACTORY_CHECK_NAMES;
|
|
409
|
+
interface PublishFactoryCheckInput {
|
|
410
|
+
conclusion?: "failure" | "success";
|
|
411
|
+
cwd: string;
|
|
412
|
+
gate: FactoryCheckGate;
|
|
413
|
+
/**
|
|
414
|
+
* HQ lane-permalink base (`<origin>/lanes/by-ref`). When present, the check
|
|
415
|
+
* run's Details link deep-links to the HQ lane page instead of the PR-ledger
|
|
416
|
+
* fallback. Derive it from the repository profile via
|
|
417
|
+
* `hqLaneRefBaseUrlFromProfile` — the same source as the HQ gate sink.
|
|
418
|
+
*/
|
|
419
|
+
hqLaneBaseUrl?: string;
|
|
420
|
+
/**
|
|
421
|
+
* Explicit issue/PR number for the HQ lane ref, used when the check run is not
|
|
422
|
+
* PR-scoped (e.g. an epic boundary check keyed by its epic issue). Falls back
|
|
423
|
+
* to `pr`, then to the checkout's PR, when omitted.
|
|
424
|
+
*/
|
|
425
|
+
laneRefNumber?: number;
|
|
426
|
+
owner: string;
|
|
427
|
+
pr?: number;
|
|
428
|
+
proof: unknown;
|
|
429
|
+
repo: string;
|
|
430
|
+
sha: string;
|
|
431
|
+
status?: "completed" | "in_progress";
|
|
432
|
+
}
|
|
433
|
+
interface CheckRunDependencies {
|
|
434
|
+
fetch?: typeof fetch;
|
|
435
|
+
githubApp?: GithubAppConfig;
|
|
436
|
+
now?: () => number;
|
|
437
|
+
postCommitStatus?: PostCommitStatus;
|
|
438
|
+
resolveDetailsUrl?: (input: PublishFactoryCheckInput) => Promise<string> | string;
|
|
439
|
+
/**
|
|
440
|
+
* Bounded retry for the check-run POST. GitHub answers 422 for a head SHA it
|
|
441
|
+
* has not seen yet, which is the normal state when `pr:verify` runs before
|
|
442
|
+
* the branch is pushed, and is also briefly true right after a push.
|
|
443
|
+
*/
|
|
444
|
+
retry?: {
|
|
445
|
+
attempts: number;
|
|
446
|
+
budgetMs?: number;
|
|
447
|
+
delayMs: number;
|
|
448
|
+
};
|
|
449
|
+
/** Injectable delay for the bounded retry (tests only). */
|
|
450
|
+
sleep?: (ms: number) => Promise<void>;
|
|
451
|
+
/** Overrides GITHUB_PUBLISH_TIMEOUT_MS for the App fetch calls (tests only). */
|
|
452
|
+
timeoutMs?: number;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Publish a factory check run and *wait* for it, so a caller that has just made
|
|
456
|
+
* the head SHA visible on GitHub (pushed the branch, created the PR) can make
|
|
457
|
+
* the proof reliably present for that SHA before it returns (#247).
|
|
458
|
+
*
|
|
459
|
+
* Never throws and never posts a commit-status fallback: the commit status is a
|
|
460
|
+
* human-readable mirror, not a proof surface, so a caller that needs an
|
|
461
|
+
* App-verified check run must be told plainly whether it got one. Returns
|
|
462
|
+
* `true` only when the App-owned check run landed.
|
|
463
|
+
*/
|
|
464
|
+
declare function ensureFactoryCheckRunPublished(input: PublishFactoryCheckInput, dependencies?: CheckRunDependencies & {
|
|
465
|
+
onDiagnostic?: (message: string) => void;
|
|
466
|
+
}): Promise<boolean>;
|
|
467
|
+
interface PublishHandledCommentsCheckInput {
|
|
468
|
+
cwd: string;
|
|
469
|
+
owner: string;
|
|
470
|
+
payload: HandledCommentsCheckPayload;
|
|
471
|
+
pr: number;
|
|
472
|
+
repo: string;
|
|
473
|
+
sha: string;
|
|
474
|
+
}
|
|
475
|
+
//#endregion
|
|
476
|
+
//#region src/merge-freeze.d.ts
|
|
477
|
+
interface MergeFreezeGeneration {
|
|
478
|
+
headSha: string;
|
|
479
|
+
id: number;
|
|
480
|
+
startedAt: string;
|
|
481
|
+
}
|
|
482
|
+
interface MergeFreezeStoreInput {
|
|
483
|
+
cwd: string;
|
|
484
|
+
headSha: string;
|
|
485
|
+
repository: CheckoutRepository;
|
|
486
|
+
}
|
|
487
|
+
interface MergeFreezeStore {
|
|
488
|
+
complete: (input: MergeFreezeStoreInput & {
|
|
489
|
+
clearRationale?: string;
|
|
490
|
+
generation: MergeFreezeGeneration;
|
|
491
|
+
outcome: "active" | "inactive" | "stale";
|
|
492
|
+
reason: string;
|
|
493
|
+
}) => Promise<void>;
|
|
494
|
+
read: (input: MergeFreezeStoreInput) => unknown;
|
|
495
|
+
start: (input: MergeFreezeStoreInput) => Promise<MergeFreezeGeneration>;
|
|
496
|
+
}
|
|
497
|
+
declare namespace worktree_held_branch_d_exports {
|
|
498
|
+
export { MergeOperationalNotices, WorktreeHeldBranch, WorktreeHeldBranchCheck, WorktreeListEntry, checkWorktreeHeldBranch, findWorktreeHeldBranch, formatHeldBranchCloseoutSummary, listWorktreesPorcelain, parseGitWorktreeList, resolveMergeOperationalNotices, worktreeHeldBranchNotice };
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Detects when a PR head branch is checked out in a local git worktree.
|
|
502
|
+
*
|
|
503
|
+
* `gh pr merge --delete-branch` fails when the local branch is held by a
|
|
504
|
+
* worktree (git refuses to delete a checked-out branch), which previously
|
|
505
|
+
* broke the auto-merge lane mid-merge (patronage/internal#284). The merge
|
|
506
|
+
* preflight surfaces this as an actionable notice — not a hard fail — so the
|
|
507
|
+
* operator merges without `--delete-branch` (or prunes the worktree first)
|
|
508
|
+
* and defers local branch cleanup to closeout.
|
|
509
|
+
*/
|
|
510
|
+
interface WorktreeHeldBranch {
|
|
511
|
+
branch: string;
|
|
512
|
+
worktreePath: string;
|
|
513
|
+
}
|
|
514
|
+
interface WorktreeListEntry {
|
|
515
|
+
branch?: string;
|
|
516
|
+
path: string;
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Parses `git worktree list --porcelain` output. Entries are separated by
|
|
520
|
+
* blank lines; each starts with `worktree <path>` and carries an optional
|
|
521
|
+
* `branch refs/heads/<name>` attribute (detached worktrees have none).
|
|
522
|
+
*/
|
|
523
|
+
declare function parseGitWorktreeList(porcelain: string): WorktreeListEntry[];
|
|
524
|
+
/**
|
|
525
|
+
* Returns the worktree holding `branch`, or undefined when no local worktree
|
|
526
|
+
* has it checked out (or the porcelain listing was unavailable).
|
|
527
|
+
*/
|
|
528
|
+
declare function findWorktreeHeldBranch({
|
|
529
|
+
branch,
|
|
530
|
+
worktreeListPorcelain
|
|
531
|
+
}: {
|
|
532
|
+
branch: string;
|
|
533
|
+
worktreeListPorcelain: string | undefined;
|
|
534
|
+
}): undefined | WorktreeHeldBranch;
|
|
535
|
+
declare function worktreeHeldBranchNotice(held: WorktreeHeldBranch): string;
|
|
536
|
+
interface MergeOperationalNotices {
|
|
537
|
+
notices: string[];
|
|
538
|
+
worktreeHeldBranch?: WorktreeHeldBranch;
|
|
539
|
+
worktreeHeldBranches?: WorktreeHeldBranch[];
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Single entry point for non-blocking merge preflight notices, mirroring
|
|
543
|
+
* `resolveMergeGuardIdentity`/`mergeGuardBlockingReasons` in
|
|
544
|
+
* merge-identity.ts: adding a notice kind never requires coordinated edits
|
|
545
|
+
* in the command runner, and persisted notice strings cannot drift from the
|
|
546
|
+
* structured detection result.
|
|
547
|
+
*/
|
|
548
|
+
declare function resolveMergeOperationalNotices({
|
|
549
|
+
headRefName,
|
|
550
|
+
worktreeListPorcelain
|
|
551
|
+
}: {
|
|
552
|
+
headRefName: string | undefined;
|
|
553
|
+
worktreeListPorcelain: string | undefined;
|
|
554
|
+
}): MergeOperationalNotices;
|
|
555
|
+
/**
|
|
556
|
+
* Shared `git worktree list --porcelain` reader for merge preflight and
|
|
557
|
+
* closeout. Returns undefined when the directory is missing, not a git
|
|
558
|
+
* repository, or git is unavailable — detection is best-effort and callers
|
|
559
|
+
* report "skipped" rather than fabricating a result.
|
|
560
|
+
*/
|
|
561
|
+
declare function listWorktreesPorcelain(cwd: string): string | undefined;
|
|
562
|
+
interface WorktreeHeldBranchCheck {
|
|
563
|
+
held?: WorktreeHeldBranch;
|
|
564
|
+
/** "skipped" means no branch was recorded or worktrees were unlistable. */
|
|
565
|
+
status: "clean" | "held" | "skipped";
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Closeout-side counterpart to the merge-preflight notice: the merge step
|
|
569
|
+
* defers local branch cleanup to closeout, so closeout planning checks
|
|
570
|
+
* whether the worker branch is still held by a worktree (#284).
|
|
571
|
+
*/
|
|
572
|
+
declare function checkWorktreeHeldBranch({
|
|
573
|
+
branch,
|
|
574
|
+
worktreeListPorcelain
|
|
575
|
+
}: {
|
|
576
|
+
branch: string | undefined;
|
|
577
|
+
worktreeListPorcelain: string | undefined;
|
|
578
|
+
}): WorktreeHeldBranchCheck;
|
|
579
|
+
/** One-line closeout summary, owned beside the detection logic. */
|
|
580
|
+
declare function formatHeldBranchCloseoutSummary(check: WorktreeHeldBranchCheck): string;
|
|
581
|
+
declare namespace merge_identity_d_exports {
|
|
582
|
+
export { LiveHeadInput, MergeGuardIdentity, MergeIdentityResult, PostProofCommit, ReadyProofForMergeIdentity, evaluateMergeIdentity, mergeGuardBlockingReasons, mergeGuardIdentitySchema, resolveMergeGuardIdentity };
|
|
583
|
+
}
|
|
584
|
+
interface PostProofCommit {
|
|
585
|
+
sha: string;
|
|
586
|
+
subject: string;
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* The slice of the pr:ready proof the merge guard actually consumes, so this
|
|
590
|
+
* module does not depend on the parent proof envelope. `PrReadyProof` is
|
|
591
|
+
* structurally assignable to this type.
|
|
592
|
+
*/
|
|
593
|
+
interface ReadyProofForMergeIdentity {
|
|
594
|
+
blockingReasons: string[];
|
|
595
|
+
ledger: {
|
|
596
|
+
/**
|
|
597
|
+
* The evaluated head SHA recorded by pr:ready: `pr.headRefOid` captured
|
|
598
|
+
* at evaluation time. The merge guard compares it to the live pushed
|
|
599
|
+
* HEAD with exact equality.
|
|
600
|
+
*/
|
|
601
|
+
headSha: string;
|
|
602
|
+
pr: number;
|
|
603
|
+
};
|
|
604
|
+
status: string;
|
|
605
|
+
}
|
|
606
|
+
type MergeIdentityResult = {
|
|
607
|
+
kind: "match";
|
|
608
|
+
headSha: string;
|
|
609
|
+
} | {
|
|
610
|
+
kind: "diverged";
|
|
611
|
+
liveHeadSha: string;
|
|
612
|
+
postProofCommits?: PostProofCommit[];
|
|
613
|
+
proofHeadSha: string;
|
|
614
|
+
};
|
|
615
|
+
type MergeGuardIdentity = MergeIdentityResult | {
|
|
616
|
+
kind: "live-head-invalid";
|
|
617
|
+
pr: number;
|
|
618
|
+
received: string;
|
|
619
|
+
} | {
|
|
620
|
+
kind: "ready-proof-missing";
|
|
621
|
+
errorDetail?: string;
|
|
622
|
+
readyProofPath: string;
|
|
623
|
+
} | {
|
|
624
|
+
kind: "ready-proof-pr-mismatch";
|
|
625
|
+
proofPr: number;
|
|
626
|
+
requestedPr: number;
|
|
627
|
+
} | {
|
|
628
|
+
kind: "ready-proof-not-ready";
|
|
629
|
+
blockingReasons: string[];
|
|
630
|
+
status: string;
|
|
631
|
+
};
|
|
632
|
+
declare const evaluateMergeIdentity: ({
|
|
633
|
+
liveHeadSha,
|
|
634
|
+
postProofCommits,
|
|
635
|
+
proofHeadSha
|
|
636
|
+
}: {
|
|
637
|
+
liveHeadSha: string;
|
|
638
|
+
postProofCommits?: PostProofCommit[];
|
|
639
|
+
proofHeadSha: string;
|
|
640
|
+
}) => MergeIdentityResult;
|
|
641
|
+
/**
|
|
642
|
+
* The live PR head as fetched from GitHub: either a validated 40-hex SHA or
|
|
643
|
+
* the raw (stringified) response that failed validation.
|
|
644
|
+
*/
|
|
645
|
+
type LiveHeadInput = {
|
|
646
|
+
headSha: string;
|
|
647
|
+
} | {
|
|
648
|
+
invalidResponse: string;
|
|
649
|
+
};
|
|
650
|
+
/**
|
|
651
|
+
* Single entry point that owns construction of every MergeGuardIdentity
|
|
652
|
+
* kind, so adding or changing a kind never requires coordinated edits in the
|
|
653
|
+
* command runner.
|
|
654
|
+
*/
|
|
655
|
+
declare const resolveMergeGuardIdentity: ({
|
|
656
|
+
commitsBetween,
|
|
657
|
+
liveHead,
|
|
658
|
+
pr,
|
|
659
|
+
readyProof,
|
|
660
|
+
readyProofError,
|
|
661
|
+
readyProofPath
|
|
662
|
+
}: {
|
|
663
|
+
commitsBetween?: (fromSha: string, toSha: string) => PostProofCommit[] | undefined;
|
|
664
|
+
liveHead: LiveHeadInput;
|
|
665
|
+
pr: number;
|
|
666
|
+
readyProof: ReadyProofForMergeIdentity | undefined;
|
|
667
|
+
readyProofError?: unknown;
|
|
668
|
+
readyProofPath: string;
|
|
669
|
+
}) => MergeGuardIdentity;
|
|
670
|
+
declare const mergeGuardIdentitySchema: z.ZodType<MergeGuardIdentity>;
|
|
671
|
+
declare const mergeGuardBlockingReasons: (identity: MergeGuardIdentity) => string[];
|
|
672
|
+
//#endregion
|
|
673
|
+
//#region src/review-rungs.d.ts
|
|
674
|
+
declare const EVIDENCE_REVIEW_RUNGS: readonly ["independent-model", "oracle", "human"];
|
|
675
|
+
type EvidenceReviewRung = (typeof EVIDENCE_REVIEW_RUNGS)[number];
|
|
676
|
+
//#endregion
|
|
677
|
+
//#region src/pr-merge-check.d.ts
|
|
678
|
+
interface PrMergeCheckArgs extends LoadProjectProfileInput {
|
|
679
|
+
epic?: number;
|
|
680
|
+
json?: boolean;
|
|
681
|
+
output?: string;
|
|
682
|
+
pr: number;
|
|
683
|
+
readyProof?: string;
|
|
684
|
+
}
|
|
685
|
+
interface PrMergeCheckProof {
|
|
686
|
+
schemaVersion: 1;
|
|
687
|
+
blockingReasons: string[];
|
|
688
|
+
boundary?: {
|
|
689
|
+
autoMerge: boolean;
|
|
690
|
+
epic: number;
|
|
691
|
+
review: EvidenceReviewRung;
|
|
692
|
+
wave: string;
|
|
693
|
+
};
|
|
694
|
+
command: "patronage-factory pr:merge-check";
|
|
695
|
+
/**
|
|
696
|
+
* Machine-safe arg array for the obvious next action (#523): on `pass`, the
|
|
697
|
+
* remote-only GitHub merge API invocation for this PR; on `fail`, the re-run that clears the
|
|
698
|
+
* block (`pr:ready`, or `pr:verify` then `pr:ready` after a head
|
|
699
|
+
* divergence). Same `argv` shape `factory:delegate --print` emits. Optional
|
|
700
|
+
* and purely additive — existing consumers ignore it.
|
|
701
|
+
*/
|
|
702
|
+
followUp?: FollowUpAction;
|
|
703
|
+
identity: MergeGuardIdentity;
|
|
704
|
+
/**
|
|
705
|
+
* The pushed PR head SHA fetched from GitHub at check time. Absent only
|
|
706
|
+
* when GitHub returned no usable 40-hex head (identity kind
|
|
707
|
+
* "live-head-invalid"), which is itself a fail-closed blocking state.
|
|
708
|
+
*/
|
|
709
|
+
liveHeadSha?: string;
|
|
710
|
+
/**
|
|
711
|
+
* Actionable operational notices that do not block the merge, e.g. a PR
|
|
712
|
+
* head branch held by a local worktree, which makes
|
|
713
|
+
* `gh pr merge --delete-branch` fail (patronage/internal#284).
|
|
714
|
+
*/
|
|
715
|
+
notices?: string[];
|
|
716
|
+
pr: number;
|
|
717
|
+
status: "pass" | "fail";
|
|
718
|
+
/** Present when the PR head branch is checked out in a local worktree. */
|
|
719
|
+
worktreeHeldBranch?: WorktreeHeldBranch;
|
|
720
|
+
/** All merge-relevant branches held by local worktrees (head and default). */
|
|
721
|
+
worktreeHeldBranches?: WorktreeHeldBranch[];
|
|
722
|
+
}
|
|
723
|
+
interface PrMergeCheckGitDependencies {
|
|
724
|
+
changedFilesBetween: (cwd: string, baseSha: string, headSha: string) => string[] | undefined;
|
|
725
|
+
checkoutRepository: (cwd: string) => CheckoutRepository;
|
|
726
|
+
commitsBetween: (cwd: string, fromSha: string, toSha: string) => PostProofCommit[] | undefined;
|
|
727
|
+
worktreeListPorcelain: (cwd: string) => string | undefined;
|
|
728
|
+
showFileAtRef: (cwd: string, ref: string, absolutePath: string) => string | undefined;
|
|
729
|
+
objectIdAtRef: (cwd: string, ref: string, absolutePath: string) => string | undefined;
|
|
730
|
+
}
|
|
731
|
+
interface PrMergeCheckDependencies {
|
|
732
|
+
git?: Partial<PrMergeCheckGitDependencies>;
|
|
733
|
+
github?: {
|
|
734
|
+
fetchClosingPullRequests?: (input: {
|
|
735
|
+
issue: number;
|
|
736
|
+
owner: string;
|
|
737
|
+
repo: string;
|
|
738
|
+
}) => {
|
|
739
|
+
number: number;
|
|
740
|
+
}[];
|
|
741
|
+
fetchIssueBody?: (input: {
|
|
742
|
+
issue: number;
|
|
743
|
+
owner: string;
|
|
744
|
+
repo: string;
|
|
745
|
+
}) => string;
|
|
746
|
+
fetchPullRequestHead: (input: {
|
|
747
|
+
cwd: string;
|
|
748
|
+
owner: string;
|
|
749
|
+
pr: number;
|
|
750
|
+
repo: string;
|
|
751
|
+
}) => {
|
|
752
|
+
headRefName?: string;
|
|
753
|
+
headRefOid: string;
|
|
754
|
+
baseRefName?: string;
|
|
755
|
+
baseRefOid?: string;
|
|
756
|
+
mergedAt?: string | null;
|
|
757
|
+
remoteHeadRefExists?: boolean;
|
|
758
|
+
labels?: {
|
|
759
|
+
name: string;
|
|
760
|
+
}[];
|
|
761
|
+
};
|
|
762
|
+
fetchPullRequestReviews?: (input: {
|
|
763
|
+
owner: string;
|
|
764
|
+
pr: number;
|
|
765
|
+
repo: string;
|
|
766
|
+
}) => GithubPullRequestReview[];
|
|
767
|
+
};
|
|
768
|
+
mergeFreeze?: MergeFreezeStore;
|
|
769
|
+
}
|
|
770
|
+
declare function validatePrMergeCheckProof(value: unknown): PrMergeCheckProof;
|
|
771
|
+
declare function readPrMergeCheckProof(filePath: string): PrMergeCheckProof;
|
|
772
|
+
declare function runPrMergeCheck(args: PrMergeCheckArgs, dependencies?: PrMergeCheckDependencies): PrMergeCheckProof;
|
|
773
|
+
//#endregion
|
|
774
|
+
//#region src/pr-proof-io.d.ts
|
|
775
|
+
interface ProofDescriptor<T> {
|
|
776
|
+
label: string;
|
|
777
|
+
defaultPath: string;
|
|
778
|
+
schemaVersion: number;
|
|
779
|
+
parse: (raw: unknown) => T;
|
|
780
|
+
}
|
|
781
|
+
//#endregion
|
|
782
|
+
//#region src/packages/review-prompt-sections/schema.d.ts
|
|
783
|
+
declare const reviewPromptSectionSchema: z.ZodObject<{
|
|
784
|
+
provenance: z.ZodEnum<{
|
|
785
|
+
"prior-review-ledger": "prior-review-ledger";
|
|
786
|
+
"profile-standing-checklist": "profile-standing-checklist";
|
|
787
|
+
"issue-review-focus": "issue-review-focus";
|
|
788
|
+
}>;
|
|
789
|
+
source: z.ZodString;
|
|
790
|
+
text: z.ZodString;
|
|
791
|
+
}, z.core.$strict>;
|
|
792
|
+
type ReviewPromptSection = z.infer<typeof reviewPromptSectionSchema>;
|
|
793
|
+
type ReviewPromptSectionProvenance = ReviewPromptSection["provenance"];
|
|
794
|
+
declare const reviewPromptSectionsSchema: z.ZodArray<z.ZodObject<{
|
|
795
|
+
provenance: z.ZodEnum<{
|
|
796
|
+
"prior-review-ledger": "prior-review-ledger";
|
|
797
|
+
"profile-standing-checklist": "profile-standing-checklist";
|
|
798
|
+
"issue-review-focus": "issue-review-focus";
|
|
799
|
+
}>;
|
|
800
|
+
source: z.ZodString;
|
|
801
|
+
text: z.ZodString;
|
|
802
|
+
}, z.core.$strict>>;
|
|
803
|
+
//#endregion
|
|
804
|
+
//#region src/review-ladder-policy.d.ts
|
|
805
|
+
type ReviewFindingSeverity = "critical" | "high" | "medium" | "low" | "unknown";
|
|
806
|
+
type ReviewFindingCategory = "correctness" | "safety" | "coordination" | "maintainability" | "unknown";
|
|
807
|
+
declare const REVIEW_SEVERITIES: readonly ["critical", "high", "medium", "low", "unknown"];
|
|
808
|
+
declare const resolveReviewFindingSeverity: (priority?: string) => ReviewFindingSeverity;
|
|
809
|
+
declare const resolveReviewFindingCategory: (category?: string) => ReviewFindingCategory;
|
|
810
|
+
declare const FINDING_DISPOSITIONS: readonly ["open", "fixed-in-thread", "follow-up-filed", "waived", "stale-repeat", "rerun-noise"];
|
|
811
|
+
type FindingDisposition = (typeof FINDING_DISPOSITIONS)[number];
|
|
812
|
+
interface ReviewFindingAttributes {
|
|
813
|
+
blockingAfterCap?: boolean;
|
|
814
|
+
category?: string;
|
|
815
|
+
citedSpan?: string;
|
|
816
|
+
file?: string;
|
|
817
|
+
prescribedAction?: string;
|
|
818
|
+
priority?: string;
|
|
819
|
+
supersedes?: {
|
|
820
|
+
file?: string;
|
|
821
|
+
title: string;
|
|
822
|
+
};
|
|
823
|
+
title: string;
|
|
824
|
+
}
|
|
825
|
+
type BlockingResolvableFinding = Pick<ReviewFindingAttributes, "blockingAfterCap" | "category" | "priority">;
|
|
826
|
+
declare const resolveFindingBlocking: (finding: BlockingResolvableFinding, disposition?: FindingDisposition) => boolean;
|
|
827
|
+
interface ReviewLadderPolicy {
|
|
828
|
+
gate: {
|
|
829
|
+
cap: number;
|
|
830
|
+
};
|
|
831
|
+
interior: {
|
|
832
|
+
cap: number;
|
|
833
|
+
};
|
|
834
|
+
}
|
|
835
|
+
declare const resolveReviewLadderPolicy: (profile: Pick<FactoryProjectProfile, "review">) => ReviewLadderPolicy;
|
|
836
|
+
//#endregion
|
|
837
|
+
//#region src/review-ladder-ledger.d.ts
|
|
838
|
+
type LadderCycleStage = "interior" | "gate";
|
|
839
|
+
interface LadderCycleRef {
|
|
840
|
+
cycle: number;
|
|
841
|
+
stage: LadderCycleStage;
|
|
842
|
+
}
|
|
843
|
+
type LadderFindingReport = ReviewFindingAttributes;
|
|
844
|
+
type DeclarableFindingDisposition = Exclude<FindingDisposition, "open" | "stale-repeat" | "rerun-noise">;
|
|
845
|
+
interface LadderDispositionDeclaration {
|
|
846
|
+
disposition: DeclarableFindingDisposition;
|
|
847
|
+
finding: {
|
|
848
|
+
file?: string;
|
|
849
|
+
title: string;
|
|
850
|
+
};
|
|
851
|
+
findingReport?: LadderFindingReport;
|
|
852
|
+
reference?: string;
|
|
853
|
+
}
|
|
854
|
+
interface FindingLedgerEntry extends ReviewFindingAttributes {
|
|
855
|
+
disposition: FindingDisposition;
|
|
856
|
+
firstFlagged: LadderCycleRef;
|
|
857
|
+
flagCount: number;
|
|
858
|
+
key: string;
|
|
859
|
+
lastFlagged: LadderCycleRef;
|
|
860
|
+
priorDisposition?: FindingDisposition;
|
|
861
|
+
reference?: string;
|
|
862
|
+
reopenedCount: number;
|
|
863
|
+
staleRepeatCount: number;
|
|
864
|
+
}
|
|
865
|
+
declare const findingKey: (finding: {
|
|
866
|
+
citedSpan?: string;
|
|
867
|
+
file?: string;
|
|
868
|
+
prescribedAction?: string;
|
|
869
|
+
title?: string;
|
|
870
|
+
}) => string;
|
|
871
|
+
declare const openLadderFindings: (ledger: FindingLedgerEntry[]) => FindingLedgerEntry[];
|
|
872
|
+
declare const blockingLadderFindings: (ledger: FindingLedgerEntry[]) => FindingLedgerEntry[];
|
|
873
|
+
declare const staleRepeatLadderFindings: (ledger: FindingLedgerEntry[]) => FindingLedgerEntry[];
|
|
874
|
+
declare const inferFixedInThreadDispositions: (ledger: FindingLedgerEntry[], findings: readonly LadderFindingReport[], options?: {
|
|
875
|
+
sameHeadAsPriorCycle?: boolean;
|
|
876
|
+
}) => LadderDispositionDeclaration[];
|
|
877
|
+
//#endregion
|
|
878
|
+
//#region src/review-ladder.d.ts
|
|
879
|
+
type ReviewLadderExecutedStage = "interior" | "gate";
|
|
880
|
+
interface LadderSessionAttribution {
|
|
881
|
+
orchestrationMode?: "autonomous" | "manual";
|
|
882
|
+
resumedSession?: boolean;
|
|
883
|
+
runtime?: string;
|
|
884
|
+
sessionId?: string;
|
|
885
|
+
}
|
|
886
|
+
interface LadderUsageReport {
|
|
887
|
+
estimatedCostUsd?: number;
|
|
888
|
+
source?: string;
|
|
889
|
+
totalTokens?: number;
|
|
890
|
+
}
|
|
891
|
+
interface ReviewLadderCycle {
|
|
892
|
+
dispositions?: LadderDispositionDeclaration[];
|
|
893
|
+
engine?: string;
|
|
894
|
+
findings: LadderFindingReport[];
|
|
895
|
+
identity?: {
|
|
896
|
+
headSha: string;
|
|
897
|
+
patchId: string;
|
|
898
|
+
};
|
|
899
|
+
model?: string;
|
|
900
|
+
correlatedRerun?: boolean;
|
|
901
|
+
session?: LadderSessionAttribution;
|
|
902
|
+
stage: LadderCycleStage;
|
|
903
|
+
usage?: LadderUsageReport;
|
|
904
|
+
}
|
|
905
|
+
interface LadderInteriorCapTransition {
|
|
906
|
+
cap: number;
|
|
907
|
+
kind: "interior-cap-reached";
|
|
908
|
+
}
|
|
909
|
+
interface LadderGateCapTransition {
|
|
910
|
+
blockingFindings: string[];
|
|
911
|
+
cap: number;
|
|
912
|
+
kind: "gate-cap-exhausted";
|
|
913
|
+
}
|
|
914
|
+
type LadderForcedTransition = LadderGateCapTransition | LadderInteriorCapTransition;
|
|
915
|
+
interface LadderRunInteriorCycleAction {
|
|
916
|
+
cycle: number;
|
|
917
|
+
kind: "run-interior-cycle";
|
|
918
|
+
}
|
|
919
|
+
type LadderGateNextAction = {
|
|
920
|
+
cycle: number;
|
|
921
|
+
kind: "run-gate-cycle";
|
|
922
|
+
} | {
|
|
923
|
+
kind: "accept-nonblocking-findings";
|
|
924
|
+
} | {
|
|
925
|
+
kind: "escalate-to-triage";
|
|
926
|
+
} | {
|
|
927
|
+
kind: "ready-for-human";
|
|
928
|
+
};
|
|
929
|
+
type LadderPosition = {
|
|
930
|
+
forcedTransition?: LadderGateCapTransition;
|
|
931
|
+
nextAction: LadderGateNextAction;
|
|
932
|
+
stage: "gate";
|
|
933
|
+
} | {
|
|
934
|
+
forcedTransition?: LadderInteriorCapTransition;
|
|
935
|
+
nextAction: {
|
|
936
|
+
kind: "advance-to-gate";
|
|
937
|
+
};
|
|
938
|
+
stage: "interior-complete";
|
|
939
|
+
} | {
|
|
940
|
+
forcedTransition?: never;
|
|
941
|
+
nextAction: LadderRunInteriorCycleAction;
|
|
942
|
+
stage: "interior";
|
|
943
|
+
};
|
|
944
|
+
type LadderNextAction = LadderPosition["nextAction"];
|
|
945
|
+
type ReviewLadderStage = LadderPosition["stage"];
|
|
946
|
+
interface ReviewLadderStageEvent {
|
|
947
|
+
cycle: number;
|
|
948
|
+
cyclesToClean?: number;
|
|
949
|
+
engine?: string;
|
|
950
|
+
findingsSummary: {
|
|
951
|
+
blocking: number;
|
|
952
|
+
bySeverity: Record<ReviewFindingSeverity, number>;
|
|
953
|
+
flagged: number;
|
|
954
|
+
open: number;
|
|
955
|
+
staleRepeats: number;
|
|
956
|
+
};
|
|
957
|
+
forcedTransition?: LadderForcedTransition["kind"];
|
|
958
|
+
model?: string;
|
|
959
|
+
payloadVersion: 1;
|
|
960
|
+
session?: LadderSessionAttribution;
|
|
961
|
+
stage: ReviewLadderExecutedStage;
|
|
962
|
+
type: "review-ladder-stage";
|
|
963
|
+
usage?: LadderUsageReport;
|
|
964
|
+
}
|
|
965
|
+
interface LadderDiagnostic {
|
|
966
|
+
code: "interior-cycles-unrecorded";
|
|
967
|
+
message: string;
|
|
968
|
+
}
|
|
969
|
+
type ReviewLadderEvaluation = LadderPosition & {
|
|
970
|
+
cycleCounts: {
|
|
971
|
+
gate: number;
|
|
972
|
+
interior: number;
|
|
973
|
+
};
|
|
974
|
+
diagnostics: LadderDiagnostic[];
|
|
975
|
+
event?: ReviewLadderStageEvent;
|
|
976
|
+
ledger: FindingLedgerEntry[];
|
|
977
|
+
unmatchedDispositions: LadderDispositionDeclaration[];
|
|
978
|
+
};
|
|
979
|
+
interface EvaluateReviewLadderInput {
|
|
980
|
+
cycles: ReviewLadderCycle[];
|
|
981
|
+
policy: ReviewLadderPolicy;
|
|
982
|
+
}
|
|
983
|
+
declare const evaluateReviewLadder: ({
|
|
984
|
+
cycles,
|
|
985
|
+
policy
|
|
986
|
+
}: EvaluateReviewLadderInput) => ReviewLadderEvaluation;
|
|
987
|
+
//#endregion
|
|
988
|
+
//#region src/pr-readiness/ladder-proof-state.d.ts
|
|
989
|
+
interface PrReviewLadderState {
|
|
990
|
+
cycles: ReviewLadderCycle[];
|
|
991
|
+
}
|
|
992
|
+
interface OpenCycleState {
|
|
993
|
+
autoBlockingFindings: number;
|
|
994
|
+
blockingEntries: ReviewFindingAttributes[];
|
|
995
|
+
openEntries: ReviewFindingAttributes[];
|
|
996
|
+
staleRepeatFindings?: number;
|
|
997
|
+
}
|
|
998
|
+
interface ReviewLadderSummaryState {
|
|
999
|
+
cycleCounts: {
|
|
1000
|
+
gate: number;
|
|
1001
|
+
interior: number;
|
|
1002
|
+
};
|
|
1003
|
+
forcedTransition?: LadderForcedTransition["kind"];
|
|
1004
|
+
nextAction: LadderNextAction["kind"];
|
|
1005
|
+
stage: ReviewLadderStage;
|
|
1006
|
+
}
|
|
1007
|
+
interface ReviewLadderSnapshot {
|
|
1008
|
+
cycleState: OpenCycleState;
|
|
1009
|
+
evaluation: ReviewLadderEvaluation;
|
|
1010
|
+
ledger: FindingLedgerEntry[];
|
|
1011
|
+
policyGateCap: number;
|
|
1012
|
+
summary: ReviewLadderSummaryState;
|
|
1013
|
+
}
|
|
1014
|
+
type ReviewEpochMode = {
|
|
1015
|
+
kind: "ladder";
|
|
1016
|
+
ladder: PrReviewLadderState;
|
|
1017
|
+
snapshot?: ReviewLadderSnapshot;
|
|
1018
|
+
} | {
|
|
1019
|
+
kind: "declared-window";
|
|
1020
|
+
};
|
|
1021
|
+
//#endregion
|
|
1022
|
+
//#region src/pr-readiness/review-proof-types.d.ts
|
|
1023
|
+
type PrReviewKind = "correctness" | "security";
|
|
1024
|
+
type PrReviewMode = PrReviewKind | "all";
|
|
1025
|
+
type PrReviewOutcome = "passed" | "failed" | "error";
|
|
1026
|
+
interface PrReviewStageResolution {
|
|
1027
|
+
model: string;
|
|
1028
|
+
sessionId: string;
|
|
1029
|
+
}
|
|
1030
|
+
//#endregion
|
|
1031
|
+
//#region src/pr-readiness/review-proof-shape.d.ts
|
|
1032
|
+
interface PrReviewFinding extends ReviewFindingAttributes {
|
|
1033
|
+
body: string;
|
|
1034
|
+
category?: ReviewFindingCategory;
|
|
1035
|
+
line?: number;
|
|
1036
|
+
protocolFinding?: true;
|
|
1037
|
+
}
|
|
1038
|
+
interface PrReviewResult {
|
|
1039
|
+
kind: PrReviewKind;
|
|
1040
|
+
startedAt: string;
|
|
1041
|
+
endedAt: string;
|
|
1042
|
+
durationMs: number;
|
|
1043
|
+
model?: string;
|
|
1044
|
+
producer?: string;
|
|
1045
|
+
rung?: EvidenceReviewRung;
|
|
1046
|
+
sessionId?: string;
|
|
1047
|
+
outcome: PrReviewOutcome;
|
|
1048
|
+
issuesFlagged: number;
|
|
1049
|
+
summary: string;
|
|
1050
|
+
findings: PrReviewFinding[];
|
|
1051
|
+
typedVerdict?: boolean;
|
|
1052
|
+
verdictSource?: "footer" | "recovered";
|
|
1053
|
+
promptSections?: ReviewPromptSection[];
|
|
1054
|
+
}
|
|
1055
|
+
interface PrReviewProof {
|
|
1056
|
+
schemaVersion: 2;
|
|
1057
|
+
findingProvenanceVersion: 1;
|
|
1058
|
+
base: string;
|
|
1059
|
+
headSha: string;
|
|
1060
|
+
patchId: string;
|
|
1061
|
+
reviewCycle?: number;
|
|
1062
|
+
maxReviewCycles?: number;
|
|
1063
|
+
changedFiles: string[];
|
|
1064
|
+
cleanedPaths: string[];
|
|
1065
|
+
ladder?: PrReviewLadderState;
|
|
1066
|
+
reviewRequirement?: {
|
|
1067
|
+
reason: "docs-only-profile-bypass";
|
|
1068
|
+
status: "not-required";
|
|
1069
|
+
};
|
|
1070
|
+
reviews: PrReviewResult[];
|
|
1071
|
+
}
|
|
1072
|
+
//#endregion
|
|
1073
|
+
//#region src/pr-readiness/readiness-ledger.d.ts
|
|
1074
|
+
declare const SCHEMA_VERSION = 1;
|
|
1075
|
+
declare const previewDeploySchema: z.ZodObject<{
|
|
1076
|
+
adminUrl: z.ZodOptional<z.ZodString>;
|
|
1077
|
+
apiHealthUrl: z.ZodOptional<z.ZodString>;
|
|
1078
|
+
headSha: z.ZodOptional<z.ZodString>;
|
|
1079
|
+
localPreviewProof: z.ZodOptional<z.ZodUnknown>;
|
|
1080
|
+
localProofPath: z.ZodOptional<z.ZodString>;
|
|
1081
|
+
proofSource: z.ZodOptional<z.ZodEnum<{
|
|
1082
|
+
"github-actions": "github-actions";
|
|
1083
|
+
"local-self-certified": "local-self-certified";
|
|
1084
|
+
}>>;
|
|
1085
|
+
publicUrl: z.ZodOptional<z.ZodString>;
|
|
1086
|
+
seedStatus: z.ZodEnum<{
|
|
1087
|
+
unknown: "unknown";
|
|
1088
|
+
skipped: "skipped";
|
|
1089
|
+
passed: "passed";
|
|
1090
|
+
failed: "failed";
|
|
1091
|
+
}>;
|
|
1092
|
+
stage: z.ZodOptional<z.ZodString>;
|
|
1093
|
+
timingsMs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodNumber>>>;
|
|
1094
|
+
workflowRunUrl: z.ZodOptional<z.ZodString>;
|
|
1095
|
+
}, z.core.$strip>;
|
|
1096
|
+
declare const READINESS_REPAIR_CODES: readonly ["undraft-pr", "render-pr-body-sections", "await-post-undraft-checks"];
|
|
1097
|
+
declare const readinessRepairSchema: z.ZodObject<{
|
|
1098
|
+
action: z.ZodString;
|
|
1099
|
+
code: z.ZodEnum<{
|
|
1100
|
+
"undraft-pr": "undraft-pr";
|
|
1101
|
+
"render-pr-body-sections": "render-pr-body-sections";
|
|
1102
|
+
"await-post-undraft-checks": "await-post-undraft-checks";
|
|
1103
|
+
}>;
|
|
1104
|
+
command: z.ZodString;
|
|
1105
|
+
}, z.core.$strip>;
|
|
1106
|
+
declare const managedReadinessLedgerSchema: z.ZodObject<{
|
|
1107
|
+
baseSha: z.ZodString;
|
|
1108
|
+
blockingReasons: z.ZodArray<z.ZodString>;
|
|
1109
|
+
classification: z.ZodEnum<{
|
|
1110
|
+
trivial: "trivial";
|
|
1111
|
+
"docs/process-only": "docs/process-only";
|
|
1112
|
+
"non-trivial": "non-trivial";
|
|
1113
|
+
}>;
|
|
1114
|
+
externalChecks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1115
|
+
checkType: z.ZodEnum<{
|
|
1116
|
+
review: "review";
|
|
1117
|
+
verify: "verify";
|
|
1118
|
+
}>;
|
|
1119
|
+
inScope: z.ZodBoolean;
|
|
1120
|
+
name: z.ZodString;
|
|
1121
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
1122
|
+
scope: z.ZodOptional<z.ZodObject<{
|
|
1123
|
+
classifications: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1124
|
+
trivial: "trivial";
|
|
1125
|
+
"docs/process-only": "docs/process-only";
|
|
1126
|
+
"non-trivial": "non-trivial";
|
|
1127
|
+
}>>>;
|
|
1128
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1129
|
+
}, z.core.$strict>>;
|
|
1130
|
+
scopeReason: z.ZodString;
|
|
1131
|
+
status: z.ZodEnum<{
|
|
1132
|
+
satisfied: "satisfied";
|
|
1133
|
+
unmet: "unmet";
|
|
1134
|
+
"out-of-scope": "out-of-scope";
|
|
1135
|
+
}>;
|
|
1136
|
+
}, z.core.$strip>>>;
|
|
1137
|
+
finalReviewPoint: z.ZodBoolean;
|
|
1138
|
+
github: z.ZodObject<{
|
|
1139
|
+
currentWithBase: z.ZodBoolean;
|
|
1140
|
+
draft: z.ZodBoolean;
|
|
1141
|
+
mergeStateStatus: z.ZodString;
|
|
1142
|
+
mergeable: z.ZodString;
|
|
1143
|
+
requiredChecks: z.ZodEnum<{
|
|
1144
|
+
unknown: "unknown";
|
|
1145
|
+
pending: "pending";
|
|
1146
|
+
passed: "passed";
|
|
1147
|
+
failed: "failed";
|
|
1148
|
+
none: "none";
|
|
1149
|
+
}>;
|
|
1150
|
+
unresolvedReviewThreads: z.ZodNumber;
|
|
1151
|
+
}, z.core.$strip>;
|
|
1152
|
+
handledCommentsProducer: z.ZodOptional<z.ZodObject<{
|
|
1153
|
+
identity: z.ZodString;
|
|
1154
|
+
mode: z.ZodEnum<{
|
|
1155
|
+
app: "app";
|
|
1156
|
+
"commit-status": "commit-status";
|
|
1157
|
+
}>;
|
|
1158
|
+
}, z.core.$strip>>;
|
|
1159
|
+
handledHumanComments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1160
|
+
clearedAt: z.ZodOptional<z.ZodString>;
|
|
1161
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
1162
|
+
source: z.ZodEnum<{
|
|
1163
|
+
"check-run": "check-run";
|
|
1164
|
+
cli: "cli";
|
|
1165
|
+
}>;
|
|
1166
|
+
url: z.ZodString;
|
|
1167
|
+
}, z.core.$strip>>>;
|
|
1168
|
+
headSha: z.ZodString;
|
|
1169
|
+
mergeBaseSha: z.ZodOptional<z.ZodString>;
|
|
1170
|
+
patchId: z.ZodString;
|
|
1171
|
+
postReadinessHumanComments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1172
|
+
author: z.ZodString;
|
|
1173
|
+
createdAt: z.ZodString;
|
|
1174
|
+
summary: z.ZodString;
|
|
1175
|
+
url: z.ZodString;
|
|
1176
|
+
}, z.core.$strip>>>;
|
|
1177
|
+
postReadinessHumanReviews: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1178
|
+
author: z.ZodString;
|
|
1179
|
+
createdAt: z.ZodString;
|
|
1180
|
+
summary: z.ZodString;
|
|
1181
|
+
url: z.ZodString;
|
|
1182
|
+
}, z.core.$strip>>>;
|
|
1183
|
+
pr: z.ZodNumber;
|
|
1184
|
+
previewDeploy: z.ZodOptional<z.ZodObject<{
|
|
1185
|
+
adminUrl: z.ZodOptional<z.ZodString>;
|
|
1186
|
+
apiHealthUrl: z.ZodOptional<z.ZodString>;
|
|
1187
|
+
headSha: z.ZodOptional<z.ZodString>;
|
|
1188
|
+
localPreviewProof: z.ZodOptional<z.ZodUnknown>;
|
|
1189
|
+
localProofPath: z.ZodOptional<z.ZodString>;
|
|
1190
|
+
proofSource: z.ZodOptional<z.ZodEnum<{
|
|
1191
|
+
"github-actions": "github-actions";
|
|
1192
|
+
"local-self-certified": "local-self-certified";
|
|
1193
|
+
}>>;
|
|
1194
|
+
publicUrl: z.ZodOptional<z.ZodString>;
|
|
1195
|
+
seedStatus: z.ZodEnum<{
|
|
1196
|
+
unknown: "unknown";
|
|
1197
|
+
skipped: "skipped";
|
|
1198
|
+
passed: "passed";
|
|
1199
|
+
failed: "failed";
|
|
1200
|
+
}>;
|
|
1201
|
+
stage: z.ZodOptional<z.ZodString>;
|
|
1202
|
+
timingsMs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodNumber>>>;
|
|
1203
|
+
workflowRunUrl: z.ZodOptional<z.ZodString>;
|
|
1204
|
+
}, z.core.$strip>>;
|
|
1205
|
+
previewDeployRequired: z.ZodBoolean;
|
|
1206
|
+
repairs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1207
|
+
action: z.ZodString;
|
|
1208
|
+
code: z.ZodEnum<{
|
|
1209
|
+
"undraft-pr": "undraft-pr";
|
|
1210
|
+
"render-pr-body-sections": "render-pr-body-sections";
|
|
1211
|
+
"await-post-undraft-checks": "await-post-undraft-checks";
|
|
1212
|
+
}>;
|
|
1213
|
+
command: z.ZodString;
|
|
1214
|
+
}, z.core.$strip>>>;
|
|
1215
|
+
reviewCycleState: z.ZodOptional<z.ZodObject<{
|
|
1216
|
+
autoBlockingFindings: z.ZodNumber;
|
|
1217
|
+
countsBySeverity: z.ZodObject<{
|
|
1218
|
+
critical: z.ZodNumber;
|
|
1219
|
+
high: z.ZodNumber;
|
|
1220
|
+
low: z.ZodNumber;
|
|
1221
|
+
medium: z.ZodNumber;
|
|
1222
|
+
unknown: z.ZodNumber;
|
|
1223
|
+
}, z.core.$strip>;
|
|
1224
|
+
highestBlockingSeverity: z.ZodOptional<z.ZodEnum<{
|
|
1225
|
+
unknown: "unknown";
|
|
1226
|
+
critical: "critical";
|
|
1227
|
+
high: "high";
|
|
1228
|
+
low: "low";
|
|
1229
|
+
medium: "medium";
|
|
1230
|
+
}>>;
|
|
1231
|
+
highestOpenSeverity: z.ZodOptional<z.ZodEnum<{
|
|
1232
|
+
unknown: "unknown";
|
|
1233
|
+
critical: "critical";
|
|
1234
|
+
high: "high";
|
|
1235
|
+
low: "low";
|
|
1236
|
+
medium: "medium";
|
|
1237
|
+
}>>;
|
|
1238
|
+
maxReviewCycles: z.ZodOptional<z.ZodNumber>;
|
|
1239
|
+
nonBlockingFindings: z.ZodNumber;
|
|
1240
|
+
openFindings: z.ZodNumber;
|
|
1241
|
+
reviewCycle: z.ZodOptional<z.ZodNumber>;
|
|
1242
|
+
staleRepeatFindings: z.ZodOptional<z.ZodNumber>;
|
|
1243
|
+
windowExhausted: z.ZodBoolean;
|
|
1244
|
+
}, z.core.$strip>>;
|
|
1245
|
+
reviewLadder: z.ZodOptional<z.ZodObject<{
|
|
1246
|
+
cycleCounts: z.ZodObject<{
|
|
1247
|
+
gate: z.ZodNumber;
|
|
1248
|
+
interior: z.ZodNumber;
|
|
1249
|
+
}, z.core.$strip>;
|
|
1250
|
+
forcedTransition: z.ZodOptional<z.ZodEnum<{
|
|
1251
|
+
"gate-cap-exhausted": "gate-cap-exhausted";
|
|
1252
|
+
"interior-cap-reached": "interior-cap-reached";
|
|
1253
|
+
}>>;
|
|
1254
|
+
nextAction: z.ZodEnum<{
|
|
1255
|
+
"run-gate-cycle": "run-gate-cycle";
|
|
1256
|
+
"accept-nonblocking-findings": "accept-nonblocking-findings";
|
|
1257
|
+
"escalate-to-triage": "escalate-to-triage";
|
|
1258
|
+
"ready-for-human": "ready-for-human";
|
|
1259
|
+
"advance-to-gate": "advance-to-gate";
|
|
1260
|
+
"run-interior-cycle": "run-interior-cycle";
|
|
1261
|
+
}>;
|
|
1262
|
+
stage: z.ZodEnum<{
|
|
1263
|
+
gate: "gate";
|
|
1264
|
+
interior: "interior";
|
|
1265
|
+
"interior-complete": "interior-complete";
|
|
1266
|
+
}>;
|
|
1267
|
+
}, z.core.$strip>>;
|
|
1268
|
+
reviewRuns: z.ZodOptional<z.ZodArray<z.ZodType<PrReviewResult, unknown, z.core.$ZodTypeInternals<PrReviewResult, unknown>>>>;
|
|
1269
|
+
reviewTerminalState: z.ZodOptional<z.ZodEnum<{
|
|
1270
|
+
blocked: "blocked";
|
|
1271
|
+
"accepted-with-findings": "accepted-with-findings";
|
|
1272
|
+
clean: "clean";
|
|
1273
|
+
}>>;
|
|
1274
|
+
reviews: z.ZodObject<{
|
|
1275
|
+
correctness: z.ZodObject<{
|
|
1276
|
+
docsOnlyDeltaAccepted: z.ZodOptional<z.ZodBoolean>;
|
|
1277
|
+
required: z.ZodBoolean;
|
|
1278
|
+
reviewedHeadSha: z.ZodOptional<z.ZodString>;
|
|
1279
|
+
reviewedPatchId: z.ZodOptional<z.ZodString>;
|
|
1280
|
+
status: z.ZodEnum<{
|
|
1281
|
+
blocked: "blocked";
|
|
1282
|
+
"not-required": "not-required";
|
|
1283
|
+
current: "current";
|
|
1284
|
+
stale: "stale";
|
|
1285
|
+
missing: "missing";
|
|
1286
|
+
}>;
|
|
1287
|
+
}, z.core.$strip>;
|
|
1288
|
+
security: z.ZodOptional<z.ZodObject<{
|
|
1289
|
+
docsOnlyDeltaAccepted: z.ZodOptional<z.ZodBoolean>;
|
|
1290
|
+
required: z.ZodBoolean;
|
|
1291
|
+
reviewedHeadSha: z.ZodOptional<z.ZodString>;
|
|
1292
|
+
reviewedPatchId: z.ZodOptional<z.ZodString>;
|
|
1293
|
+
status: z.ZodEnum<{
|
|
1294
|
+
blocked: "blocked";
|
|
1295
|
+
"not-required": "not-required";
|
|
1296
|
+
current: "current";
|
|
1297
|
+
stale: "stale";
|
|
1298
|
+
missing: "missing";
|
|
1299
|
+
}>;
|
|
1300
|
+
}, z.core.$strip>>;
|
|
1301
|
+
}, z.core.$strip>;
|
|
1302
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
1303
|
+
stackRole: z.ZodEnum<{
|
|
1304
|
+
slice: "slice";
|
|
1305
|
+
single: "single";
|
|
1306
|
+
rollup: "rollup";
|
|
1307
|
+
"merge-gate prerequisite": "merge-gate prerequisite";
|
|
1308
|
+
}>;
|
|
1309
|
+
verification: z.ZodObject<{
|
|
1310
|
+
command: z.ZodLiteral<"patronage-factory pr:verify">;
|
|
1311
|
+
docsOnlyDeltaAccepted: z.ZodOptional<z.ZodBoolean>;
|
|
1312
|
+
docsOnlyVerifiedHeadSha: z.ZodOptional<z.ZodString>;
|
|
1313
|
+
prVerify: z.ZodEnum<{
|
|
1314
|
+
passed: "passed";
|
|
1315
|
+
stale: "stale";
|
|
1316
|
+
missing: "missing";
|
|
1317
|
+
}>;
|
|
1318
|
+
trivialDeltaAccepted: z.ZodOptional<z.ZodBoolean>;
|
|
1319
|
+
trivialVerifiedHeadSha: z.ZodOptional<z.ZodString>;
|
|
1320
|
+
verifiedHeadSha: z.ZodOptional<z.ZodString>;
|
|
1321
|
+
}, z.core.$strip>;
|
|
1322
|
+
}, z.core.$strip>;
|
|
1323
|
+
type PreviewDeployProof = z.infer<typeof previewDeploySchema>;
|
|
1324
|
+
type PreviewSeedStatus = PreviewDeployProof["seedStatus"];
|
|
1325
|
+
type ReadinessRepair = z.infer<typeof readinessRepairSchema>;
|
|
1326
|
+
type ReadinessStatus = "ready" | "blocked" | "slice-ready/not-final";
|
|
1327
|
+
type ManagedReadinessLedger = z.infer<typeof managedReadinessLedgerSchema>;
|
|
1328
|
+
declare function validateManagedReadinessLedger(value: unknown): ManagedReadinessLedger;
|
|
1329
|
+
declare namespace status_check_rollup_d_exports {
|
|
1330
|
+
export { CheckState, StatusCheckRollup, isFactoryReadyCheck, statusCheckState };
|
|
1331
|
+
}
|
|
1332
|
+
type CheckState = "passed" | "failed" | "pending" | "none" | "unknown";
|
|
1333
|
+
interface StatusCheckRollup {
|
|
1334
|
+
__typename?: string;
|
|
1335
|
+
completedAt?: string;
|
|
1336
|
+
conclusion?: string;
|
|
1337
|
+
context?: string;
|
|
1338
|
+
name?: string;
|
|
1339
|
+
startedAt?: string;
|
|
1340
|
+
state?: string;
|
|
1341
|
+
status?: string;
|
|
1342
|
+
workflowName?: string;
|
|
1343
|
+
}
|
|
1344
|
+
declare const isFactoryReadyCheck: (check: StatusCheckRollup) => boolean;
|
|
1345
|
+
declare const statusCheckState: (rollup: StatusCheckRollup[] | undefined, exclude?: (check: StatusCheckRollup) => boolean) => CheckState;
|
|
1346
|
+
//#endregion
|
|
1347
|
+
//#region src/pr-ready.d.ts
|
|
1348
|
+
interface PrReadyArgs extends LoadProjectProfileInput {
|
|
1349
|
+
authoringSessionIds?: string[];
|
|
1350
|
+
base: string;
|
|
1351
|
+
bodyForEvaluation?: string;
|
|
1352
|
+
handledCommentUrls?: string[];
|
|
1353
|
+
json?: boolean;
|
|
1354
|
+
output?: string;
|
|
1355
|
+
report?: boolean;
|
|
1356
|
+
pr: number;
|
|
1357
|
+
reviewProof?: string;
|
|
1358
|
+
throwWhenBlocked?: boolean;
|
|
1359
|
+
verifyProof?: string;
|
|
1360
|
+
}
|
|
1361
|
+
interface GitHubPullRequest {
|
|
1362
|
+
baseRefName: string;
|
|
1363
|
+
baseRefOid: string;
|
|
1364
|
+
body: string;
|
|
1365
|
+
comments: {
|
|
1366
|
+
author?: {
|
|
1367
|
+
login?: string;
|
|
1368
|
+
};
|
|
1369
|
+
body: string;
|
|
1370
|
+
createdAt?: string;
|
|
1371
|
+
id?: string | number;
|
|
1372
|
+
updatedAt?: string;
|
|
1373
|
+
url?: string;
|
|
1374
|
+
}[];
|
|
1375
|
+
headRefOid: string;
|
|
1376
|
+
isDraft: boolean;
|
|
1377
|
+
labels?: {
|
|
1378
|
+
name: string;
|
|
1379
|
+
}[];
|
|
1380
|
+
mergeStateStatus: string;
|
|
1381
|
+
mergeable: string;
|
|
1382
|
+
number: number;
|
|
1383
|
+
reviews?: {
|
|
1384
|
+
author?: {
|
|
1385
|
+
login?: string;
|
|
1386
|
+
};
|
|
1387
|
+
body?: string;
|
|
1388
|
+
lastEditedAt?: string;
|
|
1389
|
+
state: string;
|
|
1390
|
+
submittedAt?: string;
|
|
1391
|
+
url?: string;
|
|
1392
|
+
}[];
|
|
1393
|
+
statusCheckRollup?: StatusCheckRollup[];
|
|
1394
|
+
title: string;
|
|
1395
|
+
unresolvedReviewThreads: number;
|
|
1396
|
+
url: string;
|
|
1397
|
+
}
|
|
1398
|
+
interface PrReadyProof {
|
|
1399
|
+
schemaVersion: 1;
|
|
1400
|
+
blockingReasons: string[];
|
|
1401
|
+
humanBlockingReasons: string[];
|
|
1402
|
+
command: "patronage-factory pr:ready";
|
|
1403
|
+
/**
|
|
1404
|
+
* Machine-safe arg array for the obvious next action (#523): when `ready`,
|
|
1405
|
+
* the `pr:merge-check` that must precede a merge; otherwise the `pr:verify`
|
|
1406
|
+
* re-run that the blocking reasons name (re-verify the head, then re-run
|
|
1407
|
+
* pr:ready). Same `argv` shape `factory:delegate --print` emits. Optional
|
|
1408
|
+
* and purely additive.
|
|
1409
|
+
*/
|
|
1410
|
+
followUp?: FollowUpAction;
|
|
1411
|
+
/**
|
|
1412
|
+
* `ledger.headSha` is the evaluated head SHA: the GitHub `pr.headRefOid`
|
|
1413
|
+
* captured at evaluation time (not a local git read), recorded explicitly
|
|
1414
|
+
* so merge-time identity checks are a pure comparison against the live
|
|
1415
|
+
* pushed HEAD, not a re-derivation. See the ledger schema.
|
|
1416
|
+
*/
|
|
1417
|
+
ledger: ManagedReadinessLedger;
|
|
1418
|
+
/** Committed profile blob evaluated by readiness. Required for merge. */
|
|
1419
|
+
profileBlobSha?: string;
|
|
1420
|
+
/** Checkout-relative committed profile path evaluated by readiness. */
|
|
1421
|
+
profilePath?: string;
|
|
1422
|
+
repairs: ReadinessRepair[];
|
|
1423
|
+
/** Trusted checkout repository used for all GitHub reads and writes. */
|
|
1424
|
+
repository?: string;
|
|
1425
|
+
status: ReadinessStatus;
|
|
1426
|
+
}
|
|
1427
|
+
type PublishHandledCommentsResult = HandledCommentsProducer | Promise<HandledCommentsProducer | undefined> | undefined;
|
|
1428
|
+
interface PrReadyDependencies {
|
|
1429
|
+
github?: {
|
|
1430
|
+
fetchHandledComments?: (input: {
|
|
1431
|
+
owner: string;
|
|
1432
|
+
pr: number;
|
|
1433
|
+
repo: string;
|
|
1434
|
+
}) => {
|
|
1435
|
+
producer?: HandledCommentsProducer;
|
|
1436
|
+
urls: string[];
|
|
1437
|
+
}; /** @deprecated Prefer fetchHandledComments (includes producer identity). */
|
|
1438
|
+
fetchHandledCommentUrls?: (input: {
|
|
1439
|
+
owner: string;
|
|
1440
|
+
pr: number;
|
|
1441
|
+
repo: string;
|
|
1442
|
+
}) => string[];
|
|
1443
|
+
fetchPullRequest: (input: {
|
|
1444
|
+
owner: string;
|
|
1445
|
+
repo: string;
|
|
1446
|
+
pr: number;
|
|
1447
|
+
}) => GitHubPullRequest;
|
|
1448
|
+
publishHandledCommentsCheck?: (input: PublishHandledCommentsCheckInput) => PublishHandledCommentsResult;
|
|
1449
|
+
};
|
|
1450
|
+
git?: PrReadyGitDependencies;
|
|
1451
|
+
hq?: HqIngestDependencies;
|
|
1452
|
+
publishCheckRun?: (input: PublishFactoryCheckInput) => void;
|
|
1453
|
+
/** Injectable delay for the UNKNOWN-mergeable brief poll (tests). */
|
|
1454
|
+
sleep?: (ms: number) => Promise<void>;
|
|
1455
|
+
/** Injectable clock for CLI handled-comment provenance (tests). */
|
|
1456
|
+
now?: () => Date;
|
|
1457
|
+
}
|
|
1458
|
+
interface PrReadyGitDependencies {
|
|
1459
|
+
canResolveCommit: (cwd: string, sha: string) => boolean;
|
|
1460
|
+
changedFiles: (cwd: string, base: string, headSha?: string) => string[];
|
|
1461
|
+
checkoutRepository: (cwd: string) => CheckoutRepository;
|
|
1462
|
+
currentHeadSha: (cwd: string) => string;
|
|
1463
|
+
mergeBaseSha: (cwd: string, base: string) => string;
|
|
1464
|
+
objectIdAtRef: (cwd: string, ref: string, absolutePath: string) => string | undefined;
|
|
1465
|
+
resolveCommitSha: (cwd: string, ref: string) => string | undefined;
|
|
1466
|
+
showFileAtRef: (cwd: string, ref: string, absolutePath: string) => string | undefined;
|
|
1467
|
+
stablePatchId: (cwd: string, base: string) => string;
|
|
1468
|
+
}
|
|
1469
|
+
declare function validatePrReadyProof(value: unknown): PrReadyProof;
|
|
1470
|
+
declare function readPrReadyProof(filePath: string): PrReadyProof;
|
|
1471
|
+
declare function runPrReady(args: PrReadyArgs, dependencies?: PrReadyDependencies): Promise<PrReadyProof>;
|
|
1472
|
+
//#endregion
|
|
1473
|
+
//#region src/required-check-policy.d.ts
|
|
1474
|
+
declare const EVIDENCE_CHECK_TYPES: readonly ["review", "verify"];
|
|
1475
|
+
type EvidenceCheckType = (typeof EVIDENCE_CHECK_TYPES)[number];
|
|
1476
|
+
declare const requiredCheckScopeSchema: z.ZodObject<{
|
|
1477
|
+
classifications: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1478
|
+
trivial: "trivial";
|
|
1479
|
+
"docs/process-only": "docs/process-only";
|
|
1480
|
+
"non-trivial": "non-trivial";
|
|
1481
|
+
}>>>;
|
|
1482
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1483
|
+
}, z.core.$strict>;
|
|
1484
|
+
type RequiredCheckScope = z.infer<typeof requiredCheckScopeSchema>;
|
|
1485
|
+
interface RequiredCheckScopeContext {
|
|
1486
|
+
labels: string[] | undefined;
|
|
1487
|
+
classification: DiffClassification;
|
|
1488
|
+
}
|
|
1489
|
+
interface ScopeDecision {
|
|
1490
|
+
inScope: boolean;
|
|
1491
|
+
reason: string;
|
|
1492
|
+
}
|
|
1493
|
+
declare const requiredCheckInScope: ({
|
|
1494
|
+
context,
|
|
1495
|
+
scope
|
|
1496
|
+
}: {
|
|
1497
|
+
context: RequiredCheckScopeContext;
|
|
1498
|
+
scope?: RequiredCheckScope;
|
|
1499
|
+
}) => ScopeDecision;
|
|
1500
|
+
interface RequiredCheck {
|
|
1501
|
+
name: string;
|
|
1502
|
+
checkType: EvidenceCheckType;
|
|
1503
|
+
scope?: RequiredCheckScope;
|
|
1504
|
+
}
|
|
1505
|
+
//#endregion
|
|
1506
|
+
//#region src/factory-session.d.ts
|
|
1507
|
+
declare const resolveAuthoringSessionIds: ({
|
|
1508
|
+
override,
|
|
1509
|
+
recorded
|
|
1510
|
+
}: {
|
|
1511
|
+
override?: string[];
|
|
1512
|
+
recorded?: string;
|
|
1513
|
+
}) => string[];
|
|
1514
|
+
declare namespace external_evidence_d_exports {
|
|
1515
|
+
export { EVIDENCE_CHECK_TYPES, EVIDENCE_DIR, EVIDENCE_ENVELOPE_SCHEMA_VERSION, EVIDENCE_REVIEW_RUNGS, EvidenceCandidateIdentity, EvidenceCheckType, EvidenceEnvelope, EvidenceEnvelopeParse, EvidenceReviewRung, IndependenceResult, LoadedEvidenceEnvelope, RequiredCheck, RequiredCheckEvaluation, RequiredCheckEvaluationInput, RequiredCheckOutcome, RequiredCheckScope, RequiredCheckScopeContext, ScopeDecision, evaluateRequiredChecks, evidenceBindingFresh, evidenceEnvelopeSchema, evidenceReviewIndependence, loadEvidenceEnvelopes, parseEvidenceEnvelope, requiredCheckInScope, requiredCheckScopeSchema, resolveAuthoringSessionIds };
|
|
1516
|
+
}
|
|
1517
|
+
declare const EVIDENCE_ENVELOPE_SCHEMA_VERSION = 1;
|
|
1518
|
+
declare const evidenceEnvelopeBaseSchema: z.ZodObject<{
|
|
1519
|
+
check: z.ZodString;
|
|
1520
|
+
checkType: z.ZodEnum<{
|
|
1521
|
+
review: "review";
|
|
1522
|
+
verify: "verify";
|
|
1523
|
+
}>;
|
|
1524
|
+
findingsPointer: z.ZodOptional<z.ZodString>;
|
|
1525
|
+
headSha: z.ZodString;
|
|
1526
|
+
mergeBaseSha: z.ZodString;
|
|
1527
|
+
model: z.ZodOptional<z.ZodString>;
|
|
1528
|
+
outcome: z.ZodEnum<{
|
|
1529
|
+
pass: "pass";
|
|
1530
|
+
fail: "fail";
|
|
1531
|
+
}>;
|
|
1532
|
+
patchId: z.ZodString;
|
|
1533
|
+
policyVersion: z.ZodOptional<z.ZodString>;
|
|
1534
|
+
producer: z.ZodString;
|
|
1535
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
1536
|
+
rung: z.ZodOptional<z.ZodEnum<{
|
|
1537
|
+
oracle: "oracle";
|
|
1538
|
+
"independent-model": "independent-model";
|
|
1539
|
+
human: "human";
|
|
1540
|
+
}>>;
|
|
1541
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
1542
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
1543
|
+
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
1544
|
+
}, z.core.$loose>;
|
|
1545
|
+
declare const evidenceEnvelopeSchema: z.ZodObject<{
|
|
1546
|
+
check: z.ZodString;
|
|
1547
|
+
checkType: z.ZodEnum<{
|
|
1548
|
+
review: "review";
|
|
1549
|
+
verify: "verify";
|
|
1550
|
+
}>;
|
|
1551
|
+
findingsPointer: z.ZodOptional<z.ZodString>;
|
|
1552
|
+
headSha: z.ZodString;
|
|
1553
|
+
mergeBaseSha: z.ZodString;
|
|
1554
|
+
model: z.ZodOptional<z.ZodString>;
|
|
1555
|
+
outcome: z.ZodEnum<{
|
|
1556
|
+
pass: "pass";
|
|
1557
|
+
fail: "fail";
|
|
1558
|
+
}>;
|
|
1559
|
+
patchId: z.ZodString;
|
|
1560
|
+
policyVersion: z.ZodOptional<z.ZodString>;
|
|
1561
|
+
producer: z.ZodString;
|
|
1562
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
1563
|
+
rung: z.ZodOptional<z.ZodEnum<{
|
|
1564
|
+
oracle: "oracle";
|
|
1565
|
+
"independent-model": "independent-model";
|
|
1566
|
+
human: "human";
|
|
1567
|
+
}>>;
|
|
1568
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
1569
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
1570
|
+
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
1571
|
+
}, z.core.$loose>;
|
|
1572
|
+
type EvidenceEnvelope = z.infer<typeof evidenceEnvelopeBaseSchema>;
|
|
1573
|
+
type EvidenceEnvelopeParse = {
|
|
1574
|
+
ok: true;
|
|
1575
|
+
envelope: EvidenceEnvelope;
|
|
1576
|
+
} | {
|
|
1577
|
+
ok: false;
|
|
1578
|
+
error: string;
|
|
1579
|
+
};
|
|
1580
|
+
declare const parseEvidenceEnvelope: (raw: unknown) => EvidenceEnvelopeParse;
|
|
1581
|
+
interface EvidenceCandidateIdentity {
|
|
1582
|
+
headSha: string;
|
|
1583
|
+
patchId: string;
|
|
1584
|
+
mergeBaseSha: string;
|
|
1585
|
+
}
|
|
1586
|
+
declare const evidenceBindingFresh: ({
|
|
1587
|
+
candidate,
|
|
1588
|
+
envelope
|
|
1589
|
+
}: {
|
|
1590
|
+
candidate: EvidenceCandidateIdentity;
|
|
1591
|
+
envelope: EvidenceEnvelope;
|
|
1592
|
+
}) => boolean;
|
|
1593
|
+
interface IndependenceResult {
|
|
1594
|
+
independent: boolean;
|
|
1595
|
+
reason?: "no-session" | "unknown-authoring-identity" | "same-session";
|
|
1596
|
+
}
|
|
1597
|
+
declare const evidenceReviewIndependence: ({
|
|
1598
|
+
authoringSessionIds,
|
|
1599
|
+
envelope
|
|
1600
|
+
}: {
|
|
1601
|
+
authoringSessionIds: string[];
|
|
1602
|
+
envelope: EvidenceEnvelope;
|
|
1603
|
+
}) => IndependenceResult;
|
|
1604
|
+
type LoadedEvidenceEnvelope = {
|
|
1605
|
+
ok: true;
|
|
1606
|
+
envelope: EvidenceEnvelope;
|
|
1607
|
+
path: string;
|
|
1608
|
+
} | {
|
|
1609
|
+
check?: string;
|
|
1610
|
+
error: string;
|
|
1611
|
+
ok: false;
|
|
1612
|
+
path: string;
|
|
1613
|
+
};
|
|
1614
|
+
interface RequiredCheckEvaluationInput {
|
|
1615
|
+
authoringSessionIds: string[];
|
|
1616
|
+
candidate: EvidenceCandidateIdentity;
|
|
1617
|
+
envelopes: LoadedEvidenceEnvelope[];
|
|
1618
|
+
requiredChecks: RequiredCheck[];
|
|
1619
|
+
scopeContext: RequiredCheckScopeContext;
|
|
1620
|
+
}
|
|
1621
|
+
interface RequiredCheckOutcome {
|
|
1622
|
+
name: string;
|
|
1623
|
+
checkType: EvidenceCheckType;
|
|
1624
|
+
status: "satisfied" | "unmet" | "out-of-scope";
|
|
1625
|
+
inScope: boolean;
|
|
1626
|
+
scopeReason: string;
|
|
1627
|
+
scope?: RequiredCheckScope;
|
|
1628
|
+
reason?: string;
|
|
1629
|
+
matchedPath?: string;
|
|
1630
|
+
}
|
|
1631
|
+
interface RequiredCheckEvaluation {
|
|
1632
|
+
outcomes: RequiredCheckOutcome[];
|
|
1633
|
+
blockingReasons: string[];
|
|
1634
|
+
}
|
|
1635
|
+
declare const evaluateRequiredChecks: ({
|
|
1636
|
+
authoringSessionIds,
|
|
1637
|
+
candidate,
|
|
1638
|
+
envelopes,
|
|
1639
|
+
requiredChecks,
|
|
1640
|
+
scopeContext
|
|
1641
|
+
}: RequiredCheckEvaluationInput) => RequiredCheckEvaluation;
|
|
1642
|
+
declare const EVIDENCE_DIR = ".factory-memory/evidence";
|
|
1643
|
+
declare const loadEvidenceEnvelopes: (cwd: string) => LoadedEvidenceEnvelope[];
|
|
1644
|
+
//#endregion
|
|
1645
|
+
//#region src/review-proof-applicability.d.ts
|
|
1646
|
+
declare const REVIEW_STATUS_VALUES: readonly ["not-required", "current", "stale", "missing", "blocked"];
|
|
1647
|
+
declare const reviewStatusSchema: z.ZodEnum<{
|
|
1648
|
+
blocked: "blocked";
|
|
1649
|
+
"not-required": "not-required";
|
|
1650
|
+
current: "current";
|
|
1651
|
+
stale: "stale";
|
|
1652
|
+
missing: "missing";
|
|
1653
|
+
}>;
|
|
1654
|
+
type ReviewStatus = z.infer<typeof reviewStatusSchema>;
|
|
1655
|
+
interface CurrentReviewIdentity {
|
|
1656
|
+
headSha: string;
|
|
1657
|
+
patchId: string;
|
|
1658
|
+
}
|
|
1659
|
+
declare const reviewStatus: ({
|
|
1660
|
+
blocked,
|
|
1661
|
+
required,
|
|
1662
|
+
reviewedHeadSha,
|
|
1663
|
+
reviewedPatchId,
|
|
1664
|
+
headSha,
|
|
1665
|
+
patchId
|
|
1666
|
+
}: CurrentReviewIdentity & {
|
|
1667
|
+
blocked?: boolean;
|
|
1668
|
+
required: boolean;
|
|
1669
|
+
reviewedHeadSha?: string;
|
|
1670
|
+
reviewedPatchId?: string;
|
|
1671
|
+
}) => ReviewStatus;
|
|
1672
|
+
declare namespace proof_identity_d_exports {
|
|
1673
|
+
export { CurrentReviewIdentity, REVIEW_STATUS_VALUES, ReviewProofClaim, ReviewStatus, explicitFailureIdentity, isExplicitReviewFailure, isUntypedReviewProof, reviewStatus, reviewStatusSchema, selectReviewProof };
|
|
1674
|
+
}
|
|
1675
|
+
type ReviewProofClaim = {
|
|
1676
|
+
reviewedHeadSha?: string;
|
|
1677
|
+
reviewedPatchId?: string;
|
|
1678
|
+
untypedVerdict?: boolean;
|
|
1679
|
+
} | {
|
|
1680
|
+
explicitFailure: true;
|
|
1681
|
+
reviewedHeadSha?: string;
|
|
1682
|
+
reviewedPatchId?: string;
|
|
1683
|
+
untypedVerdict?: boolean;
|
|
1684
|
+
};
|
|
1685
|
+
declare const isExplicitReviewFailure: (proof: ReviewProofClaim) => proof is {
|
|
1686
|
+
explicitFailure: true;
|
|
1687
|
+
reviewedHeadSha?: string;
|
|
1688
|
+
reviewedPatchId?: string;
|
|
1689
|
+
untypedVerdict?: boolean;
|
|
1690
|
+
};
|
|
1691
|
+
declare const isUntypedReviewProof: (proof: ReviewProofClaim) => proof is {
|
|
1692
|
+
untypedVerdict: true;
|
|
1693
|
+
reviewedHeadSha?: string;
|
|
1694
|
+
reviewedPatchId?: string;
|
|
1695
|
+
};
|
|
1696
|
+
declare const explicitFailureIdentity: (proof: ReviewProofClaim) => {
|
|
1697
|
+
reviewedHeadSha?: string;
|
|
1698
|
+
reviewedPatchId?: string;
|
|
1699
|
+
};
|
|
1700
|
+
declare const selectReviewProof: ({
|
|
1701
|
+
reviewProof
|
|
1702
|
+
}: {
|
|
1703
|
+
reviewProof: ReviewProofClaim;
|
|
1704
|
+
}) => {
|
|
1705
|
+
reviewedHeadSha?: string;
|
|
1706
|
+
reviewedPatchId?: string;
|
|
1707
|
+
untypedVerdict?: boolean;
|
|
1708
|
+
};
|
|
1709
|
+
//#endregion
|
|
1710
|
+
//#region src/pr-readiness/review-epoch.d.ts
|
|
1711
|
+
interface ReviewCycleState {
|
|
1712
|
+
autoBlockingFindings: number;
|
|
1713
|
+
countsBySeverity: Record<ReviewFindingSeverity, number>;
|
|
1714
|
+
highestBlockingSeverity?: ReviewFindingSeverity;
|
|
1715
|
+
highestOpenSeverity?: ReviewFindingSeverity;
|
|
1716
|
+
maxReviewCycles?: number;
|
|
1717
|
+
nonBlockingFindings: number;
|
|
1718
|
+
openFindings: number;
|
|
1719
|
+
reviewCycle?: number;
|
|
1720
|
+
staleRepeatFindings?: number;
|
|
1721
|
+
windowExhausted: boolean;
|
|
1722
|
+
}
|
|
1723
|
+
declare const reviewCycleStateFor: (proof: Pick<PrReviewProof, "ladder" | "reviewCycle" | "maxReviewCycles" | "reviews">, policy?: ReviewLadderPolicy, adjudicatedLedger?: FindingLedgerEntry[]) => ReviewCycleState;
|
|
1724
|
+
type ReviewAcceptance = "accepted-after-cap" | "accepted-clean" | "accepted-through-ladder" | "blocked";
|
|
1725
|
+
declare const resolveReviewAcceptance: (proof: PrReviewProof, review: PrReviewResult, policy: ReviewLadderPolicy | undefined) => ReviewAcceptance;
|
|
1726
|
+
type ReviewTerminalState = "accepted-with-findings" | "blocked" | "clean";
|
|
1727
|
+
declare const resolveReviewTerminalStateForEpoch: (proof: PrReviewProof, review: PrReviewResult, epoch: ReviewEpochMode, adjudicatedLedger?: FindingLedgerEntry[]) => ReviewTerminalState;
|
|
1728
|
+
declare const resolveReviewTerminalState: (proof: PrReviewProof, review: PrReviewResult, policy: ReviewLadderPolicy | undefined) => ReviewTerminalState;
|
|
1729
|
+
declare const resolveReviewTerminalStateAcrossReviews: (proof: PrReviewProof, epoch: ReviewEpochMode, adjudicatedLedger?: FindingLedgerEntry[]) => ReviewTerminalState | undefined;
|
|
1730
|
+
declare const resolveReviewTerminalStateAcrossReviewsForPolicy: (proof: PrReviewProof, policy: ReviewLadderPolicy) => ReviewTerminalState | undefined;
|
|
1731
|
+
declare const reviewProofFor: (proof: PrReviewProof | undefined, kind: PrReviewKind, policy: ReviewLadderPolicy | undefined, current?: {
|
|
1732
|
+
patchId: string;
|
|
1733
|
+
}) => ReviewProofClaim;
|
|
1734
|
+
declare namespace review_proof_d_exports {
|
|
1735
|
+
export { DEFAULT_PR_REVIEW_MAX_CYCLES, DEFAULT_PR_REVIEW_PROOF_PATH, PR_REVIEW_FINAL_READINESS_NOTICE, PR_REVIEW_FINDING_PROVENANCE_VERSION, PR_REVIEW_PROOF_DESCRIPTOR, PR_REVIEW_SCHEMA_VERSION, PrReviewFinding, PrReviewKind, PrReviewLadderState, PrReviewMode, PrReviewOutcome, PrReviewProof, PrReviewResult, PrReviewStageResolution, REVIEW_SEVERITIES, ReviewAcceptance, ReviewCycleState, ReviewFindingCategory, ReviewFindingSeverity, ReviewTerminalState, prReviewFindingSchema, prReviewProofSchema, prReviewResultSchema, readPrReviewProof, resolveReviewAcceptance, resolveReviewTerminalState, resolveReviewTerminalStateAcrossReviews, resolveReviewTerminalStateAcrossReviewsForPolicy, resolveReviewTerminalStateForEpoch, reviewCycleStateFor, reviewProofFor, validatePrReviewProof, validatePrReviewResult };
|
|
1736
|
+
}
|
|
1737
|
+
declare const PR_REVIEW_SCHEMA_VERSION = 2;
|
|
1738
|
+
declare const PR_REVIEW_FINDING_PROVENANCE_VERSION = 1;
|
|
1739
|
+
declare const DEFAULT_PR_REVIEW_PROOF_PATH = ".factory-memory/pr-review.json";
|
|
1740
|
+
declare const DEFAULT_PR_REVIEW_MAX_CYCLES = 5;
|
|
1741
|
+
declare const PR_REVIEW_FINAL_READINESS_NOTICE = "pr:review is a final readiness proof gate. Run it after local verification and avoid repeated full runs unless the review proof records actionable findings. Default review window: 5 cycles.";
|
|
1742
|
+
declare const prReviewFindingSchema: z.ZodType<PrReviewFinding>;
|
|
1743
|
+
declare const prReviewResultSchema: z.ZodType<PrReviewResult>;
|
|
1744
|
+
declare const prReviewProofSchema: z.ZodType<PrReviewProof>;
|
|
1745
|
+
declare const validatePrReviewResult: (value: unknown) => PrReviewResult;
|
|
1746
|
+
declare const validatePrReviewProof: (value: unknown) => PrReviewProof;
|
|
1747
|
+
declare const readPrReviewProof: (filePath: string) => PrReviewProof;
|
|
1748
|
+
declare const PR_REVIEW_PROOF_DESCRIPTOR: ProofDescriptor<PrReviewProof>;
|
|
1749
|
+
declare namespace verification_proof_d_exports {
|
|
1750
|
+
export { PrVerifyBaselineFullProof, PrVerifyCommandResult, PrVerifyExecutedCommand, PrVerifyProof, PrVerifySchemaVersion, ResolvedPrVerifyMode, SUPPORTED_PR_VERIFY_SCHEMA_VERSIONS, VerificationHeadShas, VerificationProofState, VerifiedHeadShas, prVerifyFullHeadShasForDiff, prVerifyProofHeadShas, readPrVerifyProof, resolveVerifyProofApplicability, validatePrVerifyProof, verificationProofApplicabilityFor, verificationProofBlockingReason, verificationProofForReadiness, verificationProofStateFor, verifyProofIdentityMatches, verifyProofPassed };
|
|
1751
|
+
}
|
|
1752
|
+
interface VerifiedHeadShas {
|
|
1753
|
+
docsOnlyVerifiedHeadShas: string[];
|
|
1754
|
+
trivialVerifiedHeadShas: string[];
|
|
1755
|
+
verifiedHeadShas: string[];
|
|
1756
|
+
}
|
|
1757
|
+
type VerificationHeadShas = {
|
|
1758
|
+
explicitFailure: true;
|
|
1759
|
+
} | VerifiedHeadShas;
|
|
1760
|
+
declare const SUPPORTED_PR_VERIFY_SCHEMA_VERSIONS: readonly [1, 2, 3, 4];
|
|
1761
|
+
type PrVerifySchemaVersion = (typeof SUPPORTED_PR_VERIFY_SCHEMA_VERSIONS)[number];
|
|
1762
|
+
interface PrVerifyCommandResult {
|
|
1763
|
+
command: string;
|
|
1764
|
+
description: string;
|
|
1765
|
+
name: string;
|
|
1766
|
+
scope: "always" | "docs-only" | "trivial" | "full";
|
|
1767
|
+
}
|
|
1768
|
+
interface PrVerifyExecutedCommand {
|
|
1769
|
+
command: string;
|
|
1770
|
+
counts?: {
|
|
1771
|
+
testFiles?: number;
|
|
1772
|
+
tests?: number;
|
|
1773
|
+
};
|
|
1774
|
+
durationMs: number;
|
|
1775
|
+
exitCode: number;
|
|
1776
|
+
name: string;
|
|
1777
|
+
scope: "always" | "docs-only" | "trivial" | "full";
|
|
1778
|
+
}
|
|
1779
|
+
interface PrVerifyProof {
|
|
1780
|
+
schemaVersion: PrVerifySchemaVersion;
|
|
1781
|
+
authoringSession?: string;
|
|
1782
|
+
base: string;
|
|
1783
|
+
baselineFullProofs?: {
|
|
1784
|
+
base: string;
|
|
1785
|
+
changedFiles: string[];
|
|
1786
|
+
headSha: string;
|
|
1787
|
+
profilePath: string;
|
|
1788
|
+
projectKey: string;
|
|
1789
|
+
repository: string;
|
|
1790
|
+
}[];
|
|
1791
|
+
changedFiles: string[];
|
|
1792
|
+
classification: DiffClassification;
|
|
1793
|
+
classificationReasons: string[];
|
|
1794
|
+
command: "patronage-factory pr:verify";
|
|
1795
|
+
durationMs: number;
|
|
1796
|
+
endedAt: string;
|
|
1797
|
+
executedCommands?: PrVerifyExecutedCommand[];
|
|
1798
|
+
headSha: string;
|
|
1799
|
+
mode: ResolvedPrVerifyMode;
|
|
1800
|
+
mergeBaseSha?: string;
|
|
1801
|
+
outcome?: "aborted" | "passed";
|
|
1802
|
+
patchId?: string;
|
|
1803
|
+
profilePath: string;
|
|
1804
|
+
projectKey: string;
|
|
1805
|
+
repository: string;
|
|
1806
|
+
startedAt: string;
|
|
1807
|
+
verificationCommands: PrVerifyCommandResult[];
|
|
1808
|
+
}
|
|
1809
|
+
type PrVerifyBaselineFullProof = NonNullable<PrVerifyProof["baselineFullProofs"]>[number];
|
|
1810
|
+
declare function validatePrVerifyProof(value: unknown): PrVerifyProof;
|
|
1811
|
+
declare function readPrVerifyProof(filePath: string): PrVerifyProof;
|
|
1812
|
+
declare const verifyProofPassed: (proof: PrVerifyProof) => boolean;
|
|
1813
|
+
declare const prVerifyProofHeadShas: (proof: PrVerifyProof | undefined, creditedHeadSha?: string) => VerifiedHeadShas;
|
|
1814
|
+
declare const verifyProofIdentityMatches: ({
|
|
1815
|
+
currentIdentity,
|
|
1816
|
+
proof
|
|
1817
|
+
}: {
|
|
1818
|
+
currentIdentity?: {
|
|
1819
|
+
patchId: string;
|
|
1820
|
+
mergeBaseSha?: string;
|
|
1821
|
+
};
|
|
1822
|
+
proof?: PrVerifyProof;
|
|
1823
|
+
}) => boolean;
|
|
1824
|
+
declare const prVerifyFullHeadShasForDiff: ({
|
|
1825
|
+
docsOnlyDeltaAcceptedSince,
|
|
1826
|
+
files,
|
|
1827
|
+
proof
|
|
1828
|
+
}: {
|
|
1829
|
+
docsOnlyDeltaAcceptedSince?: (baselineHeadSha: string) => boolean;
|
|
1830
|
+
files: string[];
|
|
1831
|
+
proof: PrVerifyProof;
|
|
1832
|
+
}) => string[];
|
|
1833
|
+
type VerificationProofState = {
|
|
1834
|
+
kind: "typed-aborted";
|
|
1835
|
+
proof: PrVerifyProof;
|
|
1836
|
+
} | {
|
|
1837
|
+
kind: "typed-missing";
|
|
1838
|
+
path: string;
|
|
1839
|
+
reason: "enoent" | "invalid";
|
|
1840
|
+
message?: string;
|
|
1841
|
+
} | {
|
|
1842
|
+
kind: "typed";
|
|
1843
|
+
headShas: VerifiedHeadShas;
|
|
1844
|
+
proof: PrVerifyProof;
|
|
1845
|
+
} | {
|
|
1846
|
+
kind: "typed-diff-mismatch";
|
|
1847
|
+
mode: ResolvedPrVerifyMode;
|
|
1848
|
+
};
|
|
1849
|
+
declare const verificationProofStateFor: ({
|
|
1850
|
+
proof,
|
|
1851
|
+
proofMatchesCurrentDiff,
|
|
1852
|
+
proofPath
|
|
1853
|
+
}: {
|
|
1854
|
+
proof?: PrVerifyProof;
|
|
1855
|
+
proofMatchesCurrentDiff?: boolean;
|
|
1856
|
+
proofPath?: string;
|
|
1857
|
+
}) => VerificationProofState;
|
|
1858
|
+
declare const verificationProofApplicabilityFor: ({
|
|
1859
|
+
docsOnlyDeltaAcceptedSince,
|
|
1860
|
+
explicitProof,
|
|
1861
|
+
files,
|
|
1862
|
+
headSha,
|
|
1863
|
+
currentIdentity,
|
|
1864
|
+
proof,
|
|
1865
|
+
proofPath,
|
|
1866
|
+
proofReadError
|
|
1867
|
+
}: {
|
|
1868
|
+
docsOnlyDeltaAcceptedSince?: (baselineHeadSha: string) => boolean;
|
|
1869
|
+
explicitProof: boolean;
|
|
1870
|
+
files: string[];
|
|
1871
|
+
headSha: string;
|
|
1872
|
+
currentIdentity?: {
|
|
1873
|
+
patchId: string;
|
|
1874
|
+
mergeBaseSha?: string;
|
|
1875
|
+
};
|
|
1876
|
+
proof?: PrVerifyProof;
|
|
1877
|
+
proofPath?: string;
|
|
1878
|
+
proofReadError?: unknown;
|
|
1879
|
+
}) => {
|
|
1880
|
+
fullVerifiedHeadShas: never[];
|
|
1881
|
+
verificationProof: VerificationProofState;
|
|
1882
|
+
} | {
|
|
1883
|
+
fullVerifiedHeadShas: string[];
|
|
1884
|
+
verificationProof: {
|
|
1885
|
+
headShas: VerifiedHeadShas;
|
|
1886
|
+
kind: "typed";
|
|
1887
|
+
proof: PrVerifyProof;
|
|
1888
|
+
};
|
|
1889
|
+
};
|
|
1890
|
+
declare const resolveVerifyProofApplicability: ({
|
|
1891
|
+
proofPath,
|
|
1892
|
+
explicitProof,
|
|
1893
|
+
docsOnlyDeltaAcceptedSince,
|
|
1894
|
+
files,
|
|
1895
|
+
headSha,
|
|
1896
|
+
currentVerifyIdentityForBase,
|
|
1897
|
+
preread
|
|
1898
|
+
}: {
|
|
1899
|
+
proofPath: string;
|
|
1900
|
+
explicitProof: boolean;
|
|
1901
|
+
docsOnlyDeltaAcceptedSince?: (baselineHeadSha: string) => boolean;
|
|
1902
|
+
files: string[];
|
|
1903
|
+
headSha: string;
|
|
1904
|
+
currentVerifyIdentityForBase?: (base: string) => {
|
|
1905
|
+
patchId: string;
|
|
1906
|
+
mergeBaseSha?: string;
|
|
1907
|
+
};
|
|
1908
|
+
preread?: {
|
|
1909
|
+
proof?: PrVerifyProof;
|
|
1910
|
+
error?: unknown;
|
|
1911
|
+
};
|
|
1912
|
+
}) => {
|
|
1913
|
+
fullVerifiedHeadShas: never[];
|
|
1914
|
+
verificationProof: VerificationProofState;
|
|
1915
|
+
} | {
|
|
1916
|
+
fullVerifiedHeadShas: string[];
|
|
1917
|
+
verificationProof: {
|
|
1918
|
+
headShas: VerifiedHeadShas;
|
|
1919
|
+
kind: "typed";
|
|
1920
|
+
proof: PrVerifyProof;
|
|
1921
|
+
};
|
|
1922
|
+
};
|
|
1923
|
+
declare const verificationProofForReadiness: (state: VerificationProofState) => VerificationHeadShas;
|
|
1924
|
+
declare const verificationProofBlockingReason: (state: VerificationProofState) => string | undefined;
|
|
1925
|
+
//#endregion
|
|
1926
|
+
//#region src/schemas.d.ts
|
|
1927
|
+
declare const boundaryCheckProofSchema: z.ZodObject<{
|
|
1928
|
+
blockingReasons: z.ZodArray<z.ZodString>;
|
|
1929
|
+
boundary: z.ZodOptional<z.ZodString>;
|
|
1930
|
+
command: z.ZodLiteral<"patronage-factory boundary:check">;
|
|
1931
|
+
coveredSet: z.ZodArray<z.ZodObject<{
|
|
1932
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
1933
|
+
pr: z.ZodNumber;
|
|
1934
|
+
sha: z.ZodString;
|
|
1935
|
+
state: z.ZodEnum<{
|
|
1936
|
+
open: "open";
|
|
1937
|
+
merged: "merged";
|
|
1938
|
+
}>;
|
|
1939
|
+
wave: z.ZodString;
|
|
1940
|
+
}, z.core.$strip>>;
|
|
1941
|
+
demandedRung: z.ZodOptional<z.ZodEnum<{
|
|
1942
|
+
oracle: "oracle";
|
|
1943
|
+
"independent-model": "independent-model";
|
|
1944
|
+
human: "human";
|
|
1945
|
+
}>>;
|
|
1946
|
+
epicIssue: z.ZodNumber;
|
|
1947
|
+
manifestHash: z.ZodOptional<z.ZodObject<{
|
|
1948
|
+
algo: z.ZodLiteral<"sha256">;
|
|
1949
|
+
value: z.ZodString;
|
|
1950
|
+
}, z.core.$strip>>;
|
|
1951
|
+
notices: z.ZodArray<z.ZodString>;
|
|
1952
|
+
repo: z.ZodString;
|
|
1953
|
+
reviewProof: z.ZodOptional<z.ZodObject<{
|
|
1954
|
+
commentId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
1955
|
+
commentUrl: z.ZodOptional<z.ZodString>;
|
|
1956
|
+
producer: z.ZodString;
|
|
1957
|
+
rung: z.ZodEnum<{
|
|
1958
|
+
oracle: "oracle";
|
|
1959
|
+
"independent-model": "independent-model";
|
|
1960
|
+
human: "human";
|
|
1961
|
+
}>;
|
|
1962
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
1963
|
+
specHash: z.ZodOptional<z.ZodObject<{
|
|
1964
|
+
algo: z.ZodLiteral<"sha256">;
|
|
1965
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
1966
|
+
value: z.ZodString;
|
|
1967
|
+
}, z.core.$loose>>;
|
|
1968
|
+
}, z.core.$strip>>;
|
|
1969
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
1970
|
+
specHash: z.ZodOptional<z.ZodObject<{
|
|
1971
|
+
algo: z.ZodLiteral<"sha256">;
|
|
1972
|
+
value: z.ZodString;
|
|
1973
|
+
}, z.core.$strip>>;
|
|
1974
|
+
status: z.ZodEnum<{
|
|
1975
|
+
blocked: "blocked";
|
|
1976
|
+
ready: "ready";
|
|
1977
|
+
}>;
|
|
1978
|
+
}, z.core.$strip>;
|
|
1979
|
+
type BoundaryCheckProofRecord = z.infer<typeof boundaryCheckProofSchema>;
|
|
1980
|
+
//#endregion
|
|
1981
|
+
//#region src/boundary-check.d.ts
|
|
1982
|
+
interface BoundaryPullRequestRef {
|
|
1983
|
+
headRefOid?: string;
|
|
1984
|
+
mergeCommitOid?: string;
|
|
1985
|
+
number: number;
|
|
1986
|
+
state: "OPEN" | "CLOSED" | "MERGED";
|
|
1987
|
+
}
|
|
1988
|
+
interface BoundaryCheckGithub {
|
|
1989
|
+
fetchIssueBody: (repo: string, issue: number) => string;
|
|
1990
|
+
fetchIssueComments: (repo: string, issue: number) => GithubIssueComment[];
|
|
1991
|
+
fetchClosingPullRequests: (repo: string, issue: number) => BoundaryPullRequestRef[];
|
|
1992
|
+
fetchPullRequest: (repo: string, pr: number) => BoundaryPullRequestRef;
|
|
1993
|
+
}
|
|
1994
|
+
interface BoundaryCheckArgs {
|
|
1995
|
+
cwd?: string;
|
|
1996
|
+
epic: number;
|
|
1997
|
+
json?: boolean;
|
|
1998
|
+
output?: string;
|
|
1999
|
+
repo?: string;
|
|
2000
|
+
}
|
|
2001
|
+
interface BoundaryCheckDependencies {
|
|
2002
|
+
github?: BoundaryCheckGithub;
|
|
2003
|
+
hq?: HqIngestDependencies;
|
|
2004
|
+
resolveRepo?: (cwd: string) => string;
|
|
2005
|
+
}
|
|
2006
|
+
declare function runBoundaryCheck(args: BoundaryCheckArgs, dependencies?: BoundaryCheckDependencies): BoundaryCheckProofRecord;
|
|
2007
|
+
declare function validateBoundaryCheckProof(value: unknown): BoundaryCheckProofRecord;
|
|
2008
|
+
//#endregion
|
|
2009
|
+
//#region src/commands/doctor.d.ts
|
|
2010
|
+
interface CliOutput {
|
|
2011
|
+
stderr: Pick<NodeJS.WriteStream, "write">;
|
|
2012
|
+
stdout: Pick<NodeJS.WriteStream, "write">;
|
|
2013
|
+
}
|
|
2014
|
+
//#endregion
|
|
2015
|
+
//#region src/commands/boundary-check.d.ts
|
|
2016
|
+
type BoundaryCheckAction = (args: BoundaryCheckArgs) => BoundaryCheckProofRecord;
|
|
2017
|
+
//#endregion
|
|
2018
|
+
//#region src/workspace-install-resolution.d.ts
|
|
2019
|
+
interface CleanInstallResolutionDependencies {
|
|
2020
|
+
existsSync?: typeof existsSync;
|
|
2021
|
+
readFileSync?: typeof readFileSync;
|
|
2022
|
+
rmSync?: typeof rmSync;
|
|
2023
|
+
runInstall?: (repoRoot: string) => void;
|
|
2024
|
+
}
|
|
2025
|
+
//#endregion
|
|
2026
|
+
//#region src/pr-verify.d.ts
|
|
2027
|
+
type PrVerifyMode = "auto" | "docs-only" | "trivial" | "full";
|
|
2028
|
+
interface VerificationCommandOutcome {
|
|
2029
|
+
counts?: {
|
|
2030
|
+
testFiles?: number;
|
|
2031
|
+
tests?: number;
|
|
2032
|
+
};
|
|
2033
|
+
durationMs: number;
|
|
2034
|
+
exitCode: number;
|
|
2035
|
+
}
|
|
2036
|
+
interface PrVerifyArgs extends LoadProjectProfileInput {
|
|
2037
|
+
authoringSession?: string;
|
|
2038
|
+
base: string;
|
|
2039
|
+
mode: PrVerifyMode;
|
|
2040
|
+
output?: string;
|
|
2041
|
+
requireKnownAuthoringSession?: boolean;
|
|
2042
|
+
}
|
|
2043
|
+
interface PrVerifyGitDependencies {
|
|
2044
|
+
changedFiles: (cwd: string, base: string) => string[];
|
|
2045
|
+
currentHeadSha: (cwd: string) => string;
|
|
2046
|
+
emptyTreeHash: (cwd: string) => string;
|
|
2047
|
+
mergeBaseSha: (cwd: string, base: string) => string;
|
|
2048
|
+
runVerificationCommand: (command: string, cwd: string, env: Record<string, string>) => VerificationCommandOutcome;
|
|
2049
|
+
statusPorcelain: (cwd: string) => string;
|
|
2050
|
+
stablePatchId: (cwd: string, base: string) => string;
|
|
2051
|
+
}
|
|
2052
|
+
interface PrVerifyDependencies {
|
|
2053
|
+
cleanInstall?: CleanInstallResolutionDependencies | false;
|
|
2054
|
+
env?: NodeJS.ProcessEnv;
|
|
2055
|
+
git?: PrVerifyGitDependencies;
|
|
2056
|
+
hq?: HqIngestDependencies;
|
|
2057
|
+
postCommitStatus?: PostCommitStatus;
|
|
2058
|
+
publishCheckRun?: (input: PublishFactoryCheckInput) => void;
|
|
2059
|
+
}
|
|
2060
|
+
declare function runPrVerify(args: PrVerifyArgs, dependencies?: PrVerifyDependencies): PrVerifyProof;
|
|
2061
|
+
//#endregion
|
|
2062
|
+
//#region src/canary-verify.d.ts
|
|
2063
|
+
interface CanaryVerifyArgs extends LoadProjectProfileInput {
|
|
2064
|
+
/** Lift an active merge freeze without running verification. */
|
|
2065
|
+
clear?: boolean;
|
|
2066
|
+
output?: string;
|
|
2067
|
+
/** Required with --clear; recorded on the canary proof. */
|
|
2068
|
+
rationale?: string;
|
|
2069
|
+
}
|
|
2070
|
+
//#endregion
|
|
2071
|
+
//#region src/commands/canary-verify.d.ts
|
|
2072
|
+
type CanaryVerifyAction = (args: CanaryVerifyArgs) => Promise<unknown> | unknown;
|
|
2073
|
+
//#endregion
|
|
2074
|
+
//#region src/commands/pr-merge-check.d.ts
|
|
2075
|
+
type PrMergeCheckAction = (args: PrMergeCheckArgs) => PrMergeCheckProof;
|
|
2076
|
+
//#endregion
|
|
2077
|
+
//#region src/pr-review.d.ts
|
|
2078
|
+
interface PrReviewArgs extends LoadProjectProfileInput {
|
|
2079
|
+
base: string;
|
|
2080
|
+
cycle: number;
|
|
2081
|
+
dispositions?: string;
|
|
2082
|
+
findings?: string;
|
|
2083
|
+
issue?: number;
|
|
2084
|
+
maxCycles?: number;
|
|
2085
|
+
mode: PrReviewMode;
|
|
2086
|
+
output?: string;
|
|
2087
|
+
verifyProof?: string;
|
|
2088
|
+
}
|
|
2089
|
+
interface PrReviewGitDependencies {
|
|
2090
|
+
changedFiles: (cwd: string, base: string) => string[];
|
|
2091
|
+
currentHeadSha: (cwd: string) => string;
|
|
2092
|
+
isAncestor: (cwd: string, ancestor: string, descendant: string) => boolean;
|
|
2093
|
+
stablePatchId: (cwd: string, base: string) => string;
|
|
2094
|
+
statusPorcelain: (cwd: string) => string;
|
|
2095
|
+
}
|
|
2096
|
+
interface PrReviewDependencies {
|
|
2097
|
+
git?: PrReviewGitDependencies;
|
|
2098
|
+
hq?: HqIngestDependencies;
|
|
2099
|
+
publishCheckRun?: (input: PublishFactoryCheckInput) => void;
|
|
2100
|
+
}
|
|
2101
|
+
declare function runPrReview(args: PrReviewArgs, dependencies?: PrReviewDependencies): Promise<PrReviewProof>;
|
|
2102
|
+
//#endregion
|
|
2103
|
+
//#region src/pr-publish.d.ts
|
|
2104
|
+
type PrPublishArgs = Omit<PrReadyArgs, "pr" | "throwWhenBlocked"> & {
|
|
2105
|
+
/** A clean-session findings file to validate into the review proof. */findings?: string;
|
|
2106
|
+
pr?: number;
|
|
2107
|
+
};
|
|
2108
|
+
type GhRunner = (args: string[], cwd: string) => string;
|
|
2109
|
+
type FollowUpRunner = (followUp: FollowUpAction, cwd: string) => Promise<void> | void;
|
|
2110
|
+
interface PrPublishHandoff {
|
|
2111
|
+
humanActions: string[];
|
|
2112
|
+
routeOwnedRepairs: ReadinessRepair[];
|
|
2113
|
+
status: PrReadyProof["status"];
|
|
2114
|
+
}
|
|
2115
|
+
type PrPublishFollowUpOutcome = {
|
|
2116
|
+
status: "not-requested";
|
|
2117
|
+
} | {
|
|
2118
|
+
action: FollowUpAction;
|
|
2119
|
+
reason: string;
|
|
2120
|
+
status: "succeeded";
|
|
2121
|
+
} | {
|
|
2122
|
+
action: FollowUpAction;
|
|
2123
|
+
error: string;
|
|
2124
|
+
status: "failed";
|
|
2125
|
+
}
|
|
2126
|
+
/**
|
|
2127
|
+
* The planner declined to run the follow-up because it cannot change the
|
|
2128
|
+
* condition that produced it (#291). `reason` is the one-line causal
|
|
2129
|
+
* statement; a skip is a decision, never a silent omission.
|
|
2130
|
+
*/
|
|
2131
|
+
| {
|
|
2132
|
+
action: FollowUpAction;
|
|
2133
|
+
reason: string;
|
|
2134
|
+
status: "skipped";
|
|
2135
|
+
};
|
|
2136
|
+
interface PrPublishResult {
|
|
2137
|
+
bodyPatched: boolean;
|
|
2138
|
+
followUp: PrPublishFollowUpOutcome;
|
|
2139
|
+
handoff: PrPublishHandoff;
|
|
2140
|
+
proof: PrReadyProof;
|
|
2141
|
+
/**
|
|
2142
|
+
* Whether publish reused the on-disk `pr:verify` proof or ran verification,
|
|
2143
|
+
* and why (#291). Always populated from this version on; optional so adding
|
|
2144
|
+
* it stays an additive change to the published result contract.
|
|
2145
|
+
*/
|
|
2146
|
+
verificationReuse?: VerificationReuse;
|
|
2147
|
+
/**
|
|
2148
|
+
* Whether the durable pr:verify check-run binding landed for this head (#247).
|
|
2149
|
+
* Always populated from this version on; optional so adding it stays an
|
|
2150
|
+
* additive change to the published result contract.
|
|
2151
|
+
*/
|
|
2152
|
+
verifyProofBinding?: VerifyProofBindingOutcome;
|
|
2153
|
+
}
|
|
2154
|
+
declare class PrPublishFollowUpError extends Error {
|
|
2155
|
+
readonly result: PrPublishResult;
|
|
2156
|
+
constructor(result: PrPublishResult, cause: unknown);
|
|
2157
|
+
}
|
|
2158
|
+
interface PrPublishDependencies extends PrReadyDependencies {
|
|
2159
|
+
currentBranch?: (cwd: string) => string | undefined;
|
|
2160
|
+
/**
|
|
2161
|
+
* Awaited republish of the `pr:verify` check run once the head SHA is on
|
|
2162
|
+
* GitHub (#247). Returns whether the App-owned check run landed.
|
|
2163
|
+
*/
|
|
2164
|
+
ensureVerifyCheckRun?: typeof ensureFactoryCheckRunPublished;
|
|
2165
|
+
factoryCliInvocation?: FactoryCliInvocation;
|
|
2166
|
+
gh?: GhRunner;
|
|
2167
|
+
github?: PrReadyDependencies["github"] & {
|
|
2168
|
+
editPullRequestBody?: (input: {
|
|
2169
|
+
body: string;
|
|
2170
|
+
owner: string;
|
|
2171
|
+
repo: string;
|
|
2172
|
+
pr: number;
|
|
2173
|
+
}) => void;
|
|
2174
|
+
};
|
|
2175
|
+
runFollowUp?: FollowUpRunner;
|
|
2176
|
+
runPrReady?: typeof runPrReady;
|
|
2177
|
+
runPrReview?: (args: PrReviewArgs) => Promise<PrReviewProof>;
|
|
2178
|
+
runPrVerify?: (args: PrVerifyArgs) => Promise<PrVerifyProof>;
|
|
2179
|
+
}
|
|
2180
|
+
/**
|
|
2181
|
+
* What became of the durable `pr:verify` binding for this publish. Reported in
|
|
2182
|
+
* the publish summary: a binding that silently failed to land is
|
|
2183
|
+
* indistinguishable from verification that never happened, and the operator is
|
|
2184
|
+
* the only one who can fix the cause (usually an unpushed head).
|
|
2185
|
+
*/
|
|
2186
|
+
type VerifyProofBindingOutcome = {
|
|
2187
|
+
status: "not-attempted";
|
|
2188
|
+
} | {
|
|
2189
|
+
headSha: string;
|
|
2190
|
+
status: "failed" | "published" | "skipped-relabelled-head";
|
|
2191
|
+
};
|
|
2192
|
+
/**
|
|
2193
|
+
* Whether publish reused the on-disk `pr:verify` proof, and the one-line reason
|
|
2194
|
+
* (#291). Publish decides reuse silently today, which is what made the
|
|
2195
|
+
* redundant follow-up rerun in paitronage#1043 impossible to attribute without
|
|
2196
|
+
* a second investigation pass. Every publish states this decision.
|
|
2197
|
+
*/
|
|
2198
|
+
interface VerificationReuse {
|
|
2199
|
+
reason: string;
|
|
2200
|
+
reused: boolean;
|
|
2201
|
+
}
|
|
2202
|
+
/**
|
|
2203
|
+
* Whether publish runs the follow-up `pr:ready` recommended, plus the one-line
|
|
2204
|
+
* reason either way (#291).
|
|
2205
|
+
*/
|
|
2206
|
+
type PublishFollowUpPlan = {
|
|
2207
|
+
kind: "run";
|
|
2208
|
+
reason: string;
|
|
2209
|
+
} | {
|
|
2210
|
+
kind: "skip";
|
|
2211
|
+
reason: string;
|
|
2212
|
+
};
|
|
2213
|
+
/**
|
|
2214
|
+
* Decide whether a `pr:ready` follow-up is worth running (#291).
|
|
2215
|
+
*
|
|
2216
|
+
* `pr:ready` recommends a verification rerun as its generic answer to a blocked
|
|
2217
|
+
* candidate, including when the blocker is red hosted required checks. That
|
|
2218
|
+
* rerun is unusable by construction when (a) verify-once applicability already
|
|
2219
|
+
* accepted an exact-head passing proof for this candidate — so the rerun would
|
|
2220
|
+
* repeat work the proof covers — and (b) the durable check-run binding did not
|
|
2221
|
+
* land, most commonly because no factory GitHub App is configured, so the
|
|
2222
|
+
* rerun's result has nowhere to go and cannot move the hosted check state that
|
|
2223
|
+
* triggered the follow-up. That was ~100 seconds of unusable work on
|
|
2224
|
+
* paitronage#1043 while the real blocker went untouched.
|
|
2225
|
+
*
|
|
2226
|
+
* Applicability is not re-decided here: `proofHeadSha`/`verifiedHeadSha` come
|
|
2227
|
+
* from {@link ensureVerifyProof}, which routes through the single shared
|
|
2228
|
+
* verify-once entry point (#692 / ADR 0016). Equal SHAs mean the proof was
|
|
2229
|
+
* accepted for this exact head rather than relabelled onto it.
|
|
2230
|
+
*/
|
|
2231
|
+
declare const planPublishFollowUp: ({
|
|
2232
|
+
binding,
|
|
2233
|
+
followUp,
|
|
2234
|
+
proofHeadSha,
|
|
2235
|
+
verifiedHeadSha
|
|
2236
|
+
}: {
|
|
2237
|
+
binding: VerifyProofBindingOutcome;
|
|
2238
|
+
followUp: FollowUpAction;
|
|
2239
|
+
proofHeadSha: string;
|
|
2240
|
+
verifiedHeadSha: string;
|
|
2241
|
+
}) => PublishFollowUpPlan;
|
|
2242
|
+
declare function runPrPublish(args: PrPublishArgs, dependencies?: PrPublishDependencies): Promise<PrPublishResult>;
|
|
2243
|
+
//#endregion
|
|
2244
|
+
//#region src/commands/pr-publish.d.ts
|
|
2245
|
+
type PrPublishAction = (args: PrPublishArgs) => Promise<unknown>;
|
|
2246
|
+
//#endregion
|
|
2247
|
+
//#region src/commands/pr-ready.d.ts
|
|
2248
|
+
type PrReadyAction = (args: PrReadyArgs) => Promise<unknown>;
|
|
2249
|
+
//#endregion
|
|
2250
|
+
//#region src/commands/pr-review.d.ts
|
|
2251
|
+
type PrReviewAction = (args: PrReviewArgs) => Promise<unknown>;
|
|
2252
|
+
//#endregion
|
|
2253
|
+
//#region src/packages/trace/implementation/core.d.ts
|
|
2254
|
+
declare const FactoryTraceEnvelopeCoreSchema: z.ZodObject<{
|
|
2255
|
+
createdAt: z.ZodString;
|
|
2256
|
+
envelope: z.ZodLiteral<1>;
|
|
2257
|
+
eventId: z.ZodString;
|
|
2258
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
2259
|
+
payload: z.ZodUnknown;
|
|
2260
|
+
pr: z.ZodOptional<z.ZodNumber>;
|
|
2261
|
+
repo: z.ZodString;
|
|
2262
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
2263
|
+
type: z.ZodString;
|
|
2264
|
+
typeVersion: z.ZodNumber;
|
|
2265
|
+
worker: z.ZodOptional<z.ZodString>;
|
|
2266
|
+
}, z.core.$strict>;
|
|
2267
|
+
declare const UnknownFactoryTraceEventSchema: z.ZodObject<{
|
|
2268
|
+
createdAt: z.ZodString;
|
|
2269
|
+
eventId: z.ZodString;
|
|
2270
|
+
eventType: z.ZodString;
|
|
2271
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
2272
|
+
observedAt: z.ZodString;
|
|
2273
|
+
pr: z.ZodOptional<z.ZodNumber>;
|
|
2274
|
+
repo: z.ZodString;
|
|
2275
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
2276
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
2277
|
+
workerId: z.ZodOptional<z.ZodString>;
|
|
2278
|
+
typeVersion: z.ZodNumber;
|
|
2279
|
+
payload: z.ZodUnknown;
|
|
2280
|
+
unknownTraceEvent: z.ZodLiteral<true>;
|
|
2281
|
+
}, z.core.$strict>;
|
|
2282
|
+
//#endregion
|
|
2283
|
+
//#region src/packages/trace/implementation/worker-closeout-lessons.d.ts
|
|
2284
|
+
declare const WorkerCloseoutLessonsTraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2285
|
+
createdAt: z.ZodString;
|
|
2286
|
+
eventId: z.ZodString;
|
|
2287
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
2288
|
+
observedAt: z.ZodString;
|
|
2289
|
+
pr: z.ZodOptional<z.ZodNumber>;
|
|
2290
|
+
repo: z.ZodString;
|
|
2291
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
2292
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
2293
|
+
workerId: z.ZodOptional<z.ZodString>;
|
|
2294
|
+
eventType: z.ZodLiteral<"worker-closeout-lessons">;
|
|
2295
|
+
lessonStatus: z.ZodLiteral<"captured">;
|
|
2296
|
+
lessons: z.ZodString;
|
|
2297
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
2298
|
+
typeVersion: z.ZodLiteral<1>;
|
|
2299
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2300
|
+
createdAt: z.ZodString;
|
|
2301
|
+
eventId: z.ZodString;
|
|
2302
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
2303
|
+
observedAt: z.ZodString;
|
|
2304
|
+
pr: z.ZodOptional<z.ZodNumber>;
|
|
2305
|
+
repo: z.ZodString;
|
|
2306
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
2307
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
2308
|
+
workerId: z.ZodOptional<z.ZodString>;
|
|
2309
|
+
eventType: z.ZodLiteral<"worker-closeout-lessons">;
|
|
2310
|
+
lessonStatus: z.ZodLiteral<"unavailable">;
|
|
2311
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
2312
|
+
typeVersion: z.ZodLiteral<1>;
|
|
2313
|
+
unavailableReason: z.ZodString;
|
|
2314
|
+
}, z.core.$strict>], "lessonStatus">;
|
|
2315
|
+
declare const LegacyWorkerCloseoutStatusTraceEventSchema: z.ZodObject<{
|
|
2316
|
+
createdAt: z.ZodString;
|
|
2317
|
+
eventId: z.ZodString;
|
|
2318
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
2319
|
+
observedAt: z.ZodString;
|
|
2320
|
+
pr: z.ZodOptional<z.ZodNumber>;
|
|
2321
|
+
repo: z.ZodString;
|
|
2322
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
2323
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
2324
|
+
workerId: z.ZodOptional<z.ZodString>;
|
|
2325
|
+
archiveStatus: z.ZodOptional<z.ZodEnum<{
|
|
2326
|
+
unavailable: "unavailable";
|
|
2327
|
+
archived: "archived";
|
|
2328
|
+
skipped: "skipped";
|
|
2329
|
+
"not-applicable": "not-applicable";
|
|
2330
|
+
pending: "pending";
|
|
2331
|
+
}>>;
|
|
2332
|
+
closeoutReason: z.ZodOptional<z.ZodString>;
|
|
2333
|
+
eventType: z.ZodLiteral<"worker-closeout-lessons">;
|
|
2334
|
+
lessonStatus: z.ZodOptional<z.ZodEnum<{
|
|
2335
|
+
captured: "captured";
|
|
2336
|
+
unavailable: "unavailable";
|
|
2337
|
+
skipped: "skipped";
|
|
2338
|
+
}>>;
|
|
2339
|
+
lessonSummary: z.ZodOptional<z.ZodString>;
|
|
2340
|
+
typeVersion: z.ZodLiteral<2>;
|
|
2341
|
+
}, z.core.$strict>;
|
|
2342
|
+
declare const LegacyWorkerCloseoutLessonsTraceEventSchema: z.ZodObject<{
|
|
2343
|
+
createdAt: z.ZodString;
|
|
2344
|
+
eventId: z.ZodString;
|
|
2345
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
2346
|
+
observedAt: z.ZodString;
|
|
2347
|
+
pr: z.ZodOptional<z.ZodNumber>;
|
|
2348
|
+
repo: z.ZodString;
|
|
2349
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
2350
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
2351
|
+
workerId: z.ZodOptional<z.ZodString>;
|
|
2352
|
+
eventType: z.ZodLiteral<"worker-closeout-lessons">;
|
|
2353
|
+
typeVersion: z.ZodLiteral<3>;
|
|
2354
|
+
}, z.core.$strict>;
|
|
2355
|
+
//#endregion
|
|
2356
|
+
//#region src/packages/trace/implementation/definitions.d.ts
|
|
2357
|
+
type InferSchema<TSchema> = TSchema extends z.ZodType ? z.infer<TSchema> : never;
|
|
2358
|
+
type ReadEventSchemasOf<TDefinition> = TDefinition extends {
|
|
2359
|
+
readEventSchemas: readonly (infer TSchema)[];
|
|
2360
|
+
} ? TSchema extends z.ZodType ? InferSchema<TSchema> : never : never;
|
|
2361
|
+
type FactoryTraceEventFromDefinitions<TDefinitions extends readonly TraceEventDefinition[]> = ReadEventSchemasOf<TDefinitions[number]>;
|
|
2362
|
+
interface TraceEventDefinition {
|
|
2363
|
+
appendEventSchema: z.ZodType;
|
|
2364
|
+
emit: (event: never) => unknown;
|
|
2365
|
+
kind: string;
|
|
2366
|
+
payloadVersions: Record<number, z.ZodType>;
|
|
2367
|
+
readEventSchemas: readonly z.ZodType[];
|
|
2368
|
+
}
|
|
2369
|
+
interface DefinedTraceEvent<TKind extends string = string, TAppendSchema extends z.ZodType = z.ZodType, TReadSchemas extends readonly z.ZodType[] = readonly z.ZodType[], TPayloadVersions extends Record<number, z.ZodType> = Record<number, z.ZodType>, TEmitEvent = z.infer<TAppendSchema>> {
|
|
2370
|
+
appendEventSchema: TAppendSchema;
|
|
2371
|
+
emit: (event: TEmitEvent) => unknown;
|
|
2372
|
+
kind: TKind;
|
|
2373
|
+
payloadVersions: TPayloadVersions;
|
|
2374
|
+
readEventSchemas: TReadSchemas;
|
|
2375
|
+
}
|
|
2376
|
+
type WorkerCloseoutTraceEvent = z.infer<typeof WorkerCloseoutLessonsTraceEventSchema> | z.infer<typeof LegacyWorkerCloseoutStatusTraceEventSchema> | z.infer<typeof LegacyWorkerCloseoutLessonsTraceEventSchema>;
|
|
2377
|
+
declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"review-gate", z.ZodObject<{
|
|
2378
|
+
createdAt: z.ZodString;
|
|
2379
|
+
eventId: z.ZodString;
|
|
2380
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
2381
|
+
pr: z.ZodOptional<z.ZodNumber>;
|
|
2382
|
+
repo: z.ZodString;
|
|
2383
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
2384
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
2385
|
+
workerId: z.ZodOptional<z.ZodString>;
|
|
2386
|
+
eventType: z.ZodLiteral<"review-gate">;
|
|
2387
|
+
typeVersion: z.ZodLiteral<1>;
|
|
2388
|
+
base: z.ZodString;
|
|
2389
|
+
changedFiles: z.ZodArray<z.ZodString>;
|
|
2390
|
+
headSha: z.ZodString;
|
|
2391
|
+
maxReviewCycles: z.ZodNumber;
|
|
2392
|
+
observedAt: z.ZodString;
|
|
2393
|
+
outcome: z.ZodLiteral<"not-required">;
|
|
2394
|
+
patchId: z.ZodString;
|
|
2395
|
+
reason: z.ZodLiteral<"docs-only-profile-bypass">;
|
|
2396
|
+
reviewCycle: z.ZodNumber;
|
|
2397
|
+
}, z.core.$strict>, readonly [z.ZodObject<{
|
|
2398
|
+
createdAt: z.ZodString;
|
|
2399
|
+
eventId: z.ZodString;
|
|
2400
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
2401
|
+
pr: z.ZodOptional<z.ZodNumber>;
|
|
2402
|
+
repo: z.ZodString;
|
|
2403
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
2404
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
2405
|
+
workerId: z.ZodOptional<z.ZodString>;
|
|
2406
|
+
eventType: z.ZodLiteral<"review-gate">;
|
|
2407
|
+
typeVersion: z.ZodLiteral<1>;
|
|
2408
|
+
base: z.ZodString;
|
|
2409
|
+
changedFiles: z.ZodArray<z.ZodString>;
|
|
2410
|
+
headSha: z.ZodString;
|
|
2411
|
+
maxReviewCycles: z.ZodNumber;
|
|
2412
|
+
observedAt: z.ZodString;
|
|
2413
|
+
outcome: z.ZodLiteral<"not-required">;
|
|
2414
|
+
patchId: z.ZodString;
|
|
2415
|
+
reason: z.ZodLiteral<"docs-only-profile-bypass">;
|
|
2416
|
+
reviewCycle: z.ZodNumber;
|
|
2417
|
+
}, z.core.$strict>], {
|
|
2418
|
+
readonly 1: z.ZodObject<{
|
|
2419
|
+
base: z.ZodString;
|
|
2420
|
+
changedFiles: z.ZodArray<z.ZodString>;
|
|
2421
|
+
headSha: z.ZodString;
|
|
2422
|
+
maxReviewCycles: z.ZodNumber;
|
|
2423
|
+
observedAt: z.ZodString;
|
|
2424
|
+
outcome: z.ZodLiteral<"not-required">;
|
|
2425
|
+
patchId: z.ZodString;
|
|
2426
|
+
reason: z.ZodLiteral<"docs-only-profile-bypass">;
|
|
2427
|
+
reviewCycle: z.ZodNumber;
|
|
2428
|
+
}, z.core.$strict>;
|
|
2429
|
+
}, {
|
|
2430
|
+
createdAt: string;
|
|
2431
|
+
eventId: string;
|
|
2432
|
+
repo: string;
|
|
2433
|
+
schemaVersion: 1;
|
|
2434
|
+
eventType: "review-gate";
|
|
2435
|
+
typeVersion: 1;
|
|
2436
|
+
base: string;
|
|
2437
|
+
changedFiles: string[];
|
|
2438
|
+
headSha: string;
|
|
2439
|
+
maxReviewCycles: number;
|
|
2440
|
+
observedAt: string;
|
|
2441
|
+
outcome: "not-required";
|
|
2442
|
+
patchId: string;
|
|
2443
|
+
reason: "docs-only-profile-bypass";
|
|
2444
|
+
reviewCycle: number;
|
|
2445
|
+
issue?: number | undefined;
|
|
2446
|
+
pr?: number | undefined;
|
|
2447
|
+
threadId?: string | undefined;
|
|
2448
|
+
workerId?: string | undefined;
|
|
2449
|
+
}>, DefinedTraceEvent<"review-ladder-stage", z.ZodObject<{
|
|
2450
|
+
createdAt: z.ZodString;
|
|
2451
|
+
eventId: z.ZodString;
|
|
2452
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
2453
|
+
pr: z.ZodOptional<z.ZodNumber>;
|
|
2454
|
+
repo: z.ZodString;
|
|
2455
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
2456
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
2457
|
+
workerId: z.ZodOptional<z.ZodString>;
|
|
2458
|
+
eventType: z.ZodLiteral<"review-ladder-stage">;
|
|
2459
|
+
typeVersion: z.ZodLiteral<1>;
|
|
2460
|
+
cycle: z.ZodNumber;
|
|
2461
|
+
cyclesToClean: z.ZodOptional<z.ZodNumber>;
|
|
2462
|
+
engine: z.ZodOptional<z.ZodString>;
|
|
2463
|
+
findingsSummary: z.ZodObject<{
|
|
2464
|
+
blocking: z.ZodNumber;
|
|
2465
|
+
bySeverity: z.ZodObject<{
|
|
2466
|
+
critical: z.ZodNumber;
|
|
2467
|
+
high: z.ZodNumber;
|
|
2468
|
+
low: z.ZodNumber;
|
|
2469
|
+
medium: z.ZodNumber;
|
|
2470
|
+
unknown: z.ZodNumber;
|
|
2471
|
+
}, z.core.$strict>;
|
|
2472
|
+
flagged: z.ZodNumber;
|
|
2473
|
+
open: z.ZodNumber;
|
|
2474
|
+
staleRepeats: z.ZodNumber;
|
|
2475
|
+
}, z.core.$strict>;
|
|
2476
|
+
forcedTransition: z.ZodOptional<z.ZodEnum<{
|
|
2477
|
+
"gate-cap-exhausted": "gate-cap-exhausted";
|
|
2478
|
+
"interior-cap-reached": "interior-cap-reached";
|
|
2479
|
+
}>>;
|
|
2480
|
+
headSha: z.ZodOptional<z.ZodString>;
|
|
2481
|
+
model: z.ZodOptional<z.ZodString>;
|
|
2482
|
+
observedAt: z.ZodString;
|
|
2483
|
+
patchId: z.ZodOptional<z.ZodString>;
|
|
2484
|
+
session: z.ZodOptional<z.ZodObject<{
|
|
2485
|
+
orchestrationMode: z.ZodOptional<z.ZodEnum<{
|
|
2486
|
+
autonomous: "autonomous";
|
|
2487
|
+
manual: "manual";
|
|
2488
|
+
}>>;
|
|
2489
|
+
resumedSession: z.ZodOptional<z.ZodBoolean>;
|
|
2490
|
+
runtime: z.ZodOptional<z.ZodString>;
|
|
2491
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
2492
|
+
}, z.core.$strict>>;
|
|
2493
|
+
stage: z.ZodEnum<{
|
|
2494
|
+
gate: "gate";
|
|
2495
|
+
interior: "interior";
|
|
2496
|
+
}>;
|
|
2497
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
2498
|
+
estimatedCostUsd: z.ZodOptional<z.ZodNumber>;
|
|
2499
|
+
source: z.ZodOptional<z.ZodString>;
|
|
2500
|
+
totalTokens: z.ZodOptional<z.ZodNumber>;
|
|
2501
|
+
}, z.core.$strict>>;
|
|
2502
|
+
}, z.core.$strict>, readonly [z.ZodObject<{
|
|
2503
|
+
createdAt: z.ZodString;
|
|
2504
|
+
eventId: z.ZodString;
|
|
2505
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
2506
|
+
pr: z.ZodOptional<z.ZodNumber>;
|
|
2507
|
+
repo: z.ZodString;
|
|
2508
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
2509
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
2510
|
+
workerId: z.ZodOptional<z.ZodString>;
|
|
2511
|
+
eventType: z.ZodLiteral<"review-ladder-stage">;
|
|
2512
|
+
typeVersion: z.ZodLiteral<1>;
|
|
2513
|
+
cycle: z.ZodNumber;
|
|
2514
|
+
cyclesToClean: z.ZodOptional<z.ZodNumber>;
|
|
2515
|
+
engine: z.ZodOptional<z.ZodString>;
|
|
2516
|
+
findingsSummary: z.ZodObject<{
|
|
2517
|
+
blocking: z.ZodNumber;
|
|
2518
|
+
bySeverity: z.ZodObject<{
|
|
2519
|
+
critical: z.ZodNumber;
|
|
2520
|
+
high: z.ZodNumber;
|
|
2521
|
+
low: z.ZodNumber;
|
|
2522
|
+
medium: z.ZodNumber;
|
|
2523
|
+
unknown: z.ZodNumber;
|
|
2524
|
+
}, z.core.$strict>;
|
|
2525
|
+
flagged: z.ZodNumber;
|
|
2526
|
+
open: z.ZodNumber;
|
|
2527
|
+
staleRepeats: z.ZodNumber;
|
|
2528
|
+
}, z.core.$strict>;
|
|
2529
|
+
forcedTransition: z.ZodOptional<z.ZodEnum<{
|
|
2530
|
+
"gate-cap-exhausted": "gate-cap-exhausted";
|
|
2531
|
+
"interior-cap-reached": "interior-cap-reached";
|
|
2532
|
+
}>>;
|
|
2533
|
+
headSha: z.ZodOptional<z.ZodString>;
|
|
2534
|
+
model: z.ZodOptional<z.ZodString>;
|
|
2535
|
+
observedAt: z.ZodString;
|
|
2536
|
+
patchId: z.ZodOptional<z.ZodString>;
|
|
2537
|
+
session: z.ZodOptional<z.ZodObject<{
|
|
2538
|
+
orchestrationMode: z.ZodOptional<z.ZodEnum<{
|
|
2539
|
+
autonomous: "autonomous";
|
|
2540
|
+
manual: "manual";
|
|
2541
|
+
}>>;
|
|
2542
|
+
resumedSession: z.ZodOptional<z.ZodBoolean>;
|
|
2543
|
+
runtime: z.ZodOptional<z.ZodString>;
|
|
2544
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
2545
|
+
}, z.core.$strict>>;
|
|
2546
|
+
stage: z.ZodEnum<{
|
|
2547
|
+
gate: "gate";
|
|
2548
|
+
interior: "interior";
|
|
2549
|
+
}>;
|
|
2550
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
2551
|
+
estimatedCostUsd: z.ZodOptional<z.ZodNumber>;
|
|
2552
|
+
source: z.ZodOptional<z.ZodString>;
|
|
2553
|
+
totalTokens: z.ZodOptional<z.ZodNumber>;
|
|
2554
|
+
}, z.core.$strict>>;
|
|
2555
|
+
}, z.core.$strict>], {
|
|
2556
|
+
readonly 1: z.ZodObject<{
|
|
2557
|
+
cycle: z.ZodNumber;
|
|
2558
|
+
cyclesToClean: z.ZodOptional<z.ZodNumber>;
|
|
2559
|
+
engine: z.ZodOptional<z.ZodString>;
|
|
2560
|
+
findingsSummary: z.ZodObject<{
|
|
2561
|
+
blocking: z.ZodNumber;
|
|
2562
|
+
bySeverity: z.ZodObject<{
|
|
2563
|
+
critical: z.ZodNumber;
|
|
2564
|
+
high: z.ZodNumber;
|
|
2565
|
+
low: z.ZodNumber;
|
|
2566
|
+
medium: z.ZodNumber;
|
|
2567
|
+
unknown: z.ZodNumber;
|
|
2568
|
+
}, z.core.$strict>;
|
|
2569
|
+
flagged: z.ZodNumber;
|
|
2570
|
+
open: z.ZodNumber;
|
|
2571
|
+
staleRepeats: z.ZodNumber;
|
|
2572
|
+
}, z.core.$strict>;
|
|
2573
|
+
forcedTransition: z.ZodOptional<z.ZodEnum<{
|
|
2574
|
+
"gate-cap-exhausted": "gate-cap-exhausted";
|
|
2575
|
+
"interior-cap-reached": "interior-cap-reached";
|
|
2576
|
+
}>>;
|
|
2577
|
+
headSha: z.ZodOptional<z.ZodString>;
|
|
2578
|
+
model: z.ZodOptional<z.ZodString>;
|
|
2579
|
+
observedAt: z.ZodString;
|
|
2580
|
+
patchId: z.ZodOptional<z.ZodString>;
|
|
2581
|
+
session: z.ZodOptional<z.ZodObject<{
|
|
2582
|
+
orchestrationMode: z.ZodOptional<z.ZodEnum<{
|
|
2583
|
+
autonomous: "autonomous";
|
|
2584
|
+
manual: "manual";
|
|
2585
|
+
}>>;
|
|
2586
|
+
resumedSession: z.ZodOptional<z.ZodBoolean>;
|
|
2587
|
+
runtime: z.ZodOptional<z.ZodString>;
|
|
2588
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
2589
|
+
}, z.core.$strict>>;
|
|
2590
|
+
stage: z.ZodEnum<{
|
|
2591
|
+
gate: "gate";
|
|
2592
|
+
interior: "interior";
|
|
2593
|
+
}>;
|
|
2594
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
2595
|
+
estimatedCostUsd: z.ZodOptional<z.ZodNumber>;
|
|
2596
|
+
source: z.ZodOptional<z.ZodString>;
|
|
2597
|
+
totalTokens: z.ZodOptional<z.ZodNumber>;
|
|
2598
|
+
}, z.core.$strict>>;
|
|
2599
|
+
}, z.core.$strict>;
|
|
2600
|
+
}, {
|
|
2601
|
+
createdAt: string;
|
|
2602
|
+
eventId: string;
|
|
2603
|
+
repo: string;
|
|
2604
|
+
schemaVersion: 1;
|
|
2605
|
+
eventType: "review-ladder-stage";
|
|
2606
|
+
typeVersion: 1;
|
|
2607
|
+
cycle: number;
|
|
2608
|
+
findingsSummary: {
|
|
2609
|
+
blocking: number;
|
|
2610
|
+
bySeverity: {
|
|
2611
|
+
critical: number;
|
|
2612
|
+
high: number;
|
|
2613
|
+
low: number;
|
|
2614
|
+
medium: number;
|
|
2615
|
+
unknown: number;
|
|
2616
|
+
};
|
|
2617
|
+
flagged: number;
|
|
2618
|
+
open: number;
|
|
2619
|
+
staleRepeats: number;
|
|
2620
|
+
};
|
|
2621
|
+
observedAt: string;
|
|
2622
|
+
stage: "gate" | "interior";
|
|
2623
|
+
issue?: number | undefined;
|
|
2624
|
+
pr?: number | undefined;
|
|
2625
|
+
threadId?: string | undefined;
|
|
2626
|
+
workerId?: string | undefined;
|
|
2627
|
+
cyclesToClean?: number | undefined;
|
|
2628
|
+
engine?: string | undefined;
|
|
2629
|
+
forcedTransition?: "gate-cap-exhausted" | "interior-cap-reached" | undefined;
|
|
2630
|
+
headSha?: string | undefined;
|
|
2631
|
+
model?: string | undefined;
|
|
2632
|
+
patchId?: string | undefined;
|
|
2633
|
+
session?: {
|
|
2634
|
+
orchestrationMode?: "autonomous" | "manual" | undefined;
|
|
2635
|
+
resumedSession?: boolean | undefined;
|
|
2636
|
+
runtime?: string | undefined;
|
|
2637
|
+
sessionId?: string | undefined;
|
|
2638
|
+
} | undefined;
|
|
2639
|
+
usage?: {
|
|
2640
|
+
estimatedCostUsd?: number | undefined;
|
|
2641
|
+
source?: string | undefined;
|
|
2642
|
+
totalTokens?: number | undefined;
|
|
2643
|
+
} | undefined;
|
|
2644
|
+
}>, DefinedTraceEvent<"worker-closeout-lessons", z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2645
|
+
createdAt: z.ZodString;
|
|
2646
|
+
eventId: z.ZodString;
|
|
2647
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
2648
|
+
observedAt: z.ZodString;
|
|
2649
|
+
pr: z.ZodOptional<z.ZodNumber>;
|
|
2650
|
+
repo: z.ZodString;
|
|
2651
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
2652
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
2653
|
+
workerId: z.ZodOptional<z.ZodString>;
|
|
2654
|
+
eventType: z.ZodLiteral<"worker-closeout-lessons">;
|
|
2655
|
+
lessonStatus: z.ZodLiteral<"captured">;
|
|
2656
|
+
lessons: z.ZodString;
|
|
2657
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
2658
|
+
typeVersion: z.ZodLiteral<1>;
|
|
2659
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2660
|
+
createdAt: z.ZodString;
|
|
2661
|
+
eventId: z.ZodString;
|
|
2662
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
2663
|
+
observedAt: z.ZodString;
|
|
2664
|
+
pr: z.ZodOptional<z.ZodNumber>;
|
|
2665
|
+
repo: z.ZodString;
|
|
2666
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
2667
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
2668
|
+
workerId: z.ZodOptional<z.ZodString>;
|
|
2669
|
+
eventType: z.ZodLiteral<"worker-closeout-lessons">;
|
|
2670
|
+
lessonStatus: z.ZodLiteral<"unavailable">;
|
|
2671
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
2672
|
+
typeVersion: z.ZodLiteral<1>;
|
|
2673
|
+
unavailableReason: z.ZodString;
|
|
2674
|
+
}, z.core.$strict>], "lessonStatus">, readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2675
|
+
createdAt: z.ZodString;
|
|
2676
|
+
eventId: z.ZodString;
|
|
2677
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
2678
|
+
observedAt: z.ZodString;
|
|
2679
|
+
pr: z.ZodOptional<z.ZodNumber>;
|
|
2680
|
+
repo: z.ZodString;
|
|
2681
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
2682
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
2683
|
+
workerId: z.ZodOptional<z.ZodString>;
|
|
2684
|
+
eventType: z.ZodLiteral<"worker-closeout-lessons">;
|
|
2685
|
+
lessonStatus: z.ZodLiteral<"captured">;
|
|
2686
|
+
lessons: z.ZodString;
|
|
2687
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
2688
|
+
typeVersion: z.ZodLiteral<1>;
|
|
2689
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2690
|
+
createdAt: z.ZodString;
|
|
2691
|
+
eventId: z.ZodString;
|
|
2692
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
2693
|
+
observedAt: z.ZodString;
|
|
2694
|
+
pr: z.ZodOptional<z.ZodNumber>;
|
|
2695
|
+
repo: z.ZodString;
|
|
2696
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
2697
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
2698
|
+
workerId: z.ZodOptional<z.ZodString>;
|
|
2699
|
+
eventType: z.ZodLiteral<"worker-closeout-lessons">;
|
|
2700
|
+
lessonStatus: z.ZodLiteral<"unavailable">;
|
|
2701
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
2702
|
+
typeVersion: z.ZodLiteral<1>;
|
|
2703
|
+
unavailableReason: z.ZodString;
|
|
2704
|
+
}, z.core.$strict>], "lessonStatus">, z.ZodObject<{
|
|
2705
|
+
createdAt: z.ZodString;
|
|
2706
|
+
eventId: z.ZodString;
|
|
2707
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
2708
|
+
observedAt: z.ZodString;
|
|
2709
|
+
pr: z.ZodOptional<z.ZodNumber>;
|
|
2710
|
+
repo: z.ZodString;
|
|
2711
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
2712
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
2713
|
+
workerId: z.ZodOptional<z.ZodString>;
|
|
2714
|
+
archiveStatus: z.ZodOptional<z.ZodEnum<{
|
|
2715
|
+
unavailable: "unavailable";
|
|
2716
|
+
archived: "archived";
|
|
2717
|
+
skipped: "skipped";
|
|
2718
|
+
"not-applicable": "not-applicable";
|
|
2719
|
+
pending: "pending";
|
|
2720
|
+
}>>;
|
|
2721
|
+
closeoutReason: z.ZodOptional<z.ZodString>;
|
|
2722
|
+
eventType: z.ZodLiteral<"worker-closeout-lessons">;
|
|
2723
|
+
lessonStatus: z.ZodOptional<z.ZodEnum<{
|
|
2724
|
+
captured: "captured";
|
|
2725
|
+
unavailable: "unavailable";
|
|
2726
|
+
skipped: "skipped";
|
|
2727
|
+
}>>;
|
|
2728
|
+
lessonSummary: z.ZodOptional<z.ZodString>;
|
|
2729
|
+
typeVersion: z.ZodLiteral<2>;
|
|
2730
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2731
|
+
createdAt: z.ZodString;
|
|
2732
|
+
eventId: z.ZodString;
|
|
2733
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
2734
|
+
observedAt: z.ZodString;
|
|
2735
|
+
pr: z.ZodOptional<z.ZodNumber>;
|
|
2736
|
+
repo: z.ZodString;
|
|
2737
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
2738
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
2739
|
+
workerId: z.ZodOptional<z.ZodString>;
|
|
2740
|
+
eventType: z.ZodLiteral<"worker-closeout-lessons">;
|
|
2741
|
+
typeVersion: z.ZodLiteral<3>;
|
|
2742
|
+
}, z.core.$strict>], {
|
|
2743
|
+
readonly 1: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2744
|
+
observedAt: z.ZodString;
|
|
2745
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
2746
|
+
lessonStatus: z.ZodLiteral<"captured">;
|
|
2747
|
+
lessons: z.ZodString;
|
|
2748
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2749
|
+
observedAt: z.ZodString;
|
|
2750
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
2751
|
+
lessonStatus: z.ZodLiteral<"unavailable">;
|
|
2752
|
+
unavailableReason: z.ZodString;
|
|
2753
|
+
}, z.core.$strict>], "lessonStatus">;
|
|
2754
|
+
readonly 2: z.ZodObject<{
|
|
2755
|
+
archiveStatus: z.ZodOptional<z.ZodEnum<{
|
|
2756
|
+
unavailable: "unavailable";
|
|
2757
|
+
archived: "archived";
|
|
2758
|
+
skipped: "skipped";
|
|
2759
|
+
"not-applicable": "not-applicable";
|
|
2760
|
+
pending: "pending";
|
|
2761
|
+
}>>;
|
|
2762
|
+
closeoutReason: z.ZodOptional<z.ZodString>;
|
|
2763
|
+
lessonStatus: z.ZodOptional<z.ZodEnum<{
|
|
2764
|
+
captured: "captured";
|
|
2765
|
+
unavailable: "unavailable";
|
|
2766
|
+
skipped: "skipped";
|
|
2767
|
+
}>>;
|
|
2768
|
+
lessonSummary: z.ZodOptional<z.ZodString>;
|
|
2769
|
+
observedAt: z.ZodString;
|
|
2770
|
+
}, z.core.$strict>;
|
|
2771
|
+
readonly 3: z.ZodObject<{
|
|
2772
|
+
observedAt: z.ZodString;
|
|
2773
|
+
}, z.core.$strict>;
|
|
2774
|
+
}, WorkerCloseoutTraceEvent>, DefinedTraceEvent<"orchestrator-session", z.ZodObject<{
|
|
2775
|
+
createdAt: z.ZodString;
|
|
2776
|
+
eventId: z.ZodString;
|
|
2777
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
2778
|
+
pr: z.ZodOptional<z.ZodNumber>;
|
|
2779
|
+
repo: z.ZodString;
|
|
2780
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
2781
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
2782
|
+
workerId: z.ZodOptional<z.ZodString>;
|
|
2783
|
+
eventType: z.ZodLiteral<"orchestrator-session">;
|
|
2784
|
+
typeVersion: z.ZodLiteral<1>;
|
|
2785
|
+
avgContextTokens: z.ZodNumber;
|
|
2786
|
+
cacheReadTokens: z.ZodNumber;
|
|
2787
|
+
cacheWriteTokens: z.ZodNumber;
|
|
2788
|
+
inputTokens: z.ZodNumber;
|
|
2789
|
+
observedAt: z.ZodString;
|
|
2790
|
+
outputTokens: z.ZodNumber;
|
|
2791
|
+
sessionId: z.ZodString;
|
|
2792
|
+
totalTokens: z.ZodNumber;
|
|
2793
|
+
turnCount: z.ZodNumber;
|
|
2794
|
+
usageSource: z.ZodEnum<{
|
|
2795
|
+
"claude-code-jsonl": "claude-code-jsonl";
|
|
2796
|
+
}>;
|
|
2797
|
+
}, z.core.$strict>, readonly [z.ZodObject<{
|
|
2798
|
+
createdAt: z.ZodString;
|
|
2799
|
+
eventId: z.ZodString;
|
|
2800
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
2801
|
+
pr: z.ZodOptional<z.ZodNumber>;
|
|
2802
|
+
repo: z.ZodString;
|
|
2803
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
2804
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
2805
|
+
workerId: z.ZodOptional<z.ZodString>;
|
|
2806
|
+
eventType: z.ZodLiteral<"orchestrator-session">;
|
|
2807
|
+
typeVersion: z.ZodLiteral<1>;
|
|
2808
|
+
avgContextTokens: z.ZodNumber;
|
|
2809
|
+
cacheReadTokens: z.ZodNumber;
|
|
2810
|
+
cacheWriteTokens: z.ZodNumber;
|
|
2811
|
+
inputTokens: z.ZodNumber;
|
|
2812
|
+
observedAt: z.ZodString;
|
|
2813
|
+
outputTokens: z.ZodNumber;
|
|
2814
|
+
sessionId: z.ZodString;
|
|
2815
|
+
totalTokens: z.ZodNumber;
|
|
2816
|
+
turnCount: z.ZodNumber;
|
|
2817
|
+
usageSource: z.ZodEnum<{
|
|
2818
|
+
"claude-code-jsonl": "claude-code-jsonl";
|
|
2819
|
+
}>;
|
|
2820
|
+
}, z.core.$strict>], {
|
|
2821
|
+
readonly 1: z.ZodObject<{
|
|
2822
|
+
avgContextTokens: z.ZodNumber;
|
|
2823
|
+
cacheReadTokens: z.ZodNumber;
|
|
2824
|
+
cacheWriteTokens: z.ZodNumber;
|
|
2825
|
+
inputTokens: z.ZodNumber;
|
|
2826
|
+
observedAt: z.ZodString;
|
|
2827
|
+
outputTokens: z.ZodNumber;
|
|
2828
|
+
sessionId: z.ZodString;
|
|
2829
|
+
totalTokens: z.ZodNumber;
|
|
2830
|
+
turnCount: z.ZodNumber;
|
|
2831
|
+
usageSource: z.ZodEnum<{
|
|
2832
|
+
"claude-code-jsonl": "claude-code-jsonl";
|
|
2833
|
+
}>;
|
|
2834
|
+
}, z.core.$strict>;
|
|
2835
|
+
}, {
|
|
2836
|
+
createdAt: string;
|
|
2837
|
+
eventId: string;
|
|
2838
|
+
repo: string;
|
|
2839
|
+
schemaVersion: 1;
|
|
2840
|
+
eventType: "orchestrator-session";
|
|
2841
|
+
typeVersion: 1;
|
|
2842
|
+
avgContextTokens: number;
|
|
2843
|
+
cacheReadTokens: number;
|
|
2844
|
+
cacheWriteTokens: number;
|
|
2845
|
+
inputTokens: number;
|
|
2846
|
+
observedAt: string;
|
|
2847
|
+
outputTokens: number;
|
|
2848
|
+
sessionId: string;
|
|
2849
|
+
totalTokens: number;
|
|
2850
|
+
turnCount: number;
|
|
2851
|
+
usageSource: "claude-code-jsonl";
|
|
2852
|
+
issue?: number | undefined;
|
|
2853
|
+
pr?: number | undefined;
|
|
2854
|
+
threadId?: string | undefined;
|
|
2855
|
+
workerId?: string | undefined;
|
|
2856
|
+
}>, DefinedTraceEvent<"delegate-exec", z.ZodObject<{
|
|
2857
|
+
createdAt: z.ZodString;
|
|
2858
|
+
eventId: z.ZodString;
|
|
2859
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
2860
|
+
pr: z.ZodOptional<z.ZodNumber>;
|
|
2861
|
+
repo: z.ZodString;
|
|
2862
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
2863
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
2864
|
+
workerId: z.ZodOptional<z.ZodString>;
|
|
2865
|
+
eventType: z.ZodLiteral<"delegate-exec">;
|
|
2866
|
+
typeVersion: z.ZodLiteral<1>;
|
|
2867
|
+
changedFiles: z.ZodArray<z.ZodString>;
|
|
2868
|
+
command: z.ZodString;
|
|
2869
|
+
diff: z.ZodString;
|
|
2870
|
+
durationMs: z.ZodNumber;
|
|
2871
|
+
endedAt: z.ZodString;
|
|
2872
|
+
engineSessionId: z.ZodOptional<z.ZodString>;
|
|
2873
|
+
exitCode: z.ZodNullable<z.ZodNumber>;
|
|
2874
|
+
harness: z.ZodString;
|
|
2875
|
+
interiorCycle: z.ZodOptional<z.ZodNumber>;
|
|
2876
|
+
observedAt: z.ZodString;
|
|
2877
|
+
purpose: z.ZodEnum<{
|
|
2878
|
+
review: "review";
|
|
2879
|
+
code: "code";
|
|
2880
|
+
}>;
|
|
2881
|
+
slotResolution: z.ZodObject<{
|
|
2882
|
+
effort: z.ZodEnum<{
|
|
2883
|
+
high: "high";
|
|
2884
|
+
low: "low";
|
|
2885
|
+
medium: "medium";
|
|
2886
|
+
xhigh: "xhigh";
|
|
2887
|
+
}>;
|
|
2888
|
+
engine: z.ZodString;
|
|
2889
|
+
fallbackTier: z.ZodOptional<z.ZodLiteral<"delegate">>;
|
|
2890
|
+
layerSource: z.ZodEnum<{
|
|
2891
|
+
committedDefault: "committedDefault";
|
|
2892
|
+
operatorSession: "operatorSession";
|
|
2893
|
+
userConfig: "userConfig";
|
|
2894
|
+
}>;
|
|
2895
|
+
model: z.ZodString;
|
|
2896
|
+
tier: z.ZodEnum<{
|
|
2897
|
+
review: "review";
|
|
2898
|
+
delegate: "delegate";
|
|
2899
|
+
oracle: "oracle";
|
|
2900
|
+
workhorse: "workhorse";
|
|
2901
|
+
scout: "scout";
|
|
2902
|
+
}>;
|
|
2903
|
+
}, z.core.$strict>;
|
|
2904
|
+
startedAt: z.ZodString;
|
|
2905
|
+
tier: z.ZodEnum<{
|
|
2906
|
+
review: "review";
|
|
2907
|
+
delegate: "delegate";
|
|
2908
|
+
oracle: "oracle";
|
|
2909
|
+
workhorse: "workhorse";
|
|
2910
|
+
scout: "scout";
|
|
2911
|
+
}>;
|
|
2912
|
+
tokenUsage: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2913
|
+
cachedInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
2914
|
+
inputTokens: z.ZodOptional<z.ZodNumber>;
|
|
2915
|
+
outputTokens: z.ZodOptional<z.ZodNumber>;
|
|
2916
|
+
reasoningOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
2917
|
+
source: z.ZodEnum<{
|
|
2918
|
+
"cursor-csv": "cursor-csv";
|
|
2919
|
+
"codex-json": "codex-json";
|
|
2920
|
+
"cursor-json": "cursor-json";
|
|
2921
|
+
"claude-json": "claude-json";
|
|
2922
|
+
}>;
|
|
2923
|
+
status: z.ZodLiteral<"available">;
|
|
2924
|
+
totalTokens: z.ZodNumber;
|
|
2925
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2926
|
+
missingReason: z.ZodString;
|
|
2927
|
+
status: z.ZodLiteral<"unavailable">;
|
|
2928
|
+
}, z.core.$strict>], "status">;
|
|
2929
|
+
usageSource: z.ZodEnum<{
|
|
2930
|
+
"cursor-agent-json": "cursor-agent-json";
|
|
2931
|
+
"codex-exec-json": "codex-exec-json";
|
|
2932
|
+
"grok-exec-json": "grok-exec-json";
|
|
2933
|
+
"in-harness": "in-harness";
|
|
2934
|
+
}>;
|
|
2935
|
+
}, z.core.$strict>, readonly [z.ZodObject<{
|
|
2936
|
+
createdAt: z.ZodString;
|
|
2937
|
+
eventId: z.ZodString;
|
|
2938
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
2939
|
+
pr: z.ZodOptional<z.ZodNumber>;
|
|
2940
|
+
repo: z.ZodString;
|
|
2941
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
2942
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
2943
|
+
workerId: z.ZodOptional<z.ZodString>;
|
|
2944
|
+
eventType: z.ZodLiteral<"delegate-exec">;
|
|
2945
|
+
typeVersion: z.ZodLiteral<1>;
|
|
2946
|
+
changedFiles: z.ZodArray<z.ZodString>;
|
|
2947
|
+
command: z.ZodString;
|
|
2948
|
+
diff: z.ZodString;
|
|
2949
|
+
durationMs: z.ZodNumber;
|
|
2950
|
+
endedAt: z.ZodString;
|
|
2951
|
+
engineSessionId: z.ZodOptional<z.ZodString>;
|
|
2952
|
+
exitCode: z.ZodNullable<z.ZodNumber>;
|
|
2953
|
+
harness: z.ZodString;
|
|
2954
|
+
interiorCycle: z.ZodOptional<z.ZodNumber>;
|
|
2955
|
+
observedAt: z.ZodString;
|
|
2956
|
+
purpose: z.ZodEnum<{
|
|
2957
|
+
review: "review";
|
|
2958
|
+
code: "code";
|
|
2959
|
+
}>;
|
|
2960
|
+
slotResolution: z.ZodObject<{
|
|
2961
|
+
effort: z.ZodEnum<{
|
|
2962
|
+
high: "high";
|
|
2963
|
+
low: "low";
|
|
2964
|
+
medium: "medium";
|
|
2965
|
+
xhigh: "xhigh";
|
|
2966
|
+
}>;
|
|
2967
|
+
engine: z.ZodString;
|
|
2968
|
+
fallbackTier: z.ZodOptional<z.ZodLiteral<"delegate">>;
|
|
2969
|
+
layerSource: z.ZodEnum<{
|
|
2970
|
+
committedDefault: "committedDefault";
|
|
2971
|
+
operatorSession: "operatorSession";
|
|
2972
|
+
userConfig: "userConfig";
|
|
2973
|
+
}>;
|
|
2974
|
+
model: z.ZodString;
|
|
2975
|
+
tier: z.ZodEnum<{
|
|
2976
|
+
review: "review";
|
|
2977
|
+
delegate: "delegate";
|
|
2978
|
+
oracle: "oracle";
|
|
2979
|
+
workhorse: "workhorse";
|
|
2980
|
+
scout: "scout";
|
|
2981
|
+
}>;
|
|
2982
|
+
}, z.core.$strict>;
|
|
2983
|
+
startedAt: z.ZodString;
|
|
2984
|
+
tier: z.ZodEnum<{
|
|
2985
|
+
review: "review";
|
|
2986
|
+
delegate: "delegate";
|
|
2987
|
+
oracle: "oracle";
|
|
2988
|
+
workhorse: "workhorse";
|
|
2989
|
+
scout: "scout";
|
|
2990
|
+
}>;
|
|
2991
|
+
tokenUsage: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2992
|
+
cachedInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
2993
|
+
inputTokens: z.ZodOptional<z.ZodNumber>;
|
|
2994
|
+
outputTokens: z.ZodOptional<z.ZodNumber>;
|
|
2995
|
+
reasoningOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
2996
|
+
source: z.ZodEnum<{
|
|
2997
|
+
"cursor-csv": "cursor-csv";
|
|
2998
|
+
"codex-json": "codex-json";
|
|
2999
|
+
"cursor-json": "cursor-json";
|
|
3000
|
+
"claude-json": "claude-json";
|
|
3001
|
+
}>;
|
|
3002
|
+
status: z.ZodLiteral<"available">;
|
|
3003
|
+
totalTokens: z.ZodNumber;
|
|
3004
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3005
|
+
missingReason: z.ZodString;
|
|
3006
|
+
status: z.ZodLiteral<"unavailable">;
|
|
3007
|
+
}, z.core.$strict>], "status">;
|
|
3008
|
+
usageSource: z.ZodEnum<{
|
|
3009
|
+
"cursor-agent-json": "cursor-agent-json";
|
|
3010
|
+
"codex-exec-json": "codex-exec-json";
|
|
3011
|
+
"grok-exec-json": "grok-exec-json";
|
|
3012
|
+
"in-harness": "in-harness";
|
|
3013
|
+
}>;
|
|
3014
|
+
}, z.core.$strict>], {
|
|
3015
|
+
readonly 1: z.ZodObject<{
|
|
3016
|
+
changedFiles: z.ZodArray<z.ZodString>;
|
|
3017
|
+
command: z.ZodString;
|
|
3018
|
+
diff: z.ZodString;
|
|
3019
|
+
durationMs: z.ZodNumber;
|
|
3020
|
+
endedAt: z.ZodString;
|
|
3021
|
+
engineSessionId: z.ZodOptional<z.ZodString>;
|
|
3022
|
+
exitCode: z.ZodNullable<z.ZodNumber>;
|
|
3023
|
+
harness: z.ZodString;
|
|
3024
|
+
interiorCycle: z.ZodOptional<z.ZodNumber>;
|
|
3025
|
+
observedAt: z.ZodString;
|
|
3026
|
+
purpose: z.ZodEnum<{
|
|
3027
|
+
review: "review";
|
|
3028
|
+
code: "code";
|
|
3029
|
+
}>;
|
|
3030
|
+
slotResolution: z.ZodObject<{
|
|
3031
|
+
effort: z.ZodEnum<{
|
|
3032
|
+
high: "high";
|
|
3033
|
+
low: "low";
|
|
3034
|
+
medium: "medium";
|
|
3035
|
+
xhigh: "xhigh";
|
|
3036
|
+
}>;
|
|
3037
|
+
engine: z.ZodString;
|
|
3038
|
+
fallbackTier: z.ZodOptional<z.ZodLiteral<"delegate">>;
|
|
3039
|
+
layerSource: z.ZodEnum<{
|
|
3040
|
+
committedDefault: "committedDefault";
|
|
3041
|
+
operatorSession: "operatorSession";
|
|
3042
|
+
userConfig: "userConfig";
|
|
3043
|
+
}>;
|
|
3044
|
+
model: z.ZodString;
|
|
3045
|
+
tier: z.ZodEnum<{
|
|
3046
|
+
review: "review";
|
|
3047
|
+
delegate: "delegate";
|
|
3048
|
+
oracle: "oracle";
|
|
3049
|
+
workhorse: "workhorse";
|
|
3050
|
+
scout: "scout";
|
|
3051
|
+
}>;
|
|
3052
|
+
}, z.core.$strict>;
|
|
3053
|
+
startedAt: z.ZodString;
|
|
3054
|
+
tier: z.ZodEnum<{
|
|
3055
|
+
review: "review";
|
|
3056
|
+
delegate: "delegate";
|
|
3057
|
+
oracle: "oracle";
|
|
3058
|
+
workhorse: "workhorse";
|
|
3059
|
+
scout: "scout";
|
|
3060
|
+
}>;
|
|
3061
|
+
tokenUsage: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3062
|
+
cachedInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
3063
|
+
inputTokens: z.ZodOptional<z.ZodNumber>;
|
|
3064
|
+
outputTokens: z.ZodOptional<z.ZodNumber>;
|
|
3065
|
+
reasoningOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
3066
|
+
source: z.ZodEnum<{
|
|
3067
|
+
"cursor-csv": "cursor-csv";
|
|
3068
|
+
"codex-json": "codex-json";
|
|
3069
|
+
"cursor-json": "cursor-json";
|
|
3070
|
+
"claude-json": "claude-json";
|
|
3071
|
+
}>;
|
|
3072
|
+
status: z.ZodLiteral<"available">;
|
|
3073
|
+
totalTokens: z.ZodNumber;
|
|
3074
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3075
|
+
missingReason: z.ZodString;
|
|
3076
|
+
status: z.ZodLiteral<"unavailable">;
|
|
3077
|
+
}, z.core.$strict>], "status">;
|
|
3078
|
+
usageSource: z.ZodEnum<{
|
|
3079
|
+
"cursor-agent-json": "cursor-agent-json";
|
|
3080
|
+
"codex-exec-json": "codex-exec-json";
|
|
3081
|
+
"grok-exec-json": "grok-exec-json";
|
|
3082
|
+
"in-harness": "in-harness";
|
|
3083
|
+
}>;
|
|
3084
|
+
}, z.core.$strict>;
|
|
3085
|
+
}, {
|
|
3086
|
+
createdAt: string;
|
|
3087
|
+
eventId: string;
|
|
3088
|
+
repo: string;
|
|
3089
|
+
schemaVersion: 1;
|
|
3090
|
+
eventType: "delegate-exec";
|
|
3091
|
+
typeVersion: 1;
|
|
3092
|
+
changedFiles: string[];
|
|
3093
|
+
command: string;
|
|
3094
|
+
diff: string;
|
|
3095
|
+
durationMs: number;
|
|
3096
|
+
endedAt: string;
|
|
3097
|
+
exitCode: number | null;
|
|
3098
|
+
harness: string;
|
|
3099
|
+
observedAt: string;
|
|
3100
|
+
purpose: "review" | "code";
|
|
3101
|
+
slotResolution: {
|
|
3102
|
+
effort: "high" | "low" | "medium" | "xhigh";
|
|
3103
|
+
engine: string;
|
|
3104
|
+
layerSource: "committedDefault" | "operatorSession" | "userConfig";
|
|
3105
|
+
model: string;
|
|
3106
|
+
tier: "review" | "delegate" | "oracle" | "workhorse" | "scout";
|
|
3107
|
+
fallbackTier?: "delegate" | undefined;
|
|
3108
|
+
};
|
|
3109
|
+
startedAt: string;
|
|
3110
|
+
tier: "review" | "delegate" | "oracle" | "workhorse" | "scout";
|
|
3111
|
+
tokenUsage: {
|
|
3112
|
+
source: "cursor-csv" | "codex-json" | "cursor-json" | "claude-json";
|
|
3113
|
+
status: "available";
|
|
3114
|
+
totalTokens: number;
|
|
3115
|
+
cachedInputTokens?: number | undefined;
|
|
3116
|
+
inputTokens?: number | undefined;
|
|
3117
|
+
outputTokens?: number | undefined;
|
|
3118
|
+
reasoningOutputTokens?: number | undefined;
|
|
3119
|
+
} | {
|
|
3120
|
+
missingReason: string;
|
|
3121
|
+
status: "unavailable";
|
|
3122
|
+
};
|
|
3123
|
+
usageSource: "cursor-agent-json" | "codex-exec-json" | "grok-exec-json" | "in-harness";
|
|
3124
|
+
issue?: number | undefined;
|
|
3125
|
+
pr?: number | undefined;
|
|
3126
|
+
threadId?: string | undefined;
|
|
3127
|
+
workerId?: string | undefined;
|
|
3128
|
+
engineSessionId?: string | undefined;
|
|
3129
|
+
interiorCycle?: number | undefined;
|
|
3130
|
+
}>];
|
|
3131
|
+
type FactoryTraceEvent = FactoryTraceEventFromDefinitions<typeof FACTORY_TRACE_EVENT_DEFINITIONS>;
|
|
3132
|
+
//#endregion
|
|
3133
|
+
//#region src/packages/trace/implementation/trace-shard.d.ts
|
|
3134
|
+
type FactoryTraceEnvelope = z.infer<typeof FactoryTraceEnvelopeCoreSchema>;
|
|
3135
|
+
//#endregion
|
|
3136
|
+
//#region src/packages/trace/implementation/trace-sinks.d.ts
|
|
3137
|
+
interface TraceSink {
|
|
3138
|
+
append: (envelope: FactoryTraceEnvelope) => void;
|
|
3139
|
+
}
|
|
3140
|
+
interface TraceMirrorDiagnostic {
|
|
3141
|
+
code: "mirror-append-failed";
|
|
3142
|
+
eventId: string;
|
|
3143
|
+
message: string;
|
|
3144
|
+
}
|
|
3145
|
+
interface TraceWriteSinks {
|
|
3146
|
+
canonical: TraceSink;
|
|
3147
|
+
mirror?: TraceSink;
|
|
3148
|
+
}
|
|
3149
|
+
interface TraceWriteResult {
|
|
3150
|
+
mirrorDiagnostics: TraceMirrorDiagnostic[];
|
|
3151
|
+
}
|
|
3152
|
+
interface ResolveTraceWriteSinksOptions {
|
|
3153
|
+
mirror?: TraceSink;
|
|
3154
|
+
}
|
|
3155
|
+
declare const createLocalJsonlTraceSink: (repoRoot: string) => TraceSink;
|
|
3156
|
+
declare const appendWithTraceSinks: (envelope: FactoryTraceEnvelope, sinks: TraceWriteSinks) => TraceWriteResult;
|
|
3157
|
+
declare const resolveTraceWriteSinks: (repoRoot: string, options?: ResolveTraceWriteSinksOptions) => TraceWriteSinks;
|
|
3158
|
+
//#endregion
|
|
3159
|
+
//#region src/packages/trace/implementation/facade.d.ts
|
|
3160
|
+
type ReadableFactoryTraceEvent = FactoryTraceEvent | z.infer<typeof UnknownFactoryTraceEventSchema>;
|
|
3161
|
+
type WorkerCloseoutLessonsTraceEvent = z.infer<typeof WorkerCloseoutLessonsTraceEventSchema>;
|
|
3162
|
+
interface FactoryTraceFilters {
|
|
3163
|
+
eventType?: string | readonly string[];
|
|
3164
|
+
issue?: number | readonly number[];
|
|
3165
|
+
pr?: number | readonly number[];
|
|
3166
|
+
repo?: string | readonly string[];
|
|
3167
|
+
threadId?: string | readonly string[];
|
|
3168
|
+
workerId?: string | readonly string[];
|
|
3169
|
+
}
|
|
3170
|
+
interface FactoryTraceDiagnostic {
|
|
3171
|
+
code: "malformed-json" | "invalid-event" | "unknown-event-type" | "unknown-event-version";
|
|
3172
|
+
event?: {
|
|
3173
|
+
eventId: string;
|
|
3174
|
+
eventType: string;
|
|
3175
|
+
issue?: number;
|
|
3176
|
+
pr?: number;
|
|
3177
|
+
repo: string;
|
|
3178
|
+
threadId?: string;
|
|
3179
|
+
workerId?: string;
|
|
3180
|
+
};
|
|
3181
|
+
file: string;
|
|
3182
|
+
line: number;
|
|
3183
|
+
message: string;
|
|
3184
|
+
}
|
|
3185
|
+
interface ScanFactoryTraceOptions {
|
|
3186
|
+
diagnosticsOnly?: boolean;
|
|
3187
|
+
filters?: FactoryTraceFilters;
|
|
3188
|
+
from: string;
|
|
3189
|
+
malformed?: "diagnostic" | "throw";
|
|
3190
|
+
repoRoot: string;
|
|
3191
|
+
to: string;
|
|
3192
|
+
}
|
|
3193
|
+
interface ScanFactoryTraceResult {
|
|
3194
|
+
diagnostics: FactoryTraceDiagnostic[];
|
|
3195
|
+
events: ReadableFactoryTraceEvent[];
|
|
3196
|
+
}
|
|
3197
|
+
interface ScanFactoryTraceDiagnosticsOptions {
|
|
3198
|
+
filters?: FactoryTraceFilters;
|
|
3199
|
+
from: string;
|
|
3200
|
+
repoRoot: string;
|
|
3201
|
+
to: string;
|
|
3202
|
+
}
|
|
3203
|
+
declare const validateFactoryTraceEvent: (event: unknown) => FactoryTraceEvent;
|
|
3204
|
+
declare const toFactoryTraceEnvelope: (event: FactoryTraceEvent) => {
|
|
3205
|
+
createdAt: string;
|
|
3206
|
+
envelope: 1;
|
|
3207
|
+
eventId: string;
|
|
3208
|
+
payload: unknown;
|
|
3209
|
+
repo: string;
|
|
3210
|
+
type: string;
|
|
3211
|
+
typeVersion: number;
|
|
3212
|
+
issue?: number | undefined;
|
|
3213
|
+
pr?: number | undefined;
|
|
3214
|
+
thread?: string | undefined;
|
|
3215
|
+
worker?: string | undefined;
|
|
3216
|
+
};
|
|
3217
|
+
interface AppendFactoryTraceEventResult {
|
|
3218
|
+
event: FactoryTraceEvent;
|
|
3219
|
+
filePath: string;
|
|
3220
|
+
mirrorDiagnostics: TraceMirrorDiagnostic[];
|
|
3221
|
+
}
|
|
3222
|
+
declare const scanFactoryTraceEvents: ({
|
|
3223
|
+
diagnosticsOnly,
|
|
3224
|
+
filters,
|
|
3225
|
+
from,
|
|
3226
|
+
malformed,
|
|
3227
|
+
repoRoot,
|
|
3228
|
+
to
|
|
3229
|
+
}: ScanFactoryTraceOptions) => ScanFactoryTraceResult;
|
|
3230
|
+
/**
|
|
3231
|
+
* Diagnostics-only trace read (#707). Scans the shard window purely to surface
|
|
3232
|
+
* malformed / unknown-record diagnostics, without materializing (and then
|
|
3233
|
+
* discarding) every well-formed event. Malformed shards are always collected as
|
|
3234
|
+
* diagnostics, never thrown. Use when a consumer wants shard-corruption signal
|
|
3235
|
+
* but no event payloads — e.g. epic closeout after the orchestrator-metrics
|
|
3236
|
+
* removal.
|
|
3237
|
+
*/
|
|
3238
|
+
declare const scanFactoryTraceDiagnostics: ({
|
|
3239
|
+
filters,
|
|
3240
|
+
from,
|
|
3241
|
+
repoRoot,
|
|
3242
|
+
to
|
|
3243
|
+
}: ScanFactoryTraceDiagnosticsOptions) => FactoryTraceDiagnostic[];
|
|
3244
|
+
//#endregion
|
|
3245
|
+
//#region src/retro-envelope.d.ts
|
|
3246
|
+
/**
|
|
3247
|
+
* Versioned retro envelope schema (epic #27 wave 2, issue #34).
|
|
3248
|
+
*
|
|
3249
|
+
* One envelope per lane, built at `factory:closeout` and delivered through the
|
|
3250
|
+
* typed gate-sink as the `retro-envelope` ingest kind. Re-derived in TypeScript
|
|
3251
|
+
* from the `spike/telemetry-layer2` S5 scratch schema (reference-only, never
|
|
3252
|
+
* merged) and kept structurally parity-compatible with HQ's v1 wire validator
|
|
3253
|
+
* (`software-factory-hq/src/contracts/retro-schemas.ts`, PR #32): a complete
|
|
3254
|
+
* envelope emitted by this package validates verbatim against HQ's payload
|
|
3255
|
+
* validator. This module is the producer-side single source of truth for the
|
|
3256
|
+
* v1 wire shape and its bounds ({@link RETRO_ENVELOPE_WIRE_BOUNDS}); the
|
|
3257
|
+
* exhaustive per-field/bound parity test in
|
|
3258
|
+
* `software-factory-hq/src/retro-envelope-parity.test.ts` (#46) walks this
|
|
3259
|
+
* schema against HQ's actual validator so ANY drift — field, type, bound,
|
|
3260
|
+
* enum, strictness — fails CI, not just drift a fixture happens to exercise.
|
|
3261
|
+
*
|
|
3262
|
+
* DESIGN INVARIANT: cross-family token sums must be UNREPRESENTABLE.
|
|
3263
|
+
*
|
|
3264
|
+
* The two model families use different tokenizers, prices, and accounting
|
|
3265
|
+
* conventions, so any token total that spans Claude and GPT is a lie:
|
|
3266
|
+
*
|
|
3267
|
+
* 1. There is no combined/total token field anywhere in the envelope.
|
|
3268
|
+
* 2. `tokenFamilies` is strict — its only keys are `claude` and `gpt`; data
|
|
3269
|
+
* cannot smuggle in a third "all"/"combined" slot.
|
|
3270
|
+
* 3. The family BLOCKS are structurally different shapes with DIFFERENT keys
|
|
3271
|
+
* (claude is a single flat block keyed on freshInput/cacheReadInput/
|
|
3272
|
+
* cacheCreationInput; gpt is `{ roles: [...] }`). The exclusive input-tier
|
|
3273
|
+
* COUNTS share no key name across families. The residual names shared
|
|
3274
|
+
* between the claude block and a gpt ROLE entry are pinned to exactly
|
|
3275
|
+
* {costUsd, model, output} (PR #32 advisory): `costUsd` is deliberate —
|
|
3276
|
+
* USD is the one cross-family summable unit (rule 4); `model` is an
|
|
3277
|
+
* unsummable label; `output` is the same name at DIFFERENT depths (lane
|
|
3278
|
+
* block vs per-role entry), frozen by a tripwire test in
|
|
3279
|
+
* `retro-envelope.test.ts` so the overlap cannot grow. Renaming `output`
|
|
3280
|
+
* is a schemaVersion-2 wire change, deliberately not spent in v1.
|
|
3281
|
+
* 4. Cost is per-family USD and nullable. Combined totals are allowed in USD
|
|
3282
|
+
* only, and only as a projection-time sum of per-family USD.
|
|
3283
|
+
*
|
|
3284
|
+
* Field names also encode the S2/S3 reader lessons: Claude `freshInput` alone
|
|
3285
|
+
* is not prompt size (true input context = freshInput + cacheReadInput +
|
|
3286
|
+
* cacheCreationInput, requestId-deduped), and codex `inputInclusiveOfCache`
|
|
3287
|
+
* already includes `cachedInput`, so `freshInputDerived` (inclusive − cached)
|
|
3288
|
+
* is the only value safe to feed a per-token pricer.
|
|
3289
|
+
*
|
|
3290
|
+
* COMPLETENESS POSTURE: harvest may have no usable native log for a lane, so
|
|
3291
|
+
* `tokenFamilies` may legitimately be absent. The closeout build gate demands
|
|
3292
|
+
* a valid envelope, not available telemetry. A families-absent envelope keeps
|
|
3293
|
+
* its operator-visible data gaps and is a replayable advisory HQ event, so it
|
|
3294
|
+
* never substitutes unavailable usage with zero. The wire shape (field names,
|
|
3295
|
+
* types, structure) stays byte-parity with HQ v1.
|
|
3296
|
+
*/
|
|
3297
|
+
declare const RETRO_ENVELOPE_SCHEMA_VERSION = 1;
|
|
3298
|
+
declare const retroEnvelopeV1Schema: z.ZodObject<{
|
|
3299
|
+
agentRunId: z.ZodString;
|
|
3300
|
+
archiveRef: z.ZodOptional<z.ZodString>;
|
|
3301
|
+
cycles: z.ZodObject<{
|
|
3302
|
+
gateRunsToFirstGreen: z.ZodNumber;
|
|
3303
|
+
reviewerFixRounds: z.ZodNumber;
|
|
3304
|
+
thermoFixRounds: z.ZodNumber;
|
|
3305
|
+
}, z.core.$strict>;
|
|
3306
|
+
dataGaps: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
3307
|
+
gates: z.ZodArray<z.ZodObject<{
|
|
3308
|
+
cycle: z.ZodNumber;
|
|
3309
|
+
duration: z.ZodNumber;
|
|
3310
|
+
gate: z.ZodString;
|
|
3311
|
+
outcome: z.ZodEnum<{
|
|
3312
|
+
pass: "pass";
|
|
3313
|
+
fail: "fail";
|
|
3314
|
+
skip: "skip";
|
|
3315
|
+
}>;
|
|
3316
|
+
startedAt: z.ZodISODateTime;
|
|
3317
|
+
}, z.core.$strict>>;
|
|
3318
|
+
generatedAt: z.ZodISODateTime;
|
|
3319
|
+
interventions: z.ZodObject<{
|
|
3320
|
+
count: z.ZodNumber;
|
|
3321
|
+
}, z.core.$strict>;
|
|
3322
|
+
joinKeys: z.ZodObject<{
|
|
3323
|
+
claudeSessionIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
3324
|
+
codexThreadIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
3325
|
+
}, z.core.$strict>;
|
|
3326
|
+
kind: z.ZodLiteral<"retro-envelope">;
|
|
3327
|
+
outcome: z.ZodOptional<z.ZodObject<{
|
|
3328
|
+
mergeCheck: z.ZodOptional<z.ZodEnum<{
|
|
3329
|
+
pass: "pass";
|
|
3330
|
+
fail: "fail";
|
|
3331
|
+
"not-run": "not-run";
|
|
3332
|
+
}>>;
|
|
3333
|
+
status: z.ZodEnum<{
|
|
3334
|
+
success: "success";
|
|
3335
|
+
fail: "fail";
|
|
3336
|
+
blocked: "blocked";
|
|
3337
|
+
"ship-with-followups": "ship-with-followups";
|
|
3338
|
+
}>;
|
|
3339
|
+
verdict: z.ZodOptional<z.ZodString>;
|
|
3340
|
+
}, z.core.$strict>>;
|
|
3341
|
+
phases: z.ZodArray<z.ZodObject<{
|
|
3342
|
+
at: z.ZodISODateTime;
|
|
3343
|
+
deltaSec: z.ZodOptional<z.ZodNumber>;
|
|
3344
|
+
name: z.ZodString;
|
|
3345
|
+
}, z.core.$strict>>;
|
|
3346
|
+
refs: z.ZodObject<{
|
|
3347
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
3348
|
+
epic: z.ZodOptional<z.ZodString>;
|
|
3349
|
+
headSha: z.ZodOptional<z.ZodString>;
|
|
3350
|
+
issue: z.ZodOptional<z.ZodString>;
|
|
3351
|
+
prNumber: z.ZodOptional<z.ZodNumber>;
|
|
3352
|
+
}, z.core.$strict>;
|
|
3353
|
+
repo: z.ZodObject<{
|
|
3354
|
+
name: z.ZodString;
|
|
3355
|
+
owner: z.ZodString;
|
|
3356
|
+
}, z.core.$strict>;
|
|
3357
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
3358
|
+
tokenFamilies: z.ZodObject<{
|
|
3359
|
+
claude: z.ZodOptional<z.ZodObject<{
|
|
3360
|
+
cacheCreationInput: z.ZodNumber;
|
|
3361
|
+
cacheReadInput: z.ZodNumber;
|
|
3362
|
+
costUsd: z.ZodNullable<z.ZodNumber>;
|
|
3363
|
+
family: z.ZodLiteral<"claude">;
|
|
3364
|
+
freshInput: z.ZodNumber;
|
|
3365
|
+
model: z.ZodString;
|
|
3366
|
+
output: z.ZodNumber;
|
|
3367
|
+
requests: z.ZodNumber;
|
|
3368
|
+
}, z.core.$strict>>;
|
|
3369
|
+
gpt: z.ZodOptional<z.ZodObject<{
|
|
3370
|
+
family: z.ZodLiteral<"gpt">;
|
|
3371
|
+
roles: z.ZodArray<z.ZodObject<{
|
|
3372
|
+
cachedInput: z.ZodNumber;
|
|
3373
|
+
costUsd: z.ZodNullable<z.ZodNumber>;
|
|
3374
|
+
freshInputDerived: z.ZodNumber;
|
|
3375
|
+
inputInclusiveOfCache: z.ZodNumber;
|
|
3376
|
+
model: z.ZodString;
|
|
3377
|
+
output: z.ZodNumber;
|
|
3378
|
+
reasoningOutput: z.ZodNumber;
|
|
3379
|
+
role: z.ZodString;
|
|
3380
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
3381
|
+
}, z.core.$strict>>;
|
|
3382
|
+
}, z.core.$strict>>;
|
|
3383
|
+
}, z.core.$strict>;
|
|
3384
|
+
wallClock: z.ZodObject<{
|
|
3385
|
+
endTs: z.ZodISODateTime;
|
|
3386
|
+
startTs: z.ZodISODateTime;
|
|
3387
|
+
totalSec: z.ZodNumber;
|
|
3388
|
+
}, z.core.$strict>;
|
|
3389
|
+
}, z.core.$strict>;
|
|
3390
|
+
type RetroEnvelope = z.infer<typeof retroEnvelopeV1Schema>;
|
|
3391
|
+
/**
|
|
3392
|
+
* Versioned payload validators, keyed by schema major. Unknown majors never
|
|
3393
|
+
* reach these — {@link parseRetroEnvelope} returns them raw and marked
|
|
3394
|
+
* degraded, mirroring HQ's ingest skew posture (stored raw, never dropped).
|
|
3395
|
+
*/
|
|
3396
|
+
declare const RETRO_ENVELOPE_VALIDATORS: Record<number, z.ZodType<RetroEnvelope, unknown>>;
|
|
3397
|
+
declare const SUPPORTED_RETRO_ENVELOPE_SCHEMA_VERSIONS: readonly number[];
|
|
3398
|
+
/** The `schemaVersion` a candidate declares, or undefined when unreadable. */
|
|
3399
|
+
declare const retroEnvelopeSchemaVersionOf: (candidate: unknown) => number | undefined;
|
|
3400
|
+
type ParsedRetroEnvelope = {
|
|
3401
|
+
disposition: "trusted";
|
|
3402
|
+
envelope: RetroEnvelope;
|
|
3403
|
+
schemaVersion: number;
|
|
3404
|
+
} | {
|
|
3405
|
+
disposition: "degraded";
|
|
3406
|
+
raw: unknown;
|
|
3407
|
+
schemaVersion: number | undefined;
|
|
3408
|
+
};
|
|
3409
|
+
/**
|
|
3410
|
+
* Parses a candidate against the versioned validators. A recognized major is
|
|
3411
|
+
* validated typed-only (throws on an invalid known-version payload); an unknown
|
|
3412
|
+
* major is round-tripped RAW and marked degraded — the retained payload is the
|
|
3413
|
+
* exact input object, never a coerced projection. Mirrors the HQ ingest seam so
|
|
3414
|
+
* the two sides agree on the skew posture.
|
|
3415
|
+
*/
|
|
3416
|
+
declare const parseRetroEnvelope: (candidate: unknown) => ParsedRetroEnvelope;
|
|
3417
|
+
/**
|
|
3418
|
+
* Whether harvest recorded at least one token family. This is an operator
|
|
3419
|
+
* summary predicate, not a delivery gate: a families-absent envelope remains
|
|
3420
|
+
* valid and replayable when its data gaps explain why telemetry is unavailable.
|
|
3421
|
+
*/
|
|
3422
|
+
declare const isRetroEnvelopeWireComplete: (envelope: Pick<RetroEnvelope, "tokenFamilies">) => boolean;
|
|
3423
|
+
/** Epic anchor for an envelope: refs.epic, else refs.issue, else the PR. */
|
|
3424
|
+
declare const retroEpicReference: (refs: RetroEnvelope["refs"]) => string | undefined;
|
|
3425
|
+
//#endregion
|
|
3426
|
+
//#region src/interior-telemetry/gate-timing.d.ts
|
|
3427
|
+
declare const GATE_TIMING_SCHEMA_VERSION = 1;
|
|
3428
|
+
type FactoryGateName = "boundary:check" | "factory:closeout" | "pr:merge-check" | "pr:ready" | "pr:review" | "pr:verify";
|
|
3429
|
+
type GateTimingOutcome = "fail" | "pass";
|
|
3430
|
+
interface GateTimingRecord {
|
|
3431
|
+
agentRunId: string;
|
|
3432
|
+
cycle: number;
|
|
3433
|
+
durationMs: number;
|
|
3434
|
+
gate: FactoryGateName;
|
|
3435
|
+
outcome: GateTimingOutcome;
|
|
3436
|
+
schemaVersion: typeof GATE_TIMING_SCHEMA_VERSION;
|
|
3437
|
+
startedAt: string;
|
|
3438
|
+
startOffsetMs: number;
|
|
3439
|
+
}
|
|
3440
|
+
//#endregion
|
|
3441
|
+
//#region src/retro-envelope-builder.d.ts
|
|
3442
|
+
/**
|
|
3443
|
+
* Folds a lane's gate-timing ledger (`.factory-memory/gate-timing/<id>.jsonl`,
|
|
3444
|
+
* wave-1 PR #33) into a versioned retro envelope at `factory:closeout`.
|
|
3445
|
+
*
|
|
3446
|
+
* STRUCTURAL INVARIANT (#677 repeat-class rule; PR #35 review cycles 1-2):
|
|
3447
|
+
* telemetry CONTENT can never fail the closeout build gate. Every value that
|
|
3448
|
+
* reaches the envelope passes through one sanitization seam that makes the
|
|
3449
|
+
* output valid BY CONSTRUCTION:
|
|
3450
|
+
*
|
|
3451
|
+
* - strings are clamped to their wire bounds (truncated, with a data gap when
|
|
3452
|
+
* truncation lost information);
|
|
3453
|
+
* - numbers must be finite and within plausibility bounds BEFORE any derived
|
|
3454
|
+
* arithmetic; an absurd value (1e16 ms duration, year-9999 timestamp) SKIPS
|
|
3455
|
+
* its record with a data gap rather than clamping, because clamping would
|
|
3456
|
+
* assert a measurement that never happened;
|
|
3457
|
+
* - arrays are bounded to their schema maxima (gates[] keeps the most recent);
|
|
3458
|
+
* - derived computations (wall clock, cycles) consume only sanitized inputs,
|
|
3459
|
+
* so no ledger content can push them outside Date/Number safe ranges.
|
|
3460
|
+
*
|
|
3461
|
+
* Terminal backstop: the assembled candidate goes through a final schema
|
|
3462
|
+
* parse; if that still fails, a minimal-valid envelope (clamped identity,
|
|
3463
|
+
* empty gates, a data gap naming the failure) is built and returned instead.
|
|
3464
|
+
* `buildRetroEnvelope` therefore never throws for content — the closeout gate
|
|
3465
|
+
* can only fail on filesystem errors when persisting.
|
|
3466
|
+
*/
|
|
3467
|
+
interface BuildRetroEnvelopeInput {
|
|
3468
|
+
agentRunId: string;
|
|
3469
|
+
/** Optional pointer (key/URL) to #8's durable proof archive — never payload. */
|
|
3470
|
+
archiveRef?: string;
|
|
3471
|
+
dataGaps?: string[];
|
|
3472
|
+
generatedAt: Date;
|
|
3473
|
+
interventions?: number;
|
|
3474
|
+
/** Per-family session identities the lane already records. */
|
|
3475
|
+
joinKeys?: {
|
|
3476
|
+
claudeSessionIds?: string[];
|
|
3477
|
+
codexThreadIds?: string[];
|
|
3478
|
+
};
|
|
3479
|
+
/** The lane's gate-timing ledger records, in append order. */
|
|
3480
|
+
ledger: GateTimingRecord[];
|
|
3481
|
+
outcome?: RetroEnvelope["outcome"];
|
|
3482
|
+
phases?: RetroEnvelope["phases"];
|
|
3483
|
+
refs: RetroEnvelope["refs"];
|
|
3484
|
+
repo: RetroEnvelope["repo"];
|
|
3485
|
+
/**
|
|
3486
|
+
* Token families. They may be absent when native session data is unavailable
|
|
3487
|
+
* (valid does not imply available telemetry). When present they satisfy the
|
|
3488
|
+
* family invariants.
|
|
3489
|
+
*/
|
|
3490
|
+
tokenFamilies?: RetroEnvelope["tokenFamilies"];
|
|
3491
|
+
}
|
|
3492
|
+
declare const buildRetroEnvelope: (input: BuildRetroEnvelopeInput) => RetroEnvelope;
|
|
3493
|
+
declare namespace comment_provenance_d_exports {
|
|
3494
|
+
export { SHA_MATCH_MIN_LENGTH, isBotLogin, sameHeadSha };
|
|
3495
|
+
}
|
|
3496
|
+
declare const isBotLogin: (login?: string | undefined) => boolean;
|
|
3497
|
+
declare const SHA_MATCH_MIN_LENGTH = 7;
|
|
3498
|
+
declare const sameHeadSha: (left: string, right: string) => boolean;
|
|
3499
|
+
//#endregion
|
|
3500
|
+
//#region src/doctor.d.ts
|
|
3501
|
+
type DoctorCheckStatus = "error" | "ok" | "warning";
|
|
3502
|
+
interface DoctorCheck {
|
|
3503
|
+
message: string;
|
|
3504
|
+
name: string;
|
|
3505
|
+
status: DoctorCheckStatus;
|
|
3506
|
+
}
|
|
3507
|
+
interface DoctorReport {
|
|
3508
|
+
checks: DoctorCheck[];
|
|
3509
|
+
ok: boolean;
|
|
3510
|
+
profilePath: string;
|
|
3511
|
+
projectKey: string;
|
|
3512
|
+
repository: {
|
|
3513
|
+
defaultBranch: string;
|
|
3514
|
+
name: string;
|
|
3515
|
+
owner: string;
|
|
3516
|
+
};
|
|
3517
|
+
schemaVersion: typeof PROFILE_SCHEMA_VERSION;
|
|
3518
|
+
}
|
|
3519
|
+
interface DoctorProjectProfileInput extends LoadProjectProfileInput {
|
|
3520
|
+
/** Diff base for the admission preflight; ignored unless `preflight`. */
|
|
3521
|
+
base?: string;
|
|
3522
|
+
env?: NodeJS.ProcessEnv;
|
|
3523
|
+
/**
|
|
3524
|
+
* Append the read-only admission checklist (#292): every requirement this
|
|
3525
|
+
* candidate must satisfy before merge, named in one pass. Preflight checks
|
|
3526
|
+
* never report `error`, so they cannot change the doctor exit code.
|
|
3527
|
+
*/
|
|
3528
|
+
preflight?: boolean;
|
|
3529
|
+
userConfig?: LoadUserConfigResult;
|
|
3530
|
+
}
|
|
3531
|
+
declare function doctorProjectProfile(input?: DoctorProjectProfileInput): DoctorReport;
|
|
3532
|
+
//#endregion
|
|
3533
|
+
//#region src/pr-review-gate-trace.d.ts
|
|
3534
|
+
interface ReviewGateTraceIdentity {
|
|
3535
|
+
issue?: number;
|
|
3536
|
+
repo: string;
|
|
3537
|
+
}
|
|
3538
|
+
type ReviewGateNotRequiredProof = Pick<PrReviewProof, "base" | "changedFiles" | "headSha" | "patchId"> & Required<Pick<PrReviewProof, "maxReviewCycles" | "reviewCycle" | "reviewRequirement">>;
|
|
3539
|
+
declare const buildReviewGateNotRequiredTraceEvent: ({
|
|
3540
|
+
createdAt,
|
|
3541
|
+
identity,
|
|
3542
|
+
proof
|
|
3543
|
+
}: {
|
|
3544
|
+
createdAt?: string;
|
|
3545
|
+
identity: ReviewGateTraceIdentity;
|
|
3546
|
+
proof: ReviewGateNotRequiredProof;
|
|
3547
|
+
}) => FactoryTraceEvent;
|
|
3548
|
+
declare const tryAppendReviewGateNotRequiredTraceEvent: ({
|
|
3549
|
+
identity,
|
|
3550
|
+
proof,
|
|
3551
|
+
repoRoot
|
|
3552
|
+
}: {
|
|
3553
|
+
identity: ReviewGateTraceIdentity;
|
|
3554
|
+
proof: ReviewGateNotRequiredProof;
|
|
3555
|
+
repoRoot: string;
|
|
3556
|
+
}) => {
|
|
3557
|
+
readonly filePath: string;
|
|
3558
|
+
readonly ok: true;
|
|
3559
|
+
readonly errorMessage?: undefined;
|
|
3560
|
+
} | {
|
|
3561
|
+
readonly errorMessage: string;
|
|
3562
|
+
readonly ok: false;
|
|
3563
|
+
readonly filePath?: undefined;
|
|
3564
|
+
};
|
|
3565
|
+
declare namespace worktree_scratch_files_d_exports {
|
|
3566
|
+
export { WorktreeRootLister, WorktreeScratchFileCheck, checkWorktreeScratchFiles, formatScratchFileCheckSummary, isWorktreeScratchFile };
|
|
3567
|
+
}
|
|
3568
|
+
declare function isWorktreeScratchFile(fileName: string): boolean;
|
|
3569
|
+
interface WorktreeScratchFileCheck {
|
|
3570
|
+
/** Stray scratch file names found at the worktree root. */
|
|
3571
|
+
files: string[];
|
|
3572
|
+
/**
|
|
3573
|
+
* "skipped" means no worktree path was recorded or the path was not
|
|
3574
|
+
* readable from the planning machine, so nothing was checked.
|
|
3575
|
+
*/
|
|
3576
|
+
status: "clean" | "flagged" | "skipped";
|
|
3577
|
+
worktreePath?: string;
|
|
3578
|
+
}
|
|
3579
|
+
type WorktreeRootLister = (worktreePath: string) => string[] | undefined;
|
|
3580
|
+
declare function checkWorktreeScratchFiles(worktreePath?: string, listRootEntries?: WorktreeRootLister): WorktreeScratchFileCheck;
|
|
3581
|
+
/**
|
|
3582
|
+
* Human-readable one-line summary of a scratch-file check, owned beside the
|
|
3583
|
+
* detection logic (mirroring worktreeHeldBranchNotice) so planner output,
|
|
3584
|
+
* docs, and future surfaces cannot drift apart.
|
|
3585
|
+
*/
|
|
3586
|
+
declare function formatScratchFileCheckSummary(check: WorktreeScratchFileCheck): string;
|
|
3587
|
+
declare namespace pr_body_metadata_d_exports {
|
|
3588
|
+
export { PrBodyMetadata, StackRole, readPrBodyMetadata };
|
|
3589
|
+
}
|
|
3590
|
+
type StackRole = "single" | "slice" | "rollup" | "merge-gate prerequisite";
|
|
3591
|
+
interface PrBodyMetadata {
|
|
3592
|
+
requiredSectionsPresent: boolean;
|
|
3593
|
+
stackRole: StackRole;
|
|
3594
|
+
finalReviewPoint: boolean;
|
|
3595
|
+
trivialWaiverAccepted: boolean;
|
|
3596
|
+
}
|
|
3597
|
+
declare const readPrBodyMetadata: (body: string) => PrBodyMetadata;
|
|
3598
|
+
declare namespace post_readiness_comments_d_exports {
|
|
3599
|
+
export { BLOCKING_REVIEW_STATE, HandledCommentEntry, PostReadinessHumanComment, PrReadinessComment, PrReadinessReview, activePostReadinessHumanComments, activePostReadinessHumanReviews, isBotLogin, postReadinessHumanCommentReason, postReadinessHumanReviewReason, selectPostReadinessHumanComments };
|
|
3600
|
+
}
|
|
3601
|
+
interface PrReadinessComment {
|
|
3602
|
+
author?: {
|
|
3603
|
+
login?: string;
|
|
3604
|
+
};
|
|
3605
|
+
body: string;
|
|
3606
|
+
createdAt?: string;
|
|
3607
|
+
id?: string | number;
|
|
3608
|
+
updatedAt?: string;
|
|
3609
|
+
url?: string;
|
|
3610
|
+
}
|
|
3611
|
+
interface PrReadinessReview {
|
|
3612
|
+
author?: {
|
|
3613
|
+
login?: string;
|
|
3614
|
+
};
|
|
3615
|
+
body?: string;
|
|
3616
|
+
/** GraphQL `PullRequestReview.lastEditedAt` — the body-edit signal used to re-arm a cleared review (#843). */
|
|
3617
|
+
lastEditedAt?: string;
|
|
3618
|
+
state: string;
|
|
3619
|
+
submittedAt?: string;
|
|
3620
|
+
url?: string;
|
|
3621
|
+
}
|
|
3622
|
+
interface PostReadinessHumanComment {
|
|
3623
|
+
author: string;
|
|
3624
|
+
createdAt: string;
|
|
3625
|
+
summary: string;
|
|
3626
|
+
url: string;
|
|
3627
|
+
}
|
|
3628
|
+
declare const BLOCKING_REVIEW_STATE = "CHANGES_REQUESTED";
|
|
3629
|
+
interface HandledCommentEntry {
|
|
3630
|
+
clearedAt?: string;
|
|
3631
|
+
url: string;
|
|
3632
|
+
}
|
|
3633
|
+
/**
|
|
3634
|
+
* Active human blocking comments: all non-bot human PR comments minus the
|
|
3635
|
+
* explicitly-handled URL set. No review-timestamp recency gate — an unhandled
|
|
3636
|
+
* blocker blocks regardless of later review runs (#819 cycle 3). A handled
|
|
3637
|
+
* comment that is EDITED after it was cleared re-arms (#825a).
|
|
3638
|
+
*/
|
|
3639
|
+
declare const selectPostReadinessHumanComments: ({
|
|
3640
|
+
comments,
|
|
3641
|
+
handledComments
|
|
3642
|
+
}: {
|
|
3643
|
+
comments: PrReadinessComment[];
|
|
3644
|
+
handledComments?: HandledCommentEntry[];
|
|
3645
|
+
}) => PostReadinessHumanComment[];
|
|
3646
|
+
/**
|
|
3647
|
+
* Active human blockers are recomputed from live GitHub comments each run
|
|
3648
|
+
* (#819). The prior local readiness proof is not a carry source —
|
|
3649
|
+
* `.factory-memory/` is gitignored and vanishes on clean checkout. Clearing
|
|
3650
|
+
* persists only via the durable handled set (factory check-run
|
|
3651
|
+
* `patronage-factory/handled-comments`) plus explicit `--handled-comment`.
|
|
3652
|
+
*/
|
|
3653
|
+
declare const activePostReadinessHumanComments: ({
|
|
3654
|
+
comments,
|
|
3655
|
+
handledComments
|
|
3656
|
+
}: {
|
|
3657
|
+
comments: PrReadinessComment[];
|
|
3658
|
+
handledComments?: HandledCommentEntry[];
|
|
3659
|
+
}) => PostReadinessHumanComment[];
|
|
3660
|
+
/**
|
|
3661
|
+
* Active CHANGES_REQUESTED PR review submissions (#825b): a top-level review
|
|
3662
|
+
* body carries no inline thread, so without this scan it is the only human
|
|
3663
|
+
* channel auto-merge would sail over — unwatched by both the issue-comment
|
|
3664
|
+
* scan and the unresolved-review-thread count. Shares the handled-set /
|
|
3665
|
+
* re-arm rules with comments so an operator can clear a stale request the
|
|
3666
|
+
* same way (`--handled-comment <review-url>`). The clear-comparison uses
|
|
3667
|
+
* `lastEditedAt` when present so a body edit after a clear re-arms the
|
|
3668
|
+
* blocker the same way an edited comment does — resubmission is not the
|
|
3669
|
+
* only edit signal GitHub exposes (#843).
|
|
3670
|
+
*/
|
|
3671
|
+
declare const activePostReadinessHumanReviews: ({
|
|
3672
|
+
handledComments,
|
|
3673
|
+
reviews
|
|
3674
|
+
}: {
|
|
3675
|
+
handledComments?: HandledCommentEntry[];
|
|
3676
|
+
reviews: PrReadinessReview[];
|
|
3677
|
+
}) => PostReadinessHumanComment[];
|
|
3678
|
+
declare const postReadinessHumanCommentReason: ({
|
|
3679
|
+
comment,
|
|
3680
|
+
pr,
|
|
3681
|
+
prTitle
|
|
3682
|
+
}: {
|
|
3683
|
+
comment: PostReadinessHumanComment;
|
|
3684
|
+
pr: number;
|
|
3685
|
+
prTitle?: string;
|
|
3686
|
+
}) => string;
|
|
3687
|
+
declare const postReadinessHumanReviewReason: ({
|
|
3688
|
+
pr,
|
|
3689
|
+
prTitle,
|
|
3690
|
+
review
|
|
3691
|
+
}: {
|
|
3692
|
+
pr: number;
|
|
3693
|
+
prTitle?: string;
|
|
3694
|
+
review: PostReadinessHumanComment;
|
|
3695
|
+
}) => string;
|
|
3696
|
+
//#endregion
|
|
3697
|
+
//#region src/pr-readiness/pr-body-sections.d.ts
|
|
3698
|
+
declare const MANAGED_SECTION_NAMES: readonly ["Verification", "Review proof", "How to review"];
|
|
3699
|
+
declare namespace pr_body_renderer_d_exports {
|
|
3700
|
+
export { MANAGED_SECTION_NAMES as PR_BODY_MANAGED_SECTIONS, renderPrBodySectionParts, renderPrBodySections };
|
|
3701
|
+
}
|
|
3702
|
+
declare const renderPrBodySectionParts: ({
|
|
3703
|
+
reviewProof,
|
|
3704
|
+
verifyProof
|
|
3705
|
+
}: {
|
|
3706
|
+
reviewProof?: PrReviewProof;
|
|
3707
|
+
verifyProof?: PrVerifyProof;
|
|
3708
|
+
}) => {
|
|
3709
|
+
heading: string;
|
|
3710
|
+
content: string;
|
|
3711
|
+
}[];
|
|
3712
|
+
declare const renderPrBodySections: ({
|
|
3713
|
+
reviewProof,
|
|
3714
|
+
verifyProof
|
|
3715
|
+
}: {
|
|
3716
|
+
reviewProof?: PrReviewProof;
|
|
3717
|
+
verifyProof?: PrVerifyProof;
|
|
3718
|
+
}) => string;
|
|
3719
|
+
//#endregion
|
|
3720
|
+
//#region src/pr-readiness/review-requiredness.d.ts
|
|
3721
|
+
interface DocsOnlyReviewBypassState {
|
|
3722
|
+
applies: boolean;
|
|
3723
|
+
}
|
|
3724
|
+
declare const resolveDocsOnlyReviewBypassState: (input: {
|
|
3725
|
+
classification: DiffClassification;
|
|
3726
|
+
docsOnlyReviewBypass?: boolean;
|
|
3727
|
+
}) => DocsOnlyReviewBypassState;
|
|
3728
|
+
declare namespace readiness_evaluation_d_exports {
|
|
3729
|
+
export { CORRECTNESS_UNTYPED_REVIEW_BLOCKER_REASON, DRAFT_BLOCKER_REASON, DocsOnlyReviewBypassState, EvaluationInput, ManagedReadinessLedger, PENDING_CHECKS_BLOCKER_REASON_PREFIX, PreviewDeployProof, PreviewSeedStatus, READINESS_REPAIR_CODES, RENDER_PR_BODY_SECTIONS_BLOCKER_REASON, ReadinessRepair, ReadinessStatus, SCHEMA_VERSION, SECURITY_UNTYPED_REVIEW_BLOCKER_REASON, evaluateReadiness, managedReadinessLedgerSchema, readinessExitCode, readinessRepairSchema, resolveDocsOnlyReviewBypassState, validateManagedReadinessLedger };
|
|
3730
|
+
}
|
|
3731
|
+
declare const CORRECTNESS_UNTYPED_REVIEW_BLOCKER_REASON = "Correctness review proof is not a head-bound typed findings verdict; re-run pr:review with a valid findings file.";
|
|
3732
|
+
declare const SECURITY_UNTYPED_REVIEW_BLOCKER_REASON = "Security review proof is not a head-bound typed findings verdict; re-run pr:review with a valid findings file.";
|
|
3733
|
+
declare const DRAFT_BLOCKER_REASON = "PR is still marked draft.";
|
|
3734
|
+
declare const RENDER_PR_BODY_SECTIONS_BLOCKER_REASON = "PR body must include Verification, Review proof, and How to review sections.";
|
|
3735
|
+
declare const PENDING_CHECKS_BLOCKER_REASON_PREFIX = "Required/current checks are";
|
|
3736
|
+
declare const readinessExitCode: (status: ReadinessStatus) => 1 | 0;
|
|
3737
|
+
interface EvaluationInput {
|
|
3738
|
+
pr: number;
|
|
3739
|
+
prTitle?: string;
|
|
3740
|
+
body: string;
|
|
3741
|
+
headSha: string;
|
|
3742
|
+
localHeadSha?: string;
|
|
3743
|
+
baseSha: string;
|
|
3744
|
+
patchId: string;
|
|
3745
|
+
classification: DiffClassification;
|
|
3746
|
+
comments?: PrReadinessComment[];
|
|
3747
|
+
reviews?: PrReadinessReview[];
|
|
3748
|
+
unresolvedReviewThreads: number;
|
|
3749
|
+
requiredChecks: CheckState;
|
|
3750
|
+
draft: boolean;
|
|
3751
|
+
currentWithBase: boolean;
|
|
3752
|
+
mergeable: string;
|
|
3753
|
+
mergeStateStatus: string;
|
|
3754
|
+
ladderPolicy?: ReviewLadderPolicy;
|
|
3755
|
+
reviewModes?: PrReviewKind[];
|
|
3756
|
+
reviewProof?: PrReviewProof;
|
|
3757
|
+
verificationProof?: VerificationProofState;
|
|
3758
|
+
docsOnlyVerifyBaselineHeadShas?: string[];
|
|
3759
|
+
docsOnlySinceReviewProof?: boolean;
|
|
3760
|
+
docsOnlyReviewBypass?: boolean;
|
|
3761
|
+
externalRequiredChecks?: RequiredCheck[];
|
|
3762
|
+
evidenceEnvelopes?: LoadedEvidenceEnvelope[];
|
|
3763
|
+
mergeBaseSha?: string;
|
|
3764
|
+
authoringSessionIds?: string[];
|
|
3765
|
+
prLabels?: string[];
|
|
3766
|
+
priorLedger?: Pick<ManagedReadinessLedger, "reviewRuns">;
|
|
3767
|
+
handledCommentUrls?: string[];
|
|
3768
|
+
checkRunHandledCommentUrls?: string[];
|
|
3769
|
+
handledCommentsProducer?: {
|
|
3770
|
+
identity: string;
|
|
3771
|
+
mode: "app" | "commit-status";
|
|
3772
|
+
};
|
|
3773
|
+
handledCommentSessionId?: string;
|
|
3774
|
+
handledCommentClearedAt?: string;
|
|
3775
|
+
}
|
|
3776
|
+
declare const evaluateReadiness: (input: EvaluationInput) => {
|
|
3777
|
+
blockingReasons: string[];
|
|
3778
|
+
humanBlockingReasons: string[];
|
|
3779
|
+
ledger: {
|
|
3780
|
+
baseSha: string;
|
|
3781
|
+
blockingReasons: string[];
|
|
3782
|
+
classification: "trivial" | "docs/process-only" | "non-trivial";
|
|
3783
|
+
finalReviewPoint: boolean;
|
|
3784
|
+
github: {
|
|
3785
|
+
currentWithBase: boolean;
|
|
3786
|
+
draft: boolean;
|
|
3787
|
+
mergeStateStatus: string;
|
|
3788
|
+
mergeable: string;
|
|
3789
|
+
requiredChecks: "unknown" | "pending" | "passed" | "failed" | "none";
|
|
3790
|
+
unresolvedReviewThreads: number;
|
|
3791
|
+
};
|
|
3792
|
+
headSha: string;
|
|
3793
|
+
patchId: string;
|
|
3794
|
+
pr: number;
|
|
3795
|
+
previewDeployRequired: boolean;
|
|
3796
|
+
repairs: {
|
|
3797
|
+
action: string;
|
|
3798
|
+
code: "undraft-pr" | "render-pr-body-sections" | "await-post-undraft-checks";
|
|
3799
|
+
command: string;
|
|
3800
|
+
}[];
|
|
3801
|
+
reviews: {
|
|
3802
|
+
correctness: {
|
|
3803
|
+
required: boolean;
|
|
3804
|
+
status: "blocked" | "not-required" | "current" | "stale" | "missing";
|
|
3805
|
+
docsOnlyDeltaAccepted?: boolean | undefined;
|
|
3806
|
+
reviewedHeadSha?: string | undefined;
|
|
3807
|
+
reviewedPatchId?: string | undefined;
|
|
3808
|
+
};
|
|
3809
|
+
security?: {
|
|
3810
|
+
required: boolean;
|
|
3811
|
+
status: "blocked" | "not-required" | "current" | "stale" | "missing";
|
|
3812
|
+
docsOnlyDeltaAccepted?: boolean | undefined;
|
|
3813
|
+
reviewedHeadSha?: string | undefined;
|
|
3814
|
+
reviewedPatchId?: string | undefined;
|
|
3815
|
+
} | undefined;
|
|
3816
|
+
};
|
|
3817
|
+
schemaVersion: 1;
|
|
3818
|
+
stackRole: "slice" | "single" | "rollup" | "merge-gate prerequisite";
|
|
3819
|
+
verification: {
|
|
3820
|
+
command: "patronage-factory pr:verify";
|
|
3821
|
+
prVerify: "passed" | "stale" | "missing";
|
|
3822
|
+
docsOnlyDeltaAccepted?: boolean | undefined;
|
|
3823
|
+
docsOnlyVerifiedHeadSha?: string | undefined;
|
|
3824
|
+
trivialDeltaAccepted?: boolean | undefined;
|
|
3825
|
+
trivialVerifiedHeadSha?: string | undefined;
|
|
3826
|
+
verifiedHeadSha?: string | undefined;
|
|
3827
|
+
};
|
|
3828
|
+
externalChecks?: {
|
|
3829
|
+
checkType: "review" | "verify";
|
|
3830
|
+
inScope: boolean;
|
|
3831
|
+
name: string;
|
|
3832
|
+
scopeReason: string;
|
|
3833
|
+
status: "satisfied" | "unmet" | "out-of-scope";
|
|
3834
|
+
reason?: string | undefined;
|
|
3835
|
+
scope?: {
|
|
3836
|
+
classifications?: ("trivial" | "docs/process-only" | "non-trivial")[] | undefined;
|
|
3837
|
+
labels?: string[] | undefined;
|
|
3838
|
+
} | undefined;
|
|
3839
|
+
}[] | undefined;
|
|
3840
|
+
handledCommentsProducer?: {
|
|
3841
|
+
identity: string;
|
|
3842
|
+
mode: "app" | "commit-status";
|
|
3843
|
+
} | undefined;
|
|
3844
|
+
handledHumanComments?: {
|
|
3845
|
+
source: "check-run" | "cli";
|
|
3846
|
+
url: string;
|
|
3847
|
+
clearedAt?: string | undefined;
|
|
3848
|
+
sessionId?: string | undefined;
|
|
3849
|
+
}[] | undefined;
|
|
3850
|
+
mergeBaseSha?: string | undefined;
|
|
3851
|
+
postReadinessHumanComments?: {
|
|
3852
|
+
author: string;
|
|
3853
|
+
createdAt: string;
|
|
3854
|
+
summary: string;
|
|
3855
|
+
url: string;
|
|
3856
|
+
}[] | undefined;
|
|
3857
|
+
postReadinessHumanReviews?: {
|
|
3858
|
+
author: string;
|
|
3859
|
+
createdAt: string;
|
|
3860
|
+
summary: string;
|
|
3861
|
+
url: string;
|
|
3862
|
+
}[] | undefined;
|
|
3863
|
+
previewDeploy?: {
|
|
3864
|
+
seedStatus: "unknown" | "skipped" | "passed" | "failed";
|
|
3865
|
+
adminUrl?: string | undefined;
|
|
3866
|
+
apiHealthUrl?: string | undefined;
|
|
3867
|
+
headSha?: string | undefined;
|
|
3868
|
+
localPreviewProof?: unknown;
|
|
3869
|
+
localProofPath?: string | undefined;
|
|
3870
|
+
proofSource?: "github-actions" | "local-self-certified" | undefined;
|
|
3871
|
+
publicUrl?: string | undefined;
|
|
3872
|
+
stage?: string | undefined;
|
|
3873
|
+
timingsMs?: Record<string, number | undefined> | undefined;
|
|
3874
|
+
workflowRunUrl?: string | undefined;
|
|
3875
|
+
} | undefined;
|
|
3876
|
+
reviewCycleState?: {
|
|
3877
|
+
autoBlockingFindings: number;
|
|
3878
|
+
countsBySeverity: {
|
|
3879
|
+
critical: number;
|
|
3880
|
+
high: number;
|
|
3881
|
+
low: number;
|
|
3882
|
+
medium: number;
|
|
3883
|
+
unknown: number;
|
|
3884
|
+
};
|
|
3885
|
+
nonBlockingFindings: number;
|
|
3886
|
+
openFindings: number;
|
|
3887
|
+
windowExhausted: boolean;
|
|
3888
|
+
highestBlockingSeverity?: "unknown" | "critical" | "high" | "low" | "medium" | undefined;
|
|
3889
|
+
highestOpenSeverity?: "unknown" | "critical" | "high" | "low" | "medium" | undefined;
|
|
3890
|
+
maxReviewCycles?: number | undefined;
|
|
3891
|
+
reviewCycle?: number | undefined;
|
|
3892
|
+
staleRepeatFindings?: number | undefined;
|
|
3893
|
+
} | undefined;
|
|
3894
|
+
reviewLadder?: {
|
|
3895
|
+
cycleCounts: {
|
|
3896
|
+
gate: number;
|
|
3897
|
+
interior: number;
|
|
3898
|
+
};
|
|
3899
|
+
nextAction: "run-gate-cycle" | "accept-nonblocking-findings" | "escalate-to-triage" | "ready-for-human" | "advance-to-gate" | "run-interior-cycle";
|
|
3900
|
+
stage: "gate" | "interior" | "interior-complete";
|
|
3901
|
+
forcedTransition?: "gate-cap-exhausted" | "interior-cap-reached" | undefined;
|
|
3902
|
+
} | undefined;
|
|
3903
|
+
reviewRuns?: PrReviewResult[] | undefined;
|
|
3904
|
+
reviewTerminalState?: "blocked" | "accepted-with-findings" | "clean" | undefined;
|
|
3905
|
+
};
|
|
3906
|
+
repairs: {
|
|
3907
|
+
action: string;
|
|
3908
|
+
code: "undraft-pr" | "render-pr-body-sections" | "await-post-undraft-checks";
|
|
3909
|
+
command: string;
|
|
3910
|
+
}[];
|
|
3911
|
+
status: ReadinessStatus;
|
|
3912
|
+
};
|
|
3913
|
+
//#endregion
|
|
3914
|
+
//#region src/evidence-emit.d.ts
|
|
3915
|
+
interface EvidenceEmitArgs {
|
|
3916
|
+
base: string;
|
|
3917
|
+
check: string;
|
|
3918
|
+
checkType: EvidenceCheckType;
|
|
3919
|
+
cwd: string;
|
|
3920
|
+
findingsPointer?: string;
|
|
3921
|
+
json?: boolean;
|
|
3922
|
+
model?: string;
|
|
3923
|
+
outcome: "pass" | "fail";
|
|
3924
|
+
output?: string;
|
|
3925
|
+
policyVersion?: string;
|
|
3926
|
+
profilePath?: string;
|
|
3927
|
+
producer: string;
|
|
3928
|
+
requestId?: string;
|
|
3929
|
+
rung?: EvidenceReviewRung;
|
|
3930
|
+
sessionId?: string;
|
|
3931
|
+
}
|
|
3932
|
+
interface EvidenceEmitDependencies {
|
|
3933
|
+
env?: NodeJS.ProcessEnv;
|
|
3934
|
+
git?: {
|
|
3935
|
+
currentHeadSha: (cwd: string) => string;
|
|
3936
|
+
mergeBaseSha: (cwd: string, base: string) => string;
|
|
3937
|
+
stablePatchId: (cwd: string, base: string) => string;
|
|
3938
|
+
};
|
|
3939
|
+
hq?: HqIngestDependencies;
|
|
3940
|
+
now?: () => Date;
|
|
3941
|
+
}
|
|
3942
|
+
interface EvidenceEmitResult {
|
|
3943
|
+
envelope: EvidenceEnvelope;
|
|
3944
|
+
path: string;
|
|
3945
|
+
}
|
|
3946
|
+
declare const evidenceEnvelopeFilename: (check: string, headSha: string) => string;
|
|
3947
|
+
declare function buildEvidenceEnvelope(args: EvidenceEmitArgs, dependencies?: EvidenceEmitDependencies): EvidenceEnvelope;
|
|
3948
|
+
declare function runEvidenceEmit(args: EvidenceEmitArgs, dependencies?: EvidenceEmitDependencies): EvidenceEmitResult;
|
|
3949
|
+
//#endregion
|
|
3950
|
+
//#region src/hq-access.d.ts
|
|
3951
|
+
/** Cloudflare Access service-token credentials for production HQ ingest. */
|
|
3952
|
+
interface CloudflareAccessServiceToken {
|
|
3953
|
+
clientId: string;
|
|
3954
|
+
clientSecret: string;
|
|
3955
|
+
}
|
|
3956
|
+
//#endregion
|
|
3957
|
+
//#region src/epic-structure.d.ts
|
|
3958
|
+
/**
|
|
3959
|
+
* Producer-side `epic-structure` v1 emitter (epic #132, lane #135).
|
|
3960
|
+
*
|
|
3961
|
+
* `psf epic:publish-structure` reads a planner's ephemeral `dag.yml` (never
|
|
3962
|
+
* committed — see epic #132 / ADR 0018), validates the graph fail-closed, and
|
|
3963
|
+
* POSTs an `epic-structure` v1 event to HQ's `/api/ingest` boundary. This
|
|
3964
|
+
* module is the pure core: parse-to-IR validation, the wire mapping, and the
|
|
3965
|
+
* deterministic content-addressed eventId. All I/O (stdin/file read, fetch)
|
|
3966
|
+
* lives in the command wrapper.
|
|
3967
|
+
*
|
|
3968
|
+
* WIRE PARITY (do not fork the schema): the emitted payload is the exact shape
|
|
3969
|
+
* HQ's `EpicGraphSchema` accepts (`software-factory-hq/src/contracts/
|
|
3970
|
+
* epic-schemas.ts`) and is built by hand the same way `seed-dev.ts` builds it
|
|
3971
|
+
* — no re-declared zod twin. HQ's `epic-structure-parity.test.ts` imports
|
|
3972
|
+
* {@link buildEpicStructureEvent} and runs its output through the real
|
|
3973
|
+
* `EpicGraphSchema`, so any drift (field, enum, bound, strictness) fails CI.
|
|
3974
|
+
*
|
|
3975
|
+
* The `dag.yml` schema itself is documented with the epic skill (lane #137);
|
|
3976
|
+
* this module is the executable contract, not a second source of truth.
|
|
3977
|
+
*/
|
|
3978
|
+
declare const EPIC_STRUCTURE_SCHEMA_VERSION = 1;
|
|
3979
|
+
/**
|
|
3980
|
+
* DAG-node PLANNING statuses — the planning-plane vocabulary a planner authors
|
|
3981
|
+
* on a `dag.yml` node. Carried forward by ADR 0018 §4 and defined by the epic
|
|
3982
|
+
* skill (`reference/epic-artifacts.md`) and both `CONTEXT.md` glossaries.
|
|
3983
|
+
*
|
|
3984
|
+
* A DAG node is a unit of *plan*; an HQ lane is a unit of *runtime execution*.
|
|
3985
|
+
* These are two planes with two vocabularies and must not be conflated — the
|
|
3986
|
+
* producer validates and emits ONLY planning statuses:
|
|
3987
|
+
*
|
|
3988
|
+
* - `open` authored, not yet done
|
|
3989
|
+
* - `closed` done (a PR merged, or otherwise resolved)
|
|
3990
|
+
* - `satisfied-on-main` already true on main without a dedicated PR
|
|
3991
|
+
* - `parked` real node, scope still moving — relabeled off
|
|
3992
|
+
* `ready-for-agent`, never closed
|
|
3993
|
+
*
|
|
3994
|
+
* HQ's `DagNodeSchema` (`software-factory-hq/src/contracts/epic-schemas.ts`)
|
|
3995
|
+
* accepts this planning vocabulary on ingest AND overlays a runtime LANE status
|
|
3996
|
+
* onto a node once a lane is linked (`syncNodesWithLanes` /
|
|
3997
|
+
* `projectEpicMembership`) — the overlay is HQ-internal; the producer never
|
|
3998
|
+
* emits a lane status. HQ's `epic-structure-parity.test.ts` fails CI if the
|
|
3999
|
+
* producer emits any status HQ won't accept.
|
|
4000
|
+
*/
|
|
4001
|
+
declare const EPIC_STRUCTURE_NODE_STATUSES: readonly ["open", "closed", "satisfied-on-main", "parked"];
|
|
4002
|
+
type EpicStructureNodeStatus = (typeof EPIC_STRUCTURE_NODE_STATUSES)[number];
|
|
4003
|
+
interface DagDocument {
|
|
4004
|
+
epic?: unknown;
|
|
4005
|
+
boundary?: unknown;
|
|
4006
|
+
name?: unknown;
|
|
4007
|
+
repo?: unknown;
|
|
4008
|
+
nodes?: unknown;
|
|
4009
|
+
edges?: unknown;
|
|
4010
|
+
}
|
|
4011
|
+
interface EpicStructureGraphNode {
|
|
4012
|
+
epicId: string;
|
|
4013
|
+
laneId?: string;
|
|
4014
|
+
slug: string;
|
|
4015
|
+
status: EpicStructureNodeStatus;
|
|
4016
|
+
title: string;
|
|
4017
|
+
}
|
|
4018
|
+
interface EpicStructureGraphEdge {
|
|
4019
|
+
epicId: string;
|
|
4020
|
+
from: string;
|
|
4021
|
+
to: string;
|
|
4022
|
+
type: "depends-on";
|
|
4023
|
+
}
|
|
4024
|
+
interface EpicStructureGraphPayload {
|
|
4025
|
+
edges: EpicStructureGraphEdge[];
|
|
4026
|
+
epics: {
|
|
4027
|
+
id: string;
|
|
4028
|
+
name: string;
|
|
4029
|
+
repo: string;
|
|
4030
|
+
}[];
|
|
4031
|
+
nodes: EpicStructureGraphNode[];
|
|
4032
|
+
}
|
|
4033
|
+
interface EpicStructureEvent {
|
|
4034
|
+
eventId: string;
|
|
4035
|
+
kind: "epic-structure";
|
|
4036
|
+
observedAt: string;
|
|
4037
|
+
payload: EpicStructureGraphPayload;
|
|
4038
|
+
schemaVersion: number;
|
|
4039
|
+
}
|
|
4040
|
+
interface BuildEpicStructureEventInput {
|
|
4041
|
+
/** Parsed dag.yml (or JSON) document. */
|
|
4042
|
+
document: DagDocument;
|
|
4043
|
+
/** Boundary slug override (else `dag.boundary`, else `epic-<id>`). */
|
|
4044
|
+
boundary?: string;
|
|
4045
|
+
/** Epic display name override (else `dag.name`, else `Epic <id>`). */
|
|
4046
|
+
name?: string;
|
|
4047
|
+
/** Repo name override (else `dag.repo`). Required by one of the two. */
|
|
4048
|
+
repo?: string;
|
|
4049
|
+
/** Event observedAt; NOT part of the eventId hash. Defaults to now. */
|
|
4050
|
+
observedAt?: string;
|
|
4051
|
+
}
|
|
4052
|
+
/**
|
|
4053
|
+
* Fail-closed validation error carrying every offending node/edge diagnostic.
|
|
4054
|
+
*/
|
|
4055
|
+
declare class EpicStructureValidationError extends Error {
|
|
4056
|
+
readonly diagnostics: string[];
|
|
4057
|
+
constructor(diagnostics: string[]);
|
|
4058
|
+
}
|
|
4059
|
+
interface ValidatedNode {
|
|
4060
|
+
slug: string;
|
|
4061
|
+
title: string;
|
|
4062
|
+
status: EpicStructureNodeStatus;
|
|
4063
|
+
issue?: number;
|
|
4064
|
+
laneId?: string;
|
|
4065
|
+
external: boolean;
|
|
4066
|
+
}
|
|
4067
|
+
interface ValidatedDag {
|
|
4068
|
+
epicId: string;
|
|
4069
|
+
boundary: string;
|
|
4070
|
+
name: string;
|
|
4071
|
+
repo: string;
|
|
4072
|
+
nodes: ValidatedNode[];
|
|
4073
|
+
edges: {
|
|
4074
|
+
from: string;
|
|
4075
|
+
to: string;
|
|
4076
|
+
}[];
|
|
4077
|
+
}
|
|
4078
|
+
/**
|
|
4079
|
+
* Validates a dag document fail-closed. Throws {@link
|
|
4080
|
+
* EpicStructureValidationError} with a diagnostic per offending node/edge.
|
|
4081
|
+
*/
|
|
4082
|
+
declare const validateDagDocument: (input: BuildEpicStructureEventInput) => ValidatedDag;
|
|
4083
|
+
/**
|
|
4084
|
+
* Builds the wire payload with deterministic ordering (nodes by slug, edges by
|
|
4085
|
+
* from then to) so re-emission of the same graph is byte-stable regardless of
|
|
4086
|
+
* the planner's source ordering — the basis for the content-addressed eventId.
|
|
4087
|
+
*/
|
|
4088
|
+
declare const buildEpicStructurePayload: (dag: ValidatedDag) => EpicStructureGraphPayload;
|
|
4089
|
+
/**
|
|
4090
|
+
* Deterministic eventId = `epic-structure-<boundary>-<sha256(payload)[0:16]>`.
|
|
4091
|
+
* Re-emitting identical graph content yields the same eventId (HQ dedups →
|
|
4092
|
+
* 200/duplicate); an amendment changes the content hash → a new eventId that
|
|
4093
|
+
* supersedes the prior structure wholesale (HQ keeps the latest). This mirrors
|
|
4094
|
+
* seed-dev's fixed-eventId idempotency, content-addressed instead of literal.
|
|
4095
|
+
*/
|
|
4096
|
+
declare const epicStructureEventId: (boundary: string, payload: EpicStructureGraphPayload) => string;
|
|
4097
|
+
/**
|
|
4098
|
+
* Validates and builds the full `epic-structure` v1 ingest event, ready to POST
|
|
4099
|
+
* to `/api/ingest`. Throws {@link EpicStructureValidationError} fail-closed.
|
|
4100
|
+
*/
|
|
4101
|
+
declare const buildEpicStructureEvent: (input: BuildEpicStructureEventInput) => EpicStructureEvent;
|
|
4102
|
+
type FetchLike = (input: string, init?: {
|
|
4103
|
+
body?: string;
|
|
4104
|
+
headers?: Record<string, string>;
|
|
4105
|
+
method?: string;
|
|
4106
|
+
redirect?: "error";
|
|
4107
|
+
}) => Promise<{
|
|
4108
|
+
json: () => Promise<unknown>;
|
|
4109
|
+
status: number;
|
|
4110
|
+
text: () => Promise<string>;
|
|
4111
|
+
}>;
|
|
4112
|
+
interface PublishEpicStructureArgs {
|
|
4113
|
+
/**
|
|
4114
|
+
* Cloudflare Access credentials for production HQ ingest. Since v0.16.0,
|
|
4115
|
+
* this replaces the removed application bearer-token `token` member.
|
|
4116
|
+
*/
|
|
4117
|
+
accessServiceToken?: CloudflareAccessServiceToken;
|
|
4118
|
+
event: EpicStructureEvent;
|
|
4119
|
+
url: string;
|
|
4120
|
+
fetchImpl?: FetchLike;
|
|
4121
|
+
}
|
|
4122
|
+
interface PublishEpicStructureResult {
|
|
4123
|
+
duplicate: boolean;
|
|
4124
|
+
eventId: string;
|
|
4125
|
+
status: number;
|
|
4126
|
+
}
|
|
4127
|
+
/** The prod HQ worker is reachable at `hq.patronage.com` and its frozen
|
|
4128
|
+
* `-v1.*.workers.dev` alias. Emitting there without an Access service token is
|
|
4129
|
+
* fail-closed. */
|
|
4130
|
+
declare const isProductionHqUrl: (url: string) => boolean;
|
|
4131
|
+
/**
|
|
4132
|
+
* POSTs the event to HQ ingest. Fail-closed: a production URL without a
|
|
4133
|
+
* Cloudflare Access service token is refused before any request; a 401/403 is
|
|
4134
|
+
* surfaced with actionable guidance; any non-2xx throws.
|
|
4135
|
+
*/
|
|
4136
|
+
declare const publishEpicStructure: (args: PublishEpicStructureArgs) => Promise<PublishEpicStructureResult>;
|
|
4137
|
+
declare namespace boundary_manifest_d_exports {
|
|
4138
|
+
export { BOUNDARY_CLOSEOUT_DEFAULT_RUNG, BOUNDARY_MANIFEST_SCHEMA_VERSION, BoundaryManifest, BoundaryManifestExtraction, BoundaryManifestParse, FACTORY_BOUNDARY_FENCE_LANG, boundaryManifestSchema, closeoutRungFor, extractBoundaryManifestBlock, manifestContentHash, parseBoundaryManifest, rungMeetsMinimum, specContentHash };
|
|
4139
|
+
}
|
|
4140
|
+
declare const FACTORY_BOUNDARY_FENCE_LANG = "factory-boundary";
|
|
4141
|
+
declare const BOUNDARY_MANIFEST_SCHEMA_VERSION = 1;
|
|
4142
|
+
declare const BOUNDARY_CLOSEOUT_DEFAULT_RUNG: EvidenceReviewRung;
|
|
4143
|
+
declare const rungMeetsMinimum: (rung: EvidenceReviewRung, minimum: EvidenceReviewRung) => boolean;
|
|
4144
|
+
declare const boundaryManifestBaseSchema: z.ZodObject<{
|
|
4145
|
+
boundary: z.ZodString;
|
|
4146
|
+
closeout: z.ZodOptional<z.ZodObject<{
|
|
4147
|
+
review: z.ZodEnum<{
|
|
4148
|
+
oracle: "oracle";
|
|
4149
|
+
"independent-model": "independent-model";
|
|
4150
|
+
human: "human";
|
|
4151
|
+
}>;
|
|
4152
|
+
}, z.core.$loose>>;
|
|
4153
|
+
declaredBy: z.ZodString;
|
|
4154
|
+
prs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
4155
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
4156
|
+
topology: z.ZodEnum<{
|
|
4157
|
+
flagged: "flagged";
|
|
4158
|
+
"each-to-main": "each-to-main";
|
|
4159
|
+
stacked: "stacked";
|
|
4160
|
+
}>;
|
|
4161
|
+
waves: z.ZodArray<z.ZodObject<{
|
|
4162
|
+
autoMerge: z.ZodOptional<z.ZodBoolean>;
|
|
4163
|
+
issues: z.ZodArray<z.ZodNumber>;
|
|
4164
|
+
name: z.ZodString;
|
|
4165
|
+
review: z.ZodEnum<{
|
|
4166
|
+
oracle: "oracle";
|
|
4167
|
+
"independent-model": "independent-model";
|
|
4168
|
+
human: "human";
|
|
4169
|
+
}>;
|
|
4170
|
+
}, z.core.$loose>>;
|
|
4171
|
+
}, z.core.$loose>;
|
|
4172
|
+
declare const boundaryManifestSchema: z.ZodObject<{
|
|
4173
|
+
boundary: z.ZodString;
|
|
4174
|
+
closeout: z.ZodOptional<z.ZodObject<{
|
|
4175
|
+
review: z.ZodEnum<{
|
|
4176
|
+
oracle: "oracle";
|
|
4177
|
+
"independent-model": "independent-model";
|
|
4178
|
+
human: "human";
|
|
4179
|
+
}>;
|
|
4180
|
+
}, z.core.$loose>>;
|
|
4181
|
+
declaredBy: z.ZodString;
|
|
4182
|
+
prs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
4183
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
4184
|
+
topology: z.ZodEnum<{
|
|
4185
|
+
flagged: "flagged";
|
|
4186
|
+
"each-to-main": "each-to-main";
|
|
4187
|
+
stacked: "stacked";
|
|
4188
|
+
}>;
|
|
4189
|
+
waves: z.ZodArray<z.ZodObject<{
|
|
4190
|
+
autoMerge: z.ZodOptional<z.ZodBoolean>;
|
|
4191
|
+
issues: z.ZodArray<z.ZodNumber>;
|
|
4192
|
+
name: z.ZodString;
|
|
4193
|
+
review: z.ZodEnum<{
|
|
4194
|
+
oracle: "oracle";
|
|
4195
|
+
"independent-model": "independent-model";
|
|
4196
|
+
human: "human";
|
|
4197
|
+
}>;
|
|
4198
|
+
}, z.core.$loose>>;
|
|
4199
|
+
}, z.core.$loose>;
|
|
4200
|
+
type BoundaryManifest = z.infer<typeof boundaryManifestBaseSchema>;
|
|
4201
|
+
type BoundaryManifestExtraction = {
|
|
4202
|
+
ok: true;
|
|
4203
|
+
blockText: string;
|
|
4204
|
+
} | {
|
|
4205
|
+
ok: false;
|
|
4206
|
+
error: string;
|
|
4207
|
+
};
|
|
4208
|
+
declare const extractBoundaryManifestBlock: (issueBody: string) => BoundaryManifestExtraction;
|
|
4209
|
+
declare const manifestContentHash: (blockText: string) => string;
|
|
4210
|
+
declare const specContentHash: (issueBody: string) => string;
|
|
4211
|
+
type BoundaryManifestParse = {
|
|
4212
|
+
ok: true;
|
|
4213
|
+
manifest: BoundaryManifest;
|
|
4214
|
+
manifestHash: string;
|
|
4215
|
+
} | {
|
|
4216
|
+
ok: false;
|
|
4217
|
+
error: string;
|
|
4218
|
+
};
|
|
4219
|
+
declare const parseBoundaryManifest: (issueBody: string) => BoundaryManifestParse;
|
|
4220
|
+
declare const closeoutRungFor: (manifest: BoundaryManifest) => EvidenceReviewRung;
|
|
4221
|
+
//#endregion
|
|
4222
|
+
//#region src/review-focus.d.ts
|
|
4223
|
+
declare const REVIEW_FOCUS_SECTION = "Review focus";
|
|
4224
|
+
interface IssueReviewFocus {
|
|
4225
|
+
issueNumber: number;
|
|
4226
|
+
text: string;
|
|
4227
|
+
}
|
|
4228
|
+
declare const reviewFocusFromIssueBody: (body: string) => string | undefined;
|
|
4229
|
+
//#endregion
|
|
4230
|
+
//#region src/review-prompt.d.ts
|
|
4231
|
+
interface AssembleReviewPromptInput {
|
|
4232
|
+
base: string;
|
|
4233
|
+
changedFiles: string[];
|
|
4234
|
+
headSha: string;
|
|
4235
|
+
issueFocus?: IssueReviewFocus;
|
|
4236
|
+
kind: PrReviewKind;
|
|
4237
|
+
patchId: string;
|
|
4238
|
+
priorLedgerEntries?: FindingLedgerEntry[];
|
|
4239
|
+
profile: FactoryProjectProfile;
|
|
4240
|
+
standingChecklist?: readonly string[];
|
|
4241
|
+
}
|
|
4242
|
+
interface AssembledReviewPrompt {
|
|
4243
|
+
prompt: string;
|
|
4244
|
+
sections: ReviewPromptSection[];
|
|
4245
|
+
}
|
|
4246
|
+
declare const assembleReviewPrompt: ({
|
|
4247
|
+
base,
|
|
4248
|
+
changedFiles,
|
|
4249
|
+
headSha,
|
|
4250
|
+
issueFocus,
|
|
4251
|
+
kind,
|
|
4252
|
+
patchId,
|
|
4253
|
+
priorLedgerEntries,
|
|
4254
|
+
profile,
|
|
4255
|
+
standingChecklist
|
|
4256
|
+
}: AssembleReviewPromptInput) => AssembledReviewPrompt;
|
|
4257
|
+
//#endregion
|
|
4258
|
+
//#region src/review-ladder-trace.d.ts
|
|
4259
|
+
interface ReviewLadderTraceIdentity {
|
|
4260
|
+
issue?: number;
|
|
4261
|
+
pr?: number;
|
|
4262
|
+
repo: string;
|
|
4263
|
+
threadId?: string;
|
|
4264
|
+
workerId?: string;
|
|
4265
|
+
}
|
|
4266
|
+
interface ReviewLadderStageTraceWriteResult {
|
|
4267
|
+
errorMessage?: string;
|
|
4268
|
+
filePath?: string;
|
|
4269
|
+
mirrorDiagnostics: TraceMirrorDiagnostic[];
|
|
4270
|
+
ok: boolean;
|
|
4271
|
+
}
|
|
4272
|
+
declare const buildReviewLadderStageTraceEvent: ({
|
|
4273
|
+
createdAt,
|
|
4274
|
+
event,
|
|
4275
|
+
headSha,
|
|
4276
|
+
identity,
|
|
4277
|
+
patchId
|
|
4278
|
+
}: {
|
|
4279
|
+
createdAt?: string;
|
|
4280
|
+
event: ReviewLadderStageEvent;
|
|
4281
|
+
headSha?: string;
|
|
4282
|
+
identity: ReviewLadderTraceIdentity;
|
|
4283
|
+
patchId?: string;
|
|
4284
|
+
}) => FactoryTraceEvent;
|
|
4285
|
+
declare const appendReviewLadderStageTraceEvent: ({
|
|
4286
|
+
createdAt,
|
|
4287
|
+
event,
|
|
4288
|
+
headSha,
|
|
4289
|
+
identity,
|
|
4290
|
+
mirror,
|
|
4291
|
+
patchId,
|
|
4292
|
+
repoRoot
|
|
4293
|
+
}: {
|
|
4294
|
+
createdAt?: string;
|
|
4295
|
+
event: ReviewLadderStageEvent;
|
|
4296
|
+
headSha?: string;
|
|
4297
|
+
identity: ReviewLadderTraceIdentity;
|
|
4298
|
+
mirror?: TraceSink;
|
|
4299
|
+
patchId?: string;
|
|
4300
|
+
repoRoot: string;
|
|
4301
|
+
}) => AppendFactoryTraceEventResult;
|
|
4302
|
+
declare const tryAppendReviewLadderStageTraceEvent: (input: Parameters<typeof appendReviewLadderStageTraceEvent>[0]) => ReviewLadderStageTraceWriteResult;
|
|
4303
|
+
//#endregion
|
|
4304
|
+
//#region src/worker-checkout-guard.d.ts
|
|
4305
|
+
type CheckoutDirsProbe = (cwd: string) => {
|
|
4306
|
+
gitCommonDir: string;
|
|
4307
|
+
gitDir: string;
|
|
4308
|
+
};
|
|
4309
|
+
declare class WorkerCheckoutGuardError extends Error {
|
|
4310
|
+
constructor(message: string);
|
|
4311
|
+
}
|
|
4312
|
+
declare function assertWorkerCheckoutAllowed({
|
|
4313
|
+
cwd,
|
|
4314
|
+
operation,
|
|
4315
|
+
probe
|
|
4316
|
+
}: {
|
|
4317
|
+
cwd: string;
|
|
4318
|
+
operation: string;
|
|
4319
|
+
probe?: CheckoutDirsProbe;
|
|
4320
|
+
}): void;
|
|
4321
|
+
//#endregion
|
|
4322
|
+
//#region src/index.d.ts
|
|
4323
|
+
interface CreateProgramOptions {
|
|
4324
|
+
actions?: {
|
|
4325
|
+
boundaryCheck?: BoundaryCheckAction;
|
|
4326
|
+
canaryVerify?: CanaryVerifyAction;
|
|
4327
|
+
prMergeCheck?: PrMergeCheckAction;
|
|
4328
|
+
prPublish?: PrPublishAction;
|
|
4329
|
+
prReady?: PrReadyAction;
|
|
4330
|
+
prReview?: PrReviewAction;
|
|
4331
|
+
};
|
|
4332
|
+
factoryCliInvocation?: FactoryCliInvocation;
|
|
4333
|
+
output?: CliOutput;
|
|
4334
|
+
}
|
|
4335
|
+
declare function createProgram(options?: CreateProgramOptions): Command;
|
|
4336
|
+
declare function run(argv?: string[]): Promise<void>;
|
|
4337
|
+
//#endregion
|
|
4338
|
+
export { type AppendFactoryTraceEventResult, type AssembledReviewPrompt, type BoundaryCheckArgs, type BoundaryCheckDependencies, type BoundaryCheckProofRecord, type BuildEpicStructureEventInput, type BuildRetroEnvelopeInput, type CloudflareAccessServiceToken, CreateProgramOptions, DEFAULT_FACTORY_REPOSITORY, type DagDocument, EPIC_STRUCTURE_NODE_STATUSES, EPIC_STRUCTURE_SCHEMA_VERSION, type EpicStructureEvent, type EpicStructureGraphPayload, type EpicStructureNodeStatus, EpicStructureValidationError, type EvidenceEmitArgs, type EvidenceEmitDependencies, type EvidenceEmitResult, type FactoryCliInvocation, FactoryCliInvocationSchema, type FactoryProjectProfile, type FactoryTraceDiagnostic, type FactoryTraceEnvelope, type FactoryTraceEvent, type FindingDisposition, type FindingLedgerEntry, type FollowUpAction, FollowUpActionSchema, type IssueReviewFocus, type LadderDispositionDeclaration, type ParsedRetroEnvelope, type PrPublishArgs, type PrPublishDependencies, PrPublishFollowUpError, type PrPublishFollowUpOutcome, type PrPublishHandoff, type PrPublishResult, type PrReadyArgs, type PrReadyProof, type PublishEpicStructureArgs, type PublishEpicStructureResult, type PublishFollowUpPlan, RETRO_ENVELOPE_SCHEMA_VERSION, RETRO_ENVELOPE_VALIDATORS, REVIEW_FOCUS_SECTION, type RetroEnvelope, type ReviewGateNotRequiredProof, type ReviewGateTraceIdentity, type ReviewLadderCycle, type ReviewLadderEvaluation, type ReviewLadderPolicy, type ReviewLadderStageEvent, type ReviewLadderTraceIdentity, type ReviewPromptSection, type ReviewPromptSectionProvenance, SUPPORTED_RETRO_ENVELOPE_SCHEMA_VERSIONS, type ScanFactoryTraceDiagnosticsOptions, type ScanFactoryTraceOptions, type ScanFactoryTraceResult, type TraceMirrorDiagnostic, type TraceSink, type TraceWriteResult, type TraceWriteSinks, type VerificationReuse, WorkerCheckoutGuardError, type WorkerCloseoutLessonsTraceEvent, appendReviewLadderStageTraceEvent, appendWithTraceSinks, assembleReviewPrompt, assertWorkerCheckoutAllowed, blockingLadderFindings, boundary_manifest_d_exports as boundaryManifest, boundary_review_proof_d_exports as boundaryReviewProof, buildEpicStructureEvent, buildEpicStructurePayload, buildEvidenceEnvelope, buildRetroEnvelope, buildReviewGateNotRequiredTraceEvent, buildReviewLadderStageTraceEvent, comment_provenance_d_exports as commentProvenance, createLocalJsonlTraceSink, createProgram, doctorProjectProfile, epicStructureEventId, evaluateReviewLadder, evidenceEnvelopeFilename, findingKey, followUpFromArgv, inferFixedInThreadDispositions, isProductionHqUrl, isRetroEnvelopeWireComplete, loadProjectProfile, normalizeIssueComments, openLadderFindings, parseRetroEnvelope, planPublishFollowUp, worktree_held_branch_d_exports as prMergePreflight, pr_body_metadata_d_exports as prReadinessBodyMetadata, readiness_evaluation_d_exports as prReadinessEvaluation, external_evidence_d_exports as prReadinessExternalEvidence, merge_identity_d_exports as prReadinessMergeIdentity, post_readiness_comments_d_exports as prReadinessPostComments, 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, publishEpicStructure, readPrMergeCheckProof, readPrReadyProof, readPrReviewProof, resolveDocsOnlyReviewBypass, resolveFactoryRepository, resolveFindingBlocking, resolveReviewFindingCategory, resolveReviewFindingSeverity, resolveReviewLadderPolicy, resolveTraceWriteSinks, retroEnvelopeSchemaVersionOf, retroEnvelopeV1Schema, retroEpicReference, reviewCycleStateFor, reviewFocusFromIssueBody, reviewPromptSectionSchema, reviewPromptSectionsSchema, run, runBoundaryCheck, runEvidenceEmit, runPrMergeCheck, runPrPublish, runPrReady, runPrReview, runPrVerify, scanFactoryTraceDiagnostics, scanFactoryTraceEvents, staleRepeatLadderFindings, toFactoryTraceEnvelope, tryAppendReviewGateNotRequiredTraceEvent, tryAppendReviewLadderStageTraceEvent, validateBoundaryCheckProof, validateDagDocument, validateFactoryTraceEvent, validatePrMergeCheckProof, validatePrReadyProof, validatePrReviewProof, validatePrVerifyProof, worktree_scratch_files_d_exports as worktreeScratchFiles };
|