@patronage/software-factory 1.0.0-alpha.35 → 1.0.0-alpha.36
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/README.md +2 -0
- package/dist/{chunk-pbuEa-1d.js → chunk-DrSxFLj_.js} +1 -0
- package/dist/index.d.ts +285 -15
- package/dist/index.js +1774 -94
- package/dist/oxlint-jev/bridge-B4Sx95ZO.js +1007 -0
- package/dist/oxlint-jev/index.d.ts +6 -0
- package/dist/oxlint-jev/index.js +581 -0
- package/dist/oxlint-jev/worker.d.ts +1 -0
- package/dist/oxlint-jev/worker.js +49 -0
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -76,4 +76,6 @@ npx skills add https://github.com/patronage/software-factory -g --all
|
|
|
76
76
|
|
|
77
77
|
They provide procedure and link back to the documentation site; they are not a second command reference.
|
|
78
78
|
|
|
79
|
+
The package also exports an Oxlint plugin at `@patronage/software-factory/oxlint-jev`. It asks Jev questions that a project writes about its own code, through HQ, from a dedicated Oxlint config. It records by default and sends only with `PATRONAGE_JEV_MODE=live`. `psf jev:calibrate` scores those questions against the project's labeled cases. Both are session diagnostics, never gates. See [Ask Jev about code](https://factory.patronage.com/how-to/ask-jev-about-code).
|
|
80
|
+
|
|
79
81
|
`assembleReviewPrompt` puts a repository-root `CODING_STANDARDS.md` into the correctness prompt when the file exists and is not blank. It reads the file at the candidate head, not from the working tree, and emits one `coding-standards` section that names the head SHA. A repository without the file gets an unchanged prompt. `pr:review --assemble` writes that factory-owned prompt under `.factory-memory/pr-review-prompt.json`. `pr:review --findings` copies the recorded sections onto the proof when the artifact's patch-id matches.
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Command } from "commander";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { existsSync, readFileSync, rmSync } from "node:fs";
|
|
4
4
|
import { PreviewProofRegistration } from "@patronage/factory-ci";
|
|
5
|
+
import { JsonValue, Questions, SystemOneRequest, choice, noul, score } from "@typesafe-ai/sdk";
|
|
5
6
|
|
|
6
7
|
//#region src/review-rungs.d.ts
|
|
7
8
|
declare const EVIDENCE_REVIEW_RUNGS: readonly ["independent-model", "oracle", "human"];
|
|
@@ -1659,8 +1660,8 @@ declare const mergeFreezeStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1659
1660
|
generationId: z.ZodNumber;
|
|
1660
1661
|
headSha: z.ZodString;
|
|
1661
1662
|
outcome: z.ZodEnum<{
|
|
1662
|
-
active: "active";
|
|
1663
1663
|
stale: "stale";
|
|
1664
|
+
active: "active";
|
|
1664
1665
|
}>;
|
|
1665
1666
|
reason: z.ZodString;
|
|
1666
1667
|
recordedAt: z.ZodISODateTime;
|
|
@@ -1668,9 +1669,9 @@ declare const mergeFreezeStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1668
1669
|
verification: z.ZodOptional<z.ZodObject<{
|
|
1669
1670
|
jobs: z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
1670
1671
|
success: "success";
|
|
1672
|
+
skipped: "skipped";
|
|
1671
1673
|
failure: "failure";
|
|
1672
1674
|
cancelled: "cancelled";
|
|
1673
|
-
skipped: "skipped";
|
|
1674
1675
|
}>>;
|
|
1675
1676
|
runAttempt: z.ZodNumber;
|
|
1676
1677
|
runId: z.ZodNumber;
|
|
@@ -1687,9 +1688,9 @@ declare const mergeFreezeStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1687
1688
|
verification: z.ZodOptional<z.ZodObject<{
|
|
1688
1689
|
jobs: z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
1689
1690
|
success: "success";
|
|
1691
|
+
skipped: "skipped";
|
|
1690
1692
|
failure: "failure";
|
|
1691
1693
|
cancelled: "cancelled";
|
|
1692
|
-
skipped: "skipped";
|
|
1693
1694
|
}>>;
|
|
1694
1695
|
runAttempt: z.ZodNumber;
|
|
1695
1696
|
runId: z.ZodNumber;
|
|
@@ -1948,10 +1949,10 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
|
|
|
1948
1949
|
reviewedHeadSha: z.ZodOptional<z.ZodString>;
|
|
1949
1950
|
reviewedPatchId: z.ZodOptional<z.ZodString>;
|
|
1950
1951
|
status: z.ZodEnum<{
|
|
1951
|
-
stale: "stale";
|
|
1952
1952
|
"not-required": "not-required";
|
|
1953
1953
|
blocked: "blocked";
|
|
1954
1954
|
current: "current";
|
|
1955
|
+
stale: "stale";
|
|
1955
1956
|
missing: "missing";
|
|
1956
1957
|
}>;
|
|
1957
1958
|
}, z.core.$strip>;
|
|
@@ -1960,10 +1961,10 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
|
|
|
1960
1961
|
reviewedHeadSha: z.ZodOptional<z.ZodString>;
|
|
1961
1962
|
reviewedPatchId: z.ZodOptional<z.ZodString>;
|
|
1962
1963
|
status: z.ZodEnum<{
|
|
1963
|
-
stale: "stale";
|
|
1964
1964
|
"not-required": "not-required";
|
|
1965
1965
|
blocked: "blocked";
|
|
1966
1966
|
current: "current";
|
|
1967
|
+
stale: "stale";
|
|
1967
1968
|
missing: "missing";
|
|
1968
1969
|
}>;
|
|
1969
1970
|
}, z.core.$strip>>;
|
|
@@ -2933,10 +2934,10 @@ declare const loadEvidenceEnvelopes: (cwd: string) => LoadedEvidenceEnvelope[];
|
|
|
2933
2934
|
//#region src/review-proof-applicability.d.ts
|
|
2934
2935
|
declare const REVIEW_STATUS_VALUES: readonly ["not-required", "current", "stale", "missing", "blocked"];
|
|
2935
2936
|
declare const reviewStatusSchema: z.ZodEnum<{
|
|
2936
|
-
stale: "stale";
|
|
2937
2937
|
"not-required": "not-required";
|
|
2938
2938
|
blocked: "blocked";
|
|
2939
2939
|
current: "current";
|
|
2940
|
+
stale: "stale";
|
|
2940
2941
|
missing: "missing";
|
|
2941
2942
|
}>;
|
|
2942
2943
|
type ReviewStatus = z.infer<typeof reviewStatusSchema>;
|
|
@@ -3715,18 +3716,18 @@ declare const LegacyWorkerCloseoutStatusTraceEventSchema: z.ZodObject<{
|
|
|
3715
3716
|
threadId: z.ZodOptional<z.ZodString>;
|
|
3716
3717
|
workerId: z.ZodOptional<z.ZodString>;
|
|
3717
3718
|
archiveStatus: z.ZodOptional<z.ZodEnum<{
|
|
3718
|
-
skipped: "skipped";
|
|
3719
3719
|
unavailable: "unavailable";
|
|
3720
3720
|
archived: "archived";
|
|
3721
|
+
skipped: "skipped";
|
|
3721
3722
|
"not-applicable": "not-applicable";
|
|
3722
3723
|
pending: "pending";
|
|
3723
3724
|
}>>;
|
|
3724
3725
|
closeoutReason: z.ZodOptional<z.ZodString>;
|
|
3725
3726
|
eventType: z.ZodLiteral<"worker-closeout-lessons">;
|
|
3726
3727
|
lessonStatus: z.ZodOptional<z.ZodEnum<{
|
|
3727
|
-
skipped: "skipped";
|
|
3728
3728
|
captured: "captured";
|
|
3729
3729
|
unavailable: "unavailable";
|
|
3730
|
+
skipped: "skipped";
|
|
3730
3731
|
}>>;
|
|
3731
3732
|
lessonSummary: z.ZodOptional<z.ZodString>;
|
|
3732
3733
|
typeVersion: z.ZodLiteral<2>;
|
|
@@ -4113,18 +4114,18 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
|
|
|
4113
4114
|
threadId: z.ZodOptional<z.ZodString>;
|
|
4114
4115
|
workerId: z.ZodOptional<z.ZodString>;
|
|
4115
4116
|
archiveStatus: z.ZodOptional<z.ZodEnum<{
|
|
4116
|
-
skipped: "skipped";
|
|
4117
4117
|
unavailable: "unavailable";
|
|
4118
4118
|
archived: "archived";
|
|
4119
|
+
skipped: "skipped";
|
|
4119
4120
|
"not-applicable": "not-applicable";
|
|
4120
4121
|
pending: "pending";
|
|
4121
4122
|
}>>;
|
|
4122
4123
|
closeoutReason: z.ZodOptional<z.ZodString>;
|
|
4123
4124
|
eventType: z.ZodLiteral<"worker-closeout-lessons">;
|
|
4124
4125
|
lessonStatus: z.ZodOptional<z.ZodEnum<{
|
|
4125
|
-
skipped: "skipped";
|
|
4126
4126
|
captured: "captured";
|
|
4127
4127
|
unavailable: "unavailable";
|
|
4128
|
+
skipped: "skipped";
|
|
4128
4129
|
}>>;
|
|
4129
4130
|
lessonSummary: z.ZodOptional<z.ZodString>;
|
|
4130
4131
|
typeVersion: z.ZodLiteral<2>;
|
|
@@ -4154,17 +4155,17 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
|
|
|
4154
4155
|
}, z.core.$strict>], "lessonStatus">;
|
|
4155
4156
|
readonly 2: z.ZodObject<{
|
|
4156
4157
|
archiveStatus: z.ZodOptional<z.ZodEnum<{
|
|
4157
|
-
skipped: "skipped";
|
|
4158
4158
|
unavailable: "unavailable";
|
|
4159
4159
|
archived: "archived";
|
|
4160
|
+
skipped: "skipped";
|
|
4160
4161
|
"not-applicable": "not-applicable";
|
|
4161
4162
|
pending: "pending";
|
|
4162
4163
|
}>>;
|
|
4163
4164
|
closeoutReason: z.ZodOptional<z.ZodString>;
|
|
4164
4165
|
lessonStatus: z.ZodOptional<z.ZodEnum<{
|
|
4165
|
-
skipped: "skipped";
|
|
4166
4166
|
captured: "captured";
|
|
4167
4167
|
unavailable: "unavailable";
|
|
4168
|
+
skipped: "skipped";
|
|
4168
4169
|
}>>;
|
|
4169
4170
|
lessonSummary: z.ZodOptional<z.ZodString>;
|
|
4170
4171
|
observedAt: z.ZodString;
|
|
@@ -4852,13 +4853,13 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
|
|
|
4852
4853
|
reviews: {
|
|
4853
4854
|
correctness: {
|
|
4854
4855
|
required: boolean;
|
|
4855
|
-
status: "
|
|
4856
|
+
status: "not-required" | "blocked" | "current" | "stale" | "missing";
|
|
4856
4857
|
reviewedHeadSha?: string | undefined;
|
|
4857
4858
|
reviewedPatchId?: string | undefined;
|
|
4858
4859
|
};
|
|
4859
4860
|
security?: {
|
|
4860
4861
|
required: boolean;
|
|
4861
|
-
status: "
|
|
4862
|
+
status: "not-required" | "blocked" | "current" | "stale" | "missing";
|
|
4862
4863
|
reviewedHeadSha?: string | undefined;
|
|
4863
4864
|
reviewedPatchId?: string | undefined;
|
|
4864
4865
|
} | undefined;
|
|
@@ -5334,6 +5335,275 @@ declare function assertWorkerCheckoutAllowed({
|
|
|
5334
5335
|
probe?: CheckoutDirsProbe;
|
|
5335
5336
|
}): void;
|
|
5336
5337
|
//#endregion
|
|
5338
|
+
//#region src/jev/schema.d.ts
|
|
5339
|
+
/** The request body this package sends. No `model` field, ever: HQ names it. */
|
|
5340
|
+
type JevRequestBody = Pick<SystemOneRequest, "state" | "questions">;
|
|
5341
|
+
/**
|
|
5342
|
+
* One answer, discriminated exactly as Jev discriminates it.
|
|
5343
|
+
*
|
|
5344
|
+
* Every member is a *stripping* object: an unknown key inside one answer is
|
|
5345
|
+
* dropped, not an error. Erroring would let a single surprising field sink a
|
|
5346
|
+
* whole response, and keeping it would put an upstream-named field into a
|
|
5347
|
+
* record. Dropping is the only behavior that is both safe and non-destructive.
|
|
5348
|
+
*/
|
|
5349
|
+
declare const jevAnswerSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
5350
|
+
noul: z.ZodNumber;
|
|
5351
|
+
type: z.ZodLiteral<"noul">;
|
|
5352
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
5353
|
+
choice: z.ZodString;
|
|
5354
|
+
confidence: z.ZodNumber;
|
|
5355
|
+
probabilities: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
5356
|
+
type: z.ZodLiteral<"choice">;
|
|
5357
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
5358
|
+
confidence: z.ZodNumber;
|
|
5359
|
+
probabilities: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
5360
|
+
score: z.ZodNumber;
|
|
5361
|
+
type: z.ZodLiteral<"score">;
|
|
5362
|
+
}, z.core.$strip>], "type">;
|
|
5363
|
+
type JevAnswer = z.infer<typeof jevAnswerSchema>;
|
|
5364
|
+
interface JevUsage {
|
|
5365
|
+
input_tokens?: number;
|
|
5366
|
+
output_tokens?: number;
|
|
5367
|
+
}
|
|
5368
|
+
interface JevResponse {
|
|
5369
|
+
answers: Record<string, JevAnswer>;
|
|
5370
|
+
/** The model HQ ran, or `unknown` when what it returned is not an id. */
|
|
5371
|
+
model: string;
|
|
5372
|
+
usage?: JevUsage;
|
|
5373
|
+
}
|
|
5374
|
+
/** What a report says when HQ names its model in something other than an id. */
|
|
5375
|
+
declare const UNKNOWN_MODEL = "unknown";
|
|
5376
|
+
/**
|
|
5377
|
+
* A question set keyed by the names its answers come back under. Re-stated as a
|
|
5378
|
+
* value type so adapters can build one incrementally without importing the
|
|
5379
|
+
* SDK.
|
|
5380
|
+
*/
|
|
5381
|
+
type JevQuestions = Questions;
|
|
5382
|
+
type JevJsonValue = JsonValue;
|
|
5383
|
+
//#endregion
|
|
5384
|
+
//#region src/jev/cache.d.ts
|
|
5385
|
+
/**
|
|
5386
|
+
* The request-hash cache: the same request bytes against the same endpoint
|
|
5387
|
+
* answer from disk instead of from HQ.
|
|
5388
|
+
*
|
|
5389
|
+
* The key is the endpoint plus the exact serialized request, and nothing else.
|
|
5390
|
+
* That is the whole design: a changed snippet, a reworded question, a
|
|
5391
|
+
* different reference file and a different HQ all move the bytes, so they all
|
|
5392
|
+
* move the key. There is no key schema to keep in step with the request
|
|
5393
|
+
* builder, and no way to grow one that forgets a field.
|
|
5394
|
+
*
|
|
5395
|
+
* It lives under `node_modules/.cache`, which is disposable by convention and
|
|
5396
|
+
* already ignored everywhere — a Jev answer is a session diagnostic (ADR
|
|
5397
|
+
* 0034), not a build input and not evidence.
|
|
5398
|
+
*
|
|
5399
|
+
* An entry that exists but cannot be used — unreadable, not JSON, not Jev's
|
|
5400
|
+
* response shape — is an error, not a miss, and so is a write that fails. Only
|
|
5401
|
+
* `ENOENT` means "nothing is stored". Repairing any of the others silently and
|
|
5402
|
+
* calling HQ anyway would be a second behavior for one failure, and a paid
|
|
5403
|
+
* one; the run names the entry and its cause, and the operator removes it.
|
|
5404
|
+
*/
|
|
5405
|
+
/** A cache entry that could not be used, or could not be written. */
|
|
5406
|
+
declare class JevCacheError extends Error {
|
|
5407
|
+
readonly path: string;
|
|
5408
|
+
constructor(entryPath: string, detail: string);
|
|
5409
|
+
}
|
|
5410
|
+
/** Where a repository's Jev answers are kept. */
|
|
5411
|
+
declare const defaultJevCacheDirectory: (cwd: string) => string;
|
|
5412
|
+
interface JevCache {
|
|
5413
|
+
/** The entry key for these request bytes: endpoint plus the bytes, hashed. */
|
|
5414
|
+
keyFor: (serialized: string) => string;
|
|
5415
|
+
/** The stored answer, or `undefined` when nothing is stored. */
|
|
5416
|
+
read: (serialized: string) => JevResponse | undefined;
|
|
5417
|
+
write: (serialized: string, response: JevResponse) => void;
|
|
5418
|
+
}
|
|
5419
|
+
interface OpenJevCacheInput {
|
|
5420
|
+
/** Defaults to `node_modules/.cache/patronage-jev` under `cwd`. */
|
|
5421
|
+
directory?: string;
|
|
5422
|
+
/** The HQ Jev endpoint these answers came from. Part of every key. */
|
|
5423
|
+
endpoint: string;
|
|
5424
|
+
}
|
|
5425
|
+
/**
|
|
5426
|
+
* Opens the cache, creating its directory now so a directory that cannot be
|
|
5427
|
+
* written fails here — at the one place that names it — rather than midway
|
|
5428
|
+
* through a run as an unexplained request failure.
|
|
5429
|
+
*/
|
|
5430
|
+
declare const openJevCache: ({
|
|
5431
|
+
directory,
|
|
5432
|
+
endpoint
|
|
5433
|
+
}: OpenJevCacheInput) => JevCache;
|
|
5434
|
+
//#endregion
|
|
5435
|
+
//#region src/jev/client.d.ts
|
|
5436
|
+
/** Sends one prepared packet and returns Jev's body, plus the model HQ ran. */
|
|
5437
|
+
type JevEvaluate = (serializedBody: string) => Promise<JevResponse>;
|
|
5438
|
+
/**
|
|
5439
|
+
* Either a reachable HQ Jev route, or the one sentence saying why there is
|
|
5440
|
+
* none. A run takes this union rather than a bare `evaluate`, so "there are no
|
|
5441
|
+
* credentials" arrives at the caller in the same shape as "HQ refused": one
|
|
5442
|
+
* typed unavailable result naming its cause, never a throw and never a
|
|
5443
|
+
* silently skipped run.
|
|
5444
|
+
*/
|
|
5445
|
+
type JevGateway = {
|
|
5446
|
+
evaluate: JevEvaluate;
|
|
5447
|
+
endpoint: string;
|
|
5448
|
+
status: "ready";
|
|
5449
|
+
} /** No call is possible. Every match is unavailable with this reason. */ | {
|
|
5450
|
+
reason: string;
|
|
5451
|
+
status: "unavailable";
|
|
5452
|
+
};
|
|
5453
|
+
/**
|
|
5454
|
+
* An upstream refusal, carried with the code HQ passed through rather than
|
|
5455
|
+
* flattened into prose. `max_tokens_exceeded` is the one a caller acts on: it
|
|
5456
|
+
* means the packet was too large despite the local budget.
|
|
5457
|
+
*/
|
|
5458
|
+
declare class JevRequestError extends Error {
|
|
5459
|
+
readonly code: string | undefined;
|
|
5460
|
+
readonly httpStatus: number;
|
|
5461
|
+
constructor(httpStatus: number, code: string | undefined, message: string);
|
|
5462
|
+
}
|
|
5463
|
+
interface ResolveJevGatewayInput {
|
|
5464
|
+
env: NodeJS.ProcessEnv;
|
|
5465
|
+
fetchImpl?: typeof fetch;
|
|
5466
|
+
}
|
|
5467
|
+
/**
|
|
5468
|
+
* Resolves the gateway, or says why there isn't one. Every `unavailable`
|
|
5469
|
+
* reason is an operator-facing sentence naming a remedy that applies to this
|
|
5470
|
+
* command, and none of them can carry a credential: nothing here reads a
|
|
5471
|
+
* resolved value into a message.
|
|
5472
|
+
*
|
|
5473
|
+
* The order is the policy. The origin is checked against HQ ingest's protocol
|
|
5474
|
+
* rule and the operator's `hqAllowedOrigins` first, and only an authorized
|
|
5475
|
+
* origin gets as far as reading credentials. An unauthorized origin never sees
|
|
5476
|
+
* a request.
|
|
5477
|
+
*/
|
|
5478
|
+
declare const resolveJevGateway: ({
|
|
5479
|
+
env,
|
|
5480
|
+
fetchImpl
|
|
5481
|
+
}: ResolveJevGatewayInput) => Promise<JevGateway>;
|
|
5482
|
+
//#endregion
|
|
5483
|
+
//#region src/jev/request.d.ts
|
|
5484
|
+
interface JevMatch {
|
|
5485
|
+
/**
|
|
5486
|
+
* Stable across splitting. Question names must already namespace it, so
|
|
5487
|
+
* moving a match into a later split never rewrites a question or an answer
|
|
5488
|
+
* name.
|
|
5489
|
+
*/
|
|
5490
|
+
key: string;
|
|
5491
|
+
/** Answer-name-keyed questions about this match. */
|
|
5492
|
+
questions: JevQuestions;
|
|
5493
|
+
/** Match-local state, published at `matches.<key>` of the request. */
|
|
5494
|
+
state: JevJsonValue;
|
|
5495
|
+
}
|
|
5496
|
+
interface JevFile {
|
|
5497
|
+
matches: readonly JevMatch[];
|
|
5498
|
+
/** Repository-relative path. Identity of the shared state, and sent with it. */
|
|
5499
|
+
path: string;
|
|
5500
|
+
/** State every match in this file is read against, sent once per request. */
|
|
5501
|
+
shared: JevJsonValue;
|
|
5502
|
+
}
|
|
5503
|
+
interface JevRequest {
|
|
5504
|
+
/** The parsed body, for a caller that records a request without sending it. */
|
|
5505
|
+
body: JevRequestBody;
|
|
5506
|
+
estimatedTokens: number;
|
|
5507
|
+
/** SHA-256 of `serialized` — the exact bytes that would be sent. */
|
|
5508
|
+
hash: string;
|
|
5509
|
+
matchKeys: string[];
|
|
5510
|
+
/** The file this request asks about. */
|
|
5511
|
+
path: string;
|
|
5512
|
+
/** The bytes to POST. Serialized once so the hash cannot drift from them. */
|
|
5513
|
+
serialized: string;
|
|
5514
|
+
}
|
|
5515
|
+
interface JevUnavailableMatch {
|
|
5516
|
+
key: string;
|
|
5517
|
+
reason: string;
|
|
5518
|
+
}
|
|
5519
|
+
interface JevRequestPlan {
|
|
5520
|
+
requests: JevRequest[];
|
|
5521
|
+
unavailable: JevUnavailableMatch[];
|
|
5522
|
+
}
|
|
5523
|
+
interface BuildJevRequestsInput {
|
|
5524
|
+
/** Per-request ceiling override, in tokens. Defaults to the budget above. */
|
|
5525
|
+
budgetTokens?: number;
|
|
5526
|
+
files: readonly JevFile[];
|
|
5527
|
+
}
|
|
5528
|
+
/**
|
|
5529
|
+
* Turns files into the requests that will be sent, plus the matches that
|
|
5530
|
+
* cannot be sent and why. Pure: it performs no I/O and decides nothing about
|
|
5531
|
+
* transport.
|
|
5532
|
+
*/
|
|
5533
|
+
declare const buildJevRequests: ({
|
|
5534
|
+
budgetTokens,
|
|
5535
|
+
files
|
|
5536
|
+
}: BuildJevRequestsInput) => JevRequestPlan;
|
|
5537
|
+
//#endregion
|
|
5538
|
+
//#region src/jev/run.d.ts
|
|
5539
|
+
/**
|
|
5540
|
+
* Sending a file's requests and recording exactly what happened.
|
|
5541
|
+
*
|
|
5542
|
+
* A Jev run is a session diagnostic (ADR 0034): it owns no gate and no demand,
|
|
5543
|
+
* so a failed request is data, not a stop. One request failing never erases
|
|
5544
|
+
* the answers a sibling request already returned, and every match that did not
|
|
5545
|
+
* get an answer says why — including when the failure was that there was no
|
|
5546
|
+
* gateway to call at all.
|
|
5547
|
+
*
|
|
5548
|
+
* Every failure has exactly one behavior: the affected matches become
|
|
5549
|
+
* unavailable, named with their cause. Nothing is retried, nothing is
|
|
5550
|
+
* truncated to fit, and no result is dropped to keep a run tidy.
|
|
5551
|
+
*/
|
|
5552
|
+
/** What one request did. Recorded whether it succeeded, failed, or was cached. */
|
|
5553
|
+
interface JevRequestRecord {
|
|
5554
|
+
/** True when the answer came from the request-hash cache; no HQ call was made. */
|
|
5555
|
+
cached: boolean;
|
|
5556
|
+
elapsedMs: number;
|
|
5557
|
+
/** Set when the request failed; the reason, in operator-facing prose. */
|
|
5558
|
+
error?: string;
|
|
5559
|
+
/** The upstream code, when HQ passed one through (`max_tokens_exceeded`). */
|
|
5560
|
+
errorCode?: string;
|
|
5561
|
+
estimatedTokens: number;
|
|
5562
|
+
matchKeys: string[];
|
|
5563
|
+
/** The model HQ reported actually running. Absent on a failed request. */
|
|
5564
|
+
model?: string;
|
|
5565
|
+
/** The file this request asked about. */
|
|
5566
|
+
path: string;
|
|
5567
|
+
/** SHA-256 of the exact request bytes. */
|
|
5568
|
+
requestHash: string;
|
|
5569
|
+
usage?: JevUsage;
|
|
5570
|
+
}
|
|
5571
|
+
/** Whether the run got answers for everything it set out to ask about. */
|
|
5572
|
+
type JevCompletion = "complete" | "partial" | "unavailable";
|
|
5573
|
+
interface JevRunResult {
|
|
5574
|
+
/** Answers per match, keyed by that match's own question names. */
|
|
5575
|
+
answersByMatchKey: Record<string, Record<string, JevAnswer>>;
|
|
5576
|
+
completion: JevCompletion;
|
|
5577
|
+
/** Wall-clock time spent on requests, including cache reads. */
|
|
5578
|
+
elapsedMs: number;
|
|
5579
|
+
/** Distinct models HQ reported, in first-seen order. */
|
|
5580
|
+
models: string[];
|
|
5581
|
+
requests: JevRequestRecord[];
|
|
5582
|
+
/** Why a match has no answers. Every unanswered match appears here. */
|
|
5583
|
+
unavailableByMatchKey: Record<string, string>;
|
|
5584
|
+
}
|
|
5585
|
+
interface RunJevFilesInput {
|
|
5586
|
+
budgetTokens?: number;
|
|
5587
|
+
/** Omitted means every request is sent live. */
|
|
5588
|
+
cache?: JevCache;
|
|
5589
|
+
files: readonly JevFile[];
|
|
5590
|
+
gateway: JevGateway;
|
|
5591
|
+
}
|
|
5592
|
+
/**
|
|
5593
|
+
* Builds the requests, sends the ones the cache does not already answer, and
|
|
5594
|
+
* routes answers back to the matches that asked for them.
|
|
5595
|
+
*
|
|
5596
|
+
* Requests go one at a time. Bounded load is the point: a repository-wide run
|
|
5597
|
+
* would otherwise open dozens of concurrent 32k-token requests against one HQ
|
|
5598
|
+
* route for a diagnostic nothing is waiting on.
|
|
5599
|
+
*/
|
|
5600
|
+
declare const runJevFiles: ({
|
|
5601
|
+
budgetTokens,
|
|
5602
|
+
cache,
|
|
5603
|
+
files,
|
|
5604
|
+
gateway
|
|
5605
|
+
}: RunJevFilesInput) => Promise<JevRunResult>;
|
|
5606
|
+
//#endregion
|
|
5337
5607
|
//#region src/index.d.ts
|
|
5338
5608
|
interface CreateProgramOptions {
|
|
5339
5609
|
actions?: {
|
|
@@ -5356,4 +5626,4 @@ declare function createProgram(options?: CreateProgramOptions): Command;
|
|
|
5356
5626
|
*/
|
|
5357
5627
|
declare function run(argv?: string[], cliEntry?: string): Promise<void>;
|
|
5358
5628
|
//#endregion
|
|
5359
|
-
export { type AppendFactoryTraceEventResult, type AssembledReviewPrompt, type BatteryCommandDisposition, type BatteryDisposition, type BoundaryCheckArgs, type BoundaryCheckDependencies, type BoundaryCheckProofRecord, type BuildEpicStructureEventInput, type CloudflareAccessServiceToken, type CompletedFactoryCheckSnapshot, CreateProgramOptions, DEFAULT_DEMAND_WAIVER_PATH, DEFAULT_FACTORY_REPOSITORY, DEFAULT_ROOT_SHARED_GLOBS, type DagDocument, type DemandWaiveArgs, type DemandWaiveDependencies, DemandWaiveRefusalError, type DemandWaiver, type DemandWaiverStore, EMPTY_TREE_OBJECT_HASH, EPIC_STRUCTURE_NODE_STATUSES, EPIC_STRUCTURE_SCHEMA_VERSION, type EpicStructureEvent, type EpicStructureGraphPayload, type EpicStructureNodeStatus, EpicStructureValidationError, type EvidenceEmitArgs, type EvidenceEmitDependencies, type EvidenceEmitResult, FACTORY_BASE_REF_ENV, FACTORY_CHANGED_FILES_ENV, FACTORY_CHANGED_FILES_FILE_ENV, type FactoryCliInvocation, FactoryCliInvocationSchema, type FactoryPrStatusCheckName, type FactoryPrStatusSources, type FactoryProjectProfile, type FactoryTraceDiagnostic, type FactoryTraceEnvelope, type FactoryTraceEvent, type FollowUpAction, FollowUpActionSchema, type GitHubCheckRunMergeFreezeApi, type ImpactScopeDecision, type ImpactScopeSurface, type IssueReviewFocus, MERGE_FREEZE_APP_SLUG, MERGE_FREEZE_CHECK_NAME, type MergeFreezeAuthority, type MergeFreezeGeneration, type MergeFreezeState, type MergeFreezeStoreInput, type PlanFactoryPrStatusHudInput, type PrPublishArgs, type PrPublishDependencies, PrPublishFollowUpError, type PrPublishFollowUpOutcome, type PrPublishHandoff, type PrPublishResult, type PrReadyArgs, type PrReadyProof, type PrVerifyProof, type PresentFactoryPrStatusHudDependencies, type PresentFactoryPrStatusHudInput, type PreviewDisposition, type PreviewLifecyclePlan, type PreviewTargetPlan, type PublishEpicStructureArgs, type PublishEpicStructureResult, type PublishFollowUpPlan, REVIEW_FOCUS_SECTION, type ReadFactoryPrStatusSourcesDependencies, type ReadFactoryPrStatusSourcesInput, type RefreshFactoryPrStatusHudInput, type RenderFactoryPrStatusHudInput, type ReviewGateNotRequiredProof, type ReviewGateTraceIdentity, type ReviewPromptSection, type ReviewPromptSectionProvenance, type ScanFactoryTraceDiagnosticsOptions, type ScanFactoryTraceOptions, type ScanFactoryTraceResult, type ScopedOutCommand, type TraceMirrorDiagnostic, type TraceSink, type TraceWriteResult, type TraceWriteSinks, type VerificationBatteryPlan, type VerificationReuse, type VerificationRunContext, type VerificationRunContextInput, type WaivedDemand, WorkerCheckoutGuardError, type WorkerCloseoutLessonsTraceEvent, appendWithTraceSinks, applyDemandWaiver, assembleReviewPrompt, assertFactoryPrStatusIdentity, assertWorkerCheckoutAllowed, authorizeDemandWaiver, batteryScopeSummaryLines, boundary_manifest_d_exports as boundaryManifest, boundary_review_proof_d_exports as boundaryReviewProof, buildEpicStructureEvent, buildEpicStructurePayload, buildEvidenceEnvelope, buildReviewGateNotRequiredTraceEvent, comment_provenance_d_exports as commentProvenance, createGitHubCheckRunMergeFreezeStore, createLocalJsonlTraceSink, createProgram, createVerificationRunContext, doctorProjectProfile, epicStructureEventId, evidenceEnvelopeFilename, followUpFromArgv, impactStampScopeDecision, isProductionHqUrl, loadProjectProfile, normalizeIssueComments, planFactoryPrStatusHud, planPreviewLifecycle, planPublishFollowUp, planVerificationBattery, readiness_evaluation_d_exports as prReadinessEvaluation, external_evidence_d_exports as prReadinessExternalEvidence, pr_body_renderer_d_exports as prReadinessPrBodyRenderer, proof_identity_d_exports as prReadinessProofIdentity, review_proof_d_exports as prReadinessReviewProof, status_check_rollup_d_exports as prReadinessStatusChecks, verification_proof_d_exports as prReadinessVerificationProof, presentFactoryPrStatusHud, previewLifecycleTargets, publishEpicStructure, readDemandWaivers, readFactoryPrStatusSources, readPrReadyProof, refreshFactoryPrStatusHud, refreshFactoryPrStatusHudSafely, renderFactoryPrStatusHud, resolveFactoryRepository, resolveTraceWriteSinks, reviewFocusFromIssueBody, reviewPromptSectionSchema, reviewPromptSectionsSchema, run, runBoundaryCheck, runDemandWaive, runEvidenceEmit, runPrPublish, runPrReady, runPrReview, runPrVerify, scanFactoryTraceDiagnostics, scanFactoryTraceEvents, selectWaiversForCandidate, toFactoryTraceEnvelope, tryAppendReviewGateNotRequiredTraceEvent, validateBoundaryCheckProof, validateDagDocument, validateDemandWaiverStore, validateFactoryTraceEvent, validateMergeFreezeState, validatePrReadyProof, validatePrVerifyProof, validatePreviewLifecyclePlan, waivedDemandNotice, waivedDemandSchema, worktree_scratch_files_d_exports as worktreeScratchFiles };
|
|
5629
|
+
export { type AppendFactoryTraceEventResult, type AssembledReviewPrompt, type BatteryCommandDisposition, type BatteryDisposition, type BoundaryCheckArgs, type BoundaryCheckDependencies, type BoundaryCheckProofRecord, type BuildEpicStructureEventInput, type CloudflareAccessServiceToken, type CompletedFactoryCheckSnapshot, CreateProgramOptions, DEFAULT_DEMAND_WAIVER_PATH, DEFAULT_FACTORY_REPOSITORY, DEFAULT_ROOT_SHARED_GLOBS, type DagDocument, type DemandWaiveArgs, type DemandWaiveDependencies, DemandWaiveRefusalError, type DemandWaiver, type DemandWaiverStore, EMPTY_TREE_OBJECT_HASH, EPIC_STRUCTURE_NODE_STATUSES, EPIC_STRUCTURE_SCHEMA_VERSION, type EpicStructureEvent, type EpicStructureGraphPayload, type EpicStructureNodeStatus, EpicStructureValidationError, type EvidenceEmitArgs, type EvidenceEmitDependencies, type EvidenceEmitResult, FACTORY_BASE_REF_ENV, FACTORY_CHANGED_FILES_ENV, FACTORY_CHANGED_FILES_FILE_ENV, type FactoryCliInvocation, FactoryCliInvocationSchema, type FactoryPrStatusCheckName, type FactoryPrStatusSources, type FactoryProjectProfile, type FactoryTraceDiagnostic, type FactoryTraceEnvelope, type FactoryTraceEvent, type FollowUpAction, FollowUpActionSchema, type GitHubCheckRunMergeFreezeApi, type ImpactScopeDecision, type ImpactScopeSurface, type IssueReviewFocus, type JevAnswer, type JevCache, JevCacheError, type JevCompletion, type JevEvaluate, type JevFile, type JevGateway, type JevJsonValue, type JevMatch, type JevQuestions, type JevRequest, JevRequestError, type JevRequestPlan, type JevRequestRecord, type JevResponse, type JevRunResult, type JevUnavailableMatch, type JevUsage, MERGE_FREEZE_APP_SLUG, MERGE_FREEZE_CHECK_NAME, type MergeFreezeAuthority, type MergeFreezeGeneration, type MergeFreezeState, type MergeFreezeStoreInput, type PlanFactoryPrStatusHudInput, type PrPublishArgs, type PrPublishDependencies, PrPublishFollowUpError, type PrPublishFollowUpOutcome, type PrPublishHandoff, type PrPublishResult, type PrReadyArgs, type PrReadyProof, type PrVerifyProof, type PresentFactoryPrStatusHudDependencies, type PresentFactoryPrStatusHudInput, type PreviewDisposition, type PreviewLifecyclePlan, type PreviewTargetPlan, type PublishEpicStructureArgs, type PublishEpicStructureResult, type PublishFollowUpPlan, REVIEW_FOCUS_SECTION, type ReadFactoryPrStatusSourcesDependencies, type ReadFactoryPrStatusSourcesInput, type RefreshFactoryPrStatusHudInput, type RenderFactoryPrStatusHudInput, type ReviewGateNotRequiredProof, type ReviewGateTraceIdentity, type ReviewPromptSection, type ReviewPromptSectionProvenance, type ScanFactoryTraceDiagnosticsOptions, type ScanFactoryTraceOptions, type ScanFactoryTraceResult, type ScopedOutCommand, type TraceMirrorDiagnostic, type TraceSink, type TraceWriteResult, type TraceWriteSinks, UNKNOWN_MODEL, type VerificationBatteryPlan, type VerificationReuse, type VerificationRunContext, type VerificationRunContextInput, type WaivedDemand, WorkerCheckoutGuardError, type WorkerCloseoutLessonsTraceEvent, appendWithTraceSinks, applyDemandWaiver, assembleReviewPrompt, assertFactoryPrStatusIdentity, assertWorkerCheckoutAllowed, authorizeDemandWaiver, batteryScopeSummaryLines, boundary_manifest_d_exports as boundaryManifest, boundary_review_proof_d_exports as boundaryReviewProof, buildEpicStructureEvent, buildEpicStructurePayload, buildEvidenceEnvelope, buildJevRequests, buildReviewGateNotRequiredTraceEvent, choice, comment_provenance_d_exports as commentProvenance, createGitHubCheckRunMergeFreezeStore, createLocalJsonlTraceSink, createProgram, createVerificationRunContext, defaultJevCacheDirectory, doctorProjectProfile, epicStructureEventId, evidenceEnvelopeFilename, followUpFromArgv, impactStampScopeDecision, isProductionHqUrl, loadProjectProfile, normalizeIssueComments, noul, openJevCache, planFactoryPrStatusHud, planPreviewLifecycle, planPublishFollowUp, planVerificationBattery, readiness_evaluation_d_exports as prReadinessEvaluation, external_evidence_d_exports as prReadinessExternalEvidence, pr_body_renderer_d_exports as prReadinessPrBodyRenderer, proof_identity_d_exports as prReadinessProofIdentity, review_proof_d_exports as prReadinessReviewProof, status_check_rollup_d_exports as prReadinessStatusChecks, verification_proof_d_exports as prReadinessVerificationProof, presentFactoryPrStatusHud, previewLifecycleTargets, publishEpicStructure, readDemandWaivers, readFactoryPrStatusSources, readPrReadyProof, refreshFactoryPrStatusHud, refreshFactoryPrStatusHudSafely, renderFactoryPrStatusHud, resolveFactoryRepository, resolveJevGateway, resolveTraceWriteSinks, reviewFocusFromIssueBody, reviewPromptSectionSchema, reviewPromptSectionsSchema, run, runBoundaryCheck, runDemandWaive, runEvidenceEmit, runJevFiles, runPrPublish, runPrReady, runPrReview, runPrVerify, scanFactoryTraceDiagnostics, scanFactoryTraceEvents, score, selectWaiversForCandidate, toFactoryTraceEnvelope, tryAppendReviewGateNotRequiredTraceEvent, validateBoundaryCheckProof, validateDagDocument, validateDemandWaiverStore, validateFactoryTraceEvent, validateMergeFreezeState, validatePrReadyProof, validatePrVerifyProof, validatePreviewLifecyclePlan, waivedDemandNotice, waivedDemandSchema, worktree_scratch_files_d_exports as worktreeScratchFiles };
|