fwdloop 0.26.2 → 0.28.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.
Files changed (73) hide show
  1. package/bin/fwdloop +46 -7
  2. package/package.json +2 -2
  3. package/src/authoring.js +21 -1
  4. package/src/canrun.js +23 -0
  5. package/src/config.js +18 -0
  6. package/src/declaration.js +129 -3
  7. package/src/drafter.js +38 -10
  8. package/src/flow.js +2 -1
  9. package/src/launcher.js +4 -2
  10. package/src/learnstore.js +3 -2
  11. package/src/mcp-checks.js +50 -0
  12. package/src/mcp-pick.js +33 -0
  13. package/src/mcp-sources.js +84 -0
  14. package/src/mcp-use.js +54 -0
  15. package/src/natural.js +23 -0
  16. package/src/panel/author.js +17 -1
  17. package/src/panel/authorcard.js +35 -0
  18. package/src/panel/authorflows.js +15 -6
  19. package/src/panel/authorstart.js +10 -6
  20. package/src/panel/authortrigger.js +263 -82
  21. package/src/panel/data.js +127 -9
  22. package/src/panel/index.html +945 -94
  23. package/src/panel/jobgrid.js +127 -0
  24. package/src/panel/scheduler.js +48 -6
  25. package/src/panel/server.js +33 -8
  26. package/src/panel/settings.js +119 -4
  27. package/src/panel/tickets.js +118 -0
  28. package/src/primitives.js +34 -5
  29. package/src/runner.js +129 -15
  30. package/src/schedule.js +5 -0
  31. package/src/summary-words.js +27 -7
  32. package/src/ticket-draft.js +85 -0
  33. package/src/ticket-labels.js +75 -0
  34. package/src/ticket-mcp.js +89 -0
  35. package/src/ticket-next.js +33 -0
  36. package/src/ticket-shape.js +33 -0
  37. package/src/trigger-clock.js +4 -4
  38. package/src/trigger-files.js +4 -4
  39. package/src/trigger-line.js +2 -1
  40. package/src/trigger-tickets.js +238 -0
  41. package/types/authoring.d.ts +5 -1
  42. package/types/canrun.d.ts +7 -0
  43. package/types/config.d.ts +6 -0
  44. package/types/declaration.d.ts +8 -0
  45. package/types/drafter.d.ts +552 -21
  46. package/types/mcp-checks.d.ts +8 -0
  47. package/types/mcp-pick.d.ts +23 -0
  48. package/types/mcp-sources.d.ts +51 -0
  49. package/types/mcp-use.d.ts +12 -0
  50. package/types/natural.d.ts +2 -0
  51. package/types/panel/author.d.ts +44 -0
  52. package/types/panel/authorcard.d.ts +11 -0
  53. package/types/panel/authorflows.d.ts +11 -1
  54. package/types/panel/authorstart.d.ts +3 -1
  55. package/types/panel/authortrigger.d.ts +83 -7
  56. package/types/panel/data.d.ts +78 -5
  57. package/types/panel/jobgrid.d.ts +109 -0
  58. package/types/panel/scheduler.d.ts +7 -2
  59. package/types/panel/server.d.ts +13 -2
  60. package/types/panel/settings.d.ts +3 -2
  61. package/types/panel/tickets.d.ts +103 -0
  62. package/types/primitives.d.ts +15 -2
  63. package/types/runner.d.ts +133 -75
  64. package/types/summary-words.d.ts +24 -4
  65. package/types/ticket-draft.d.ts +104 -0
  66. package/types/ticket-labels.d.ts +42 -0
  67. package/types/ticket-mcp.d.ts +57 -0
  68. package/types/ticket-next.d.ts +23 -0
  69. package/types/ticket-shape.d.ts +30 -0
  70. package/types/trigger-clock.d.ts +4 -3
  71. package/types/trigger-files.d.ts +3 -1
  72. package/types/trigger-line.d.ts +7 -0
  73. package/types/trigger-tickets.d.ts +105 -0
@@ -1,29 +1,61 @@
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
- * @param {any[]} menu @param {{sheets?: Record<string, {header: string[]}>}} [o]
4
+ * 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
+ * @param {any[]} menu @param {{sheets?: Record<string, {header: string[]}>, ticket?: {flowType: 'mcp'|'tickets', tools: 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
+ flowType: "mcp" | "tickets";
13
+ tools: string[];
14
+ };
10
15
  }): {
11
16
  type: string;
12
17
  properties: {
13
- steps: {
18
+ guardrailClasses: {
19
+ type: string;
20
+ additionalProperties: {
21
+ type: string;
22
+ enum: string[];
23
+ };
24
+ description: string;
25
+ };
26
+ unjudgeable: {
27
+ type: string;
28
+ additionalProperties: {
29
+ type: string;
30
+ };
31
+ description: string;
32
+ };
33
+ refused: {
14
34
  type: string;
15
- minItems: number;
16
35
  items: {
17
36
  type: string;
18
37
  properties: {
19
- primitives: {
38
+ line: {
20
39
  type: string;
21
- items: {
22
- type: string;
23
- enum: any[];
24
- };
25
- description: string;
26
40
  };
41
+ reason: {
42
+ type: string;
43
+ minLength: number;
44
+ };
45
+ };
46
+ required: string[];
47
+ additionalProperties: boolean;
48
+ };
49
+ description: string;
50
+ };
51
+ ticketFilter?: undefined;
52
+ ticketWatch?: undefined;
53
+ steps: {
54
+ type: string;
55
+ minItems: number;
56
+ items: {
57
+ type: string;
58
+ properties: {
27
59
  reads: {
28
60
  type: string;
29
61
  items: {
@@ -179,11 +211,28 @@ export function buildDeclarationSchema(menu: any[], { sheets }?: {
179
211
  required: string[];
180
212
  additionalProperties: boolean;
181
213
  };
214
+ mcpTools?: {
215
+ type: string;
216
+ items: {
217
+ type: string;
218
+ enum: string[];
219
+ };
220
+ description: string;
221
+ } | undefined;
222
+ primitives: {
223
+ type: string;
224
+ items: {
225
+ type: string;
226
+ enum: any[];
227
+ };
228
+ description: string;
229
+ };
182
230
  };
183
231
  required: string[];
184
232
  additionalProperties: boolean;
185
233
  };
186
234
  };
235
+ } | {
187
236
  guardrailClasses: {
188
237
  type: string;
189
238
  additionalProperties: {
@@ -217,17 +266,233 @@ export function buildDeclarationSchema(menu: any[], { sheets }?: {
217
266
  };
218
267
  description: string;
219
268
  };
269
+ ticketFilter: {
270
+ type: string;
271
+ properties: {
272
+ priority: {
273
+ type: string;
274
+ items: {
275
+ type: string;
276
+ enum: string[];
277
+ };
278
+ description: string;
279
+ };
280
+ labels: {
281
+ type: string;
282
+ items: {
283
+ type: string;
284
+ };
285
+ description: string;
286
+ };
287
+ };
288
+ additionalProperties: boolean;
289
+ description: string;
290
+ };
291
+ ticketWatch: {
292
+ type: string;
293
+ items: {
294
+ type: string;
295
+ enum: string[];
296
+ };
297
+ description: string;
298
+ };
299
+ steps: {
300
+ type: string;
301
+ minItems: number;
302
+ items: {
303
+ type: string;
304
+ properties: {
305
+ reads: {
306
+ type: string;
307
+ items: {
308
+ type: string;
309
+ };
310
+ description: string;
311
+ };
312
+ emits: {
313
+ type: string;
314
+ minLength: number;
315
+ description: string;
316
+ };
317
+ fromLine: {
318
+ type: string[];
319
+ description: string;
320
+ };
321
+ picks: {
322
+ type: string;
323
+ additionalProperties: {
324
+ type: string;
325
+ items: {
326
+ type: string;
327
+ };
328
+ };
329
+ description: string;
330
+ };
331
+ close: {
332
+ type: string;
333
+ properties: {
334
+ sheet?: Record<string, any> | undefined;
335
+ class: {
336
+ type: string;
337
+ enum: string[];
338
+ description: string;
339
+ };
340
+ shape: {
341
+ type: string;
342
+ properties: {};
343
+ additionalProperties: boolean;
344
+ description: string;
345
+ };
346
+ cited: Readonly<{
347
+ type: "object";
348
+ 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";
349
+ properties: {
350
+ source: {
351
+ type: string;
352
+ description: string;
353
+ };
354
+ facts: {
355
+ type: string;
356
+ minItems: number;
357
+ maxItems: number;
358
+ description: string;
359
+ items: {
360
+ type: string;
361
+ properties: {
362
+ name: {
363
+ type: string;
364
+ description: string;
365
+ };
366
+ shape: {
367
+ type: string;
368
+ enum: string[];
369
+ };
370
+ unit: {
371
+ type: string[];
372
+ items: {
373
+ type: string;
374
+ };
375
+ description: string;
376
+ };
377
+ currency: {
378
+ type: string[];
379
+ items: {
380
+ type: string;
381
+ };
382
+ description: string;
383
+ };
384
+ phrase: {
385
+ type: string;
386
+ description: string;
387
+ };
388
+ anchor: {
389
+ type: string;
390
+ description: string;
391
+ };
392
+ until: {
393
+ type: string;
394
+ description: string;
395
+ };
396
+ rule: {
397
+ type: string;
398
+ description: string;
399
+ properties: {
400
+ op: {
401
+ type: string;
402
+ enum: string[];
403
+ };
404
+ value: {};
405
+ lo: {};
406
+ hi: {};
407
+ };
408
+ required: string[];
409
+ additionalProperties: boolean;
410
+ };
411
+ };
412
+ required: string[];
413
+ additionalProperties: boolean;
414
+ };
415
+ };
416
+ count: {
417
+ type: string;
418
+ description: string;
419
+ properties: {
420
+ min: {
421
+ type: string;
422
+ minimum: number;
423
+ };
424
+ max: {
425
+ type: string;
426
+ minimum: number;
427
+ };
428
+ };
429
+ additionalProperties: boolean;
430
+ };
431
+ };
432
+ required: string[];
433
+ additionalProperties: false;
434
+ }>;
435
+ columns: Readonly<{
436
+ type: "array";
437
+ minItems: 1;
438
+ maxItems: 10;
439
+ 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";
440
+ items: {
441
+ type: string;
442
+ properties: {
443
+ source: {
444
+ type: string;
445
+ description: string;
446
+ };
447
+ column: {
448
+ type: string;
449
+ description: string;
450
+ };
451
+ };
452
+ required: string[];
453
+ additionalProperties: boolean;
454
+ };
455
+ }>;
456
+ };
457
+ required: string[];
458
+ additionalProperties: boolean;
459
+ };
460
+ mcpTools?: {
461
+ type: string;
462
+ items: {
463
+ type: string;
464
+ enum: string[];
465
+ };
466
+ description: string;
467
+ } | undefined;
468
+ primitives: {
469
+ type: string;
470
+ items: {
471
+ type: string;
472
+ enum: any[];
473
+ };
474
+ description: string;
475
+ };
476
+ };
477
+ required: string[];
478
+ additionalProperties: boolean;
479
+ };
480
+ };
220
481
  };
221
482
  required: string[];
222
483
  additionalProperties: boolean;
223
484
  };
224
485
  /** The declaration schema plus the optional `notChecked` (every try) and, on try 3 only, `questions`. Neither is in `required`. */
225
- /** @param {any[]} menu @param {{questions?: boolean, sheets?: Record<string, {header: string[]}>|undefined}} [o] */
226
- export function buildRoundSchema(menu: any[], { questions, sheets }?: {
486
+ /** @param {any[]} menu @param {{questions?: boolean, sheets?: Record<string, {header: string[]}>|undefined, ticket?: {flowType: 'mcp'|'tickets', tools: string[]}}} [o] */
487
+ export function buildRoundSchema(menu: any[], { questions, sheets, ticket }?: {
227
488
  questions?: boolean;
228
489
  sheets?: Record<string, {
229
490
  header: string[];
230
491
  }> | undefined;
492
+ ticket?: {
493
+ flowType: "mcp" | "tickets";
494
+ tools: string[];
495
+ };
231
496
  }): {
232
497
  properties: {
233
498
  notChecked: {
@@ -237,20 +502,47 @@ export function buildRoundSchema(menu: any[], { questions, sheets }?: {
237
502
  };
238
503
  description: string;
239
504
  };
240
- steps: {
505
+ guardrailClasses: {
506
+ type: string;
507
+ additionalProperties: {
508
+ type: string;
509
+ enum: string[];
510
+ };
511
+ description: string;
512
+ };
513
+ unjudgeable: {
514
+ type: string;
515
+ additionalProperties: {
516
+ type: string;
517
+ };
518
+ description: string;
519
+ };
520
+ refused: {
241
521
  type: string;
242
- minItems: number;
243
522
  items: {
244
523
  type: string;
245
524
  properties: {
246
- primitives: {
525
+ line: {
247
526
  type: string;
248
- items: {
249
- type: string;
250
- enum: any[];
251
- };
252
- description: string;
253
527
  };
528
+ reason: {
529
+ type: string;
530
+ minLength: number;
531
+ };
532
+ };
533
+ required: string[];
534
+ additionalProperties: boolean;
535
+ };
536
+ description: string;
537
+ };
538
+ ticketFilter?: undefined;
539
+ ticketWatch?: undefined;
540
+ steps: {
541
+ type: string;
542
+ minItems: number;
543
+ items: {
544
+ type: string;
545
+ properties: {
254
546
  reads: {
255
547
  type: string;
256
548
  items: {
@@ -406,11 +698,35 @@ export function buildRoundSchema(menu: any[], { questions, sheets }?: {
406
698
  required: string[];
407
699
  additionalProperties: boolean;
408
700
  };
701
+ mcpTools?: {
702
+ type: string;
703
+ items: {
704
+ type: string;
705
+ enum: string[];
706
+ };
707
+ description: string;
708
+ } | undefined;
709
+ primitives: {
710
+ type: string;
711
+ items: {
712
+ type: string;
713
+ enum: any[];
714
+ };
715
+ description: string;
716
+ };
409
717
  };
410
718
  required: string[];
411
719
  additionalProperties: boolean;
412
720
  };
413
721
  };
722
+ } | {
723
+ notChecked: {
724
+ type: string;
725
+ items: {
726
+ type: string;
727
+ };
728
+ description: string;
729
+ };
414
730
  guardrailClasses: {
415
731
  type: string;
416
732
  additionalProperties: {
@@ -444,6 +760,218 @@ export function buildRoundSchema(menu: any[], { questions, sheets }?: {
444
760
  };
445
761
  description: string;
446
762
  };
763
+ ticketFilter: {
764
+ type: string;
765
+ properties: {
766
+ priority: {
767
+ type: string;
768
+ items: {
769
+ type: string;
770
+ enum: string[];
771
+ };
772
+ description: string;
773
+ };
774
+ labels: {
775
+ type: string;
776
+ items: {
777
+ type: string;
778
+ };
779
+ description: string;
780
+ };
781
+ };
782
+ additionalProperties: boolean;
783
+ description: string;
784
+ };
785
+ ticketWatch: {
786
+ type: string;
787
+ items: {
788
+ type: string;
789
+ enum: string[];
790
+ };
791
+ description: string;
792
+ };
793
+ steps: {
794
+ type: string;
795
+ minItems: number;
796
+ items: {
797
+ type: string;
798
+ properties: {
799
+ reads: {
800
+ type: string;
801
+ items: {
802
+ type: string;
803
+ };
804
+ description: string;
805
+ };
806
+ emits: {
807
+ type: string;
808
+ minLength: number;
809
+ description: string;
810
+ };
811
+ fromLine: {
812
+ type: string[];
813
+ description: string;
814
+ };
815
+ picks: {
816
+ type: string;
817
+ additionalProperties: {
818
+ type: string;
819
+ items: {
820
+ type: string;
821
+ };
822
+ };
823
+ description: string;
824
+ };
825
+ close: {
826
+ type: string;
827
+ properties: {
828
+ sheet?: Record<string, any> | undefined;
829
+ class: {
830
+ type: string;
831
+ enum: string[];
832
+ description: string;
833
+ };
834
+ shape: {
835
+ type: string;
836
+ properties: {};
837
+ additionalProperties: boolean;
838
+ description: string;
839
+ };
840
+ cited: Readonly<{
841
+ type: "object";
842
+ 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";
843
+ properties: {
844
+ source: {
845
+ type: string;
846
+ description: string;
847
+ };
848
+ facts: {
849
+ type: string;
850
+ minItems: number;
851
+ maxItems: number;
852
+ description: string;
853
+ items: {
854
+ type: string;
855
+ properties: {
856
+ name: {
857
+ type: string;
858
+ description: string;
859
+ };
860
+ shape: {
861
+ type: string;
862
+ enum: string[];
863
+ };
864
+ unit: {
865
+ type: string[];
866
+ items: {
867
+ type: string;
868
+ };
869
+ description: string;
870
+ };
871
+ currency: {
872
+ type: string[];
873
+ items: {
874
+ type: string;
875
+ };
876
+ description: string;
877
+ };
878
+ phrase: {
879
+ type: string;
880
+ description: string;
881
+ };
882
+ anchor: {
883
+ type: string;
884
+ description: string;
885
+ };
886
+ until: {
887
+ type: string;
888
+ description: string;
889
+ };
890
+ rule: {
891
+ type: string;
892
+ description: string;
893
+ properties: {
894
+ op: {
895
+ type: string;
896
+ enum: string[];
897
+ };
898
+ value: {};
899
+ lo: {};
900
+ hi: {};
901
+ };
902
+ required: string[];
903
+ additionalProperties: boolean;
904
+ };
905
+ };
906
+ required: string[];
907
+ additionalProperties: boolean;
908
+ };
909
+ };
910
+ count: {
911
+ type: string;
912
+ description: string;
913
+ properties: {
914
+ min: {
915
+ type: string;
916
+ minimum: number;
917
+ };
918
+ max: {
919
+ type: string;
920
+ minimum: number;
921
+ };
922
+ };
923
+ additionalProperties: boolean;
924
+ };
925
+ };
926
+ required: string[];
927
+ additionalProperties: false;
928
+ }>;
929
+ columns: Readonly<{
930
+ type: "array";
931
+ minItems: 1;
932
+ maxItems: 10;
933
+ 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";
934
+ items: {
935
+ type: string;
936
+ properties: {
937
+ source: {
938
+ type: string;
939
+ description: string;
940
+ };
941
+ column: {
942
+ type: string;
943
+ description: string;
944
+ };
945
+ };
946
+ required: string[];
947
+ additionalProperties: boolean;
948
+ };
949
+ }>;
950
+ };
951
+ required: string[];
952
+ additionalProperties: boolean;
953
+ };
954
+ mcpTools?: {
955
+ type: string;
956
+ items: {
957
+ type: string;
958
+ enum: string[];
959
+ };
960
+ description: string;
961
+ } | undefined;
962
+ primitives: {
963
+ type: string;
964
+ items: {
965
+ type: string;
966
+ enum: any[];
967
+ };
968
+ description: string;
969
+ };
970
+ };
971
+ required: string[];
972
+ additionalProperties: boolean;
973
+ };
974
+ };
447
975
  };
448
976
  type: string;
449
977
  required: string[];
@@ -492,7 +1020,7 @@ export function goalForLine(fromLine: any, lines: any): any;
492
1020
  * `learnHints` (M8 item 5a): the earlier runs' notes block (src/learnstore.js hintsForRun), appended to the drafter's system prompt; null = nothing.
493
1021
  * `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
1022
  */
495
- export function draft({ proseText, slot, model, provider: injected, rates: injectedRates, modelId: injectedModelId, env, priorSpend, skills, makeProviderFn, onBook, offerQuestions, draftThinking, draftDir, fetchPage, leftRules, learnHints, }: {
1023
+ export function draft({ proseText, slot, model, provider: injected, rates: injectedRates, modelId: injectedModelId, env, priorSpend, skills, makeProviderFn, onBook, offerQuestions, draftThinking, draftDir, fetchPage, leftRules, learnHints, mcpServers, flowType, mcp, }: {
496
1024
  proseText: any;
497
1025
  slot: any;
498
1026
  model: any;
@@ -516,6 +1044,9 @@ export function draft({ proseText, slot, model, provider: injected, rates: injec
516
1044
  text: string;
517
1045
  ids: string[];
518
1046
  } | null | undefined;
1047
+ mcpServers?: string[] | undefined;
1048
+ flowType?: "mcp" | "plain" | "tickets" | undefined;
1049
+ mcp?: any;
519
1050
  }): Promise<{
520
1051
  ok: boolean;
521
1052
  declaration: object | null;
@@ -0,0 +1,8 @@
1
+ /** append ONE line; throws when it cannot be written @param {string|undefined} home @param {Record<string, any>} entry */
2
+ export function appendMcpCheck(home: string | undefined, entry: Record<string, any>): void;
3
+ /** the newest line per `path\tserver` @param {string|undefined} home @returns {Map<string, any>} */
4
+ export function newestMcpChecks(home: string | undefined): Map<string, any>;
5
+ /** M13 piece 4 (R1): the tool names of the newest OK line (with at least one tool) for this server at this path, or null @param {string|undefined} home @param {string} server @param {string} path @returns {string[]|null} */
6
+ export function newestOkMcpTools(home: string | undefined, server: string, path: string): string[] | null;
7
+ export const MCP_CHECKS_FILE: "mcp-checks.jsonl";
8
+ export function mcpChecksFile(home: string | undefined): string;