bareloop 0.8.0 → 0.10.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.
@@ -0,0 +1,559 @@
1
+ /**
2
+ * THE CEILING (hamr, 2026-08-08, *"yes to both, go"*): the picked class is a
3
+ * PROMISE, and this is what the composition actually demands.
4
+ *
5
+ * Every kind carries the class of verdict it can honestly render, so a
6
+ * declaration's ceiling is the HIGHEST class any of its stages needs. A pick
7
+ * below that ceiling is a silent UPGRADE — a judgment ruler running under a
8
+ * green promise, which is exactly the fake-hard verdict `CLASS_BY_CLOSE` and
9
+ * `CLASS_BY_VERDICT` exist to stop, defeated from ABOVE by never letting the
10
+ * illegal pair be formed.
11
+ *
12
+ * INERT IN v1 BY CONSTRUCTION, which is why it is cheap now: every LIVE kind is
13
+ * mechanical, so no declaration a v1 catalogue can express reaches above green.
14
+ * It is written before the second class exists so the first soft-green kind is
15
+ * not the thing that discovers the question.
16
+ *
17
+ * A kind the catalogue does not know contributes NOTHING — it already carries an
18
+ * `unknown-kind` red, and guessing a class for it would be deriving the promise
19
+ * from a typo. A catalogue entry with no class at all THROWS: the catalogue is
20
+ * OURS, and failing loudly beats weighing a kind whose honesty nobody stated.
21
+ * @param {any} declaration
22
+ * @param {Record<string, KindSpec>} [catalogue]
23
+ * @returns {{class: string, kind: string, stage: string|null, locked: boolean}|null}
24
+ */
25
+ export function closeCeiling(declaration: any, catalogue?: Record<string, KindSpec>): {
26
+ class: string;
27
+ kind: string;
28
+ stage: string | null;
29
+ locked: boolean;
30
+ } | null;
31
+ /**
32
+ * Which kinds can carry an environment at all, read off the CATALOGUE rather
33
+ * than a hand-kept list. ONE spelling, because two consumers must agree
34
+ * EXACTLY: `applyGenreEnv` injects the genre's variable into these stages and
35
+ * nowhere else, and the validator's completeness rule demands it on these
36
+ * stages and nowhere else. A second copy that drifted either way is a hole —
37
+ * stages injected but unchecked, or stages checked for what nothing injects.
38
+ * @param {string} kind @param {Record<string, KindSpec>} [catalogue]
39
+ */
40
+ export function envCapableKind(kind: string, catalogue?: Record<string, KindSpec>): boolean;
41
+ /**
42
+ * The floor's decision for one declared `cmd`, as a reason or null.
43
+ *
44
+ * NORMALISATION FIRST, because that is where the dodge lives: `/usr/bin/rm`
45
+ * carries the same program as `rm` and only a basename read taken AFTER
46
+ * splitting the path can see it. Case is folded for the same reason.
47
+ *
48
+ * A cmd naming a program OUTSIDE the repository — an absolute path, or one that
49
+ * climbs out with `..` — is refused whatever its basename says. Two reasons, and
50
+ * both are the fail-safe direction: the validator has no repository in hand at
51
+ * every call site (the job validator judges a signed spec with no tree), so
52
+ * "outside" cannot be decided per-machine; and a machine-absolute path inside a
53
+ * SIGNED artefact grades a different machine than the one it was signed on.
54
+ * @param {string} cmd @returns {string|null}
55
+ */
56
+ export function deniedCommandReason(cmd: string): string | null;
57
+ /**
58
+ * The picked class's mandatory guards, FULLY ENUMERATED (D13 forward-compat
59
+ * point 3: an omittable-with-a-default field is the omitted-`tools` shape, where
60
+ * widening changes what runs without changing what was signed — so the guards
61
+ * are stored spelled out, and the hash is taken over the resolved form).
62
+ *
63
+ * `fill` names the ONLY slot the model supplies. `changed-from-seed`'s
64
+ * allowPrefixes is the job's own target scope and cannot be ours; everything
65
+ * else — including `no-suppressions`' absent scope — is.
66
+ *
67
+ * AN EMPTY BATTERY IS IMPOSSIBLE for a known class and a known language, and
68
+ * that is enforced rather than asserted: an unknown class, a locked class, an
69
+ * unknown language, a battery that resolved to nothing, and a composed param
70
+ * that resolved to nothing all THROW. F59's shape at the load-bearing decision
71
+ * of the design — a suppression scan with no patterns reads clean exactly like
72
+ * one that scanned correctly, and it lands in a SIGNED artefact.
73
+ *
74
+ * Returns a fresh deep copy each call: a frozen constant handed to a caller that
75
+ * edits it is one shared battery away from a silently weakened guard.
76
+ * @param {{verdictType: string, lang: string}} o
77
+ * @returns {{name: string, kind: string, params: Record<string, any>, compose: string[], fill: string[]}[]}
78
+ */
79
+ export function classGuards({ verdictType, lang }: {
80
+ verdictType: string;
81
+ lang: string;
82
+ }): {
83
+ name: string;
84
+ kind: string;
85
+ params: Record<string, any>;
86
+ compose: string[];
87
+ fill: string[];
88
+ }[];
89
+ /**
90
+ * The genre's environment for this patient — ours to inject at execution (M3),
91
+ * never model-authored. An entry with no value produces NO VARIABLE: an empty
92
+ * `MYPYPATH` is not the same instruction as an unset one, and shipping `''`
93
+ * would silently change how mypy resolves.
94
+ * @param {string} lang
95
+ * @param {{sourcePrefixes?: string[]}} [o]
96
+ * @returns {Record<string, string>}
97
+ */
98
+ export function genreEnv(lang: string, { sourcePrefixes }?: {
99
+ sourcePrefixes?: string[];
100
+ }): Record<string, string>;
101
+ /** The names the genre OWNS — the validator refuses a declaration that authors
102
+ * one of them, because ownership is only real if it is mechanical.
103
+ * @param {string} lang @returns {string[]} */
104
+ export function genreOwnedEnvNames(lang: string): string[];
105
+ /**
106
+ * HOW THE GENRE'S OWN TOOLS PRINT — genre property, like the suppression battery
107
+ * and like `MYPYPATH`, and for the same reason: it is a FACT ABOUT AN INSTRUMENT
108
+ * WE ALREADY OWN, not a composition choice. Seven hand-written closes read tsc
109
+ * with the identical `/error TS\d+/` (`scripts/u-pulselog-close.mjs:122`,
110
+ * `u-bareguard-close.mjs:123`, `u-bareagent-close.mjs:123`,
111
+ * `u-baremobile-close.mjs:122`, `u-litectx-close.mjs:140`, `types-close.mjs:190`,
112
+ * `types-check.mjs:60`) and one reads mypy with `' error: '`
113
+ * (`u-spawner-close.mjs:133`) — the same provenance the SUPPRESSIONS table has:
114
+ * operator knowledge minted by paying for live runs.
115
+ *
116
+ * WHY IT BECAME GENRE DATA (run msmbpjk6, 2026-08-09, $0.43). Left to the model,
117
+ * the parser for a known tool is a DRAFT-TIME LOTTERY on a fact nobody needed to
118
+ * guess: that run composed tsc's TTY-only pretty shape
119
+ * (`^\S+\.js:\d+:\d+ - error TS\d+:`), which matched 0 of the 67 real error lines
120
+ * the piped run actually printed, while the tool exited 2. The gates held — the
121
+ * stage read as a crashed instrument and signing was refused, correctly — but the
122
+ * refusal cost a whole authoring run to learn something the tree already knew. An
123
+ * earlier run (mslwbkz7) happened to roll the right shape. A coin-flip on an
124
+ * owned fact is not a capability question.
125
+ *
126
+ * WHAT THIS IS NOT: it does not close the parser. A stage counting something we
127
+ * have NOT measured still writes its own pattern, and that remains a real gap —
128
+ * named, not smoothed. This table is where a measured instrument fact lands, one
129
+ * at a time, with its provenance.
130
+ *
131
+ * THE TEST-COUNT FACTS (2026-08-13) landed under exactly that rule, and closed
132
+ * two of the three gaps the paragraph above used to name by hand: the executed
133
+ * count and the failure line, for both runners, are now measured facts rather
134
+ * than draft-time lotteries. Provenance rides on each entry.
135
+ *
136
+ * WHAT STAYED OUT, deliberately, because no evidence covers it:
137
+ * - a pytest FAIL-COUNT figure. A green pytest run omits the segment entirely
138
+ * (`1 passed in 0.04s`), so a figure term over it reports "never reported" on
139
+ * precisely the runs that went well. Failures are counted with the `^FAILED `
140
+ * tally instead, where no match IS zero.
141
+ * - a pytest EXECUTED count. `collected N items` is printed under `-ra` and NOT
142
+ * under `-q` (measured both ways), so no single spelling survives the modes a
143
+ * patient may configure; a stage needing it still composes its own and says so.
144
+ *
145
+ * Returns a fresh copy per call, for the reason `classGuards` does: a frozen
146
+ * constant handed to a caller that edits it is one shared table away from a
147
+ * silently changed ruler.
148
+ * @param {string} lang
149
+ * @returns {{id: string, what: string, lineMatch: string, capture: number|null, example: string, why: string}[]}
150
+ */
151
+ export function genreInstruments(lang: string): {
152
+ id: string;
153
+ what: string;
154
+ lineMatch: string;
155
+ capture: number | null;
156
+ example: string;
157
+ why: string;
158
+ }[];
159
+ /**
160
+ * GROUNDING for a RECORDED genre environment — the provenance half of the
161
+ * owned-env rule, and the reason the by-value comparison is worth anything.
162
+ *
163
+ * The value check proves the envelope's `genreEnv` and the stage's `params.env`
164
+ * AGREE. Both copies live in the same hand-editable spec, so agreement is
165
+ * something a forger gets for free: a spec carrying
166
+ * `MYPYPATH=/tmp/attacker-stubs` in both places is perfectly self-consistent and
167
+ * would point the checker at a tree nobody signed. Agreement is not provenance.
168
+ *
169
+ * What a forger does NOT own is the repository at the seed. Every value the
170
+ * arbiter can build is `genreEnv`'s join of `sourcePrefixes`, and those prefixes
171
+ * were already filtered against the seed listing before the join — so each
172
+ * ELEMENT of a genuine value is a path the listing SELECTS, exactly like hamr's
173
+ * listing rule for a declared path. Grounding therefore accepts precisely what
174
+ * `applyGenreEnv` produces and refuses everything else, without needing a second
175
+ * spelling of what "ours" means.
176
+ *
177
+ * Element-wise, never whole-value: a joined list is as strong as its weakest
178
+ * element, and one real prefix must not launder the rest. A root spelling is
179
+ * ungrounded here rather than waved through the way `checkPaths` waves it —
180
+ * `genreEnv` filters those out before joining, so the arbiter can never produce
181
+ * one, and a validator that admits what its own producer cannot emit is a gap.
182
+ *
183
+ * Callers that hold a listing only; the deferred job-spec gate cannot run this
184
+ * and does not pretend to (see `validateCloseDecl`).
185
+ * @param {string} lang
186
+ * @param {Record<string, string>} recorded what the envelope claims the arbiter injected
187
+ * @param {string[]} listing repo-relative paths at the seed
188
+ * @returns {{name: string, value: string, element: string, resolved: string}[]} one row per ungrounded element
189
+ */
190
+ export function ungroundedGenreEnv(lang: string, recorded: Record<string, string>, listing: string[]): {
191
+ name: string;
192
+ value: string;
193
+ element: string;
194
+ resolved: string;
195
+ }[];
196
+ /**
197
+ * Validate an authored close DECLARATION. Never throws on model output — every
198
+ * failure is a named red, in the shipped `{ok, reds, <parsed>}` shape, and the
199
+ * parsed value is the RESOLVED declaration (every short-form parser expanded),
200
+ * because that is the form the executor runs and the signature covers.
201
+ *
202
+ * `listing`, `guards` and `envOwned` are REQUIRED, and their absence is a red
203
+ * rather than a skipped check — all three guard the SAME failure: a validator
204
+ * that silently stops checking when handed nothing to check against reports a
205
+ * clean declaration it never examined. v1 only admits a job with a runnable
206
+ * patient and a git seed (D13), so the listing always exists, and D5's guards
207
+ * exist by construction. `envOwned` is separated into absent-vs-empty for
208
+ * F59's reason exactly: `[]` is a genre that owns no variables (JS), and
209
+ * `undefined` is a caller that never asked — the two must not read alike.
210
+ *
211
+ * The CATALOGUE is ours, not model input: a malformed one is a bareloop bug and
212
+ * is allowed to throw, because failing loudly beats a validator that quietly
213
+ * stops enforcing a rule it was configured out of.
214
+ *
215
+ * `deferListing: true` is the ONE way to run without a listing, and it must be
216
+ * spelled literally. It exists for exactly one caller — the job-spec validator,
217
+ * which judges a signed `closeDecl` with no repository in hand — and it does NOT
218
+ * make the listing optional: it moves that half of the gate to the runner, which
219
+ * re-validates GROUNDED against the real seed before any stage runs. Two checks
220
+ * ride on the listing and both are named here rather than discovered later: the
221
+ * path rule (a path SELECTS or it does not exist), and the SCOPED-job derivation
222
+ * that arms the F84 one-population law. With the listing deferred, neither
223
+ * fires, and `grounded: false` on the result is how a caller knows.
224
+ *
225
+ * `verdictType` is REQUIRED for the same reason: it is the PROMISE the ceiling
226
+ * rule checks the composition against, and a validator with no pick in hand
227
+ * cannot check it. Absent or unknown is `class-absent`, naming the closed set.
228
+ *
229
+ * @param {any} declaration the parsed model output
230
+ * @param {{catalogue?: Record<string, KindSpec>, listing?: string[]|null,
231
+ * guards?: {name: string, kind: string, params: Record<string, any>, fill: string[]}[]|null,
232
+ * envOwned?: string[]|null, envInjected?: Record<string, string>|null, deferListing?: boolean,
233
+ * verdictType?: string|null}} [opts]
234
+ * `listing` — repo-relative paths at the seed (`git ls-tree -r --name-only`).
235
+ * `guards` — the picked class's injected guards (`classGuards`).
236
+ * `verdictType` — the class the USER picked (`VERDICT_CLASSES`).
237
+ * `envOwned` — env names the genre injects (`genreOwnedEnvNames`), `[]` when it owns none.
238
+ * `envInjected` — the env the ARBITER itself injected (`genreEnv`'s output), for a
239
+ * POST-injection re-validation. Omitted is the PRE-injection form: every owned name
240
+ * is the model's and reds. Supplied, an owned name is accepted only when its value is
241
+ * EXACTLY the injected one — a wrong value is the model's guess or corruption.
242
+ * `deferListing` — literally `true` to run the tree-independent half only.
243
+ * @returns {{ok: boolean, reds: Red[], declaration: any, grounded: boolean,
244
+ * scoped: {scoped: boolean, via: string|null},
245
+ * ceiling: {class: string, kind: string, stage: string|null, locked: boolean}|null}}
246
+ */
247
+ export function validateDeclaration(declaration: any, opts?: {
248
+ catalogue?: Record<string, KindSpec>;
249
+ listing?: string[] | null;
250
+ guards?: {
251
+ name: string;
252
+ kind: string;
253
+ params: Record<string, any>;
254
+ fill: string[];
255
+ }[] | null;
256
+ envOwned?: string[] | null;
257
+ envInjected?: Record<string, string> | null;
258
+ deferListing?: boolean;
259
+ verdictType?: string | null;
260
+ }): {
261
+ ok: boolean;
262
+ reds: Red[];
263
+ declaration: any;
264
+ grounded: boolean;
265
+ scoped: {
266
+ scoped: boolean;
267
+ via: string | null;
268
+ };
269
+ ceiling: {
270
+ class: string;
271
+ kind: string;
272
+ stage: string | null;
273
+ locked: boolean;
274
+ } | null;
275
+ };
276
+ /**
277
+ * The declaration the EXECUTOR sees and the SIGNATURE covers: every
278
+ * `count-not-worse` parser resolved to `{terms: [...]}`, so the short form stops
279
+ * existing at this boundary and there is exactly one shape downstream (D13
280
+ * forward-compat point 3 — the hash is taken over the RESOLVED form, or an
281
+ * omittable-with-a-default field changes what runs without changing what was
282
+ * signed).
283
+ *
284
+ * A parser that would not normalise is left VERBATIM: it already carries a red,
285
+ * and rewriting it would hide what the model actually wrote.
286
+ * @param {any} declaration
287
+ */
288
+ export function normalizeDeclaration(declaration: any): any;
289
+ /** @typedef {{code: string, path: string, detail: string, [k: string]: any}} Red */
290
+ /** @typedef {{required: readonly string[], optional: readonly string[], pathParams: readonly string[], locked?: true, verdictClass: string, shape: string, asserts: string}} KindSpec */
291
+ /** the whole menu, in ascending order of what it takes to render the verdict */
292
+ export const VERDICT_CLASSES: readonly string[];
293
+ /** declared-but-locked: selecting one is COUNTED demand, never an admission */
294
+ export const LOCKED_CLASSES: readonly string[];
295
+ /** the classes v1 actually builds — exactly one */
296
+ export const LIVE_CLASSES: readonly string[];
297
+ /**
298
+ * The whole vocabulary, as DATA. `shape` and `asserts` are the strings the
299
+ * authoring prompt renders (M3) — the prompt and this validator must judge the
300
+ * same facts, so they read one catalogue rather than two (the drift class
301
+ * SECRET_PATTERNS exists to prevent, one layer up).
302
+ *
303
+ * `pathParams` names every param that carries a repository path, in dotted
304
+ * form. It is data rather than a switch so hamr's listing rule reaches a new
305
+ * path-bearing param the day one is added, instead of the day someone
306
+ * remembers to widen a condition.
307
+ *
308
+ * `verdictClass` is the class of verdict this kind can HONESTLY render, and it
309
+ * is what makes the user's pick a promise the composer must keep (PRD v1.57 §1).
310
+ * Every live kind is `green` — a command's measurement is the truth — so the
311
+ * ceiling rule is inert in v1 by construction; the two locked kinds carry the
312
+ * classes they belong to so the rule is already correct the day one goes live.
313
+ *
314
+ * Optionality is read off the prereg §5 table, with ONE deliberate divergence
315
+ * from the gate-2 POC validator, named because it reverses a POC behaviour:
316
+ * `pattern-absent-in-diff.scope` is OPTIONAL here and the guard ships without
317
+ * it. Under addendum 6 the guard's scope is GENRE property and the answer is
318
+ * "every changed file of these extensions" — an absent scope is exactly that
319
+ * (M1's `inScope` admits everything when no scope object is present). The POC
320
+ * required it, and required it filled, which is how round 3's arm A came to
321
+ * narrow the scan and call it stricter.
322
+ * @type {Record<string, KindSpec>}
323
+ */
324
+ export const KIND_CATALOGUE: Record<string, KindSpec>;
325
+ export const CATALOGUE_KINDS: readonly string[];
326
+ export const LOCKED_KINDS: readonly string[];
327
+ /** the catalogue's live half — asserted EQUAL to the executor's own LIVE_KINDS
328
+ * by the suite, both directions: a kind the catalogue offers and the executor
329
+ * cannot run is a close that stops at runtime, and a kind the executor runs
330
+ * that the catalogue never names is a capability nothing can reach. */
331
+ export const CATALOGUE_LIVE_KINDS: readonly string[];
332
+ export const DIRECTIONS: readonly string[];
333
+ /** D12: the close stores the COUNTING RULE, never the number. "seed" is measured
334
+ * at this run's own seed every run; 0 is literally zero. A frozen constant (the
335
+ * hand-written closes' `SEED_ERRORS 63`) is exactly what this menu retires. */
336
+ export const BASELINES: readonly (string | number)[];
337
+ /** a runaway stage list is a red, not a bill — the sibling of M1's MAX_TERMS */
338
+ export const MAX_STAGES: 12;
339
+ /**
340
+ * THE DENY FLOOR under a declared command (hamr's ruling, PRD v1.57 §3: *"there
341
+ * should be a floor of all dangerous things… straight out block… no one wants
342
+ * `rm -rf` allowed either ways"*).
343
+ *
344
+ * Four families, and each one is here for a different reason:
345
+ * - SHELL INTERPRETERS. A shell runs anything, so admitting one makes every
346
+ * other entry decoration — the D3 line ("the danger is in the ACTIONS, not
347
+ * the SYNTAX") reappearing at the close's own spawn.
348
+ * - DESTRUCTIVE / SYSTEM commands. The `rm -rf` class the ruling names, plus
349
+ * the machine-level siblings (`dd`, the `mkfs` FAMILY, shutdown/reboot) and
350
+ * privilege escalation.
351
+ * - FETCH-AND-RUN vectors (`curl`, `wget`). A close that downloads its own
352
+ * instrument is a close nobody signed.
353
+ * - INDIRECTION (`env`, `eval`, `exec`, `xargs`). They run a program the
354
+ * declaration never names, which defeats every entry above by construction.
355
+ *
356
+ * It is a FLOOR, and MONOTONIC: names are only ever ADDED, never removed or
357
+ * narrowed (the F49 precedent — closing a false negative is the allowed
358
+ * direction; chasing a false positive is not). A legitimate runner refused here
359
+ * is fixed by declaring the runner, never by shrinking the floor.
360
+ *
361
+ * It is NOT A SANDBOX, and nothing here claims to be one. The local-trust model
362
+ * of v1.41 stands intact and its limitations are written out in PRD v1.57 §3:
363
+ * close children keep the operator's OS user, network egress and file access;
364
+ * `args` are not inspected (`node -e <anything>` is reachable and always was);
365
+ * resource use is bounded by liveness checks, not quotas. The floor narrows
366
+ * blast radius; it does not promise containment.
367
+ */
368
+ export const DENIED_COMMANDS: readonly string[];
369
+ /**
370
+ * THE FROZEN TYPES GENRE TEMPLATE — prereg addendum 3's six policy points,
371
+ * VERBATIM. The suite reads the prereg and compares BYTES, so a paraphrase here
372
+ * fails the build rather than quietly changing what every future close is
373
+ * authored against. It deliberately carries no repo-specific command, path, env
374
+ * value or regex: round 2 measured that stating the LAW still leaves the model
375
+ * to find the VALUE, and that is the axis the build must keep live.
376
+ */
377
+ export const TYPES_GENRE_TEMPLATE: "1. The graded instrument is the STRICT form of the language's type checker, regardless of what\n the repo's own scripts run. If the repo's script omits strictness, the close adds it.\n2. Tools are invoked so their binaries actually resolve \u2014 through the project's own package\n runner or language module runner, never a bare binary name.\n3. The stage skeleton, in first-red-wins order: changed-from-seed (guard) \u2192 typecheck (error\n count IN the target scope, baseline 0, lower-is-better) \u2192 typecheck-outside (error count\n OUTSIDE the target scope, baseline measured at seed, a ceiling \u2014 required whenever the job\n scopes to a subset of the tree; omitted only for whole-tree jobs) \u2192 tests-kept (a floor on\n tests that actually EXECUTED, baseline at seed, higher-is-better; a skipped or deselected\n test did not run and must not count) \u2192 suite-green (the suite exits clean AND reports zero\n failing tests \u2014 two assertions) \u2192 no-suppressions (guard).\n4. One population per stage \u2014 two structurally different counts never share a stage.\n5. The checker must judge the PATIENT's own tree: if imports could resolve to an installed or\n editable copy elsewhere, the environment is set so they resolve inside the patient.\n6. A number the tool did not report is unknown, never zero.";
378
+ export const GENRE_LANGUAGES: readonly string[];
379
+ /**
380
+ * THE GENRE, as data. The suppression batteries are the hand-written closes'
381
+ * own `SUPPRESSIONS` tables (`scripts/u-pulselog-close.mjs:35`,
382
+ * `scripts/u-spawner-close.mjs:34`) — operator-owned genre knowledge, minted by
383
+ * paying for live runs. `unknown` is deliberately NOT a JS suppression and not
384
+ * a Python one: it forces narrowing at the use site, which is real typing work.
385
+ *
386
+ * `env` is the addendum-6 residue expressed as data. Python's `MYPYPATH` is
387
+ * load-bearing and was found by probe, never by reading: the aurora patient sets
388
+ * `explicit_package_bases`, so without it a sibling import falls through to an
389
+ * editable install pointing at a DIFFERENT checkout and a cross-module fix is
390
+ * graded against unedited source. It moves no seed number, which is why no
391
+ * seed-verdict read can ever catch its absence — the only place it can live is
392
+ * here, in genre data, injected by the flow.
393
+ */
394
+ export const TYPES_GENRE: Readonly<{
395
+ name: "TYPES";
396
+ template: "1. The graded instrument is the STRICT form of the language's type checker, regardless of what\n the repo's own scripts run. If the repo's script omits strictness, the close adds it.\n2. Tools are invoked so their binaries actually resolve — through the project's own package\n runner or language module runner, never a bare binary name.\n3. The stage skeleton, in first-red-wins order: changed-from-seed (guard) → typecheck (error\n count IN the target scope, baseline 0, lower-is-better) → typecheck-outside (error count\n OUTSIDE the target scope, baseline measured at seed, a ceiling — required whenever the job\n scopes to a subset of the tree; omitted only for whole-tree jobs) → tests-kept (a floor on\n tests that actually EXECUTED, baseline at seed, higher-is-better; a skipped or deselected\n test did not run and must not count) → suite-green (the suite exits clean AND reports zero\n failing tests — two assertions) → no-suppressions (guard).\n4. One population per stage — two structurally different counts never share a stage.\n5. The checker must judge the PATIENT's own tree: if imports could resolve to an installed or\n editable copy elsewhere, the environment is set so they resolve inside the patient.\n6. A number the tool did not report is unknown, never zero.";
397
+ languages: Readonly<{
398
+ js: Readonly<{
399
+ suppressions: readonly (Readonly<{
400
+ id: "ts-ignore";
401
+ regex: "@ts-ignore";
402
+ }> | Readonly<{
403
+ id: "ts-expect-error";
404
+ regex: "@ts-expect-error";
405
+ }> | Readonly<{
406
+ id: "ts-nocheck";
407
+ regex: "@ts-nocheck";
408
+ }> | Readonly<{
409
+ id: "eslint-disable";
410
+ regex: "eslint-disable";
411
+ }> | Readonly<{
412
+ id: "any";
413
+ regex: "(?:[{<|(\\[:,]|\\bas)\\s*any\\b|\\bany\\[\\]";
414
+ }> | Readonly<{
415
+ id: "any-star";
416
+ regex: "@\\w+\\s*\\{\\s*[*?]\\s*\\}";
417
+ }> | Readonly<{
418
+ id: "cast";
419
+ regex: "@type\\s*\\{.*\\}\\s*\\*\\/\\s*\\(";
420
+ }>)[];
421
+ extensions: readonly string[];
422
+ /** no import-resolution hazard on this runner — an EMPTY list, declared,
423
+ * never an absent field that would read as "not looked into" (F59) */
424
+ env: readonly never[];
425
+ instruments: readonly (Readonly<{
426
+ id: "tsc-error-line";
427
+ what: "one type error, as the TypeScript checker prints it";
428
+ lineMatch: "error TS\\d+";
429
+ capture: null;
430
+ example: "src/backup.js(21,19): error TS7006: Parameter 'now' implicitly has an 'any' type.";
431
+ why: string;
432
+ }> | Readonly<{
433
+ id: "node-test-total-count";
434
+ what: "how many tests the runner EXECUTED, off the TAP summary";
435
+ lineMatch: "^# tests (\\d+)$";
436
+ capture: 1;
437
+ example: "# tests 317";
438
+ why: string;
439
+ }> | Readonly<{
440
+ id: "node-test-pass-count";
441
+ what: "how many tests passed, off the TAP summary";
442
+ lineMatch: "^# pass (\\d+)$";
443
+ capture: 1;
444
+ example: "# pass 316";
445
+ why: string;
446
+ }> | Readonly<{
447
+ id: "node-test-fail-count";
448
+ what: "how many tests failed, off the TAP summary";
449
+ lineMatch: "^# fail (\\d+)$";
450
+ capture: 1;
451
+ example: "# fail 1";
452
+ why: string;
453
+ }> | Readonly<{
454
+ id: "node-test-failed-line";
455
+ what: "one failing test, as the TAP reporter names it";
456
+ lineMatch: "^not ok \\d+ ";
457
+ capture: null;
458
+ example: "not ok 7 - edit-renotify: a non-participant edit, and edits on a pending event, ping no one";
459
+ why: string;
460
+ }>)[];
461
+ }>;
462
+ python: Readonly<{
463
+ suppressions: readonly (Readonly<{
464
+ id: "ignore";
465
+ regex: "#\\s*type:\\s*ignore";
466
+ }> | Readonly<{
467
+ id: "any";
468
+ regex: "\\bAny\\b";
469
+ }> | Readonly<{
470
+ id: "cast";
471
+ regex: "\\bcast\\s*\\(";
472
+ }> | Readonly<{
473
+ id: "noqa";
474
+ regex: "#\\s*noqa";
475
+ }> | Readonly<{
476
+ id: "mypy-disable";
477
+ regex: "#\\s*mypy:\\s*disable";
478
+ }>)[];
479
+ extensions: readonly string[];
480
+ env: readonly Readonly<{
481
+ name: "MYPYPATH";
482
+ from: "sourcePrefixes";
483
+ join: ":";
484
+ why: string;
485
+ }>[];
486
+ instruments: readonly (Readonly<{
487
+ id: "mypy-error-line";
488
+ what: "one type error, as mypy prints it";
489
+ lineMatch: " error: ";
490
+ capture: null;
491
+ example: "packages/spawner/src/aurora_spawner/timeout_policy.py:89: error: Statement is unreachable [unreachable]";
492
+ why: string;
493
+ }> | Readonly<{
494
+ id: "pytest-pass-count";
495
+ what: "how many tests passed, off pytest's final counts line";
496
+ lineMatch: "(\\d+) passed";
497
+ capture: 1;
498
+ example: "= 1 failed, 2690 passed, 3 skipped, 18 deselected, 1775 warnings in 326.12s (0:05:26) =";
499
+ why: string;
500
+ }> | Readonly<{
501
+ id: "pytest-failed-line";
502
+ what: "one failing test, as pytest's short summary names it";
503
+ lineMatch: "^FAILED ";
504
+ capture: null;
505
+ example: "FAILED packages/soar/tests/test_agent_registry_deprecation.py::TestAgentRegistryDeprecation::test_registry_and_discovery_equivalent_results";
506
+ why: string;
507
+ }>)[];
508
+ }>;
509
+ }>;
510
+ }>;
511
+ /**
512
+ * THE GUARD BATTERY, KEYED BY VERDICT CLASS (hamr's ruling, PRD v1.57 §2).
513
+ *
514
+ * D5's battery was genre-keyed data. Under class-keyed interviews it has no
515
+ * genre to hang from, and the ruling gives it the same home the interview took:
516
+ * **the battery attaches to the verdict class the user picked** — not to a
517
+ * problem-genre label, and not per catalogue KIND.
518
+ *
519
+ * WHY THE CLASS. What a battery is FOR is the class of dishonesty the class of
520
+ * VERDICT admits. A green job is a job whose *done* is claimed to be
521
+ * machine-checkable, so it carries the green battery whatever problem it came
522
+ * from — that is the anti-suppression obligation the F87 genre earned, and it
523
+ * must not travel with a label the interview no longer asks for.
524
+ *
525
+ * ATTACHMENT POINT vs CONTENTS, and the split is the whole implementation:
526
+ * - the battery's STRUCTURE and its un-removability key off the CLASS. That
527
+ * is this table: which guards exist, what they assert, which slot is the
528
+ * model's (`fill`), and which params are ours.
529
+ * - the battery's CONTENTS fill in at COMPOSITION (`compose`), because a
530
+ * suppression pattern, a file extension and a checker's escape hatch belong
531
+ * to the TOOL the declaration names, and nothing before composition knows
532
+ * that tool. `classGuards` resolves them from the language data below.
533
+ *
534
+ * A LOCKED class carries `guards: null`, not `[]`. Absent is never empty (F59):
535
+ * `[]` would read as "this class needs no guards", which is exactly the sentence
536
+ * D5 exists to make unsayable. Nothing ever reaches it — admission refuses a
537
+ * locked class before its battery is asked for — and `classGuards` throws rather
538
+ * than hand back nothing if anything ever does.
539
+ * @type {Record<string, {locked: boolean, guards: readonly any[]|null}>}
540
+ */
541
+ export const CLASS_BATTERIES: Record<string, {
542
+ locked: boolean;
543
+ guards: readonly any[] | null;
544
+ }>;
545
+ export type Red = {
546
+ code: string;
547
+ path: string;
548
+ detail: string;
549
+ [k: string]: any;
550
+ };
551
+ export type KindSpec = {
552
+ required: readonly string[];
553
+ optional: readonly string[];
554
+ pathParams: readonly string[];
555
+ locked?: true;
556
+ verdictClass: string;
557
+ shape: string;
558
+ asserts: string;
559
+ };