fwdloop 0.19.0 → 0.20.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 +22 -13
- package/package.json +1 -1
- package/src/authoring.js +23 -3
- package/src/books.js +3 -2
- package/src/flow.js +218 -2
- package/src/jobkey.js +25 -0
- package/src/jsonl-append.js +29 -0
- package/src/monthly.js +3 -2
- package/src/panel/author.js +44 -18
- package/src/panel/authorcard.js +7 -13
- package/src/panel/authorflows.js +118 -24
- package/src/panel/authorresume.js +8 -4
- package/src/panel/authorstart.js +63 -18
- package/src/panel/authortrigger.js +252 -128
- package/src/panel/authorvalues.js +13 -2
- package/src/panel/data.js +233 -36
- package/src/panel/index.html +330 -124
- package/src/panel/needsyou.js +29 -0
- package/src/panel/scheduler.js +23 -23
- package/src/panel/server.js +30 -6
- package/src/primitives.js +5 -6
- package/src/provider.js +3 -2
- package/src/runner.js +10 -10
- package/src/runvalues.js +10 -2
- package/src/schedule.js +135 -0
- package/src/setup.js +0 -21
- package/src/summary-words.js +180 -12
- package/src/trigger-clock.js +18 -16
- package/src/trigger-files.js +40 -27
- package/src/trigger-line.js +6 -15
- package/src/types.js +1 -1
- package/types/authoring.d.ts +32 -2
- package/types/flow.d.ts +106 -0
- package/types/jobkey.d.ts +11 -0
- package/types/jsonl-append.d.ts +6 -0
- package/types/panel/author.d.ts +48 -38
- package/types/panel/authorcard.d.ts +3 -6
- package/types/panel/authorflows.d.ts +38 -10
- package/types/panel/authorstart.d.ts +15 -2
- package/types/panel/authortrigger.d.ts +75 -63
- package/types/panel/authorvalues.d.ts +6 -0
- package/types/panel/data.d.ts +101 -19
- package/types/panel/needsyou.d.ts +20 -0
- package/types/primitives.d.ts +5 -0
- package/types/runvalues.d.ts +5 -0
- package/types/schedule.d.ts +69 -0
- package/types/setup.d.ts +0 -19
- package/types/summary-words.d.ts +105 -4
- package/types/trigger-clock.d.ts +8 -7
- package/types/trigger-files.d.ts +17 -10
- package/types/trigger-line.d.ts +16 -8
- package/types/types.d.ts +1 -1
package/types/flow.d.ts
CHANGED
|
@@ -201,6 +201,71 @@ export function writeFlow({ root, name, proseText, declaration, signedBy, signed
|
|
|
201
201
|
* @param {string} flowDir @returns {string|null}
|
|
202
202
|
*/
|
|
203
203
|
export function signedHashOf(flowDir: string): string | null;
|
|
204
|
+
/**
|
|
205
|
+
* M6 am9 ("Each run keeps the plan it ran"): which plan does a reuse of run `runDir` run? `{same:true}` = the workflow's own plan (the run kept no copy, as a run made
|
|
206
|
+
* before M6, or its kept plan is byte-equal to the workflow's declaration and prose, a trigger line aside). `{same:false, read}` = a different kept plan, already verified.
|
|
207
|
+
* `{ok:false, red}` = a kept plan that does not verify: refused by name, never swapped for the workflow's.
|
|
208
|
+
* @param {{root: string, name: string, runDir: string, catalogue: unknown}} a
|
|
209
|
+
* @returns {{ok: true, same: true} | {ok: true, same: false, read: ReadFlowResult & {ok: true}} | {ok: false, red: string}}
|
|
210
|
+
*/
|
|
211
|
+
export function planForReuse({ root, name, runDir, catalogue, }: {
|
|
212
|
+
root: string;
|
|
213
|
+
name: string;
|
|
214
|
+
runDir: string;
|
|
215
|
+
catalogue: unknown;
|
|
216
|
+
}): {
|
|
217
|
+
ok: true;
|
|
218
|
+
same: true;
|
|
219
|
+
} | {
|
|
220
|
+
ok: true;
|
|
221
|
+
same: false;
|
|
222
|
+
read: ReadFlowResult & {
|
|
223
|
+
ok: true;
|
|
224
|
+
};
|
|
225
|
+
} | {
|
|
226
|
+
ok: false;
|
|
227
|
+
red: string;
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* M6 am9: give the run folder `runDir` a verified copy of the plan run `fromRunDir` kept (`job/` write-once, then `plan.json {planOf}`), so the run executes
|
|
231
|
+
* it. Nothing is signed: the bytes already carry a signature, proved here. A failure removes what this call wrote.
|
|
232
|
+
* @param {{fromRunDir: string, runDir: string, catalogue: unknown}} a
|
|
233
|
+
* @returns {{ok: true} | {ok: false, red: string}}
|
|
234
|
+
*/
|
|
235
|
+
export function copyRunPlan({ fromRunDir, runDir, catalogue }: {
|
|
236
|
+
fromRunDir: string;
|
|
237
|
+
runDir: string;
|
|
238
|
+
catalogue: unknown;
|
|
239
|
+
}): {
|
|
240
|
+
ok: true;
|
|
241
|
+
} | {
|
|
242
|
+
ok: false;
|
|
243
|
+
red: string;
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* M6 am9 ("a red run always drafts"): sign a plan as the plan of a NEW run of an existing workflow. Same checks and the same `signFlow` as `writeFlow`,
|
|
247
|
+
* but nothing of the workflow is written: the run folder is claimed (`claimRunId`) and receives `job/{prose.txt,declaration.json,signature.json}` write-once,
|
|
248
|
+
* then `plan.json` last (the file that makes the run execute it). A failure removes the run folder this call claimed. The caller proves the job is unchanged.
|
|
249
|
+
* @param {{root: unknown, name: unknown, proseText: unknown, declaration: unknown, signedBy: unknown, signedAt: unknown, catalogue: unknown}} a
|
|
250
|
+
* @returns {{ok: true, runId: string, runDir: string, signature: any} | {ok: false, reds: string[]}}
|
|
251
|
+
*/
|
|
252
|
+
export function writeRunPlan({ root, name, proseText, declaration, signedBy, signedAt, catalogue, }: {
|
|
253
|
+
root: unknown;
|
|
254
|
+
name: unknown;
|
|
255
|
+
proseText: unknown;
|
|
256
|
+
declaration: unknown;
|
|
257
|
+
signedBy: unknown;
|
|
258
|
+
signedAt: unknown;
|
|
259
|
+
catalogue: unknown;
|
|
260
|
+
}): {
|
|
261
|
+
ok: true;
|
|
262
|
+
runId: string;
|
|
263
|
+
runDir: string;
|
|
264
|
+
signature: any;
|
|
265
|
+
} | {
|
|
266
|
+
ok: false;
|
|
267
|
+
reds: string[];
|
|
268
|
+
};
|
|
204
269
|
/**
|
|
205
270
|
* Read and verify a signed flow from `<root>/<name>/`. Verifies the bytes on
|
|
206
271
|
* disk against the signature FIRST — before anything in the flow is
|
|
@@ -228,6 +293,38 @@ export function writeRunJobCopy(flowDir: string, runDir: string, expectedFlowHas
|
|
|
228
293
|
ok: false;
|
|
229
294
|
red: string;
|
|
230
295
|
};
|
|
296
|
+
/** M6 am9: does this run execute its own kept plan? The ONE test (no marker = the flow folder's plan, as every run before am9). @param {string} runDir */
|
|
297
|
+
export function runOwnsPlan(runDir: string): boolean;
|
|
298
|
+
/**
|
|
299
|
+
* M6 am9: the ONE reader of the plan a run executes. A run whose folder holds `plan.json` reads its own verified copy (`<run>/job/`); every other
|
|
300
|
+
* run (and a read with no run) reads the flow folder exactly as `readFlow` does. Never throws; a kept plan that does not verify is a red, never swapped for the flow's.
|
|
301
|
+
* @param {{root: unknown, name: unknown, catalogue: unknown, runDir?: string|null}} a
|
|
302
|
+
* @returns {ReadFlowResult}
|
|
303
|
+
*/
|
|
304
|
+
export function readPlan({ root, name, catalogue, runDir }: {
|
|
305
|
+
root: unknown;
|
|
306
|
+
name: unknown;
|
|
307
|
+
catalogue: unknown;
|
|
308
|
+
runDir?: string | null;
|
|
309
|
+
}): ReadFlowResult;
|
|
310
|
+
/**
|
|
311
|
+
* M9 am12: the ONE reader of "the job this run resumes against" (an answer, Resume, Reopen, continue-after-cap, the panel's resume controls).
|
|
312
|
+
* Always the run's OWN kept copy, verified against that copy's own signature (a run with `plan.json` reads it through `readPlan`, the same
|
|
313
|
+
* `<run>/job/`); never the workflow's current job, so a Cancel or an Edit of the workflow does not strand a waiting run. A copy that fails its
|
|
314
|
+
* signature is a red naming it; a run with no copy (it started before M6) is a red with `noCopy: true`, never the flow's job. Never throws.
|
|
315
|
+
* @param {{root: unknown, name: unknown, catalogue: unknown, runDir: string}} a
|
|
316
|
+
* @returns {ReadFlowResult | {ok: false, reds: string[], noCopy: true}}
|
|
317
|
+
*/
|
|
318
|
+
export function readRunPlan({ root, name, catalogue, runDir }: {
|
|
319
|
+
root: unknown;
|
|
320
|
+
name: unknown;
|
|
321
|
+
catalogue: unknown;
|
|
322
|
+
runDir: string;
|
|
323
|
+
}): ReadFlowResult | {
|
|
324
|
+
ok: false;
|
|
325
|
+
reds: string[];
|
|
326
|
+
noCopy: true;
|
|
327
|
+
};
|
|
231
328
|
/**
|
|
232
329
|
* M6: the job a run ran, from its own copy. `{present:false}` = the run has none (it started before M6). `{present:true, ok:true, ...}` = the same
|
|
233
330
|
* shape as a good `readFlow` (lines, arbiter, declaration, signature, classes), after the copy was verified against the copied signature.
|
|
@@ -240,6 +337,13 @@ export function readRunJobCopy(runDir: string, catalogue: unknown): {
|
|
|
240
337
|
} | ({
|
|
241
338
|
present: true;
|
|
242
339
|
} & ReadFlowResult);
|
|
340
|
+
/**
|
|
341
|
+
* M6 am5 item 2: the name suggested for the new workflow a changed job becomes: `<base>-N`, N the first free number from 2. A trailing `-N` of
|
|
342
|
+
* `name` is stripped first when what is left is itself a workflow here (aging-live-4-2 -> base aging-live-4; aging-live-4 keeps its 4). "Free" = nothing at all by that name under root (a folder or a file), the same
|
|
343
|
+
* test the card's name check makes. Pure read; the sign still refuses a name taken meanwhile (writeFlow never overwrites).
|
|
344
|
+
* @param {string} root @param {string} name
|
|
345
|
+
*/
|
|
346
|
+
export function suggestFlowName(root: string, name: string): string;
|
|
243
347
|
/** @typedef {import('./types.js').WriteFlowResult} WriteFlowResult */
|
|
244
348
|
/** @typedef {import('./types.js').ReadFlowResult} ReadFlowResult */
|
|
245
349
|
/** @typedef {import('./types.js').CheckFlowNameResult} CheckFlowNameResult */
|
|
@@ -248,6 +352,8 @@ export function readRunJobCopy(runDir: string, catalogue: unknown): {
|
|
|
248
352
|
export const FLOW_FILES: readonly string[];
|
|
249
353
|
/** The one folder under the flows root where the panel keeps each run start's own files (M4e piece 2b). A dot-name, so never a flow. */
|
|
250
354
|
export const PANEL_STARTS_DIR: ".starts";
|
|
355
|
+
/** M6 am9: a run's folder holds this file when the run executes the plan it keeps (`<run>/job/`), not the flow folder's. Written once, by the run's plan writer. */
|
|
356
|
+
export const RUN_PLAN_MARKER: "plan.json";
|
|
251
357
|
export type WriteFlowResult = import("./types.js").WriteFlowResult;
|
|
252
358
|
export type ReadFlowResult = import("./types.js").ReadFlowResult;
|
|
253
359
|
export type CheckFlowNameResult = import("./types.js").CheckFlowNameResult;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** The key of the job as the card's job box types it. @param {string} job */
|
|
2
|
+
export function jobKeyOfCard(job: string): string;
|
|
3
|
+
/** The key of a signed job. @param {{ lines: {n: number, text: string, guardrail: string}[], arbiter: any }} signed `parseSignedText`'s ok result */
|
|
4
|
+
export function jobKeyOfSigned({ lines, arbiter }: {
|
|
5
|
+
lines: {
|
|
6
|
+
n: number;
|
|
7
|
+
text: string;
|
|
8
|
+
guardrail: string;
|
|
9
|
+
}[];
|
|
10
|
+
arbiter: any;
|
|
11
|
+
}): string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** The ledger's text, '' when there is no file yet. @param {string} file */
|
|
2
|
+
export function ledgerText(file: string): string;
|
|
3
|
+
/** Append one JSON row as its own line; a torn last line gets its newline first. The parent folder must exist. @param {string} file @param {unknown} row @param {{mode?: number}} [options] e.g. `{ mode: 0o600 }` */
|
|
4
|
+
export function appendRow(file: string, row: unknown, options?: {
|
|
5
|
+
mode?: number;
|
|
6
|
+
}): void;
|
package/types/panel/author.d.ts
CHANGED
|
@@ -47,31 +47,15 @@ export function createAuthor(opts: {
|
|
|
47
47
|
status: any;
|
|
48
48
|
body: any;
|
|
49
49
|
};
|
|
50
|
+
reuseCheck: (b: any) => {
|
|
51
|
+
status: any;
|
|
52
|
+
body: any;
|
|
53
|
+
};
|
|
50
54
|
runPrepare: (body: any) => {
|
|
51
55
|
status: any;
|
|
52
56
|
body: any;
|
|
53
57
|
};
|
|
54
58
|
trigger: {
|
|
55
|
-
inspect: (body: any) => {
|
|
56
|
-
ok: false;
|
|
57
|
-
reply: {
|
|
58
|
-
status: number;
|
|
59
|
-
body: {
|
|
60
|
-
ok: boolean;
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
} | {
|
|
64
|
-
ok: true;
|
|
65
|
-
flow: any;
|
|
66
|
-
read: import("../types.js").ReadFlowOk;
|
|
67
|
-
trigger: import("../trigger-line.js").Trigger | null;
|
|
68
|
-
flowDir: string;
|
|
69
|
-
realRoot: string;
|
|
70
|
-
proseText: string;
|
|
71
|
-
declaration: any;
|
|
72
|
-
hash: string;
|
|
73
|
-
};
|
|
74
|
-
now: () => number;
|
|
75
59
|
prepare(body: any): {
|
|
76
60
|
status: number;
|
|
77
61
|
body: {
|
|
@@ -98,44 +82,49 @@ export function createAuthor(opts: {
|
|
|
98
82
|
ok: boolean;
|
|
99
83
|
refused: string;
|
|
100
84
|
say: string;
|
|
101
|
-
|
|
85
|
+
flow?: undefined;
|
|
86
|
+
trigger?: undefined;
|
|
87
|
+
words?: undefined;
|
|
88
|
+
armed?: undefined;
|
|
89
|
+
flowHash?: undefined;
|
|
90
|
+
sig?: undefined;
|
|
102
91
|
};
|
|
103
92
|
} | {
|
|
104
93
|
status: number;
|
|
105
94
|
body: {
|
|
106
95
|
ok: boolean;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
96
|
+
flow: any;
|
|
97
|
+
trigger: null;
|
|
98
|
+
words: string | null;
|
|
99
|
+
armed: boolean;
|
|
100
|
+
refused?: undefined;
|
|
101
|
+
say?: undefined;
|
|
102
|
+
flowHash?: undefined;
|
|
103
|
+
sig?: undefined;
|
|
110
104
|
};
|
|
111
105
|
} | {
|
|
112
106
|
status: number;
|
|
113
107
|
body: {
|
|
114
|
-
say?: string | undefined;
|
|
115
108
|
ok: boolean;
|
|
116
109
|
flow: any;
|
|
117
|
-
trigger: import("../trigger-line.js").Trigger
|
|
110
|
+
trigger: import("../trigger-line.js").Trigger;
|
|
118
111
|
words: string | null;
|
|
119
112
|
flowHash: string;
|
|
113
|
+
sig: string;
|
|
120
114
|
armed: boolean;
|
|
121
115
|
refused?: undefined;
|
|
122
|
-
|
|
116
|
+
say?: undefined;
|
|
123
117
|
};
|
|
124
118
|
};
|
|
125
119
|
scan(): {
|
|
126
120
|
flow: string;
|
|
127
121
|
flowDir: string;
|
|
128
122
|
read: import("../types.js").ReadFlowOk;
|
|
129
|
-
|
|
123
|
+
schedule: import("../schedule.js").Schedule;
|
|
124
|
+
trigger: import("../trigger-line.js").Trigger;
|
|
125
|
+
sig: string;
|
|
130
126
|
}[];
|
|
131
|
-
|
|
132
|
-
flowDir: string;
|
|
133
|
-
read: any;
|
|
134
|
-
trigger: Trigger;
|
|
135
|
-
}): {
|
|
136
|
-
armed: boolean;
|
|
137
|
-
already: boolean;
|
|
138
|
-
};
|
|
127
|
+
retireStale(): void;
|
|
139
128
|
busy(job: {
|
|
140
129
|
flow: string;
|
|
141
130
|
}): boolean;
|
|
@@ -143,17 +132,20 @@ export function createAuthor(opts: {
|
|
|
143
132
|
flow: string;
|
|
144
133
|
flowDir: string;
|
|
145
134
|
trigger: Trigger;
|
|
135
|
+
sig: string;
|
|
146
136
|
}, row: Record<string, any>): void;
|
|
147
137
|
refuse(job: {
|
|
148
138
|
flow: string;
|
|
149
139
|
flowDir: string;
|
|
150
140
|
trigger: Trigger;
|
|
141
|
+
sig: string;
|
|
151
142
|
}, why: string): void;
|
|
152
143
|
fire(job: {
|
|
153
144
|
flow: string;
|
|
154
145
|
flowDir: string;
|
|
155
146
|
read: any;
|
|
156
147
|
trigger: Trigger;
|
|
148
|
+
schedule: Schedule;
|
|
157
149
|
}, cause: {
|
|
158
150
|
kind: "clock";
|
|
159
151
|
slot: number;
|
|
@@ -164,13 +156,32 @@ export function createAuthor(opts: {
|
|
|
164
156
|
path: string;
|
|
165
157
|
sha: string;
|
|
166
158
|
}, hooks?: {
|
|
167
|
-
told?: (
|
|
159
|
+
told?: (row: Record<string, any>) => boolean;
|
|
168
160
|
beforeStart?: () => void;
|
|
161
|
+
holdIfCannotStart?: boolean;
|
|
169
162
|
}): Record<string, any>;
|
|
170
163
|
read(flow: string): {
|
|
171
164
|
flow: string;
|
|
172
165
|
trigger: import("../trigger-line.js").Trigger | null;
|
|
173
166
|
flowHash: string;
|
|
167
|
+
sig: string | null;
|
|
168
|
+
armed: boolean;
|
|
169
|
+
armedAt: number | null;
|
|
170
|
+
nextSlotMs: number | null;
|
|
171
|
+
lastOutcome: any;
|
|
172
|
+
hasGreenRun: boolean;
|
|
173
|
+
} | null;
|
|
174
|
+
facts(flow: string): {
|
|
175
|
+
from: string | null;
|
|
176
|
+
model: string | null;
|
|
177
|
+
destination: string | null;
|
|
178
|
+
inputs: string[];
|
|
179
|
+
fires: any[];
|
|
180
|
+
allFires: any[];
|
|
181
|
+
flow: string;
|
|
182
|
+
trigger: import("../trigger-line.js").Trigger | null;
|
|
183
|
+
flowHash: string;
|
|
184
|
+
sig: string | null;
|
|
174
185
|
armed: boolean;
|
|
175
186
|
armedAt: number | null;
|
|
176
187
|
nextSlotMs: number | null;
|
|
@@ -183,7 +194,6 @@ export function createAuthor(opts: {
|
|
|
183
194
|
armed: boolean;
|
|
184
195
|
hasGreenRun: boolean;
|
|
185
196
|
refusal: string | null;
|
|
186
|
-
editNote: string | null;
|
|
187
197
|
} | null;
|
|
188
198
|
};
|
|
189
199
|
resumePrepare: (body: any) => any;
|
|
@@ -62,10 +62,6 @@ 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
65
|
thinking?: boolean | undefined;
|
|
70
66
|
provider?: string | undefined;
|
|
71
67
|
model?: string | undefined;
|
|
@@ -175,13 +171,14 @@ export function destinationRefusal(dest: string, root: string): string | null;
|
|
|
175
171
|
/**
|
|
176
172
|
* Every $0 check on the card, before any spawn (scope 6). Collects all refusals so the page can name every box.
|
|
177
173
|
* @param {ReturnType<typeof cardFields>} card
|
|
178
|
-
* @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)
|
|
174
|
+
* @param {{ root: string, keys?: string[], home?: string, runOf?: 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)
|
|
179
175
|
* @returns {{ ok: true, prose: string }|{ ok: false, refusals: {field: string, say: string}[] }}
|
|
180
176
|
*/
|
|
181
|
-
export function checkCard(card: ReturnType<typeof cardFields>, { root, keys, home }: {
|
|
177
|
+
export function checkCard(card: ReturnType<typeof cardFields>, { root, keys, home, runOf }: {
|
|
182
178
|
root: string;
|
|
183
179
|
keys?: string[];
|
|
184
180
|
home?: string;
|
|
181
|
+
runOf?: string;
|
|
185
182
|
}): {
|
|
186
183
|
ok: true;
|
|
187
184
|
prose: string;
|
|
@@ -44,6 +44,30 @@ export function createFlowsDoor(opts: {
|
|
|
44
44
|
}): {
|
|
45
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
46
|
editBlock(name: string): string | null;
|
|
47
|
+
/** M9 am8 item 1: the sentence that says why the SCHEDULE cannot start a run now (one is starting or still working; a run waiting at its ask does not count), or null. @param {string} name */
|
|
48
|
+
scheduleBusy(name: string): string | null;
|
|
49
|
+
/**
|
|
50
|
+
* M6 am9: is this run red, as the panel's glyph rule reads it (`[✗]` and nothing else; stopped `[■]` and waiting are not)? The server decides this itself,
|
|
51
|
+
* never from the page's word. False for a run that does not resolve.
|
|
52
|
+
* @param {string} flow @param {unknown} runId
|
|
53
|
+
*/
|
|
54
|
+
runIsRed(flow: string, runId: unknown): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* M6 am5/am6: the job key of the signed flow `name` (see src/jobkey.js), or null when it is not a signed flow that reads. The draft door compares a Reuse card with it.
|
|
57
|
+
* @param {string} name
|
|
58
|
+
*/
|
|
59
|
+
signedJobKey(name: string): string | null;
|
|
60
|
+
/**
|
|
61
|
+
* `POST /api/author/reuse-check` (M6 am6 item 2): what the ONE Reuse card's button is for the fields as typed, decided here, at $0, writes nothing.
|
|
62
|
+
* Any job field changed (lines, guardrails, asks, steps) = `draft` (with the next free name); else a RED source run (`[✗]`, M6 am9) = `draft` with `runOf: true`; else a destination, cap or ask wait different from the
|
|
63
|
+
* signed value = `sign-run` (with the hash the second click carries); else `run`. Only a red run's colour enters, and the server reads it. `fromRun` (the run the card was
|
|
64
|
+
* opened from) is dropped before the run checks; `job` is read here and never reaches the run door.
|
|
65
|
+
* @param {any} body
|
|
66
|
+
*/
|
|
67
|
+
reuseCheck(body: any): {
|
|
68
|
+
status: any;
|
|
69
|
+
body: any;
|
|
70
|
+
};
|
|
47
71
|
/** M9: the source paths the newest run of this job used, role -> path (blank = none), for a start a trigger fires. @param {string} name @param {string[]} roles */
|
|
48
72
|
lastSourcesOf(name: string, roles: string[]): {
|
|
49
73
|
runId: null;
|
|
@@ -66,10 +90,8 @@ export function createFlowsDoor(opts: {
|
|
|
66
90
|
ok: boolean;
|
|
67
91
|
flows: {
|
|
68
92
|
edit: {
|
|
69
|
-
ok:
|
|
93
|
+
ok: false;
|
|
70
94
|
say: string;
|
|
71
|
-
card?: undefined;
|
|
72
|
-
flowHash?: undefined;
|
|
73
95
|
} | {
|
|
74
96
|
ok: boolean;
|
|
75
97
|
card: {
|
|
@@ -79,8 +101,6 @@ export function createFlowsDoor(opts: {
|
|
|
79
101
|
capUsd: string;
|
|
80
102
|
askWait: string;
|
|
81
103
|
};
|
|
82
|
-
flowHash: any;
|
|
83
|
-
say?: undefined;
|
|
84
104
|
};
|
|
85
105
|
values: {
|
|
86
106
|
capUsd: number;
|
|
@@ -110,6 +130,10 @@ export function createFlowsDoor(opts: {
|
|
|
110
130
|
destination: string | null;
|
|
111
131
|
askWaits: Record<string, string>;
|
|
112
132
|
};
|
|
133
|
+
model: {
|
|
134
|
+
slot: any;
|
|
135
|
+
model: any;
|
|
136
|
+
} | null;
|
|
113
137
|
runId: string;
|
|
114
138
|
}[];
|
|
115
139
|
stats: {
|
|
@@ -153,10 +177,8 @@ export function createFlowsDoor(opts: {
|
|
|
153
177
|
ok: boolean;
|
|
154
178
|
flow: {
|
|
155
179
|
edit: {
|
|
156
|
-
ok:
|
|
180
|
+
ok: false;
|
|
157
181
|
say: string;
|
|
158
|
-
card?: undefined;
|
|
159
|
-
flowHash?: undefined;
|
|
160
182
|
} | {
|
|
161
183
|
ok: boolean;
|
|
162
184
|
card: {
|
|
@@ -166,8 +188,6 @@ export function createFlowsDoor(opts: {
|
|
|
166
188
|
capUsd: string;
|
|
167
189
|
askWait: string;
|
|
168
190
|
};
|
|
169
|
-
flowHash: any;
|
|
170
|
-
say?: undefined;
|
|
171
191
|
};
|
|
172
192
|
values: {
|
|
173
193
|
capUsd: number;
|
|
@@ -197,6 +217,10 @@ export function createFlowsDoor(opts: {
|
|
|
197
217
|
destination: string | null;
|
|
198
218
|
askWaits: Record<string, string>;
|
|
199
219
|
};
|
|
220
|
+
model: {
|
|
221
|
+
slot: any;
|
|
222
|
+
model: any;
|
|
223
|
+
} | null;
|
|
200
224
|
runId: string;
|
|
201
225
|
}[];
|
|
202
226
|
stats: {
|
|
@@ -215,6 +239,10 @@ export function createFlowsDoor(opts: {
|
|
|
215
239
|
destination: string | null;
|
|
216
240
|
askWaits: Record<string, string>;
|
|
217
241
|
};
|
|
242
|
+
model: {
|
|
243
|
+
slot: any;
|
|
244
|
+
model: any;
|
|
245
|
+
} | null;
|
|
218
246
|
runId: string;
|
|
219
247
|
};
|
|
220
248
|
};
|
|
@@ -15,6 +15,17 @@ export function createStarter(opts: {
|
|
|
15
15
|
say?: undefined;
|
|
16
16
|
};
|
|
17
17
|
startingFor: (flow: string, keys: string[], runId?: string) => string | null;
|
|
18
|
+
canStart: ({ flow, runId, planRun }: {
|
|
19
|
+
flow: string;
|
|
20
|
+
runId: string;
|
|
21
|
+
planRun?: boolean;
|
|
22
|
+
}, loaded: {
|
|
23
|
+
env: Record<string, string | undefined>;
|
|
24
|
+
keyNames?: string[];
|
|
25
|
+
}) => {
|
|
26
|
+
status: number;
|
|
27
|
+
body: any;
|
|
28
|
+
} | null;
|
|
18
29
|
/**
|
|
19
30
|
* Start `fwdloop run` for a flow whose every $0 check already passed at the calling door. Re-checks the run id here (nothing
|
|
20
31
|
* awaits between this check and the spawn). 202 { startId, runId } or a refusal; a refusal creates nothing.
|
|
@@ -23,11 +34,11 @@ export function createStarter(opts: {
|
|
|
23
34
|
* folder as `signed-values.json` BEFORE the spawn; the run then uses them (`pickRunValues`). None = the flow's own.
|
|
24
35
|
* `trigger` (M9): `{kind, reason, catchUp, ...}` for a start a trigger fired (kind 'trigger'): written once into the run's own folder as `trigger.json`
|
|
25
36
|
* BEFORE the spawn; `appendHistory` copies it into the run's history row (the catch-up mark, am2 item 1).
|
|
26
|
-
* @param {{ kind: 'run'|'sign'|'trigger', flow: string, runId: string, sources: {role: string, path: string}[], values?: any, pick?: {slot: string, model: string}|null, trigger?: Record<string, any>|null }} a
|
|
37
|
+
* @param {{ kind: 'run'|'sign'|'trigger', flow: string, runId: string, sources: {role: string, path: string}[], planRun?: boolean, planOf?: string|null, values?: any, pick?: {slot: string, model: string}|null, trigger?: Record<string, any>|null }} a
|
|
27
38
|
* @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
|
|
28
39
|
* @returns {{ status: number, body: any }}
|
|
29
40
|
*/
|
|
30
|
-
start({ kind, flow, runId, sources, values, pick, trigger, }: {
|
|
41
|
+
start({ kind, flow, runId, sources, values, pick, trigger, planRun, planOf, }: {
|
|
31
42
|
kind: "run" | "sign" | "trigger";
|
|
32
43
|
flow: string;
|
|
33
44
|
runId: string;
|
|
@@ -35,6 +46,8 @@ export function createStarter(opts: {
|
|
|
35
46
|
role: string;
|
|
36
47
|
path: string;
|
|
37
48
|
}[];
|
|
49
|
+
planRun?: boolean;
|
|
50
|
+
planOf?: string | null;
|
|
38
51
|
values?: any;
|
|
39
52
|
pick?: {
|
|
40
53
|
slot: string;
|