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/rubricstep.d.ts
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
* @returns {string}
|
|
4
4
|
*/
|
|
5
5
|
export function stepFileContract(): string;
|
|
6
|
+
/**
|
|
7
|
+
* R10 (fwd am28, rewritten here): what a facts+text line's worker is told about the person's picks, one plain line per pick, the values and what counts, never a verdict and never any other
|
|
8
|
+
* check. Written by code from the signed pick parts; a list item is what bareguard's listItems counts (its own line starting with "1." or "- " and a space).
|
|
9
|
+
* @param {any[]} picked countable parts (`{check, value, names, ...}`) @returns {string[]}
|
|
10
|
+
*/
|
|
11
|
+
export function toldPicks(picked: any[]): string[];
|
|
6
12
|
/**
|
|
7
13
|
* What the worker is told about each line, from the close that will grade it (PART 1b item 7): a FACTS line gets its
|
|
8
14
|
* facts and its count; a TEXT line that follows a facts line is told its numbers come from that line's quotes. Written by code from
|
|
@@ -199,41 +205,69 @@ export function checkRubricRules(stages: any[], { jobLines, refused, red }: {
|
|
|
199
205
|
red: (code: string, path: string, detail: string, extra?: object) => void;
|
|
200
206
|
}): void;
|
|
201
207
|
/**
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
* - a time range the AI proposed while the person wrote ONE explicit positive time range ("between 07:00 and 23:00") on that line
|
|
206
|
-
* is replaced by exactly that range (smv710w8c3wdh: the plan said 5:00 AM). Only when it is unambiguous: one such range in the
|
|
207
|
-
* line's rules and one AI-proposed `between` time fact on the line; a rule with a negation ("not between ...") is never read as a range;
|
|
208
|
-
* - a `~` rule is a check or under Not checked, never both: a `refused` entry for a rule that a part of its own line carries is dropped.
|
|
209
|
-
* Pure; returns a new declaration, the input untouched. The model is told the same in the brief; this makes it true either way.
|
|
210
|
-
* @param {any} declaration @param {any[]|null|undefined} jobLines @returns {any}
|
|
208
|
+
* Does this rule text hold more than one amount (money) or more than one time range (time)? The ONE guard code's own limit read and an AI
|
|
209
|
+
* reading edit both use: "under $450 or over $900" is two limits, and one reading of it would be a wrong check.
|
|
210
|
+
* @param {string} shape @param {string} text @returns {boolean}
|
|
211
211
|
*/
|
|
212
|
-
export function
|
|
212
|
+
export function holdsManyBounds(shape: string, text: string): boolean;
|
|
213
213
|
/**
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
* @param {any} declaration @returns {any}
|
|
214
|
+
* The limit the person's own words give a fact of this shape: `{reading}` or `{why}` (a plain reason; the rule then stays Not checked).
|
|
215
|
+
* @param {string} shape money or time @param {string} text the `~` rule's words @param {any} [fact] the look fact (its currency and unit lists must fit)
|
|
216
|
+
* @returns {{reading: {op: 'lt'|'lte'|'gt'|'gte', value: number} | {op: 'between', lo: number|string, hi: number|string}} | {why: string}}
|
|
218
217
|
*/
|
|
219
|
-
export function
|
|
218
|
+
export function readLimit(shape: string, text: string, fact?: any): {
|
|
219
|
+
reading: {
|
|
220
|
+
op: "lt" | "lte" | "gt" | "gte";
|
|
221
|
+
value: number;
|
|
222
|
+
} | {
|
|
223
|
+
op: "between";
|
|
224
|
+
lo: number | string;
|
|
225
|
+
hi: number | string;
|
|
226
|
+
};
|
|
227
|
+
} | {
|
|
228
|
+
why: string;
|
|
229
|
+
};
|
|
220
230
|
/**
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
* narrower check is still said) -> one line in `closeDecl.notes`, shown as Not checked (the AI's own reading).
|
|
226
|
-
* Never a line-level `refused` entry without `rule` (that would silence every other rule red on the line). A rule the drafter already listed
|
|
227
|
-
* itself is never listed twice, and running this twice adds nothing. Pure; the input is untouched.
|
|
228
|
-
* @param {any} declaration @param {import('./pagerules.js').Dropped[]|null|undefined} dropped @param {any[]|null|undefined} jobLines @returns {any}
|
|
231
|
+
* A check-list row named in the person's plain words: `phrase "### Fixed"`. The words are the draft log's; with none, the text after the key's kind prefix (`L1.phrase.### fixed`).
|
|
232
|
+
* Never empty. Pure.
|
|
233
|
+
* @param {unknown} kind @param {string} key @param {string[]|null|undefined} words
|
|
234
|
+
* @returns {string}
|
|
229
235
|
*/
|
|
230
|
-
export function
|
|
236
|
+
export function listRowName(kind: unknown, key: string, words: string[] | null | undefined): string;
|
|
231
237
|
/**
|
|
232
238
|
* The ~ rules the drafter listed under Not checked (`refused` entries that name a `rule`), each as one line in the person's own
|
|
233
239
|
* words: `line N: "<the rule as written>" — <the drafter's reason>` (PART 1b, RF6 / RF16).
|
|
234
|
-
* @param {any} closeDecl @param {any[]|null|undefined} jobLines @returns {string[]}
|
|
240
|
+
* @param {any} closeDecl @param {any[]|null|undefined} jobLines @param {{key: string, words: string[]}[]|null} [ledger] the draft log's final list rows (`readDraftLedger`) @returns {string[]}
|
|
235
241
|
*/
|
|
236
|
-
export function ruleNotChecked(closeDecl: any, jobLines: any[] | null | undefined
|
|
242
|
+
export function ruleNotChecked(closeDecl: any, jobLines: any[] | null | undefined, ledger?: {
|
|
243
|
+
key: string;
|
|
244
|
+
words: string[];
|
|
245
|
+
}[] | null): string[];
|
|
246
|
+
/** the same lines as {@link ruleNotChecked}, each with who it belongs to (`by`: the row's kind, F-c) @param {any} closeDecl @param {any[]|null|undefined} jobLines @param {{key: string, words: string[]}[]|null} [ledger] @returns {{text: string, by?: 'you'|'agent'|'default'}[]} */
|
|
247
|
+
export function ruleNotCheckedItems(closeDecl: any, jobLines: any[] | null | undefined, ledger?: {
|
|
248
|
+
key: string;
|
|
249
|
+
words: string[];
|
|
250
|
+
}[] | null): {
|
|
251
|
+
text: string;
|
|
252
|
+
by?: "you" | "agent" | "default";
|
|
253
|
+
}[];
|
|
254
|
+
/**
|
|
255
|
+
* The refusals of a signed close, as ONE reader: when the close carries the one check list (`closeDecl.list`) its not-checked rows are the refusals (a `~` rule's row names the rule, a fact row its
|
|
256
|
+
* fact name); the old `closeDecl.refused` entries a list has no row for (a line-level refusal, a rule the list never saw) are kept, so nothing the older close said is lost. A close with no list
|
|
257
|
+
* reads `refused` alone. Pure.
|
|
258
|
+
* @param {any} closeDecl
|
|
259
|
+
* @returns {{line: number, rule?: number, kind?: string, key?: string, by?: 'you'|'agent'|'default', label?: string, reason: string, fromList: boolean}[]}
|
|
260
|
+
*/
|
|
261
|
+
export function refusedOf(closeDecl: any): {
|
|
262
|
+
line: number;
|
|
263
|
+
rule?: number;
|
|
264
|
+
kind?: string;
|
|
265
|
+
key?: string;
|
|
266
|
+
by?: "you" | "agent" | "default";
|
|
267
|
+
label?: string;
|
|
268
|
+
reason: string;
|
|
269
|
+
fromList: boolean;
|
|
270
|
+
}[];
|
|
237
271
|
/**
|
|
238
272
|
* The Not-checked lines code owns for the rubric-step stages of a close: a prose step's CONTENT is judged by the person at
|
|
239
273
|
* Accept, and the card says so (PART 1b, RF5). One line per prose step (a stage with no fact part).
|
|
@@ -251,19 +285,25 @@ export function proseNotCheckedItems(closeDecl: any): {
|
|
|
251
285
|
* @param {any} part @returns {string}
|
|
252
286
|
*/
|
|
253
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;
|
|
254
294
|
/**
|
|
255
295
|
* The checks a signed close actually runs, per job line, in plain code-written sentences: one per countable part of every
|
|
256
296
|
* rubric-step stage. This is the ONE reader both the plan card and the sign-time invariant use.
|
|
257
297
|
* Each row says who added the check (`by`): `you` = one of the person's picks, as the signed close's own record (`closeDecl.picks`) names it; `agent` = the drafter's;
|
|
258
|
-
* `
|
|
298
|
+
* `default` = code's own (the one list's `$` rows: the cited part written by `defaultCitedText`, and the numbers tie of a text step).
|
|
259
299
|
* @param {any} closeDecl
|
|
260
|
-
* @returns {{line: number, text: string,
|
|
300
|
+
* @returns {{line: number, text: string, by: 'agent'|'you'|'default', key?: string}[]}
|
|
261
301
|
*/
|
|
262
302
|
export function checksOfClose(closeDecl: any): {
|
|
263
303
|
line: number;
|
|
264
304
|
text: string;
|
|
265
|
-
|
|
266
|
-
|
|
305
|
+
by: "agent" | "you" | "default";
|
|
306
|
+
key?: string;
|
|
267
307
|
}[];
|
|
268
308
|
/**
|
|
269
309
|
* The names of the facts a signed close checks (every fact part of every rubric-step stage). Pure.
|
|
@@ -271,33 +311,40 @@ export function checksOfClose(closeDecl: any): {
|
|
|
271
311
|
*/
|
|
272
312
|
export function signedFactNames(closeDecl: any): string[];
|
|
273
313
|
/**
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
* @
|
|
279
|
-
* `jobLines` — the person's numbered lines, so a ~ rule the drafter listed as Not checked reads in the person's own words
|
|
280
|
-
* @returns {{checkItems: {text: string, fromLine: number[], by: 'agent'|'you'|null}[], notChecked: string[], moved: {text: string, fromLine: number[]|null}[]}}
|
|
314
|
+
* The plan card after drafting, read from the signed close ALONE (one source, the same the Job tab reads): its checks are `checksOfClose`; its Not checked is the close's own notes, the prose
|
|
315
|
+
* steps' "you judge it at Accept" lines and the refusals (`ruleNotChecked`, which reads the list's not-checked rows when the close carries the list). Nothing the confirm turn said is merged
|
|
316
|
+
* in: a rubric confirm turn plans the goal only, so a check can never be shown and then silently dropped (run mv5bk400).
|
|
317
|
+
* @param {{closeDecl: any, jobLines?: any[]|null, ledger?: {key: string, words: string[]}[]|null}} o `jobLines` the person's numbered lines, so a ~ rule reads in the person's own words; `ledger` the draft log's final list rows, so a phrase row is named by its words
|
|
318
|
+
* @returns {{checkItems: {text: string, fromLine: number[], by: 'agent'|'you'|'default', key?: string}[], notChecked: string[], notCheckedBy: Record<string, 'you'|'agent'|'default'>}}
|
|
281
319
|
*/
|
|
282
|
-
export function
|
|
283
|
-
confirmed: {
|
|
284
|
-
text: string;
|
|
285
|
-
fromLine: number[] | null;
|
|
286
|
-
}[];
|
|
287
|
-
notChecked: string[];
|
|
320
|
+
export function cardOfClose({ closeDecl, jobLines, ledger }: {
|
|
288
321
|
closeDecl: any;
|
|
289
322
|
jobLines?: any[] | null;
|
|
323
|
+
ledger?: {
|
|
324
|
+
key: string;
|
|
325
|
+
words: string[];
|
|
326
|
+
}[] | null;
|
|
290
327
|
}): {
|
|
291
328
|
checkItems: {
|
|
292
329
|
text: string;
|
|
293
330
|
fromLine: number[];
|
|
294
|
-
by: "agent" | "you" |
|
|
331
|
+
by: "agent" | "you" | "default";
|
|
332
|
+
key?: string;
|
|
295
333
|
}[];
|
|
296
334
|
notChecked: string[];
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
335
|
+
notCheckedBy: Record<string, "you" | "agent" | "default">;
|
|
336
|
+
};
|
|
337
|
+
/**
|
|
338
|
+
* The sign-time check of a close that carries the one check list: every BUILT row (the mechanical floor aside) points at a part that is really in the close, and every real check part
|
|
339
|
+
* (countable or fact) has at least one built row pointing at it, so a check cannot be in the close with no row and a row cannot claim a check the close does not run. A close with no list is
|
|
340
|
+
* not examined here. Pure.
|
|
341
|
+
* @param {any} closeDecl @returns {{ok: true}|{ok: false, error: string}}
|
|
342
|
+
*/
|
|
343
|
+
export function listMatchesClose(closeDecl: any): {
|
|
344
|
+
ok: true;
|
|
345
|
+
} | {
|
|
346
|
+
ok: false;
|
|
347
|
+
error: string;
|
|
301
348
|
};
|
|
302
349
|
/**
|
|
303
350
|
* The sign-time invariant: the checks the person was shown (`shown`, from the plan card) are exactly the checks the signed
|
|
@@ -350,6 +397,11 @@ export const COUNT_CHECKS: Readonly<Record<string, readonly string[]>>;
|
|
|
350
397
|
export function sha256Of(b: string | Buffer): string;
|
|
351
398
|
export function boundInWords(b: unknown, said: string): boolean;
|
|
352
399
|
export function wordsSaidOn(jl: any): string;
|
|
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";
|
|
403
|
+
export function defaultCitedText(label: string): string;
|
|
404
|
+
export function defaultNoteText(n: number): string;
|
|
353
405
|
export type ShapeRed = {
|
|
354
406
|
code: string;
|
|
355
407
|
path: string;
|
package/types/run.d.ts
CHANGED
|
@@ -38,19 +38,10 @@
|
|
|
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 {
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
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`).
|
|
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
|
|
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
|
|
43
|
+
* SIGNED one and the signed spec is never changed; the planner and the close read the copy. Absent = the signed words.
|
|
44
|
+
* @param {{workflowKey: string, rows: object[]}|null} [opts.placeRead] PLACE RULES: what the run start read (rows {key, kind, found, value, was, reason}); recorded once as a `place-rules` event right after `job-start`. Absent = the job has none (or this is a resume, whose first leg wrote it).
|
|
54
45
|
* @param {number} [opts.capRuns] shell-owned iteration cap for the plan flow's
|
|
55
46
|
* CLOSE-FIX loop (a plan STEP runs under the strike ladder instead)
|
|
56
47
|
* @param {number} [opts.strikeLimit] shell-owned strike ceiling for a plan step's ladder
|
|
@@ -219,7 +210,7 @@
|
|
|
219
210
|
* deliberately NOT in the resumable/checkpoint set (`src/reuse.js`) — an
|
|
220
211
|
* unknown in-flight state is not a known-safe resume point.
|
|
221
212
|
*/
|
|
222
|
-
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 }: {
|
|
223
214
|
approvals: unknown;
|
|
224
215
|
workdir: string;
|
|
225
216
|
provider: any;
|
|
@@ -235,12 +226,11 @@ export function runJob(rawSpec: object | string, { approvals, workdir, provider,
|
|
|
235
226
|
in: number;
|
|
236
227
|
out: number;
|
|
237
228
|
} | null | undefined;
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
229
|
+
placeValues?: Record<string, string> | null | undefined;
|
|
230
|
+
placeRead?: {
|
|
231
|
+
workflowKey: string;
|
|
232
|
+
rows: object[];
|
|
241
233
|
} | null | undefined;
|
|
242
|
-
judgeModel?: string | null | undefined;
|
|
243
|
-
judgeProvider?: any;
|
|
244
234
|
capRuns?: number | undefined;
|
|
245
235
|
strikeLimit?: number | undefined;
|
|
246
236
|
shellCapUsd?: number | undefined;
|
package/types/userrun.d.ts
CHANGED