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
|
@@ -22,15 +22,15 @@ import { spawn as realSpawn } from 'node:child_process';
|
|
|
22
22
|
import { openSync, existsSync } from 'node:fs';
|
|
23
23
|
import { join } from 'node:path';
|
|
24
24
|
import { readFileSync } from 'node:fs';
|
|
25
|
-
import { planMatchesClose } from '../rubricstep.js';
|
|
25
|
+
import { planMatchesClose, listMatchesClose } from '../rubricstep.js';
|
|
26
26
|
import { ticketNumberOf } from '../ticketshape.js';
|
|
27
27
|
import { newestUnrunTicket } from '../ticketnext.js';
|
|
28
28
|
import { readRunList } from '../runlist.js';
|
|
29
|
-
import { createSession, validateJobCard, validateReuseCard, jobBoxesChanged, buildReuseSpec, cardFields, nextFreeJobName, startDestinationProblem, resolveFlowCard, ticketBoxProblem, STEP_LABELS } from './authorsession.js';
|
|
29
|
+
import { createSession, ticketRubricInputs, validateJobCard, validateReuseCard, jobBoxesChanged, buildReuseSpec, cardFields, nextFreeJobName, startDestinationProblem, resolveFlowCard, ticketBoxProblem, STEP_LABELS } from './authorsession.js';
|
|
30
30
|
import { parseInputs } from '../jobblock.js';
|
|
31
31
|
import { isReusableGreen } from './status.js';
|
|
32
32
|
import { proveInputFiles, looksLikeRubricInput, webFetchState } from '../source.js';
|
|
33
|
-
import { validateJob, flowTypeOf } from '../job.js';
|
|
33
|
+
import { validateJob, flowTypeOf, oldJobWords } from '../job.js';
|
|
34
34
|
import { ticketAnyway } from './tickets.js';
|
|
35
35
|
import { cardScheduleOf } from '../cardschedule.js';
|
|
36
36
|
|
|
@@ -48,6 +48,7 @@ import { thinkingForLine } from '../thinking.js';
|
|
|
48
48
|
import { panelMoney2 } from '../panelmoney.js';
|
|
49
49
|
import { apiKeyProblem, checkProviderReachable } from '../providers.js';
|
|
50
50
|
import { reviseRefusal, sessionsRootOf } from '../revises.js';
|
|
51
|
+
import { CHOICE_SAYS } from '../questionbox.js';
|
|
51
52
|
|
|
52
53
|
/** @returns {string} a fresh per-process token — never persisted, never logged */
|
|
53
54
|
export function mintToken() {
|
|
@@ -166,13 +167,19 @@ export function createAuthorRoutes(opts) {
|
|
|
166
167
|
// the session proves every line itself (`proveRubricInputs`), at $0, before any model call.
|
|
167
168
|
const rubric = reuse ? reuse.spec?.verdictType === 'soft-green' : card?.checkType === 'rubric';
|
|
168
169
|
if (reuse) card = { ...card, checkType: rubric ? 'rubric' : 'deterministic' };
|
|
169
|
-
|
|
170
|
+
// hamr 2026-11-14 (piece 6): a job made with PASS/FAIL examples or the old judge is not reused, nor fired by a schedule; old runs are not repaired
|
|
171
|
+
const oldJob = reuse ? oldJobWords(reuse.spec) : null;
|
|
172
|
+
if (oldJob !== null) return Promise.resolve({ ok: /** @type {false} */ (false), status: 400, error: `${oldJob} Nothing spent.` });
|
|
170
173
|
// piece 8: the card's Flow type and MCP pick, decided at $0 before any session (a reuse keeps the signed spec's own MCP). Nothing is started: the pick reads the check log.
|
|
171
174
|
/** @type {ReturnType<typeof resolveFlowCard>} */
|
|
172
175
|
const flow = reuse
|
|
173
176
|
? { ok: true, flowType: flowTypeOf(reuse.spec), pick: reuse.spec?.mcp ? { server: reuse.spec.mcp.server, tools: reuse.spec.mcp.tools } : null }
|
|
174
177
|
: resolveFlowCard(card, { ...(opts.home !== undefined ? { home: opts.home } : {}), ...(opts.mcpHome !== undefined ? { mcpHome: opts.mcpHome } : {}) });
|
|
175
178
|
if (!flow.ok) return Promise.resolve({ ok: /** @type {false} */ (false), status: 400, error: flow.error });
|
|
179
|
+
// hamr 2026-11-14 (piece 5): a Tickets + rubric job's one input is its ticket line, numbered 1, by the same owner the card, the session and Reuse read
|
|
180
|
+
inputs = ticketRubricInputs(inputs, { rubric, flowType: flow.flowType });
|
|
181
|
+
if (flow.flowType === 'tickets') card = { ...card, flowType: 'tickets' };
|
|
182
|
+
const filesJob = rubric && inputs.length > 0 && looksLikeRubricInput(inputs[0].value);
|
|
176
183
|
const ticketProblem = ticketBoxProblem(card, flow.flowType);
|
|
177
184
|
if (ticketProblem !== null) return Promise.resolve({ ok: /** @type {false} */ (false), status: 400, error: ticketProblem });
|
|
178
185
|
// piece 9 (R7): the card's Schedule row, decided at $0 before any session exists. A scheduled fire is a headless start with no Schedule row, so it never reaches this.
|
|
@@ -432,7 +439,7 @@ export function createAuthorRoutes(opts) {
|
|
|
432
439
|
return true;
|
|
433
440
|
}
|
|
434
441
|
|
|
435
|
-
const m = /^\/api\/author\/([A-Za-z0-9]+)(\/(send|sign-prepare|sign|check-deps|abandon))?$/.exec(pathname);
|
|
442
|
+
const m = /^\/api\/author\/([A-Za-z0-9]+)(\/(send|sign-prepare|sign|check-deps|abandon|row-edit))?$/.exec(pathname);
|
|
436
443
|
if (!m) { send(404, { ok: false, error: 'not found' }); return true; }
|
|
437
444
|
const session = sessions.get(m[1]);
|
|
438
445
|
if (!session) { send(404, { ok: false, error: 'no such session' }); return true; }
|
|
@@ -447,7 +454,9 @@ export function createAuthorRoutes(opts) {
|
|
|
447
454
|
if (req.method !== 'POST') { send(405, { ok: false, error: 'POST only' }); return true; }
|
|
448
455
|
|
|
449
456
|
if (sub === 'send') {
|
|
450
|
-
|
|
457
|
+
// hamr 2026-11-12 (fwd M10 am32 A): while a question is open the page always posts the button's typed choice; an answer with none is from an old page and is refused, nothing logged, the question stays open
|
|
458
|
+
if (session.state.pendingAsk?.kind === 'answer' && body?.choice === undefined) { send(400, { ok: false, refused: 'bad-choice', error: CHOICE_SAYS.outOfDate, state: session.state }); return true; }
|
|
459
|
+
const r =session.send(String(body?.text ?? ''), body?.choice);
|
|
451
460
|
send(r.ok ? 200 : 400, { ...r, state: session.state });
|
|
452
461
|
return true;
|
|
453
462
|
}
|
|
@@ -464,6 +473,12 @@ export function createAuthorRoutes(opts) {
|
|
|
464
473
|
send(r.ok ? 200 : 400, { ...r, state: session.state });
|
|
465
474
|
return true;
|
|
466
475
|
}
|
|
476
|
+
if (sub === 'row-edit') {
|
|
477
|
+
// hamr 2026-11-13 (N-2): the confirm card's Drop / Add. $0 and instant: a row edit through the live check block, never a model call
|
|
478
|
+
const r = session.rowEdit(body?.op, body?.key);
|
|
479
|
+
send(r.ok ? 200 : 400, { ...r, state: session.state });
|
|
480
|
+
return true;
|
|
481
|
+
}
|
|
467
482
|
if (sub === 'sign-prepare') {
|
|
468
483
|
const r = session.signPrepare();
|
|
469
484
|
send(r.ok ? 200 : 400, { ...r, state: session.state });
|
|
@@ -523,6 +538,9 @@ export function signRun(session, claimedHash, o) {
|
|
|
523
538
|
const spec = JSON.parse(readFileSync(session.state.resolvedSpecPath, 'utf8'));
|
|
524
539
|
const m = planMatchesClose(session.state.finalPlan.checkItems, spec.closeDecl);
|
|
525
540
|
if (!m.ok) return { ok: false, error: m.error };
|
|
541
|
+
// B2: a close that carries the one check list must agree with it: every built row points at a check the close runs, and every check has a row
|
|
542
|
+
const lm = listMatchesClose(spec.closeDecl);
|
|
543
|
+
if (!lm.ok) return { ok: false, error: lm.error };
|
|
526
544
|
} catch { return { ok: false, error: 'could not read the signed spec to compare it with the plan you were shown — refusing to sign' }; }
|
|
527
545
|
}
|
|
528
546
|
// PIECE 9 (R7): the Schedule the card picked is signed WITH the job it is a field of (`spec.trigger`), written OFF beside the run about to start; the first green run turns it on. Before the
|