fwdloop 0.14.0 → 0.16.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.
Files changed (58) hide show
  1. package/bin/fwdloop +106 -31
  2. package/package.json +2 -2
  3. package/src/authoring.js +26 -11
  4. package/src/checked.js +9 -5
  5. package/src/closers.js +5 -0
  6. package/src/config.js +66 -4
  7. package/src/declaration.js +27 -1
  8. package/src/draft-steps.js +79 -0
  9. package/src/drafter.js +54 -15
  10. package/src/flow.js +220 -5
  11. package/src/flowmodel.js +30 -0
  12. package/src/input-facts.js +12 -3
  13. package/src/keysfile.js +51 -16
  14. package/src/model-step.js +13 -11
  15. package/src/monthly.js +9 -1
  16. package/src/panel/author.js +89 -24
  17. package/src/panel/authorcard.js +80 -20
  18. package/src/panel/authorflows.js +72 -21
  19. package/src/panel/authorresume.js +11 -10
  20. package/src/panel/authorstart.js +29 -19
  21. package/src/panel/data.js +62 -21
  22. package/src/panel/index.html +662 -185
  23. package/src/panel/resume.js +3 -3
  24. package/src/panel/server.js +5 -4
  25. package/src/panel/settings.js +138 -80
  26. package/src/panel/spawn.js +15 -9
  27. package/src/provider.js +136 -178
  28. package/src/providershapes.js +7 -7
  29. package/src/runner.js +47 -23
  30. package/src/signed-diff.js +71 -0
  31. package/src/thinking.js +55 -0
  32. package/types/authoring.d.ts +20 -7
  33. package/types/checked.d.ts +6 -4
  34. package/types/closers.d.ts +2 -0
  35. package/types/config.d.ts +9 -1
  36. package/types/draft-steps.d.ts +14 -0
  37. package/types/drafter.d.ts +13 -10
  38. package/types/flow.d.ts +42 -2
  39. package/types/flowmodel.d.ts +16 -0
  40. package/types/input-facts.d.ts +6 -1
  41. package/types/keysfile.d.ts +23 -6
  42. package/types/model-step.d.ts +1 -1
  43. package/types/monthly.d.ts +1 -0
  44. package/types/panel/author.d.ts +78 -6
  45. package/types/panel/authorcard.d.ts +53 -8
  46. package/types/panel/authorflows.d.ts +68 -6
  47. package/types/panel/authorresume.d.ts +2 -1
  48. package/types/panel/authorstart.d.ts +17 -6
  49. package/types/panel/data.d.ts +10 -6
  50. package/types/panel/resume.d.ts +2 -1
  51. package/types/panel/server.d.ts +3 -1
  52. package/types/panel/settings.d.ts +3 -1
  53. package/types/panel/spawn.d.ts +13 -4
  54. package/types/provider.d.ts +94 -284
  55. package/types/providershapes.d.ts +3 -4
  56. package/types/runner.d.ts +2 -4
  57. package/types/signed-diff.d.ts +10 -0
  58. package/types/thinking.d.ts +25 -0
@@ -45,6 +45,7 @@ export function spendSummary(opts?: {
45
45
  };
46
46
  };
47
47
  };
48
+ byModel: Record<string, Record<string, number>>;
48
49
  undatedRows: number;
49
50
  preM4dRunsNotCounted: boolean;
50
51
  };
@@ -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, childRunning?: (dir: string) => boolean }} opts
2
+ * @param {{ root: string, home?: string, skipMonthly?: boolean, loadEnv: () => { ok: boolean, env: Record<string, string|undefined>, refusal: string|null, keyNames?: string[] }, bin?: string, childRunning?: (dir: string) => boolean, thinkingSupport?: typeof bareagentThinkingSupport }} 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
  */
@@ -11,9 +11,11 @@ export function createAuthor(opts: {
11
11
  ok: boolean;
12
12
  env: Record<string, string | undefined>;
13
13
  refusal: string | null;
14
+ keyNames?: string[];
14
15
  };
15
16
  bin?: string;
16
17
  childRunning?: (dir: string) => boolean;
18
+ thinkingSupport?: typeof bareagentThinkingSupport;
17
19
  }): {
18
20
  flows: () => {
19
21
  status: number;
@@ -27,6 +29,23 @@ export function createAuthor(opts: {
27
29
  body: {
28
30
  ok: boolean;
29
31
  flows: {
32
+ edit: {
33
+ ok: boolean;
34
+ say: string;
35
+ card?: undefined;
36
+ flowHash?: undefined;
37
+ } | {
38
+ ok: boolean;
39
+ card: {
40
+ job: string;
41
+ inputs: string;
42
+ destination: string;
43
+ capUsd: string;
44
+ askWait: string;
45
+ };
46
+ flowHash: any;
47
+ say?: undefined;
48
+ };
30
49
  values: {
31
50
  capUsd: number;
32
51
  destination: string | null;
@@ -34,8 +53,13 @@ export function createAuthor(opts: {
34
53
  };
35
54
  jobLines: any;
36
55
  hasSend: boolean;
37
- capFloorUsd: any;
56
+ capFloorUsd: number;
38
57
  floorText: string;
58
+ model: {
59
+ slot: string;
60
+ model: string;
61
+ label: string;
62
+ } | null;
39
63
  flow: string;
40
64
  capUsd: any;
41
65
  roles: any;
@@ -86,6 +110,23 @@ export function createAuthor(opts: {
86
110
  body: {
87
111
  ok: boolean;
88
112
  flow: {
113
+ edit: {
114
+ ok: boolean;
115
+ say: string;
116
+ card?: undefined;
117
+ flowHash?: undefined;
118
+ } | {
119
+ ok: boolean;
120
+ card: {
121
+ job: string;
122
+ inputs: string;
123
+ destination: string;
124
+ capUsd: string;
125
+ askWait: string;
126
+ };
127
+ flowHash: any;
128
+ say?: undefined;
129
+ };
89
130
  values: {
90
131
  capUsd: number;
91
132
  destination: string | null;
@@ -93,8 +134,13 @@ export function createAuthor(opts: {
93
134
  };
94
135
  jobLines: any;
95
136
  hasSend: boolean;
96
- capFloorUsd: any;
137
+ capFloorUsd: number;
97
138
  floorText: string;
139
+ model: {
140
+ slot: string;
141
+ model: string;
142
+ label: string;
143
+ } | null;
98
144
  flow: string;
99
145
  capUsd: any;
100
146
  roles: any;
@@ -149,18 +195,43 @@ export function createAuthor(opts: {
149
195
  * `GET /api/author/monthly-check?cap=<usd>`: the note under Cap, one read-only check. `{ text, red }` is what to show (red =
150
196
  * the cap does not fit this month); `floorUsd` is the smallest cap that funds one round of a model step, for the page's
151
197
  * `needs at least $X per run` line. A cap that is not a number above 0 gets no note. Never spends, never writes.
152
- * @param {unknown} cap @param {string|null} [spent] what a resumed run has already spent (amendment 4 item 4)
198
+ * @param {unknown} cap @param {string|null} [spent] what a resumed run has already spent (amendment 4 item 4) @param {{ provider?: string, model?: string, flow?: string }|null} [pick] the card's picked model, or (a Resume) the flow whose recorded model it is: its own prices are the floor (M4d am6)
153
199
  */
154
- monthlyCheck(cap: unknown, spent?: string | null): {
200
+ monthlyCheck(cap: unknown, spent?: string | null, pick?: {
201
+ provider?: string;
202
+ model?: string;
203
+ flow?: string;
204
+ } | null): {
155
205
  status: number;
156
206
  body: {
157
207
  ok: boolean;
158
208
  text: string;
159
209
  red: boolean;
160
- floorUsd: any;
210
+ floorUsd: number;
161
211
  floorText: string;
162
212
  };
163
213
  };
214
+ /**
215
+ * `GET /api/author/models` (M4d amendment 6 item 6): what Chat's Model menu offers - every ticked, priced line of a provider whose key is set up, as
216
+ * "provider · model" - and, per line, whether "Thinking on" can change (`canChange`; bareagent's answer through `src/thinking.js`, am7). Read-only.
217
+ */
218
+ models(): {
219
+ status: number;
220
+ body: {
221
+ ok: boolean;
222
+ lines: {
223
+ thinking: {
224
+ support: boolean | "unverified";
225
+ canChange: boolean;
226
+ say: string;
227
+ };
228
+ slot: string;
229
+ model: string;
230
+ label: string;
231
+ }[];
232
+ say: string;
233
+ };
234
+ };
164
235
  /** `GET /api/author/start/:startId`: the start's phase, read from its files. @param {string} id */
165
236
  startGet(id: string): {
166
237
  status: number;
@@ -314,3 +385,4 @@ export function createAuthor(opts: {
314
385
  };
315
386
  /** 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). */
316
387
  export const MAX_REVISES: 2;
388
+ import { thinkingSupport as bareagentThinkingSupport } from '../thinking.js';
@@ -62,6 +62,13 @@ export function parseInputLines(text: string): {
62
62
  * @param {any} body
63
63
  */
64
64
  export function cardFields(body: any): {
65
+ editOf?: {
66
+ flow: any;
67
+ flowHash: any;
68
+ } | undefined;
69
+ thinking?: boolean | undefined;
70
+ provider?: string | undefined;
71
+ model?: string | undefined;
65
72
  flowName: string;
66
73
  job: string;
67
74
  destination: string;
@@ -81,6 +88,34 @@ export function runInputRows(v: any): {
81
88
  * @returns {string}
82
89
  */
83
90
  export function cardToProse(card: ReturnType<typeof cardFields>): string;
91
+ /**
92
+ * 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
93
+ * `arbiter`. The ONE rule of fidelity is mechanical: the card is offered only if writing it again (`cardToProse` -> `parseSignedText`) gives back the
94
+ * 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
95
+ * 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.
96
+ * @param {{ lines: {n: number, text: string, guardrail: string}[], arbiter: any }} signed
97
+ * @returns {{ ok: true, card: { job: string, inputs: string, destination: string, capUsd: string, askWait: string } } | { ok: false, say: string }}
98
+ */
99
+ export function cardFromSigned({ lines, arbiter }: {
100
+ lines: {
101
+ n: number;
102
+ text: string;
103
+ guardrail: string;
104
+ }[];
105
+ arbiter: any;
106
+ }): {
107
+ ok: true;
108
+ card: {
109
+ job: string;
110
+ inputs: string;
111
+ destination: string;
112
+ capUsd: string;
113
+ askWait: string;
114
+ };
115
+ } | {
116
+ ok: false;
117
+ say: string;
118
+ };
84
119
  /**
85
120
  * 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,
86
121
  * a role shape the signed-text parser accepts and used once, each path a full path to a readable regular file (realpath at the
@@ -101,13 +136,22 @@ export function checkInputRows(rows: {
101
136
  /**
102
137
  * M4e amendment 4 item 2: the smallest per-run cap that funds ONE round of the first model step. The runner halts a step when
103
138
  * `spent + ceiling > cap` (`runStepRalph`), and every ordinary (non-ask) step is a model step, so the floor is the runner's own
104
- * per-round ceiling (`resolveCeilingUsd`) as soon as the job has one such line; a job of only asks spends nothing before its stop.
139
+ * per-round hold (the picked model's own Settings prices times the token bounds) as soon as the job has one such line; a job of only asks spends nothing before its stop.
105
140
  * ONE function: the card's Draft check, Sign, and the page's note all read it. Returns 0 when no step needs a round.
106
- * @param {string} jobText
141
+ * @param {string} jobText @param {string} [home] the config home the panel reads Settings from (default: the process door)
142
+ * @param {{ slot?: string, provider?: string, model?: string }|null} [pick] the job's picked model (M4d amendment 6): its own Settings prices are the hold (a card names its key as `provider`)
107
143
  */
108
- export function capFloorUsd(jobText: string): any;
109
- /** The floor itself, for a caller that already knows whether the job has a step that is not an ask (a signed flow: any step off an ask line). @param {boolean} hasRoundStep */
110
- export function capFloorFor(hasRoundStep: boolean): any;
144
+ export function capFloorUsd(jobText: string, home?: string, pick?: {
145
+ slot?: string;
146
+ provider?: string;
147
+ model?: string;
148
+ } | null): number;
149
+ /** The floor itself, for a caller that already knows whether the job has a step that is not an ask (a signed flow: any step off an ask line). @param {boolean} hasRoundStep @param {string} [home] @param {{ slot?: string, provider?: string, model?: string }|null} [pick] */
150
+ export function capFloorFor(hasRoundStep: boolean, home?: string, pick?: {
151
+ slot?: string;
152
+ provider?: string;
153
+ model?: string;
154
+ } | null): number;
111
155
  /** The one sentence for a cap under the floor (red under Cap, and the Draft / sign refusal). @param {number} floorUsd */
112
156
  export function capFloorText(floorUsd: number): string;
113
157
  /**
@@ -121,12 +165,13 @@ export function destinationRefusal(dest: string, root: string): string | null;
121
165
  /**
122
166
  * Every $0 check on the card, before any spawn (scope 6). Collects all refusals so the page can name every box.
123
167
  * @param {ReturnType<typeof cardFields>} card
124
- * @param {{ root: string, env?: Record<string, string|undefined> }} ctx `env` = the merged keys env: a key value typed into any box is refused
168
+ * @param {{ root: string, keys?: string[], home?: string }} ctx `keys` = the provider key values (the keys load's scrub list): a key value typed into any box is refused; `home` = the config home Settings is read from (the cap floor)
125
169
  * @returns {{ ok: true, prose: string }|{ ok: false, refusals: {field: string, say: string}[] }}
126
170
  */
127
- export function checkCard(card: ReturnType<typeof cardFields>, { root, env }: {
171
+ export function checkCard(card: ReturnType<typeof cardFields>, { root, keys, home }: {
128
172
  root: string;
129
- env?: Record<string, string | undefined>;
173
+ keys?: string[];
174
+ home?: string;
130
175
  }): {
131
176
  ok: true;
132
177
  prose: string;
@@ -1,9 +1,13 @@
1
1
  /**
2
2
  * What the Run / Resume forms show of a signed flow (read from its own files, never from a model): the job lines as the signed text has them
3
3
  * (an ask line carries its question and its wait), the values the open boxes start from, and the cap floor. Amendment 5 item 2: all the rest is dimmed.
4
- * @param {any} read `readFlow`'s ok result
4
+ * @param {any} read `readFlow`'s ok result @param {string} [home] the config home Settings is read from @param {string} [flowDir] the signed flow's folder: the model recorded beside it is the one it runs with (M4d amendment 6)
5
+ * @param {{ slot: string, model: string }|null} [picked] a flow with no record runs with the model picked in Chat (M4d amendment 7b): its price is the cap floor
5
6
  */
6
- export function formFacts(read: any): {
7
+ export function formFacts(read: any, home?: string, flowDir?: string, picked?: {
8
+ slot: string;
9
+ model: string;
10
+ } | null): {
7
11
  values: {
8
12
  capUsd: number;
9
13
  destination: string | null;
@@ -11,11 +15,16 @@ export function formFacts(read: any): {
11
15
  };
12
16
  jobLines: any;
13
17
  hasSend: boolean;
14
- capFloorUsd: any;
18
+ capFloorUsd: number;
15
19
  floorText: string;
20
+ model: {
21
+ slot: string;
22
+ model: string;
23
+ label: string;
24
+ } | null;
16
25
  };
17
26
  /**
18
- * @param {{ root: string, home?: string, skipMonthly?: boolean, loadEnv: () => { ok: boolean, env: Record<string, string|undefined>, refusal: string|null }, starter: ReturnType<typeof import('./authorstart.js').createStarter>, monthlyClaim: (usd: number) => any }} opts
27
+ * @param {{ root: string, home?: string, skipMonthly?: boolean, loadEnv: () => { ok: boolean, env: Record<string, string|undefined>, refusal: string|null }, starter: ReturnType<typeof import('./authorstart.js').createStarter>, monthlyClaim: (usd: number) => any, modelRefusal: (card: any, loaded: any) => { field: string, say: string }[] }} opts
19
28
  */
20
29
  export function createFlowsDoor(opts: {
21
30
  root: string;
@@ -28,7 +37,13 @@ export function createFlowsDoor(opts: {
28
37
  };
29
38
  starter: ReturnType<typeof import("./authorstart.js").createStarter>;
30
39
  monthlyClaim: (usd: number) => any;
40
+ modelRefusal: (card: any, loaded: any) => {
41
+ field: string;
42
+ say: string;
43
+ }[];
31
44
  }): {
45
+ /** 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 */
46
+ editBlock(name: string): string | null;
32
47
  /** `GET /api/author/flows`. */
33
48
  flows(): {
34
49
  status: number;
@@ -42,6 +57,23 @@ export function createFlowsDoor(opts: {
42
57
  body: {
43
58
  ok: boolean;
44
59
  flows: {
60
+ edit: {
61
+ ok: boolean;
62
+ say: string;
63
+ card?: undefined;
64
+ flowHash?: undefined;
65
+ } | {
66
+ ok: boolean;
67
+ card: {
68
+ job: string;
69
+ inputs: string;
70
+ destination: string;
71
+ capUsd: string;
72
+ askWait: string;
73
+ };
74
+ flowHash: any;
75
+ say?: undefined;
76
+ };
45
77
  values: {
46
78
  capUsd: number;
47
79
  destination: string | null;
@@ -49,8 +81,13 @@ export function createFlowsDoor(opts: {
49
81
  };
50
82
  jobLines: any;
51
83
  hasSend: boolean;
52
- capFloorUsd: any;
84
+ capFloorUsd: number;
53
85
  floorText: string;
86
+ model: {
87
+ slot: string;
88
+ model: string;
89
+ label: string;
90
+ } | null;
54
91
  flow: string;
55
92
  capUsd: any;
56
93
  roles: any;
@@ -107,6 +144,23 @@ export function createFlowsDoor(opts: {
107
144
  body: {
108
145
  ok: boolean;
109
146
  flow: {
147
+ edit: {
148
+ ok: boolean;
149
+ say: string;
150
+ card?: undefined;
151
+ flowHash?: undefined;
152
+ } | {
153
+ ok: boolean;
154
+ card: {
155
+ job: string;
156
+ inputs: string;
157
+ destination: string;
158
+ capUsd: string;
159
+ askWait: string;
160
+ };
161
+ flowHash: any;
162
+ say?: undefined;
163
+ };
110
164
  values: {
111
165
  capUsd: number;
112
166
  destination: string | null;
@@ -114,8 +168,13 @@ export function createFlowsDoor(opts: {
114
168
  };
115
169
  jobLines: any;
116
170
  hasSend: boolean;
117
- capFloorUsd: any;
171
+ capFloorUsd: number;
118
172
  floorText: string;
173
+ model: {
174
+ slot: string;
175
+ model: string;
176
+ label: string;
177
+ } | null;
119
178
  flow: string;
120
179
  capUsd: any;
121
180
  roles: any;
@@ -173,3 +232,6 @@ export function createFlowsDoor(opts: {
173
232
  body: any;
174
233
  };
175
234
  };
235
+ export function editBlockedSay(runId: string): string;
236
+ /** M6 amendment 3: the sentence for a job with a start still alive (its start folder in phase `starting`). */
237
+ export const EDIT_STARTING_SAY: "a run is starting";
@@ -1,8 +1,9 @@
1
1
  /**
2
- * @param {{ root: string, loadEnv: () => { ok: boolean, env: Record<string, string|undefined>, refusal: string|null }, monthlyClaim: (usd: number) => any, starter: ReturnType<typeof import('./authorstart.js').createStarter> }} opts
2
+ * @param {{ root: string, home?: string, loadEnv: () => { ok: boolean, env: Record<string, string|undefined>, refusal: string|null }, monthlyClaim: (usd: number) => any, starter: ReturnType<typeof import('./authorstart.js').createStarter> }} opts
3
3
  */
4
4
  export function createResumeDoor(opts: {
5
5
  root: string;
6
+ home?: string;
6
7
  loadEnv: () => {
7
8
  ok: boolean;
8
9
  env: Record<string, string | undefined>;
@@ -14,17 +14,18 @@ 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.
20
21
  * `runId` '' = no typed id: the start CLAIMS the next `run-<n>` itself (claimRunId, folder created exclusively; amendment 3).
21
22
  * `values` (M4e amendment 5 item 3): the human's signed values for THIS run (the page's second click), written once into the run's own
22
23
  * folder as `signed-values.json` BEFORE the spawn; the run then uses them (`pickRunValues`). None = the flow's own.
23
- * @param {{ kind: 'run'|'sign', flow: string, runId: string, sources: {role: string, path: string}[], values?: any }} a
24
- * @param {Record<string, string|undefined>} env the merged keys env: the child's env AND the scrub list
24
+ * @param {{ kind: 'run'|'sign', flow: string, runId: string, sources: {role: string, path: string}[], values?: any, pick?: {slot: string, model: string}|null }} a
25
+ * @param {{ env: Record<string, string|undefined>, keyNames?: string[] }} loaded the keys load: its env is the child's env AND (with its key names) the scrub list
25
26
  * @returns {{ status: number, body: any }}
26
27
  */
27
- start({ kind, flow, runId, sources, values, }: {
28
+ start({ kind, flow, runId, sources, values, pick, }: {
28
29
  kind: "run" | "sign";
29
30
  flow: string;
30
31
  runId: string;
@@ -33,7 +34,14 @@ export function createStarter(opts: {
33
34
  path: string;
34
35
  }[];
35
36
  values?: any;
36
- }, env: Record<string, string | undefined>): {
37
+ pick?: {
38
+ slot: string;
39
+ model: string;
40
+ } | null;
41
+ }, loaded: {
42
+ env: Record<string, string | undefined>;
43
+ keyNames?: string[];
44
+ }): {
37
45
  status: number;
38
46
  body: any;
39
47
  };
@@ -41,14 +49,17 @@ export function createStarter(opts: {
41
49
  * Start `fwdloop continue <runId>` (M4e amendment 4 item 4): Resume of a stopped or cap-halted run, after the door wrote the run's new
42
50
  * signed values version. The same detached-child shape as `start`; the start folder reads as `starting` until the child consumes
43
51
  * `halt.json`, then `started`; a child that died with `halt.json` still there is `refused` with its own sentence. One start at a time per flow.
44
- * @param {{ flow: string, runId: string, version: number }} a @param {Record<string, string|undefined>} env the merged keys env
52
+ * @param {{ flow: string, runId: string, version: number }} a @param {{ env: Record<string, string|undefined>, keyNames?: string[] }} loaded the keys load
45
53
  * @returns {{ status: number, body: any }}
46
54
  */
47
55
  startContinue({ flow, runId, version }: {
48
56
  flow: string;
49
57
  runId: string;
50
58
  version: number;
51
- }, env: Record<string, string | undefined>): {
59
+ }, loaded: {
60
+ env: Record<string, string | undefined>;
61
+ keyNames?: string[];
62
+ }): {
52
63
  status: number;
53
64
  body: any;
54
65
  };
@@ -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, stoppedAtAsk?: string|null}} 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, stoppedAtAsk, }: {
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;
@@ -189,6 +189,7 @@ export function computeGlyph({ historyRow, askJson, consumedAnswerExists, hasSta
189
189
  lock?: string;
190
190
  resumable?: boolean;
191
191
  stoppedAtAsk?: string | null;
192
+ jobEdited?: boolean;
192
193
  }): {
193
194
  glyph: "[\u2713]" | "[\u2717]" | "[\u00B7]" | "[!]" | "[\u25B6]" | "[?]" | "[II]" | "[\u25A0]";
194
195
  label: string;
@@ -223,8 +224,8 @@ export function costDisplay(spentUsd: number | null | undefined, spendComplete:
223
224
  * never a stale first-attempt value. `null` (never a guess) when no row in
224
225
  * this run ever named one (e.g. every step is `hitl`, no model step ran).
225
226
  * No provider/API-kind field exists in ANY book (`src/provider.js`'s
226
- * `PROVIDER_SLOTS` maps a slot name to a model, but nothing writes which
227
- * slot served a given run back to `audit.jsonl`/`spend.jsonl`) — provider is
227
+ * a provider row maps to a model, but nothing writes which
228
+ * row served a given run back to `audit.jsonl`/`spend.jsonl`) — provider is
228
229
  * never shown alongside it (hamr's own instruction: "if the provider isn't
229
230
  * in any book, show model only").
230
231
  * @param {any[]} auditRows
@@ -655,12 +656,13 @@ export function getRunAsks({ root, flow, runId, catalogue, resumeAttempt, }: {
655
656
  * force-`false` here as a second, independent check (belt-and-braces on the
656
657
  * one thing the brief calls out by name: "the Inbox tab's open count counts
657
658
  * only truly open asks — parked run, no history row, unexpired, unanswered").
658
- * @param {{root: string, resumeAttempt?: (flow: string, runId: string) => any}} opts
659
+ * @param {{root: string, resumeAttempt?: (flow: string, runId: string) => any, catalogue?: any}} opts
659
660
  * @returns {any[]}
660
661
  */
661
- export function listStops({ root, resumeAttempt }: {
662
+ export function listStops({ root, resumeAttempt, catalogue }: {
662
663
  root: string;
663
664
  resumeAttempt?: (flow: string, runId: string) => any;
665
+ catalogue?: any;
664
666
  }): any[];
665
667
  /**
666
668
  * The ONE ordering of the Inbox (M4c item 4, hamr 2026-09-30); the page renders
@@ -714,3 +716,5 @@ export const STUCK_REASONS: {
714
716
  };
715
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). */
716
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.";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @param {{ root: string, env?: Record<string, string|undefined>, loadEnv?: () => { ok: boolean, env: Record<string, string|undefined>, refusal: string|null }, bin?: string, logDir?: string,
2
+ * @param {{ root: string, env?: Record<string, string|undefined>, loadEnv?: () => { ok: boolean, env: Record<string, string|undefined>, refusal: string|null, keyNames?: string[] }, bin?: string, logDir?: string,
3
3
  * maxTries?: number, windowMs?: number, slotMs?: number }} opts
4
4
  * `loadEnv` (M4d: the keys-file door, called before EVERY spawn so editing the file needs no panel restart) returns the merged env
5
5
  * that is BOTH the child's spawn env AND its scrub list, or a refusal sentence that becomes the attempt's refusal (nothing spawns).
@@ -16,6 +16,7 @@ export function createResumer(opts: {
16
16
  ok: boolean;
17
17
  env: Record<string, string | undefined>;
18
18
  refusal: string | null;
19
+ keyNames?: string[];
19
20
  };
20
21
  bin?: string;
21
22
  logDir?: string;
@@ -19,7 +19,7 @@ export function handleRequest(req: import("node:http").IncomingMessage, res: imp
19
19
  * header). Resolves once actually listening; rejects on a bind error
20
20
  * (including `EADDRINUSE`) with a `.port` field on the error for the
21
21
  * caller's message.
22
- * @param {{ port?: number, root: string, settings?: { home?: string, env?: Record<string,string|undefined>, fetch?: typeof fetch, now?: () => number }, resume?: { env?: Record<string,string|undefined>, bin?: string, logDir?: string, maxTries?: number, windowMs?: number, slotMs?: number }, author?: { env?: Record<string,string|undefined>, loadEnv?: () => any, bin?: string } }} opts
22
+ * @param {{ port?: number, root: string, settings?: { home?: string, env?: Record<string,string|undefined>, fetch?: typeof fetch, now?: () => number, openFolderSpawn?: Function, platform?: string }, resume?: { env?: Record<string,string|undefined>, bin?: string, logDir?: string, maxTries?: number, windowMs?: number, slotMs?: number }, author?: { env?: Record<string,string|undefined>, loadEnv?: () => any, bin?: string } }} opts
23
23
  * `resume` and `author` are for tests only (a fake env/bin, a short retry window); the CLI passes none.
24
24
  * @returns {Promise<{ server: import('node:http').Server, port: number, close: () => Promise<void> }>}
25
25
  */
@@ -31,6 +31,8 @@ export function createPanelServer(opts: {
31
31
  env?: Record<string, string | undefined>;
32
32
  fetch?: typeof fetch;
33
33
  now?: () => number;
34
+ openFolderSpawn?: Function;
35
+ platform?: string;
34
36
  };
35
37
  resume?: {
36
38
  env?: Record<string, string | undefined>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @param {{ home?: string, skip?: boolean, env?: Record<string,string|undefined>, fetch?: typeof fetch, now?: () => number }} cfg
2
+ * @param {{ home?: string, skip?: boolean, env?: Record<string,string|undefined>, fetch?: typeof fetch, now?: () => number, openFolderSpawn?: Function, platform?: string }} cfg
3
3
  * `home` the config home (undefined = the real `~/.config/fwdloop`); `skip` true under a test process
4
4
  * with no `FWDLOOP_CONFIG_HOME` (Settings then touches nothing); `env` the shell side (tests only);
5
5
  * `fetch` and `now` are test seams.
@@ -10,6 +10,8 @@ export function createSettings(cfg: {
10
10
  env?: Record<string, string | undefined>;
11
11
  fetch?: typeof fetch;
12
12
  now?: () => number;
13
+ openFolderSpawn?: Function;
14
+ platform?: string;
13
15
  }): {
14
16
  handle: ({ method, pathname, query, body }: {
15
17
  method: string;
@@ -1,3 +1,9 @@
1
+ /**
2
+ * The ONE spawn for the Settings "Open keys folder" button (borrowed-from: bareloop src/panel/settingsroutes.js@07c298f): the OS file manager
3
+ * (`xdg-open` / `open`) on a folder the server chose, argv array, no shell, detached. Settings calls it only through its injected seam.
4
+ * @param {string} cmd @param {string[]} args @param {import('node:child_process').SpawnOptions} o
5
+ */
6
+ export function spawnOpener(cmd: string, args: string[], o: import("node:child_process").SpawnOptions): import("child_process").ChildProcess;
1
7
  /**
2
8
  * @param {{ bin: string, argv: string[], env: Record<string, string|undefined>, logPath: string }} a
3
9
  * @returns {import('node:child_process').ChildProcess} the child (already `unref()`ed; the log fd is closed here)
@@ -23,8 +29,11 @@ export function readJsonFile(dir: string, rel: string): any;
23
29
  */
24
30
  export function childRunning(dir: string): boolean;
25
31
  /**
26
- * The provider key VALUES in the merged env — the scrub list. The env that holds them is the SAME object that is the child's
27
- * spawn env (POC (a), M4d wiring rule), so the list can never differ from what the child was given.
28
- * @param {Record<string, string|undefined>} env
32
+ * The provider key VALUES of a keys load (`keysForDoor`) — the scrub list. The env that holds them is the SAME object that is the child's
33
+ * spawn env (POC (a), M4d wiring rule), and the names are the load's own `keyNames`, so the list can never differ from what the child was given.
34
+ * @param {{ env: Record<string, string|undefined>, keyNames?: string[] }} loaded
29
35
  */
30
- export function providerKeys(env: Record<string, string | undefined>): string[];
36
+ export function providerKeys(loaded: {
37
+ env: Record<string, string | undefined>;
38
+ keyNames?: string[];
39
+ }): string[];