fwdloop 0.38.0 → 0.39.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/bin/fwdloop +21 -19
- package/package.json +1 -1
- package/src/ask.js +70 -148
- package/src/audit-fold.js +5 -4
- package/src/auditchecks.js +6 -4
- package/src/authoring.js +32 -60
- package/src/blockasks.js +2 -1
- package/src/blockassemble.js +3 -2
- package/src/blockdraft.js +2 -2
- package/src/blockpick.js +5 -5
- package/src/books.js +217 -12
- package/src/checkblock.js +20 -41
- package/src/checklistsign.js +25 -3
- package/src/checklook.js +3 -1
- package/src/checkpick.js +5 -76
- package/src/cited-source.js +4 -4
- package/src/citedcheck.js +6 -11
- package/src/citedwords.js +9 -8
- package/src/closers.js +9 -6
- package/src/declaration.js +14 -49
- package/src/diary.js +23 -1
- package/src/draft-steps.js +11 -1
- package/src/drafter.js +13 -9
- package/src/draftfiles.js +127 -0
- package/src/draftspend.js +165 -17
- package/src/flow.js +42 -87
- package/src/flowmodel.js +1 -1
- package/src/index.js +3 -2
- package/src/inside.js +86 -0
- package/src/jsonl-append.js +33 -1
- package/src/learn.js +1 -1
- package/src/learnstore.js +20 -22
- package/src/line-checks.js +1 -1
- package/src/liveness.js +3 -0
- package/src/mcp-use.js +8 -9
- package/src/memo.js +13 -16
- package/src/model-step.js +2 -2
- package/src/page-words.js +8 -0
- package/src/pageask.js +8 -3
- package/src/pagebits.js +8 -1
- package/src/pagedropwords.js +1 -1
- package/src/pagerules.js +6 -3
- package/src/panel/author.js +99 -75
- package/src/panel/authorcard.js +21 -8
- package/src/panel/authorflows.js +3 -3
- package/src/panel/authorresume.js +3 -3
- package/src/panel/authorstart.js +15 -16
- package/src/panel/authortrigger.js +43 -70
- package/src/panel/data.js +125 -168
- package/src/panel/index.html +122 -61
- package/src/panel/jobgrid.js +3 -7
- package/src/panel/result.js +7 -10
- package/src/panel/resume.js +4 -3
- package/src/panel/scheduler.js +9 -9
- package/src/panel/server.js +8 -4
- package/src/panel/spawn.js +22 -11
- package/src/panel/tickets.js +2 -2
- package/src/pickrecord.js +51 -31
- package/src/placerule.js +3 -4
- package/src/planrebuild.js +19 -19
- package/src/primitives.js +1 -1
- package/src/provider.js +1 -1
- package/src/reasons.js +25 -0
- package/src/runfile.js +26 -2
- package/src/runner.js +57 -105
- package/src/runvalues.js +47 -24
- package/src/schedule-choices.js +41 -0
- package/src/schedule-shape.js +39 -0
- package/src/schedule.js +9 -8
- package/src/setup.js +20 -36
- package/src/shaperows.js +2 -2
- package/src/sheetblock.js +2 -2
- package/src/sheetbuild.js +5 -5
- package/src/sheetrun.js +4 -5
- package/src/summary-words.js +2 -1
- package/src/thinking.js +5 -2
- package/src/ticketrows.js +7 -28
- package/src/trigger-clock.js +9 -23
- package/src/trigger-files.js +30 -22
- package/src/trigger-tickets.js +15 -14
- package/src/try-checks.js +2 -1
- package/src/types.js +2 -0
- package/types/ask.d.ts +25 -20
- package/types/authoring.d.ts +7 -42
- package/types/blockpick.d.ts +1 -1
- package/types/books.d.ts +256 -4
- package/types/checkblock.d.ts +1 -23
- package/types/checklist.d.ts +3 -3
- package/types/checklistsign.d.ts +7 -0
- package/types/checkpick.d.ts +0 -21
- package/types/citedwords.d.ts +7 -4
- package/types/closers.d.ts +1 -0
- package/types/declaration.d.ts +4 -14
- package/types/diary.d.ts +14 -1
- package/types/draft-steps.d.ts +7 -0
- package/types/drafter.d.ts +1 -1
- package/types/draftfiles.d.ts +89 -0
- package/types/draftspend.d.ts +74 -0
- package/types/flow.d.ts +32 -54
- package/types/index.d.ts +3 -3
- package/types/inside.d.ts +58 -0
- package/types/jsonl-append.d.ts +20 -0
- package/types/learnstore.d.ts +0 -2
- package/types/liveness.d.ts +1 -0
- package/types/page-words.d.ts +6 -0
- package/types/pageask.d.ts +2 -0
- package/types/pagebits.d.ts +3 -0
- package/types/pagerules.d.ts +1 -0
- package/types/panel/author.d.ts +7 -3
- package/types/panel/authorcard.d.ts +0 -6
- package/types/panel/authorflows.d.ts +4 -4
- package/types/panel/authortrigger.d.ts +16 -2
- package/types/panel/data.d.ts +36 -11
- package/types/panel/spawn.d.ts +18 -2
- package/types/pickrecord.d.ts +29 -0
- package/types/reasons.d.ts +23 -0
- package/types/runfile.d.ts +14 -0
- package/types/runner.d.ts +6 -38
- package/types/runvalues.d.ts +17 -2
- package/types/schedule-choices.d.ts +9 -0
- package/types/schedule-shape.d.ts +15 -0
- package/types/sheetbuild.d.ts +1 -1
- package/types/thinking.d.ts +1 -0
- package/types/ticketrows.d.ts +0 -9
- package/types/trigger-clock.d.ts +3 -2
- package/types/trigger-files.d.ts +15 -4
- package/types/types.d.ts +8 -0
package/src/trigger-tickets.js
CHANGED
|
@@ -9,7 +9,8 @@ import { createMCPBridge, discoverServers } from 'bare-agent/mcp';
|
|
|
9
9
|
|
|
10
10
|
import { configForServer, remoteRefusal, mcpStartOpts, startRefusal, firstLine, isDeviceLogin } from './ticket-mcp.js';
|
|
11
11
|
import { parseTicketList, isTicketNumber, TICKET_MAX } from './ticket-shape.js';
|
|
12
|
-
import {
|
|
12
|
+
import { queueOf } from './trigger-files.js';
|
|
13
|
+
import { appendTriggerLedger, readTriggerLedger } from './jsonl-append.js';
|
|
13
14
|
|
|
14
15
|
/** A look every 15 minutes, fixed (item 8). */
|
|
15
16
|
export const TICKET_LOOK_MS = 15 * 60_000;
|
|
@@ -142,12 +143,12 @@ export async function lookTickets({
|
|
|
142
143
|
|
|
143
144
|
/** The numbers a signing has a baseline or an arrived row for. @param {string} ledger @param {string} sig */
|
|
144
145
|
export function seenNumbers(ledger, sig) {
|
|
145
|
-
return new Set(
|
|
146
|
+
return new Set(readTriggerLedger(ledger, sig).filter((r) => (r.kind === 'baseline' || r.kind === 'arrived') && Number.isInteger(/** @type {any} */ (r).number)).map((r) => /** @type {any} */ (r).number));
|
|
146
147
|
}
|
|
147
148
|
/** Last-seen watched values per number: the newest baseline/arrived row's. @param {string} ledger @param {string} sig @returns {Map<number, {state: string, labels: string[]}>} */
|
|
148
149
|
export function lastSeen(ledger, sig) {
|
|
149
150
|
const m = new Map();
|
|
150
|
-
for (const r of /** @type {any[]} */ (
|
|
151
|
+
for (const r of /** @type {any[]} */ (readTriggerLedger(ledger, sig))) if ((r.kind === 'baseline' || r.kind === 'arrived') && r.watch) m.set(r.number, r.watch);
|
|
151
152
|
return m;
|
|
152
153
|
}
|
|
153
154
|
/** Has this signing had its first look (its baseline written)? @param {string} ledger @param {string} sig */
|
|
@@ -159,7 +160,7 @@ export function lookProblemOf(rows) {
|
|
|
159
160
|
const last = /** @type {any[]} */ (rows).findLast((r) => r.kind === 'unreadable' || r.kind === 'looked' || r.kind === 'baseline' || r.kind === 'arrived');
|
|
160
161
|
return last?.kind === 'unreadable' ? { at: last.at, why: String(last.why ?? 'it could not read the list') } : null;
|
|
161
162
|
}
|
|
162
|
-
export const hasBaseline = (ledger, sig) =>
|
|
163
|
+
export const hasBaseline = (ledger, sig) => readTriggerLedger(ledger, sig).some((r) => r.kind === 'baseline');
|
|
163
164
|
|
|
164
165
|
/**
|
|
165
166
|
* Write what a look found, once. First look: a `baseline` row per ticket on the page (never runs). Later: an `arrived` row per new ticket, oldest first (its arrival
|
|
@@ -169,50 +170,50 @@ export const hasBaseline = (ledger, sig) => readSeen(ledger, sig).some((r) => r.
|
|
|
169
170
|
*/
|
|
170
171
|
export function recordLook(ledger, sig, look, at) {
|
|
171
172
|
if (!look.ok) {
|
|
172
|
-
|
|
173
|
+
appendTriggerLedger(ledger, /** @type {any} */ ({ id: `unreadable:${at}`, kind: 'unreadable', sha: `unreadable:${at}`, name: '', size: 0, at, why: look.error }), sig);
|
|
173
174
|
return { arrived: [], unreadable: look.error };
|
|
174
175
|
}
|
|
175
176
|
// a look that read, after one that could not: one `looked` row ends the problem even when nothing is new (the only look row that is not found tickets)
|
|
176
177
|
// M13 piece 7 (9.7): ticket numbers over the cap were ignored by the look; ONE reason is recorded on the same row
|
|
177
178
|
const note = look.ignored?.length ? `ignored ${look.ignored.length} ticket number${look.ignored.length === 1 ? '' : 's'} over ${TICKET_MAX.toLocaleString('en-US')}: ${look.ignored.slice(0, 5).join(', ')}` : null;
|
|
178
|
-
if (note !== null || lookProblemOf(
|
|
179
|
+
if (note !== null || lookProblemOf(readTriggerLedger(ledger, sig))) appendTriggerLedger(ledger, /** @type {any} */ ({ id: `looked:${at}`, kind: 'looked', sha: `looked:${at}`, name: '', size: 0, at, ...(note !== null ? { why: note } : {}) }), sig);
|
|
179
180
|
const arrived = [];
|
|
180
181
|
const watch = (/** @type {{state: string, labels: string[]}} */ w) => ({ state: w.state, labels: w.labels });
|
|
181
182
|
if (look.first) {
|
|
182
183
|
for (const i of [...look.found].reverse()) {
|
|
183
184
|
if (look.cut !== undefined && i.number > look.cut) {
|
|
184
185
|
// M13 piece 5 (F114f): above the number the first green run read = it came in after that run began, so it runs once the schedule is on
|
|
185
|
-
|
|
186
|
+
appendTriggerLedger(ledger, /** @type {any} */ ({
|
|
186
187
|
id: `arrived:ticket:${i.number}`, kind: 'arrived', sha: `ticket:${i.number}`, name: `#${i.number}`, path: `#${i.number}`, size: 0, at, number: i.number, watch: watch(i),
|
|
187
188
|
}), sig);
|
|
188
189
|
arrived.push(i.number);
|
|
189
190
|
continue;
|
|
190
191
|
}
|
|
191
|
-
|
|
192
|
+
appendTriggerLedger(ledger, /** @type {any} */ ({
|
|
192
193
|
id: `baseline:ticket:${i.number}`, kind: 'baseline', sha: `ticket:${i.number}`, name: `#${i.number}`, path: `#${i.number}`, size: 0, at, number: i.number, watch: watch(i),
|
|
193
194
|
}), sig);
|
|
194
195
|
}
|
|
195
196
|
return { arrived, unreadable: null };
|
|
196
197
|
}
|
|
197
198
|
for (const i of [...look.found].reverse()) {
|
|
198
|
-
|
|
199
|
+
appendTriggerLedger(ledger, /** @type {any} */ ({
|
|
199
200
|
id: `arrived:ticket:${i.number}`, kind: 'arrived', sha: `ticket:${i.number}`, name: `#${i.number}`, path: `#${i.number}`, size: 0, at, number: i.number, watch: watch(i),
|
|
200
201
|
}), sig);
|
|
201
202
|
arrived.push(i.number);
|
|
202
203
|
}
|
|
203
204
|
for (const c of look.changed) {
|
|
204
|
-
const rows =
|
|
205
|
+
const rows = readTriggerLedger(ledger, sig);
|
|
205
206
|
if (queueOf(rows).some((q) => /** @type {any} */ (q).number === c.number)) {
|
|
206
207
|
// already waiting: the queued run reads the ticket as it is when it starts, so no second run. Advance the last-seen value (a `baseline` row, same writer) so the
|
|
207
208
|
// next look does not re-fire this same change once that run has started; a LATER change still differs from it and arrives once.
|
|
208
209
|
const b = rows.filter((r) => r.kind === 'baseline' && /** @type {any} */ (r).number === c.number).length;
|
|
209
|
-
|
|
210
|
+
appendTriggerLedger(ledger, /** @type {any} */ ({
|
|
210
211
|
id: `baseline:ticket:${c.number}:${b}`, kind: 'baseline', sha: `ticket:${c.number}`, name: `#${c.number}`, path: `#${c.number}`, size: 0, at, number: c.number, watch: watch(c),
|
|
211
212
|
}), sig);
|
|
212
213
|
continue;
|
|
213
214
|
}
|
|
214
215
|
const n = rows.filter((r) => r.kind === 'arrived' && /** @type {any} */ (r).number === c.number).length;
|
|
215
|
-
|
|
216
|
+
appendTriggerLedger(ledger, /** @type {any} */ ({
|
|
216
217
|
id: `arrived:ticket:${c.number}:${n}`, kind: 'arrived', sha: `ticket:${c.number}:${n}`, name: `#${c.number}`, path: `#${c.number}`, size: 0, at, number: c.number, watch: watch(c), reason: c.reason,
|
|
217
218
|
}), sig);
|
|
218
219
|
arrived.push(c.number);
|
|
@@ -227,11 +228,11 @@ export function recordLook(ledger, sig, look, at) {
|
|
|
227
228
|
* @returns {{ok: true} | {ok: false, say: string}}
|
|
228
229
|
*/
|
|
229
230
|
export function recordAnyway(ledger, sig, a, at) {
|
|
230
|
-
const rows =
|
|
231
|
+
const rows = readTriggerLedger(ledger, sig);
|
|
231
232
|
if (queueOf(rows).some((q) => /** @type {any} */ (q).number === a.number)) return { ok: false, say: `Ticket #${a.number} is already queued. Nothing more was queued.` };
|
|
232
233
|
const n = rows.filter((r) => r.kind === 'arrived' && /** @type {any} */ (r).number === a.number).length;
|
|
233
234
|
const watch = lastSeen(ledger, sig).get(a.number);
|
|
234
|
-
|
|
235
|
+
appendTriggerLedger(ledger, /** @type {any} */ ({
|
|
235
236
|
id: `arrived:ticket:${a.number}:${n}`, kind: 'arrived', sha: `ticket:${a.number}:${n}`, name: `#${a.number}`, path: `#${a.number}`, size: 0, at, number: a.number, ...(watch ? { watch } : {}), reason: a.reason, anyway: true,
|
|
236
237
|
}), sig);
|
|
237
238
|
return { ok: true };
|
package/src/try-checks.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { createHash } from 'node:crypto';
|
|
5
5
|
import { serializeArtifact } from './ask.js';
|
|
6
6
|
import { labelled } from './checkwords.js';
|
|
7
|
+
import { noJudgment } from './closers.js';
|
|
7
8
|
import { sheetRowKey } from './sheetrows.js';
|
|
8
9
|
import { listLinesOf, partByOf } from './checklistsign.js';
|
|
9
10
|
import { rowResultsOf } from './rowresults.js';
|
|
@@ -74,7 +75,7 @@ export function closeRecords(step, artifact, closed, checkList = undefined, jobL
|
|
|
74
75
|
/** @param {any} step @param {any} artifact @param {any} closed @param {((idx: number) => string|null)} [partBy] set for a list line (M16): its softgreen picks carry the row's `by` instead of a label @param {any[]} [checkList] the signed list: a sheet row on it gives its check's `by` @param {any[]} [jobLines] */
|
|
75
76
|
function factRecords(step, artifact, closed, partBy = undefined, checkList = undefined, jobLines = undefined) {
|
|
76
77
|
const source = lineSource(step);
|
|
77
|
-
if (closed.verdict
|
|
78
|
+
if (noJudgment(closed.verdict)) {
|
|
78
79
|
return [{
|
|
79
80
|
n: 3, text: 'the close could run', ok: false, result: closed.verdict, source,
|
|
80
81
|
}];
|
package/src/types.js
CHANGED
|
@@ -222,6 +222,8 @@
|
|
|
222
222
|
* @property {Record<string, any>} declaration
|
|
223
223
|
* @property {Signature} signature
|
|
224
224
|
* @property {Record<string, string>} classes
|
|
225
|
+
* @property {string} [proseText] only on `readRunJobCopy`: the verified copy's own bytes (prose.txt)
|
|
226
|
+
* @property {string} [declarationText] only on `readRunJobCopy`: the verified copy's own bytes (declaration.json)
|
|
225
227
|
*/
|
|
226
228
|
|
|
227
229
|
/**
|
package/types/ask.d.ts
CHANGED
|
@@ -29,24 +29,6 @@ export function stripControl(text: any): string;
|
|
|
29
29
|
/** The status for a decision word read from disk, or undefined for anything that is not one of the table's OWN
|
|
30
30
|
* entries ("constructor", "toString" and the rest of Object.prototype read as unrecognised). */
|
|
31
31
|
export function decisionStatus(decision: any): any;
|
|
32
|
-
/**
|
|
33
|
-
* @param {{ timeoutMs?: number, pollMs?: number, clock?: () => string, writeLine?: (line:string) => void }} [opts]
|
|
34
|
-
* @returns {(opts:{question:string, evidence:unknown, runDir:string, ttlMs?: number}) => Promise<{decision:string, reason?:string}>}
|
|
35
|
-
*/
|
|
36
|
-
export function makeFileAskStep({ timeoutMs, pollMs, clock, writeLine, }?: {
|
|
37
|
-
timeoutMs?: number;
|
|
38
|
-
pollMs?: number;
|
|
39
|
-
clock?: () => string;
|
|
40
|
-
writeLine?: (line: string) => void;
|
|
41
|
-
}): (opts: {
|
|
42
|
-
question: string;
|
|
43
|
-
evidence: unknown;
|
|
44
|
-
runDir: string;
|
|
45
|
-
ttlMs?: number;
|
|
46
|
-
}) => Promise<{
|
|
47
|
-
decision: string;
|
|
48
|
-
reason?: string;
|
|
49
|
-
}>;
|
|
50
32
|
/**
|
|
51
33
|
* @param {any} ask the parsed ask.json object (or its `evidence` field's
|
|
52
34
|
* container — pass the whole ask so a missing `evidence` key is itself a
|
|
@@ -90,10 +72,12 @@ export function sha256Hex(serialised: string): string;
|
|
|
90
72
|
* M4c-fix amendment 1 (a): why a saved `answer.json` is not a usable answer for the open ask `openAskId`, or `null`
|
|
91
73
|
* when it is usable. The resume refuses each of these by name before it consumes the file, so without a way aside
|
|
92
74
|
* the file would block every new answer (`answerAsk`'s exclusive create).
|
|
93
|
-
* @param {
|
|
75
|
+
* @param {Extract<ReturnType<typeof readSavedAnswer>, {ok: true}>} saved `readSavedAnswer`'s result (the one reader of the file) @param {string} openAskId
|
|
94
76
|
* @returns {string|null}
|
|
95
77
|
*/
|
|
96
|
-
export function brokenAnswerWhy(
|
|
78
|
+
export function brokenAnswerWhy(saved: Extract<ReturnType<typeof readSavedAnswer>, {
|
|
79
|
+
ok: true;
|
|
80
|
+
}>, openAskId: string): string | null;
|
|
97
81
|
/**
|
|
98
82
|
* Move `answer.json` aside as a record: `answer.<askId>.<kind>.<n>.json`, `n` the first free number. Write-once:
|
|
99
83
|
* the new name is created with a hard link (`EEXIST` = taken, try the next), then the old name is removed — never
|
|
@@ -115,6 +99,23 @@ export function setAsideAnswer(runDir: string, askId: string, kind: "broken" | "
|
|
|
115
99
|
* @returns {string}
|
|
116
100
|
*/
|
|
117
101
|
export function effectiveExpiresAt(runDir: string, askId: string, original: string): string;
|
|
102
|
+
/**
|
|
103
|
+
* M20 am3e item 15: the ONE reader of a run's `ask.json`, as found, through the safe gateway: `{ok: false, missing, red}` when the gateway gives nothing (missing, a symlink,
|
|
104
|
+
* outside the folder), else `{ok: true, value, parseError}`: `value` is the parsed JSON as it is (any shape), `parseError` the parser's message when the text is not JSON
|
|
105
|
+
* (`value` is then undefined). It applies nothing: each caller keeps its own refusal words and its own `withReopen` step (`readAsk` in src/runner.js is this plus
|
|
106
|
+
* `withReopen`, null on any trouble).
|
|
107
|
+
* @param {string} runDir
|
|
108
|
+
* @returns {{ok: false, missing: boolean, red?: string}|{ok: true, value: any, parseError: string|null}}
|
|
109
|
+
*/
|
|
110
|
+
export function readAskFile(runDir: string): {
|
|
111
|
+
ok: false;
|
|
112
|
+
missing: boolean;
|
|
113
|
+
red?: string;
|
|
114
|
+
} | {
|
|
115
|
+
ok: true;
|
|
116
|
+
value: any;
|
|
117
|
+
parseError: string | null;
|
|
118
|
+
};
|
|
118
119
|
/**
|
|
119
120
|
* An `ask.json`-shaped object as every reader should see it: `expiresAt` is the effective deadline, and `waitMs`
|
|
120
121
|
* is the signed wait the ask was parked with (its own `expiresAt` minus `askedAt`, written from the signed ttl),
|
|
@@ -251,8 +252,12 @@ export function listArchivedAsks(runDir: string): {
|
|
|
251
252
|
archived: false;
|
|
252
253
|
why: string;
|
|
253
254
|
};
|
|
255
|
+
/** M20 am8a: the decisions that need a reason, as a list (the panel hands it to the page, which asks it instead of spelling them) */
|
|
256
|
+
export const REASON_DECISIONS: readonly string[];
|
|
257
|
+
export function needsReason(decision: unknown): boolean;
|
|
254
258
|
export namespace DECISION_STATUS {
|
|
255
259
|
let accept: string;
|
|
256
260
|
let redo: string;
|
|
257
261
|
let rerun: string;
|
|
258
262
|
}
|
|
263
|
+
import { readSavedAnswer } from './books.js';
|
package/types/authoring.d.ts
CHANGED
|
@@ -18,43 +18,13 @@ export function specHash({ proseText, declarationText, inputFactsText, readoutTe
|
|
|
18
18
|
red: string;
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
|
-
* The
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* @param {string} planDir
|
|
25
|
-
* A question the page look raised (M10 piece 3) also carries `source: 'look'`, `ask` ('reading' | 'cant-check'), `ruleNo`, `ruleText` and `proposal`; an answer file carries `at`.
|
|
26
|
-
* @returns {{ questions: {k:number, line:number, question:string, answer:string|null, at?:string, rule?:string|null, choice?:'agree'|'drop'|'rule'|'column', source?:string, ask?:string, ruleNo?:number, ruleText?:string, proposal?:string|null, check?:Record<string, any>, pairRule?:number, columns?:string[], readings?:Record<string,string>}[], open: {k:number, line:number, question:string, answer:null}[] }}
|
|
21
|
+
* The flow name a draft will sign as: the `name` in `target.json` of a plan folder (`planDir`, read through the safe gateway). A string that is not empty,
|
|
22
|
+
* else null (no file, not JSON, not an object, no name, a name that is empty or not a string).
|
|
23
|
+
* @param {string} planDir @returns {string|null}
|
|
27
24
|
*/
|
|
28
|
-
export function
|
|
29
|
-
questions: {
|
|
30
|
-
k: number;
|
|
31
|
-
line: number;
|
|
32
|
-
question: string;
|
|
33
|
-
answer: string | null;
|
|
34
|
-
at?: string;
|
|
35
|
-
rule?: string | null;
|
|
36
|
-
choice?: "agree" | "drop" | "rule" | "column";
|
|
37
|
-
source?: string;
|
|
38
|
-
ask?: string;
|
|
39
|
-
ruleNo?: number;
|
|
40
|
-
ruleText?: string;
|
|
41
|
-
proposal?: string | null;
|
|
42
|
-
check?: Record<string, any>;
|
|
43
|
-
pairRule?: number;
|
|
44
|
-
columns?: string[];
|
|
45
|
-
readings?: Record<string, string>;
|
|
46
|
-
}[];
|
|
47
|
-
open: {
|
|
48
|
-
k: number;
|
|
49
|
-
line: number;
|
|
50
|
-
question: string;
|
|
51
|
-
answer: null;
|
|
52
|
-
}[];
|
|
53
|
-
};
|
|
25
|
+
export function readTargetName(planDir: string): string | null;
|
|
54
26
|
/** The ONE check that a plan folder with questions is not signable (CLI sign, the page's sign route and signDraft all call it). null = fine. @param {string} planDir */
|
|
55
27
|
export function questionsRefusal(planDir: string): "A question the plan raised is still open. Answer it in the panel (fwdloop panel), then sign the plan it drafts after your answers. Nothing was signed." | "This plan raised questions, and your answers went into a newer plan. Sign the newest plan, not this one. Nothing was signed." | null;
|
|
56
|
-
/** Literal (never RegExp) key scrub; a secret under 8 chars is skipped so it can't blank ordinary text. */
|
|
57
|
-
export function scrub(text: any, secrets: any): any;
|
|
58
28
|
/** Count files directly inside `dir` that contain a secret literally. */
|
|
59
29
|
export function sweepForSecrets(dir: any, secrets: any): number;
|
|
60
30
|
/** Exact signed TTL with its unit, never rounded: 2h / 30m / 20s / 1500ms (the largest unit that divides it exactly). */
|
|
@@ -132,7 +102,7 @@ export function writePlanFiles(dir: string, files: Record<string, string>, opts?
|
|
|
132
102
|
* Test seam: `provider`/`rates`/`modelId` are injected; without them a live provider is built.
|
|
133
103
|
* `onResult({ ok })` (M4d am32): called once, after the spend is booked and just before the result files are written (the CLI gives its monthly hold back there).
|
|
134
104
|
*/
|
|
135
|
-
export function draftToDir({ proseFile, dir, root, name, slot, model, draftThinking, keyNames, env, provider, rates, modelId, noQuestions, onResult, fetchPage, leftRules, columnAnswers, carriedColumns, checkPicks, carriedPicks, carriedChoices, carriedSheetDropped, carriedShapeDropped, proseRead, flowType, mcpServer, mcpPick, mcpServers, actionMode, }: {
|
|
105
|
+
export function draftToDir({ proseFile, dir, root, name, slot, model, draftThinking, keyNames, env, provider, rates, modelId, noQuestions, onResult, onStepLine, fetchPage, leftRules, columnAnswers, carriedColumns, checkPicks, carriedPicks, carriedChoices, carriedSheetDropped, carriedShapeDropped, proseRead, flowType, mcpServer, mcpPick, mcpServers, actionMode, }: {
|
|
136
106
|
proseFile: any;
|
|
137
107
|
dir: any;
|
|
138
108
|
root: any;
|
|
@@ -147,6 +117,7 @@ export function draftToDir({ proseFile, dir, root, name, slot, model, draftThink
|
|
|
147
117
|
modelId: any;
|
|
148
118
|
noQuestions?: boolean | undefined;
|
|
149
119
|
onResult: any;
|
|
120
|
+
onStepLine: any;
|
|
150
121
|
fetchPage: any;
|
|
151
122
|
leftRules: any;
|
|
152
123
|
columnAnswers: any;
|
|
@@ -157,7 +128,7 @@ export function draftToDir({ proseFile, dir, root, name, slot, model, draftThink
|
|
|
157
128
|
carriedSheetDropped: any;
|
|
158
129
|
carriedShapeDropped: any;
|
|
159
130
|
proseRead: any;
|
|
160
|
-
flowType?: "
|
|
131
|
+
flowType?: "mcp" | "plain" | "tickets" | undefined;
|
|
161
132
|
mcpServer?: string | undefined;
|
|
162
133
|
mcpPick?: any;
|
|
163
134
|
mcpServers?: string[] | undefined;
|
|
@@ -276,20 +247,14 @@ export function signDraft({ dir, approve, signedBy, signedAt, env, keyNames, ses
|
|
|
276
247
|
runDir?: undefined;
|
|
277
248
|
modelPick?: undefined;
|
|
278
249
|
};
|
|
279
|
-
export const SPEC_HASH_FILE: "spec.hash";
|
|
280
250
|
/** The one folder under the flows root where the panel keeps its draft folders (M4e). Starts with a dot, so it is never a flow name. */
|
|
281
251
|
export const PANEL_DRAFTS_DIR: ".drafts";
|
|
282
|
-
/** Written when the end sweep finds a key in the draft dir; sign refuses a dir that has it. */
|
|
283
|
-
export const LEAK_MARKER_FILE: "scrub-leak.red";
|
|
284
252
|
/** M4e amendments 24/25: the drafter's questions (written once by `fwdloop draft`), each human answer (`answer-<k>.json`, written once by the panel),
|
|
285
253
|
* and the drafter's own "not checked" reading (information only; never in the readout, so never in the hash). */
|
|
286
|
-
export const QUESTIONS_FILE: "questions.json";
|
|
287
|
-
export const NOT_CHECKED_FILE: "not-checked.json";
|
|
288
254
|
/** M10: the drafting copy of each web page input is kept in this folder of the draft folder (a run freezes its own, never this one). */
|
|
289
255
|
export const PAGES_DIR: "pages";
|
|
290
256
|
/** M10 item 3: what the page-word look kept and dropped, per page input (the map the AI named, the kept facts with their readings, every drop). Not signed. */
|
|
291
257
|
export const PAGE_LOOK_FILE: "page-look.json";
|
|
292
|
-
export function ANSWER_FILE(k: any): string;
|
|
293
258
|
export function SIGN_LINE(dir: any, hash: any): string;
|
|
294
259
|
export const OPEN_QUESTION_SAY: "A question the plan raised is still open. Answer it in the panel (fwdloop panel), then sign the plan it drafts after your answers. Nothing was signed.";
|
|
295
260
|
export const ANSWERED_QUESTION_SAY: "This plan raised questions, and your answers went into a newer plan. Sign the newest plan, not this one. Nothing was signed.";
|
package/types/blockpick.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export function guardrailStandaloneNumbers(g: unknown): number[];
|
|
|
6
6
|
export function guardrailWordsPerSection(g: unknown): number | null;
|
|
7
7
|
/** the first "<N> sections" in a guardrail (digits, or one..ten), or null @param {unknown} g @returns {number|null} */
|
|
8
8
|
export function guardrailSectionCount(g: unknown): number | null;
|
|
9
|
-
/** the first "<N> bullets / list items / items / lines / points" in a guardrail (digits, or one..ten), or null @param {unknown} g @returns {number|null} */
|
|
9
|
+
/** the first "<N> bullets / list items / items / lines / points" in a guardrail (digits, or one..ten; not a price like "$5 per item" or a decimal), or null @param {unknown} g @returns {number|null} */
|
|
10
10
|
export function guardrailItemCount(g: unknown): number | null;
|
|
11
11
|
/**
|
|
12
12
|
* Keep a suggestion only if its rule is on bareguard's list, it carries only that rule's own fields, every number in it is a number the guardrail names and every word in it
|
package/types/books.d.ts
CHANGED
|
@@ -17,6 +17,31 @@ export function appendPidRow(runDir: string, row: {
|
|
|
17
17
|
* @returns {any[]}
|
|
18
18
|
*/
|
|
19
19
|
export function readPidRows(runDir: string): any[];
|
|
20
|
+
/**
|
|
21
|
+
* M20 am3b item 1: the ONE reader of a run's saved answer, `answer.json` (what `answerAsk` writes; the resume consumes it by renaming it away). Through the safe
|
|
22
|
+
* gateway (a symlink or a file outside the folder is refused). It parses nothing else's words: each caller keeps its own refusal sentence and reads these fields.
|
|
23
|
+
* `broken` = no JSON object, no `askId`, or no readable `answeredAt`: the file is not a usable answer for any ask. `value` is the parsed JSON as it is (any shape),
|
|
24
|
+
* `parseError` the parser's message when the text is not JSON, `isObject` says `value` is a plain JSON object. `decision` is the file's own word, not normalised.
|
|
25
|
+
* @param {string} runDir
|
|
26
|
+
* @returns {{ok: false, missing: boolean, red: string}
|
|
27
|
+
* | {ok: true, value: any, parseError: string|null, isObject: boolean, askId: string|null, decision: string|null, answeredAt: string|null, broken: boolean}}
|
|
28
|
+
*/
|
|
29
|
+
export function readSavedAnswer(runDir: string): {
|
|
30
|
+
ok: false;
|
|
31
|
+
missing: boolean;
|
|
32
|
+
red: string;
|
|
33
|
+
} | {
|
|
34
|
+
ok: true;
|
|
35
|
+
value: any;
|
|
36
|
+
parseError: string | null;
|
|
37
|
+
isObject: boolean;
|
|
38
|
+
askId: string | null;
|
|
39
|
+
decision: string | null;
|
|
40
|
+
answeredAt: string | null;
|
|
41
|
+
broken: boolean;
|
|
42
|
+
};
|
|
43
|
+
/** Has a process started on this run? (the run wrote its first pid row; a run with none is still starting, or never started) @param {string} runDir */
|
|
44
|
+
export function processStarted(runDir: string): boolean;
|
|
20
45
|
/**
|
|
21
46
|
* Raw read-back of one JSONL book, one writer's own sibling reader (M4a
|
|
22
47
|
* piece 2, docs/wiki/the-module-ladder.md M4a scope item 2: "one reader per
|
|
@@ -100,10 +125,20 @@ export function auditRowAt(row: Record<string, any>): {
|
|
|
100
125
|
* Read back every row `appendAudit` has written for one run, in file order
|
|
101
126
|
* (append order — never re-sorted). `[]` when the file doesn't exist yet
|
|
102
127
|
* (a run that hasn't made an attempt), never a thrown error.
|
|
128
|
+
* `{ strict: true }` is the one named mode for the money sum: `{ok:true, rows}` or `{ok:false, red}` on a torn line.
|
|
103
129
|
* @param {string} runDir
|
|
104
|
-
* @
|
|
130
|
+
* @param {{strict?: boolean}} [opts]
|
|
131
|
+
* @returns {any}
|
|
132
|
+
*/
|
|
133
|
+
export function readAudit(runDir: string, { strict }?: {
|
|
134
|
+
strict?: boolean;
|
|
135
|
+
}): any;
|
|
136
|
+
/**
|
|
137
|
+
* The one reader of a run's `trigger.json` (why it started): an object, or `null` (a hand run, a missing, refused or unreadable file, a non-object).
|
|
138
|
+
* @param {string} runDir
|
|
139
|
+
* @returns {Record<string, any>|null}
|
|
105
140
|
*/
|
|
106
|
-
export function
|
|
141
|
+
export function readTriggerRecord(runDir: string): Record<string, any> | null;
|
|
107
142
|
/**
|
|
108
143
|
* One row per run. `row` shape: `{ runId, at, outcome, spentUsd,
|
|
109
144
|
* spendComplete, capUsd, wallMs, signatureHash }`. Append-only, one writer.
|
|
@@ -120,6 +155,14 @@ export function appendHistory(flowDir: string, row: Record<string, any>): void;
|
|
|
120
155
|
* @returns {any[]}
|
|
121
156
|
*/
|
|
122
157
|
export function readHistory(flowDir: string): any[];
|
|
158
|
+
/**
|
|
159
|
+
* M20 am3g item 22: the ONE rule for why a run is red: the log's own `red` when it is a non-empty string, else the LAST red audit row as `<step>: <gap>` (a step can fail,
|
|
160
|
+
* redo and fail again differently; the most recent stop is where the run sits now), else null. The Run tab and the Result tab ask it and keep their own guards and words.
|
|
161
|
+
* @param {any} logJson the run's log.json (or null) @param {any[]} auditRows @returns {string|null}
|
|
162
|
+
*/
|
|
163
|
+
export function redWhyOf(logJson: any, auditRows: any[]): string | null;
|
|
164
|
+
/** the Runs list's bold word for an ending (`null` for none); `resumable` false asks the word of a run that cannot be continued @param {string} w @param {boolean} [resumable] @returns {string|null} */
|
|
165
|
+
export function endingWord(w: string, resumable?: boolean): string | null;
|
|
123
166
|
/**
|
|
124
167
|
* The ONE rule for "how did this run end": the LAST history row of the run (a run that was stopped or cap-halted and
|
|
125
168
|
* continued has one row per leg; history stays append-only). `null` when the run has no row yet, and also while a
|
|
@@ -130,5 +173,214 @@ export function readHistory(flowDir: string): any[];
|
|
|
130
173
|
* @returns {any|null}
|
|
131
174
|
*/
|
|
132
175
|
export function endRow(historyRows: any[], runDir: string, runId: string): any | null;
|
|
133
|
-
/** The
|
|
134
|
-
export
|
|
176
|
+
/** The one place `halt.<n>.consumed.json` is named: how many a run holds, and the name the next continue renames halt.json to. @param {string} runDir */
|
|
177
|
+
export function haltConsumedCount(runDir: string): number;
|
|
178
|
+
/** @param {string} runDir */
|
|
179
|
+
export function nextHaltConsumedName(runDir: string): string;
|
|
180
|
+
/** The one reader of halt.json (the run is waiting = the file EXISTS, parse or not: see {@link haltFileExists}): `{ok:true, halt}`, `{ok:false, missing:true}` (not resumable), or `{ok:false, red}`. @param {string} runDir */
|
|
181
|
+
export function readHaltRecord(runDir: string): {
|
|
182
|
+
ok: boolean;
|
|
183
|
+
missing: boolean;
|
|
184
|
+
red?: undefined;
|
|
185
|
+
halt?: undefined;
|
|
186
|
+
} | {
|
|
187
|
+
ok: boolean;
|
|
188
|
+
red: string;
|
|
189
|
+
missing?: undefined;
|
|
190
|
+
halt?: undefined;
|
|
191
|
+
} | {
|
|
192
|
+
ok: boolean;
|
|
193
|
+
halt: any;
|
|
194
|
+
missing?: undefined;
|
|
195
|
+
red?: undefined;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* `writeLog`'s own sibling reader (M4a piece 2, docs/wiki/the-module-
|
|
199
|
+
* ladder.md M4a scope item 2: "one reader per book") — `null` when the run
|
|
200
|
+
* hasn't reached an exit path yet (still running, or parked before any
|
|
201
|
+
* halt/complete), or the file is present but not valid JSON (a torn write),
|
|
202
|
+
* never a thrown error.
|
|
203
|
+
* @param {string} runDir
|
|
204
|
+
* @returns {any|null}
|
|
205
|
+
*/
|
|
206
|
+
export function readLog(runDir: string): any | null;
|
|
207
|
+
/**
|
|
208
|
+
* `state.json`'s own sibling reader (same rule as {@link readLog}) — `null`
|
|
209
|
+
* when the run has never parked, or the file is present but not valid JSON. `{ strict: true }` (Resume) returns
|
|
210
|
+
* `{ok:true, state}`, `{ok:false, missing:true}` or `{ok:false, red}` instead.
|
|
211
|
+
* @param {string} runDir
|
|
212
|
+
* @param {{strict?: boolean}} [opts]
|
|
213
|
+
* @returns {any}
|
|
214
|
+
*/
|
|
215
|
+
export function readRunState(runDir: string, { strict }?: {
|
|
216
|
+
strict?: boolean;
|
|
217
|
+
}): any;
|
|
218
|
+
/**
|
|
219
|
+
* "Is this run waiting to be resumed?" as the panel's start watcher has always read it: a `halt.json` that EXISTS means
|
|
220
|
+
* waiting, even when it does not parse (unlike {@link readHaltRecord}, where a torn file is a red). One name for that rule.
|
|
221
|
+
* @param {string} runDir
|
|
222
|
+
*/
|
|
223
|
+
export function haltFileExists(runDir: string): boolean;
|
|
224
|
+
export function consumedAnswerName(askId: string): string;
|
|
225
|
+
export function askIdOfConsumedName(name: string): string | null;
|
|
226
|
+
export const HALT_FILE: "halt.json";
|
|
227
|
+
/**
|
|
228
|
+
* M20 am1 item 1: the ONE table of endings. Every history outcome and every audit verdict fwd writes is a key; the flags say what it
|
|
229
|
+
* means, and every reader asks a helper below (never its own list of words):
|
|
230
|
+
* good the run or try passed resumable `halt.json` is left, the run can be continued
|
|
231
|
+
* notFailed not a failure of the job (complete, a stop, a cap halt, a rerun, an expired ask, a skipped ticket)
|
|
232
|
+
* noise the instrument failed, not the work (learnings set the run aside)
|
|
233
|
+
* blocked a verdict that stopped a step, the Run tab's "blocked" line
|
|
234
|
+
* open the Audit's `·` mark: waiting / a human note, not yet resolved either way
|
|
235
|
+
* waiting a step whose last row is this is parked stopNote a Stop's own note row, never a try
|
|
236
|
+
* humanNo the human's own no (the ask fold's `✗`) redTry a try that said the output was wrong
|
|
237
|
+
* tryVerdict a step's try with a verdict on its output spendFloor a halt whose spend can be a floor
|
|
238
|
+
* draftRow a verdict a drafting row of the Audit can carry (anything else reads not-done)
|
|
239
|
+
* notRunEnd not an end of a run (a pause, a failed stop, a skipped ticket): learnings wait
|
|
240
|
+
* word the Runs list's bold word for it (`null` = none: a run the human ended with rerun)
|
|
241
|
+
* wordUnresumed its word when the run cannot be continued (M20 am1 item 9: a cap-halt with no usable halt.json reads "capped")
|
|
242
|
+
* Outcome (history.jsonl) and verdict (audit.jsonl) are not split: one word means one thing on either book.
|
|
243
|
+
* Not here, by design: the scheduler's own words (busy, monthly-exhausted, refused fire), the closers' verdicts (done, crash,
|
|
244
|
+
* unparseable), and the Run tab's ending sentences (src/summary-words.js stays their one owner).
|
|
245
|
+
*/
|
|
246
|
+
export const ENDINGS: Readonly<{
|
|
247
|
+
complete: {
|
|
248
|
+
good: boolean;
|
|
249
|
+
notFailed: boolean;
|
|
250
|
+
word: string;
|
|
251
|
+
};
|
|
252
|
+
skipped: {
|
|
253
|
+
notFailed: boolean;
|
|
254
|
+
notRunEnd: boolean;
|
|
255
|
+
word: string;
|
|
256
|
+
};
|
|
257
|
+
stopped: {
|
|
258
|
+
resumable: boolean;
|
|
259
|
+
notFailed: boolean;
|
|
260
|
+
open: boolean;
|
|
261
|
+
humanNo: boolean;
|
|
262
|
+
word: string;
|
|
263
|
+
};
|
|
264
|
+
'cap-halt': {
|
|
265
|
+
resumable: boolean;
|
|
266
|
+
notFailed: boolean;
|
|
267
|
+
blocked: boolean;
|
|
268
|
+
spendFloor: boolean;
|
|
269
|
+
word: string;
|
|
270
|
+
wordUnresumed: string;
|
|
271
|
+
};
|
|
272
|
+
rerun: {
|
|
273
|
+
notFailed: boolean;
|
|
274
|
+
word: null;
|
|
275
|
+
};
|
|
276
|
+
'ask-expired': {
|
|
277
|
+
notFailed: boolean;
|
|
278
|
+
blocked: boolean;
|
|
279
|
+
open: boolean;
|
|
280
|
+
word: string;
|
|
281
|
+
};
|
|
282
|
+
'ask-timeout': {
|
|
283
|
+
blocked: boolean;
|
|
284
|
+
open: boolean;
|
|
285
|
+
word: string;
|
|
286
|
+
};
|
|
287
|
+
refused: {
|
|
288
|
+
blocked: boolean;
|
|
289
|
+
open: boolean;
|
|
290
|
+
waiting: boolean;
|
|
291
|
+
word: string;
|
|
292
|
+
};
|
|
293
|
+
red: {
|
|
294
|
+
blocked: boolean;
|
|
295
|
+
humanNo: boolean;
|
|
296
|
+
redTry: boolean;
|
|
297
|
+
tryVerdict: boolean;
|
|
298
|
+
draftRow: boolean;
|
|
299
|
+
word: string;
|
|
300
|
+
};
|
|
301
|
+
'not-done': {
|
|
302
|
+
blocked: boolean;
|
|
303
|
+
redTry: boolean;
|
|
304
|
+
tryVerdict: boolean;
|
|
305
|
+
word: string;
|
|
306
|
+
};
|
|
307
|
+
'provider-red': {
|
|
308
|
+
blocked: boolean;
|
|
309
|
+
noise: boolean;
|
|
310
|
+
spendFloor: boolean;
|
|
311
|
+
word: string;
|
|
312
|
+
};
|
|
313
|
+
'pricing-red': {
|
|
314
|
+
blocked: boolean;
|
|
315
|
+
spendFloor: boolean;
|
|
316
|
+
word: string;
|
|
317
|
+
};
|
|
318
|
+
'close-casualty': {
|
|
319
|
+
blocked: boolean;
|
|
320
|
+
noise: boolean;
|
|
321
|
+
word: string;
|
|
322
|
+
};
|
|
323
|
+
'preflight-red': {
|
|
324
|
+
word: string;
|
|
325
|
+
};
|
|
326
|
+
'struck-out': {
|
|
327
|
+
word: string;
|
|
328
|
+
};
|
|
329
|
+
'attempt-fallback': {
|
|
330
|
+
word: string;
|
|
331
|
+
};
|
|
332
|
+
'redo-halt': {
|
|
333
|
+
word: string;
|
|
334
|
+
};
|
|
335
|
+
'stop-failed': {
|
|
336
|
+
notRunEnd: boolean;
|
|
337
|
+
word: string;
|
|
338
|
+
};
|
|
339
|
+
green: {
|
|
340
|
+
good: boolean;
|
|
341
|
+
tryVerdict: boolean;
|
|
342
|
+
draftRow: boolean;
|
|
343
|
+
};
|
|
344
|
+
hitl: {
|
|
345
|
+
good: boolean;
|
|
346
|
+
tryVerdict: boolean;
|
|
347
|
+
};
|
|
348
|
+
softgreen: {
|
|
349
|
+
tryVerdict: boolean;
|
|
350
|
+
};
|
|
351
|
+
paused: {
|
|
352
|
+
open: boolean;
|
|
353
|
+
waiting: boolean;
|
|
354
|
+
notRunEnd: boolean;
|
|
355
|
+
};
|
|
356
|
+
'ask-reopened': {
|
|
357
|
+
open: boolean;
|
|
358
|
+
};
|
|
359
|
+
'lock-removed': {
|
|
360
|
+
open: boolean;
|
|
361
|
+
};
|
|
362
|
+
'stop-asked': {
|
|
363
|
+
open: boolean;
|
|
364
|
+
stopNote: boolean;
|
|
365
|
+
};
|
|
366
|
+
'stop-not-honoured': {
|
|
367
|
+
open: boolean;
|
|
368
|
+
stopNote: boolean;
|
|
369
|
+
};
|
|
370
|
+
'stale-answer-ignored': {};
|
|
371
|
+
'answer-after-run': {};
|
|
372
|
+
}>;
|
|
373
|
+
export function isGoodEnding(w: unknown): boolean;
|
|
374
|
+
export function isFailedEnding(w: unknown): boolean;
|
|
375
|
+
export function isNoiseEnding(w: unknown): boolean;
|
|
376
|
+
export function isBlockedEnding(w: unknown): boolean;
|
|
377
|
+
export function isOpenEnding(w: unknown): boolean;
|
|
378
|
+
export function isWaitingEnding(w: unknown): boolean;
|
|
379
|
+
export function isStopNote(w: unknown): boolean;
|
|
380
|
+
export function isHumanNo(w: unknown): boolean;
|
|
381
|
+
export function isRedTry(w: unknown): boolean;
|
|
382
|
+
export function isTryVerdict(w: unknown): boolean;
|
|
383
|
+
export function isSpendFloorEnding(w: unknown): boolean;
|
|
384
|
+
export function isDraftRowVerdict(w: unknown): boolean;
|
|
385
|
+
export function isNotRunEnd(w: unknown): boolean;
|
|
386
|
+
export function isResumableEnding(w: unknown): boolean;
|
package/types/checkblock.d.ts
CHANGED
|
@@ -31,29 +31,7 @@ export function choiceEntries(lines: {
|
|
|
31
31
|
/** what `setSheet` is given: code's build of a job's sheet checks, per sheet line @typedef {Awaited<ReturnType<typeof import('./sheetbuild.js').buildSheetChecks>>} SheetBuilt */
|
|
32
32
|
/** the four row edits an AI reply may hold */
|
|
33
33
|
export const EDIT_OPS: readonly string[];
|
|
34
|
-
|
|
35
|
-
export const REASON: Readonly<{
|
|
36
|
-
left: "You chose to leave it Not checked, so you judge it at Accept.";
|
|
37
|
-
nothingOnPage: "Your own words are on the line; the machine has no check for them, so you judge it at Accept.";
|
|
38
|
-
noRule: "No rule can check this, so you judge it at Accept.";
|
|
39
|
-
waitingPick: "waiting for your answer on the proposed check";
|
|
40
|
-
waitingReading: "waiting for your answer on the reading";
|
|
41
|
-
onePerLine: "this line finds facts, so it has no text to quote";
|
|
42
|
-
manyInputs: "the job has more than one input and code cannot pick which one the claims quote";
|
|
43
|
-
oneSidedTime: "a time limit the AI proposes must be a range, so you judge it at Accept.";
|
|
44
|
-
countNeedsFact: "a result count needs a fact to count; this line has none";
|
|
45
|
-
countNeedsSuggested: "a result count needs a fact to count; add the suggested fact on this line to count its results";
|
|
46
|
-
lookNoWords: "the page does not hold the words of the look's fact for this rule";
|
|
47
|
-
afterLast: "no more tries: Start over (rows are never changed by the AI after the last try)";
|
|
48
|
-
noPick: "No check was picked for it, so you judge it at Accept.";
|
|
49
|
-
itemCountByRule: "your rule on this line sets the item count";
|
|
50
|
-
negated: "it says what is not needed, so there is nothing to check";
|
|
51
|
-
dropped: "You dropped it.";
|
|
52
|
-
suggested: "Suggested: not in your job, so it is not checked unless you add it.";
|
|
53
|
-
sheetLine: "this line reads a sheet and its rules are checked by the sheet checks, so a row edit about it is not used";
|
|
54
|
-
sheetFacts: "this line reads a sheet, so it is checked by its sheet checks and not by page facts";
|
|
55
|
-
columnRule: "this rule only names a column; the agent's checks on this line use it";
|
|
56
|
-
}>;
|
|
34
|
+
export function isFactKind(kind: unknown): boolean;
|
|
57
35
|
export class CheckBlock {
|
|
58
36
|
/** @param {{texts: Record<string, string>, labels: string[], maxTries?: number, countScope?: (ruleText: string) => boolean, asks?: boolean, split?: boolean, cited?: boolean, repo?: {files: string[]|null, writeScope: string[]|null}|null}} o the frozen input texts, their labels, how many AI replies (tries) may still change a row, whether code scopes a counting `~` rule in (a pick is asked), and whether a person can be asked at all (`asks`: false = a rule code cannot settle is Not checked, a reading code proposes is built as the AI's proposal) */
|
|
59
37
|
constructor({ texts, labels, maxTries, countScope, asks, split, cited, repo }: {
|
package/types/checklist.d.ts
CHANGED
|
@@ -27,11 +27,11 @@ export function isEmptyList(rows: Row[]): boolean;
|
|
|
27
27
|
export function ledgerRecord(rows: Row[]): ({
|
|
28
28
|
key: string;
|
|
29
29
|
line: number;
|
|
30
|
-
rowKind: "
|
|
31
|
-
from: "default" | "agent" | "
|
|
30
|
+
rowKind: "count" | "floor" | "phrase" | "numbers" | "rule" | "fact" | "cited" | "note";
|
|
31
|
+
from: "default" | "agent" | "look" | "rule" | "pick";
|
|
32
32
|
by: "default" | "agent" | "you";
|
|
33
33
|
words: string[];
|
|
34
|
-
state: "
|
|
34
|
+
state: "built" | "dropped" | "not-checked" | "listed";
|
|
35
35
|
reason: string | null;
|
|
36
36
|
} | {
|
|
37
37
|
key: string;
|