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
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {{kind: 'headingBetween'|'headingDateAfter', prefix: string, end: string, shape: string, skip: string[]}} PlaceRule
|
|
3
|
+
* @typedef {{found: true, value: string, lineIndex: number}|{found: false, reason: string}} PlaceRead
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Why a rule is not a legal place rule, or null when it is. Pure.
|
|
7
|
+
* @param {unknown} rule @returns {string|null}
|
|
8
|
+
*/
|
|
9
|
+
export function placeRuleProblem(rule: unknown): string | null;
|
|
10
|
+
/**
|
|
11
|
+
* Heading lines at the rule's level: lines outside ``` / ~~~ fences that start with the level mark (for example "## "). Pure.
|
|
12
|
+
* @param {string} text @param {string} prefix @returns {{i: number, line: string}[]}
|
|
13
|
+
*/
|
|
14
|
+
export function levelLines(text: string, prefix: string): {
|
|
15
|
+
i: number;
|
|
16
|
+
line: string;
|
|
17
|
+
}[];
|
|
18
|
+
/**
|
|
19
|
+
* The mixed-level guard: every non-fenced heading line is scanned; semver-carrying headings at MORE THAN ONE level mean mixed. A heading with no
|
|
20
|
+
* semver (a "# Changelog" title, "### Fixed") is ignored. It only ever turns a read into not found, never into a value.
|
|
21
|
+
* @param {string} text @returns {boolean}
|
|
22
|
+
*/
|
|
23
|
+
export function mixedLevels(text: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Read one rule against one input text: the run-start function, code only. A rule that is not legal throws (the signed spec was validated, so a bad one
|
|
26
|
+
* is a defect, never a read).
|
|
27
|
+
* @param {PlaceRule} rule @param {string} text @returns {PlaceRead}
|
|
28
|
+
*/
|
|
29
|
+
export function readPlace(rule: PlaceRule, text: string): PlaceRead;
|
|
30
|
+
/**
|
|
31
|
+
* Fit a place rule to a fact's own words, by CODE, at drafting. The words must be exactly one version (X.Y.Z) or exactly one ISO date; the frozen
|
|
32
|
+
* candidates are walked in order, and the first whose strict first-heading read on the input's own text returns exactly those words wins. Null =
|
|
33
|
+
* no fit (a version and a date together, any other words, another date form, a mixed-level file, no text, or no candidate reading them): the caller
|
|
34
|
+
* refuses the words as week-only exactly as before. Only the two kinds are handled. Pure.
|
|
35
|
+
* @param {string} words @param {string|null|undefined} text
|
|
36
|
+
* @returns {PlaceRule|null}
|
|
37
|
+
*/
|
|
38
|
+
export function fitPlaceRule(words: string, text: string | null | undefined): PlaceRule | null;
|
|
39
|
+
/**
|
|
40
|
+
* STRIP (P1b, hamr 2026-11-11): the words of a phrase fact that are a piece of the newest release heading ("## [0.54.1]", "[0.54.1] -", "0.54.1",
|
|
41
|
+
* "2026-11-04", "## [0.54.1] - 2026-11-04") are stripped by code to their value(s). The words hold exactly one version (X.Y.Z, an optional leading v) and/or
|
|
42
|
+
* exactly one ISO date and nothing else but heading marks; each value is fitted with {@link fitPlaceRule} on the input's own text, and when both are
|
|
43
|
+
* present both must sit on the SAME first release heading line. Returns the values (version first) each with its rule, or null: two versions, two dates,
|
|
44
|
+
* any other word, another date form, a value that is not at the first release heading, no text. Pure.
|
|
45
|
+
* @param {string} words @param {string|null|undefined} text
|
|
46
|
+
* @returns {{kind: 'version'|'date', value: string, rule: PlaceRule}[]|null}
|
|
47
|
+
*/
|
|
48
|
+
export function fitPlacePhrase(words: string, text: string | null | undefined): {
|
|
49
|
+
kind: "version" | "date";
|
|
50
|
+
value: string;
|
|
51
|
+
rule: PlaceRule;
|
|
52
|
+
}[] | null;
|
|
53
|
+
/**
|
|
54
|
+
* @typedef {{key: string, name: string, source: string, stage: number, part: number, fact: number, place: PlaceRule, phrase: string}} PlaceFact
|
|
55
|
+
*/
|
|
56
|
+
/**
|
|
57
|
+
* Every place-rule fact of a spec, in stage / part / fact order. The key is the stage's name and the fact's name (both stable across the runs of one
|
|
58
|
+
* workflow), so an earlier run's record finds the same fact. Pure.
|
|
59
|
+
* @param {any} spec @returns {PlaceFact[]}
|
|
60
|
+
*/
|
|
61
|
+
export function placeFactsOf(spec: any): PlaceFact[];
|
|
62
|
+
/**
|
|
63
|
+
* A copy of the spec with each place fact's phrase replaced by the value the run read. The input spec is never touched (the signed spec and its hash
|
|
64
|
+
* stay as signed); the copy is for this run's planner and close only. A key with no value is left as the signed drafting words.
|
|
65
|
+
* @param {any} spec @param {Record<string, string>} values place-fact key to the value read @returns {any}
|
|
66
|
+
*/
|
|
67
|
+
export function bindPlaceValues(spec: any, values: Record<string, string>): any;
|
|
68
|
+
/**
|
|
69
|
+
* The value the drafting words themselves hold for this rule: the first version for headingBetween, the first ISO date for headingDateAfter. Null when
|
|
70
|
+
* the words hold none. Used as "last read" when no earlier run has one.
|
|
71
|
+
* @param {PlaceRule} rule @param {string} words @returns {string|null}
|
|
72
|
+
*/
|
|
73
|
+
export function valueInWords(rule: PlaceRule, words: string): string | null;
|
|
74
|
+
/**
|
|
75
|
+
* Re-read EVERY place fact against the run's own input text, one by one, before any spend. A row is same / new / notfound. Any notfound stops the run;
|
|
76
|
+
* otherwise the run proceeds with the new words.
|
|
77
|
+
* @param {{fact: PlaceFact, text: string|null, was: string|null}[]} items `text` null = the input could not be read
|
|
78
|
+
* @returns {{proceed: boolean, rows: {key: string, name: string, kind: string, found: boolean, value: string|null, was: string|null, reason: string|null}[], values: Record<string, string>}}
|
|
79
|
+
*/
|
|
80
|
+
export function readPlaceRules(items: {
|
|
81
|
+
fact: PlaceFact;
|
|
82
|
+
text: string | null;
|
|
83
|
+
was: string | null;
|
|
84
|
+
}[]): {
|
|
85
|
+
proceed: boolean;
|
|
86
|
+
rows: {
|
|
87
|
+
key: string;
|
|
88
|
+
name: string;
|
|
89
|
+
kind: string;
|
|
90
|
+
found: boolean;
|
|
91
|
+
value: string | null;
|
|
92
|
+
was: string | null;
|
|
93
|
+
reason: string | null;
|
|
94
|
+
}[];
|
|
95
|
+
values: Record<string, string>;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* The words of the $0 stop, plain words from code. Every rule is listed, found or not: "<name>: found <value>" (with "(was <last>)" when the value is
|
|
99
|
+
* new) or "<name>: not found (<plain reason>)", then the closing line. The reasons come only from the closed list.
|
|
100
|
+
* @param {{name: string, found: boolean, value: string|null, was: string|null, reason: string|null}[]} rows @returns {string}
|
|
101
|
+
*/
|
|
102
|
+
export function stopWords(rows: {
|
|
103
|
+
name: string;
|
|
104
|
+
found: boolean;
|
|
105
|
+
value: string | null;
|
|
106
|
+
was: string | null;
|
|
107
|
+
reason: string | null;
|
|
108
|
+
}[]): string;
|
|
109
|
+
/**
|
|
110
|
+
* The values of the LAST `place-rules` record in a run's own events (key to value): what a RESUME of that run rebinds, since a resume does not re-read. Null when
|
|
111
|
+
* there is no record, or any of its rows was not found.
|
|
112
|
+
* @param {any[]} events @returns {Record<string, string>|null}
|
|
113
|
+
*/
|
|
114
|
+
export function placeValuesOfEvents(events: any[]): Record<string, string> | null;
|
|
115
|
+
/**
|
|
116
|
+
* What the newest EARLIER run of the same workflow read, per fact key: "last read". `rows` are the run list's rows (file order, oldest first). Candidates are
|
|
117
|
+
* the rows of the same job, newest first, at most {@link LAST_READ_LOOK} of them; the first whose spine holds a `place-rules` record of the same workflow key
|
|
118
|
+
* answers. An unreadable spine is skipped. Empty when there is none (the caller falls back to the drafting words).
|
|
119
|
+
* @param {{rows: {runid: string, job: string, spine: string}[], job: string, workflowKey: string, runid: string}} o @returns {Record<string, string>}
|
|
120
|
+
*/
|
|
121
|
+
export function lastPlaceRead({ rows, job, workflowKey, runid }: {
|
|
122
|
+
rows: {
|
|
123
|
+
runid: string;
|
|
124
|
+
job: string;
|
|
125
|
+
spine: string;
|
|
126
|
+
}[];
|
|
127
|
+
job: string;
|
|
128
|
+
workflowKey: string;
|
|
129
|
+
runid: string;
|
|
130
|
+
}): Record<string, string>;
|
|
131
|
+
/**
|
|
132
|
+
* The Audit lines of a run's `place-rules` record, in plain words from code: "<name>: <value>" (with "(was <last>)" when the value is new) or
|
|
133
|
+
* "<name>: not found (<reason>)". Null when the run has no record.
|
|
134
|
+
* @param {any[]} events @returns {string[]|null}
|
|
135
|
+
*/
|
|
136
|
+
export function placeRuleLines(events: any[]): string[] | null;
|
|
137
|
+
/** the two rule kinds on the menu: the version in a heading, and the date on the same heading line */
|
|
138
|
+
export const PLACE_KINDS: readonly string[];
|
|
139
|
+
/** the end-of-line end mark */
|
|
140
|
+
export const EOL: "$EOL";
|
|
141
|
+
/** the field a place rule may carry */
|
|
142
|
+
export const PLACE_FIELDS: readonly string[];
|
|
143
|
+
/** the closed list of reasons a read can end not found */
|
|
144
|
+
export const PLACE_REASONS: readonly string[];
|
|
145
|
+
/** plain words for each reason, from code (the person never reads a raw code) */
|
|
146
|
+
export const PLAIN_REASONS: Readonly<{
|
|
147
|
+
'mixed-levels': "the file writes its version headings at more than one level";
|
|
148
|
+
'no-heading-line': "the file has no heading at the level the rule reads";
|
|
149
|
+
'first-heading-mismatch': "the newest heading does not start the way the rule says";
|
|
150
|
+
'end-mark-missing': "the newest heading does not have the mark the rule reads up to";
|
|
151
|
+
'capture-not-shape': "the newest heading does not carry a version number";
|
|
152
|
+
'only-skipped-headings': "the file has only an Unreleased heading and no release after it";
|
|
153
|
+
'no-date-on-line': "the newest heading line carries no date";
|
|
154
|
+
'no-file': "the input could not be read";
|
|
155
|
+
'empty-text': "the input is empty";
|
|
156
|
+
}>;
|
|
157
|
+
/** the frozen candidate list: 9 prefixes crossed with 3 ends, prefix-major (27) */
|
|
158
|
+
export const PLACE_CANDIDATES: readonly Readonly<{
|
|
159
|
+
prefix: string;
|
|
160
|
+
end: string;
|
|
161
|
+
}>[];
|
|
162
|
+
/** the end of the stop words: what the person can do, and that nothing ran or was spent */
|
|
163
|
+
export const STOP_TAIL: "Reuse workflow and adjust the rules, or check the input. The run did not start. Nothing spent.";
|
|
164
|
+
/** the plain words of the door's refusal when a place-rule run has no record of the values it read */
|
|
165
|
+
export const NO_PLACE_RECORD_WORDS: "This run has no record of the values it read, so it cannot be checked again. Use Reuse workflow.";
|
|
166
|
+
/** the spine event a run writes, once, after job-start */
|
|
167
|
+
export const PLACE_EVENT: "place-rules";
|
|
168
|
+
/** how many earlier runs of the job are looked at for "last read" */
|
|
169
|
+
export const LAST_READ_LOOK: 25;
|
|
170
|
+
export type PlaceRule = {
|
|
171
|
+
kind: "headingBetween" | "headingDateAfter";
|
|
172
|
+
prefix: string;
|
|
173
|
+
end: string;
|
|
174
|
+
shape: string;
|
|
175
|
+
skip: string[];
|
|
176
|
+
};
|
|
177
|
+
export type PlaceRead = {
|
|
178
|
+
found: true;
|
|
179
|
+
value: string;
|
|
180
|
+
lineIndex: number;
|
|
181
|
+
} | {
|
|
182
|
+
found: false;
|
|
183
|
+
reason: string;
|
|
184
|
+
};
|
|
185
|
+
export type PlaceFact = {
|
|
186
|
+
key: string;
|
|
187
|
+
name: string;
|
|
188
|
+
source: string;
|
|
189
|
+
stage: number;
|
|
190
|
+
part: number;
|
|
191
|
+
fact: number;
|
|
192
|
+
place: PlaceRule;
|
|
193
|
+
phrase: string;
|
|
194
|
+
};
|
package/types/planrun.d.ts
CHANGED
|
@@ -183,21 +183,6 @@ export function planPrompt(job: any, scoutBlob: string, reds: any[] | null, maxS
|
|
|
183
183
|
* @param {{in: number, out: number}|null} [opts.rates] the customer's own price for the worker's key row (USD per
|
|
184
184
|
* 1K tokens, `ratesFor`) — handed to the one Loop that drives worker, scout and planner rounds, so they read
|
|
185
185
|
* `rateSource:'caller'`; null = bare-agent's built-in guess. Not applied to a native (CLI) session, which reports its own cost.
|
|
186
|
-
* @param {{in: number, out: number}|null} [opts.judgeRates] the same, for the judge's Loop
|
|
187
|
-
* @param {string|null} [opts.judgeModel] softgreen — WHICH model that judge provider drives
|
|
188
|
-
* (PRD item 32.1). Resolved by the CALLER (`resolveJudge`, src/judged.js: the spec's signed
|
|
189
|
-
* `judge` override, else the job's own worker model), never pinned in this library. It
|
|
190
|
-
* travels with `judgeProvider` or the judged stage stops as a wiring gap: a verdict whose
|
|
191
|
-
* grader cannot be named is a floor nobody can attribute.
|
|
192
|
-
* @param {any} [opts.judgeProvider] softgreen — the provider a JUDGED close stage runs its
|
|
193
|
-
* locate call through, built by the CALLER from the RESOLVED judge identity (PRD item
|
|
194
|
-
* 32.1: `resolveJudge`, src/judged.js — the spec's signed `judge` override, else the job's
|
|
195
|
-
* own worker provider and model), never pinned in this library. Separate
|
|
196
|
-
* from `provider`/`providerFor` on purpose: the judge tier is not a step knob and never
|
|
197
|
-
* agent-selectable, and the worker's binding is not a legal stand-in for it. Absent is not
|
|
198
|
-
* a fall-back — a judged stage with no seam instrument-STOPS as a wiring gap, the same
|
|
199
|
-
* answer a native job with no `nativeProvider` gets. A close with no judged stage never
|
|
200
|
-
* reads it.
|
|
201
186
|
* @param {(type: string, data?: object) => object} opts.emit spine emitter (the caller's METERED emit)
|
|
202
187
|
* @param {() => number} opts.remainingUsd the one wallet: what is left of the signed budget right now
|
|
203
188
|
* @param {() => boolean} [opts.isUnpriced] has any round come back with a null cost? (F6) — the
|
|
@@ -415,7 +400,7 @@ export function planPrompt(job: any, scoutBlob: string, reds: any[] | null, maxS
|
|
|
415
400
|
* 'branch-red' | 'cap-halt' | 'wall-halt' | 'stopped' | 'provider-red' | 'interpreter-red' |
|
|
416
401
|
* 'step-stalled' | 'hitl-pause' | 'hitl-decision-red' | `step-red:<id>`
|
|
417
402
|
*/
|
|
418
|
-
export function runPlan(job: any, { workdir, provider, nativeProvider, providerFor,
|
|
403
|
+
export function runPlan(job: any, { workdir, provider, nativeProvider, providerFor, rates, emit, remainingUsd, isUnpriced, spendComplete, capRuns, strikeLimit, closeTimeoutMs, closeDir, maxStepRounds, layerRoot, readShim, scout, scoutRounds, bridge, now, priorWallMs, resumeSeed, resumeGrades, resumeReplans, resumeBranch, humanRuling, heldRuling, priorSpentUsd, reviewDoor, doorRerun, resumable, stopFile, learnHints }: {
|
|
419
404
|
workdir: string;
|
|
420
405
|
provider: any;
|
|
421
406
|
nativeProvider?: ((o: {
|
|
@@ -428,12 +413,6 @@ export function runPlan(job: any, { workdir, provider, nativeProvider, providerF
|
|
|
428
413
|
in: number;
|
|
429
414
|
out: number;
|
|
430
415
|
} | null | undefined;
|
|
431
|
-
judgeRates?: {
|
|
432
|
-
in: number;
|
|
433
|
-
out: number;
|
|
434
|
-
} | null | undefined;
|
|
435
|
-
judgeModel?: string | null | undefined;
|
|
436
|
-
judgeProvider?: any;
|
|
437
416
|
emit: (type: string, data?: object) => object;
|
|
438
417
|
remainingUsd: () => number;
|
|
439
418
|
isUnpriced?: (() => boolean) | undefined;
|
package/types/providerrows.d.ts
CHANGED
|
@@ -233,37 +233,6 @@ export function ratesOfLine(line: ModelLine): {
|
|
|
233
233
|
inPerM: number;
|
|
234
234
|
outPerM: number;
|
|
235
235
|
} | null;
|
|
236
|
-
/**
|
|
237
|
-
* The row a judge's key and endpoint come from: the worker's own row when the judge shares the worker's API shape, else the judge
|
|
238
|
-
* shape's row that ticks the judge's model (else the first row of that shape). `null` when no row is on that shape.
|
|
239
|
-
* @param {readonly KeyRow[]} rows
|
|
240
|
-
* @param {{ provider: string, model?: string|null }} judge
|
|
241
|
-
* @param {string|null|undefined} workerProvider
|
|
242
|
-
* @param {KeyRow|null} workerRow
|
|
243
|
-
* @returns {KeyRow|null}
|
|
244
|
-
*/
|
|
245
|
-
export function judgeRowFor(rows: readonly KeyRow[], judge: {
|
|
246
|
-
provider: string;
|
|
247
|
-
model?: string | null;
|
|
248
|
-
}, workerProvider: string | null | undefined, workerRow: KeyRow | null): KeyRow | null;
|
|
249
|
-
/**
|
|
250
|
-
* The price a judge's rounds are booked at. A price belongs to the MODEL's line: when the judge is
|
|
251
|
-
* the worker's own provider it calls the worker's endpoint, so a row on that endpoint with a line
|
|
252
|
-
* NAMED for the judge's model prices it ({@link ratesFor}); a judge model that is absent or names
|
|
253
|
-
* no line there keeps the worker's price (the worker's row, or none = the guess). A different
|
|
254
|
-
* provider resolves with no endpoint. The judge's KEY is chosen elsewhere (`judgeRowFor`:
|
|
255
|
-
* the worker's own row when the judge shares its provider), so the two can come from different rows.
|
|
256
|
-
* @param {{ provider: string, model?: string|null }} judge
|
|
257
|
-
* @param {string|null|undefined} workerProvider
|
|
258
|
-
* @param {string|null|undefined} workerBaseUrl
|
|
259
|
-
* @param {ReturnType<typeof ratesFor>} workerPrice what the worker's own rounds are booked at
|
|
260
|
-
* @param {readonly KeyRow[]} rows
|
|
261
|
-
* @returns {ReturnType<typeof ratesFor>}
|
|
262
|
-
*/
|
|
263
|
-
export function judgeRatesFor(judge: {
|
|
264
|
-
provider: string;
|
|
265
|
-
model?: string | null;
|
|
266
|
-
}, workerProvider: string | null | undefined, workerBaseUrl: string | null | undefined, workerPrice: ReturnType<typeof ratesFor>, rows: readonly KeyRow[]): ReturnType<typeof ratesFor>;
|
|
267
236
|
export { SHAPES };
|
|
268
237
|
/**
|
|
269
238
|
* A key line whose value is the word `null` is SET and means "no real key": the row exists and
|
package/types/providers.d.ts
CHANGED
|
@@ -52,40 +52,24 @@ export function makeProvider(providerName: string, { apiKey, model, baseUrl, leg
|
|
|
52
52
|
legacyMaxTokens?: boolean;
|
|
53
53
|
}): any;
|
|
54
54
|
/**
|
|
55
|
-
* Build the `{provider, providerFor
|
|
56
|
-
*
|
|
57
|
-
* already-RESOLVED worker model id (the caller picked the Settings line).
|
|
58
|
-
*
|
|
59
|
-
* THE JUDGE IS NOT PINNED (PRD item 32.2): it is constructed through this same factory from a `judgeProviderName`/`judgeModel`
|
|
60
|
-
* pair the CALLER resolved. `judgeApiKey` stays a SEPARATE argument: the judge may be a different provider from the worker,
|
|
61
|
-
* and each key is read by the caller from its own row.
|
|
55
|
+
* Build the `{provider, providerFor}` pair both authoring runners need (`src/authorrun.js` and `src/panel/authorsession.js` call it) — ONE seam
|
|
56
|
+
* instead of two copies of the same construction. `model` is the already-RESOLVED worker model id (the caller picked the Settings line).
|
|
62
57
|
* @param {object} args
|
|
63
58
|
* @param {string} args.providerName the worker's API shape id
|
|
64
59
|
* @param {string|undefined} args.apiKey the WORKER's key, read from its row's env name
|
|
65
60
|
* @param {string} args.model the already-resolved worker model id
|
|
66
61
|
* @param {string|undefined} [args.baseUrl] the worker row's Base URL
|
|
67
62
|
* @param {boolean} [args.legacyMaxTokens] the worker row's old max_tokens tick
|
|
68
|
-
* @param {string|undefined} args.judgeApiKey the judge's own key
|
|
69
|
-
* @param {string} args.judgeModel the resolved judge model id
|
|
70
|
-
* @param {string} [args.judgeProviderName] the resolved judge shape; defaults to `providerName`
|
|
71
|
-
* @param {string|undefined} [args.judgeBaseUrl] the judge row's endpoint
|
|
72
|
-
* @param {boolean} [args.judgeLegacyMaxTokens] the judge row's old max_tokens tick (defaults to the worker's when the judge shares its provider)
|
|
73
63
|
*/
|
|
74
|
-
export function buildRunnerProviders({ providerName, apiKey, model, baseUrl, legacyMaxTokens
|
|
64
|
+
export function buildRunnerProviders({ providerName, apiKey, model, baseUrl, legacyMaxTokens }: {
|
|
75
65
|
providerName: string;
|
|
76
66
|
apiKey: string | undefined;
|
|
77
67
|
model: string;
|
|
78
68
|
baseUrl?: string | undefined;
|
|
79
69
|
legacyMaxTokens?: boolean | undefined;
|
|
80
|
-
judgeApiKey: string | undefined;
|
|
81
|
-
judgeModel: string;
|
|
82
|
-
judgeProviderName?: string | undefined;
|
|
83
|
-
judgeBaseUrl?: string | undefined;
|
|
84
|
-
judgeLegacyMaxTokens?: boolean | undefined;
|
|
85
70
|
}): {
|
|
86
71
|
provider: any;
|
|
87
72
|
providerFor: (_tier: string) => any;
|
|
88
|
-
judgeProvider: any;
|
|
89
73
|
};
|
|
90
74
|
/**
|
|
91
75
|
* $0 reachability check: ONE GET of the provider's models list (`src/modellist.js`, the one owner of
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which buttons a look question offers. Agree only when it carries a proposal (a reading ask with its reading, a check-pick ask with its check); Drop it only where "drop it" leaves
|
|
3
|
+
* one of the person's own `~` rules Not checked (a can't-check ask or a check-pick ask about a rule number).
|
|
4
|
+
* @param {{source?: string, ask?: string, reading?: unknown, check?: unknown, rule?: unknown}} q @returns {{agree: boolean, drop: boolean}}
|
|
5
|
+
*/
|
|
6
|
+
export function offersOf(q: {
|
|
7
|
+
source?: string;
|
|
8
|
+
ask?: string;
|
|
9
|
+
reading?: unknown;
|
|
10
|
+
check?: unknown;
|
|
11
|
+
rule?: unknown;
|
|
12
|
+
}): {
|
|
13
|
+
agree: boolean;
|
|
14
|
+
drop: boolean;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* A look question as the PANEL shows it: the code's own answer words (`Answer "agree"...` / `Answer "drop it"...`) cut off the end, because the buttons and the box say it.
|
|
18
|
+
* Only the known tails are cut, matched exactly as a suffix (never a pattern over the prose); a question that ends in none of them is returned whole.
|
|
19
|
+
* @param {{question: string, line?: number, source?: string}} q @returns {string}
|
|
20
|
+
*/
|
|
21
|
+
export function panelQuestionText(q: {
|
|
22
|
+
question: string;
|
|
23
|
+
line?: number;
|
|
24
|
+
source?: string;
|
|
25
|
+
}): string;
|
|
26
|
+
/**
|
|
27
|
+
* What the panel's question box shows for one pending ask. Only a question the person answers (`kind: 'answer'`) has a box; every other ask (language, menu, install)
|
|
28
|
+
* keeps the chat input. `sendChoice` = the choice the box's own Send posts.
|
|
29
|
+
* @param {{kind: string, source?: string, index?: number, total?: number, question?: string, line?: number, offers?: {agree: boolean, drop: boolean}, folder?: string, current?: string}} step
|
|
30
|
+
* @returns {{head: string, line: string, text: string, choices: {choice: string, label: string}[], orLabel: string|null, sendChoice: string}|null}
|
|
31
|
+
*/
|
|
32
|
+
export function boxFor(step: {
|
|
33
|
+
kind: string;
|
|
34
|
+
source?: string;
|
|
35
|
+
index?: number;
|
|
36
|
+
total?: number;
|
|
37
|
+
question?: string;
|
|
38
|
+
line?: number;
|
|
39
|
+
offers?: {
|
|
40
|
+
agree: boolean;
|
|
41
|
+
drop: boolean;
|
|
42
|
+
};
|
|
43
|
+
folder?: string;
|
|
44
|
+
current?: string;
|
|
45
|
+
}): {
|
|
46
|
+
head: string;
|
|
47
|
+
line: string;
|
|
48
|
+
text: string;
|
|
49
|
+
choices: {
|
|
50
|
+
choice: string;
|
|
51
|
+
label: string;
|
|
52
|
+
}[];
|
|
53
|
+
orLabel: string | null;
|
|
54
|
+
sendChoice: string;
|
|
55
|
+
} | null;
|
|
56
|
+
/**
|
|
57
|
+
* The door's check of a choice sent for the pending ask. Null = accepted; else the refusal words.
|
|
58
|
+
* @param {{kind: string, source?: string, rule?: unknown, offers?: {agree: boolean, drop: boolean}}} step @param {unknown} choice @returns {string|null}
|
|
59
|
+
*/
|
|
60
|
+
export function refuseChoice(step: {
|
|
61
|
+
kind: string;
|
|
62
|
+
source?: string;
|
|
63
|
+
rule?: unknown;
|
|
64
|
+
offers?: {
|
|
65
|
+
agree: boolean;
|
|
66
|
+
drop: boolean;
|
|
67
|
+
};
|
|
68
|
+
}, choice: unknown): string | null;
|
|
69
|
+
/**
|
|
70
|
+
* What a choice resolves the question with: the words the asker reads (today's own words for the effect, so the drafting log and the CLI path see the same), and the chat line the person
|
|
71
|
+
* sees as their own. `rule` = the box's words kept whole.
|
|
72
|
+
* @param {unknown} choice @param {unknown} text @returns {{value: string, shown: string}|{error: string}}
|
|
73
|
+
*/
|
|
74
|
+
export function resolveChoice(choice: unknown, text: unknown): {
|
|
75
|
+
value: string;
|
|
76
|
+
shown: string;
|
|
77
|
+
} | {
|
|
78
|
+
error: string;
|
|
79
|
+
};
|
|
80
|
+
/** the door's refusals, word for word (fwd am31); a refusal leaves the question open and writes nothing */
|
|
81
|
+
export const CHOICE_SAYS: Readonly<{
|
|
82
|
+
bad: "That answer is not one of the choices. Nothing was saved.";
|
|
83
|
+
notOffered: "That choice is not offered for this question. Nothing was saved.";
|
|
84
|
+
outOfDate: "This page is out of date. Reload it and answer again. Nothing was saved.";
|
|
85
|
+
noRule: "That question is about the job line, not one of your ~ rules, so there is nothing to drop. Agree, or type your own words. Nothing was saved.";
|
|
86
|
+
blank: "An answer is needed here — there is no skip. Type it in the box and press Send.";
|
|
87
|
+
}>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE user message: the person's job lines (their `~` rules numbered), the look, the inputs (bounded).
|
|
3
|
+
* @param {{jobLines: any[], look: any, texts: Record<string, string>}} o
|
|
4
|
+
* @returns {string}
|
|
5
|
+
*/
|
|
6
|
+
export function rowEditUserText({ jobLines, look, texts }: {
|
|
7
|
+
jobLines: any[];
|
|
8
|
+
look: any;
|
|
9
|
+
texts: Record<string, string>;
|
|
10
|
+
}): string;
|
|
11
|
+
/** the tool a row-edit reply is delivered through */
|
|
12
|
+
export const ROW_EDIT_TOOL: "submit_edits";
|
|
13
|
+
/** what an acknowledged reply returns (the loop ends the call the moment the tool fires) */
|
|
14
|
+
export const ROW_EDIT_ACK: "edits received";
|
|
15
|
+
/** the drafter's system text for the row-edit turn (a prompt register: src/promptregisters.js) */
|
|
16
|
+
export const ROW_EDIT_SYSTEM: string;
|
|
17
|
+
/** the fixed sentence that follows the refusals in a revise turn (the turn carries each refusal's own reason and nothing else) */
|
|
18
|
+
export const ROW_EDIT_REVISE: "Send corrected edits only (an empty \"edits\" list is a good answer).";
|
|
19
|
+
export function rowEditChannel(ticket?: boolean): {
|
|
20
|
+
name: string;
|
|
21
|
+
instruction: string;
|
|
22
|
+
textPath: string;
|
|
23
|
+
tool: (box: {
|
|
24
|
+
calls: any[];
|
|
25
|
+
}) => {
|
|
26
|
+
name: string;
|
|
27
|
+
description: string;
|
|
28
|
+
parameters: Record<string, any>;
|
|
29
|
+
execute: (args: any) => Promise<string>;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export function editsOf(artifact: any): any[];
|