bareloop 0.56.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 +35 -0
- package/README.md +3 -3
- package/bareloop.context.md +65 -207
- package/package.json +2 -2
- package/src/authorflow.js +25 -78
- package/src/authoring.js +5 -124
- package/src/authorjob.js +33 -395
- package/src/authorreadout.js +17 -355
- package/src/authorrun.js +8 -211
- package/src/blockasks.js +2 -2
- package/src/bundlerun.js +4 -1
- package/src/checkblock.js +76 -50
- package/src/checklist.js +1 -1
- package/src/checkpick.js +10 -1
- package/src/cli.js +3 -3
- package/src/declaredclose.js +11 -110
- package/src/destpoint.js +1 -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 +2 -2
- package/src/pagerules.js +18 -3
- package/src/panel/authorroutes.js +9 -3
- package/src/panel/authorsession.js +99 -141
- package/src/panel/importrun.js +0 -1
- package/src/panel/index.html +6 -6
- package/src/panel/jobplan.js +7 -5
- package/src/panel/server.js +25 -64
- package/src/panel/status.js +3 -0
- package/src/pickrecord.js +15 -54
- package/src/planrun.js +2 -48
- package/src/promptregisters.js +2 -17
- package/src/providerrows.js +0 -36
- package/src/providers.js +4 -25
- package/src/questionbox.js +4 -12
- package/src/rubricstep.js +26 -6
- package/src/run.js +2 -15
- package/src/userrun.js +14 -111
- package/types/authorflow.d.ts +9 -58
- package/types/authoring.d.ts +1 -14
- package/types/authorjob.d.ts +13 -55
- package/types/authorreadout.d.ts +8 -80
- package/types/blockasks.d.ts +1 -2
- package/types/checkblock.d.ts +32 -17
- package/types/checklist.d.ts +2 -2
- package/types/checkpick.d.ts +5 -0
- package/types/cli.d.ts +1 -3
- package/types/declaredclose.d.ts +3 -33
- 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/pagerules.d.ts +7 -0
- package/types/panel/authorsession.d.ts +35 -4
- package/types/panel/jobplan.d.ts +3 -3
- package/types/panel/server.d.ts +13 -5
- package/types/panel/status.d.ts +5 -0
- package/types/pickrecord.d.ts +8 -13
- package/types/planrun.d.ts +1 -22
- package/types/providerrows.d.ts +0 -31
- package/types/providers.d.ts +3 -19
- package/types/rubricstep.d.ts +9 -0
- package/types/run.d.ts +1 -20
- package/types/userrun.d.ts +0 -1
- package/src/calibrate.js +0 -702
- package/src/cardauthor.js +0 -502
- package/src/fitcheck.js +0 -168
- package/types/calibrate.d.ts +0 -201
- package/types/cardauthor.d.ts +0 -358
- package/types/fitcheck.d.ts +0 -119
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/** What the AI is told: the numbered job lines (text only), the one question, the reply shape and a legal example. @param {{n: number, text: string}[]} lines @returns {string} */
|
|
2
|
+
export function notePrompt(lines: {
|
|
3
|
+
n: number;
|
|
4
|
+
text: string;
|
|
5
|
+
}[]): string;
|
|
6
|
+
/**
|
|
7
|
+
* Code reads the reply: every asked line answered exactly yes or no, else malformed (no repair). An answer for a line not asked is malformed too.
|
|
8
|
+
* @param {unknown} text @param {{n: number}[]} lines @returns {Map<number, 'yes'|'no'>|null}
|
|
9
|
+
*/
|
|
10
|
+
export function decideNote(text: unknown, lines: {
|
|
11
|
+
n: number;
|
|
12
|
+
}[]): Map<number, "yes" | "no"> | null;
|
|
13
|
+
/**
|
|
14
|
+
* Run the call: one call, one retry on a malformed reply, a transport failure or a 429. Never throws on a call casualty; every failure is `failed` (the lines stay facts-only).
|
|
15
|
+
* @param {{lines: {n: number, text: string}[], provider?: any, maxTokens?: number, ceilingUsd?: number|null, callTimeoutMs?: number,
|
|
16
|
+
* onCall?: (call: {label: string, costUsd: number|null, unpricedRounds: number, thinkingStatus?: string, raw?: string}) => void,
|
|
17
|
+
* createLoop?: Function, rates?: {in: number, out: number}|null, callOptions?: Record<string, any>, sleep?: (ms: number) => Promise<void>}} o
|
|
18
|
+
* @returns {Promise<{state: 'answered'|'failed', answers: Map<number, 'yes'|'no'>, reason: string|null, calls: {label: string, costUsd: number|null, unpricedRounds: number}[]}>}
|
|
19
|
+
*/
|
|
20
|
+
export function runNoteAsk({ lines, provider, maxTokens, ceilingUsd, callTimeoutMs, onCall, createLoop, rates, callOptions, sleep, }: {
|
|
21
|
+
lines: {
|
|
22
|
+
n: number;
|
|
23
|
+
text: string;
|
|
24
|
+
}[];
|
|
25
|
+
provider?: any;
|
|
26
|
+
maxTokens?: number;
|
|
27
|
+
ceilingUsd?: number | null;
|
|
28
|
+
callTimeoutMs?: number;
|
|
29
|
+
onCall?: (call: {
|
|
30
|
+
label: string;
|
|
31
|
+
costUsd: number | null;
|
|
32
|
+
unpricedRounds: number;
|
|
33
|
+
thinkingStatus?: string;
|
|
34
|
+
raw?: string;
|
|
35
|
+
}) => void;
|
|
36
|
+
createLoop?: Function;
|
|
37
|
+
rates?: {
|
|
38
|
+
in: number;
|
|
39
|
+
out: number;
|
|
40
|
+
} | null;
|
|
41
|
+
callOptions?: Record<string, any>;
|
|
42
|
+
sleep?: (ms: number) => Promise<void>;
|
|
43
|
+
}): Promise<{
|
|
44
|
+
state: "answered" | "failed";
|
|
45
|
+
answers: Map<number, "yes" | "no">;
|
|
46
|
+
reason: string | null;
|
|
47
|
+
calls: {
|
|
48
|
+
label: string;
|
|
49
|
+
costUsd: number | null;
|
|
50
|
+
unpricedRounds: number;
|
|
51
|
+
}[];
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* The drafting step: when the block has a facts-only line (and a `noteFn`), make the ONE call, then let code decide through `block.setNotes`. No facts-only line, or no `noteFn`: no call, nothing changes.
|
|
55
|
+
* A failed call leaves the lines facts-only, each with its Not checked row. Returns the calls made (for the drafting book).
|
|
56
|
+
* @param {{block: import('./checkblock.js').CheckBlock, jobLines: {n: number, text: string}[], noteFn: Function|null, ceilingUsd?: number|null, onCall?: Function, onPhase?: (name: string, data: any) => void}} o
|
|
57
|
+
* @returns {Promise<{label: string, costUsd: number|null, unpricedRounds: number}[]>}
|
|
58
|
+
*/
|
|
59
|
+
export function askNotes({ block, jobLines, noteFn, ceilingUsd, onCall, onPhase }: {
|
|
60
|
+
block: import("./checkblock.js").CheckBlock;
|
|
61
|
+
jobLines: {
|
|
62
|
+
n: number;
|
|
63
|
+
text: string;
|
|
64
|
+
}[];
|
|
65
|
+
noteFn: Function | null;
|
|
66
|
+
ceilingUsd?: number | null;
|
|
67
|
+
onCall?: Function;
|
|
68
|
+
onPhase?: (name: string, data: any) => void;
|
|
69
|
+
}): Promise<{
|
|
70
|
+
label: string;
|
|
71
|
+
costUsd: number | null;
|
|
72
|
+
unpricedRounds: number;
|
|
73
|
+
}[]>;
|
|
74
|
+
/** the label of the one paid call, as the drafting book sees it */
|
|
75
|
+
export const NOTE_CALL_LABEL: "note-ask";
|
|
76
|
+
export const NOTE_SYSTEM: "You read the numbered lines of a job. You answer only about what each line says; you never invent words.";
|
package/types/pagedry.d.ts
CHANGED
|
@@ -22,6 +22,19 @@ export function dryReadMoney(text: string, facts: KeptFact[]): Promise<{
|
|
|
22
22
|
reads: Record<string, number>;
|
|
23
23
|
results: Record<string, number>;
|
|
24
24
|
}>;
|
|
25
|
+
/**
|
|
26
|
+
* The page's RESULT LINES: the lines the given money facts read (`moneyResultLines`), each quote once. Empty when no money fact reads a line (the result lines are then unknown).
|
|
27
|
+
* The one owner of "what is a result row" for phrase facts, shared by the dry read below and by the check list's `!` rows (`phraseInNoResult`).
|
|
28
|
+
* @param {string} text @param {KeptFact[]} facts @returns {string[]}
|
|
29
|
+
*/
|
|
30
|
+
export function resultQuotes(text: string, facts: KeptFact[]): string[];
|
|
31
|
+
/**
|
|
32
|
+
* Is this phrase in the page but in NONE of its result lines (the `phrase-no-result` case)? Sync, for a `!` row the check list is about to build.
|
|
33
|
+
* True only when result lines exist and no line holds the words (case and spacing aside, a plain substring: it never refuses a phrase the run's presence check could pass).
|
|
34
|
+
* With no result line known nothing is guessed (false).
|
|
35
|
+
* @param {string} text @param {KeptFact[]} moneyFacts the line's money facts @param {string} words @returns {boolean}
|
|
36
|
+
*/
|
|
37
|
+
export function phraseInNoResult(text: string, moneyFacts: KeptFact[], words: string): boolean;
|
|
25
38
|
/**
|
|
26
39
|
* The same "can it read" for PHRASE facts (hamr ruled 3a, run m10-walk-flights-3: "Rome" was on the page only in "Track prices from Madrid to
|
|
27
40
|
* Rome" switches, in none of the 18 result lines, so no result could ever say it). A kept phrase fact is read against the page's RESULT LINES =
|
package/types/pagerules.d.ts
CHANGED
|
@@ -31,6 +31,13 @@ export function numberAtEnd(s: string): string | undefined;
|
|
|
31
31
|
* @param {string} s @returns {string|undefined}
|
|
32
32
|
*/
|
|
33
33
|
export function numberAtEndComma(s: string): string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* The ONE owner of a label's separator: the label as the page writes it. The run's checker reads a value right after the signed label, so a page that
|
|
36
|
+
* writes "Departure time: 10:24 AM." can only be read by the label "Departure time:". When EVERY place the page holds the label has a colon right after
|
|
37
|
+
* it, the label is signed with that colon; one bare place leaves it as the look gave it. A plain count of the page's own text, no pattern.
|
|
38
|
+
* @param {string} text the frozen page text @param {string} label a label as normLabel leaves it @returns {string}
|
|
39
|
+
*/
|
|
40
|
+
export function withColon(text: string, label: string): string;
|
|
34
41
|
/**
|
|
35
42
|
* Apply the rules to the AI's map over one saved page. Returns the kept facts and, for everything a rule removed, one `dropped` entry.
|
|
36
43
|
* The order of the rules is the POC's (apply-v3.mjs): found-on-page, then the rules that read the page. A place is read as a phrase.
|
|
@@ -81,6 +81,33 @@ export function jobNameTaken(name: string, opts?: {
|
|
|
81
81
|
export function nextFreeJobName(origin: string, runJobs: Iterable<string>, opts?: {
|
|
82
82
|
jobsDir?: string;
|
|
83
83
|
}): string;
|
|
84
|
+
/**
|
|
85
|
+
* The card's Inputs as the JOB reads them: the one place that decides which lines are inputs (hamr 2026-11-14, piece 5): the fresh card, the session, the
|
|
86
|
+
* Destination check and Reuse (`buildReuseSpec`) all read THIS, never a copy.
|
|
87
|
+
* @param {any} card
|
|
88
|
+
* @param {{rubric?: boolean, flowType?: 'plain'|'mcp'|'tickets'}} [o]
|
|
89
|
+
* @returns {{ok: true, inputs: import('../jobblock.js').JobInput[]}|{ok: false, error: string}}
|
|
90
|
+
*/
|
|
91
|
+
export function cardInputs(card: any, o?: {
|
|
92
|
+
rubric?: boolean;
|
|
93
|
+
flowType?: "plain" | "mcp" | "tickets";
|
|
94
|
+
}): {
|
|
95
|
+
ok: true;
|
|
96
|
+
inputs: import("../jobblock.js").JobInput[];
|
|
97
|
+
} | {
|
|
98
|
+
ok: false;
|
|
99
|
+
error: string;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* The renumbering itself, for a caller that holds parsed lines already (`startSession`): a Tickets + rubric job reads the ticket and nothing else (a repo line is
|
|
103
|
+
* not an input of it), so the ticket line stands alone, numbered 1 (a signed spec's inputs must run 1, 2, 3...). Any other job keeps its lines as typed.
|
|
104
|
+
* @param {import('../jobblock.js').JobInput[]} inputs @param {{rubric: boolean, flowType: 'plain'|'mcp'|'tickets'}} o
|
|
105
|
+
* @returns {import('../jobblock.js').JobInput[]}
|
|
106
|
+
*/
|
|
107
|
+
export function ticketRubricInputs(inputs: import("../jobblock.js").JobInput[], { rubric, flowType }: {
|
|
108
|
+
rubric: boolean;
|
|
109
|
+
flowType: "plain" | "mcp" | "tickets";
|
|
110
|
+
}): import("../jobblock.js").JobInput[];
|
|
84
111
|
/**
|
|
85
112
|
* The repo a card names: Inputs line 1 (P7 — the Source box is gone; the first input IS the repo). `''` when the Inputs
|
|
86
113
|
* box does not parse (the card validator refuses that before anything uses this).
|
|
@@ -215,8 +242,8 @@ export function validateJobCard(card: any, opts?: {
|
|
|
215
242
|
* `signPrepare()` are the only ways in.
|
|
216
243
|
* @param {any} card the validated job card (see {@link validateJobCard})
|
|
217
244
|
* @param {{env?: Record<string,string|undefined>, sessionsRoot?: string, home?: string, timeoutMs?: number,
|
|
218
|
-
* scout?: any, generate?: Function, pickGenerate?: Function|null, ledgerGenerate?: Function|null, editGenerate?: Function|null, carryFrom?: string, carryKind?: string, confirmGenerate?: Function, authorFn?: Function,
|
|
219
|
-
* prepareSigningFn?: Function, npmCiFn?: Function, lookFn?: Function|null,
|
|
245
|
+
* scout?: any, generate?: Function, pickGenerate?: Function|null, ledgerGenerate?: Function|null, noteFn?: Function|null, editGenerate?: Function|null, carryFrom?: string, carryKind?: string, confirmGenerate?: Function, authorFn?: Function,
|
|
246
|
+
* prepareSigningFn?: Function, npmCiFn?: Function, lookFn?: Function|null, destFn?: Function|null, newestUnrunTicket?: typeof newestUnrunTicket, readTicketFn?: typeof readTicket, fetchUrl?: (url: string) => Promise<{ok: true, text: string, url: string}|{ok: false, error: string}>, draftThinking?: "on"|"off", reuse?: {spec: any, workflowKey: string}, schedule?: import('../trigger.js').Trigger|null, flow?: {flowType: 'plain'|'mcp'|'tickets', pick: {server: string, tools: string[]}|null}}} [deps] `scout`..`prepareSigningFn` are
|
|
220
247
|
* TEST SEAMS ONLY — see the note just above where each is read, below. `reuse` (Reuse workflow) is NOT a seam: the
|
|
221
248
|
* caller (`/api/author/start`) sets it only when the server's own same-job rule held.
|
|
222
249
|
* @returns {any} the session object
|
|
@@ -230,6 +257,7 @@ export function createSession(card: any, deps?: {
|
|
|
230
257
|
generate?: Function;
|
|
231
258
|
pickGenerate?: Function | null;
|
|
232
259
|
ledgerGenerate?: Function | null;
|
|
260
|
+
noteFn?: Function | null;
|
|
233
261
|
editGenerate?: Function | null;
|
|
234
262
|
carryFrom?: string;
|
|
235
263
|
carryKind?: string;
|
|
@@ -238,8 +266,9 @@ export function createSession(card: any, deps?: {
|
|
|
238
266
|
prepareSigningFn?: Function;
|
|
239
267
|
npmCiFn?: Function;
|
|
240
268
|
lookFn?: Function | null;
|
|
241
|
-
fitFn?: Function | null;
|
|
242
269
|
destFn?: Function | null;
|
|
270
|
+
newestUnrunTicket?: typeof newestUnrunTicket;
|
|
271
|
+
readTicketFn?: typeof readTicket;
|
|
243
272
|
fetchUrl?: (url: string) => Promise<{
|
|
244
273
|
ok: true;
|
|
245
274
|
text: string;
|
|
@@ -288,7 +317,7 @@ export const CARD_FIELDS: readonly string[];
|
|
|
288
317
|
/**
|
|
289
318
|
* REUSE WORKFLOW, ONE DOOR (RULED 2026-10-15, v1.101; replaces v1.88's five open boxes). Every box on the card is open. What decides
|
|
290
319
|
* the path is the CARD compared with the origin run's card, never the drafted spec: the JOB boxes are the job text (numbered lines,
|
|
291
|
-
* `~` rules
|
|
320
|
+
* `~` rules), the check type and the thinking tick. The RUN boxes (Inputs, Destination, Model, $ cap, Time cap)
|
|
292
321
|
* never decide it. A green origin with no job box changed reuses the signed plan verbatim (no drafting); anything else drafts.
|
|
293
322
|
*/
|
|
294
323
|
export const JOB_BOXES: readonly string[];
|
|
@@ -303,6 +332,8 @@ export type StepLine = {
|
|
|
303
332
|
detail: string;
|
|
304
333
|
};
|
|
305
334
|
import { planFromConfirm } from './jobplan.js';
|
|
335
|
+
import { newestUnrunTicket } from '../ticketnext.js';
|
|
336
|
+
import { readTicket } from '../ticket.js';
|
|
306
337
|
import { thinkingRowText } from '../thinking.js';
|
|
307
338
|
import { nonRepoSourceMessage } from '../source.js';
|
|
308
339
|
export { thinkingRowText, nonRepoSourceMessage };
|
package/types/panel/jobplan.d.ts
CHANGED
|
@@ -62,10 +62,10 @@ export function planFromConfirm(jobLines: {
|
|
|
62
62
|
* (`results`: stage name to passed), never re-derived; a row no verdict was recorded for says so. A Not checked row's result is "not checked" (its reason is in its words).
|
|
63
63
|
* The write fence is enforced per write by the gate, so its row reads the gate's own record of THIS run (hamr ruling A, 2026-11-13): `blocked` = the write/edit attempts the gate denied
|
|
64
64
|
* (`held · N writes blocked`), or `null` when the run's gate record is missing (said in plain words, never "held").
|
|
65
|
-
* @param {JobPlan} plan @param {string[]} guards @param {Map<string, boolean>|null} results @param {number|null} [blocked]
|
|
65
|
+
* @param {JobPlan} plan @param {string[]} guards @param {Map<string, boolean>|null} results @param {number|null} [blocked] @param {boolean} [closeRan] the results are a CLOSE's (the latest), so a declared stage missing from them was not reached (the close stops at its first red); else a stage no verdict was recorded for reads none
|
|
66
66
|
* @returns {{checks: AuditRow[], notChecked: AuditRow[], always: AuditRow[]}}
|
|
67
67
|
*/
|
|
68
|
-
export function auditChecksOf(plan: JobPlan, guards: string[], results: Map<string, boolean> | null, blocked?: number | null): {
|
|
68
|
+
export function auditChecksOf(plan: JobPlan, guards: string[], results: Map<string, boolean> | null, blocked?: number | null, closeRan?: boolean): {
|
|
69
69
|
checks: AuditRow[];
|
|
70
70
|
notChecked: AuditRow[];
|
|
71
71
|
always: AuditRow[];
|
|
@@ -75,7 +75,7 @@ export const AUDIT_NO_RESULT: "no result recorded";
|
|
|
75
75
|
export type AuditRow = {
|
|
76
76
|
text: string;
|
|
77
77
|
by: "agent" | "you" | "default" | null;
|
|
78
|
-
result: "passed" | "failed" | "none" | "not-checked" | "held" | "record-missing";
|
|
78
|
+
result: "passed" | "failed" | "none" | "not-reached" | "not-checked" | "held" | "record-missing";
|
|
79
79
|
word?: string;
|
|
80
80
|
};
|
|
81
81
|
export type PlanCheck = {
|
package/types/panel/server.d.ts
CHANGED
|
@@ -735,9 +735,17 @@ export function getRunResult(runid: string, opts?: {
|
|
|
735
735
|
scopeLine: string | null;
|
|
736
736
|
} | null;
|
|
737
737
|
checks: {
|
|
738
|
+
head: string;
|
|
739
|
+
passed: number;
|
|
740
|
+
total: number;
|
|
741
|
+
allPassed: boolean;
|
|
742
|
+
stages: any[];
|
|
743
|
+
notes: never[];
|
|
744
|
+
} | {
|
|
738
745
|
head: string;
|
|
739
746
|
passed: any;
|
|
740
747
|
total: any;
|
|
748
|
+
notReached: number;
|
|
741
749
|
allPassed: boolean;
|
|
742
750
|
stages: any;
|
|
743
751
|
notes: any;
|
|
@@ -920,13 +928,13 @@ export function callsLineOf(records: any[], behaviour: {
|
|
|
920
928
|
denied: number;
|
|
921
929
|
} | null): string;
|
|
922
930
|
/**
|
|
923
|
-
* "
|
|
924
|
-
*
|
|
925
|
-
*
|
|
926
|
-
* @param {any[]} records the run's raw spine @param {any
|
|
931
|
+
* "3 run · 3 passed · 0 failed" (+ " · N not reached") — counts of what the run's LATEST close ran, never a fraction (the "checks N/M" headline stays withdrawn).
|
|
932
|
+
* Read from {@link checksOf}, the one owner the Audit checks fold and the Result checks box read (live run mwg3pov1): the last staged close, a stage it never reached counts as
|
|
933
|
+
* neither passed nor failed, and a run no close reached falls back to the checks its steps ran. No history of earlier tries. A run with neither says `not recorded`.
|
|
934
|
+
* @param {any[]} records the run's raw spine @param {any} spec the run's signed spec (names the stages the close declares)
|
|
927
935
|
* @returns {string}
|
|
928
936
|
*/
|
|
929
|
-
export function checksLineOf(records: any[],
|
|
937
|
+
export function checksLineOf(records: any[], spec: any): string;
|
|
930
938
|
/**
|
|
931
939
|
* The step card's extra line (PRD v1.106 Part 5 G): "5 tries · last try: 1 check passed, 1 failed", with the cut-off try named when there is one
|
|
932
940
|
* ("4 tries (the 4th cut off before its checks ran) · last try: no checks ran"). Words for what passed and failed, never a fraction. `null`
|
package/types/panel/status.d.ts
CHANGED
|
@@ -110,6 +110,11 @@ export const STATUS: Readonly<{
|
|
|
110
110
|
word: "skipped";
|
|
111
111
|
}>;
|
|
112
112
|
}>;
|
|
113
|
+
/** a close stage the run's LATEST close never reached (it stops at the first red): the [·] sign, grey, never the precheck's old reading. Beside STATUS, not in it: it is a stage's standing, never a run's status */
|
|
114
|
+
export const NOT_REACHED: Readonly<{
|
|
115
|
+
sign: "·";
|
|
116
|
+
word: "not reached";
|
|
117
|
+
}>;
|
|
113
118
|
/**
|
|
114
119
|
* PRD v1.106 Part 5 (C, choice 9): the review door's words, ONE table. The door is the only human step bareloop has; there is no "you
|
|
115
120
|
* cancelled" (cancel is deleted). `decision` is the spine's `door-decision.decision`, or null while nothing has been decided.
|
package/types/pickrecord.d.ts
CHANGED
|
@@ -10,9 +10,9 @@ export function lineKeys(lines: {
|
|
|
10
10
|
occurrence: number;
|
|
11
11
|
}>;
|
|
12
12
|
/**
|
|
13
|
-
* The entries for answers just given, numbered on THIS card (the answer redraft's card: its line and rule numbers are the ones the asks carried).
|
|
13
|
+
* The entries for answers just given, numbered on THIS card (the answer redraft's card: its line and rule numbers are the ones the asks carried; the rule's text is the FINAL rule's words).
|
|
14
14
|
* @param {{n: number, text: string}[]} lines @param {Rule[]} rules
|
|
15
|
-
* @param {{line: number, rule: number, check?: Record<string, any>|null,
|
|
15
|
+
* @param {{line: number, rule: number, check?: Record<string, any>|null, own?: boolean}[]} picks @param {{line: number, rule: number}[]} left
|
|
16
16
|
* @returns {Entry[]}
|
|
17
17
|
*/
|
|
18
18
|
export function entriesFromAnswers(lines: {
|
|
@@ -22,7 +22,6 @@ export function entriesFromAnswers(lines: {
|
|
|
22
22
|
line: number;
|
|
23
23
|
rule: number;
|
|
24
24
|
check?: Record<string, any> | null;
|
|
25
|
-
added?: string | null;
|
|
26
25
|
own?: boolean;
|
|
27
26
|
}[], left: {
|
|
28
27
|
line: number;
|
|
@@ -30,12 +29,11 @@ export function entriesFromAnswers(lines: {
|
|
|
30
29
|
}[]): Entry[];
|
|
31
30
|
/**
|
|
32
31
|
* Decide, for the card in hand, which stored picks are kept and which guardrails must be asked.
|
|
33
|
-
* A pick is KEPT when the job line with its words (same order among equal lines) still has
|
|
34
|
-
*
|
|
35
|
-
* partner left on the card is folded (neither asked nor given the old check) - except an EDITED added line (M10 am21): that one is asked (`pairRule` = its source's number) and the source is folded. Pure.
|
|
32
|
+
* A pick is KEPT when the job line with its words (same order among equal lines) still has a guardrail with the pick's exact words. One rule in, one rule out (hamr 2026-11-14): an answer REPLACED the
|
|
33
|
+
* rule it was asked about, so the stored words are the final rule's words and there is no second line to pair; a rule whose words changed is simply new and asked. Pure.
|
|
36
34
|
* @param {Entry[]} entries @param {{n: number, text: string}[]} lines @param {Rule[]} rules every guardrail the call settles
|
|
37
|
-
* @returns {{picks: {line: number, rule: number, check: Record<string, any>|null,
|
|
38
|
-
* kept: {line: number, rule: number, entry: Entry}[], askRules:
|
|
35
|
+
* @returns {{picks: {line: number, rule: number, check: Record<string, any>|null, own?: boolean}[], left: {line: number, rule: number}[],
|
|
36
|
+
* kept: {line: number, rule: number, entry: Entry}[], askRules: Rule[]}}
|
|
39
37
|
*/
|
|
40
38
|
export function matchRecord(entries: Entry[], lines: {
|
|
41
39
|
n: number;
|
|
@@ -45,7 +43,6 @@ export function matchRecord(entries: Entry[], lines: {
|
|
|
45
43
|
line: number;
|
|
46
44
|
rule: number;
|
|
47
45
|
check: Record<string, any> | null;
|
|
48
|
-
added?: string;
|
|
49
46
|
own?: boolean;
|
|
50
47
|
}[];
|
|
51
48
|
left: {
|
|
@@ -57,9 +54,7 @@ export function matchRecord(entries: Entry[], lines: {
|
|
|
57
54
|
rule: number;
|
|
58
55
|
entry: Entry;
|
|
59
56
|
}[];
|
|
60
|
-
askRules:
|
|
61
|
-
pairRule?: number;
|
|
62
|
-
})[];
|
|
57
|
+
askRules: Rule[];
|
|
63
58
|
};
|
|
64
59
|
/**
|
|
65
60
|
* Read a carried record (the session folder's file). A missing or unreadable file is no record (a draft from before R10 has none).
|
|
@@ -88,7 +83,7 @@ export type Entry = {
|
|
|
88
83
|
lineWords: string;
|
|
89
84
|
occurrence: number;
|
|
90
85
|
ruleText: string;
|
|
91
|
-
added
|
|
86
|
+
added?: string | null;
|
|
92
87
|
check: Record<string, any> | null;
|
|
93
88
|
own: boolean;
|
|
94
89
|
left: boolean;
|
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
|
package/types/rubricstep.d.ts
CHANGED
|
@@ -285,6 +285,12 @@ export function proseNotCheckedItems(closeDecl: any): {
|
|
|
285
285
|
* @param {any} part @returns {string}
|
|
286
286
|
*/
|
|
287
287
|
export function partSentence(part: any): string;
|
|
288
|
+
/**
|
|
289
|
+
* Does the signed close really put a text-present check on job line `n`'s step file? (ONE reader, derived from the close: the protections list and the brief never claim it otherwise.)
|
|
290
|
+
* A facts line has no text check unless a countable part (a pick, or the default note) sits beside its facts; a line with no stage has none.
|
|
291
|
+
* @param {any} closeDecl @param {number} n @returns {boolean}
|
|
292
|
+
*/
|
|
293
|
+
export function lineCarriesText(closeDecl: any, n: number): boolean;
|
|
288
294
|
/**
|
|
289
295
|
* The checks a signed close actually runs, per job line, in plain code-written sentences: one per countable part of every
|
|
290
296
|
* rubric-step stage. This is the ONE reader both the plan card and the sign-time invariant use.
|
|
@@ -392,7 +398,10 @@ export function sha256Of(b: string | Buffer): string;
|
|
|
392
398
|
export function boundInWords(b: unknown, said: string): boolean;
|
|
393
399
|
export function wordsSaidOn(jl: any): string;
|
|
394
400
|
export const NEGATING_RE: RegExp;
|
|
401
|
+
/** the plain reason a rule's amount is in a currency the page fact does not use; `readLimit` gives it and the check list reads it, one spelling */
|
|
402
|
+
export const WHY_OTHER_CURRENCY: "the amount is in another currency than the page fact";
|
|
395
403
|
export function defaultCitedText(label: string): string;
|
|
404
|
+
export function defaultNoteText(n: number): string;
|
|
396
405
|
export type ShapeRed = {
|
|
397
406
|
code: string;
|
|
398
407
|
path: string;
|
package/types/run.d.ts
CHANGED
|
@@ -38,19 +38,6 @@
|
|
|
38
38
|
* (`ratesFor`, src/providerrows.js — USD per 1K tokens), resolved once by the door and handed to every
|
|
39
39
|
* worker/planner Loop as bare-agent's `rates` (rounds then read `rateSource:'caller'`). Absent = the
|
|
40
40
|
* built-in guess, exactly as before. A Loop-driven provider only: a native session reports its own cost.
|
|
41
|
-
* @param {{in: number, out: number}|null} [opts.judgeRates] the same, for the judge's own key row
|
|
42
|
-
* @param {string|null} [opts.judgeModel] SOFTGREEN — WHICH model the judge provider drives
|
|
43
|
-
* (PRD item 32.1), resolved by the CALLER (`resolveJudge`, src/judged.js) and passed
|
|
44
|
-
* through untouched. Travels with `judgeProvider`; absent, a judged stage stops as a
|
|
45
|
-
* wiring gap rather than grading under an identity nobody named.
|
|
46
|
-
* @param {any} [opts.judgeProvider] SOFTGREEN — the provider a JUDGED close stage runs its
|
|
47
|
-
* locate call through, built by the CALLER from the RESOLVED judge identity (PRD item
|
|
48
|
-
* 32.1: `resolveJudge`/`resolveJobJudge`, src/judged.js — the spec's signed `judge`
|
|
49
|
-
* override, else the job's own worker provider and model), never pinned. Forwarded to the plan
|
|
50
|
-
* flow. It is its own seam and not `provider`/`providerFor`, because the judge tier is
|
|
51
|
-
* never a step knob and never agent-selectable; absent, a judged stage instrument-stops as
|
|
52
|
-
* a wiring gap rather than grading on whatever binding happened to be at hand. Its spend
|
|
53
|
-
* lands on this ledger as `judge-round` (see `ACCOUNTED_ROUND_TYPES`).
|
|
54
41
|
* @param {Record<string, string>|null} [opts.placeValues] PLACE RULES (src/placerule.js): the values this run's start read for the spec's place-rule facts, by key. Bound
|
|
55
42
|
* as those facts' phrases on the run's own in-memory copy AFTER the approval check and the `job-start` record, so the hash checked and the hash recorded stay the
|
|
56
43
|
* SIGNED one and the signed spec is never changed; the planner and the close read the copy. Absent = the signed words.
|
|
@@ -223,7 +210,7 @@
|
|
|
223
210
|
* deliberately NOT in the resumable/checkpoint set (`src/reuse.js`) — an
|
|
224
211
|
* unknown in-flight state is not a known-safe resume point.
|
|
225
212
|
*/
|
|
226
|
-
export function runJob(rawSpec: object | string, { approvals, workdir, provider, nativeProvider, providerFor,
|
|
213
|
+
export function runJob(rawSpec: object | string, { approvals, workdir, provider, nativeProvider, providerFor, rates, emit, capRuns, strikeLimit, shellCapUsd, closeTimeoutMs, closeDir, layerRoot, readShim, scout, bridge, draftSpentUsd, draftSpendComplete, priorSpentUsd, priorSpendComplete, priorWallMs, resumeSeed, resumeGrades, resumeReplans, resumeBranch, humanRuling, heldRuling, reviewDoor, doorRerun, resumable, stopFile, learnHints, ticketRecord, ticketUnsure, prRecord, placeValues, placeRead }: {
|
|
227
214
|
approvals: unknown;
|
|
228
215
|
workdir: string;
|
|
229
216
|
provider: any;
|
|
@@ -239,12 +226,6 @@ export function runJob(rawSpec: object | string, { approvals, workdir, provider,
|
|
|
239
226
|
in: number;
|
|
240
227
|
out: number;
|
|
241
228
|
} | null | undefined;
|
|
242
|
-
judgeRates?: {
|
|
243
|
-
in: number;
|
|
244
|
-
out: number;
|
|
245
|
-
} | null | undefined;
|
|
246
|
-
judgeModel?: string | null | undefined;
|
|
247
|
-
judgeProvider?: any;
|
|
248
229
|
placeValues?: Record<string, string> | null | undefined;
|
|
249
230
|
placeRead?: {
|
|
250
231
|
workflowKey: string;
|
package/types/userrun.d.ts
CHANGED