fwdloop 0.19.1 → 0.21.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/README.md +2 -0
- package/bin/fwdloop +22 -13
- package/package.json +1 -1
- package/src/audit-fold.js +177 -0
- package/src/authoring.js +24 -4
- package/src/books.js +4 -3
- package/src/closers.js +49 -2
- package/src/ctx-tools.js +1 -1
- package/src/diary.js +49 -0
- package/src/flow.js +218 -2
- package/src/flowmodel.js +42 -5
- package/src/jobkey.js +25 -0
- package/src/jsonl-append.js +29 -0
- package/src/model-step.js +103 -5
- 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 +250 -125
- package/src/panel/authorvalues.js +13 -2
- package/src/panel/data.js +279 -43
- package/src/panel/index.html +547 -150
- package/src/panel/needsyou.js +29 -0
- package/src/panel/scheduler.js +21 -22
- package/src/panel/server.js +30 -6
- package/src/primitives.js +44 -2
- package/src/provider.js +3 -2
- package/src/runner.js +58 -22
- package/src/runvalues.js +10 -2
- package/src/schedule.js +135 -0
- package/src/setup.js +0 -21
- package/src/summary-words.js +180 -7
- package/src/thinking.js +39 -0
- package/src/trigger-clock.js +18 -16
- package/src/trigger-files.js +37 -24
- package/src/trigger-line.js +6 -15
- package/src/try-checks.js +62 -0
- package/src/types.js +2 -1
- package/types/audit-fold.d.ts +54 -0
- package/types/authoring.d.ts +33 -2
- package/types/books.d.ts +17 -0
- package/types/ctx-tools.d.ts +1 -0
- package/types/diary.d.ts +57 -0
- package/types/flow.d.ts +106 -0
- package/types/flowmodel.d.ts +25 -3
- package/types/jobkey.d.ts +11 -0
- package/types/jsonl-append.d.ts +6 -0
- package/types/model-step.d.ts +4 -1
- package/types/panel/author.d.ts +47 -17
- 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 +73 -41
- 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/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 -2
- package/types/thinking.d.ts +31 -0
- 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/try-checks.d.ts +55 -0
- package/types/types.d.ts +10 -1
package/types/summary-words.d.ts
CHANGED
|
@@ -13,8 +13,6 @@ export function slotWords(ms: number): string;
|
|
|
13
13
|
export function nextTimeWords(ms: number, now: number): string;
|
|
14
14
|
/** M11 am1 item 3, the Scheduled card's second line start: "next in 20m" / "next in 3h" / "next in 3d" (whole units, rounded down, never "0m"). @param {number} ms @param {number} now */
|
|
15
15
|
export function nextInWords(ms: number, now: number): string;
|
|
16
|
-
/** am1, said before a human signs an edit of a job that has a trigger. @param {Trigger|null} t @param {string} [home] */
|
|
17
|
-
export function editClearsWords(t: Trigger | null, home?: string): string | null;
|
|
18
16
|
/**
|
|
19
17
|
* NEXT of a job with a trigger. One sentence, first match wins:
|
|
20
18
|
* 1. a run of this job is waiting at its ask (the next run waits too);
|
|
@@ -55,4 +53,109 @@ export function endedWords(f: {
|
|
|
55
53
|
reason: string;
|
|
56
54
|
next: string;
|
|
57
55
|
} | null;
|
|
56
|
+
/** "MM/DD HH:MM", local time: the same form as the run cards' `rlShortDate`. @param {number|string} when epoch ms or an ISO string */
|
|
57
|
+
export function shortStamp(when: number | string): string;
|
|
58
|
+
/** "Tue 10/20 09:05": the day name then the short stamp. @param {number} ms */
|
|
59
|
+
export function dayStamp(ms: number): string;
|
|
60
|
+
/**
|
|
61
|
+
* The schedule in words, lower-case first ("every day at 08:15"): the SINGLE line-1 of the Run tab's SCHEDULE block and the first part of the Job tab's
|
|
62
|
+
* Schedule field. `null` (no schedule) has no sentence. @param {Trigger|null} t @param {string} [home]
|
|
63
|
+
*/
|
|
64
|
+
export function scheduleHead(t: Trigger | null, home?: string): string | null;
|
|
65
|
+
/**
|
|
66
|
+
* The Job tab's "Schedule" field: the workflow's schedule now and what it is bound to, parts joined by " · ", or `none`.
|
|
67
|
+
* @param {{trigger: Trigger|null, from?: string|null, model?: string|null, destination?: string|null, inputs?: string[]|null, home?: string}} f
|
|
68
|
+
*/
|
|
69
|
+
export function scheduleFieldWords(f: {
|
|
70
|
+
trigger: Trigger | null;
|
|
71
|
+
from?: string | null;
|
|
72
|
+
model?: string | null;
|
|
73
|
+
destination?: string | null;
|
|
74
|
+
inputs?: string[] | null;
|
|
75
|
+
home?: string;
|
|
76
|
+
}): string;
|
|
77
|
+
/**
|
|
78
|
+
* The Job tab's Started line: `By hand · 10/15 13:46`, `By the schedule: every day at 08:15 · catch-up, 10 min late · 10/15 08:16`,
|
|
79
|
+
* `By a new file: aging-oct.csv · …`, `By a file update: aging.csv · …`. The trailing stamp is the run's start (am7 item 5); absent when the books do not hold one.
|
|
80
|
+
* @param {any} rec the run's trigger.json or null @param {number|null} startMs @param {string} [home]
|
|
81
|
+
*/
|
|
82
|
+
export function startedWords(rec: any, startMs: number | null, home?: string): string;
|
|
83
|
+
/**
|
|
84
|
+
* The Run tab's SCHEDULE block (am7 item 3, am8 items 2-8): `{line1, line2, red}`. Line 1 = the schedule words or `By hand`. Line 2 (only with a schedule):
|
|
85
|
+
* `no run yet` before any fire; else `last <stamp> · ` then the newest fire's words, then `next ...`:
|
|
86
|
+
* - a start: `<run-N> · <outcome>[ · catch-up]` (a run waiting at its ask: `<run-N> · waiting for your answer (the next run does not wait)`), normal;
|
|
87
|
+
* - busy: `busy: a run of this job was still working`, normal (it clears by itself);
|
|
88
|
+
* - month used up: `month used up: $0.01 left, needs $0.50 · next: raise the limit in Settings, or it starts on the 1st`, red only while `nowMs` is still that month;
|
|
89
|
+
* - refused: `refused: <why> · next: fix it in Cancel / modify schedule`, red until a later good start.
|
|
90
|
+
* `next` otherwise: `next <day stamp>`, `next: waiting for a new file` (file schedule) or `next: not armed yet`.
|
|
91
|
+
* @param {{trigger: Trigger|null, home?: string, last: {at: string, runId: string, outcome: string, catchUp: boolean}|null, nextSlotMs: number|null, armed: boolean, problem: any, nowMs?: number}} f
|
|
92
|
+
* `problem`: the newest fire when it started nothing (busy, monthly-exhausted, refused), else null.
|
|
93
|
+
* @returns {{line1: string, line2: string|null, red: boolean}}
|
|
94
|
+
*/
|
|
95
|
+
export function scheduleBlockWords(f: {
|
|
96
|
+
trigger: Trigger | null;
|
|
97
|
+
home?: string;
|
|
98
|
+
last: {
|
|
99
|
+
at: string;
|
|
100
|
+
runId: string;
|
|
101
|
+
outcome: string;
|
|
102
|
+
catchUp: boolean;
|
|
103
|
+
} | null;
|
|
104
|
+
nextSlotMs: number | null;
|
|
105
|
+
armed: boolean;
|
|
106
|
+
problem: any;
|
|
107
|
+
nowMs?: number;
|
|
108
|
+
}): {
|
|
109
|
+
line1: string;
|
|
110
|
+
line2: string | null;
|
|
111
|
+
red: boolean;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* M9 am9 / am11: a run's Audit `schedule` section (one for every run of a job that has a schedule NOW; `null` when it has none). Folded head
|
|
115
|
+
* `<sign> <schedule words> · from run-7 · 2 tries started nothing`; unfolded rows `this run` and `tries` (stamp + words each).
|
|
116
|
+
* The schedule words are the SAME `line1` the Run tab's SCHEDULE block carries; the sign is `[▶]` while a run of the job is running, `[✗]` when that block is red, else `[·]` (am11).
|
|
117
|
+
* @param {{trigger: Trigger|null, runId: string, from: string|null, rec: any, startMs: number|null, block: {line1: string, red: boolean}, running: boolean, fires: any[]}} f
|
|
118
|
+
* `rec`: this run's trigger.json or null (a hand run); `fires`: every triggers.jsonl row of the job, across every signing.
|
|
119
|
+
* @returns {{sign: string, head: string, rows: Array<{label: string, stamp: string, text: string}>}|null}
|
|
120
|
+
*/
|
|
121
|
+
export function scheduleAuditWords(f: {
|
|
122
|
+
trigger: Trigger | null;
|
|
123
|
+
runId: string;
|
|
124
|
+
from: string | null;
|
|
125
|
+
rec: any;
|
|
126
|
+
startMs: number | null;
|
|
127
|
+
block: {
|
|
128
|
+
line1: string;
|
|
129
|
+
red: boolean;
|
|
130
|
+
};
|
|
131
|
+
running: boolean;
|
|
132
|
+
fires: any[];
|
|
133
|
+
}): {
|
|
134
|
+
sign: string;
|
|
135
|
+
head: string;
|
|
136
|
+
rows: Array<{
|
|
137
|
+
label: string;
|
|
138
|
+
stamp: string;
|
|
139
|
+
text: string;
|
|
140
|
+
}>;
|
|
141
|
+
} | null;
|
|
142
|
+
/**
|
|
143
|
+
* M11 am11 items 3-4: the Audit row that says why a card left Needs you: `removed from Needs you by you · 10/15 08:15`, or `removed from Needs you after 7 days`. `null` when it did not.
|
|
144
|
+
* @param {{by: 'you', at: string}|{by: 'age'}|null} left
|
|
145
|
+
*/
|
|
146
|
+
export function needsLeftWords(left: {
|
|
147
|
+
by: "you";
|
|
148
|
+
at: string;
|
|
149
|
+
} | {
|
|
150
|
+
by: "age";
|
|
151
|
+
} | null): string | null;
|
|
152
|
+
/** ENDED (am7 item 1): `10/14 08:16 · passed · Goal met.`. The stamp is the run's local end time; the word is the run's outcome word (none for a run ended on purpose). @param {string|null} at ISO @param {string|null} word @param {string} reason */
|
|
153
|
+
export function endedLineWords(at: string | null, word: string | null, reason: string): string;
|
|
154
|
+
/** M9 am8 item 3: the busy sentence, in the busy row of `triggers.jsonl` and in the SCHEDULE block. One owner; the scheduler writes it, the words read it. */
|
|
155
|
+
export const SCHEDULE_BUSY_SAY: "a run of this job was still working";
|
|
156
|
+
export function startedNothing(row: any): any;
|
|
157
|
+
/** M9 am9 item 4: at most this many `tries` show. */
|
|
158
|
+
export const SCHEDULE_TRIES_SHOWN: 7;
|
|
159
|
+
/** M9 am12: what a stopped run with no kept copy of its job says where Resume would be (a run made before runs kept one). The one owner of these words. */
|
|
160
|
+
export const NO_COPY_SAY: "This run started before runs kept their own copy of the job, so it cannot carry on. Start a new run.";
|
|
58
161
|
export type Trigger = import("./trigger-line.js").Trigger;
|
package/types/thinking.d.ts
CHANGED
|
@@ -19,6 +19,37 @@ export function worstThinkingStatus(statuses: Array<string | null | undefined>):
|
|
|
19
19
|
* @param {string|null} status @returns {string|null}
|
|
20
20
|
*/
|
|
21
21
|
export function thinkingSay(status: string | null): string | null;
|
|
22
|
+
/**
|
|
23
|
+
* M4d am26 items 1-2: the words after a try line in the Audit, from that try's audit-row `thinking` {asked, status} (am25). bareagent confirmed it
|
|
24
|
+
* ('applied'): `thinking on` / `thinking off`. Any other status: `thinkingSay`'s words above, the same ones Chat uses. A row with no `thinking` (before am25,
|
|
25
|
+
* or no model call) has no words: nothing is guessed.
|
|
26
|
+
* M4d am27: a row with a `thinking` record but no status (the model sent no reply: an error, the time limit, a Stop before the first reply) reads
|
|
27
|
+
* `thinking <asked> (no reply)`, from what was ASKED; the words never say thinking happened. Nothing asked (asked null) has no words.
|
|
28
|
+
* @param {{asked?: unknown, status?: unknown}|null|undefined} thinking @returns {string|null}
|
|
29
|
+
*/
|
|
30
|
+
export function thinkingTryWords(thinking: {
|
|
31
|
+
asked?: unknown;
|
|
32
|
+
status?: unknown;
|
|
33
|
+
} | null | undefined): string | null;
|
|
34
|
+
/**
|
|
35
|
+
* M4d am28 items 2-4 (replaces am26 item 3's words and the hidden row): the Job tab's Thinking value, from the run's own record
|
|
36
|
+
* (`boxOn` = the Chat "Thinking on" box as the run started). A run with no record (before am25) is `null` and reads `—`, never a guess from model.json.
|
|
37
|
+
* Words: bareloop's `thinkingJobText`.
|
|
38
|
+
* // borrowed-from: bareloop src/thinking.js@b79e7d9
|
|
39
|
+
* @param {boolean|null} boxOn
|
|
40
|
+
*/
|
|
41
|
+
export function thinkingRuleWords(boxOn: boolean | null): "—" | "always on" | "on retries";
|
|
42
|
+
/**
|
|
43
|
+
* M4d am25 item 1/2: the ONE owner of what thinking a step's model call asks for. Code decides, never the model.
|
|
44
|
+
* Box ticked (the job's Chat "Thinking on" box, kept with the job): every try 'on'. Box off: the 1st try 'off'; the 2nd and later tries 'on'.
|
|
45
|
+
* A step redone after a human Redo is numbered from its redo count (the runner's `attemptOffset`), so it is always a 2nd-or-later try and thinks 'on'.
|
|
46
|
+
* @param {{boxOn: boolean, attempt: number}} a the runner's 1-based attempt number for this step
|
|
47
|
+
* @returns {'on'|'off'}
|
|
48
|
+
*/
|
|
49
|
+
export function stepThinkingMode({ boxOn, attempt }: {
|
|
50
|
+
boxOn: boolean;
|
|
51
|
+
attempt: number;
|
|
52
|
+
}): "on" | "off";
|
|
22
53
|
/** The sentence under a greyed "Thinking on" box (amendment 7 item 2). */
|
|
23
54
|
export const THINKING_FIXED_SAY: "can't change this for this model";
|
|
24
55
|
/** The note beside the Chat "Thinking on" box, before any draft, for a model bareagent has not checked (M4d am11 item 2). */
|
package/types/trigger-clock.d.ts
CHANGED
|
@@ -20,17 +20,17 @@ export function due(schedule: Schedule, rows: ClockRow[], now: number): Due;
|
|
|
20
20
|
* @returns {number}
|
|
21
21
|
*/
|
|
22
22
|
export function nextSlot(schedule: Schedule, afterMs: number): number;
|
|
23
|
-
/** @param {string} file @returns {ClockRow[]} every row on disk, oldest first; a missing file is no rows. */
|
|
24
|
-
export function readRows(file: string): ClockRow[];
|
|
25
|
-
/** The trigger was set at `now`: no slot before this ever fires. @param {string} file @param {number} now */
|
|
26
|
-
export function armTrigger(file: string, now: number): void;
|
|
23
|
+
/** @param {string} file @param {string} [sig] M9 am20: only the rows of that schedule signing (the one schedule ledger carries every signing's rows); absent = every row @returns {ClockRow[]} every row on disk that parses, oldest first; a missing file is no rows; a line a crash tore mid-append is skipped (`appendOnce` starts each append on a fresh line, so it never glues onto the next row). */
|
|
24
|
+
export function readRows(file: string, sig?: string): ClockRow[];
|
|
25
|
+
/** The trigger was set at `now`: no slot before this ever fires. @param {string} file @param {number} now @param {string} [sig] */
|
|
26
|
+
export function armTrigger(file: string, now: number, sig?: string): void;
|
|
27
27
|
/**
|
|
28
28
|
* Record that the run for this due slot is starting. Call BEFORE starting the run: a crash loses a run, never doubles one.
|
|
29
|
-
* @param {string} file @param {Due} d the result of `due` with fire true @param {number} now
|
|
29
|
+
* @param {string} file @param {Due} d the result of `due` with fire true @param {number} now @param {string} [sig]
|
|
30
30
|
*/
|
|
31
|
-
export function recordFire(file: string, d: Due, now: number): void;
|
|
31
|
+
export function recordFire(file: string, d: Due, now: number, sig?: string): void;
|
|
32
32
|
/** @typedef {{kind:'daily'|'weekdays', hour:number, minute:number} | {kind:'weekly', day:string, hour:number, minute:number}} Schedule */
|
|
33
|
-
/** @typedef {{id:string, kind:'armed'|'fire', at:number, slot?:number, catchUp?:boolean, missed?:number}} ClockRow */
|
|
33
|
+
/** @typedef {{id:string, kind:'armed'|'fire', at:number, slot?:number, catchUp?:boolean, missed?:number, sig?:string}} ClockRow */
|
|
34
34
|
/** @typedef {{fire:boolean, catchUp:boolean, missed:number, slot?:number}} Due */
|
|
35
35
|
/** A slot seen MORE than this after its set time is a catch-up (M9 am2 item 1). Exactly this late is on time. */
|
|
36
36
|
export const GRACE_MS: 120000;
|
|
@@ -51,6 +51,7 @@ export type ClockRow = {
|
|
|
51
51
|
slot?: number;
|
|
52
52
|
catchUp?: boolean;
|
|
53
53
|
missed?: number;
|
|
54
|
+
sig?: string;
|
|
54
55
|
};
|
|
55
56
|
export type Due = {
|
|
56
57
|
fire: boolean;
|
package/types/trigger-files.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
/** @param {string} file @returns {SeenRow[]} */
|
|
2
|
-
export function readSeen(file: string): SeenRow[];
|
|
3
|
-
/** Arrived rows are never overwritten: the 2nd arrival of a sha (after a drop) gets its own id. @param {string} ledger @param {ToRun & {name?:string}} item @param {number} at the scheduler's clock, never the file's mtime */
|
|
1
|
+
/** Every row that parses; a line a crash tore mid-append is skipped (it counts as not written). `appendSeen` starts each append on a fresh line, so a torn line can never glue onto the next row. @param {string} file @param {string} [sig] M9 am20: only the rows of that schedule signing (the one schedule ledger carries every signing's rows); absent = every row @returns {SeenRow[]} */
|
|
2
|
+
export function readSeen(file: string, sig?: string): SeenRow[];
|
|
3
|
+
/** Arrived rows are never overwritten: the 2nd arrival of a sha (after a drop) gets its own id. @param {string} ledger @param {ToRun & {name?:string}} item @param {number} at the scheduler's clock, never the file's mtime @param {string} [sig] */
|
|
4
4
|
export function recordArrived(ledger: string, item: ToRun & {
|
|
5
5
|
name?: string;
|
|
6
|
-
}, at: number): boolean;
|
|
7
|
-
/** `of` = the arrived row it cancels (item.id when a queue row is passed). @param {string} ledger @param {{sha:string, path:string, size:number, id?:string}} item @param {'deleted'|'changed'} why @param {number} at */
|
|
6
|
+
}, at: number, sig?: string): boolean;
|
|
7
|
+
/** `of` = the arrived row it cancels (item.id when a queue row is passed). @param {string} ledger @param {{sha:string, path:string, size:number, id?:string}} item @param {'deleted'|'changed'|'schedule-changed'|'carried'} why @param {number} at @param {string} [sig] */
|
|
8
8
|
export function recordDropped(ledger: string, item: {
|
|
9
9
|
sha: string;
|
|
10
10
|
path: string;
|
|
11
11
|
size: number;
|
|
12
12
|
id?: string;
|
|
13
|
-
}, why: "deleted" | "changed", at: number): boolean;
|
|
13
|
+
}, why: "deleted" | "changed" | "schedule-changed" | "carried", at: number, sig?: string): boolean;
|
|
14
14
|
/**
|
|
15
15
|
* The queue: arrived and neither ran nor dropped, oldest arrival first. Identical arrival times: by name, then by sha (deterministic).
|
|
16
16
|
* @param {SeenRow[]} rows @returns {(SeenRow & {path:string})[]}
|
|
@@ -45,12 +45,18 @@ export function recheck(item: {
|
|
|
45
45
|
*/
|
|
46
46
|
export function checkTarget(mode: "new" | "updated", target: string): void;
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* M9 am16: does a trigger on this target still watch this file? New: the file sits directly in the same (real) folder. Updated: it is the same (real) file. False when the target cannot be resolved.
|
|
49
|
+
* @param {'new'|'updated'} mode @param {string} target @param {string} filePath a queued file's path as the watcher recorded it (a real path)
|
|
49
50
|
*/
|
|
50
|
-
export function
|
|
51
|
+
export function watches(mode: "new" | "updated", target: string, filePath: string): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* @param {{mode:'new'|'updated', target:string, ledger:string, sig?:string}} opts target = folder (new) or file (updated); `sig` (M9 am20) = the schedule signing every row this trigger reads and writes belongs to
|
|
54
|
+
*/
|
|
55
|
+
export function createFileTrigger({ mode, target, ledger, sig }: {
|
|
51
56
|
mode: "new" | "updated";
|
|
52
57
|
target: string;
|
|
53
58
|
ledger: string;
|
|
59
|
+
sig?: string;
|
|
54
60
|
}): {
|
|
55
61
|
arm: () => void;
|
|
56
62
|
poll: () => {
|
|
@@ -58,7 +64,7 @@ export function createFileTrigger({ mode, target, ledger }: {
|
|
|
58
64
|
refused: Refused[];
|
|
59
65
|
};
|
|
60
66
|
};
|
|
61
|
-
/** @typedef {{id:string, kind:'baseline'|'arrived'|'ran'|'dropped', sha:string, name:string, size:number, at:number, path?:string, why?:string, of?:string}} SeenRow */
|
|
67
|
+
/** @typedef {{id:string, kind:'baseline'|'arrived'|'ran'|'dropped', sha:string, name:string, size:number, at:number, path?:string, why?:string, of?:string, sig?:string}} SeenRow */
|
|
62
68
|
/** @typedef {{path:string, sha:string, size:number}} ToRun */
|
|
63
69
|
/** @typedef {{path:string, why:string}} Refused */
|
|
64
70
|
/** Consecutive polls with the same size and mtime before a file is taken. (Two matches in a row = taken on the third sighting.) */
|
|
@@ -67,7 +73,7 @@ export function recordRan(ledger: string, item: {
|
|
|
67
73
|
sha: string;
|
|
68
74
|
path: string;
|
|
69
75
|
size: number;
|
|
70
|
-
}, at: number): boolean;
|
|
76
|
+
}, at: number, sig?: string): boolean;
|
|
71
77
|
export type SeenRow = {
|
|
72
78
|
id: string;
|
|
73
79
|
kind: "baseline" | "arrived" | "ran" | "dropped";
|
|
@@ -78,6 +84,7 @@ export type SeenRow = {
|
|
|
78
84
|
path?: string;
|
|
79
85
|
why?: string;
|
|
80
86
|
of?: string;
|
|
87
|
+
sig?: string;
|
|
81
88
|
};
|
|
82
89
|
export type ToRun = {
|
|
83
90
|
path: string;
|
package/types/trigger-line.d.ts
CHANGED
|
@@ -14,20 +14,28 @@ export function parseTrigger(text: string): {
|
|
|
14
14
|
export function triggerLine(t: Trigger): string;
|
|
15
15
|
/** The prose without any trigger line. Everything else is byte-for-byte what it was. @param {string} prose */
|
|
16
16
|
export function stripTrigger(prose: string): string;
|
|
17
|
-
/**
|
|
18
|
-
* The ONE writer of the trigger line: the prose with its trigger line replaced by this trigger's (or removed for null). With no trigger
|
|
19
|
-
* in and none asked for, the text is returned unchanged. The arbiter block is last in a signed text, so the line goes at the end.
|
|
20
|
-
* @param {string} prose @param {Trigger|null} trigger
|
|
21
|
-
*/
|
|
22
|
-
export function proseWithTrigger(prose: string, trigger: Trigger | null): string;
|
|
23
17
|
/**
|
|
24
18
|
* What the human's second click carries: binds the job, the exact signature it was shown at and the trigger.
|
|
25
|
-
* @param {{flow: string, flowSignatureHash: string, trigger: Trigger|null}} a
|
|
19
|
+
* @param {{flow: string, flowSignatureHash: string, trigger: Trigger|null, model?: {slot: string, model: string}|null, destination?: string|null, inputs?: {role: string, path: string}[]|null, plan?: {run: string, flowHash: string, declSha: string}|null}} a
|
|
26
20
|
*/
|
|
27
|
-
export function triggerHash({ flow, flowSignatureHash, trigger }: {
|
|
21
|
+
export function triggerHash({ flow, flowSignatureHash, trigger, model, destination, inputs, plan }: {
|
|
28
22
|
flow: string;
|
|
29
23
|
flowSignatureHash: string;
|
|
30
24
|
trigger: Trigger | null;
|
|
25
|
+
model?: {
|
|
26
|
+
slot: string;
|
|
27
|
+
model: string;
|
|
28
|
+
} | null;
|
|
29
|
+
destination?: string | null;
|
|
30
|
+
inputs?: {
|
|
31
|
+
role: string;
|
|
32
|
+
path: string;
|
|
33
|
+
}[] | null;
|
|
34
|
+
plan?: {
|
|
35
|
+
run: string;
|
|
36
|
+
flowHash: string;
|
|
37
|
+
declSha: string;
|
|
38
|
+
} | null;
|
|
31
39
|
}): string;
|
|
32
40
|
export function isTriggerLine(line: string): boolean;
|
|
33
41
|
/** M9: the file a triggered start writes (once, before the spawn) into the run's own folder: why this run started. `appendHistory` copies it into the run's history row. */
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** The size words of a byte count: `412 B`, `7.9 KB`, `1.2 MB`. @param {number} n */
|
|
2
|
+
export function sizeWords(n: number): string;
|
|
3
|
+
/** #2, the model's own `done`. @param {{verdict: 'done'|'not-done'}} doneCheck @param {unknown} artifact */
|
|
4
|
+
export function doneRecord(doneCheck: {
|
|
5
|
+
verdict: "done" | "not-done";
|
|
6
|
+
}, artifact: unknown): {
|
|
7
|
+
n: number;
|
|
8
|
+
text: string;
|
|
9
|
+
ok: boolean;
|
|
10
|
+
result: string | null;
|
|
11
|
+
source: string;
|
|
12
|
+
};
|
|
13
|
+
/** #1, the happened check: the output exists and is not empty. @param {{verdict: string, red?: string}} happened @param {unknown} artifact */
|
|
14
|
+
export function happenedRecord(happened: {
|
|
15
|
+
verdict: string;
|
|
16
|
+
red?: string;
|
|
17
|
+
}, artifact: unknown): {
|
|
18
|
+
n: number;
|
|
19
|
+
text: string;
|
|
20
|
+
ok: boolean;
|
|
21
|
+
result: string;
|
|
22
|
+
source: string;
|
|
23
|
+
};
|
|
24
|
+
/** The output a try judged: the file it is saved as when the step closes, with the size and sha256 of those exact bytes. Never its content. @param {{emits?: string}} step @param {unknown} artifact */
|
|
25
|
+
export function outputRecord(step: {
|
|
26
|
+
emits?: string;
|
|
27
|
+
}, artifact: unknown): {
|
|
28
|
+
file: string;
|
|
29
|
+
bytes: number;
|
|
30
|
+
sha256: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* #3 and up: the close's own checks. A softgreen close carries each of its checks; a green close is one check over all its cited fields; a close that
|
|
34
|
+
* judged nothing (`unparseable`, `crash`) is one check that could not run, with that third outcome as its result.
|
|
35
|
+
* @param {any} step @param {any} artifact @param {{verdict: string, red?: string|null, checks?: Array<{text:string, ok:boolean, result:string|null}>}} closed
|
|
36
|
+
*/
|
|
37
|
+
export function closeRecords(step: any, artifact: any, closed: {
|
|
38
|
+
verdict: string;
|
|
39
|
+
red?: string | null;
|
|
40
|
+
checks?: Array<{
|
|
41
|
+
text: string;
|
|
42
|
+
ok: boolean;
|
|
43
|
+
result: string | null;
|
|
44
|
+
}>;
|
|
45
|
+
}): {
|
|
46
|
+
n: number;
|
|
47
|
+
text: string;
|
|
48
|
+
ok: boolean;
|
|
49
|
+
result: string | null;
|
|
50
|
+
source: string;
|
|
51
|
+
}[];
|
|
52
|
+
export const EVERY_STEP: "every step";
|
|
53
|
+
export function lineSource(step: {
|
|
54
|
+
fromLine?: unknown;
|
|
55
|
+
}): string;
|
package/types/types.d.ts
CHANGED
|
@@ -95,7 +95,7 @@ export type Arbiter = {
|
|
|
95
95
|
*/
|
|
96
96
|
roundBudgetMs: number;
|
|
97
97
|
/**
|
|
98
|
-
* - `trigger <kind> ...` (M9). Default null = By hand.
|
|
98
|
+
* - `trigger <kind> ...` (M9). Default null = By hand. M9 am20: read for jobs signed before, NEVER acted on (a schedule is `schedule.json`).
|
|
99
99
|
*/
|
|
100
100
|
trigger: import("./trigger-line.js").Trigger | null;
|
|
101
101
|
};
|
|
@@ -277,6 +277,15 @@ export type CloseVerdict = {
|
|
|
277
277
|
verdict: "green" | "red" | "hitl" | "unparseable" | "crash";
|
|
278
278
|
red?: string | null | undefined;
|
|
279
279
|
reds?: string[] | undefined;
|
|
280
|
+
/**
|
|
281
|
+
* a softgreen close: every check it ran (M4d am29 item 2)
|
|
282
|
+
*/
|
|
283
|
+
checks?: {
|
|
284
|
+
id: string;
|
|
285
|
+
text: string;
|
|
286
|
+
ok: boolean;
|
|
287
|
+
result: string | null;
|
|
288
|
+
}[] | undefined;
|
|
280
289
|
};
|
|
281
290
|
/**
|
|
282
291
|
* One row appended to `runs/<run-id>/audit.jsonl` (M2 scope item 9).
|