fwdloop 0.12.0 → 0.14.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 +155 -27
- package/package.json +2 -2
- package/src/ask.js +3 -0
- package/src/authoring.js +135 -16
- package/src/books.js +23 -2
- package/src/canrun.js +106 -0
- package/src/catalogue.json +2 -2
- package/src/checked.js +50 -0
- package/src/closers.js +112 -91
- package/src/config.js +2 -1
- package/src/declaration.js +175 -3
- package/src/drafter.js +148 -10
- package/src/draftspend.js +70 -0
- package/src/flow.js +43 -0
- package/src/keysfile.js +4 -2
- package/src/liveness.js +1 -1
- package/src/model-step.js +31 -5
- package/src/monthly.js +195 -28
- package/src/panel/author.js +638 -0
- package/src/panel/authorcard.js +340 -0
- package/src/panel/authorflows.js +317 -0
- package/src/panel/authorresume.js +149 -0
- package/src/panel/authorstart.js +257 -0
- package/src/panel/authorvalues.js +110 -0
- package/src/panel/data.js +318 -99
- package/src/panel/index.html +2000 -330
- package/src/panel/resume.js +6 -8
- package/src/panel/server.js +122 -119
- package/src/panel/settings.js +8 -6
- package/src/panel/spawn.js +77 -0
- package/src/provider.js +12 -17
- package/src/runner.js +707 -104
- package/src/runvalues.js +178 -0
- package/src/send.js +10 -3
- package/src/setup.js +127 -0
- package/types/authoring.d.ts +56 -2
- package/types/books.d.ts +14 -2
- package/types/canrun.d.ts +64 -0
- package/types/checked.d.ts +23 -0
- package/types/closers.d.ts +47 -28
- package/types/config.d.ts +1 -0
- package/types/declaration.d.ts +23 -1
- package/types/drafter.d.ts +151 -2
- package/types/draftspend.d.ts +21 -0
- package/types/flow.d.ts +23 -0
- package/types/liveness.d.ts +2 -2
- package/types/model-step.d.ts +4 -7
- package/types/monthly.d.ts +46 -1
- package/types/panel/author.d.ts +316 -0
- package/types/panel/authorcard.d.ts +142 -0
- package/types/panel/authorflows.d.ts +175 -0
- package/types/panel/authorresume.d.ts +32 -0
- package/types/panel/authorstart.d.ts +115 -0
- package/types/panel/authorvalues.d.ts +62 -0
- package/types/panel/data.d.ts +105 -63
- package/types/panel/server.d.ts +11 -33
- package/types/panel/spawn.d.ts +30 -0
- package/types/provider.d.ts +6 -9
- package/types/runner.d.ts +129 -6
- package/types/runvalues.d.ts +97 -0
- package/types/send.d.ts +5 -1
- package/types/setup.d.ts +77 -0
package/types/runner.d.ts
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
/** The panel's one write of a stop request. `'exists'` = already asked, nothing more to do. @param {string} runDir */
|
|
2
|
+
export function requestStop(runDir: string): "written" | "exists";
|
|
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): {
|
|
11
|
+
at: string | null;
|
|
12
|
+
} | null;
|
|
13
|
+
/** Is a stop pending for this run? (read-only) @param {string} runDir */
|
|
14
|
+
export function stopPending(runDir: string): boolean;
|
|
15
|
+
/** The one reader of halt.json: `{ok:true, halt}`, `{ok:false, missing:true}` (not resumable), or `{ok:false, red}`. @param {string} runDir */
|
|
16
|
+
export function readHaltRecord(runDir: string): {
|
|
17
|
+
ok: boolean;
|
|
18
|
+
missing: boolean;
|
|
19
|
+
red?: undefined;
|
|
20
|
+
halt?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
ok: boolean;
|
|
23
|
+
red: string;
|
|
24
|
+
missing?: undefined;
|
|
25
|
+
halt?: undefined;
|
|
26
|
+
} | {
|
|
27
|
+
ok: boolean;
|
|
28
|
+
halt: any;
|
|
29
|
+
missing?: undefined;
|
|
30
|
+
red?: undefined;
|
|
31
|
+
};
|
|
1
32
|
/** @param {string|null|undefined} modelId */
|
|
2
33
|
export function resolveCeilingUsd(modelId: string | null | undefined): any;
|
|
3
34
|
/** @param {{goal:string, primitives?:string[], reads?:Record<string,any>, gap?:string|null}} opts */
|
|
@@ -53,13 +84,23 @@ export function freezeInputs(runDir: any, sources: any): {
|
|
|
53
84
|
}[];
|
|
54
85
|
red?: undefined;
|
|
55
86
|
};
|
|
56
|
-
/** The send target's
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
87
|
+
/** The send target's folder (M4e amendment 1, "Destination is any folder").
|
|
88
|
+
* An absolute `file:/abs/path` is that folder, anywhere on the machine. A
|
|
89
|
+
* relative path keeps its M0/M2 meaning: joined onto the install folder and
|
|
90
|
+
* fenced inside it (lexically AND after realpath — a symlink inside the repo
|
|
91
|
+
* pointing outside must not pass). Either way, with `realpathSync` (symlinks
|
|
92
|
+
* followed), the folder must exist, be a folder, be writable, and must NOT be
|
|
93
|
+
* the run's own folder (its records and `inputs/`), the panel/CLI flow root, any flow
|
|
94
|
+
* folder under it (one holding a FLOW_FILES file) or `<root>/.drafts` or `<root>/.starts`, or the fwdloop config folder (holds the keys).
|
|
95
|
+
* Called at sign time and re-called at write time (time-of-check vs
|
|
96
|
+
* time-of-use, M0's own fix) — the one rule for both.
|
|
60
97
|
* @param {string} target
|
|
98
|
+
* @param {{root?: string, runDir?: string}} [ctx] `root` = the flow root, `runDir` = this run's folder
|
|
61
99
|
* @returns {{ok:true, dir:string} | {ok:false, red:string}} */
|
|
62
|
-
export function checkSendDestination(target: string
|
|
100
|
+
export function checkSendDestination(target: string, ctx?: {
|
|
101
|
+
root?: string;
|
|
102
|
+
runDir?: string;
|
|
103
|
+
}): {
|
|
63
104
|
ok: true;
|
|
64
105
|
dir: string;
|
|
65
106
|
} | {
|
|
@@ -205,8 +246,67 @@ export function makeParkingAskStep(): (opts?: any) => Promise<{
|
|
|
205
246
|
* @param {string} opts.businessDate
|
|
206
247
|
* @param {number} [opts.ceilingUsd]
|
|
207
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.
|
|
250
|
+
*/
|
|
251
|
+
export function resumeRun({ root, name, runId, catalogue, modelStep, sendStep, primitives, primitiveReds, clock, businessDate, ceilingUsd, nowMs, onRerunStart, }: {
|
|
252
|
+
root: string;
|
|
253
|
+
name: string;
|
|
254
|
+
runId: string;
|
|
255
|
+
catalogue: unknown;
|
|
256
|
+
modelStep: (executorContext: object, grantedTools: Record<string, any>, stepMeta?: {
|
|
257
|
+
class: string | null;
|
|
258
|
+
}) => Promise<any>;
|
|
259
|
+
sendStep: (target: string, filename: string, content: unknown) => Promise<{
|
|
260
|
+
ok: boolean;
|
|
261
|
+
red?: string;
|
|
262
|
+
bytes?: number;
|
|
263
|
+
}>;
|
|
264
|
+
primitives?: Record<string, any> | undefined;
|
|
265
|
+
primitiveReds?: string[] | undefined;
|
|
266
|
+
clock?: (() => string) | undefined;
|
|
267
|
+
businessDate: string;
|
|
268
|
+
ceilingUsd?: number | undefined;
|
|
269
|
+
nowMs?: (() => number) | undefined;
|
|
270
|
+
onRerunStart?: ((newRunDir: string) => void) | undefined;
|
|
271
|
+
}): Promise<any>;
|
|
272
|
+
/**
|
|
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
|
|
274
|
+
* row cost nothing and carries no number), and whether any row left the total a floor. Used by `continueRun` and the CLI's hold.
|
|
275
|
+
* @param {string} runDir
|
|
276
|
+
* @returns {{ ok: true, total: number, complete: boolean } | { ok: false, red: string }}
|
|
208
277
|
*/
|
|
209
|
-
export function
|
|
278
|
+
export function auditSpend(runDir: string): {
|
|
279
|
+
ok: true;
|
|
280
|
+
total: number;
|
|
281
|
+
complete: boolean;
|
|
282
|
+
} | {
|
|
283
|
+
ok: false;
|
|
284
|
+
red: string;
|
|
285
|
+
};
|
|
286
|
+
/**
|
|
287
|
+
* M4e amendment 4 items 4 and 6 (Resume of a stopped or cap-halted run): the SAME run id continues, never a new run. Takes the
|
|
288
|
+
* same exclusive `resume.lock` as an answer-resume (one resume at a time per run), reads `halt.json` (the runner's own record of
|
|
289
|
+
* where it stopped), re-verifies the flow's signature, the frozen inputs and every finished step's artifact, lays the run's
|
|
290
|
+
* highest signed values version over the flow's (`pickRunValues`: the human's new cap lives there, write-once, never in the flow's
|
|
291
|
+
* own files), refuses by name at $0 when that cap is not above what is already spent, consumes `halt.json` by rename (the
|
|
292
|
+
* mutex, like an answer), then re-enters the ONE fold at the first step with no artifact. Done steps are not re-run, spend so
|
|
293
|
+
* far (re-summed from the books) counts against the new cap, the plan is never redrawn.
|
|
294
|
+
*
|
|
295
|
+
* @param {object} opts same shape as `resumeRun`'s
|
|
296
|
+
* @param {string} opts.root
|
|
297
|
+
* @param {string} opts.name
|
|
298
|
+
* @param {string} opts.runId
|
|
299
|
+
* @param {unknown} opts.catalogue
|
|
300
|
+
* @param {(executorContext:object, grantedTools:Record<string,any>, stepMeta?:{class:string|null}) => Promise<any>} opts.modelStep
|
|
301
|
+
* @param {(target:string, filename:string, content:unknown) => Promise<{ok:boolean, red?:string, bytes?:number}>} opts.sendStep
|
|
302
|
+
* @param {Record<string, any>} [opts.primitives]
|
|
303
|
+
* @param {string[]} [opts.primitiveReds]
|
|
304
|
+
* @param {() => string} [opts.clock]
|
|
305
|
+
* @param {string} opts.businessDate
|
|
306
|
+
* @param {number} [opts.ceilingUsd]
|
|
307
|
+
* @param {() => number} [opts.nowMs]
|
|
308
|
+
*/
|
|
309
|
+
export function continueRun({ root, name, runId, catalogue, modelStep, sendStep, primitives, primitiveReds, clock, businessDate, ceilingUsd, nowMs, }: {
|
|
210
310
|
root: string;
|
|
211
311
|
name: string;
|
|
212
312
|
runId: string;
|
|
@@ -226,6 +326,27 @@ export function resumeRun({ root, name, runId, catalogue, modelStep, sendStep, p
|
|
|
226
326
|
ceilingUsd?: number | undefined;
|
|
227
327
|
nowMs?: (() => number) | undefined;
|
|
228
328
|
}): Promise<any>;
|
|
329
|
+
/**
|
|
330
|
+
* M4e amendment 13: the Stop on a run that already waits at its ask (the panel's Stop door; also the fallback for a request that
|
|
331
|
+
* landed right after the park). Writes the request if none is pending (`requestStop`, its one writer), takes the same exclusive
|
|
332
|
+
* `resume.lock` as a resume, checks the run really is parked on its open, unanswered ask, and stops it at the ask (`stopAtAsk`).
|
|
333
|
+
* Refused by name, writing nothing, for a run that is not waiting at an ask. $0: no model call, no spend.
|
|
334
|
+
* @param {object} opts
|
|
335
|
+
* @param {string} opts.root
|
|
336
|
+
* @param {string} opts.name
|
|
337
|
+
* @param {string} opts.runId
|
|
338
|
+
* @param {unknown} opts.catalogue
|
|
339
|
+
* @param {() => string} [opts.clock]
|
|
340
|
+
* @param {() => number} [opts.nowMs]
|
|
341
|
+
*/
|
|
342
|
+
export function stopParkedRun({ root, name, runId, catalogue, clock, nowMs, }: {
|
|
343
|
+
root: string;
|
|
344
|
+
name: string;
|
|
345
|
+
runId: string;
|
|
346
|
+
catalogue: unknown;
|
|
347
|
+
clock?: (() => string) | undefined;
|
|
348
|
+
nowMs?: (() => number) | undefined;
|
|
349
|
+
}): Promise<any>;
|
|
229
350
|
/**
|
|
230
351
|
* `writeLog`'s own sibling reader (M4a piece 2, docs/wiki/the-module-
|
|
231
352
|
* ladder.md M4a scope item 2: "one reader per book") — `null` when the run
|
|
@@ -270,3 +391,5 @@ export const MAX_ATTEMPTS: 4;
|
|
|
270
391
|
* orders of magnitude below the cheapest real round (audit rows here run
|
|
271
392
|
* $0.0006+), so nothing a real tamper produces can hide inside it. */
|
|
272
393
|
export const SPEND_TOLERANCE_USD: 1e-9;
|
|
394
|
+
export const STOP_FILE: "stop.request";
|
|
395
|
+
export const HALT_FILE: "halt.json";
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/** An ask wait as the signed text spells it (`<int>` then `s`, `m` or `h`), in ms; null when it is not that or not above 0. @param {unknown} text */
|
|
2
|
+
export function parseWaitMs(text: unknown): number | null;
|
|
3
|
+
/** The wait text for a ttl in ms (`2h`, `30m`, `45s`). @param {number} ms */
|
|
4
|
+
export function waitText(ms: number): string;
|
|
5
|
+
/**
|
|
6
|
+
* The values a flow's own signature gives: the cap, the ONE send's destination folder (null when the flow has no single file send, so a
|
|
7
|
+
* destination cannot be added or changed), and each ask's wait by its line number.
|
|
8
|
+
* @param {any} arbiter `readFlow`'s arbiter
|
|
9
|
+
* @returns {{ capUsd: number, destination: string|null, askWaits: Record<string, string> }}
|
|
10
|
+
*/
|
|
11
|
+
export function flowValues(arbiter: any): {
|
|
12
|
+
capUsd: number;
|
|
13
|
+
destination: string | null;
|
|
14
|
+
askWaits: Record<string, string>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The hash the human's click is bound to.
|
|
18
|
+
* @param {{ flow: string, flowSignatureHash: string, runId?: string|null, version: number, values: {capUsd: number, destination: string|null, askWaits: Record<string,string>} }} a
|
|
19
|
+
*/
|
|
20
|
+
export function valuesHash({ flow, flowSignatureHash, runId, version, values, }: {
|
|
21
|
+
flow: string;
|
|
22
|
+
flowSignatureHash: string;
|
|
23
|
+
runId?: string | null;
|
|
24
|
+
version: number;
|
|
25
|
+
values: {
|
|
26
|
+
capUsd: number;
|
|
27
|
+
destination: string | null;
|
|
28
|
+
askWaits: Record<string, string>;
|
|
29
|
+
};
|
|
30
|
+
}): string;
|
|
31
|
+
/** True when `a` and `b` are the same values (cap, destination, every wait). */
|
|
32
|
+
export function sameValues(a: any, b: any): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The ONE writer of a version file: write-once (`wx`), mode 0600. Refuses a record whose hash does not match its own fields.
|
|
35
|
+
* @param {string} runDir
|
|
36
|
+
* @param {{ flow: string, flowSignatureHash: string, runId: string, version: number, values: any, hash: string, signedBy: string, at: string }} record
|
|
37
|
+
* @returns {{ok: true, file: string} | {ok: false, red: string}}
|
|
38
|
+
*/
|
|
39
|
+
export function writeRunValues(runDir: string, record: {
|
|
40
|
+
flow: string;
|
|
41
|
+
flowSignatureHash: string;
|
|
42
|
+
runId: string;
|
|
43
|
+
version: number;
|
|
44
|
+
values: any;
|
|
45
|
+
hash: string;
|
|
46
|
+
signedBy: string;
|
|
47
|
+
at: string;
|
|
48
|
+
}): {
|
|
49
|
+
ok: true;
|
|
50
|
+
file: string;
|
|
51
|
+
} | {
|
|
52
|
+
ok: false;
|
|
53
|
+
red: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* The ONE decision "which signed version does this run use": the highest version file in the run folder.
|
|
57
|
+
* `{ok:true, none:true}` = the flow's own values; `{ok:true, version, record}`; `{ok:false, red}` = a file that cannot be trusted
|
|
58
|
+
* (unreadable, not JSON, wrong shape, a hash that does not match its fields, a name that disagrees with its version).
|
|
59
|
+
* @param {string} runDir
|
|
60
|
+
* @returns {{ok: true, none: true} | {ok: true, none?: false, version: number, record: any} | {ok: false, red: string}}
|
|
61
|
+
*/
|
|
62
|
+
export function pickRunValues(runDir: string): {
|
|
63
|
+
ok: true;
|
|
64
|
+
none: true;
|
|
65
|
+
} | {
|
|
66
|
+
ok: true;
|
|
67
|
+
none?: false;
|
|
68
|
+
version: number;
|
|
69
|
+
record: any;
|
|
70
|
+
} | {
|
|
71
|
+
ok: false;
|
|
72
|
+
red: string;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* The arbiter a run executes under: the flow's own, with the picked record's cap, send folder and ask waits laid over it. The flow's
|
|
76
|
+
* arbiter object is never mutated. A record for another flow or a changed flow signature is refused; so is a record that names a send
|
|
77
|
+
* or an ask the flow does not have.
|
|
78
|
+
* @param {any} arbiter `readFlow`'s arbiter @param {string} flow @param {string} flowSignatureHash
|
|
79
|
+
* @param {ReturnType<typeof pickRunValues>} picked
|
|
80
|
+
* @returns {{ok: true, arbiter: any, version: number|null} | {ok: false, red: string}}
|
|
81
|
+
*/
|
|
82
|
+
export function applyRunValues(arbiter: any, flow: string, flowSignatureHash: string, picked: ReturnType<typeof pickRunValues>): {
|
|
83
|
+
ok: true;
|
|
84
|
+
arbiter: any;
|
|
85
|
+
version: number | null;
|
|
86
|
+
} | {
|
|
87
|
+
ok: false;
|
|
88
|
+
red: string;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* A start that refused before the run began (monthly limit, empty key ...) leaves a run folder holding nothing but its signed values
|
|
92
|
+
* file: remove that one file so the folder can be removed too and the run name is not burned. Never touches a folder with anything else.
|
|
93
|
+
* @param {string} runDir @returns {boolean} true when the file was removed
|
|
94
|
+
*/
|
|
95
|
+
export function dropUnstartedValues(runDir: string): boolean;
|
|
96
|
+
export const VALUES_FILE_RE: RegExp;
|
|
97
|
+
export function valuesFileName(version: number): string;
|
package/types/send.d.ts
CHANGED
|
@@ -5,9 +5,13 @@
|
|
|
5
5
|
* @param {string|null} [acceptedSha256] - the sha256 the human's accept recorded
|
|
6
6
|
* (`answerAsk`, M4b piece 3). Required: none recorded (an answer written by an
|
|
7
7
|
* older version, or no accept in this process) refuses by name.
|
|
8
|
+
* @param {{root?: string, runDir?: string}} [ctx] the flow root and this run's folder, for the destination refusals
|
|
8
9
|
* @returns {Promise<{ok:true, path:string, bytes:number} | {ok:false, red:string}>}
|
|
9
10
|
*/
|
|
10
|
-
export function sendViaPrimitive(target: string, filename: string, content: unknown, acceptedSha256?: string | null
|
|
11
|
+
export function sendViaPrimitive(target: string, filename: string, content: unknown, acceptedSha256?: string | null, ctx?: {
|
|
12
|
+
root?: string;
|
|
13
|
+
runDir?: string;
|
|
14
|
+
}): Promise<{
|
|
11
15
|
ok: true;
|
|
12
16
|
path: string;
|
|
13
17
|
bytes: number;
|
package/types/setup.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
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
|
+
* draft has none, so its record is its one plan folder (`planDir`, read as `draft`) plus the sign.
|
|
4
|
+
* @param {{ sessionDir?: string, planDir: string, hash: string, signedBy: string, signedAt: string, flowHash?: string }} a
|
|
5
|
+
*/
|
|
6
|
+
export function buildSetupRows({ sessionDir, planDir, hash, signedBy, signedAt, flowHash, }: {
|
|
7
|
+
sessionDir?: string;
|
|
8
|
+
planDir: string;
|
|
9
|
+
hash: string;
|
|
10
|
+
signedBy: string;
|
|
11
|
+
signedAt: string;
|
|
12
|
+
flowHash?: string;
|
|
13
|
+
}): ({
|
|
14
|
+
kind: any;
|
|
15
|
+
n: any;
|
|
16
|
+
at: any;
|
|
17
|
+
model: any;
|
|
18
|
+
costUsd: any;
|
|
19
|
+
spendComplete: boolean;
|
|
20
|
+
calls: any;
|
|
21
|
+
wallMs: any;
|
|
22
|
+
structureRetries: any;
|
|
23
|
+
verdict: string;
|
|
24
|
+
hash: string | null;
|
|
25
|
+
gap: string | null;
|
|
26
|
+
} | {
|
|
27
|
+
kind: string;
|
|
28
|
+
n: number;
|
|
29
|
+
at: string | null;
|
|
30
|
+
card: any;
|
|
31
|
+
signedBy?: undefined;
|
|
32
|
+
hash?: undefined;
|
|
33
|
+
flowHash?: undefined;
|
|
34
|
+
notChecked?: undefined;
|
|
35
|
+
} | {
|
|
36
|
+
kind: string;
|
|
37
|
+
n: number;
|
|
38
|
+
at: string;
|
|
39
|
+
signedBy: string;
|
|
40
|
+
hash: string;
|
|
41
|
+
flowHash: string | null;
|
|
42
|
+
notChecked: {
|
|
43
|
+
label: string;
|
|
44
|
+
items: any[];
|
|
45
|
+
};
|
|
46
|
+
card?: undefined;
|
|
47
|
+
})[];
|
|
48
|
+
/**
|
|
49
|
+
* Write `<flowDir>/setup.jsonl` ONCE ('wx': a second write is refused, never merged or replaced), mode 0600, every row scrubbed of the
|
|
50
|
+
* given key values. Never throws.
|
|
51
|
+
* @param {{ flowDir: string, secrets?: string[] } & Parameters<typeof buildSetupRows>[0]} a
|
|
52
|
+
* @returns {{ ok: true, file: string, rows: number } | { ok: false, red: string }}
|
|
53
|
+
*/
|
|
54
|
+
export function writeSetup({ flowDir, secrets, ...rest }: {
|
|
55
|
+
flowDir: string;
|
|
56
|
+
secrets?: string[];
|
|
57
|
+
} & Parameters<typeof buildSetupRows>[0]): {
|
|
58
|
+
ok: true;
|
|
59
|
+
file: string;
|
|
60
|
+
rows: number;
|
|
61
|
+
} | {
|
|
62
|
+
ok: false;
|
|
63
|
+
red: string;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* The flow's setup rows, through the one safe gateway. `present:false` = a flow signed before amendment 6 (or a file that cannot be read).
|
|
67
|
+
* @param {string} flowDir
|
|
68
|
+
* @returns {{ present: false } | { present: true, rows: any[], unreadable: number }}
|
|
69
|
+
*/
|
|
70
|
+
export function readSetup(flowDir: string): {
|
|
71
|
+
present: false;
|
|
72
|
+
} | {
|
|
73
|
+
present: true;
|
|
74
|
+
rows: any[];
|
|
75
|
+
unreadable: number;
|
|
76
|
+
};
|
|
77
|
+
export const SETUP_FILE: "setup.jsonl";
|