fwdloop 0.26.1 → 0.27.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 +23 -3
- package/package.json +3 -3
- package/src/authoring.js +10 -0
- package/src/canrun.js +20 -0
- package/src/declaration.js +98 -2
- package/src/drafter.js +23 -10
- package/src/launcher.js +3 -2
- package/src/learnstore.js +1 -1
- package/src/pageask.js +18 -2
- package/src/pagefetch.js +10 -5
- package/src/panel/author.js +18 -2
- package/src/panel/authorflows.js +9 -4
- package/src/panel/authorstart.js +10 -6
- package/src/panel/authortrigger.js +34 -10
- package/src/panel/data.js +39 -4
- package/src/panel/index.html +516 -60
- package/src/panel/scheduler.js +42 -6
- package/src/panel/server.js +21 -5
- package/src/panel/tickets.js +113 -0
- package/src/runner.js +51 -10
- package/src/schedule.js +5 -0
- package/src/summary-words.js +12 -4
- package/src/ticket-draft.js +87 -0
- package/src/ticket-labels.js +65 -0
- package/src/ticket-mcp.js +66 -0
- package/src/ticket-shape.js +24 -0
- package/src/trigger-files.js +1 -1
- package/src/trigger-line.js +2 -1
- package/src/trigger-tickets.js +209 -0
- package/types/canrun.d.ts +14 -0
- package/types/drafter.d.ts +186 -64
- package/types/pageask.d.ts +1 -0
- package/types/pagefetch.d.ts +6 -3
- package/types/panel/author.d.ts +8 -0
- package/types/panel/authorflows.d.ts +2 -0
- package/types/panel/authorstart.d.ts +3 -1
- package/types/panel/authortrigger.d.ts +11 -1
- package/types/panel/data.d.ts +22 -3
- package/types/panel/scheduler.d.ts +7 -2
- package/types/panel/server.d.ts +9 -2
- package/types/panel/tickets.d.ts +81 -0
- package/types/runner.d.ts +21 -3
- package/types/summary-words.d.ts +2 -1
- package/types/ticket-draft.d.ts +96 -0
- package/types/ticket-labels.d.ts +36 -0
- package/types/ticket-mcp.d.ts +40 -0
- package/types/ticket-shape.d.ts +25 -0
- package/types/trigger-files.d.ts +2 -0
- package/types/trigger-line.d.ts +7 -0
- package/types/trigger-tickets.d.ts +91 -0
package/types/drafter.d.ts
CHANGED
|
@@ -1,29 +1,107 @@
|
|
|
1
1
|
/**
|
|
2
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
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
|
-
*
|
|
4
|
+
* M12 piece 3: `ticket` = `{servers}` when the job signs a ticket list; then the tool may also carry `mcp`, `ticketFilter` and a step's `mcpTools` (src/ticket-draft.js).
|
|
5
|
+
* @param {any[]} menu @param {{sheets?: Record<string, {header: string[]}>, ticket?: {servers: string[]}}} [o]
|
|
5
6
|
*/
|
|
6
|
-
export function buildDeclarationSchema(menu: any[], { sheets }?: {
|
|
7
|
+
export function buildDeclarationSchema(menu: any[], { sheets, ticket }?: {
|
|
7
8
|
sheets?: Record<string, {
|
|
8
9
|
header: string[];
|
|
9
10
|
}>;
|
|
11
|
+
ticket?: {
|
|
12
|
+
servers: string[];
|
|
13
|
+
};
|
|
10
14
|
}): {
|
|
11
15
|
type: string;
|
|
12
16
|
properties: {
|
|
13
|
-
|
|
17
|
+
guardrailClasses: {
|
|
18
|
+
type: string;
|
|
19
|
+
additionalProperties: {
|
|
20
|
+
type: string;
|
|
21
|
+
enum: string[];
|
|
22
|
+
};
|
|
23
|
+
description: string;
|
|
24
|
+
};
|
|
25
|
+
unjudgeable: {
|
|
26
|
+
type: string;
|
|
27
|
+
additionalProperties: {
|
|
28
|
+
type: string;
|
|
29
|
+
};
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
refused: {
|
|
14
33
|
type: string;
|
|
15
|
-
minItems: number;
|
|
16
34
|
items: {
|
|
17
35
|
type: string;
|
|
18
36
|
properties: {
|
|
19
|
-
|
|
37
|
+
line: {
|
|
20
38
|
type: string;
|
|
21
|
-
items: {
|
|
22
|
-
type: string;
|
|
23
|
-
enum: any[];
|
|
24
|
-
};
|
|
25
|
-
description: string;
|
|
26
39
|
};
|
|
40
|
+
reason: {
|
|
41
|
+
type: string;
|
|
42
|
+
minLength: number;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
required: string[];
|
|
46
|
+
additionalProperties: boolean;
|
|
47
|
+
};
|
|
48
|
+
description: string;
|
|
49
|
+
};
|
|
50
|
+
mcp?: {
|
|
51
|
+
type: string;
|
|
52
|
+
properties: {
|
|
53
|
+
server: {
|
|
54
|
+
type: string;
|
|
55
|
+
enum: string[];
|
|
56
|
+
};
|
|
57
|
+
tools: {
|
|
58
|
+
type: string;
|
|
59
|
+
items: {
|
|
60
|
+
type: string;
|
|
61
|
+
enum: string[];
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
required: string[];
|
|
66
|
+
additionalProperties: boolean;
|
|
67
|
+
description: string;
|
|
68
|
+
} | undefined;
|
|
69
|
+
ticketFilter?: {
|
|
70
|
+
type: string;
|
|
71
|
+
properties: {
|
|
72
|
+
priority: {
|
|
73
|
+
type: string;
|
|
74
|
+
items: {
|
|
75
|
+
type: string;
|
|
76
|
+
enum: string[];
|
|
77
|
+
};
|
|
78
|
+
description: string;
|
|
79
|
+
};
|
|
80
|
+
labels: {
|
|
81
|
+
type: string;
|
|
82
|
+
items: {
|
|
83
|
+
type: string;
|
|
84
|
+
};
|
|
85
|
+
description: string;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
additionalProperties: boolean;
|
|
89
|
+
description: string;
|
|
90
|
+
} | undefined;
|
|
91
|
+
ticketWatch?: {
|
|
92
|
+
type: string;
|
|
93
|
+
items: {
|
|
94
|
+
type: string;
|
|
95
|
+
enum: string[];
|
|
96
|
+
};
|
|
97
|
+
description: string;
|
|
98
|
+
} | undefined;
|
|
99
|
+
steps: {
|
|
100
|
+
type: string;
|
|
101
|
+
minItems: number;
|
|
102
|
+
items: {
|
|
103
|
+
type: string;
|
|
104
|
+
properties: {
|
|
27
105
|
reads: {
|
|
28
106
|
type: string;
|
|
29
107
|
items: {
|
|
@@ -179,11 +257,50 @@ export function buildDeclarationSchema(menu: any[], { sheets }?: {
|
|
|
179
257
|
required: string[];
|
|
180
258
|
additionalProperties: boolean;
|
|
181
259
|
};
|
|
260
|
+
mcpTools?: {
|
|
261
|
+
type: string;
|
|
262
|
+
items: {
|
|
263
|
+
type: string;
|
|
264
|
+
enum: string[];
|
|
265
|
+
};
|
|
266
|
+
description: string;
|
|
267
|
+
} | undefined;
|
|
268
|
+
primitives: {
|
|
269
|
+
type: string;
|
|
270
|
+
items: {
|
|
271
|
+
type: string;
|
|
272
|
+
enum: any[];
|
|
273
|
+
};
|
|
274
|
+
description: string;
|
|
275
|
+
};
|
|
182
276
|
};
|
|
183
277
|
required: string[];
|
|
184
278
|
additionalProperties: boolean;
|
|
185
279
|
};
|
|
186
280
|
};
|
|
281
|
+
};
|
|
282
|
+
required: string[];
|
|
283
|
+
additionalProperties: boolean;
|
|
284
|
+
};
|
|
285
|
+
/** The declaration schema plus the optional `notChecked` (every try) and, on try 3 only, `questions`. Neither is in `required`. */
|
|
286
|
+
/** @param {any[]} menu @param {{questions?: boolean, sheets?: Record<string, {header: string[]}>|undefined, ticket?: {servers: string[]}}} [o] */
|
|
287
|
+
export function buildRoundSchema(menu: any[], { questions, sheets, ticket }?: {
|
|
288
|
+
questions?: boolean;
|
|
289
|
+
sheets?: Record<string, {
|
|
290
|
+
header: string[];
|
|
291
|
+
}> | undefined;
|
|
292
|
+
ticket?: {
|
|
293
|
+
servers: string[];
|
|
294
|
+
};
|
|
295
|
+
}): {
|
|
296
|
+
properties: {
|
|
297
|
+
notChecked: {
|
|
298
|
+
type: string;
|
|
299
|
+
items: {
|
|
300
|
+
type: string;
|
|
301
|
+
};
|
|
302
|
+
description: string;
|
|
303
|
+
};
|
|
187
304
|
guardrailClasses: {
|
|
188
305
|
type: string;
|
|
189
306
|
additionalProperties: {
|
|
@@ -217,40 +334,61 @@ export function buildDeclarationSchema(menu: any[], { sheets }?: {
|
|
|
217
334
|
};
|
|
218
335
|
description: string;
|
|
219
336
|
};
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
337
|
+
mcp?: {
|
|
338
|
+
type: string;
|
|
339
|
+
properties: {
|
|
340
|
+
server: {
|
|
341
|
+
type: string;
|
|
342
|
+
enum: string[];
|
|
343
|
+
};
|
|
344
|
+
tools: {
|
|
345
|
+
type: string;
|
|
346
|
+
items: {
|
|
347
|
+
type: string;
|
|
348
|
+
enum: string[];
|
|
349
|
+
};
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
required: string[];
|
|
353
|
+
additionalProperties: boolean;
|
|
354
|
+
description: string;
|
|
355
|
+
} | undefined;
|
|
356
|
+
ticketFilter?: {
|
|
357
|
+
type: string;
|
|
358
|
+
properties: {
|
|
359
|
+
priority: {
|
|
360
|
+
type: string;
|
|
361
|
+
items: {
|
|
362
|
+
type: string;
|
|
363
|
+
enum: string[];
|
|
364
|
+
};
|
|
365
|
+
description: string;
|
|
366
|
+
};
|
|
367
|
+
labels: {
|
|
368
|
+
type: string;
|
|
369
|
+
items: {
|
|
370
|
+
type: string;
|
|
371
|
+
};
|
|
372
|
+
description: string;
|
|
373
|
+
};
|
|
374
|
+
};
|
|
375
|
+
additionalProperties: boolean;
|
|
376
|
+
description: string;
|
|
377
|
+
} | undefined;
|
|
378
|
+
ticketWatch?: {
|
|
234
379
|
type: string;
|
|
235
380
|
items: {
|
|
236
381
|
type: string;
|
|
382
|
+
enum: string[];
|
|
237
383
|
};
|
|
238
384
|
description: string;
|
|
239
|
-
};
|
|
385
|
+
} | undefined;
|
|
240
386
|
steps: {
|
|
241
387
|
type: string;
|
|
242
388
|
minItems: number;
|
|
243
389
|
items: {
|
|
244
390
|
type: string;
|
|
245
391
|
properties: {
|
|
246
|
-
primitives: {
|
|
247
|
-
type: string;
|
|
248
|
-
items: {
|
|
249
|
-
type: string;
|
|
250
|
-
enum: any[];
|
|
251
|
-
};
|
|
252
|
-
description: string;
|
|
253
|
-
};
|
|
254
392
|
reads: {
|
|
255
393
|
type: string;
|
|
256
394
|
items: {
|
|
@@ -406,43 +544,26 @@ export function buildRoundSchema(menu: any[], { questions, sheets }?: {
|
|
|
406
544
|
required: string[];
|
|
407
545
|
additionalProperties: boolean;
|
|
408
546
|
};
|
|
409
|
-
|
|
410
|
-
required: string[];
|
|
411
|
-
additionalProperties: boolean;
|
|
412
|
-
};
|
|
413
|
-
};
|
|
414
|
-
guardrailClasses: {
|
|
415
|
-
type: string;
|
|
416
|
-
additionalProperties: {
|
|
417
|
-
type: string;
|
|
418
|
-
enum: string[];
|
|
419
|
-
};
|
|
420
|
-
description: string;
|
|
421
|
-
};
|
|
422
|
-
unjudgeable: {
|
|
423
|
-
type: string;
|
|
424
|
-
additionalProperties: {
|
|
425
|
-
type: string;
|
|
426
|
-
};
|
|
427
|
-
description: string;
|
|
428
|
-
};
|
|
429
|
-
refused: {
|
|
430
|
-
type: string;
|
|
431
|
-
items: {
|
|
432
|
-
type: string;
|
|
433
|
-
properties: {
|
|
434
|
-
line: {
|
|
547
|
+
mcpTools?: {
|
|
435
548
|
type: string;
|
|
436
|
-
|
|
437
|
-
|
|
549
|
+
items: {
|
|
550
|
+
type: string;
|
|
551
|
+
enum: string[];
|
|
552
|
+
};
|
|
553
|
+
description: string;
|
|
554
|
+
} | undefined;
|
|
555
|
+
primitives: {
|
|
438
556
|
type: string;
|
|
439
|
-
|
|
557
|
+
items: {
|
|
558
|
+
type: string;
|
|
559
|
+
enum: any[];
|
|
560
|
+
};
|
|
561
|
+
description: string;
|
|
440
562
|
};
|
|
441
563
|
};
|
|
442
564
|
required: string[];
|
|
443
565
|
additionalProperties: boolean;
|
|
444
566
|
};
|
|
445
|
-
description: string;
|
|
446
567
|
};
|
|
447
568
|
};
|
|
448
569
|
type: string;
|
|
@@ -492,7 +613,7 @@ export function goalForLine(fromLine: any, lines: any): any;
|
|
|
492
613
|
* `learnHints` (M8 item 5a): the earlier runs' notes block (src/learnstore.js hintsForRun), appended to the drafter's system prompt; null = nothing.
|
|
493
614
|
* `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`.
|
|
494
615
|
*/
|
|
495
|
-
export function draft({ proseText, slot, model, provider: injected, rates: injectedRates, modelId: injectedModelId, env, priorSpend, skills, makeProviderFn, onBook, offerQuestions, draftThinking, draftDir, fetchPage, leftRules, learnHints, }: {
|
|
616
|
+
export function draft({ proseText, slot, model, provider: injected, rates: injectedRates, modelId: injectedModelId, env, priorSpend, skills, makeProviderFn, onBook, offerQuestions, draftThinking, draftDir, fetchPage, leftRules, learnHints, mcpServers, }: {
|
|
496
617
|
proseText: any;
|
|
497
618
|
slot: any;
|
|
498
619
|
model: any;
|
|
@@ -516,6 +637,7 @@ export function draft({ proseText, slot, model, provider: injected, rates: injec
|
|
|
516
637
|
text: string;
|
|
517
638
|
ids: string[];
|
|
518
639
|
} | null | undefined;
|
|
640
|
+
mcpServers?: string[] | undefined;
|
|
519
641
|
}): Promise<{
|
|
520
642
|
ok: boolean;
|
|
521
643
|
declaration: object | null;
|
package/types/pageask.d.ts
CHANGED
|
@@ -61,6 +61,7 @@ export const MAX_LOOK_ASKS: 3;
|
|
|
61
61
|
export const DROP_IT: "drop it";
|
|
62
62
|
export function isDropIt(text: unknown): boolean;
|
|
63
63
|
export function isAgree(text: unknown): boolean;
|
|
64
|
+
export function stripAgreeLead(text: string): string;
|
|
64
65
|
/**
|
|
65
66
|
* `reading` = the plain words an `agree` writes as a `~` rule (a reading ask only)
|
|
66
67
|
*/
|
package/types/pagefetch.d.ts
CHANGED
|
@@ -65,16 +65,19 @@ export const MIN_CONTENT_CHARS: 100;
|
|
|
65
65
|
/** our own deadline around one whole fetch (a hung browser leaves no trace; this is the only thing that fires on the absence of an answer) */
|
|
66
66
|
export const PAGE_FETCH_TIMEOUT_MS: 90000;
|
|
67
67
|
/**
|
|
68
|
-
* @typedef {{goto: (url: string, timeout?: number) => Promise<
|
|
68
|
+
* @typedef {{goto: (url: string, timeout?: number) => Promise<{url: string, status: number}>, waitForNetworkIdle: (o?: {idle?: number, timeout?: number}) => Promise<void>,
|
|
69
69
|
* snapshot: (o?: {mode?: string}) => Promise<string>, close: () => Promise<void>}} FetchPage the part of barebrowse's page handle the fetch uses
|
|
70
70
|
*/
|
|
71
|
-
/** the oldest barebrowse we accept: 0.21.0 honours CONNECT_OPTIONS (incognito, blockPrivateNetwork; an older one would drop both guards without a word); 0.24.1 tethers Chromium to its launcher, so a killed run or an Abandoned draft leaves no browser behind */
|
|
71
|
+
/** the oldest barebrowse we accept: 0.21.0 honours CONNECT_OPTIONS (incognito, blockPrivateNetwork; an older one would drop both guards without a word); 0.24.1 tethers Chromium to its launcher, so a killed run or an Abandoned draft leaves no browser behind; 0.26.0 makes goto() resolve to {url, status}, the HTTP status an error page is refused on (M10 am13) */
|
|
72
72
|
export const MIN_BAREBROWSE: number[];
|
|
73
73
|
/**
|
|
74
74
|
* the part of barebrowse's page handle the fetch uses
|
|
75
75
|
*/
|
|
76
76
|
export type FetchPage = {
|
|
77
|
-
goto: (url: string, timeout?: number) => Promise<
|
|
77
|
+
goto: (url: string, timeout?: number) => Promise<{
|
|
78
|
+
url: string;
|
|
79
|
+
status: number;
|
|
80
|
+
}>;
|
|
78
81
|
waitForNetworkIdle: (o?: {
|
|
79
82
|
idle?: number;
|
|
80
83
|
timeout?: number;
|
package/types/panel/author.d.ts
CHANGED
|
@@ -157,6 +157,14 @@ export function createAuthor(opts: {
|
|
|
157
157
|
kind: "file";
|
|
158
158
|
path: string;
|
|
159
159
|
sha: string;
|
|
160
|
+
} | {
|
|
161
|
+
kind: "ticket";
|
|
162
|
+
number: number;
|
|
163
|
+
sha: string;
|
|
164
|
+
role: string;
|
|
165
|
+
list: string;
|
|
166
|
+
why?: string;
|
|
167
|
+
anyway?: boolean;
|
|
160
168
|
}, hooks?: {
|
|
161
169
|
told?: (row: Record<string, any>) => boolean;
|
|
162
170
|
beforeStart?: () => void;
|
|
@@ -120,6 +120,7 @@ export function createFlowsDoor(opts: {
|
|
|
120
120
|
capUsd: any;
|
|
121
121
|
roles: any;
|
|
122
122
|
pages: Record<string, string>;
|
|
123
|
+
tickets: string[];
|
|
123
124
|
nextRunId: string;
|
|
124
125
|
lastRunId: string | null;
|
|
125
126
|
lastSources: Record<string, string>;
|
|
@@ -208,6 +209,7 @@ export function createFlowsDoor(opts: {
|
|
|
208
209
|
capUsd: any;
|
|
209
210
|
roles: any;
|
|
210
211
|
pages: Record<string, string>;
|
|
212
|
+
tickets: string[];
|
|
211
213
|
nextRunId: string;
|
|
212
214
|
lastRunId: string | null;
|
|
213
215
|
lastSources: Record<string, string>;
|
|
@@ -34,7 +34,7 @@ export function createStarter(opts: {
|
|
|
34
34
|
* folder as `signed-values.json` BEFORE the spawn; the run then uses them (`pickRunValues`). None = the flow's own.
|
|
35
35
|
* `trigger` (M9): `{kind, reason, catchUp, ...}` for a start a trigger fired (kind 'trigger'): written once into the run's own folder as `trigger.json`
|
|
36
36
|
* BEFORE the spawn; `appendHistory` copies it into the run's history row (the catch-up mark, am2 item 1).
|
|
37
|
-
* @param {{ kind: 'run'|'sign'|'trigger', flow: string, runId: string, sources: {role: string, path: string}[], planRun?: boolean, planOf?: string|null, values?: any, pick?: {slot: string, model: string}|null, trigger?: Record<string, any>|null }} a
|
|
37
|
+
* @param {{ kind: 'run'|'sign'|'trigger', flow: string, runId: string, sources: {role: string, path: string, ticket?: number, anyway?: boolean}[], planRun?: boolean, planOf?: string|null, values?: any, pick?: {slot: string, model: string}|null, trigger?: Record<string, any>|null }} a
|
|
38
38
|
* @param {{ env: Record<string, string|undefined>, keyNames?: string[] }} loaded the keys load: its env is the child's env AND (with its key names) the scrub list
|
|
39
39
|
* @returns {{ status: number, body: any }}
|
|
40
40
|
*/
|
|
@@ -45,6 +45,8 @@ export function createStarter(opts: {
|
|
|
45
45
|
sources: {
|
|
46
46
|
role: string;
|
|
47
47
|
path: string;
|
|
48
|
+
ticket?: number;
|
|
49
|
+
anyway?: boolean;
|
|
48
50
|
}[];
|
|
49
51
|
planRun?: boolean;
|
|
50
52
|
planOf?: string | null;
|
|
@@ -139,7 +139,7 @@ export function createTriggerDoor(opts: {
|
|
|
139
139
|
* are missing) -> started through the ONE start path (kind `trigger`; the reason and the catch-up mark go into the run's own folder first).
|
|
140
140
|
* The fire / ran ledger row was written by the caller BEFORE this, so a crash loses a run and never doubles one.
|
|
141
141
|
* @param {{flow: string, flowDir: string, read: any, trigger: Trigger, schedule: Schedule}} job
|
|
142
|
-
* @param {{kind: 'clock', slot: number, catchUp: boolean, missed: number} | {kind: 'file', path: string, sha: string}} cause
|
|
142
|
+
* @param {{kind: 'clock', slot: number, catchUp: boolean, missed: number} | {kind: 'file', path: string, sha: string} | {kind: 'ticket', number: number, sha: string, role: string, list: string, why?: string, anyway?: boolean}} cause
|
|
143
143
|
* @param {{ told?: (row: Record<string, any>) => boolean, beforeStart?: () => void, holdIfCannotStart?: boolean }} [hooks] M9 am3 (a queued file): `told(row)` true = this file
|
|
144
144
|
* already has a row for that outcome and reason (`why`), so none is written again (the outcome is still returned); `beforeStart` runs right before the ONE
|
|
145
145
|
* start, once every check has passed: the scheduler writes the file's `ran` row there. `holdIfCannotStart` (a queued file, M9 am17): the starter's `canStart` is asked first, and a no writes nothing
|
|
@@ -160,6 +160,14 @@ export function createTriggerDoor(opts: {
|
|
|
160
160
|
kind: "file";
|
|
161
161
|
path: string;
|
|
162
162
|
sha: string;
|
|
163
|
+
} | {
|
|
164
|
+
kind: "ticket";
|
|
165
|
+
number: number;
|
|
166
|
+
sha: string;
|
|
167
|
+
role: string;
|
|
168
|
+
list: string;
|
|
169
|
+
why?: string;
|
|
170
|
+
anyway?: boolean;
|
|
163
171
|
}, hooks?: {
|
|
164
172
|
told?: (row: Record<string, any>) => boolean;
|
|
165
173
|
beforeStart?: () => void;
|
|
@@ -217,6 +225,8 @@ export function createTriggerDoor(opts: {
|
|
|
217
225
|
refusal: string | null;
|
|
218
226
|
} | null;
|
|
219
227
|
};
|
|
228
|
+
/** M12: the one tool a ticket schedule's look uses, signed with the schedule's two clicks. */
|
|
229
|
+
export const TICKET_LOOK_TOOL: "list_issues";
|
|
220
230
|
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.";
|
|
221
231
|
export type Trigger = import("../trigger-line.js").Trigger;
|
|
222
232
|
export type Schedule = import("../schedule.js").Schedule;
|
package/types/panel/data.d.ts
CHANGED
|
@@ -177,7 +177,7 @@ export function glyphPulses(g: {
|
|
|
177
177
|
* - `[?]` crashed after taking your answer (amendment 2 (f)) — the answer was
|
|
178
178
|
* consumed, the process is gone, no end row: cannot be carried on.
|
|
179
179
|
* @param {{historyRow: any, askJson: any, consumedAnswerExists: boolean, hasStateJson: boolean, resume?: any, liveness?: 'running'|'gone'|'unknown', booksFresh?: boolean, lock?: string, resumable?: boolean, stoppedAtAsk?: string|null, jobEdited?: boolean, starting?: boolean}} ctx
|
|
180
|
-
* @returns {{glyph: '[✓]'|'[✗]'|'[·]'|'[!]'|'[▶]'|'[?]'|'[II]'|'[■]', label: string}}
|
|
180
|
+
* @returns {{glyph: '[✓]'|'[✗]'|'[·]'|'[!]'|'[▶]'|'[?]'|'[II]'|'[■]'|'[–]', label: string}}
|
|
181
181
|
*/
|
|
182
182
|
export function computeGlyph({ historyRow, askJson, consumedAnswerExists, hasStateJson, resume, liveness, booksFresh, lock, resumable, stoppedAtAsk, jobEdited, starting, }: {
|
|
183
183
|
historyRow: any;
|
|
@@ -193,7 +193,7 @@ export function computeGlyph({ historyRow, askJson, consumedAnswerExists, hasSta
|
|
|
193
193
|
jobEdited?: boolean;
|
|
194
194
|
starting?: boolean;
|
|
195
195
|
}): {
|
|
196
|
-
glyph: "[\u2713]" | "[\u2717]" | "[\u00B7]" | "[!]" | "[\u25B6]" | "[?]" | "[II]" | "[\u25A0]";
|
|
196
|
+
glyph: "[\u2713]" | "[\u2717]" | "[\u00B7]" | "[!]" | "[\u25B6]" | "[?]" | "[II]" | "[\u25A0]" | "[\u2013]";
|
|
197
197
|
label: string;
|
|
198
198
|
};
|
|
199
199
|
/**
|
|
@@ -451,7 +451,7 @@ export function getRunGlyph({ root, flow, runId, catalogue, }: {
|
|
|
451
451
|
runId: string;
|
|
452
452
|
catalogue: any;
|
|
453
453
|
}): {
|
|
454
|
-
glyph: "[\u2713]" | "[\u2717]" | "[\u00B7]" | "[!]" | "[\u25B6]" | "[?]" | "[II]" | "[\u25A0]";
|
|
454
|
+
glyph: "[\u2713]" | "[\u2717]" | "[\u00B7]" | "[!]" | "[\u25B6]" | "[?]" | "[II]" | "[\u25A0]" | "[\u2013]";
|
|
455
455
|
label: string;
|
|
456
456
|
} | null;
|
|
457
457
|
/**
|
|
@@ -715,6 +715,25 @@ export function getRunResult({ root, flow, runId, catalogue, resumeAttempt, now,
|
|
|
715
715
|
resumeAttempt?: (flow: string, runId: string) => any;
|
|
716
716
|
now?: () => number;
|
|
717
717
|
}): any | null;
|
|
718
|
+
/**
|
|
719
|
+
* M12 piece 3: the ticket list of the run a ticket schedule was set from (the Result tab's, and `Run it anyway`'s check), or null.
|
|
720
|
+
* @param {{root: string, flow: string, runId: string, catalogue: any}} a
|
|
721
|
+
*/
|
|
722
|
+
export function getTicketList({ root, flow, runId, catalogue, }: {
|
|
723
|
+
root: string;
|
|
724
|
+
flow: string;
|
|
725
|
+
runId: string;
|
|
726
|
+
catalogue: any;
|
|
727
|
+
}): {
|
|
728
|
+
line: string;
|
|
729
|
+
list: string;
|
|
730
|
+
groups: Array<{
|
|
731
|
+
key: string;
|
|
732
|
+
label: string;
|
|
733
|
+
open: boolean;
|
|
734
|
+
rows: any[];
|
|
735
|
+
}>;
|
|
736
|
+
} | null;
|
|
718
737
|
/**
|
|
719
738
|
* `GET /api/runs/:flow/:runId/download?i=<n>` (M10 am4): one saved file, or why not.
|
|
720
739
|
* @param {{root: string, flow: string, runId: string, catalogue: any, index: unknown}} a
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @param {{ door: ReturnType<typeof import('./authortrigger.js').createTriggerDoor>, now?: () => number, intervalMs?: number }} opts
|
|
3
|
-
* `intervalMs` 0 = no timer (a test drives `tick`).
|
|
2
|
+
* @param {{ door: ReturnType<typeof import('./authortrigger.js').createTriggerDoor>, now?: () => number, intervalMs?: number, look?: typeof lookTickets, mcpConfig?: string }} opts
|
|
3
|
+
* `intervalMs` 0 = no timer (a test drives `tick`). `look`/`mcpConfig`: M12 piece 2, the ticket look and the MCP config it reads (default: the person's own ~/.mcp.json).
|
|
4
4
|
*/
|
|
5
5
|
export function createScheduler(opts: {
|
|
6
6
|
door: ReturnType<typeof import("./authortrigger.js").createTriggerDoor>;
|
|
7
7
|
now?: () => number;
|
|
8
8
|
intervalMs?: number;
|
|
9
|
+
look?: typeof lookTickets;
|
|
10
|
+
mcpConfig?: string;
|
|
9
11
|
}): {
|
|
10
12
|
tick: () => void;
|
|
13
|
+
/** M12 piece 2: resolves when every ticket look now out has been written to its ledger (a test awaits it; the timer never does). */
|
|
14
|
+
settled(): Promise<void>;
|
|
11
15
|
/** Start the real timer (idempotent). */
|
|
12
16
|
start(): void;
|
|
13
17
|
/** Stop it (idempotent). The server's close calls this. */
|
|
14
18
|
stop(): void;
|
|
15
19
|
};
|
|
20
|
+
import { lookTickets } from '../trigger-tickets.js';
|
package/types/panel/server.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* real listening socket where that is simpler.
|
|
5
5
|
* @param {import('node:http').IncomingMessage} req
|
|
6
6
|
* @param {import('node:http').ServerResponse} res
|
|
7
|
-
* @param {{ root: string, port: number, version?: string|null, startedAt?: string, packagePath?: string, resumer: ReturnType<typeof createResumer>, settings: ReturnType<typeof createSettings>, author: ReturnType<typeof createAuthor>, now?: () => number }} opts
|
|
7
|
+
* @param {{ root: string, port: number, version?: string|null, startedAt?: string, packagePath?: string, resumer: ReturnType<typeof createResumer>, settings: ReturnType<typeof createSettings>, author: ReturnType<typeof createAuthor>, now?: () => number, ticketQueue: {arriveAnyway: Function} }} opts
|
|
8
8
|
*/
|
|
9
9
|
export function handleRequest(req: import("node:http").IncomingMessage, res: import("node:http").ServerResponse, opts: {
|
|
10
10
|
root: string;
|
|
@@ -16,6 +16,9 @@ export function handleRequest(req: import("node:http").IncomingMessage, res: imp
|
|
|
16
16
|
settings: ReturnType<typeof createSettings>;
|
|
17
17
|
author: ReturnType<typeof createAuthor>;
|
|
18
18
|
now?: () => number;
|
|
19
|
+
ticketQueue: {
|
|
20
|
+
arriveAnyway: Function;
|
|
21
|
+
};
|
|
19
22
|
}): void;
|
|
20
23
|
/**
|
|
21
24
|
* The runs list as the panel builds it, for a caller with no panel running (the launcher header): the SAME `listRuns` over the same catalogue,
|
|
@@ -42,7 +45,7 @@ export function panelUrl(boundPort: number): string;
|
|
|
42
45
|
* header). Resolves once actually listening; rejects on a bind error
|
|
43
46
|
* (including `EADDRINUSE`) with a `.port` field on the error for the
|
|
44
47
|
* caller's message.
|
|
45
|
-
* @param {{ port?: number, root: string, packagePath?: string, settings?: { home?: string, env?: Record<string,string|undefined>, fetch?: typeof fetch, now?: () => number, openFolderSpawn?: (cmd: string, args: string[], o: object) => any, platform?: string }, resume?: { env?: Record<string,string|undefined>, bin?: string, logDir?: string, maxTries?: number, windowMs?: number, slotMs?: number }, author?: { env?: Record<string,string|undefined>, loadEnv?: () => any, bin?: string, now?: () => number }, scheduler?: { intervalMs?: number } }} opts
|
|
48
|
+
* @param {{ port?: number, root: string, packagePath?: string, settings?: { home?: string, env?: Record<string,string|undefined>, fetch?: typeof fetch, now?: () => number, openFolderSpawn?: (cmd: string, args: string[], o: object) => any, platform?: string }, resume?: { env?: Record<string,string|undefined>, bin?: string, logDir?: string, maxTries?: number, windowMs?: number, slotMs?: number }, author?: { env?: Record<string,string|undefined>, loadEnv?: () => any, bin?: string, now?: () => number }, scheduler?: { intervalMs?: number, mcpConfig?: string }, ticketQueue?: {arriveAnyway?: Function} }} opts
|
|
46
49
|
* `resume` and `author` are for tests only (a fake env/bin, a short retry window); the CLI passes none.
|
|
47
50
|
* @returns {Promise<{ server: import('node:http').Server, port: number, tick: () => void, close: () => Promise<void> }>}
|
|
48
51
|
*/
|
|
@@ -74,6 +77,10 @@ export function createPanelServer(opts: {
|
|
|
74
77
|
};
|
|
75
78
|
scheduler?: {
|
|
76
79
|
intervalMs?: number;
|
|
80
|
+
mcpConfig?: string;
|
|
81
|
+
};
|
|
82
|
+
ticketQueue?: {
|
|
83
|
+
arriveAnyway?: Function;
|
|
77
84
|
};
|
|
78
85
|
}): Promise<{
|
|
79
86
|
server: import("node:http").Server;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ticket schedule this run was set from, or null (no schedule, not a ticket schedule, or set from another run).
|
|
3
|
+
* @param {string} flowDir @param {string} runId @param {(dir: string) => any} [readSched]
|
|
4
|
+
*/
|
|
5
|
+
export function ticketScheduleOf(flowDir: string, runId: string, readSched?: (dir: string) => any): any;
|
|
6
|
+
/**
|
|
7
|
+
* @param {{flowDir: string, runId: string, runIdsOf: (flowDir: string) => string[], glyphOf: (runId: string) => {glyph: string, label: string}|null, atOf?: (runId: string) => number|null, readSched?: (dir: string) => any}} a
|
|
8
|
+
* @returns {null | {line: string, list: string, groups: Array<{key: string, label: string, open: boolean, rows: any[]}>}}
|
|
9
|
+
*/
|
|
10
|
+
export function ticketListOf({ flowDir, runId, runIdsOf, glyphOf, atOf, readSched }: {
|
|
11
|
+
flowDir: string;
|
|
12
|
+
runId: string;
|
|
13
|
+
runIdsOf: (flowDir: string) => string[];
|
|
14
|
+
glyphOf: (runId: string) => {
|
|
15
|
+
glyph: string;
|
|
16
|
+
label: string;
|
|
17
|
+
} | null;
|
|
18
|
+
atOf?: (runId: string) => number | null;
|
|
19
|
+
readSched?: (dir: string) => any;
|
|
20
|
+
}): null | {
|
|
21
|
+
line: string;
|
|
22
|
+
list: string;
|
|
23
|
+
groups: Array<{
|
|
24
|
+
key: string;
|
|
25
|
+
label: string;
|
|
26
|
+
open: boolean;
|
|
27
|
+
rows: any[];
|
|
28
|
+
}>;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* `POST /api/author/ticket-anyway`: queue a SKIPPED ticket as a new arrival, after a short reason. Without a reason nothing starts. The queue is the schedule builder's:
|
|
32
|
+
* `queue.arriveAnyway({flow, number, reason})` is the ONE seam (production: `arriveAnywayOf`).
|
|
33
|
+
* @param {{body: any, listOf: (flow: string, runId: string) => ReturnType<typeof ticketListOf>, queue: {arriveAnyway: (a: {flow: string, runId: string, number: number, reason: string}) => {ok: boolean, say?: string}}}} a
|
|
34
|
+
* @returns {{status: number, body: Record<string, any>}}
|
|
35
|
+
*/
|
|
36
|
+
export function ticketAnyway({ body, listOf, queue }: {
|
|
37
|
+
body: any;
|
|
38
|
+
listOf: (flow: string, runId: string) => ReturnType<typeof ticketListOf>;
|
|
39
|
+
queue: {
|
|
40
|
+
arriveAnyway: (a: {
|
|
41
|
+
flow: string;
|
|
42
|
+
runId: string;
|
|
43
|
+
number: number;
|
|
44
|
+
reason: string;
|
|
45
|
+
}) => {
|
|
46
|
+
ok: boolean;
|
|
47
|
+
say?: string;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
}): {
|
|
51
|
+
status: number;
|
|
52
|
+
body: Record<string, any>;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* The production queue seam: ONE `arrived` row (`recordAnyway`, the ledger's writer) in the job's schedule ledger, so the scheduler's queue starts the ticket as a new
|
|
56
|
+
* arrival under the job's normal cap. A job with no live ticket schedule is refused by name, at $0, with nothing written.
|
|
57
|
+
* @param {{scan: () => any[], now: () => number}} a
|
|
58
|
+
* @returns {{arriveAnyway: (a: {flow: string, runId: string, number: number, reason: string}) => {ok: boolean, say?: string}}}
|
|
59
|
+
*/
|
|
60
|
+
export function arriveAnywayOf({ scan, now }: {
|
|
61
|
+
scan: () => any[];
|
|
62
|
+
now: () => number;
|
|
63
|
+
}): {
|
|
64
|
+
arriveAnyway: (a: {
|
|
65
|
+
flow: string;
|
|
66
|
+
runId: string;
|
|
67
|
+
number: number;
|
|
68
|
+
reason: string;
|
|
69
|
+
}) => {
|
|
70
|
+
ok: boolean;
|
|
71
|
+
say?: string;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
/** the four groups, in the mockup's order: key, label, open at first. The page draws them; it types none of these words. */
|
|
75
|
+
export const TICKET_GROUPS: readonly {
|
|
76
|
+
key: string;
|
|
77
|
+
label: string;
|
|
78
|
+
open: boolean;
|
|
79
|
+
}[];
|
|
80
|
+
/** a "Run it anyway" reason: short, never blank. The same bar as a rerun's. */
|
|
81
|
+
export const ANYWAY_REASON_MAX: 500;
|