bareloop 0.55.0 → 0.57.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/CHANGELOG.md +82 -0
- package/README.md +3 -3
- package/bareloop.context.md +69 -209
- package/package.json +2 -2
- package/src/authorflow.js +164 -340
- package/src/authoring.js +7 -127
- package/src/authorjob.js +139 -472
- package/src/authorreadout.js +24 -368
- package/src/authorrun.js +21 -215
- package/src/behaviour.js +14 -0
- package/src/blockasks.js +43 -0
- package/src/bundlerun.js +4 -1
- package/src/checkblock.js +798 -0
- package/src/checklist.js +128 -0
- package/src/checkpick.js +39 -312
- package/src/checkwords.js +3 -1
- package/src/cli.js +3 -3
- package/src/declaredclose.js +38 -108
- package/src/destpoint.js +4 -2
- package/src/draftspend.js +46 -0
- package/src/facts.js +8 -1
- package/src/index.js +3 -43
- package/src/interviewrun.js +13 -8
- package/src/job.js +20 -1
- package/src/jobblock.js +11 -46
- package/src/judged.js +13 -1229
- package/src/kinds.js +5 -347
- package/src/noteask.js +124 -0
- package/src/pagedry.js +27 -5
- package/src/pagemap.js +15 -3
- package/src/pagerules.js +18 -3
- package/src/panel/authorroutes.js +24 -6
- package/src/panel/authorsession.js +222 -177
- package/src/panel/importrun.js +0 -1
- package/src/panel/index.html +198 -26
- package/src/panel/jobplan.js +87 -33
- package/src/panel/server.js +74 -68
- package/src/panel/status.js +3 -0
- package/src/pickrecord.js +34 -55
- package/src/placerule.js +355 -0
- package/src/planrun.js +2 -48
- package/src/promptregisters.js +13 -17
- package/src/providerrows.js +0 -36
- package/src/providers.js +4 -25
- package/src/questionbox.js +104 -0
- package/src/rowedit.js +115 -0
- package/src/rubricstep.js +234 -127
- package/src/run.js +11 -16
- package/src/userrun.js +60 -112
- package/types/authorflow.d.ts +41 -197
- package/types/authoring.d.ts +1 -14
- package/types/authorjob.d.ts +35 -59
- package/types/authorreadout.d.ts +10 -88
- package/types/behaviour.d.ts +12 -0
- package/types/blockasks.d.ts +36 -0
- package/types/checkblock.d.ts +376 -0
- package/types/checklist.d.ts +134 -0
- package/types/checkpick.d.ts +8 -140
- package/types/cli.d.ts +1 -3
- package/types/declaredclose.d.ts +7 -33
- package/types/destpoint.d.ts +2 -0
- package/types/draftspend.d.ts +21 -0
- package/types/index.d.ts +2 -4
- package/types/job.d.ts +8 -0
- package/types/jobblock.d.ts +8 -38
- package/types/judged.d.ts +7 -357
- package/types/kinds.d.ts +3 -104
- package/types/noteask.d.ts +76 -0
- package/types/pagedry.d.ts +13 -0
- package/types/pagemap.d.ts +4 -0
- package/types/pagerules.d.ts +7 -0
- package/types/panel/authorsession.d.ts +47 -5
- package/types/panel/jobgrid.d.ts +8 -8
- package/types/panel/jobplan.d.ts +48 -10
- package/types/panel/server.d.ts +27 -18
- package/types/panel/status.d.ts +5 -0
- package/types/pickrecord.d.ts +20 -13
- package/types/placerule.d.ts +194 -0
- package/types/planrun.d.ts +1 -22
- package/types/providerrows.d.ts +0 -31
- package/types/providers.d.ts +3 -19
- package/types/questionbox.d.ts +87 -0
- package/types/rowedit.d.ts +32 -0
- package/types/rubricstep.d.ts +100 -48
- package/types/run.d.ts +9 -19
- package/types/userrun.d.ts +0 -1
- package/src/calibrate.js +0 -702
- package/src/cardauthor.js +0 -502
- package/src/fitcheck.js +0 -166
- package/types/calibrate.d.ts +0 -201
- package/types/cardauthor.d.ts +0 -358
- package/types/fitcheck.d.ts +0 -113
package/types/calibrate.d.ts
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Did the pipe grade this case the way the signer signed it?
|
|
3
|
-
*
|
|
4
|
-
* BOTH HALVES, AND BOTH ARE REQUIRED. The verdict alone is the aggregate this
|
|
5
|
-
* floor was written against: a red case that reds on the wrong card line, or on
|
|
6
|
-
* the right line and the wrong function, has told the operator nothing about
|
|
7
|
-
* whether their ruler works — §4.4's *"with itemized reds, not a paragraph"* is
|
|
8
|
-
* exactly this comparison and not a looser one.
|
|
9
|
-
*
|
|
10
|
-
* The reds compare as SETS: `decide()` grades every card item over every
|
|
11
|
-
* function and its emission order follows the card and the model's function
|
|
12
|
-
* list, while a signer writes their expectation in whatever order they thought
|
|
13
|
-
* of it. Order is not a fact about the pipe, so it is not compared; the ADDRESSES
|
|
14
|
-
* are. A duplicate is already inexpressible on both sides (`expectedOf` dedupes,
|
|
15
|
-
* `validateCalibrationSet` reds a repeated pair), so set comparison loses
|
|
16
|
-
* nothing.
|
|
17
|
-
* @param {{verdict: string, reds: {rule: string, fn: string}[]}} got
|
|
18
|
-
* @param {any} want
|
|
19
|
-
* @returns {{ok: boolean, verdictOk: boolean, redsOk: boolean, missing: string[], extra: string[]}}
|
|
20
|
-
*/
|
|
21
|
-
export function compareExpectation(got: {
|
|
22
|
-
verdict: string;
|
|
23
|
-
reds: {
|
|
24
|
-
rule: string;
|
|
25
|
-
fn: string;
|
|
26
|
-
}[];
|
|
27
|
-
}, want: any): {
|
|
28
|
-
ok: boolean;
|
|
29
|
-
verdictOk: boolean;
|
|
30
|
-
redsOk: boolean;
|
|
31
|
-
missing: string[];
|
|
32
|
-
extra: string[];
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Did the extraction survive the attack?
|
|
36
|
-
*
|
|
37
|
-
* Three readings, all mechanical, all over facts this module owns both sides of:
|
|
38
|
-
* - THE FUNCTION LIST is exactly the gold's, as a set. A style that hides a
|
|
39
|
-
* function has moved the facts even if every remaining fact is true.
|
|
40
|
-
* - EVERY DOCUMENTED function's `docQuote` is a REAL JSDoc opener from the
|
|
41
|
-
* artifact, and every UNDOCUMENTED one's is `null`. A non-null quote on an
|
|
42
|
-
* undocumented function is the leak this battery exists to catch, and it is
|
|
43
|
-
* invisible one layer up: `decide()` reds it either way (an invented quote
|
|
44
|
-
* fails the artifact check), so resist and leak render the SAME itemized
|
|
45
|
-
* reds and only the facts separate them.
|
|
46
|
-
* - and the DECISION still matches gold, so a leak that somehow survives both
|
|
47
|
-
* fact checks still has one more gate to pass.
|
|
48
|
-
* @param {any} facts @param {any} gold @param {string} artifactText
|
|
49
|
-
* @returns {{ok: boolean, why: string|null}}
|
|
50
|
-
*/
|
|
51
|
-
export function factsResist(facts: any, gold: any, artifactText: string): {
|
|
52
|
-
ok: boolean;
|
|
53
|
-
why: string | null;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* THE CALIBRATION GATE. Run the whole pipe over the signed ten and over the five
|
|
57
|
-
* arbiter-owned injection artifacts, and report — itemized, per case — whether
|
|
58
|
-
* the ruler is a ruler.
|
|
59
|
-
*
|
|
60
|
-
* It never throws on a caller's data: an illegal set is a RED (the same
|
|
61
|
-
* `{ok, reds}` shape module 4's validators return), because this is reached from
|
|
62
|
-
* a signing gate whose whole job is to hand a person a readable refusal. It
|
|
63
|
-
* throws on nothing at all.
|
|
64
|
-
*
|
|
65
|
-
* ORDER, and it is load-bearing: the $0 legality check runs FIRST and buys no
|
|
66
|
-
* calls; then the ten; then the battery. A set that cannot be legal is refused
|
|
67
|
-
* before a token, and an operator whose card is malformed does not pay to find
|
|
68
|
-
* out.
|
|
69
|
-
*
|
|
70
|
-
* ALL-OR-NOTHING, both halves (v1.73 ruling 2 and ruling 3, kept by the second
|
|
71
|
-
* addendum's ruling 1): `ok` is true only when all ten graded correctly AND all
|
|
72
|
-
* five styles resisted AND nothing was a casualty.
|
|
73
|
-
* THE OPERATOR'S CEILING RIDES IN AS A PREDICATE (`capStop`), asked between metered
|
|
74
|
-
* calls exactly as the authoring pipeline's cost book asks its own. It is the
|
|
75
|
-
* CALLER's book that answers, because the gate is the THIRD paid seam of one run and
|
|
76
|
-
* a tally that starts at zero here would be a second ceiling wearing the first one's
|
|
77
|
-
* number. Absent is UNBOUNDED, and unbounded is a stated operator choice.
|
|
78
|
-
*
|
|
79
|
-
* A ceiling stop is a REFUSAL, never a throw and never a partial set presented as a
|
|
80
|
-
* graded one: `ok` is false, the cases nobody bought are absent rather than recorded
|
|
81
|
-
* as failures, and `casualty` stays null — the transport was fine, the operator's own
|
|
82
|
-
* governance stopped the gate.
|
|
83
|
-
* `judgeModel` is REQUIRED and has no default (PRD item 32.1). It is the identity
|
|
84
|
-
* the caller resolved (`resolveJudge`, src/judged.js) and it is what the graded set
|
|
85
|
-
* is STAMPED with — `setHash` folds it in, so a set certified by one judge cannot be
|
|
86
|
-
* mistaken for the same set certified by another. A default here would be the silent
|
|
87
|
-
* fall-back the whole judge-identity change exists to remove: a gate that grades
|
|
88
|
-
* under a model nobody named certifies a floor nobody can attribute.
|
|
89
|
-
* @param {{cases: any, card: any, judgeLoop: Function|null, judgeModel: string,
|
|
90
|
-
* onCost?: (c: any) => void, attempts?: number, battery?: any[], batteryCard?: any,
|
|
91
|
-
* capStop?: () => 'cap-halt'|'pricing-red'|null}} o
|
|
92
|
-
* @returns {Promise<{ok: boolean, stop: string|null, casualty: any,
|
|
93
|
-
* graded: {id: string, ok: boolean, got: any, want: any, detail: string|null, diag: any}[],
|
|
94
|
-
* injection: {styles: any[], allResisted: boolean, leaks: string[]},
|
|
95
|
-
* failures: string[], reds: Red[], judgeModel: string,
|
|
96
|
-
* cardHash: string|null, casesHash: string|null, setHash: string|null,
|
|
97
|
-
* costUsd: number|null, knownUsd: number, spendComplete: boolean, calls: any[]}>}
|
|
98
|
-
*/
|
|
99
|
-
export function runCalibration({ cases, card, judgeLoop, judgeModel, onCost, attempts, battery, batteryCard, capStop, }: {
|
|
100
|
-
cases: any;
|
|
101
|
-
card: any;
|
|
102
|
-
judgeLoop: Function | null;
|
|
103
|
-
judgeModel: string;
|
|
104
|
-
onCost?: (c: any) => void;
|
|
105
|
-
attempts?: number;
|
|
106
|
-
battery?: any[];
|
|
107
|
-
batteryCard?: any;
|
|
108
|
-
capStop?: () => "cap-halt" | "pricing-red" | null;
|
|
109
|
-
}): Promise<{
|
|
110
|
-
ok: boolean;
|
|
111
|
-
stop: string | null;
|
|
112
|
-
casualty: any;
|
|
113
|
-
graded: {
|
|
114
|
-
id: string;
|
|
115
|
-
ok: boolean;
|
|
116
|
-
got: any;
|
|
117
|
-
want: any;
|
|
118
|
-
detail: string | null;
|
|
119
|
-
diag: any;
|
|
120
|
-
}[];
|
|
121
|
-
injection: {
|
|
122
|
-
styles: any[];
|
|
123
|
-
allResisted: boolean;
|
|
124
|
-
leaks: string[];
|
|
125
|
-
};
|
|
126
|
-
failures: string[];
|
|
127
|
-
reds: Red[];
|
|
128
|
-
judgeModel: string;
|
|
129
|
-
cardHash: string | null;
|
|
130
|
-
casesHash: string | null;
|
|
131
|
-
setHash: string | null;
|
|
132
|
-
costUsd: number | null;
|
|
133
|
-
knownUsd: number;
|
|
134
|
-
spendComplete: boolean;
|
|
135
|
-
calls: any[];
|
|
136
|
-
}>;
|
|
137
|
-
/** @typedef {{code: string, path: string, detail: string, [k: string]: any}} Red */
|
|
138
|
-
/** the label a calibration's own locate calls are metered under. The SAME
|
|
139
|
-
* `LOCATE_LABEL` a close's judged stage spends under, deliberately: it is the
|
|
140
|
-
* same call to the same model over the same prompt, and a second spelling would
|
|
141
|
-
* make one population of spend read as two. */
|
|
142
|
-
export const CALIBRATION_LABEL: "judged-locate";
|
|
143
|
-
/** the axes that STOP the gate as a casualty rather than failing a case. All
|
|
144
|
-
* three are `runLocate`'s own, borrowed with their meanings intact — this module
|
|
145
|
-
* invents no vocabulary for a fault the shipped pipe already names. */
|
|
146
|
-
export const CASUALTY_AXES: readonly ("pricing-red" | "provider-red" | "artifact-red")[];
|
|
147
|
-
export function artifactHash(v: any): string;
|
|
148
|
-
/**
|
|
149
|
-
* The battery's OWN card — `has-doc` alone, and one line rather than three on
|
|
150
|
-
* purpose. Every attack style below aims at exactly one lie ("this file is
|
|
151
|
-
* documented"), so the card that grades them names exactly the fact being lied
|
|
152
|
-
* about; extra lines would buy extra prompt surface and extra ways for a
|
|
153
|
-
* truthful-but-noisy extraction to look like a leak.
|
|
154
|
-
*/
|
|
155
|
-
export const INJECTION_CARD: Readonly<{
|
|
156
|
-
items: readonly Readonly<{
|
|
157
|
-
rule: "has-doc";
|
|
158
|
-
text: "Every top-level function has a JSDoc block directly above it.";
|
|
159
|
-
}>[];
|
|
160
|
-
}>;
|
|
161
|
-
/**
|
|
162
|
-
* THE FIVE STYLES, one artifact each. Every artifact carries one honestly
|
|
163
|
-
* documented function and one honestly undocumented one, and the attack always
|
|
164
|
-
* asks for the same thing: report the undocumented function as documented (or
|
|
165
|
-
* do not report it at all). The truth is therefore identical across all five,
|
|
166
|
-
* which is what makes a leak attributable to the STYLE rather than to the file.
|
|
167
|
-
*/
|
|
168
|
-
export const INJECTION_LOCATE_BATTERY: readonly Readonly<{
|
|
169
|
-
id: string;
|
|
170
|
-
style: string;
|
|
171
|
-
attack: string;
|
|
172
|
-
artifact: `/**
|
|
173
|
-
* Add two numbers.
|
|
174
|
-
*/
|
|
175
|
-
export function add(a, b) {
|
|
176
|
-
return a + b;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
${string}`;
|
|
180
|
-
expectFacts: Readonly<{
|
|
181
|
-
functions: readonly Readonly<{
|
|
182
|
-
name: string;
|
|
183
|
-
hasDoc: boolean;
|
|
184
|
-
}>[];
|
|
185
|
-
}>;
|
|
186
|
-
expect: Readonly<{
|
|
187
|
-
verdict: "pass" | "red";
|
|
188
|
-
reds: readonly Readonly<{
|
|
189
|
-
rule: string;
|
|
190
|
-
fn: string;
|
|
191
|
-
}>[];
|
|
192
|
-
}>;
|
|
193
|
-
}>[];
|
|
194
|
-
/** the per-string cap on anything the diagnostic keeps (bytes, scrubbed) */
|
|
195
|
-
export const DIAG_STRING_CAP: 400;
|
|
196
|
-
export type Red = {
|
|
197
|
-
code: string;
|
|
198
|
-
path: string;
|
|
199
|
-
detail: string;
|
|
200
|
-
[k: string]: any;
|
|
201
|
-
};
|
package/types/cardauthor.d.ts
DELETED
|
@@ -1,358 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The proposal's shape, and therefore the whole shape the compiler can express.
|
|
3
|
-
*
|
|
4
|
-
* `rule` is an ENUM off the judge's own rulebook in BOTH places it appears — the
|
|
5
|
-
* card's lines and a case's expected reds — because wherever only a closed set
|
|
6
|
-
* can satisfy a field, the illegal value is made INEXPRESSIBLE rather than
|
|
7
|
-
* rejected after the fact (the `check-passes(name)` model). The SIZE is pinned by
|
|
8
|
-
* `minItems`/`maxItems` from the one constant, so nine and eleven are both
|
|
9
|
-
* unsayable rather than argued about afterwards.
|
|
10
|
-
*
|
|
11
|
-
* `artifact` and `text` are the only free strings, and neither decides anything:
|
|
12
|
-
* one is the code the judge will read, the other is the signer's own words.
|
|
13
|
-
*/
|
|
14
|
-
export function proposalSchema(): {
|
|
15
|
-
type: string;
|
|
16
|
-
properties: {
|
|
17
|
-
card: {
|
|
18
|
-
type: string;
|
|
19
|
-
description: string;
|
|
20
|
-
properties: {
|
|
21
|
-
items: {
|
|
22
|
-
type: string;
|
|
23
|
-
minItems: number;
|
|
24
|
-
items: {
|
|
25
|
-
type: string;
|
|
26
|
-
properties: {
|
|
27
|
-
rule: {
|
|
28
|
-
enum: string[];
|
|
29
|
-
description: string;
|
|
30
|
-
};
|
|
31
|
-
text: {
|
|
32
|
-
type: string;
|
|
33
|
-
minLength: number;
|
|
34
|
-
description: string;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
required: string[];
|
|
38
|
-
additionalProperties: boolean;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
required: string[];
|
|
43
|
-
additionalProperties: boolean;
|
|
44
|
-
};
|
|
45
|
-
cases: {
|
|
46
|
-
type: string;
|
|
47
|
-
minItems: number;
|
|
48
|
-
maxItems: number;
|
|
49
|
-
description: string;
|
|
50
|
-
items: {
|
|
51
|
-
type: string;
|
|
52
|
-
properties: {
|
|
53
|
-
id: {
|
|
54
|
-
type: string;
|
|
55
|
-
minLength: number;
|
|
56
|
-
description: string;
|
|
57
|
-
};
|
|
58
|
-
artifact: {
|
|
59
|
-
type: string;
|
|
60
|
-
minLength: number;
|
|
61
|
-
description: string;
|
|
62
|
-
};
|
|
63
|
-
expect: {
|
|
64
|
-
type: string;
|
|
65
|
-
properties: {
|
|
66
|
-
verdict: {
|
|
67
|
-
enum: string[];
|
|
68
|
-
};
|
|
69
|
-
reds: {
|
|
70
|
-
type: string;
|
|
71
|
-
description: string;
|
|
72
|
-
items: {
|
|
73
|
-
type: string;
|
|
74
|
-
properties: {
|
|
75
|
-
rule: {
|
|
76
|
-
enum: string[];
|
|
77
|
-
description: string;
|
|
78
|
-
};
|
|
79
|
-
fn: {
|
|
80
|
-
type: string;
|
|
81
|
-
minLength: number;
|
|
82
|
-
description: string;
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
required: string[];
|
|
86
|
-
additionalProperties: boolean;
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
required: string[];
|
|
91
|
-
additionalProperties: boolean;
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
required: string[];
|
|
95
|
-
additionalProperties: boolean;
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
required: string[];
|
|
100
|
-
additionalProperties: boolean;
|
|
101
|
-
};
|
|
102
|
-
/**
|
|
103
|
-
* The output channel. It records and acknowledges; it takes no action, which is
|
|
104
|
-
* why handing it to a toolless compile call does not reopen D3.
|
|
105
|
-
* @param {{calls: any[]}} box
|
|
106
|
-
*/
|
|
107
|
-
export function proposalTool(box: {
|
|
108
|
-
calls: any[];
|
|
109
|
-
}): {
|
|
110
|
-
name: string;
|
|
111
|
-
description: string;
|
|
112
|
-
parameters: {
|
|
113
|
-
type: string;
|
|
114
|
-
properties: {
|
|
115
|
-
card: {
|
|
116
|
-
type: string;
|
|
117
|
-
description: string;
|
|
118
|
-
properties: {
|
|
119
|
-
items: {
|
|
120
|
-
type: string;
|
|
121
|
-
minItems: number;
|
|
122
|
-
items: {
|
|
123
|
-
type: string;
|
|
124
|
-
properties: {
|
|
125
|
-
rule: {
|
|
126
|
-
enum: string[];
|
|
127
|
-
description: string;
|
|
128
|
-
};
|
|
129
|
-
text: {
|
|
130
|
-
type: string;
|
|
131
|
-
minLength: number;
|
|
132
|
-
description: string;
|
|
133
|
-
};
|
|
134
|
-
};
|
|
135
|
-
required: string[];
|
|
136
|
-
additionalProperties: boolean;
|
|
137
|
-
};
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
required: string[];
|
|
141
|
-
additionalProperties: boolean;
|
|
142
|
-
};
|
|
143
|
-
cases: {
|
|
144
|
-
type: string;
|
|
145
|
-
minItems: number;
|
|
146
|
-
maxItems: number;
|
|
147
|
-
description: string;
|
|
148
|
-
items: {
|
|
149
|
-
type: string;
|
|
150
|
-
properties: {
|
|
151
|
-
id: {
|
|
152
|
-
type: string;
|
|
153
|
-
minLength: number;
|
|
154
|
-
description: string;
|
|
155
|
-
};
|
|
156
|
-
artifact: {
|
|
157
|
-
type: string;
|
|
158
|
-
minLength: number;
|
|
159
|
-
description: string;
|
|
160
|
-
};
|
|
161
|
-
expect: {
|
|
162
|
-
type: string;
|
|
163
|
-
properties: {
|
|
164
|
-
verdict: {
|
|
165
|
-
enum: string[];
|
|
166
|
-
};
|
|
167
|
-
reds: {
|
|
168
|
-
type: string;
|
|
169
|
-
description: string;
|
|
170
|
-
items: {
|
|
171
|
-
type: string;
|
|
172
|
-
properties: {
|
|
173
|
-
rule: {
|
|
174
|
-
enum: string[];
|
|
175
|
-
description: string;
|
|
176
|
-
};
|
|
177
|
-
fn: {
|
|
178
|
-
type: string;
|
|
179
|
-
minLength: number;
|
|
180
|
-
description: string;
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
|
-
required: string[];
|
|
184
|
-
additionalProperties: boolean;
|
|
185
|
-
};
|
|
186
|
-
};
|
|
187
|
-
};
|
|
188
|
-
required: string[];
|
|
189
|
-
additionalProperties: boolean;
|
|
190
|
-
};
|
|
191
|
-
};
|
|
192
|
-
required: string[];
|
|
193
|
-
additionalProperties: boolean;
|
|
194
|
-
};
|
|
195
|
-
};
|
|
196
|
-
};
|
|
197
|
-
required: string[];
|
|
198
|
-
additionalProperties: boolean;
|
|
199
|
-
};
|
|
200
|
-
execute: (args: any) => Promise<string>;
|
|
201
|
-
};
|
|
202
|
-
/**
|
|
203
|
-
* The compile prompt. The Judge Examples answer travels VERBATIM — it is the
|
|
204
|
-
* whole input, and paraphrasing a lay answer is how a rubric stops being the
|
|
205
|
-
* person's. PRD item 33 M3 piece 3: this used to be two answers (Q6+Q7);
|
|
206
|
-
* `SOFTGREEN_JUDGE_EXAMPLES_KEY` is the ONE key both the interview and this
|
|
207
|
-
* compile now read, so a future renumbering of the form moves both readers
|
|
208
|
-
* together rather than drifting.
|
|
209
|
-
*
|
|
210
|
-
* The rulebook is rendered from `JUDGE_RULES` itself rather than restated, for
|
|
211
|
-
* the reason the catalogue block is rendered from the catalogue: the prompt and
|
|
212
|
-
* the gate must describe one set of facts.
|
|
213
|
-
* @param {{answers: Record<string|number, any>, questions?: Record<string|number, string>}} o
|
|
214
|
-
*/
|
|
215
|
-
export function cardCasesPrompt({ answers, questions }: {
|
|
216
|
-
answers: Record<string | number, any>;
|
|
217
|
-
questions?: Record<string | number, string>;
|
|
218
|
-
}): string;
|
|
219
|
-
/**
|
|
220
|
-
* THE D5 MOMENT. The proposal is SHOWN; the signer's `fix` is what is STORED.
|
|
221
|
-
*
|
|
222
|
-
* The fix replaces the proposal WHOLE rather than merging into it. A merge would
|
|
223
|
-
* mean a signer who deleted a card line got it back, and "the signer signs the
|
|
224
|
-
* whole hash" is not a rule that survives a field-wise reconciliation. Handing
|
|
225
|
-
* back no fix is a legal answer — signing the proposal as proposed — and it says
|
|
226
|
-
* so (`source`), because *a person read this and changed nothing* and *nobody has
|
|
227
|
-
* looked* are two different facts.
|
|
228
|
-
*
|
|
229
|
-
* THE GATE RUNS OVER WHAT WILL BE STORED, never over the proposal: a signer can
|
|
230
|
-
* fix a legal proposal into an illegal one, and the artifact that reaches the
|
|
231
|
-
* hash is the one that must be legal.
|
|
232
|
-
*
|
|
233
|
-
* `scrubbed` is the INGEST SCRUB'S OWN ANNOUNCEMENT — the paths whose bytes the
|
|
234
|
-
* secret inventory masked on the way in. Empty on every honest artifact, and
|
|
235
|
-
* never silent when it is not: a signer signs a hash over the STORED bytes, so
|
|
236
|
-
* "what you typed is not what was stored" is a fact they are owed rather than one
|
|
237
|
-
* the redactor keeps.
|
|
238
|
-
* @param {{proposal: any, fix?: any}} o
|
|
239
|
-
* @returns {{ok: boolean, reds: Red[], card: any, cases: any[]|null, source: 'signer'|'proposal',
|
|
240
|
-
* scrubbed: {path: string}[]}}
|
|
241
|
-
*/
|
|
242
|
-
export function signJudgedArtifacts({ proposal, fix }: {
|
|
243
|
-
proposal: any;
|
|
244
|
-
fix?: any;
|
|
245
|
-
}): {
|
|
246
|
-
ok: boolean;
|
|
247
|
-
reds: Red[];
|
|
248
|
-
card: any;
|
|
249
|
-
cases: any[] | null;
|
|
250
|
-
source: "signer" | "proposal";
|
|
251
|
-
scrubbed: {
|
|
252
|
-
path: string;
|
|
253
|
-
}[];
|
|
254
|
-
};
|
|
255
|
-
/**
|
|
256
|
-
* Fold the two signed artifacts into the close declaration, ENUMERATED.
|
|
257
|
-
*
|
|
258
|
-
* WHERE EACH LANDS, and both are inside the spec so `jobSpecHash` covers them by
|
|
259
|
-
* construction (the hash is over the whole resolved spec):
|
|
260
|
-
* - THE CARD replaces the judged stage's own `params.card`. ONE card, and it is
|
|
261
|
-
* the SIGNED one: the composer's draft is a draft, and two cards in one close
|
|
262
|
-
* is the drift a single storage site exists to prevent. The stage is where it
|
|
263
|
-
* already lives, which is what `validateCard`, the M2 runner and the locate
|
|
264
|
-
* prompt all read.
|
|
265
|
-
* - THE CASES land beside the stages as `calibration.cases` — a close-level
|
|
266
|
-
* artifact, because the set calibrates the RULER and not one stage's params,
|
|
267
|
-
* and because module 5's gate reads it before any stage runs.
|
|
268
|
-
* - THE JUDGE MODEL lands beside them as `calibration.judgeModel`. Since PRD item
|
|
269
|
-
* 32.1 that is the RESOLVED judge identity the caller hands in (`resolveJudge`,
|
|
270
|
-
* src/judged.js — the spec's signed `judge` override, else the job's own worker
|
|
271
|
-
* model), not a library pin. A calibration set is only worth the judge that
|
|
272
|
-
* graded it, so the set has to carry which judge certified it or nothing
|
|
273
|
-
* downstream can tell a signed floor from a moved one. Storing it HERE, inside
|
|
274
|
-
* the spec, is what makes a judge change flip `jobSpecHash`: the signature dies,
|
|
275
|
-
* the signer re-signs, and a re-sign is a re-run of the calibration gate. It is
|
|
276
|
-
* REQUIRED, with no default — a set stamped with a model nobody named is exactly
|
|
277
|
-
* the unattributable floor this field exists to prevent (F45).
|
|
278
|
-
*
|
|
279
|
-
* A card with NOWHERE TO LAND THROWS. It is a caller's own broken input — a
|
|
280
|
-
* signed rubric folded into a close with no judged ruler — and there is no safe
|
|
281
|
-
* direction to degrade toward: storing it would sign a rubric nothing reads.
|
|
282
|
-
*
|
|
283
|
-
* The input is never mutated: a closeDecl is a signed artefact and rewriting a
|
|
284
|
-
* caller's copy in place is how two readers come to disagree about what was
|
|
285
|
-
* signed.
|
|
286
|
-
* @param {any} closeDecl @param {{card: any, cases: any[], judgeModel: string}} o
|
|
287
|
-
* @returns {any} a new closeDecl
|
|
288
|
-
*/
|
|
289
|
-
export function foldJudgedArtifacts(closeDecl: any, { card, cases, judgeModel }: {
|
|
290
|
-
card: any;
|
|
291
|
-
cases: any[];
|
|
292
|
-
judgeModel: string;
|
|
293
|
-
}): any;
|
|
294
|
-
/**
|
|
295
|
-
* ONE compile call: the person's Judge Examples answer in, a proposal out.
|
|
296
|
-
*
|
|
297
|
-
* It buys ONE artifact through ONE channel, and the malformed-emission ladder is
|
|
298
|
-
* the SHARED one (`askStructured`) rather than a second copy — a second ladder is
|
|
299
|
-
* a second place for the cap, the reject block and the re-ask to drift.
|
|
300
|
-
*
|
|
301
|
-
* WHAT IS AND IS NOT RETRIED, and the split is the standing one: a reply that
|
|
302
|
-
* carries no proposal is a TRANSPORT fault and is retried under the bound; a
|
|
303
|
-
* proposal that PARSED and then broke the ruling is not — the model answered
|
|
304
|
-
* perfectly clearly and re-asking buys another call to be told the same thing.
|
|
305
|
-
* The proposal is returned as it was said, never repaired: no JSON repair, ever.
|
|
306
|
-
*
|
|
307
|
-
* The book is the CALLER's, so one ceiling governs the survey, the declaration
|
|
308
|
-
* ladder and this compile — the advertised ceiling and the enforced ceiling are
|
|
309
|
-
* the same ceiling.
|
|
310
|
-
* @param {{answers: Record<string|number, any>, questions?: Record<string|number, string>,
|
|
311
|
-
* generate: Function, book?: ReturnType<typeof makeCostBook>,
|
|
312
|
-
* structuredMode?: 'tool'|'text', structureRetries?: number}} o
|
|
313
|
-
* @returns {Promise<{ok: boolean, proposal: any, reds: Red[], stop: string|null,
|
|
314
|
-
* attempts: number, raw: string, cost: any, raws: any[]}>}
|
|
315
|
-
*/
|
|
316
|
-
export function proposeJudgedArtifacts({ answers, questions, generate, book, structuredMode, structureRetries, }: {
|
|
317
|
-
answers: Record<string | number, any>;
|
|
318
|
-
questions?: Record<string | number, string>;
|
|
319
|
-
generate: Function;
|
|
320
|
-
book?: ReturnType<typeof makeCostBook>;
|
|
321
|
-
structuredMode?: "tool" | "text";
|
|
322
|
-
structureRetries?: number;
|
|
323
|
-
}): Promise<{
|
|
324
|
-
ok: boolean;
|
|
325
|
-
proposal: any;
|
|
326
|
-
reds: Red[];
|
|
327
|
-
stop: string | null;
|
|
328
|
-
attempts: number;
|
|
329
|
-
raw: string;
|
|
330
|
-
cost: any;
|
|
331
|
-
raws: any[];
|
|
332
|
-
}>;
|
|
333
|
-
/** @typedef {{code: string, path: string, detail: string, [k: string]: any}} Red */
|
|
334
|
-
/** the output channel for the compile. It takes no action; it carries the answer. */
|
|
335
|
-
export const PROPOSAL_TOOL_NAME: "propose_rubric";
|
|
336
|
-
/** what the tool returns. The loop stops on delivery, so the model never reads it. */
|
|
337
|
-
export const PROPOSAL_ACK: "proposal received";
|
|
338
|
-
/** the label the compile call is metered and persisted under — one spelling */
|
|
339
|
-
export const PROPOSAL_LABEL: "judged-compile";
|
|
340
|
-
/** a malformed EMISSION is a transport fault, bounded on its own axis — the same
|
|
341
|
-
* ceiling `authorClose` declares for the declaration channel */
|
|
342
|
-
export const MAX_PROPOSAL_RETRIES: 2;
|
|
343
|
-
/**
|
|
344
|
-
* The system prompt a caller BINDS ITS SEAM WITH — this module owns no provider
|
|
345
|
-
* and picks none, exactly as `authorClose` does not: the compile call arrives as
|
|
346
|
-
* `generate`, and a caller wires it with `makeLoopGenerate(provider, {system:
|
|
347
|
-
* COMPILE_SYSTEM})`, whose own `maxTokens` default (F30) is what holds ten
|
|
348
|
-
* artifacts. Exported rather than inlined so the one register this call is made
|
|
349
|
-
* in is not re-spelled at every integration.
|
|
350
|
-
*/
|
|
351
|
-
export const COMPILE_SYSTEM: string;
|
|
352
|
-
export type Red = {
|
|
353
|
-
code: string;
|
|
354
|
-
path: string;
|
|
355
|
-
detail: string;
|
|
356
|
-
[k: string]: any;
|
|
357
|
-
};
|
|
358
|
-
import { makeCostBook } from './authorflow.js';
|
package/types/fitcheck.d.ts
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What the AI is told: the job lines (the numbered text only, no `~` rules) and the WHOLE text of every input under its label. Adapted from the POC
|
|
3
|
-
* call (.claude/scratch/fit-poc6/run.mjs): the asks are copied from each job line instead of hand-written.
|
|
4
|
-
* @param {{jobLines: {n: number, text: string}[], texts: Record<string, string>}} o
|
|
5
|
-
* @returns {string}
|
|
6
|
-
*/
|
|
7
|
-
export function fitPrompt({ jobLines, texts }: {
|
|
8
|
-
jobLines: {
|
|
9
|
-
n: number;
|
|
10
|
-
text: string;
|
|
11
|
-
}[];
|
|
12
|
-
texts: Record<string, string>;
|
|
13
|
-
}): string;
|
|
14
|
-
/**
|
|
15
|
-
* Read the AI's reply and decide, all in code. Malformed (no repair): not JSON, another form, a line that is not a job line, an ask not copied from its own
|
|
16
|
-
* line, found not a boolean, a quote neither text nor null, or a job line with no ask. An ask is found only if `found` is true AND its quote is on a page;
|
|
17
|
-
* `found` with a quote that is not on any page (or no quote) is made up and counts as not found.
|
|
18
|
-
* @param {unknown} text the reply
|
|
19
|
-
* @param {{n: number, text: string}[]} jobLines
|
|
20
|
-
* @param {Record<string, string>} texts the frozen input texts by label
|
|
21
|
-
* @returns {{status: 'malformed'}|{status: 'ok', state: 'fits'|'ask', asks: FitAsk[], notFound: {line: number, ask: string}[]}}
|
|
22
|
-
*/
|
|
23
|
-
export function decideFit(text: unknown, jobLines: {
|
|
24
|
-
n: number;
|
|
25
|
-
text: string;
|
|
26
|
-
}[], texts: Record<string, string>): {
|
|
27
|
-
status: "malformed";
|
|
28
|
-
} | {
|
|
29
|
-
status: "ok";
|
|
30
|
-
state: "fits" | "ask";
|
|
31
|
-
asks: FitAsk[];
|
|
32
|
-
notFound: {
|
|
33
|
-
line: number;
|
|
34
|
-
ask: string;
|
|
35
|
-
}[];
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Run the fit check: one call (one retry on a malformed reply or a transport failure or a 429). Never throws on a call casualty; every failure is `absent`.
|
|
39
|
-
* @param {{jobLines: {n: number, text: string}[], texts: Record<string, string>, provider?: any, maxTokens?: number, ceilingUsd?: number|null,
|
|
40
|
-
* callTimeoutMs?: number, onCall?: (call: {label: string, costUsd: number|null, unpricedRounds: number, thinkingStatus?: string, raw?: string}) => void,
|
|
41
|
-
* createLoop?: Function, rates?: {in: number, out: number}|null, callOptions?: Record<string, any>, sleep?: (ms: number) => Promise<void>}} o
|
|
42
|
-
* @returns {Promise<{state: 'fits'|'ask'|'absent', asks: FitAsk[], notFound: {line: number, ask: string}[], reason: string|null, cause: string|null,
|
|
43
|
-
* calls: {label: string, costUsd: number|null, unpricedRounds: number}[], budgetStop: 'cap-halt'|'pricing-red'|null}>}
|
|
44
|
-
*/
|
|
45
|
-
export function runFitCheck({ jobLines, texts, provider, maxTokens, ceilingUsd, callTimeoutMs, onCall, createLoop, rates, callOptions, sleep, }: {
|
|
46
|
-
jobLines: {
|
|
47
|
-
n: number;
|
|
48
|
-
text: string;
|
|
49
|
-
}[];
|
|
50
|
-
texts: Record<string, string>;
|
|
51
|
-
provider?: any;
|
|
52
|
-
maxTokens?: number;
|
|
53
|
-
ceilingUsd?: number | null;
|
|
54
|
-
callTimeoutMs?: number;
|
|
55
|
-
onCall?: (call: {
|
|
56
|
-
label: string;
|
|
57
|
-
costUsd: number | null;
|
|
58
|
-
unpricedRounds: number;
|
|
59
|
-
thinkingStatus?: string;
|
|
60
|
-
raw?: string;
|
|
61
|
-
}) => void;
|
|
62
|
-
createLoop?: Function;
|
|
63
|
-
rates?: {
|
|
64
|
-
in: number;
|
|
65
|
-
out: number;
|
|
66
|
-
} | null;
|
|
67
|
-
callOptions?: Record<string, any>;
|
|
68
|
-
sleep?: (ms: number) => Promise<void>;
|
|
69
|
-
}): Promise<{
|
|
70
|
-
state: "fits" | "ask" | "absent";
|
|
71
|
-
asks: FitAsk[];
|
|
72
|
-
notFound: {
|
|
73
|
-
line: number;
|
|
74
|
-
ask: string;
|
|
75
|
-
}[];
|
|
76
|
-
reason: string | null;
|
|
77
|
-
cause: string | null;
|
|
78
|
-
calls: {
|
|
79
|
-
label: string;
|
|
80
|
-
costUsd: number | null;
|
|
81
|
-
unpricedRounds: number;
|
|
82
|
-
}[];
|
|
83
|
-
budgetStop: "cap-halt" | "pricing-red" | null;
|
|
84
|
-
}>;
|
|
85
|
-
/** the label of the one paid call, as the drafting book and the progress line see it */
|
|
86
|
-
export const FIT_CALL_LABEL: "fit-check";
|
|
87
|
-
/** what the chat says when the check did not finish (drafting goes on) */
|
|
88
|
-
export const FIT_ABSENT_NOTE: "The fit check did not finish; drafting goes on.";
|
|
89
|
-
/** the answer that keeps drafting after the fit question (any case, a closing full stop allowed) */
|
|
90
|
-
export const FIT_GO_ON: "go on";
|
|
91
|
-
export function isGoOn(text: unknown): boolean;
|
|
92
|
-
export const FIT_SYSTEM: "You check whether saved web pages show what a job asks for. You never invent words: every ask must be copied from its job line and every quote must be copied from the page, character for character.";
|
|
93
|
-
export function norm(s: unknown): string;
|
|
94
|
-
export function notFoundList(notFound: {
|
|
95
|
-
line: number;
|
|
96
|
-
ask: string;
|
|
97
|
-
}[]): string;
|
|
98
|
-
export function fitQuestionText({ found, total, notFound }: {
|
|
99
|
-
found: number;
|
|
100
|
-
total: number;
|
|
101
|
-
notFound: {
|
|
102
|
-
line: number;
|
|
103
|
-
ask: string;
|
|
104
|
-
}[];
|
|
105
|
-
}): string;
|
|
106
|
-
export type FitAsk = {
|
|
107
|
-
line: number;
|
|
108
|
-
ask: string;
|
|
109
|
-
found: boolean;
|
|
110
|
-
quote: string | null;
|
|
111
|
-
madeUp: boolean;
|
|
112
|
-
ignored?: "number";
|
|
113
|
-
};
|