fwdloop 0.13.0 → 0.15.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 +25 -12
- package/package.json +2 -2
- package/src/authoring.js +73 -39
- package/src/canrun.js +71 -1
- package/src/catalogue.json +2 -2
- package/src/checked.js +54 -0
- package/src/closers.js +112 -91
- package/src/declaration.js +115 -11
- package/src/drafter.js +139 -39
- package/src/flow.js +220 -5
- package/src/keysfile.js +4 -2
- package/src/model-step.js +1 -1
- package/src/monthly.js +139 -17
- package/src/panel/author.js +226 -64
- package/src/panel/authorcard.js +99 -4
- package/src/panel/authorflows.js +51 -10
- package/src/panel/authorresume.js +2 -2
- package/src/panel/authorstart.js +18 -10
- package/src/panel/data.js +147 -81
- package/src/panel/index.html +497 -338
- package/src/panel/server.js +5 -2
- package/src/panel/settings.js +1 -1
- package/src/runner.js +105 -48
- package/src/setup.js +21 -14
- package/src/signed-diff.js +71 -0
- package/types/authoring.d.ts +52 -14
- package/types/canrun.d.ts +33 -1
- package/types/checked.d.ts +25 -0
- package/types/closers.d.ts +47 -28
- package/types/declaration.d.ts +16 -2
- package/types/drafter.d.ts +146 -11
- package/types/flow.d.ts +42 -2
- package/types/model-step.d.ts +1 -6
- package/types/monthly.d.ts +25 -1
- package/types/panel/author.d.ts +55 -40
- package/types/panel/authorcard.d.ts +54 -0
- package/types/panel/authorflows.d.ts +39 -0
- package/types/panel/authorstart.d.ts +1 -0
- package/types/panel/data.d.ts +11 -56
- package/types/runner.d.ts +11 -3
- package/types/setup.d.ts +6 -12
- package/types/signed-diff.d.ts +10 -0
package/types/panel/author.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @param {{ root: string, home?: string, skipMonthly?: boolean, loadEnv: () => { ok: boolean, env: Record<string, string|undefined>, refusal: string|null }, bin?: string }} opts
|
|
2
|
+
* @param {{ root: string, home?: string, skipMonthly?: boolean, loadEnv: () => { ok: boolean, env: Record<string, string|undefined>, refusal: string|null }, bin?: string, childRunning?: (dir: string) => boolean }} opts
|
|
3
3
|
* `loadEnv` is the keys-file door (`keysForDoor`): called before EVERY spawn and every reply that quotes a log, so editing
|
|
4
4
|
* the file needs no restart. Its `env` is BOTH the child's spawn env AND the scrub list (POC (a), M4d wiring rule).
|
|
5
5
|
*/
|
|
@@ -13,6 +13,7 @@ export function createAuthor(opts: {
|
|
|
13
13
|
refusal: string | null;
|
|
14
14
|
};
|
|
15
15
|
bin?: string;
|
|
16
|
+
childRunning?: (dir: string) => boolean;
|
|
16
17
|
}): {
|
|
17
18
|
flows: () => {
|
|
18
19
|
status: number;
|
|
@@ -26,6 +27,23 @@ export function createAuthor(opts: {
|
|
|
26
27
|
body: {
|
|
27
28
|
ok: boolean;
|
|
28
29
|
flows: {
|
|
30
|
+
edit: {
|
|
31
|
+
ok: boolean;
|
|
32
|
+
say: string;
|
|
33
|
+
card?: undefined;
|
|
34
|
+
flowHash?: undefined;
|
|
35
|
+
} | {
|
|
36
|
+
ok: boolean;
|
|
37
|
+
card: {
|
|
38
|
+
job: string;
|
|
39
|
+
inputs: string;
|
|
40
|
+
destination: string;
|
|
41
|
+
capUsd: string;
|
|
42
|
+
askWait: string;
|
|
43
|
+
};
|
|
44
|
+
flowHash: any;
|
|
45
|
+
say?: undefined;
|
|
46
|
+
};
|
|
29
47
|
values: {
|
|
30
48
|
capUsd: number;
|
|
31
49
|
destination: string | null;
|
|
@@ -85,6 +103,23 @@ export function createAuthor(opts: {
|
|
|
85
103
|
body: {
|
|
86
104
|
ok: boolean;
|
|
87
105
|
flow: {
|
|
106
|
+
edit: {
|
|
107
|
+
ok: boolean;
|
|
108
|
+
say: string;
|
|
109
|
+
card?: undefined;
|
|
110
|
+
flowHash?: undefined;
|
|
111
|
+
} | {
|
|
112
|
+
ok: boolean;
|
|
113
|
+
card: {
|
|
114
|
+
job: string;
|
|
115
|
+
inputs: string;
|
|
116
|
+
destination: string;
|
|
117
|
+
capUsd: string;
|
|
118
|
+
askWait: string;
|
|
119
|
+
};
|
|
120
|
+
flowHash: any;
|
|
121
|
+
say?: undefined;
|
|
122
|
+
};
|
|
88
123
|
values: {
|
|
89
124
|
capUsd: number;
|
|
90
125
|
destination: string | null;
|
|
@@ -231,48 +266,28 @@ export function createAuthor(opts: {
|
|
|
231
266
|
*/
|
|
232
267
|
sign(id: string, body: any): any;
|
|
233
268
|
/**
|
|
234
|
-
* `POST /api/author/:id/revise` body
|
|
235
|
-
* plan -> $0 checks
|
|
236
|
-
*
|
|
237
|
-
* draft;
|
|
269
|
+
* `POST /api/author/:id/revise` body = the card fields, as `POST /api/author/draft` takes them (M4e amendment 14): the human's edited
|
|
270
|
+
* card on a draft whose first plan was green -> the same $0 checks as a first draft -> `card-<n>.json` + `prose-<n>.txt` (write-once)
|
|
271
|
+
* -> one detached plain `fwdloop draft prose-<n>.txt --out draft-<n>` -> 202. The model gets the card only. Up to MAX_REVISES per
|
|
272
|
+
* draft; a refusal makes no model call and writes nothing. A body carrying a note (`text`/`note`) is refused: nothing the human types
|
|
273
|
+
* goes to the model as a note. Synchronous, like `start`.
|
|
238
274
|
* @param {string} id @param {any} body
|
|
239
275
|
*/
|
|
240
276
|
revise(id: string, body: any): {
|
|
241
277
|
status: number;
|
|
242
|
-
body:
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
refused: string;
|
|
254
|
-
say?: undefined;
|
|
255
|
-
draftId?: undefined;
|
|
256
|
-
n?: undefined;
|
|
257
|
-
};
|
|
258
|
-
} | {
|
|
259
|
-
status: number;
|
|
260
|
-
body: {
|
|
261
|
-
ok: boolean;
|
|
262
|
-
refused: string;
|
|
263
|
-
draftId: string;
|
|
264
|
-
say: string;
|
|
265
|
-
n?: undefined;
|
|
266
|
-
};
|
|
267
|
-
} | {
|
|
278
|
+
body: any;
|
|
279
|
+
};
|
|
280
|
+
/**
|
|
281
|
+
* `POST /api/author/:id/answer` body `{ k, answer }` (M4e amendments 24, 25): the human's answer to the plan's question `k` of `n`, one at a time.
|
|
282
|
+
* A blank answer is refused and the question stays open; there is no skip. The answer is written ONCE ('wx') as `<plan>/answer-<k>.json`. After
|
|
283
|
+
* the LAST answer the plan is drafted again as a fresh plain `fwdloop draft --no-questions` child (it never asks), from the submitted card with
|
|
284
|
+
* each answer added word for word as a `~` guardrail under its line (the one `appendAnswersToJob`, then the one `cardToProse`). It is booked as
|
|
285
|
+
* an answer redraft (`redraft-<n>.json`), not a revise: it uses none of the 2. Synchronous, like `revise`; a refusal at $0 writes nothing.
|
|
286
|
+
* @param {string} id @param {any} body
|
|
287
|
+
*/
|
|
288
|
+
answer(id: string, body: any): {
|
|
268
289
|
status: number;
|
|
269
|
-
body:
|
|
270
|
-
ok: boolean;
|
|
271
|
-
draftId: string;
|
|
272
|
-
n: number;
|
|
273
|
-
refused?: undefined;
|
|
274
|
-
say?: undefined;
|
|
275
|
-
};
|
|
290
|
+
body: any;
|
|
276
291
|
};
|
|
277
292
|
/**
|
|
278
293
|
* `GET /api/author/live`: the newest draft that is not abandoned or signed, and the newest panel start the human has not cleared
|
|
@@ -331,5 +346,5 @@ export function createAuthor(opts: {
|
|
|
331
346
|
};
|
|
332
347
|
}>;
|
|
333
348
|
};
|
|
334
|
-
/** Up to 2
|
|
335
|
-
export const
|
|
349
|
+
/** Up to 2 revises per draft (amendment 14 item 3); a revise is used once its `draft-<n>/` exists (a refusal at $0 makes none). */
|
|
350
|
+
export const MAX_REVISES: 2;
|
|
@@ -20,6 +20,28 @@ export function parseJobBox(text: string): {
|
|
|
20
20
|
say: string;
|
|
21
21
|
}[];
|
|
22
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* M4e amendment 24 item 3: the submitted job box with each answer added WORD FOR WORD as a `~` line under the job line it is about, after
|
|
25
|
+
* that line's own `~` lines (several answers for one line keep their order). The job box's own lines are untouched; the card -> prose path
|
|
26
|
+
* (`cardToProse`) then writes the answer as that line's guardrail, so it reaches the signed text and the hash. Pure. An answer for a line
|
|
27
|
+
* the box does not have is NOT added (the caller sees the count).
|
|
28
|
+
* @param {string} job @param {{ line: number, answer: string }[]} answers
|
|
29
|
+
* @returns {{ job: string, added: number }}
|
|
30
|
+
*/
|
|
31
|
+
export function appendAnswersToJob(job: string, answers: {
|
|
32
|
+
line: number;
|
|
33
|
+
answer: string;
|
|
34
|
+
}[]): {
|
|
35
|
+
job: string;
|
|
36
|
+
added: number;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* THE one place a step's `~` lines become its guardrail: several `~` lines under one step are ONE continuous guardrail (hamr ruling 2026-10-09),
|
|
40
|
+
* each part verbatim (trimmed), in typed order, joined by "; ". An answer (am24) is one more `~` line, so it joins here too. The signed-text parser
|
|
41
|
+
* stays strict 1-for-1 because the job file never carries more than one `guardrail:` per line.
|
|
42
|
+
* @param {string[]} parts
|
|
43
|
+
*/
|
|
44
|
+
export function joinGuardrails(parts: string[]): string;
|
|
23
45
|
/** The job file lines (`N. text`, ` guardrail: text`, `N. ask <wait>: question`) for parsed steps; the wait is ALWAYS written out. @param {ReturnType<typeof parseJobBox>['steps']} steps @param {string} askWait */
|
|
24
46
|
export function jobFileLines(steps: ReturnType<typeof parseJobBox>["steps"], askWait: string): string[];
|
|
25
47
|
/**
|
|
@@ -40,6 +62,10 @@ export function parseInputLines(text: string): {
|
|
|
40
62
|
* @param {any} body
|
|
41
63
|
*/
|
|
42
64
|
export function cardFields(body: any): {
|
|
65
|
+
editOf?: {
|
|
66
|
+
flow: any;
|
|
67
|
+
flowHash: any;
|
|
68
|
+
} | undefined;
|
|
43
69
|
flowName: string;
|
|
44
70
|
job: string;
|
|
45
71
|
destination: string;
|
|
@@ -59,6 +85,34 @@ export function runInputRows(v: any): {
|
|
|
59
85
|
* @returns {string}
|
|
60
86
|
*/
|
|
61
87
|
export function cardToProse(card: ReturnType<typeof cardFields>): string;
|
|
88
|
+
/**
|
|
89
|
+
* M6: a signed job turned back into the card's fields (the job box, inputs box, destination, cap, ask wait), from `parseSignedText`'s `lines` and
|
|
90
|
+
* `arbiter`. The ONE rule of fidelity is mechanical: the card is offered only if writing it again (`cardToProse` -> `parseSignedText`) gives back the
|
|
91
|
+
* SAME lines and the SAME arbiter (an old unsigned `ask:` wait is the one thing allowed to differ: it comes back signed at its 30m). A setting the
|
|
92
|
+
* card has no box for (a redo cap, a second send, a send off the last line, a wait in seconds) makes the answer `{ok:false, say}`; nothing is dropped.
|
|
93
|
+
* @param {{ lines: {n: number, text: string, guardrail: string}[], arbiter: any }} signed
|
|
94
|
+
* @returns {{ ok: true, card: { job: string, inputs: string, destination: string, capUsd: string, askWait: string } } | { ok: false, say: string }}
|
|
95
|
+
*/
|
|
96
|
+
export function cardFromSigned({ lines, arbiter }: {
|
|
97
|
+
lines: {
|
|
98
|
+
n: number;
|
|
99
|
+
text: string;
|
|
100
|
+
guardrail: string;
|
|
101
|
+
}[];
|
|
102
|
+
arbiter: any;
|
|
103
|
+
}): {
|
|
104
|
+
ok: true;
|
|
105
|
+
card: {
|
|
106
|
+
job: string;
|
|
107
|
+
inputs: string;
|
|
108
|
+
destination: string;
|
|
109
|
+
capUsd: string;
|
|
110
|
+
askWait: string;
|
|
111
|
+
};
|
|
112
|
+
} | {
|
|
113
|
+
ok: false;
|
|
114
|
+
say: string;
|
|
115
|
+
};
|
|
62
116
|
/**
|
|
63
117
|
* The $0 check of the input rows, shared by the card (draft door) and the Run-a-signed-flow door: a role and a path on every row,
|
|
64
118
|
* a role shape the signed-text parser accepts and used once, each path a full path to a readable regular file (realpath at the
|
|
@@ -29,6 +29,8 @@ export function createFlowsDoor(opts: {
|
|
|
29
29
|
starter: ReturnType<typeof import("./authorstart.js").createStarter>;
|
|
30
30
|
monthlyClaim: (usd: number) => any;
|
|
31
31
|
}): {
|
|
32
|
+
/** M6 amendments 1 and 3: the sentence that says why this flow cannot be edited now, or null (the sign route's check). @param {string} name */
|
|
33
|
+
editBlock(name: string): string | null;
|
|
32
34
|
/** `GET /api/author/flows`. */
|
|
33
35
|
flows(): {
|
|
34
36
|
status: number;
|
|
@@ -42,6 +44,23 @@ export function createFlowsDoor(opts: {
|
|
|
42
44
|
body: {
|
|
43
45
|
ok: boolean;
|
|
44
46
|
flows: {
|
|
47
|
+
edit: {
|
|
48
|
+
ok: boolean;
|
|
49
|
+
say: string;
|
|
50
|
+
card?: undefined;
|
|
51
|
+
flowHash?: undefined;
|
|
52
|
+
} | {
|
|
53
|
+
ok: boolean;
|
|
54
|
+
card: {
|
|
55
|
+
job: string;
|
|
56
|
+
inputs: string;
|
|
57
|
+
destination: string;
|
|
58
|
+
capUsd: string;
|
|
59
|
+
askWait: string;
|
|
60
|
+
};
|
|
61
|
+
flowHash: any;
|
|
62
|
+
say?: undefined;
|
|
63
|
+
};
|
|
45
64
|
values: {
|
|
46
65
|
capUsd: number;
|
|
47
66
|
destination: string | null;
|
|
@@ -107,6 +126,23 @@ export function createFlowsDoor(opts: {
|
|
|
107
126
|
body: {
|
|
108
127
|
ok: boolean;
|
|
109
128
|
flow: {
|
|
129
|
+
edit: {
|
|
130
|
+
ok: boolean;
|
|
131
|
+
say: string;
|
|
132
|
+
card?: undefined;
|
|
133
|
+
flowHash?: undefined;
|
|
134
|
+
} | {
|
|
135
|
+
ok: boolean;
|
|
136
|
+
card: {
|
|
137
|
+
job: string;
|
|
138
|
+
inputs: string;
|
|
139
|
+
destination: string;
|
|
140
|
+
capUsd: string;
|
|
141
|
+
askWait: string;
|
|
142
|
+
};
|
|
143
|
+
flowHash: any;
|
|
144
|
+
say?: undefined;
|
|
145
|
+
};
|
|
110
146
|
values: {
|
|
111
147
|
capUsd: number;
|
|
112
148
|
destination: string | null;
|
|
@@ -173,3 +209,6 @@ export function createFlowsDoor(opts: {
|
|
|
173
209
|
body: any;
|
|
174
210
|
};
|
|
175
211
|
};
|
|
212
|
+
export function editBlockedSay(runId: string): string;
|
|
213
|
+
/** M6 amendment 3: the sentence for a job with a start still alive (its start folder in phase `starting`). */
|
|
214
|
+
export const EDIT_STARTING_SAY: "a run is starting";
|
|
@@ -14,6 +14,7 @@ export function createStarter(opts: {
|
|
|
14
14
|
runDir: string;
|
|
15
15
|
say?: undefined;
|
|
16
16
|
};
|
|
17
|
+
startingFor: (flow: string, keys: string[]) => string | null;
|
|
17
18
|
/**
|
|
18
19
|
* Start `fwdloop run` for a flow whose every $0 check already passed at the calling door. Re-checks the run id here (nothing
|
|
19
20
|
* awaits between this check and the spawn). 202 { startId, runId } or a refusal; a refusal creates nothing.
|
package/types/panel/data.d.ts
CHANGED
|
@@ -175,10 +175,10 @@ export function glyphPulses(g: {
|
|
|
175
175
|
* A saved answer with a live process is `[▶]` working on your answer.
|
|
176
176
|
* - `[?]` crashed after taking your answer (amendment 2 (f)) — the answer was
|
|
177
177
|
* consumed, the process is gone, no end row: cannot be carried on.
|
|
178
|
-
* @param {{historyRow: any, askJson: any, consumedAnswerExists: boolean, hasStateJson: boolean, resume?: any, liveness?: 'running'|'gone'|'unknown', booksFresh?: boolean, lock?: string, resumable?: boolean}} ctx
|
|
178
|
+
* @param {{historyRow: any, askJson: any, consumedAnswerExists: boolean, hasStateJson: boolean, resume?: any, liveness?: 'running'|'gone'|'unknown', booksFresh?: boolean, lock?: string, resumable?: boolean, stoppedAtAsk?: string|null, jobEdited?: boolean}} ctx
|
|
179
179
|
* @returns {{glyph: '[✓]'|'[✗]'|'[·]'|'[!]'|'[▶]'|'[?]'|'[II]'|'[■]', label: string}}
|
|
180
180
|
*/
|
|
181
|
-
export function computeGlyph({ historyRow, askJson, consumedAnswerExists, hasStateJson, resume, liveness, booksFresh, lock, resumable, }: {
|
|
181
|
+
export function computeGlyph({ historyRow, askJson, consumedAnswerExists, hasStateJson, resume, liveness, booksFresh, lock, resumable, stoppedAtAsk, jobEdited, }: {
|
|
182
182
|
historyRow: any;
|
|
183
183
|
askJson: any;
|
|
184
184
|
consumedAnswerExists: boolean;
|
|
@@ -188,6 +188,8 @@ export function computeGlyph({ historyRow, askJson, consumedAnswerExists, hasSta
|
|
|
188
188
|
booksFresh?: boolean;
|
|
189
189
|
lock?: string;
|
|
190
190
|
resumable?: boolean;
|
|
191
|
+
stoppedAtAsk?: string | null;
|
|
192
|
+
jobEdited?: boolean;
|
|
191
193
|
}): {
|
|
192
194
|
glyph: "[\u2713]" | "[\u2717]" | "[\u00B7]" | "[!]" | "[\u25B6]" | "[?]" | "[II]" | "[\u25A0]";
|
|
193
195
|
label: string;
|
|
@@ -483,7 +485,7 @@ export function getRunDetail({ root, flow, runId, catalogue, resumeAttempt, }: {
|
|
|
483
485
|
* What the Draft adds up to, ONE place (the Map box, the first step card and the Audit group all read it, so the three can never disagree).
|
|
484
486
|
* M4e amendment 9: `timeMs` is the card row's `at` to the sign row's `at` (the whole drafting, human time included), `null` when either has no
|
|
485
487
|
* usable `at`; never a sum of the model rows' `wallMs`. `calls` sums the rows' `calls`, a row with none counts 1 and sets `callsAtLeast`, so an
|
|
486
|
-
* unknown never shows as a smaller exact number; no model rows = `null`. `humanChecks` = the note rows + the sign row + the run's signed-values
|
|
488
|
+
* unknown never shows as a smaller exact number; no model rows = `null`. `humanChecks` = the note rows + the revise rows (each is the card the human edited and sent) + the sign row + the run's signed-values
|
|
487
489
|
* rows (the card is not a check), given by the caller as `ctx.humanChecks`. Money follows `costDisplay` ("at least $X" for a floor).
|
|
488
490
|
* @param {any[]} modelRows the draft and change rows (`kind` draft | change) of `setup.jsonl`
|
|
489
491
|
* @param {{cardAt?: any, signAt?: any, humanChecks?: number|null}} [ctx]
|
|
@@ -549,55 +551,6 @@ export function getRunAudit({ root, flow, runId }: {
|
|
|
549
551
|
empty: boolean;
|
|
550
552
|
why: string | null;
|
|
551
553
|
} | null;
|
|
552
|
-
/**
|
|
553
|
-
* `GET /api/runs/:flow/:runId/job` — the Job tab (M4a scope item 2): the
|
|
554
|
-
* signed prose, the arbiter block (cap, asks with TTL, redo cap, sends,
|
|
555
|
-
* sources), and the signature (who, when, hash). Derived purely from the
|
|
556
|
-
* flow's own signed files (`readFlow`) — fwdloop always has exactly one
|
|
557
|
-
* signed `declaration.json` + `signature.json` per flow, so there is no
|
|
558
|
-
* multi-source provenance chain to resolve (unlike bareloop's `getRunJob` —
|
|
559
|
-
* DROPPED per the fit-check). `runId` is only used to confirm the run
|
|
560
|
-
* exists at all; `null` when it doesn't (404).
|
|
561
|
-
* @param {{root: string, flow: string, runId: string, catalogue: any}} opts
|
|
562
|
-
* @returns {any|null}
|
|
563
|
-
*/
|
|
564
|
-
/**
|
|
565
|
-
* hamr's 2026-09-27 exit-check review #5: one plain-words sentence for a
|
|
566
|
-
* declared step's own close rule — the Job tab's "Success" field. Derived
|
|
567
|
-
* STRICTLY from `step.close` (and, for the "your accept" wording, whether
|
|
568
|
-
* this step is the one line `arbiter.asks[]` itself binds to) — never a
|
|
569
|
-
* fabricated cite/shape value:
|
|
570
|
-
* - `hitl`: "human check", or "human check (your accept)" when this step's
|
|
571
|
-
* own `fromLine` is a signed ask line (the ask step itself — the one a
|
|
572
|
-
* human pauses a run on, distinct from an ordinary hitl pass-through
|
|
573
|
-
* step with no ask binding).
|
|
574
|
-
* - `softgreen`: "shape: N headings (a / b / c)" when `close.shape.sections`
|
|
575
|
-
* is signed, "max W words" appended when `close.shape.maxWords` is
|
|
576
|
-
* signed, "blocks of L lines" / "must carry: a, b" for the invoice-block
|
|
577
|
-
* shape keys (`linesPerInvoice`/`mustCarry`) — every signed shape key
|
|
578
|
-
* shown, nothing invented; "shape (no shape rules signed)" when a
|
|
579
|
-
* softgreen step signs no `close.shape` at all (declaration.js allows
|
|
580
|
-
* this — an empty/absent shape is not itself a red).
|
|
581
|
-
* - `green`: "cited" — `CLOSE_ALLOWED` (`src/declaration.js`) never lets a
|
|
582
|
-
* step declare WHAT it cites ahead of time (that's the drafted
|
|
583
|
-
* artifact's own per-run field data, not signed prose), so there is
|
|
584
|
-
* never anything honest to append here.
|
|
585
|
-
* - anything else: the raw class name, named as unknown, never silently
|
|
586
|
-
* dropped or guessed into one of the three above; no class at all names
|
|
587
|
-
* that plainly too.
|
|
588
|
-
* @param {{close?: {class?: string, shape?: any}, fromLine?: number|null}} step one `declaration.steps` entry
|
|
589
|
-
* @param {Array<{line:number}>} arbiterAsks `arbiter.asks`, for the "your accept" check
|
|
590
|
-
* @returns {string}
|
|
591
|
-
*/
|
|
592
|
-
export function deriveStepSuccessText(step: {
|
|
593
|
-
close?: {
|
|
594
|
-
class?: string;
|
|
595
|
-
shape?: any;
|
|
596
|
-
};
|
|
597
|
-
fromLine?: number | null;
|
|
598
|
-
}, arbiterAsks: Array<{
|
|
599
|
-
line: number;
|
|
600
|
-
}>): string;
|
|
601
554
|
/**
|
|
602
555
|
* `GET /api/runs/:flow/:runId/job` — the Job tab (hamr's 2026-09-27
|
|
603
556
|
* exit-check review #5: bareloop-style one-field-per-piece layout,
|
|
@@ -606,8 +559,7 @@ export function deriveStepSuccessText(step: {
|
|
|
606
559
|
* signature.json/prose lines — nothing invented; a piece the books can't
|
|
607
560
|
* name carries its own why, never a blank or a guess. Field order (server
|
|
608
561
|
* order matches the page's own render order): prose, asks, model, cap
|
|
609
|
-
* (+redo cap), sources, sends, guardrails,
|
|
610
|
-
* `deriveStepSuccessText`), signature.
|
|
562
|
+
* (+redo cap), sources, sends, guardrails, plan (one row per step, amendment 34), signature.
|
|
611
563
|
* @param {{root: string, flow: string, runId: string, catalogue: any}} opts
|
|
612
564
|
* @returns {any|null}
|
|
613
565
|
*/
|
|
@@ -704,12 +656,13 @@ export function getRunAsks({ root, flow, runId, catalogue, resumeAttempt, }: {
|
|
|
704
656
|
* force-`false` here as a second, independent check (belt-and-braces on the
|
|
705
657
|
* one thing the brief calls out by name: "the Inbox tab's open count counts
|
|
706
658
|
* only truly open asks — parked run, no history row, unexpired, unanswered").
|
|
707
|
-
* @param {{root: string, resumeAttempt?: (flow: string, runId: string) => any}} opts
|
|
659
|
+
* @param {{root: string, resumeAttempt?: (flow: string, runId: string) => any, catalogue?: any}} opts
|
|
708
660
|
* @returns {any[]}
|
|
709
661
|
*/
|
|
710
|
-
export function listStops({ root, resumeAttempt }: {
|
|
662
|
+
export function listStops({ root, resumeAttempt, catalogue }: {
|
|
711
663
|
root: string;
|
|
712
664
|
resumeAttempt?: (flow: string, runId: string) => any;
|
|
665
|
+
catalogue?: any;
|
|
713
666
|
}): any[];
|
|
714
667
|
/**
|
|
715
668
|
* The ONE ordering of the Inbox (M4c item 4, hamr 2026-09-30); the page renders
|
|
@@ -763,3 +716,5 @@ export const STUCK_REASONS: {
|
|
|
763
716
|
};
|
|
764
717
|
/** The words the Draft says for a flow with no `setup.jsonl` (M4e amendment 6 item 4; renamed Draft by amendment 7 item 2). */
|
|
765
718
|
export const NO_DRAFT_WORDS: "no draft record";
|
|
719
|
+
/** M6: what the Job tab says for a run that started before runs kept a copy of their job. */
|
|
720
|
+
export const NO_JOB_COPY_WORDS: "This run started before runs kept a copy of their job, so this shows the job as it is now.";
|
package/types/runner.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
/** The panel's one write of a stop request. `'exists'` = already asked, nothing more to do. @param {string} runDir */
|
|
2
2
|
export function requestStop(runDir: string): "written" | "exists";
|
|
3
|
-
/**
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* The ONE reader of the stop request: `{at}` (when it was asked) or `null` when none is pending. Amendment 16 C11 / amendment 17 2A: a
|
|
5
|
+
* time that is not a real date (a non-date string, a number, a missing or empty time, a torn file) is treated as made "now" (`now`,
|
|
6
|
+
* when given), one rule for all, so the stop completes with every record and the ask is never lost. Without `now` (a pending check)
|
|
7
|
+
* such a request reads `{at:null}`.
|
|
8
|
+
* @param {string} runDir @param {() => string} [now]
|
|
9
|
+
*/
|
|
10
|
+
export function readStopRequest(runDir: string, now?: () => string): {
|
|
5
11
|
at: string | null;
|
|
6
12
|
} | null;
|
|
7
13
|
/** Is a stop pending for this run? (read-only) @param {string} runDir */
|
|
@@ -240,8 +246,9 @@ export function makeParkingAskStep(): (opts?: any) => Promise<{
|
|
|
240
246
|
* @param {string} opts.businessDate
|
|
241
247
|
* @param {number} [opts.ceilingUsd]
|
|
242
248
|
* @param {() => number} [opts.nowMs] - F45 finding 3; see `runFlow`'s own.
|
|
249
|
+
* @param {(newRunDir:string) => void} [opts.onRerunStart] - amendment 16 C2: called with the new run's folder just before a `rerun` starts it.
|
|
243
250
|
*/
|
|
244
|
-
export function resumeRun({ root, name, runId, catalogue, modelStep, sendStep, primitives, primitiveReds, clock, businessDate, ceilingUsd, nowMs, }: {
|
|
251
|
+
export function resumeRun({ root, name, runId, catalogue, modelStep, sendStep, primitives, primitiveReds, clock, businessDate, ceilingUsd, nowMs, onRerunStart, }: {
|
|
245
252
|
root: string;
|
|
246
253
|
name: string;
|
|
247
254
|
runId: string;
|
|
@@ -260,6 +267,7 @@ export function resumeRun({ root, name, runId, catalogue, modelStep, sendStep, p
|
|
|
260
267
|
businessDate: string;
|
|
261
268
|
ceilingUsd?: number | undefined;
|
|
262
269
|
nowMs?: (() => number) | undefined;
|
|
270
|
+
onRerunStart?: ((newRunDir: string) => void) | undefined;
|
|
263
271
|
}): Promise<any>;
|
|
264
272
|
/**
|
|
265
273
|
* What a run has spent so far, from its own books (audit.jsonl is the source of truth): the sum of every priced row (a cap-halt
|
package/types/setup.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The rows of a draft's record, oldest first. `sessionDir` is the panel's draft folder (card.json, draft/,
|
|
2
|
+
* The rows of a draft's record, oldest first. `sessionDir` is the panel's draft folder (card.json, draft/, card-<n>.json, draft-<n>/); a CLI
|
|
3
3
|
* draft has none, so its record is its one plan folder (`planDir`, read as `draft`) plus the sign.
|
|
4
4
|
* @param {{ sessionDir?: string, planDir: string, hash: string, signedBy: string, signedAt: string, flowHash?: string }} a
|
|
5
5
|
*/
|
|
@@ -28,19 +28,10 @@ export function buildSetupRows({ sessionDir, planDir, hash, signedBy, signedAt,
|
|
|
28
28
|
n: number;
|
|
29
29
|
at: string | null;
|
|
30
30
|
card: any;
|
|
31
|
-
text?: undefined;
|
|
32
|
-
signedBy?: undefined;
|
|
33
|
-
hash?: undefined;
|
|
34
|
-
flowHash?: undefined;
|
|
35
|
-
} | {
|
|
36
|
-
kind: string;
|
|
37
|
-
n: number;
|
|
38
|
-
at: string | null;
|
|
39
|
-
text: string;
|
|
40
|
-
card?: undefined;
|
|
41
31
|
signedBy?: undefined;
|
|
42
32
|
hash?: undefined;
|
|
43
33
|
flowHash?: undefined;
|
|
34
|
+
notChecked?: undefined;
|
|
44
35
|
} | {
|
|
45
36
|
kind: string;
|
|
46
37
|
n: number;
|
|
@@ -48,8 +39,11 @@ export function buildSetupRows({ sessionDir, planDir, hash, signedBy, signedAt,
|
|
|
48
39
|
signedBy: string;
|
|
49
40
|
hash: string;
|
|
50
41
|
flowHash: string | null;
|
|
42
|
+
notChecked: {
|
|
43
|
+
label: string;
|
|
44
|
+
items: any[];
|
|
45
|
+
};
|
|
51
46
|
card?: undefined;
|
|
52
|
-
text?: undefined;
|
|
53
47
|
})[];
|
|
54
48
|
/**
|
|
55
49
|
* Write `<flowDir>/setup.jsonl` ONCE ('wx': a second write is refused, never merged or replaced), mode 0600, every row scrubbed of the
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {{ oldProse: string, newProse: string, oldDecl: string, newDecl: string }} x the signed copy (old) and the files on disk (new)
|
|
3
|
+
* @returns {string[]} plain sentences; empty when nothing differs
|
|
4
|
+
*/
|
|
5
|
+
export function describeChange({ oldProse, newProse, oldDecl, newDecl }: {
|
|
6
|
+
oldProse: string;
|
|
7
|
+
newProse: string;
|
|
8
|
+
oldDecl: string;
|
|
9
|
+
newDecl: string;
|
|
10
|
+
}): string[];
|