fwdloop 0.21.0 → 0.23.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 +85 -34
- package/package.json +4 -3
- package/src/ask.js +20 -4
- package/src/audit-fold.js +5 -1
- package/src/authoring.js +36 -6
- package/src/canrun.js +5 -0
- package/src/checked.js +32 -4
- package/src/cited-record.js +138 -0
- package/src/cited-source.js +49 -0
- package/src/citedcheck.js +321 -0
- package/src/citedwords.js +197 -0
- package/src/closers.js +37 -198
- package/src/csv.js +69 -12
- package/src/ctx-tools.js +2 -14
- package/src/declaration.js +143 -5
- package/src/diary.js +2 -2
- package/src/docx.js +16 -2
- package/src/draft-steps.js +1 -1
- package/src/drafter.js +322 -33
- package/src/flow.js +33 -7
- package/src/flowmodel.js +21 -0
- package/src/input-facts.js +20 -3
- package/src/model-step.js +38 -21
- package/src/pageask.js +136 -0
- package/src/pagebits.js +107 -0
- package/src/pagedropwords.js +171 -0
- package/src/pagedry.js +120 -0
- package/src/pagefetch.js +164 -0
- package/src/pagelook.js +155 -0
- package/src/pagemap.js +55 -0
- package/src/pageplace.js +103 -0
- package/src/pagerules.js +318 -0
- package/src/panel/author.js +43 -21
- package/src/panel/authorcard.js +20 -3
- package/src/panel/authorflows.js +21 -15
- package/src/panel/authorstart.js +2 -4
- package/src/panel/authortrigger.js +14 -4
- package/src/panel/data.js +102 -6
- package/src/panel/index.html +321 -12
- package/src/panel/result.js +301 -0
- package/src/panel/server.js +27 -3
- package/src/primitives.js +2 -3
- package/src/provider.js +5 -2
- package/src/redact.js +17 -0
- package/src/runner.js +102 -14
- package/src/schedule.js +3 -3
- package/src/setup.js +16 -1
- package/src/sheet-record.js +57 -0
- package/src/sheetblock.js +170 -0
- package/src/sheetchecks.js +206 -0
- package/src/sheetclaims.js +78 -0
- package/src/sheetfind.js +50 -0
- package/src/sheetlook.js +157 -0
- package/src/sheetoffer.js +125 -0
- package/src/sheetrun.js +105 -0
- package/src/signed-text.js +11 -1
- package/src/thinking.js +1 -1
- package/src/try-checks.js +12 -0
- package/src/types.js +4 -11
- package/types/ask.d.ts +2 -1
- package/types/authoring.d.ts +19 -2
- package/types/checked.d.ts +19 -3
- package/types/cited-record.d.ts +21 -0
- package/types/cited-source.d.ts +18 -0
- package/types/citedcheck.d.ts +95 -0
- package/types/citedwords.d.ts +97 -0
- package/types/closers.d.ts +37 -10
- package/types/csv.d.ts +25 -4
- package/types/ctx-tools.d.ts +0 -1
- package/types/declaration.d.ts +20 -1
- package/types/docx.d.ts +14 -0
- package/types/drafter.d.ts +264 -8
- package/types/flow.d.ts +21 -0
- package/types/flowmodel.d.ts +15 -0
- package/types/input-facts.d.ts +12 -2
- package/types/model-step.d.ts +40 -19
- package/types/pageask.d.ts +75 -0
- package/types/pagebits.d.ts +32 -0
- package/types/pagedropwords.d.ts +40 -0
- package/types/pagedry.d.ts +38 -0
- package/types/pagefetch.d.ts +86 -0
- package/types/pagelook.d.ts +75 -0
- package/types/pagemap.d.ts +31 -0
- package/types/pageplace.d.ts +22 -0
- package/types/pagerules.d.ts +86 -0
- package/types/panel/authorcard.d.ts +4 -1
- package/types/panel/authorflows.d.ts +2 -0
- package/types/panel/data.d.ts +26 -0
- package/types/panel/result.d.ts +156 -0
- package/types/provider.d.ts +3 -1
- package/types/redact.d.ts +1 -0
- package/types/runner.d.ts +162 -9
- package/types/schedule.d.ts +0 -11
- package/types/setup.d.ts +13 -0
- package/types/sheet-record.d.ts +24 -0
- package/types/sheetblock.d.ts +116 -0
- package/types/sheetchecks.d.ts +70 -0
- package/types/sheetclaims.d.ts +26 -0
- package/types/sheetfind.d.ts +46 -0
- package/types/sheetlook.d.ts +120 -0
- package/types/sheetoffer.d.ts +25 -0
- package/types/sheetrun.d.ts +35 -0
- package/types/thinking.d.ts +1 -1
- package/types/types.d.ts +27 -14
package/types/csv.d.ts
CHANGED
|
@@ -8,15 +8,36 @@ export function parseCellRef(cell: any): {
|
|
|
8
8
|
row: number;
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
|
-
* Parse CSV text
|
|
12
|
-
* `rows[i]` is `{ rowNumber, cells: { A: '...', B: '...' }, byName: { Customer: '...' } }`
|
|
13
|
-
* where `rowNumber` is the
|
|
11
|
+
* Parse CSV text into { header, rows } (RFC 4180 quoting, see `records`).
|
|
12
|
+
* `rows[i]` is `{ rowNumber, cells: { A: '...', B: '...' }, byName: { Customer: '...' }, raw: ['...', '...'] }` (`raw` is the row's cells exactly as the file has them: no padding, nothing cut)
|
|
13
|
+
* where `rowNumber` is the real sheet line the row starts on (header is row 1; a blank line is skipped but still counted, so it never shifts the rows below).
|
|
14
14
|
*/
|
|
15
15
|
export function parseCsv(text: any): {
|
|
16
|
-
header:
|
|
16
|
+
header: string[];
|
|
17
17
|
rows: {
|
|
18
18
|
rowNumber: number;
|
|
19
19
|
cells: {};
|
|
20
20
|
byName: {};
|
|
21
|
+
raw: string[];
|
|
22
|
+
}[];
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* A parsed sheet as bareguard's table shape: `{ header: string[], rows: [{ rowNumber, cells: string[] }] }`. Each row's cells are the row exactly as the file
|
|
26
|
+
* has it (`raw`): a short or a long row is NOT padded or cut here, so bareguard itself stops it (`tableSha` gives null for a ragged row, and the table is
|
|
27
|
+
* refused). The header strings are exactly as the file has them. The one writer of this shape (M10b item 2).
|
|
28
|
+
* @param {{header: string[], rows: {rowNumber: number, raw: string[]}[]}} sheet from `parseCsv`
|
|
29
|
+
* @returns {{header: string[], rows: {rowNumber: number, cells: string[]}[]}}
|
|
30
|
+
*/
|
|
31
|
+
export function sheetTable(sheet: {
|
|
32
|
+
header: string[];
|
|
33
|
+
rows: {
|
|
34
|
+
rowNumber: number;
|
|
35
|
+
raw: string[];
|
|
36
|
+
}[];
|
|
37
|
+
}): {
|
|
38
|
+
header: string[];
|
|
39
|
+
rows: {
|
|
40
|
+
rowNumber: number;
|
|
41
|
+
cells: string[];
|
|
21
42
|
}[];
|
|
22
43
|
};
|
package/types/ctx-tools.d.ts
CHANGED
|
@@ -16,4 +16,3 @@ export function makeCtxTools({ runDir, gatePath }: {
|
|
|
16
16
|
/** One stashed item holds at most this many bytes (measured after secrets are masked,
|
|
17
17
|
* because that is what enters the store). Bareloop's number, signed in M7 item 3. */
|
|
18
18
|
export const ISOLATE_MAX_BYTES: 65536;
|
|
19
|
-
export function redactSecrets(raw: unknown): string;
|
package/types/declaration.d.ts
CHANGED
|
@@ -50,7 +50,13 @@ export function checkShapeFitsJobLine(step: any, i: any, lines: any, reds: any):
|
|
|
50
50
|
* text as its goal, exactly. Off by default so already-signed flows keep running; draft and sign turn it on.
|
|
51
51
|
* `fitJobLine` (optional boolean; M4e amendment 6): when true, a `close.shape` whose sections/maxWords fight the step's job
|
|
52
52
|
* line or its guardrail is a red. Draft, change and sign turn it on; readFlow does not (signed flows keep running).
|
|
53
|
-
*
|
|
53
|
+
* `pageWords` (optional; M10 am7 item 1): `{texts: {role: drafting copy}, look: {facts, dropped}}`. With `fitJobLine`, the words of every `close.cited` fact are
|
|
54
|
+
* proved on the page at $0; the drafter passes it, sign does not (the draft was already proved, and its files are hash-bound).
|
|
55
|
+
* `pageWords.docs` (M10 piece 5): the roles that are documents (.docx / .md / .txt): their words are proved on their text alone, with no page-word map.
|
|
56
|
+
* `sheetWords` (optional; M10 am8 item 2): `{headers: {role: header names}, facts: the columns the sheet look kept}`. With `fitJobLine`, every column a step's `close.columns` names
|
|
57
|
+
* is proved a real column of its sheet, and a column the code kept for the step's line (an agreed one included) must be in it.
|
|
58
|
+
* `sheetWords.tables` (optional; M10b piece 1): `{role: bareguard table}` of the drafting copy. With it, every `close.sheet` check passes bareguard's sign-time test at $0.
|
|
59
|
+
* @param {{ arbiter?: unknown, lines?: unknown, catalogue?: unknown, wired?: Set<string>, verbatimGoals?: boolean, fitJobLine?: boolean, pageWords?: {texts: Record<string, string>, look: any, docs?: string[]}, sheetWords?: {headers: Record<string, string[]>, facts: any[], tables?: Record<string, {header: string[], rows: any[]}>} }} [context]
|
|
54
60
|
* @returns {ValidateDeclarationResult}
|
|
55
61
|
*/
|
|
56
62
|
export function validateDeclaration(declaration: unknown, context?: {
|
|
@@ -60,6 +66,19 @@ export function validateDeclaration(declaration: unknown, context?: {
|
|
|
60
66
|
wired?: Set<string>;
|
|
61
67
|
verbatimGoals?: boolean;
|
|
62
68
|
fitJobLine?: boolean;
|
|
69
|
+
pageWords?: {
|
|
70
|
+
texts: Record<string, string>;
|
|
71
|
+
look: any;
|
|
72
|
+
docs?: string[];
|
|
73
|
+
};
|
|
74
|
+
sheetWords?: {
|
|
75
|
+
headers: Record<string, string[]>;
|
|
76
|
+
facts: any[];
|
|
77
|
+
tables?: Record<string, {
|
|
78
|
+
header: string[];
|
|
79
|
+
rows: any[];
|
|
80
|
+
}>;
|
|
81
|
+
};
|
|
63
82
|
}): ValidateDeclarationResult;
|
|
64
83
|
/** @typedef {import('./types.js').Arbiter} Arbiter */
|
|
65
84
|
/** @typedef {import('./types.js').SignedLine} SignedLine */
|
package/types/docx.d.ts
CHANGED
|
@@ -7,6 +7,20 @@ export function readDocxText(path: string): {
|
|
|
7
7
|
ok: false;
|
|
8
8
|
red: string;
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* M10 piece 5 (item 2, "a quote in a doc"): the text of a .docx AND the sha256 of its bytes from one read, so a cited check can prove the run's own frozen copy is
|
|
12
|
+
* the file that was frozen. Same text as {@link readDocxText} (what it throws away is declared at the top of this file).
|
|
13
|
+
* @param {string} path @returns {{ok:true,text:string,paragraphs:number,sha256:string}|{ok:false,red:string}}
|
|
14
|
+
*/
|
|
15
|
+
export function readDocxSource(path: string): {
|
|
16
|
+
ok: true;
|
|
17
|
+
text: string;
|
|
18
|
+
paragraphs: number;
|
|
19
|
+
sha256: string;
|
|
20
|
+
} | {
|
|
21
|
+
ok: false;
|
|
22
|
+
red: string;
|
|
23
|
+
};
|
|
10
24
|
/** @param {string} path @returns {{ok:true,headings:string[]}|{ok:false,red:string}} */
|
|
11
25
|
export function readDocxHeadings(path: string): {
|
|
12
26
|
ok: true;
|
package/types/drafter.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The forced tool's parameter schema. `menu` = wiredMenu(). `sheets` (M10b piece 3, optional) = the drafting copy's table of each CSV input role: with it a step may carry
|
|
3
|
+
* `close.sheet`, and every column a check names is an enum of that sheet's exact header (src/sheetoffer.js); without it (no CSV input) no sheet property exists.
|
|
4
|
+
* @param {any[]} menu @param {{sheets?: Record<string, {header: string[]}>}} [o]
|
|
5
|
+
*/
|
|
6
|
+
export function buildDeclarationSchema(menu: any[], { sheets }?: {
|
|
7
|
+
sheets?: Record<string, {
|
|
8
|
+
header: string[];
|
|
9
|
+
}>;
|
|
10
|
+
}): {
|
|
3
11
|
type: string;
|
|
4
12
|
properties: {
|
|
5
13
|
steps: {
|
|
@@ -12,7 +20,7 @@ export function buildDeclarationSchema(menu: any): {
|
|
|
12
20
|
type: string;
|
|
13
21
|
items: {
|
|
14
22
|
type: string;
|
|
15
|
-
enum: any;
|
|
23
|
+
enum: any[];
|
|
16
24
|
};
|
|
17
25
|
description: string;
|
|
18
26
|
};
|
|
@@ -45,6 +53,7 @@ export function buildDeclarationSchema(menu: any): {
|
|
|
45
53
|
close: {
|
|
46
54
|
type: string;
|
|
47
55
|
properties: {
|
|
56
|
+
sheet?: Record<string, any> | undefined;
|
|
48
57
|
class: {
|
|
49
58
|
type: string;
|
|
50
59
|
enum: string[];
|
|
@@ -56,6 +65,116 @@ export function buildDeclarationSchema(menu: any): {
|
|
|
56
65
|
additionalProperties: boolean;
|
|
57
66
|
description: string;
|
|
58
67
|
};
|
|
68
|
+
cited: Readonly<{
|
|
69
|
+
type: "object";
|
|
70
|
+
description: "only on a green step that checks quotes from a web page or a document input: the facts every result must hold. Omit on any other step";
|
|
71
|
+
properties: {
|
|
72
|
+
source: {
|
|
73
|
+
type: string;
|
|
74
|
+
description: string;
|
|
75
|
+
};
|
|
76
|
+
facts: {
|
|
77
|
+
type: string;
|
|
78
|
+
minItems: number;
|
|
79
|
+
maxItems: number;
|
|
80
|
+
description: string;
|
|
81
|
+
items: {
|
|
82
|
+
type: string;
|
|
83
|
+
properties: {
|
|
84
|
+
name: {
|
|
85
|
+
type: string;
|
|
86
|
+
description: string;
|
|
87
|
+
};
|
|
88
|
+
shape: {
|
|
89
|
+
type: string;
|
|
90
|
+
enum: string[];
|
|
91
|
+
};
|
|
92
|
+
unit: {
|
|
93
|
+
type: string[];
|
|
94
|
+
items: {
|
|
95
|
+
type: string;
|
|
96
|
+
};
|
|
97
|
+
description: string;
|
|
98
|
+
};
|
|
99
|
+
currency: {
|
|
100
|
+
type: string[];
|
|
101
|
+
items: {
|
|
102
|
+
type: string;
|
|
103
|
+
};
|
|
104
|
+
description: string;
|
|
105
|
+
};
|
|
106
|
+
phrase: {
|
|
107
|
+
type: string;
|
|
108
|
+
description: string;
|
|
109
|
+
};
|
|
110
|
+
anchor: {
|
|
111
|
+
type: string;
|
|
112
|
+
description: string;
|
|
113
|
+
};
|
|
114
|
+
until: {
|
|
115
|
+
type: string;
|
|
116
|
+
description: string;
|
|
117
|
+
};
|
|
118
|
+
rule: {
|
|
119
|
+
type: string;
|
|
120
|
+
description: string;
|
|
121
|
+
properties: {
|
|
122
|
+
op: {
|
|
123
|
+
type: string;
|
|
124
|
+
enum: string[];
|
|
125
|
+
};
|
|
126
|
+
value: {};
|
|
127
|
+
lo: {};
|
|
128
|
+
hi: {};
|
|
129
|
+
};
|
|
130
|
+
required: string[];
|
|
131
|
+
additionalProperties: boolean;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
required: string[];
|
|
135
|
+
additionalProperties: boolean;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
count: {
|
|
139
|
+
type: string;
|
|
140
|
+
description: string;
|
|
141
|
+
properties: {
|
|
142
|
+
min: {
|
|
143
|
+
type: string;
|
|
144
|
+
minimum: number;
|
|
145
|
+
};
|
|
146
|
+
max: {
|
|
147
|
+
type: string;
|
|
148
|
+
minimum: number;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
additionalProperties: boolean;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
required: string[];
|
|
155
|
+
additionalProperties: false;
|
|
156
|
+
}>;
|
|
157
|
+
columns: Readonly<{
|
|
158
|
+
type: "array";
|
|
159
|
+
minItems: 1;
|
|
160
|
+
maxItems: 10;
|
|
161
|
+
description: "only on a green step that reads a CSV input: the exact column names (the sheet's header) its values come from. Omit on any other step";
|
|
162
|
+
items: {
|
|
163
|
+
type: string;
|
|
164
|
+
properties: {
|
|
165
|
+
source: {
|
|
166
|
+
type: string;
|
|
167
|
+
description: string;
|
|
168
|
+
};
|
|
169
|
+
column: {
|
|
170
|
+
type: string;
|
|
171
|
+
description: string;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
required: string[];
|
|
175
|
+
additionalProperties: boolean;
|
|
176
|
+
};
|
|
177
|
+
}>;
|
|
59
178
|
};
|
|
60
179
|
required: string[];
|
|
61
180
|
additionalProperties: boolean;
|
|
@@ -103,8 +222,12 @@ export function buildDeclarationSchema(menu: any): {
|
|
|
103
222
|
additionalProperties: boolean;
|
|
104
223
|
};
|
|
105
224
|
/** The declaration schema plus the optional `notChecked` (every try) and, on try 3 only, `questions`. Neither is in `required`. */
|
|
106
|
-
|
|
107
|
-
|
|
225
|
+
/** @param {any[]} menu @param {{questions?: boolean, sheets?: Record<string, {header: string[]}>|undefined}} [o] */
|
|
226
|
+
export function buildRoundSchema(menu: any[], { questions, sheets }?: {
|
|
227
|
+
questions?: boolean;
|
|
228
|
+
sheets?: Record<string, {
|
|
229
|
+
header: string[];
|
|
230
|
+
}> | undefined;
|
|
108
231
|
}): {
|
|
109
232
|
properties: {
|
|
110
233
|
notChecked: {
|
|
@@ -124,7 +247,7 @@ export function buildRoundSchema(menu: any, { questions }?: {
|
|
|
124
247
|
type: string;
|
|
125
248
|
items: {
|
|
126
249
|
type: string;
|
|
127
|
-
enum: any;
|
|
250
|
+
enum: any[];
|
|
128
251
|
};
|
|
129
252
|
description: string;
|
|
130
253
|
};
|
|
@@ -157,6 +280,7 @@ export function buildRoundSchema(menu: any, { questions }?: {
|
|
|
157
280
|
close: {
|
|
158
281
|
type: string;
|
|
159
282
|
properties: {
|
|
283
|
+
sheet?: Record<string, any> | undefined;
|
|
160
284
|
class: {
|
|
161
285
|
type: string;
|
|
162
286
|
enum: string[];
|
|
@@ -168,6 +292,116 @@ export function buildRoundSchema(menu: any, { questions }?: {
|
|
|
168
292
|
additionalProperties: boolean;
|
|
169
293
|
description: string;
|
|
170
294
|
};
|
|
295
|
+
cited: Readonly<{
|
|
296
|
+
type: "object";
|
|
297
|
+
description: "only on a green step that checks quotes from a web page or a document input: the facts every result must hold. Omit on any other step";
|
|
298
|
+
properties: {
|
|
299
|
+
source: {
|
|
300
|
+
type: string;
|
|
301
|
+
description: string;
|
|
302
|
+
};
|
|
303
|
+
facts: {
|
|
304
|
+
type: string;
|
|
305
|
+
minItems: number;
|
|
306
|
+
maxItems: number;
|
|
307
|
+
description: string;
|
|
308
|
+
items: {
|
|
309
|
+
type: string;
|
|
310
|
+
properties: {
|
|
311
|
+
name: {
|
|
312
|
+
type: string;
|
|
313
|
+
description: string;
|
|
314
|
+
};
|
|
315
|
+
shape: {
|
|
316
|
+
type: string;
|
|
317
|
+
enum: string[];
|
|
318
|
+
};
|
|
319
|
+
unit: {
|
|
320
|
+
type: string[];
|
|
321
|
+
items: {
|
|
322
|
+
type: string;
|
|
323
|
+
};
|
|
324
|
+
description: string;
|
|
325
|
+
};
|
|
326
|
+
currency: {
|
|
327
|
+
type: string[];
|
|
328
|
+
items: {
|
|
329
|
+
type: string;
|
|
330
|
+
};
|
|
331
|
+
description: string;
|
|
332
|
+
};
|
|
333
|
+
phrase: {
|
|
334
|
+
type: string;
|
|
335
|
+
description: string;
|
|
336
|
+
};
|
|
337
|
+
anchor: {
|
|
338
|
+
type: string;
|
|
339
|
+
description: string;
|
|
340
|
+
};
|
|
341
|
+
until: {
|
|
342
|
+
type: string;
|
|
343
|
+
description: string;
|
|
344
|
+
};
|
|
345
|
+
rule: {
|
|
346
|
+
type: string;
|
|
347
|
+
description: string;
|
|
348
|
+
properties: {
|
|
349
|
+
op: {
|
|
350
|
+
type: string;
|
|
351
|
+
enum: string[];
|
|
352
|
+
};
|
|
353
|
+
value: {};
|
|
354
|
+
lo: {};
|
|
355
|
+
hi: {};
|
|
356
|
+
};
|
|
357
|
+
required: string[];
|
|
358
|
+
additionalProperties: boolean;
|
|
359
|
+
};
|
|
360
|
+
};
|
|
361
|
+
required: string[];
|
|
362
|
+
additionalProperties: boolean;
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
count: {
|
|
366
|
+
type: string;
|
|
367
|
+
description: string;
|
|
368
|
+
properties: {
|
|
369
|
+
min: {
|
|
370
|
+
type: string;
|
|
371
|
+
minimum: number;
|
|
372
|
+
};
|
|
373
|
+
max: {
|
|
374
|
+
type: string;
|
|
375
|
+
minimum: number;
|
|
376
|
+
};
|
|
377
|
+
};
|
|
378
|
+
additionalProperties: boolean;
|
|
379
|
+
};
|
|
380
|
+
};
|
|
381
|
+
required: string[];
|
|
382
|
+
additionalProperties: false;
|
|
383
|
+
}>;
|
|
384
|
+
columns: Readonly<{
|
|
385
|
+
type: "array";
|
|
386
|
+
minItems: 1;
|
|
387
|
+
maxItems: 10;
|
|
388
|
+
description: "only on a green step that reads a CSV input: the exact column names (the sheet's header) its values come from. Omit on any other step";
|
|
389
|
+
items: {
|
|
390
|
+
type: string;
|
|
391
|
+
properties: {
|
|
392
|
+
source: {
|
|
393
|
+
type: string;
|
|
394
|
+
description: string;
|
|
395
|
+
};
|
|
396
|
+
column: {
|
|
397
|
+
type: string;
|
|
398
|
+
description: string;
|
|
399
|
+
};
|
|
400
|
+
};
|
|
401
|
+
required: string[];
|
|
402
|
+
additionalProperties: boolean;
|
|
403
|
+
};
|
|
404
|
+
}>;
|
|
171
405
|
};
|
|
172
406
|
required: string[];
|
|
173
407
|
additionalProperties: boolean;
|
|
@@ -253,9 +487,11 @@ export function goalForLine(fromLine: any, lines: any): any;
|
|
|
253
487
|
*
|
|
254
488
|
* @returns {Promise<{ok:boolean, declaration:object|null, reds:string[], rounds:number, calls:number, spendComplete:boolean,
|
|
255
489
|
* costUsd:number|null, modelReturned:string|null, modelId?:string, price?:object|null, tokens?:object|null, structureRetries:number, revisions:number, stop:string|null, log:object[],
|
|
256
|
-
* questions?:{line:number, question:string}[], droppedQuestions?:object[], notChecked?:string[], thinking?:{asked:string, status:string|null, say:string|null}, inputs?:{role:string, detail:string}[]
|
|
490
|
+
* questions?:{line:number, question:string}[], droppedQuestions?:object[], notChecked?:string[], thinking?:{asked:string, status:string|null, say:string|null}, inputs?:{role:string, detail:string}[],
|
|
491
|
+
* look?:{facts:any[], dropped:any[]}, pageLooks?:{role:string, address:string, sha256:string, bytes:number, frozen:string, attempts:number, mapping:any}[], sheetLooks?:any[]}>}
|
|
492
|
+
* `look` / `pageLooks` (M10 item 3) are there when the job signs a web page: the kept facts (with their `reading`, the input a later ask reads), every drop, and per page its address, sha256 and the AI's map. Each drop is also a line in `notChecked`.
|
|
257
493
|
*/
|
|
258
|
-
export function draft({ proseText, slot, model, provider: injected, rates: injectedRates, modelId: injectedModelId, env, priorSpend, skills, makeProviderFn, onBook, offerQuestions, draftThinking, }: {
|
|
494
|
+
export function draft({ proseText, slot, model, provider: injected, rates: injectedRates, modelId: injectedModelId, env, priorSpend, skills, makeProviderFn, onBook, offerQuestions, draftThinking, draftDir, fetchPage, leftRules, }: {
|
|
259
495
|
proseText: any;
|
|
260
496
|
slot: any;
|
|
261
497
|
model: any;
|
|
@@ -269,6 +505,12 @@ export function draft({ proseText, slot, model, provider: injected, rates: injec
|
|
|
269
505
|
onBook: any;
|
|
270
506
|
offerQuestions?: boolean | undefined;
|
|
271
507
|
draftThinking?: "on" | "off" | undefined;
|
|
508
|
+
draftDir?: string | null | undefined;
|
|
509
|
+
fetchPage?: undefined;
|
|
510
|
+
leftRules?: {
|
|
511
|
+
line: number;
|
|
512
|
+
rule: number;
|
|
513
|
+
}[] | undefined;
|
|
272
514
|
}): Promise<{
|
|
273
515
|
ok: boolean;
|
|
274
516
|
declaration: object | null;
|
|
@@ -300,6 +542,20 @@ export function draft({ proseText, slot, model, provider: injected, rates: injec
|
|
|
300
542
|
role: string;
|
|
301
543
|
detail: string;
|
|
302
544
|
}[];
|
|
545
|
+
look?: {
|
|
546
|
+
facts: any[];
|
|
547
|
+
dropped: any[];
|
|
548
|
+
};
|
|
549
|
+
pageLooks?: {
|
|
550
|
+
role: string;
|
|
551
|
+
address: string;
|
|
552
|
+
sha256: string;
|
|
553
|
+
bytes: number;
|
|
554
|
+
frozen: string;
|
|
555
|
+
attempts: number;
|
|
556
|
+
mapping: any;
|
|
557
|
+
}[];
|
|
558
|
+
sheetLooks?: any[];
|
|
303
559
|
}>;
|
|
304
560
|
export const MAX_STRUCTURE_RETRIES: 2;
|
|
305
561
|
export const MAX_REVISIONS: 2;
|
package/types/flow.d.ts
CHANGED
|
@@ -98,6 +98,21 @@ export function listRunIds(flowDir: string): string[];
|
|
|
98
98
|
* @returns {string}
|
|
99
99
|
*/
|
|
100
100
|
export function nextRunId(flowDir: string): string;
|
|
101
|
+
/**
|
|
102
|
+
* The ONE decider of an unnamed run's id: the first `run-<n>` from `from` (default: nextRunId) with nothing by that name (a stray file counts as taken, as
|
|
103
|
+
* `mkdir` EEXIST does). Only LOOKS; `claimRunId` claims it and `canStart` (src/panel/authorstart.js) asks it.
|
|
104
|
+
* @param {string} flowDir @param {number} [from]
|
|
105
|
+
* @returns {{ok:true, runId:string, runDir:string, n:number}|{ok:false, red:string}}
|
|
106
|
+
*/
|
|
107
|
+
export function freeRunId(flowDir: string, from?: number): {
|
|
108
|
+
ok: true;
|
|
109
|
+
runId: string;
|
|
110
|
+
runDir: string;
|
|
111
|
+
n: number;
|
|
112
|
+
} | {
|
|
113
|
+
ok: false;
|
|
114
|
+
red: string;
|
|
115
|
+
};
|
|
101
116
|
/**
|
|
102
117
|
* @param {string} flowDir
|
|
103
118
|
* @returns {{ok:true, runId:string, runDir:string}|{ok:false, red:string}}
|
|
@@ -344,6 +359,12 @@ export function readRunJobCopy(runDir: string, catalogue: unknown): {
|
|
|
344
359
|
* @param {string} root @param {string} name
|
|
345
360
|
*/
|
|
346
361
|
export function suggestFlowName(root: string, name: string): string;
|
|
362
|
+
/**
|
|
363
|
+
* M10: take back the drafting copies of web pages (`files`) a draft froze into `dir` when the draft is then refused at $0, and the folder itself once it is
|
|
364
|
+
* empty. Only the files named are removed; a folder holding anything else is left.
|
|
365
|
+
* @param {string} dir @param {string[]} files
|
|
366
|
+
*/
|
|
367
|
+
export function removeFrozenPages(dir: string, files: string[]): void;
|
|
347
368
|
/** @typedef {import('./types.js').WriteFlowResult} WriteFlowResult */
|
|
348
369
|
/** @typedef {import('./types.js').ReadFlowResult} ReadFlowResult */
|
|
349
370
|
/** @typedef {import('./types.js').CheckFlowNameResult} CheckFlowNameResult */
|
package/types/flowmodel.d.ts
CHANGED
|
@@ -33,6 +33,21 @@ export function readRunThinking(runDir: string | null): boolean | null;
|
|
|
33
33
|
* Written for every fresh run, ticked or not. @param {string} flowDir @param {string} runDir
|
|
34
34
|
*/
|
|
35
35
|
export function writeRunThinking(flowDir: string, runDir: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* M4d am33: the ONE reader of the model a run started on, or null (a run from before the record, or an unusable one: the caller then keeps today's pick).
|
|
38
|
+
* @param {string|null} runDir @returns {{ slot: string, model: string }|null}
|
|
39
|
+
*/
|
|
40
|
+
export function readRunModel(runDir: string | null): {
|
|
41
|
+
slot: string;
|
|
42
|
+
model: string;
|
|
43
|
+
} | null;
|
|
44
|
+
/** M4d am33: the ONE writer, called once when a fresh run starts (`runFlow`); never over an existing record. @param {string} runDir @param {{ slot: string, model: string }} pick */
|
|
45
|
+
export function writeRunModel(runDir: string, { slot, model }: {
|
|
46
|
+
slot: string;
|
|
47
|
+
model: string;
|
|
48
|
+
}): void;
|
|
36
49
|
export const MODEL_FILE: "model.json";
|
|
37
50
|
/** M4d am25: the file in a run's folder that keeps the box as the run started with it (outside `job/`, which holds the three signed files only). */
|
|
38
51
|
export const RUN_THINKING_FILE: "thinking.json";
|
|
52
|
+
/** M4d am33: the file in a run's folder that records the model the run STARTED on (write-once; every continue path keeps it). */
|
|
53
|
+
export const RUN_MODEL_FILE: "run-model.json";
|
package/types/input-facts.d.ts
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @param {Array<{kind?:string, role:string, path:string}>} sources arbiter.sources
|
|
3
|
+
* @param {{pages?: Record<string, {text: string}>}} [o] `pages` (M10 item 1): the drafting copy of each web page input, role -> its frozen text, fetched by the caller. A page
|
|
4
|
+
* source with no copy here is a named red (never skipped); it adds no heading facts (a page has none), only its line for the drafter and the Chat card.
|
|
3
5
|
* `list` (M4d am10) is one `{role, detail}` per readable input for the Chat card's list (a CSV: its columns; text: its headings); never hashed.
|
|
4
|
-
*
|
|
6
|
+
* `sheets` (M10 piece 5): role -> the text of each CSV input, for the sheet-word look (the same read, not a second one).
|
|
7
|
+
* `docs` (M10 piece 5, item 2): role -> the text of each document input (.docx paragraphs, .md / .txt as is), the drafting copy a cited fact part's words are proved on.
|
|
8
|
+
* @returns {{ok:boolean, inputFacts:Record<string,string[]>, info:string[], list:Array<{role:string, detail:string}>, reds:string[], sheets:Record<string,string>, docs:Record<string,string>}}
|
|
5
9
|
*/
|
|
6
10
|
export function readInputFacts(sources: Array<{
|
|
7
11
|
kind?: string;
|
|
8
12
|
role: string;
|
|
9
13
|
path: string;
|
|
10
|
-
}
|
|
14
|
+
}>, { pages }?: {
|
|
15
|
+
pages?: Record<string, {
|
|
16
|
+
text: string;
|
|
17
|
+
}>;
|
|
18
|
+
}): {
|
|
11
19
|
ok: boolean;
|
|
12
20
|
inputFacts: Record<string, string[]>;
|
|
13
21
|
info: string[];
|
|
@@ -16,4 +24,6 @@ export function readInputFacts(sources: Array<{
|
|
|
16
24
|
detail: string;
|
|
17
25
|
}>;
|
|
18
26
|
reds: string[];
|
|
27
|
+
sheets: Record<string, string>;
|
|
28
|
+
docs: Record<string, string>;
|
|
19
29
|
};
|
package/types/model-step.d.ts
CHANGED
|
@@ -12,9 +12,11 @@
|
|
|
12
12
|
export function isTransportFailure(err: any): boolean;
|
|
13
13
|
/**
|
|
14
14
|
* Build the `emit_artifact` tool schema from a step's declared close CLASS
|
|
15
|
-
* only
|
|
15
|
+
* only (plus, for a green step that quotes a saved page, the form of its answer).
|
|
16
|
+
* `stepClass` is `'green' | 'softgreen' | 'hitl' | null | undefined`; `cited` is true for that green step.
|
|
16
17
|
*/
|
|
17
|
-
|
|
18
|
+
/** @param {string|null|undefined} stepClass @param {boolean} [cited] @param {any[]|null} [sheet] M10b piece 2: the step's `close.sheet` (its claim boxes become the answer) */
|
|
19
|
+
export function buildEmitArtifactSchema(stepClass: string | null | undefined, cited?: boolean, sheet?: any[] | null): Readonly<{
|
|
18
20
|
type: "object";
|
|
19
21
|
properties: {
|
|
20
22
|
done: {
|
|
@@ -25,21 +27,12 @@ export function buildEmitArtifactSchema(stepClass: any): Readonly<{
|
|
|
25
27
|
type: string[];
|
|
26
28
|
description: string;
|
|
27
29
|
};
|
|
28
|
-
|
|
30
|
+
text: {
|
|
29
31
|
type: string;
|
|
30
|
-
additionalProperties: {
|
|
31
|
-
type: string;
|
|
32
|
-
properties: {
|
|
33
|
-
value: {};
|
|
34
|
-
cite: {
|
|
35
|
-
type: string;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
required: string[];
|
|
39
|
-
};
|
|
40
32
|
};
|
|
41
33
|
};
|
|
42
34
|
required: string[];
|
|
35
|
+
additionalProperties: false;
|
|
43
36
|
}> | Readonly<{
|
|
44
37
|
type: "object";
|
|
45
38
|
properties: {
|
|
@@ -54,9 +47,12 @@ export function buildEmitArtifactSchema(stepClass: any): Readonly<{
|
|
|
54
47
|
text: {
|
|
55
48
|
type: string;
|
|
56
49
|
};
|
|
50
|
+
cells: {
|
|
51
|
+
type: string;
|
|
52
|
+
};
|
|
57
53
|
};
|
|
58
54
|
required: string[];
|
|
59
|
-
additionalProperties:
|
|
55
|
+
additionalProperties: true;
|
|
60
56
|
}> | Readonly<{
|
|
61
57
|
type: "object";
|
|
62
58
|
properties: {
|
|
@@ -68,16 +64,39 @@ export function buildEmitArtifactSchema(stepClass: any): Readonly<{
|
|
|
68
64
|
type: string[];
|
|
69
65
|
description: string;
|
|
70
66
|
};
|
|
71
|
-
|
|
67
|
+
results: {
|
|
72
68
|
type: string;
|
|
69
|
+
items: {
|
|
70
|
+
type: string;
|
|
71
|
+
properties: {
|
|
72
|
+
quote: {
|
|
73
|
+
type: string;
|
|
74
|
+
};
|
|
75
|
+
values: {
|
|
76
|
+
type: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
required: string[];
|
|
80
|
+
};
|
|
73
81
|
};
|
|
74
|
-
|
|
82
|
+
};
|
|
83
|
+
required: string[];
|
|
84
|
+
additionalProperties: false;
|
|
85
|
+
}> | {
|
|
86
|
+
type: string;
|
|
87
|
+
properties: {
|
|
88
|
+
done: {
|
|
75
89
|
type: string;
|
|
90
|
+
description: string;
|
|
91
|
+
};
|
|
92
|
+
blocker: {
|
|
93
|
+
type: string[];
|
|
94
|
+
description: string;
|
|
76
95
|
};
|
|
77
96
|
};
|
|
78
97
|
required: string[];
|
|
79
|
-
additionalProperties:
|
|
80
|
-
}
|
|
98
|
+
additionalProperties: boolean;
|
|
99
|
+
};
|
|
81
100
|
/**
|
|
82
101
|
* @param {object} opts
|
|
83
102
|
* @param {string} [opts.slot] - a provider row (the name of a key in the keys file); required when `provider` isn't injected.
|
|
@@ -87,7 +106,7 @@ export function buildEmitArtifactSchema(stepClass: any): Readonly<{
|
|
|
87
106
|
* @param {{in:number,out:number}} [opts.rates]
|
|
88
107
|
* @param {string} [opts.modelId]
|
|
89
108
|
* @param {Record<string,string|undefined>} [opts.env] - the merged shell+keys-file env the key is read from (default process.env).
|
|
90
|
-
* @returns {(executorContext:object, grantedTools:Record<string,any>, stepMeta?:{class?:string, attempt?:number, step?:string|null, thinkingMode?:'on'|'off'}, seam?:{stopRequested?:() => boolean}) => Promise<any>}
|
|
109
|
+
* @returns {(executorContext:object, grantedTools:Record<string,any>, stepMeta?:{class?:string, attempt?:number, step?:string|null, cited?:any, sheet?:any[]|null, thinkingMode?:'on'|'off'}, seam?:{stopRequested?:() => boolean}) => Promise<any>}
|
|
91
110
|
*/
|
|
92
111
|
export function makeLiveModelStep({ slot, model, spendPath, provider: injectedProvider, rates: injectedRates, modelId: injectedModelId, env, }: {
|
|
93
112
|
slot?: string | undefined;
|
|
@@ -104,6 +123,8 @@ export function makeLiveModelStep({ slot, model, spendPath, provider: injectedPr
|
|
|
104
123
|
class?: string;
|
|
105
124
|
attempt?: number;
|
|
106
125
|
step?: string | null;
|
|
126
|
+
cited?: any;
|
|
127
|
+
sheet?: any[] | null;
|
|
107
128
|
thinkingMode?: "on" | "off";
|
|
108
129
|
}, seam?: {
|
|
109
130
|
stopRequested?: () => boolean;
|