fwdloop 0.33.0 → 0.34.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 +14 -2
- package/package.json +1 -1
- package/src/auditchecks.js +6 -4
- package/src/authoring.js +4 -3
- package/src/blockasks.js +3 -2
- package/src/blockassemble.js +40 -21
- package/src/blockdraft.js +8 -13
- package/src/blockpick.js +11 -1
- package/src/checkblock.js +95 -56
- package/src/checklist.js +1 -1
- package/src/checklistsign.js +1 -1
- package/src/checkpick.js +7 -73
- package/src/declaration.js +9 -7
- package/src/drafter.js +152 -130
- package/src/noteask.js +62 -0
- package/src/pageask.js +5 -68
- package/src/pagedry.js +27 -4
- package/src/pagerules.js +19 -3
- package/src/panel/author.js +3 -3
- package/src/panel/authorcard.js +34 -11
- package/src/panel/index.html +7 -1
- package/src/pickrecord.js +42 -54
- package/src/planrebuild.js +16 -6
- package/src/rowedit.js +35 -5
- package/src/rubricstep.js +9 -1
- package/src/setup.js +1 -1
- package/src/sheetblock.js +17 -7
- package/src/sheetbuild.js +151 -0
- package/src/sheetchecks.js +3 -2
- package/src/sheetfind.js +4 -4
- package/src/sheetlook.js +14 -3
- package/src/sheetoffer.js +50 -5
- package/src/sheetrows.js +18 -2
- package/src/ticket-draft.js +4 -21
- package/src/ticketrows.js +100 -0
- package/types/auditchecks.d.ts +2 -1
- package/types/authoring.d.ts +4 -2
- package/types/blockasks.d.ts +1 -2
- package/types/blockassemble.d.ts +20 -3
- package/types/blockdraft.d.ts +4 -12
- package/types/blockpick.d.ts +5 -0
- package/types/checkblock.d.ts +32 -17
- package/types/checklist.d.ts +3 -3
- package/types/checkpick.d.ts +4 -34
- package/types/declaration.d.ts +7 -0
- package/types/drafter.d.ts +15 -355
- package/types/noteask.d.ts +52 -0
- package/types/pageask.d.ts +0 -35
- package/types/pagedry.d.ts +13 -0
- package/types/pagerules.d.ts +7 -0
- package/types/panel/authorcard.d.ts +13 -8
- package/types/panel/authorflows.d.ts +4 -4
- package/types/panel/data.d.ts +1 -1
- package/types/pickrecord.d.ts +47 -13
- package/types/rowedit.d.ts +16 -1
- package/types/rubricstep.d.ts +3 -0
- package/types/sheetblock.d.ts +11 -4
- package/types/sheetbuild.d.ts +84 -0
- package/types/sheetchecks.d.ts +2 -1
- package/types/sheetfind.d.ts +2 -2
- package/types/sheetoffer.d.ts +26 -1
- package/types/sheetrows.d.ts +8 -0
- package/types/ticket-draft.d.ts +3 -49
- package/types/ticketrows.d.ts +61 -0
- package/src/repairs.js +0 -38
- package/types/repairs.d.ts +0 -13
package/types/drafter.d.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The forced tool's parameter schema. `menu` = wiredMenu().
|
|
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.
|
|
2
|
+
* The forced tool's parameter schema. `menu` = wiredMenu(). M17 am2: the AI is offered no `close.sheet` (it suggests sheet checks on the row-edit reply, src/rowedit.js; code builds them, src/sheetbuild.js).
|
|
4
3
|
* M13 piece 4: `ticket` = `{flowType, tools}` for MCP (generic) and Tickets; then a step may carry `mcpTools` (an enum of the job's tools) and, for Tickets, the tool carries `ticketFilter` and `ticketWatch` (src/ticket-draft.js). The job's `mcp` block and `flowType` are set by code, never offered.
|
|
5
4
|
* M16 item 5: the AI is offered no `close.cited` (the list owns the facts; code builds them from its rows).
|
|
6
|
-
* @param {any[]} menu @param {{
|
|
5
|
+
* @param {any[]} menu @param {{ticket?: {flowType: 'mcp'|'tickets', tools: string[]}}} [o]
|
|
7
6
|
*/
|
|
8
|
-
export function buildDeclarationSchema(menu: any[], {
|
|
9
|
-
sheets?: Record<string, {
|
|
10
|
-
header: string[];
|
|
11
|
-
}>;
|
|
7
|
+
export function buildDeclarationSchema(menu: any[], { ticket }?: {
|
|
12
8
|
ticket?: {
|
|
13
9
|
flowType: "mcp" | "tickets";
|
|
14
10
|
tools: string[];
|
|
@@ -24,136 +20,6 @@ export function buildDeclarationSchema(menu: any[], { sheets, ticket }?: {
|
|
|
24
20
|
};
|
|
25
21
|
description: string;
|
|
26
22
|
};
|
|
27
|
-
unjudgeable: {
|
|
28
|
-
type: string;
|
|
29
|
-
additionalProperties: {
|
|
30
|
-
type: string;
|
|
31
|
-
};
|
|
32
|
-
description: string;
|
|
33
|
-
};
|
|
34
|
-
refused: {
|
|
35
|
-
type: string;
|
|
36
|
-
items: {
|
|
37
|
-
type: string;
|
|
38
|
-
properties: {
|
|
39
|
-
line: {
|
|
40
|
-
type: string;
|
|
41
|
-
};
|
|
42
|
-
reason: {
|
|
43
|
-
type: string;
|
|
44
|
-
minLength: number;
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
required: string[];
|
|
48
|
-
additionalProperties: boolean;
|
|
49
|
-
};
|
|
50
|
-
description: string;
|
|
51
|
-
};
|
|
52
|
-
ticketFilter?: undefined;
|
|
53
|
-
ticketWatch?: undefined;
|
|
54
|
-
steps: {
|
|
55
|
-
type: string;
|
|
56
|
-
minItems: number;
|
|
57
|
-
items: {
|
|
58
|
-
type: string;
|
|
59
|
-
properties: {
|
|
60
|
-
reads: {
|
|
61
|
-
type: string;
|
|
62
|
-
items: {
|
|
63
|
-
type: string;
|
|
64
|
-
};
|
|
65
|
-
description: string;
|
|
66
|
-
};
|
|
67
|
-
emits: {
|
|
68
|
-
type: string;
|
|
69
|
-
minLength: number;
|
|
70
|
-
description: string;
|
|
71
|
-
};
|
|
72
|
-
fromLine: {
|
|
73
|
-
type: string[];
|
|
74
|
-
description: string;
|
|
75
|
-
};
|
|
76
|
-
picks: {
|
|
77
|
-
type: string;
|
|
78
|
-
additionalProperties: {
|
|
79
|
-
type: string;
|
|
80
|
-
items: {
|
|
81
|
-
type: string;
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
description: string;
|
|
85
|
-
};
|
|
86
|
-
close: {
|
|
87
|
-
type: string;
|
|
88
|
-
properties: {
|
|
89
|
-
sheet?: Record<string, any> | undefined;
|
|
90
|
-
class: {
|
|
91
|
-
type: string;
|
|
92
|
-
enum: string[];
|
|
93
|
-
description: string;
|
|
94
|
-
};
|
|
95
|
-
columns: Readonly<{
|
|
96
|
-
type: "array";
|
|
97
|
-
minItems: 1;
|
|
98
|
-
maxItems: 10;
|
|
99
|
-
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";
|
|
100
|
-
items: {
|
|
101
|
-
type: string;
|
|
102
|
-
properties: {
|
|
103
|
-
source: {
|
|
104
|
-
type: string;
|
|
105
|
-
description: string;
|
|
106
|
-
};
|
|
107
|
-
column: {
|
|
108
|
-
type: string;
|
|
109
|
-
description: string;
|
|
110
|
-
};
|
|
111
|
-
};
|
|
112
|
-
required: string[];
|
|
113
|
-
additionalProperties: boolean;
|
|
114
|
-
};
|
|
115
|
-
}>;
|
|
116
|
-
};
|
|
117
|
-
required: string[];
|
|
118
|
-
additionalProperties: boolean;
|
|
119
|
-
};
|
|
120
|
-
mcpTools?: {
|
|
121
|
-
type: string;
|
|
122
|
-
items: {
|
|
123
|
-
type: string;
|
|
124
|
-
enum: string[];
|
|
125
|
-
};
|
|
126
|
-
description: string;
|
|
127
|
-
} | undefined;
|
|
128
|
-
primitives: {
|
|
129
|
-
type: string;
|
|
130
|
-
items: {
|
|
131
|
-
type: string;
|
|
132
|
-
enum: any[];
|
|
133
|
-
};
|
|
134
|
-
description: string;
|
|
135
|
-
};
|
|
136
|
-
};
|
|
137
|
-
required: string[];
|
|
138
|
-
additionalProperties: boolean;
|
|
139
|
-
};
|
|
140
|
-
};
|
|
141
|
-
} | {
|
|
142
|
-
guardrailClasses: {
|
|
143
|
-
type: string;
|
|
144
|
-
additionalProperties: {
|
|
145
|
-
type: string;
|
|
146
|
-
enum: string[];
|
|
147
|
-
};
|
|
148
|
-
description: string;
|
|
149
|
-
};
|
|
150
|
-
unjudgeable: {
|
|
151
|
-
type: string;
|
|
152
|
-
additionalProperties: {
|
|
153
|
-
type: string;
|
|
154
|
-
};
|
|
155
|
-
description: string;
|
|
156
|
-
};
|
|
157
23
|
refused: {
|
|
158
24
|
type: string;
|
|
159
25
|
items: {
|
|
@@ -172,36 +38,6 @@ export function buildDeclarationSchema(menu: any[], { sheets, ticket }?: {
|
|
|
172
38
|
};
|
|
173
39
|
description: string;
|
|
174
40
|
};
|
|
175
|
-
ticketFilter: {
|
|
176
|
-
type: string;
|
|
177
|
-
properties: {
|
|
178
|
-
priority: {
|
|
179
|
-
type: string;
|
|
180
|
-
items: {
|
|
181
|
-
type: string;
|
|
182
|
-
enum: string[];
|
|
183
|
-
};
|
|
184
|
-
description: string;
|
|
185
|
-
};
|
|
186
|
-
labels: {
|
|
187
|
-
type: string;
|
|
188
|
-
items: {
|
|
189
|
-
type: string;
|
|
190
|
-
};
|
|
191
|
-
description: string;
|
|
192
|
-
};
|
|
193
|
-
};
|
|
194
|
-
additionalProperties: boolean;
|
|
195
|
-
description: string;
|
|
196
|
-
};
|
|
197
|
-
ticketWatch: {
|
|
198
|
-
type: string;
|
|
199
|
-
items: {
|
|
200
|
-
type: string;
|
|
201
|
-
enum: string[];
|
|
202
|
-
};
|
|
203
|
-
description: string;
|
|
204
|
-
};
|
|
205
41
|
steps: {
|
|
206
42
|
type: string;
|
|
207
43
|
minItems: number;
|
|
@@ -237,7 +73,6 @@ export function buildDeclarationSchema(menu: any[], { sheets, ticket }?: {
|
|
|
237
73
|
close: {
|
|
238
74
|
type: string;
|
|
239
75
|
properties: {
|
|
240
|
-
sheet?: Record<string, any> | undefined;
|
|
241
76
|
class: {
|
|
242
77
|
type: string;
|
|
243
78
|
enum: string[];
|
|
@@ -293,156 +128,16 @@ export function buildDeclarationSchema(menu: any[], { sheets, ticket }?: {
|
|
|
293
128
|
required: string[];
|
|
294
129
|
additionalProperties: boolean;
|
|
295
130
|
};
|
|
296
|
-
/** The declaration schema plus
|
|
297
|
-
/** @param {any[]} menu @param {{questions?: boolean,
|
|
298
|
-
export function buildRoundSchema(menu: any[], { questions,
|
|
131
|
+
/** The declaration schema plus, on try 3 only, `questions` (not in `required`). */
|
|
132
|
+
/** @param {any[]} menu @param {{questions?: boolean, ticket?: {flowType: 'mcp'|'tickets', tools: string[]}}} [o] */
|
|
133
|
+
export function buildRoundSchema(menu: any[], { questions, ticket }?: {
|
|
299
134
|
questions?: boolean;
|
|
300
|
-
sheets?: Record<string, {
|
|
301
|
-
header: string[];
|
|
302
|
-
}> | undefined;
|
|
303
135
|
ticket?: {
|
|
304
136
|
flowType: "mcp" | "tickets";
|
|
305
137
|
tools: string[];
|
|
306
138
|
};
|
|
307
139
|
}): {
|
|
308
140
|
properties: {
|
|
309
|
-
notChecked: {
|
|
310
|
-
type: string;
|
|
311
|
-
items: {
|
|
312
|
-
type: string;
|
|
313
|
-
};
|
|
314
|
-
description: string;
|
|
315
|
-
};
|
|
316
|
-
guardrailClasses: {
|
|
317
|
-
type: string;
|
|
318
|
-
additionalProperties: {
|
|
319
|
-
type: string;
|
|
320
|
-
enum: string[];
|
|
321
|
-
};
|
|
322
|
-
description: string;
|
|
323
|
-
};
|
|
324
|
-
unjudgeable: {
|
|
325
|
-
type: string;
|
|
326
|
-
additionalProperties: {
|
|
327
|
-
type: string;
|
|
328
|
-
};
|
|
329
|
-
description: string;
|
|
330
|
-
};
|
|
331
|
-
refused: {
|
|
332
|
-
type: string;
|
|
333
|
-
items: {
|
|
334
|
-
type: string;
|
|
335
|
-
properties: {
|
|
336
|
-
line: {
|
|
337
|
-
type: string;
|
|
338
|
-
};
|
|
339
|
-
reason: {
|
|
340
|
-
type: string;
|
|
341
|
-
minLength: number;
|
|
342
|
-
};
|
|
343
|
-
};
|
|
344
|
-
required: string[];
|
|
345
|
-
additionalProperties: boolean;
|
|
346
|
-
};
|
|
347
|
-
description: string;
|
|
348
|
-
};
|
|
349
|
-
ticketFilter?: undefined;
|
|
350
|
-
ticketWatch?: undefined;
|
|
351
|
-
steps: {
|
|
352
|
-
type: string;
|
|
353
|
-
minItems: number;
|
|
354
|
-
items: {
|
|
355
|
-
type: string;
|
|
356
|
-
properties: {
|
|
357
|
-
reads: {
|
|
358
|
-
type: string;
|
|
359
|
-
items: {
|
|
360
|
-
type: string;
|
|
361
|
-
};
|
|
362
|
-
description: string;
|
|
363
|
-
};
|
|
364
|
-
emits: {
|
|
365
|
-
type: string;
|
|
366
|
-
minLength: number;
|
|
367
|
-
description: string;
|
|
368
|
-
};
|
|
369
|
-
fromLine: {
|
|
370
|
-
type: string[];
|
|
371
|
-
description: string;
|
|
372
|
-
};
|
|
373
|
-
picks: {
|
|
374
|
-
type: string;
|
|
375
|
-
additionalProperties: {
|
|
376
|
-
type: string;
|
|
377
|
-
items: {
|
|
378
|
-
type: string;
|
|
379
|
-
};
|
|
380
|
-
};
|
|
381
|
-
description: string;
|
|
382
|
-
};
|
|
383
|
-
close: {
|
|
384
|
-
type: string;
|
|
385
|
-
properties: {
|
|
386
|
-
sheet?: Record<string, any> | undefined;
|
|
387
|
-
class: {
|
|
388
|
-
type: string;
|
|
389
|
-
enum: string[];
|
|
390
|
-
description: string;
|
|
391
|
-
};
|
|
392
|
-
columns: Readonly<{
|
|
393
|
-
type: "array";
|
|
394
|
-
minItems: 1;
|
|
395
|
-
maxItems: 10;
|
|
396
|
-
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";
|
|
397
|
-
items: {
|
|
398
|
-
type: string;
|
|
399
|
-
properties: {
|
|
400
|
-
source: {
|
|
401
|
-
type: string;
|
|
402
|
-
description: string;
|
|
403
|
-
};
|
|
404
|
-
column: {
|
|
405
|
-
type: string;
|
|
406
|
-
description: string;
|
|
407
|
-
};
|
|
408
|
-
};
|
|
409
|
-
required: string[];
|
|
410
|
-
additionalProperties: boolean;
|
|
411
|
-
};
|
|
412
|
-
}>;
|
|
413
|
-
};
|
|
414
|
-
required: string[];
|
|
415
|
-
additionalProperties: boolean;
|
|
416
|
-
};
|
|
417
|
-
mcpTools?: {
|
|
418
|
-
type: string;
|
|
419
|
-
items: {
|
|
420
|
-
type: string;
|
|
421
|
-
enum: string[];
|
|
422
|
-
};
|
|
423
|
-
description: string;
|
|
424
|
-
} | undefined;
|
|
425
|
-
primitives: {
|
|
426
|
-
type: string;
|
|
427
|
-
items: {
|
|
428
|
-
type: string;
|
|
429
|
-
enum: any[];
|
|
430
|
-
};
|
|
431
|
-
description: string;
|
|
432
|
-
};
|
|
433
|
-
};
|
|
434
|
-
required: string[];
|
|
435
|
-
additionalProperties: boolean;
|
|
436
|
-
};
|
|
437
|
-
};
|
|
438
|
-
} | {
|
|
439
|
-
notChecked: {
|
|
440
|
-
type: string;
|
|
441
|
-
items: {
|
|
442
|
-
type: string;
|
|
443
|
-
};
|
|
444
|
-
description: string;
|
|
445
|
-
};
|
|
446
141
|
guardrailClasses: {
|
|
447
142
|
type: string;
|
|
448
143
|
additionalProperties: {
|
|
@@ -451,13 +146,6 @@ export function buildRoundSchema(menu: any[], { questions, sheets, ticket }?: {
|
|
|
451
146
|
};
|
|
452
147
|
description: string;
|
|
453
148
|
};
|
|
454
|
-
unjudgeable: {
|
|
455
|
-
type: string;
|
|
456
|
-
additionalProperties: {
|
|
457
|
-
type: string;
|
|
458
|
-
};
|
|
459
|
-
description: string;
|
|
460
|
-
};
|
|
461
149
|
refused: {
|
|
462
150
|
type: string;
|
|
463
151
|
items: {
|
|
@@ -476,36 +164,6 @@ export function buildRoundSchema(menu: any[], { questions, sheets, ticket }?: {
|
|
|
476
164
|
};
|
|
477
165
|
description: string;
|
|
478
166
|
};
|
|
479
|
-
ticketFilter: {
|
|
480
|
-
type: string;
|
|
481
|
-
properties: {
|
|
482
|
-
priority: {
|
|
483
|
-
type: string;
|
|
484
|
-
items: {
|
|
485
|
-
type: string;
|
|
486
|
-
enum: string[];
|
|
487
|
-
};
|
|
488
|
-
description: string;
|
|
489
|
-
};
|
|
490
|
-
labels: {
|
|
491
|
-
type: string;
|
|
492
|
-
items: {
|
|
493
|
-
type: string;
|
|
494
|
-
};
|
|
495
|
-
description: string;
|
|
496
|
-
};
|
|
497
|
-
};
|
|
498
|
-
additionalProperties: boolean;
|
|
499
|
-
description: string;
|
|
500
|
-
};
|
|
501
|
-
ticketWatch: {
|
|
502
|
-
type: string;
|
|
503
|
-
items: {
|
|
504
|
-
type: string;
|
|
505
|
-
enum: string[];
|
|
506
|
-
};
|
|
507
|
-
description: string;
|
|
508
|
-
};
|
|
509
167
|
steps: {
|
|
510
168
|
type: string;
|
|
511
169
|
minItems: number;
|
|
@@ -541,7 +199,6 @@ export function buildRoundSchema(menu: any[], { questions, sheets, ticket }?: {
|
|
|
541
199
|
close: {
|
|
542
200
|
type: string;
|
|
543
201
|
properties: {
|
|
544
|
-
sheet?: Record<string, any> | undefined;
|
|
545
202
|
class: {
|
|
546
203
|
type: string;
|
|
547
204
|
enum: string[];
|
|
@@ -658,7 +315,7 @@ export function goalForLine(fromLine: any, lines: any): any;
|
|
|
658
315
|
* `learnHints` (M8 item 5a): the earlier runs' notes block (src/learnstore.js hintsForRun), appended to the drafter's system prompt; null = nothing.
|
|
659
316
|
* `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`.
|
|
660
317
|
*/
|
|
661
|
-
export function draft({ proseText, slot, model, provider: injected, rates: injectedRates, modelId: injectedModelId, env, priorSpend, skills, makeProviderFn, onBook, offerQuestions, draftThinking, draftDir, fetchPage, leftRules, checkPicks, carriedPicks, carriedChoices, carriedSheetDropped, onSheetDropped, onChoices, onPickRecord, learnHints, mcpServers, flowType, mcp, }: {
|
|
318
|
+
export function draft({ proseText, slot, model, provider: injected, rates: injectedRates, modelId: injectedModelId, env, priorSpend, skills, makeProviderFn, onBook, offerQuestions, draftThinking, draftDir, fetchPage, leftRules, columnAnswers, carriedColumns, onColumns, checkPicks, carriedPicks, carriedChoices, carriedSheetDropped, onSheetDropped, onChoices, onPickRecord, learnHints, mcpServers, flowType, mcp, }: {
|
|
662
319
|
proseText: any;
|
|
663
320
|
slot: any;
|
|
664
321
|
model: any;
|
|
@@ -678,6 +335,13 @@ export function draft({ proseText, slot, model, provider: injected, rates: injec
|
|
|
678
335
|
line: number;
|
|
679
336
|
rule: number;
|
|
680
337
|
}[] | undefined;
|
|
338
|
+
columnAnswers?: {
|
|
339
|
+
line: number;
|
|
340
|
+
word: string;
|
|
341
|
+
column: string;
|
|
342
|
+
}[] | undefined;
|
|
343
|
+
carriedColumns?: any[] | undefined;
|
|
344
|
+
onColumns?: ((rec: any[]) => void) | undefined;
|
|
681
345
|
checkPicks?: import("./checkpick.js").Pick[] | undefined;
|
|
682
346
|
carriedPicks?: import("./pickrecord.js").Entry[] | undefined;
|
|
683
347
|
carriedChoices?: any[] | null | undefined;
|
|
@@ -698,7 +362,7 @@ export function draft({ proseText, slot, model, provider: injected, rates: injec
|
|
|
698
362
|
ids: string[];
|
|
699
363
|
} | null | undefined;
|
|
700
364
|
mcpServers?: string[] | undefined;
|
|
701
|
-
flowType?: "
|
|
365
|
+
flowType?: "tickets" | "mcp" | "plain" | undefined;
|
|
702
366
|
mcp?: any;
|
|
703
367
|
}): Promise<{
|
|
704
368
|
ok: boolean;
|
|
@@ -757,10 +421,6 @@ export const CLASSES: readonly string[];
|
|
|
757
421
|
export const WHOLE_OUTPUT_CEILING_RULE: "use the guardrail's ceiling for the whole output";
|
|
758
422
|
export function docRolesOf(sources: any[] | undefined): string[];
|
|
759
423
|
export const MAX_QUESTIONS: 2;
|
|
760
|
-
/** What fwdloop's typed checks can really check (bareloop F174: give the model the real list, or "Not checked" is invented). */
|
|
761
|
-
export const CHECKABLE: readonly string[];
|
|
762
|
-
/** Offered on EVERY try (it is information, not asking). */
|
|
763
|
-
export const NOTCHECKED_PROMPT: string;
|
|
764
424
|
/** Try 3 only, and only after tries 1 and 2 both failed validation. No digit and no number word anywhere (a test greps this): the machine, not the prompt, bounds the count. */
|
|
765
425
|
export const QUESTIONS_PROMPT: string;
|
|
766
426
|
import { makeProvider } from './provider.js';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** What the AI is told: the numbered job lines (text only) and the one question. @param {{n: number, text: string}[]} lines @returns {string} */
|
|
2
|
+
export function notePrompt(lines: {
|
|
3
|
+
n: number;
|
|
4
|
+
text: string;
|
|
5
|
+
}[]): string;
|
|
6
|
+
/**
|
|
7
|
+
* Code reads the typed answer: every asked line answered exactly yes or no, else null (no repair). An answer for a line not asked is unreadable too.
|
|
8
|
+
* @param {any} args the tool's arguments @param {{n: number}[]} lines @returns {Map<number, 'yes'|'no'>|null}
|
|
9
|
+
*/
|
|
10
|
+
export function decideNote(args: any, lines: {
|
|
11
|
+
n: number;
|
|
12
|
+
}[]): Map<number, "yes" | "no"> | null;
|
|
13
|
+
/**
|
|
14
|
+
* The answers per asked line as the block reads them: the typed answer, or `failed` for every asked line when there is none. ONE function, shared by the draft and the replay.
|
|
15
|
+
* @param {number[]} asked the facts-only lines asked @param {any} args the tool's arguments, or null @param {{n: number}[]} lines
|
|
16
|
+
* @returns {{line: number, answer: 'yes'|'no'|'failed'}[]}
|
|
17
|
+
*/
|
|
18
|
+
export function noteAnswers(asked: number[], args: any, lines: {
|
|
19
|
+
n: number;
|
|
20
|
+
}[]): {
|
|
21
|
+
line: number;
|
|
22
|
+
answer: "yes" | "no" | "failed";
|
|
23
|
+
}[];
|
|
24
|
+
/** the label of the forced turn, as the draft's log and the replay in src/planrebuild.js see it */
|
|
25
|
+
export const NOTE_KIND: "note-ask";
|
|
26
|
+
export const NOTE_TOOL: "answer_note_question";
|
|
27
|
+
export const NOTE_SYSTEM: "You read the numbered lines of a job. You answer only about what each line says; you never invent words.";
|
|
28
|
+
export const NOTE_SCHEMA: Readonly<{
|
|
29
|
+
type: "object";
|
|
30
|
+
properties: {
|
|
31
|
+
lines: {
|
|
32
|
+
type: string;
|
|
33
|
+
items: {
|
|
34
|
+
type: string;
|
|
35
|
+
properties: {
|
|
36
|
+
line: {
|
|
37
|
+
type: string;
|
|
38
|
+
minimum: number;
|
|
39
|
+
description: string;
|
|
40
|
+
};
|
|
41
|
+
writtenWords: {
|
|
42
|
+
enum: string[];
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
required: string[];
|
|
46
|
+
additionalProperties: boolean;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
required: string[];
|
|
51
|
+
additionalProperties: false;
|
|
52
|
+
}>;
|
package/types/pageask.d.ts
CHANGED
|
@@ -17,29 +17,6 @@ export function panelQuestionText(q: {
|
|
|
17
17
|
line: number;
|
|
18
18
|
source?: string;
|
|
19
19
|
}): string;
|
|
20
|
-
/**
|
|
21
|
-
* The early asks CODE forces before any paid drafting, from the look's own result. One ask per rule text on a line; readings first, then can't-check
|
|
22
|
-
* asks, each in line order. The caller applies the cap and the answer gate.
|
|
23
|
-
* @param {{facts?: {line: number, forRule?: number, name?: string, shape?: string, unit?: string[], currency?: string[], reading?: import('./pagerules.js').Reading}[]}|null|undefined} look
|
|
24
|
-
* @param {{n: number, text?: string, rule?: string, rules?: string[]}[]|null|undefined} jobLines
|
|
25
|
-
* @returns {LookAsk[]}
|
|
26
|
-
*/
|
|
27
|
-
export function askableFromLook(look: {
|
|
28
|
-
facts?: {
|
|
29
|
-
line: number;
|
|
30
|
-
forRule?: number;
|
|
31
|
-
name?: string;
|
|
32
|
-
shape?: string;
|
|
33
|
-
unit?: string[];
|
|
34
|
-
currency?: string[];
|
|
35
|
-
reading?: import("./pagerules.js").Reading;
|
|
36
|
-
}[];
|
|
37
|
-
} | null | undefined, jobLines: {
|
|
38
|
-
n: number;
|
|
39
|
-
text?: string;
|
|
40
|
-
rule?: string;
|
|
41
|
-
rules?: string[];
|
|
42
|
-
}[] | null | undefined): LookAsk[];
|
|
43
20
|
/**
|
|
44
21
|
* More asks than the cap means the job needs a rewrite, not a questionnaire. The code-owned stop words list EVERY ask and its reading as the
|
|
45
22
|
* suggestion (no extra paid call). A secret in a rule is masked.
|
|
@@ -81,15 +58,3 @@ export function isAgree(text: unknown): boolean;
|
|
|
81
58
|
export function stripAgreeLead(text: string): string;
|
|
82
59
|
export function readingQuestion(n: number, rule: string, reading: string): string;
|
|
83
60
|
export function cantCheckQuestion(n: number, rule: string): string;
|
|
84
|
-
/**
|
|
85
|
-
* `reading` = the plain words an `agree` writes as a `~` rule (a reading ask only)
|
|
86
|
-
*/
|
|
87
|
-
export type LookAsk = {
|
|
88
|
-
line: number;
|
|
89
|
-
rule: number;
|
|
90
|
-
source: "look";
|
|
91
|
-
question: string;
|
|
92
|
-
ask: "reading" | "cant-check";
|
|
93
|
-
ruleText: string;
|
|
94
|
-
reading?: string;
|
|
95
|
-
};
|
package/types/pagedry.d.ts
CHANGED
|
@@ -19,6 +19,19 @@ export function dryReadMoney(text: string, facts: KeptFact[]): Promise<{
|
|
|
19
19
|
reads: Record<string, number>;
|
|
20
20
|
results: Record<string, number>;
|
|
21
21
|
}>;
|
|
22
|
+
/**
|
|
23
|
+
* The page's RESULT LINES: the lines the given money facts read (`moneyResultLines`), each quote once. Empty when no money fact reads a line (the result lines are then unknown).
|
|
24
|
+
* The one owner of "what is a result row" for phrase facts, shared by the dry read below and by the check list's `!` rows (`phraseInNoResult`).
|
|
25
|
+
* @param {string} text @param {KeptFact[]} facts @returns {string[]}
|
|
26
|
+
*/
|
|
27
|
+
export function resultQuotes(text: string, facts: KeptFact[]): string[];
|
|
28
|
+
/**
|
|
29
|
+
* Is this phrase in the page but in NONE of its result lines (the `phrase-no-result` case)? Sync, for a `!` row the check list is about to build.
|
|
30
|
+
* True only when result lines exist and no line holds the words (case and spacing aside, a plain substring: it never refuses a phrase the run's presence check could pass).
|
|
31
|
+
* With no result line known nothing is guessed (false).
|
|
32
|
+
* @param {string} text @param {KeptFact[]} moneyFacts the line's money facts @param {string} words @returns {boolean}
|
|
33
|
+
*/
|
|
34
|
+
export function phraseInNoResult(text: string, moneyFacts: KeptFact[], words: string): boolean;
|
|
22
35
|
/**
|
|
23
36
|
* The same "can it read" for PHRASE facts (bareloop c550dc8; our failure: m10-walk-flights-3, "Rome" was on the page only in "Track prices from Madrid to
|
|
24
37
|
* Rome" switches, in none of the 18 result lines, so no result could ever say it). A kept phrase fact is read against the page's RESULT LINES = the lines
|
package/types/pagerules.d.ts
CHANGED
|
@@ -26,6 +26,13 @@ export function validReading(shape: unknown, r: unknown): boolean;
|
|
|
26
26
|
* @param {string} s @returns {string|undefined}
|
|
27
27
|
*/
|
|
28
28
|
export function numberAtEnd(s: string): string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* The ONE owner of a label's separator: the label as the page writes it. The run's checker reads a value right after the signed label, so a page that
|
|
31
|
+
* writes "Departure time: 10:24 AM." can only be read by the label "Departure time:". When EVERY place the page holds the label has a colon right after
|
|
32
|
+
* it, the label is signed with that colon; one bare place leaves it as the look gave it. A plain count of the page's own text, no pattern.
|
|
33
|
+
* @param {string} text the frozen page text @param {string} label a label as normLabel leaves it @returns {string}
|
|
34
|
+
*/
|
|
35
|
+
export function withColon(text: string, label: string): string;
|
|
29
36
|
/**
|
|
30
37
|
* Apply the rules to the AI's map over one saved page. Returns the kept facts and, for everything a rule removed, one `dropped` entry.
|
|
31
38
|
* The order of the rules is the POC's (apply-v3.mjs): found-on-page, then the rules that read the page. A place is read as a phrase.
|
|
@@ -37,7 +37,7 @@ export function appendAnswersToJob(job: string, answers: {
|
|
|
37
37
|
added: number;
|
|
38
38
|
};
|
|
39
39
|
/**
|
|
40
|
-
* M10 am21: the submitted job box with ONE `~`
|
|
40
|
+
* M10 am21, M17 am1: the submitted job box with ONE `~` rule of a job line (a whole `~` line, or one `; ` part of it) replaced by the words of an answer. Pure.
|
|
41
41
|
* @param {string} job @param {number} line the job line (step) number @param {string} oldText the `~` words to replace (case and spacing aside) @param {string} newText
|
|
42
42
|
* @returns {{ job: string, replaced: boolean }}
|
|
43
43
|
*/
|
|
@@ -46,11 +46,12 @@ export function replaceRuleOnJob(job: string, line: number, oldText: string, new
|
|
|
46
46
|
replaced: boolean;
|
|
47
47
|
};
|
|
48
48
|
/**
|
|
49
|
-
* THE one writer of what a set of answers does to the job box and to the picks (M4e am24, M10 am16 (4),
|
|
50
|
-
* (
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* @
|
|
49
|
+
* THE one writer of what a set of answers does to the job box and to the picks (M4e am24, M10 am16 (4); M17 am1 (a), one rule in, one rule out): an answer about one of the person's `~` rules
|
|
50
|
+
* (a look ask with a rule number) REPLACES that rule in place, the same line and the same rule number (`replaceRuleOnJob`), and never adds a line beside it. Only an answer that is about no
|
|
51
|
+
* rule (a drafter question, a sheet column ask) is still added word for word as a new `~` line (`appendAnswersToJob`). Picks and left rules are numbered as the asks carried them; a pick carries
|
|
52
|
+
* no `added` words, because its rule's words ARE the answer. A rule-about answer whose rule is no longer on the job line is not applied (the caller sees the count and refuses).
|
|
53
|
+
* @param {string} job @param {{line: number, rule: string|null, left: boolean, check?: Record<string, any>|null, own?: boolean, ruleNo?: number, ruleText?: string, ask?: string, proposal?: string|null}[]} all
|
|
54
|
+
* @returns {{job: string, added: number, picks: {line: number, rule: number|undefined, check: Record<string, any>|null, own?: boolean}[], left: {line: number, rule: number|undefined}[], columns: {line: number, word: string, column: string}[]}}
|
|
54
55
|
*/
|
|
55
56
|
export function applyAnswers(job: string, all: {
|
|
56
57
|
line: number;
|
|
@@ -61,7 +62,7 @@ export function applyAnswers(job: string, all: {
|
|
|
61
62
|
ruleNo?: number;
|
|
62
63
|
ruleText?: string;
|
|
63
64
|
ask?: string;
|
|
64
|
-
|
|
65
|
+
proposal?: string | null;
|
|
65
66
|
}[]): {
|
|
66
67
|
job: string;
|
|
67
68
|
added: number;
|
|
@@ -69,13 +70,17 @@ export function applyAnswers(job: string, all: {
|
|
|
69
70
|
line: number;
|
|
70
71
|
rule: number | undefined;
|
|
71
72
|
check: Record<string, any> | null;
|
|
72
|
-
added: string;
|
|
73
73
|
own?: boolean;
|
|
74
74
|
}[];
|
|
75
75
|
left: {
|
|
76
76
|
line: number;
|
|
77
77
|
rule: number | undefined;
|
|
78
78
|
}[];
|
|
79
|
+
columns: {
|
|
80
|
+
line: number;
|
|
81
|
+
word: string;
|
|
82
|
+
column: string;
|
|
83
|
+
}[];
|
|
79
84
|
};
|
|
80
85
|
/**
|
|
81
86
|
* THE one place a step's `~` lines become its guardrail: several `~` lines under one step are ONE continuous guardrail (hamr ruling 2026-10-09),
|