fwdloop 0.38.0 → 0.39.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 +21 -19
- package/package.json +1 -1
- package/src/ask.js +70 -148
- package/src/audit-fold.js +5 -4
- package/src/auditchecks.js +6 -4
- package/src/authoring.js +32 -60
- package/src/blockasks.js +2 -1
- package/src/blockassemble.js +3 -2
- package/src/blockdraft.js +2 -2
- package/src/blockpick.js +5 -5
- package/src/books.js +217 -12
- package/src/checkblock.js +20 -41
- package/src/checklistsign.js +25 -3
- package/src/checklook.js +3 -1
- package/src/checkpick.js +5 -76
- package/src/cited-source.js +4 -4
- package/src/citedcheck.js +6 -11
- package/src/citedwords.js +9 -8
- package/src/closers.js +9 -6
- package/src/declaration.js +14 -49
- package/src/diary.js +23 -1
- package/src/draft-steps.js +11 -1
- package/src/drafter.js +13 -9
- package/src/draftfiles.js +127 -0
- package/src/draftspend.js +165 -17
- package/src/flow.js +42 -87
- package/src/flowmodel.js +1 -1
- package/src/index.js +3 -2
- package/src/inside.js +86 -0
- package/src/jsonl-append.js +33 -1
- package/src/learn.js +1 -1
- package/src/learnstore.js +20 -22
- package/src/line-checks.js +1 -1
- package/src/liveness.js +3 -0
- package/src/mcp-use.js +8 -9
- package/src/memo.js +13 -16
- package/src/model-step.js +2 -2
- package/src/page-words.js +8 -0
- package/src/pageask.js +8 -3
- package/src/pagebits.js +8 -1
- package/src/pagedropwords.js +1 -1
- package/src/pagerules.js +6 -3
- package/src/panel/author.js +99 -75
- package/src/panel/authorcard.js +21 -8
- package/src/panel/authorflows.js +3 -3
- package/src/panel/authorresume.js +3 -3
- package/src/panel/authorstart.js +15 -16
- package/src/panel/authortrigger.js +43 -70
- package/src/panel/data.js +125 -168
- package/src/panel/index.html +122 -61
- package/src/panel/jobgrid.js +3 -7
- package/src/panel/result.js +7 -10
- package/src/panel/resume.js +4 -3
- package/src/panel/scheduler.js +9 -9
- package/src/panel/server.js +8 -4
- package/src/panel/spawn.js +22 -11
- package/src/panel/tickets.js +2 -2
- package/src/pickrecord.js +51 -31
- package/src/placerule.js +3 -4
- package/src/planrebuild.js +19 -19
- package/src/primitives.js +1 -1
- package/src/provider.js +1 -1
- package/src/reasons.js +25 -0
- package/src/runfile.js +26 -2
- package/src/runner.js +57 -105
- package/src/runvalues.js +47 -24
- package/src/schedule-choices.js +41 -0
- package/src/schedule-shape.js +39 -0
- package/src/schedule.js +9 -8
- package/src/setup.js +20 -36
- package/src/shaperows.js +2 -2
- package/src/sheetblock.js +2 -2
- package/src/sheetbuild.js +5 -5
- package/src/sheetrun.js +4 -5
- package/src/summary-words.js +2 -1
- package/src/thinking.js +5 -2
- package/src/ticketrows.js +7 -28
- package/src/trigger-clock.js +9 -23
- package/src/trigger-files.js +30 -22
- package/src/trigger-tickets.js +15 -14
- package/src/try-checks.js +2 -1
- package/src/types.js +2 -0
- package/types/ask.d.ts +25 -20
- package/types/authoring.d.ts +7 -42
- package/types/blockpick.d.ts +1 -1
- package/types/books.d.ts +256 -4
- package/types/checkblock.d.ts +1 -23
- package/types/checklist.d.ts +3 -3
- package/types/checklistsign.d.ts +7 -0
- package/types/checkpick.d.ts +0 -21
- package/types/citedwords.d.ts +7 -4
- package/types/closers.d.ts +1 -0
- package/types/declaration.d.ts +4 -14
- package/types/diary.d.ts +14 -1
- package/types/draft-steps.d.ts +7 -0
- package/types/drafter.d.ts +1 -1
- package/types/draftfiles.d.ts +89 -0
- package/types/draftspend.d.ts +74 -0
- package/types/flow.d.ts +32 -54
- package/types/index.d.ts +3 -3
- package/types/inside.d.ts +58 -0
- package/types/jsonl-append.d.ts +20 -0
- package/types/learnstore.d.ts +0 -2
- package/types/liveness.d.ts +1 -0
- package/types/page-words.d.ts +6 -0
- package/types/pageask.d.ts +2 -0
- package/types/pagebits.d.ts +3 -0
- package/types/pagerules.d.ts +1 -0
- package/types/panel/author.d.ts +7 -3
- package/types/panel/authorcard.d.ts +0 -6
- package/types/panel/authorflows.d.ts +4 -4
- package/types/panel/authortrigger.d.ts +16 -2
- package/types/panel/data.d.ts +36 -11
- package/types/panel/spawn.d.ts +18 -2
- package/types/pickrecord.d.ts +29 -0
- package/types/reasons.d.ts +23 -0
- package/types/runfile.d.ts +14 -0
- package/types/runner.d.ts +6 -38
- package/types/runvalues.d.ts +17 -2
- package/types/schedule-choices.d.ts +9 -0
- package/types/schedule-shape.d.ts +15 -0
- package/types/sheetbuild.d.ts +1 -1
- package/types/thinking.d.ts +1 -0
- package/types/ticketrows.d.ts +0 -9
- package/types/trigger-clock.d.ts +3 -2
- package/types/trigger-files.d.ts +15 -4
- package/types/types.d.ts +8 -0
package/types/pagerules.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ export function applyPageRules(text: string, mapping: PageMap, jobLines: {
|
|
|
48
48
|
facts: KeptFact[];
|
|
49
49
|
dropped: Dropped[];
|
|
50
50
|
};
|
|
51
|
+
export function canReadLimit(shape: unknown): shape is "money" | "time";
|
|
51
52
|
export function linesOf(text: string): string[];
|
|
52
53
|
/**
|
|
53
54
|
* what a `~` rule means as a limit (PRD v1.107 Part 5b): the same shape as a signed fact rule
|
package/types/panel/author.d.ts
CHANGED
|
@@ -201,7 +201,7 @@ export function createAuthor(opts: {
|
|
|
201
201
|
flowHash: string;
|
|
202
202
|
sig: string | null;
|
|
203
203
|
armed: boolean;
|
|
204
|
-
armedAt:
|
|
204
|
+
armedAt: any;
|
|
205
205
|
nextSlotMs: number | null;
|
|
206
206
|
lastOutcome: any;
|
|
207
207
|
hasGreenRun: boolean;
|
|
@@ -223,7 +223,7 @@ export function createAuthor(opts: {
|
|
|
223
223
|
flowHash: string;
|
|
224
224
|
sig: string | null;
|
|
225
225
|
armed: boolean;
|
|
226
|
-
armedAt:
|
|
226
|
+
armedAt: any;
|
|
227
227
|
nextSlotMs: number | null;
|
|
228
228
|
lastOutcome: any;
|
|
229
229
|
hasGreenRun: boolean;
|
|
@@ -450,7 +450,7 @@ export function createAuthor(opts: {
|
|
|
450
450
|
body: any;
|
|
451
451
|
};
|
|
452
452
|
/**
|
|
453
|
-
* `POST /api/author/:id/abandon`: stop the child (by its recorded pid, only after `
|
|
453
|
+
* `POST /api/author/:id/abandon`: stop the child (by its recorded pid, only after `childState` says it is ours),
|
|
454
454
|
* confirm it is gone, then write `abandoned.json`. No further model call; the spend already booked stays booked.
|
|
455
455
|
* @param {string} id
|
|
456
456
|
*/
|
|
@@ -485,4 +485,8 @@ export function createAuthor(opts: {
|
|
|
485
485
|
};
|
|
486
486
|
/** 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). */
|
|
487
487
|
export const MAX_REVISES: 2;
|
|
488
|
+
/** M20 am8a: the phases in which a revise or the redraft after the human's answers is running over an existing plan (a first draft is `drafting`: another refusal). The panel hands the list to the page. */
|
|
489
|
+
export const REVISE_PHASES: readonly string[];
|
|
490
|
+
/** M20 am8a: the phases where the draft ended not green, red or stopped (the card is open to fix and draft again). The panel hands the list to the page. */
|
|
491
|
+
export const NOT_GREEN_PHASES: readonly string[];
|
|
488
492
|
import { thinkingSupport as bareagentThinkingSupport } from '../thinking.js';
|
|
@@ -110,13 +110,7 @@ export function parseInputLines(text: string): {
|
|
|
110
110
|
*/
|
|
111
111
|
export function cardFields(body: any): {
|
|
112
112
|
schedule?: {
|
|
113
|
-
kind: string;
|
|
114
|
-
hour?: undefined;
|
|
115
|
-
minute?: undefined;
|
|
116
|
-
} | {
|
|
117
113
|
kind: any;
|
|
118
|
-
hour: any;
|
|
119
|
-
minute: any;
|
|
120
114
|
} | undefined;
|
|
121
115
|
flowType?: string | undefined;
|
|
122
116
|
mcp?: string | undefined;
|
|
@@ -95,7 +95,7 @@ export function createFlowsDoor(opts: {
|
|
|
95
95
|
} | {
|
|
96
96
|
ok: boolean;
|
|
97
97
|
card: {
|
|
98
|
-
flowType?: "
|
|
98
|
+
flowType?: "mcp" | "plain" | "tickets" | undefined;
|
|
99
99
|
mcp?: any;
|
|
100
100
|
job: string;
|
|
101
101
|
inputs: string;
|
|
@@ -123,7 +123,7 @@ export function createFlowsDoor(opts: {
|
|
|
123
123
|
roles: any;
|
|
124
124
|
pages: Record<string, string>;
|
|
125
125
|
tickets: string[];
|
|
126
|
-
flowType: "
|
|
126
|
+
flowType: "mcp" | "plain" | "tickets";
|
|
127
127
|
mcp: any;
|
|
128
128
|
nextRunId: string;
|
|
129
129
|
lastRunId: string | null;
|
|
@@ -188,7 +188,7 @@ export function createFlowsDoor(opts: {
|
|
|
188
188
|
} | {
|
|
189
189
|
ok: boolean;
|
|
190
190
|
card: {
|
|
191
|
-
flowType?: "
|
|
191
|
+
flowType?: "mcp" | "plain" | "tickets" | undefined;
|
|
192
192
|
mcp?: any;
|
|
193
193
|
job: string;
|
|
194
194
|
inputs: string;
|
|
@@ -216,7 +216,7 @@ export function createFlowsDoor(opts: {
|
|
|
216
216
|
roles: any;
|
|
217
217
|
pages: Record<string, string>;
|
|
218
218
|
tickets: string[];
|
|
219
|
-
flowType: "
|
|
219
|
+
flowType: "mcp" | "plain" | "tickets";
|
|
220
220
|
mcp: any;
|
|
221
221
|
nextRunId: string;
|
|
222
222
|
lastRunId: string | null;
|
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
export function readOutcomes(flowDir: string): any[];
|
|
3
3
|
/** The ONE writer of `triggers.jsonl`: append-only, one line per fire outcome. @param {string} flowDir @param {Record<string, any>} row */
|
|
4
4
|
export function appendOutcome(flowDir: string, row: Record<string, any>): void;
|
|
5
|
+
/**
|
|
6
|
+
* M9 item 1 and 2: the runs that count as "one green run" for this job, in run-name order. THE decider: a passed run counts when the job it ran (its own
|
|
7
|
+
* `job/` copy) is the job as it is now (prose and declaration, byte for byte: a schedule is its own file, so setting one never changes the job).
|
|
8
|
+
* A run from before runs kept a job copy has none to compare, so it counts only when its history row's signature is the job's current one.
|
|
9
|
+
* @param {string} flowDir @returns {Generator<{runId: string, runDir: string, at: string}>}
|
|
10
|
+
*/
|
|
11
|
+
export function greenRuns(flowDir: string): Generator<{
|
|
12
|
+
runId: string;
|
|
13
|
+
runDir: string;
|
|
14
|
+
at: string;
|
|
15
|
+
}>;
|
|
5
16
|
/** M9 item 1 and 2: does this job have "one green run"? @param {string} flowDir */
|
|
6
17
|
export function hasGreenRunForJob(flowDir: string): boolean;
|
|
7
18
|
/**
|
|
@@ -239,7 +250,7 @@ export function createTriggerDoor(opts: {
|
|
|
239
250
|
flowHash: string;
|
|
240
251
|
sig: string | null;
|
|
241
252
|
armed: boolean;
|
|
242
|
-
armedAt:
|
|
253
|
+
armedAt: any;
|
|
243
254
|
nextSlotMs: number | null;
|
|
244
255
|
lastOutcome: any;
|
|
245
256
|
hasGreenRun: boolean;
|
|
@@ -267,7 +278,7 @@ export function createTriggerDoor(opts: {
|
|
|
267
278
|
flowHash: string;
|
|
268
279
|
sig: string | null;
|
|
269
280
|
armed: boolean;
|
|
270
|
-
armedAt:
|
|
281
|
+
armedAt: any;
|
|
271
282
|
nextSlotMs: number | null;
|
|
272
283
|
lastOutcome: any;
|
|
273
284
|
hasGreenRun: boolean;
|
|
@@ -296,3 +307,6 @@ export const TICKET_LOOK_TOOL: "list_issues";
|
|
|
296
307
|
export const NO_GREEN_SAY: "This job has not had a good run yet. Run it once by hand and get it right first; then you can set when it runs. Nothing was changed.";
|
|
297
308
|
export type Trigger = import("../trigger-line.js").Trigger;
|
|
298
309
|
export type Schedule = import("../schedule.js").Schedule;
|
|
310
|
+
export type FileTrigger = Extract<Trigger, {
|
|
311
|
+
kind: "file-updated" | "new-file";
|
|
312
|
+
}>;
|
package/types/panel/data.d.ts
CHANGED
|
@@ -40,17 +40,16 @@ export function resolveFlowDir(root: string, flowName: string): {
|
|
|
40
40
|
*/
|
|
41
41
|
export function hasConsumedAnswer(runDir: string, askId: string | null): boolean;
|
|
42
42
|
/**
|
|
43
|
-
* M4b piece 2: a SAVED, not-yet-consumed answer
|
|
44
|
-
* `
|
|
45
|
-
* through `readFileInside` (a symlinked file is "none"). `null` when there is
|
|
46
|
-
* none or it is unreadable/unparseable or names no askId.
|
|
43
|
+
* M4b piece 2: a SAVED, not-yet-consumed answer, as the panel shows it: `readSavedAnswer` (src/books.js, the one reader) read for an answer that names an ask.
|
|
44
|
+
* `null` when there is none or it is unreadable, unparseable or names no askId. `broken` is the reader's own field (M20 am3b item 1).
|
|
47
45
|
* @param {string} runDir
|
|
48
|
-
* @returns {{askId: string, decision: string|null, answeredAt: string|null}|null}
|
|
46
|
+
* @returns {{askId: string, decision: string|null, answeredAt: string|null, broken: boolean}|null}
|
|
49
47
|
*/
|
|
50
|
-
export function
|
|
48
|
+
export function savedAnswerOf(runDir: string): {
|
|
51
49
|
askId: string;
|
|
52
50
|
decision: string | null;
|
|
53
51
|
answeredAt: string | null;
|
|
52
|
+
broken: boolean;
|
|
54
53
|
} | null;
|
|
55
54
|
/**
|
|
56
55
|
* M4b amendment 1 scope 2: the ONE derivation of "answer saved, resume not
|
|
@@ -62,7 +61,7 @@ export function readSavedAnswer(runDir: string): {
|
|
|
62
61
|
* answer for that ask that was NOT saved in time, once the deadline has passed, is not a resumable answer: it reads
|
|
63
62
|
* as none, so the ask is expired and offers the reopen (M4c-fix amendment 1 (b)). One with no readable time, before
|
|
64
63
|
* the deadline, reads `broken` (amendment 1 (a)).
|
|
65
|
-
* @param {{savedAnswer: {askId:string, decision:string|null, answeredAt?:string|null}|null, attempt: any, ask?: any}} ctx
|
|
64
|
+
* @param {{savedAnswer: {askId:string, decision:string|null, answeredAt?:string|null, broken?: boolean}|null, attempt: any, ask?: any}} ctx
|
|
66
65
|
* @returns {{state: 'starting'|'not-started'|'broken'|'took-over', askId: string|null, tries: number|null, maxTries: number|null, reason: string|null, label: string}|null}
|
|
67
66
|
*/
|
|
68
67
|
export function deriveResumeState({ savedAnswer: savedOnDisk, attempt, ask }: {
|
|
@@ -70,6 +69,7 @@ export function deriveResumeState({ savedAnswer: savedOnDisk, attempt, ask }: {
|
|
|
70
69
|
askId: string;
|
|
71
70
|
decision: string | null;
|
|
72
71
|
answeredAt?: string | null;
|
|
72
|
+
broken?: boolean;
|
|
73
73
|
} | null;
|
|
74
74
|
attempt: any;
|
|
75
75
|
ask?: any;
|
|
@@ -86,10 +86,13 @@ export function deriveResumeState({ savedAnswer: savedOnDisk, attempt, ask }: {
|
|
|
86
86
|
* opens with the word ("stuck — …") or is the word itself ("passed") loses that repeat, so it is never said twice.
|
|
87
87
|
* `noWord`: a run the human ended on purpose with rerun wears `[✗]` but is never called "failed" (M4b amendment 3),
|
|
88
88
|
* so it shows its plain line alone.
|
|
89
|
-
* @param {string} glyph a `computeGlyph` sign @param {string} label its plain line @param {boolean} [noWord]
|
|
89
|
+
* @param {string} glyph a `computeGlyph` sign @param {string} label its plain line @param {boolean} [noWord] @param {{outcome: string|null|undefined, resumable: boolean}|null} [ending] the run's end row outcome and whether it can be continued
|
|
90
90
|
* @returns {{word: string|null, line: string|null}}
|
|
91
91
|
*/
|
|
92
|
-
export function signParts(glyph: string, label: string, noWord?: boolean
|
|
92
|
+
export function signParts(glyph: string, label: string, noWord?: boolean, ending?: {
|
|
93
|
+
outcome: string | null | undefined;
|
|
94
|
+
resumable: boolean;
|
|
95
|
+
} | null): {
|
|
93
96
|
word: string | null;
|
|
94
97
|
line: string | null;
|
|
95
98
|
};
|
|
@@ -316,7 +319,22 @@ export function deriveAuditToolsPhrase(row: any): string | null;
|
|
|
316
319
|
* @returns {string|null}
|
|
317
320
|
*/
|
|
318
321
|
export function deriveAuditAtWhy(row: any): string | null;
|
|
319
|
-
|
|
322
|
+
/**
|
|
323
|
+
* hamr's 2026-09-27 exit-check review #2: the Audit tab's Blocked filter —
|
|
324
|
+
* ONE server-side function naming exactly which verdicts count as "did not
|
|
325
|
+
* pass", derived strictly from a row's own `verdict` string (never a second,
|
|
326
|
+
* client-side guess). Blocked: `not-done`, `red` (a mechanical close miss OR
|
|
327
|
+
* a human's own redo on a hitl step — both are "this attempt did not
|
|
328
|
+
* pass"), `refused` (a blank redo/rerun reason), `ask-timeout` and
|
|
329
|
+
* `ask-expired` (the human never answered in time), `cap-halt`,
|
|
330
|
+
* `provider-red`, `pricing-red`, `close-casualty` (every other halt shape
|
|
331
|
+
* `src/runner.js` records). NOT blocked: `green`/`hitl` (passed), `paused`
|
|
332
|
+
* (still open — waiting, not yet failed), `stale-answer-ignored` (a book
|
|
333
|
+
* hygiene note about a late answer, not an attempt outcome).
|
|
334
|
+
* @param {string|null|undefined} verdict
|
|
335
|
+
* @returns {boolean}
|
|
336
|
+
*/
|
|
337
|
+
export function isBlockedVerdict(verdict: string | null | undefined): boolean;
|
|
320
338
|
/**
|
|
321
339
|
* One mark per try, in try order — mirrors `computeTryCount`'s own pairing
|
|
322
340
|
* exactly (a `hitl` step's `paused` row plus its next resolving row is ONE
|
|
@@ -582,6 +600,12 @@ export function listScheduled({ root, triggerRead, now, home, rows, }: {
|
|
|
582
600
|
words: string;
|
|
583
601
|
runId: string | null;
|
|
584
602
|
}[];
|
|
603
|
+
/**
|
|
604
|
+
* M20 am1 item 8: the Run tab's NOW row, "AI working · M:SS", only while the run is live (`[▶]`, no end row) and a model step's try is running: the newest
|
|
605
|
+
* `try-start` row has no audit row written at or after it. Anything else is null (nothing is made up between tries). The time moves in 30 s steps (`stepped`).
|
|
606
|
+
* @param {any} ctx `loadRunContext`'s result @param {string} glyph `computeGlyph`'s sign @param {number} nowMs @returns {string|null}
|
|
607
|
+
*/
|
|
608
|
+
export function nowOf(ctx: any, glyph: string, nowMs: number): string | null;
|
|
585
609
|
/**
|
|
586
610
|
* `GET /api/runs/:flow/:runId` — the Run tab (M4a scope item 2): the step
|
|
587
611
|
* map from `declaration.steps`, step cards -> attempts from `audit.jsonl`
|
|
@@ -787,7 +811,7 @@ export function getJobGrid({ root, flow, catalogue, now, }: {
|
|
|
787
811
|
spentUsd: number | null;
|
|
788
812
|
spentComplete: boolean;
|
|
789
813
|
};
|
|
790
|
-
flowType: "
|
|
814
|
+
flowType: "mcp" | "plain" | "tickets" | null;
|
|
791
815
|
} | null;
|
|
792
816
|
/**
|
|
793
817
|
* `GET /api/runs/:flow/:runId/download?i=<n>` (M10 am4): one saved file, or why not.
|
|
@@ -927,6 +951,7 @@ export function inboxOpenCount(rows: any[]): number;
|
|
|
927
951
|
/** What the `resume` field says when the panel has no attempt record for a run
|
|
928
952
|
* (it restarted since the answer was saved) — said so, never blank. */
|
|
929
953
|
export const RESUME_REASON_UNKNOWN: "reason unknown: the panel restarted, so it has no record of the resume attempt";
|
|
954
|
+
export function answerPickedUp(resume: any, askId: unknown): boolean;
|
|
930
955
|
export const WAITING_LABEL: "waiting on you (parked, unanswered)";
|
|
931
956
|
export const STUCK_LABEL: "stuck \u2014 your answer is saved; the run stopped before using it";
|
|
932
957
|
export const STUCK_LOCK_LABEL: "stuck \u2014 an old resume lock is in the way";
|
package/types/panel/spawn.d.ts
CHANGED
|
@@ -14,8 +14,24 @@ export function spawnDetached({ bin, argv, env, logPath, }: {
|
|
|
14
14
|
* @param {string} dir @param {import('node:child_process').ChildProcess} child
|
|
15
15
|
*/
|
|
16
16
|
export function writePidFile(dir: string, child: import("node:child_process").ChildProcess): void;
|
|
17
|
-
/**
|
|
18
|
-
|
|
17
|
+
/**
|
|
18
|
+
* M20 am3 item 8: the ONE owner of "is the draft/start child alive": the child recorded in `<dir>/pid.json` (null when none is
|
|
19
|
+
* recorded) and whether it is ours and running now: true / false, or null when it cannot be told (no /proc). `childRunning` and the
|
|
20
|
+
* draft door's abandon both ask it.
|
|
21
|
+
* @param {string} dir
|
|
22
|
+
* @returns {{pid: number, procStart: string|null, startedAt: unknown, alive: boolean|null}|null}
|
|
23
|
+
*/
|
|
24
|
+
export function childState(dir: string): {
|
|
25
|
+
pid: number;
|
|
26
|
+
procStart: string | null;
|
|
27
|
+
startedAt: unknown;
|
|
28
|
+
alive: boolean | null;
|
|
29
|
+
} | null;
|
|
30
|
+
/** The same question again for a child `childState` returned (the abandon loop asks it after each signal). @param {{pid: number, procStart: string|null}} child @returns {boolean|null} */
|
|
31
|
+
export function childAlive(child: {
|
|
32
|
+
pid: number;
|
|
33
|
+
procStart: string | null;
|
|
34
|
+
}): boolean | null;
|
|
19
35
|
/**
|
|
20
36
|
* Is the child recorded in `<dir>/pid.json` running? true / false, never null: no pid.json = nothing known to be running =
|
|
21
37
|
* false; a liveness that cannot be told (no /proc) reads as running only while pid.json is fresh (M4c's rule).
|
package/types/pickrecord.d.ts
CHANGED
|
@@ -132,6 +132,35 @@ export function columnsOnLines(entries: {
|
|
|
132
132
|
word: string;
|
|
133
133
|
column: string;
|
|
134
134
|
}[];
|
|
135
|
+
/**
|
|
136
|
+
* M20 am3e item 19: the record's `kept` list, the ONE reader (the plan card, the setup row and the sign-time card check all ask it). `kept` is the list as written, or null
|
|
137
|
+
* when there is none to read (no file, refused by the gateway, not a JSON object, no list). `torn` tells an unreadable record from an empty one: the file was read and
|
|
138
|
+
* is not JSON. The sign-time card check skips on a torn record; the other two read it as no list.
|
|
139
|
+
* @param {string} dir the folder that holds the plan folder @param {string} [rel] `draft`, `draft-<n>` or `.` (the plan folder itself)
|
|
140
|
+
* @returns {{kept: any[]|null, torn: boolean}}
|
|
141
|
+
*/
|
|
142
|
+
export function readKept(dir: string, rel?: string): {
|
|
143
|
+
kept: any[] | null;
|
|
144
|
+
torn: boolean;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* M20 am4: the counts the person switched on with Add, from the plan's `rowChoices` (the entries `readRowChoices` gives, or the block's own `choicesRecord()`): a set of
|
|
148
|
+
* `<line>:min:<n>` / `<line>:max:<n>` strings, one per number of an Added `count.<min>-<max>` row, the line found by its words as the record ties it. The count check
|
|
149
|
+
* (src/citedwords.js `countReds`) reads a number in this set as said: the Add says it.
|
|
150
|
+
* @param {{lineWords: string, occurrence: number, tail: string, choice: string}[]|null|undefined} entries @param {{n: number, text: string}[]} lines @returns {Set<string>}
|
|
151
|
+
*/
|
|
152
|
+
export function addedCountsOf(entries: {
|
|
153
|
+
lineWords: string;
|
|
154
|
+
occurrence: number;
|
|
155
|
+
tail: string;
|
|
156
|
+
choice: string;
|
|
157
|
+
}[] | null | undefined, lines: {
|
|
158
|
+
n: number;
|
|
159
|
+
text: string;
|
|
160
|
+
}[]): Set<string>;
|
|
161
|
+
/** M20 am8: the one list of a person's row choices on the plan card, and the one question "is this a legal Drop or Add choice" (the row-edit door, the record's reader and the check block ask it) */
|
|
162
|
+
export const ROW_CHOICES: readonly string[];
|
|
163
|
+
export function isRowChoice(choice: unknown): boolean;
|
|
135
164
|
/** the record's file, inside a drafting folder only (never a run folder) */
|
|
136
165
|
export const RECORD_FILE: "picks-record.json";
|
|
137
166
|
/** the exact words a kept pick is marked with in the draft log, the Audit and the plan card (M10 am17 (6)) */
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** the plain reasons code gives, in one place (the card, the Job tab and the Audit read them from the row) */
|
|
2
|
+
export const REASON: Readonly<{
|
|
3
|
+
left: "You chose to leave it Not checked, so you judge it at Accept.";
|
|
4
|
+
nothingOnPage: "Your own words are on the line; the machine has no check for them, so you judge it at Accept.";
|
|
5
|
+
noRule: "No rule can check this, so you judge it at Accept.";
|
|
6
|
+
waitingPick: "waiting for your answer on the proposed check";
|
|
7
|
+
waitingReading: "waiting for your answer on the reading";
|
|
8
|
+
onePerLine: "this line finds facts, so it has no text to quote";
|
|
9
|
+
manyInputs: "the job has more than one input and code cannot pick which one the claims quote";
|
|
10
|
+
oneSidedTime: "a time limit the AI proposes must be a range, so you judge it at Accept.";
|
|
11
|
+
countNeedsFact: "a result count needs a fact to count; this line has none";
|
|
12
|
+
countNeedsSuggested: "a result count needs a fact to count; add the suggested fact on this line to count its results";
|
|
13
|
+
lookNoWords: "the page does not hold the words of the look's fact for this rule";
|
|
14
|
+
afterLast: "no more tries: Start over (rows are never changed by the AI after the last try)";
|
|
15
|
+
noPick: "No check was picked for it, so you judge it at Accept.";
|
|
16
|
+
itemCountByRule: "your rule on this line sets the item count";
|
|
17
|
+
negated: "it says what is not needed, so there is nothing to check";
|
|
18
|
+
dropped: "You dropped it.";
|
|
19
|
+
suggested: "Suggested: not in your job, so it is not checked unless you add it.";
|
|
20
|
+
sheetLine: "this line reads a sheet and its rules are checked by the sheet checks, so a row edit about it is not used";
|
|
21
|
+
sheetFacts: "this line reads a sheet, so it is checked by its sheet checks and not by page facts";
|
|
22
|
+
columnRule: "this rule only names a column; the agent's checks on this line use it";
|
|
23
|
+
}>;
|
package/types/runfile.d.ts
CHANGED
|
@@ -10,6 +10,11 @@ export function readRunRecord(runDir: string | null): {
|
|
|
10
10
|
code: "missing" | "unreadable" | "invalid";
|
|
11
11
|
red: string;
|
|
12
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* M20 am3 item 12: the ONE test for "this run began as a rerun": the human's words its `run.json` carries (`rerun.decision` is `rerun` and
|
|
15
|
+
* `rerun.words` is a string), or null. The Audit's first step and the carry memo ask it. @param {string|null} runDir @returns {string|null}
|
|
16
|
+
*/
|
|
17
|
+
export function readRerunWords(runDir: string | null): string | null;
|
|
13
18
|
/**
|
|
14
19
|
* M4d am26: the run's OWN record of the box (`thinking` in `<run>/run.json`) and nothing else: `true`/`false`, or `null` when the run has none (a run from before am25).
|
|
15
20
|
* An unreadable record is box off, as `readJobThinking` has always read it. @param {string|null} runDir @returns {boolean|null}
|
|
@@ -29,6 +34,12 @@ export function readRunInputs(runDir: string | null): {
|
|
|
29
34
|
code: "missing" | "unreadable" | "invalid";
|
|
30
35
|
red: string;
|
|
31
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* M20 am3e item 16: the place-rule rows the run recorded at its start (`placeRules.rows`), or null when there are none to read (no record, a refused or torn file,
|
|
39
|
+
* no `placeRules` section, rows that are not a list). Each caller maps null to its own none: the carry-forward reads it as no rows, a resume refuses by name.
|
|
40
|
+
* @param {string|null} runDir @returns {any[]|null}
|
|
41
|
+
*/
|
|
42
|
+
export function readPlaceRows(runDir: string | null): any[] | null;
|
|
32
43
|
/**
|
|
33
44
|
* M8b item 1: the ONE writer of `run.json`, called once when a fresh run has frozen its inputs (`runFlow`); never over an existing record. `model` is the pick
|
|
34
45
|
* the run started on (M4d am33; null = the section is left out), `thinking` the job's "Thinking on" box as it was at the start (M4d am25: written for every fresh
|
|
@@ -53,3 +64,6 @@ export function writeRunStart(runDir: string, { model, thinking, inputs, rerun,
|
|
|
53
64
|
}): void;
|
|
54
65
|
/** the file's name in the run's folder */
|
|
55
66
|
export const RUN_FILE: "run.json";
|
|
67
|
+
/** the folder inside a run that holds the frozen copy of each input */
|
|
68
|
+
export const INPUTS_DIR: "inputs";
|
|
69
|
+
export function frozenRel(name: string): string;
|
package/types/runner.d.ts
CHANGED
|
@@ -12,23 +12,6 @@ export function readStopRequest(runDir: string, now?: () => string): {
|
|
|
12
12
|
} | null;
|
|
13
13
|
/** Is a stop pending for this run? (read-only) @param {string} runDir */
|
|
14
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
|
-
};
|
|
32
15
|
/** @param {{goal:string, primitives?:string[], reads?:Record<string,any>, gap?:string|null, hints?:string|null, memo?:string|null}} opts `hints` (M8 am7): the earlier runs' block, text only, for a retry / redo / rerun try; `memo` (M14): what happened so far in this run, text only, every try */
|
|
33
16
|
export function buildExecutorContext(opts: {
|
|
34
17
|
goal: string;
|
|
@@ -400,8 +383,7 @@ export function runFlow({ root, name, runId, sources, catalogue, modelStep, askS
|
|
|
400
383
|
nowMs?: (() => number) | undefined;
|
|
401
384
|
}): Promise<any>;
|
|
402
385
|
/** An ask step that never waits — it immediately tells the fold to park.
|
|
403
|
-
*
|
|
404
|
-
* a caller wanting park-and-exit behaviour from a FRESH `runFlow` call
|
|
386
|
+
* A caller wanting park-and-exit behaviour from a FRESH `runFlow` call
|
|
405
387
|
* passes this (or an equivalent) as `askStep`.
|
|
406
388
|
* @returns {(opts?: any) => Promise<{decision: 'park'}>} */
|
|
407
389
|
export function makeParkingAskStep(): (opts?: any) => Promise<{
|
|
@@ -538,23 +520,6 @@ export function stopParkedRun({ root, name, runId, catalogue, clock, nowMs, }: {
|
|
|
538
520
|
clock?: (() => string) | undefined;
|
|
539
521
|
nowMs?: (() => number) | undefined;
|
|
540
522
|
}): Promise<any>;
|
|
541
|
-
/**
|
|
542
|
-
* `writeLog`'s own sibling reader (M4a piece 2, docs/wiki/the-module-
|
|
543
|
-
* ladder.md M4a scope item 2: "one reader per book") — `null` when the run
|
|
544
|
-
* hasn't reached an exit path yet (still running, or parked before any
|
|
545
|
-
* halt/complete), or the file is present but not valid JSON (a torn write),
|
|
546
|
-
* never a thrown error.
|
|
547
|
-
* @param {string} runDir
|
|
548
|
-
* @returns {any|null}
|
|
549
|
-
*/
|
|
550
|
-
export function readLog(runDir: string): any | null;
|
|
551
|
-
/**
|
|
552
|
-
* `state.json`'s own sibling reader (same rule as {@link readLog}) — `null`
|
|
553
|
-
* when the run has never parked, or the file is present but not valid JSON.
|
|
554
|
-
* @param {string} runDir
|
|
555
|
-
* @returns {any|null}
|
|
556
|
-
*/
|
|
557
|
-
export function readRunState(runDir: string): any | null;
|
|
558
523
|
/**
|
|
559
524
|
* `ask.json`'s own sibling reader (same rule as {@link readLog}) — the
|
|
560
525
|
* parking ask protocol's own writer lives in {@link runAskSlot} above.
|
|
@@ -583,9 +548,12 @@ export const MAX_ATTEMPTS: 4;
|
|
|
583
548
|
* a few hundredths of a cent and up), so nothing a real tamper produces can hide inside it. */
|
|
584
549
|
export const SPEND_TOLERANCE_USD: 1e-9;
|
|
585
550
|
export const STOP_FILE: "stop.request";
|
|
586
|
-
export
|
|
551
|
+
export { HALT_FILE };
|
|
587
552
|
/** where a failure of learnings work that must not stop the run is recorded (one appended row, in the run's own folder): the run-end tally (`recordRunNotes`) and the take of the draft's learnings record (`takeLearningsRecord`, in runFlow). The run itself is unaffected */
|
|
588
553
|
export const LEARN_ERROR_FILE: "learn-error.jsonl";
|
|
554
|
+
export function endsRun(r: {
|
|
555
|
+
type?: unknown;
|
|
556
|
+
}): boolean;
|
|
589
557
|
import { readTicketMcp } from './ticket-mcp.js';
|
|
590
558
|
/**
|
|
591
559
|
* Run one step to green (or hitl pass-through), looping under strikes and
|
|
@@ -667,4 +635,4 @@ declare function runStepTries({ step, primitivesMap, readsMap, businessDate, mod
|
|
|
667
635
|
step?: string | null;
|
|
668
636
|
};
|
|
669
637
|
}>;
|
|
670
|
-
|
|
638
|
+
import { HALT_FILE } from './books.js';
|
package/types/runvalues.d.ts
CHANGED
|
@@ -57,10 +57,26 @@ export function writeRunValues(runDir: string, record: {
|
|
|
57
57
|
ok: false;
|
|
58
58
|
red: string;
|
|
59
59
|
};
|
|
60
|
+
/**
|
|
61
|
+
* Every signed values file in the run folder, oldest version first, each read by `readValuesFile` (the Audit lists them; a refused one
|
|
62
|
+
* shows as refused).
|
|
63
|
+
* @param {string} runDir
|
|
64
|
+
* @returns {Array<{file: string, version: number} & ({ok: true, record: any} | {ok: false, red: string})>}
|
|
65
|
+
*/
|
|
66
|
+
export function listRunValues(runDir: string): Array<{
|
|
67
|
+
file: string;
|
|
68
|
+
version: number;
|
|
69
|
+
} & ({
|
|
70
|
+
ok: true;
|
|
71
|
+
record: any;
|
|
72
|
+
} | {
|
|
73
|
+
ok: false;
|
|
74
|
+
red: string;
|
|
75
|
+
})>;
|
|
60
76
|
/**
|
|
61
77
|
* The ONE decision "which signed version does this run use": the highest version file in the run folder.
|
|
62
78
|
* `{ok:true, none:true}` = the flow's own values; `{ok:true, version, record}`; `{ok:false, red}` = a file that cannot be trusted
|
|
63
|
-
* (
|
|
79
|
+
* (see `readValuesFile`).
|
|
64
80
|
* @param {string} runDir
|
|
65
81
|
* @returns {{ok: true, none: true} | {ok: true, none?: false, version: number, record: any} | {ok: false, red: string}}
|
|
66
82
|
*/
|
|
@@ -98,5 +114,4 @@ export function applyRunValues(arbiter: any, flow: string, flowSignatureHash: st
|
|
|
98
114
|
* @param {string} runDir @returns {boolean} true when the file was removed
|
|
99
115
|
*/
|
|
100
116
|
export function dropUnstartedValues(runDir: string): boolean;
|
|
101
|
-
export const VALUES_FILE_RE: RegExp;
|
|
102
117
|
export function valuesFileName(version: number): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** the whole list as the page takes it: per flow type, `{kind, clock, file, label, newCardLabel}` (clock, file: the one answers of isClockKind and isFileKind) @returns {Record<string, {kind: string, clock: boolean, file: boolean, label: string, newCardLabel: string}[]>} */
|
|
2
|
+
export function scheduleChoices(): Record<string, {
|
|
3
|
+
kind: string;
|
|
4
|
+
clock: boolean;
|
|
5
|
+
file: boolean;
|
|
6
|
+
label: string;
|
|
7
|
+
newCardLabel: string;
|
|
8
|
+
}[]>;
|
|
9
|
+
export function scheduleKindsOf(flowType: unknown): string[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** @typedef {import('./trigger-line.js').Trigger} Trigger */
|
|
2
|
+
/**
|
|
3
|
+
* The trigger a body asks for, checked as data: null (By hand) or exactly one of the five shapes, the role one of the job's inputs, a full
|
|
4
|
+
* path. Returns the typed trigger or the sentence that says what to fix.
|
|
5
|
+
* @param {unknown} t @param {string[]} roles
|
|
6
|
+
* @returns {{ok: true, trigger: Trigger|null} | {ok: false, say: string}}
|
|
7
|
+
*/
|
|
8
|
+
export function shapeOf(t: unknown, roles: string[]): {
|
|
9
|
+
ok: true;
|
|
10
|
+
trigger: Trigger | null;
|
|
11
|
+
} | {
|
|
12
|
+
ok: false;
|
|
13
|
+
say: string;
|
|
14
|
+
};
|
|
15
|
+
export type Trigger = import("./trigger-line.js").Trigger;
|
package/types/sheetbuild.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export function buildSheetLine({ line, tables, suggestions }: {
|
|
|
39
39
|
* then Not checked with the no-pick sentence, never silently nothing). A suggestion that names no sheet line, or is not an object, is refused and listed with its helper.
|
|
40
40
|
* @param {{lines: {n: number, text?: string, rules?: string[], guardrail?: string, rule?: string}[], tables: Record<string, {header: string[], rows: any[]}>, suggestions: any[]}} o
|
|
41
41
|
* @returns {Promise<{built: Record<number, Awaited<ReturnType<typeof buildSheetLine>>>, checks: any[], notChecked: Record<string, string>, refused: {line: number|null, helper: string, why: string}[]}>}
|
|
42
|
-
* `notChecked`: `line N: "rule"` -> the refusal that named it (or `
|
|
42
|
+
* `notChecked`: `line N: "rule"` -> the refusal that named it (or `REASON.noPick`), for each rule of a sheet line that no check holds
|
|
43
43
|
*/
|
|
44
44
|
export function buildSheetChecks({ lines, tables, suggestions }: {
|
|
45
45
|
lines: {
|
package/types/thinking.d.ts
CHANGED
|
@@ -63,5 +63,6 @@ export function stepHintsWanted({ attempt, rerunReason }: {
|
|
|
63
63
|
}): boolean;
|
|
64
64
|
/** The sentence under a greyed "Thinking on" box (amendment 7 item 2). */
|
|
65
65
|
export const THINKING_FIXED_SAY: "can't change this for this model";
|
|
66
|
+
export function isThinkingMode(mode: unknown): boolean;
|
|
66
67
|
/** The note beside the Chat "Thinking on" box, before any draft, for a model bareagent has not checked (M4d am11 item 2). */
|
|
67
68
|
export const THINKING_UNVERIFIED_SAY: "thinking off (not verified for this model)";
|
package/types/ticketrows.d.ts
CHANGED
|
@@ -49,13 +49,4 @@ export function withTicketRows({ declaration, lines }: {
|
|
|
49
49
|
declaration: any;
|
|
50
50
|
tickets: ReturnType<typeof ticketRowsOf>;
|
|
51
51
|
};
|
|
52
|
-
/**
|
|
53
|
-
* The proof of a plan whose list has ticket rows (a plan with none is not examined): a built ticket row needs the declaration's field, and a field the declaration holds needs a built row for it.
|
|
54
|
-
* @param {any} declaration @returns {string[]}
|
|
55
|
-
*/
|
|
56
|
-
export function ticketListReds(declaration: any): string[];
|
|
57
|
-
/** @type {readonly ('ticketFilter'|'ticketWatch')[]} */
|
|
58
|
-
export const TICKET_FIELDS: readonly ("ticketFilter" | "ticketWatch")[];
|
|
59
|
-
/** the Not-checked reason of a ticket rule no legal value was suggested for (the block's own noPick sentence is used by the caller's words) */
|
|
60
|
-
export const NO_VALUE_WHY: "No check was picked for it, so you judge it at Accept.";
|
|
61
52
|
export function ticketRowKey(line: number, rule: number, field: string): string;
|
package/types/trigger-clock.d.ts
CHANGED
|
@@ -20,8 +20,6 @@ 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 @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
23
|
/** The trigger was set at `now`: no slot before this ever fires. M13 piece 5: `ticketN` = the highest ticket number the first green run read; a ticket schedule's first look baselines only tickets up to it. @param {string} file @param {number} now @param {string} [sig] @param {number} [ticketN] */
|
|
26
24
|
export function armTrigger(file: string, now: number, sig?: string, ticketN?: number): void;
|
|
27
25
|
/**
|
|
@@ -34,6 +32,9 @@ export function recordFire(file: string, d: Due, now: number, sig?: string): voi
|
|
|
34
32
|
/** @typedef {{fire:boolean, catchUp:boolean, missed:number, slot?:number}} Due */
|
|
35
33
|
/** 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
34
|
export const GRACE_MS: 120000;
|
|
35
|
+
/** M20 am6: the one list of clock schedule kinds, and the one question "is this a clock kind" */
|
|
36
|
+
export const CLOCK_KINDS: readonly string[];
|
|
37
|
+
export function isClockKind(kind: unknown): boolean;
|
|
37
38
|
export type Schedule = {
|
|
38
39
|
kind: "daily" | "weekdays";
|
|
39
40
|
hour: number;
|
package/types/trigger-files.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
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
|
-
/** The ONE appender: write-once by id within a signing (a second row with the same id is not written). Starts on a fresh line when the file does not end in a newline (a torn last line). @param {string} file @param {SeenRow} row @param {string} [sig] stamped on the row @returns {boolean} written */
|
|
4
|
-
export function appendSeen(file: string, row: SeenRow, sig?: string): boolean;
|
|
5
1
|
/** 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] */
|
|
6
2
|
export function recordArrived(ledger: string, item: ToRun & {
|
|
7
3
|
name?: string;
|
|
@@ -46,6 +42,18 @@ export function recheck(item: {
|
|
|
46
42
|
* @param {'new'|'updated'} mode @param {string} target
|
|
47
43
|
*/
|
|
48
44
|
export function checkTarget(mode: "new" | "updated", target: string): void;
|
|
45
|
+
/**
|
|
46
|
+
* Is a file or folder trigger's target usable now? The words say what is wrong, without the closing "Nothing was changed."; null = fine. A file that does not exist yet may arrive
|
|
47
|
+
* (`checkTarget` allows it), but its folder must be there: a typo is caught now, not never.
|
|
48
|
+
* @param {{kind: 'file-updated', path: string}|{kind: 'new-file', folder: string}} trigger @returns {string|null}
|
|
49
|
+
*/
|
|
50
|
+
export function fileTriggerWhy(trigger: {
|
|
51
|
+
kind: "file-updated";
|
|
52
|
+
path: string;
|
|
53
|
+
} | {
|
|
54
|
+
kind: "new-file";
|
|
55
|
+
folder: string;
|
|
56
|
+
}): string | null;
|
|
49
57
|
/**
|
|
50
58
|
* 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.
|
|
51
59
|
* @param {'new'|'updated'} mode @param {string} target @param {string} filePath a queued file's path as the watcher recorded it (a real path)
|
|
@@ -69,6 +77,9 @@ export function createFileTrigger({ mode, target, ledger, sig }: {
|
|
|
69
77
|
/** @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 */
|
|
70
78
|
/** @typedef {{path:string, sha:string, size:number}} ToRun */
|
|
71
79
|
/** @typedef {{path:string, why:string}} Refused */
|
|
80
|
+
/** M20 am7: the one list of file schedule kinds, and the one question "is this a file kind" */
|
|
81
|
+
export const FILE_KINDS: readonly string[];
|
|
82
|
+
export function isFileKind(kind: unknown): boolean;
|
|
72
83
|
/** Consecutive polls with the same size and mtime before a file is taken. (Two matches in a row = taken on the third sighting.) */
|
|
73
84
|
export const STABLE_POLLS: 2;
|
|
74
85
|
export function recordRan(ledger: string, item: {
|
package/types/types.d.ts
CHANGED
|
@@ -237,6 +237,14 @@ export type ReadFlowOk = {
|
|
|
237
237
|
declaration: Record<string, any>;
|
|
238
238
|
signature: Signature;
|
|
239
239
|
classes: Record<string, string>;
|
|
240
|
+
/**
|
|
241
|
+
* only on `readRunJobCopy`: the verified copy's own bytes (prose.txt)
|
|
242
|
+
*/
|
|
243
|
+
proseText?: string | undefined;
|
|
244
|
+
/**
|
|
245
|
+
* only on `readRunJobCopy`: the verified copy's own bytes (declaration.json)
|
|
246
|
+
*/
|
|
247
|
+
declarationText?: string | undefined;
|
|
240
248
|
};
|
|
241
249
|
export type ReadFlowRed = {
|
|
242
250
|
ok: false;
|