@sweny-ai/core 0.1.72 → 0.1.74
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/dist/__tests__/executor.test.js +196 -1
- package/dist/__tests__/schema.test.js +68 -1
- package/dist/__tests__/verify.test.d.ts +1 -0
- package/dist/__tests__/verify.test.js +517 -0
- package/dist/executor.js +10 -30
- package/dist/schema.d.ts +284 -0
- package/dist/schema.js +21 -2
- package/dist/types.d.ts +31 -12
- package/dist/verify.d.ts +23 -0
- package/dist/verify.js +309 -0
- package/dist/workflows/browser.js +1 -1
- package/dist/workflows/triage.yml +50 -17
- package/package.json +1 -1
package/dist/schema.d.ts
CHANGED
|
@@ -404,16 +404,107 @@ export declare const nodeSourcesZ: z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodStrin
|
|
|
404
404
|
})[];
|
|
405
405
|
only?: boolean | undefined;
|
|
406
406
|
}>]>;
|
|
407
|
+
export declare const outputMatchZ: z.ZodEffects<z.ZodObject<{
|
|
408
|
+
path: z.ZodString;
|
|
409
|
+
equals: z.ZodOptional<z.ZodUnknown>;
|
|
410
|
+
in: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
|
|
411
|
+
matches: z.ZodOptional<z.ZodString>;
|
|
412
|
+
}, "strip", z.ZodTypeAny, {
|
|
413
|
+
path: string;
|
|
414
|
+
equals?: unknown;
|
|
415
|
+
in?: unknown[] | undefined;
|
|
416
|
+
matches?: string | undefined;
|
|
417
|
+
}, {
|
|
418
|
+
path: string;
|
|
419
|
+
equals?: unknown;
|
|
420
|
+
in?: unknown[] | undefined;
|
|
421
|
+
matches?: string | undefined;
|
|
422
|
+
}>, {
|
|
423
|
+
path: string;
|
|
424
|
+
equals?: unknown;
|
|
425
|
+
in?: unknown[] | undefined;
|
|
426
|
+
matches?: string | undefined;
|
|
427
|
+
}, {
|
|
428
|
+
path: string;
|
|
429
|
+
equals?: unknown;
|
|
430
|
+
in?: unknown[] | undefined;
|
|
431
|
+
matches?: string | undefined;
|
|
432
|
+
}>;
|
|
407
433
|
export declare const nodeVerifyZ: z.ZodEffects<z.ZodObject<{
|
|
408
434
|
any_tool_called: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
435
|
+
all_tools_called: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
436
|
+
no_tool_called: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
437
|
+
output_required: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
438
|
+
output_matches: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
439
|
+
path: z.ZodString;
|
|
440
|
+
equals: z.ZodOptional<z.ZodUnknown>;
|
|
441
|
+
in: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
|
|
442
|
+
matches: z.ZodOptional<z.ZodString>;
|
|
443
|
+
}, "strip", z.ZodTypeAny, {
|
|
444
|
+
path: string;
|
|
445
|
+
equals?: unknown;
|
|
446
|
+
in?: unknown[] | undefined;
|
|
447
|
+
matches?: string | undefined;
|
|
448
|
+
}, {
|
|
449
|
+
path: string;
|
|
450
|
+
equals?: unknown;
|
|
451
|
+
in?: unknown[] | undefined;
|
|
452
|
+
matches?: string | undefined;
|
|
453
|
+
}>, {
|
|
454
|
+
path: string;
|
|
455
|
+
equals?: unknown;
|
|
456
|
+
in?: unknown[] | undefined;
|
|
457
|
+
matches?: string | undefined;
|
|
458
|
+
}, {
|
|
459
|
+
path: string;
|
|
460
|
+
equals?: unknown;
|
|
461
|
+
in?: unknown[] | undefined;
|
|
462
|
+
matches?: string | undefined;
|
|
463
|
+
}>, "many">>;
|
|
409
464
|
}, "strip", z.ZodTypeAny, {
|
|
410
465
|
any_tool_called?: string[] | undefined;
|
|
466
|
+
all_tools_called?: string[] | undefined;
|
|
467
|
+
no_tool_called?: string[] | undefined;
|
|
468
|
+
output_required?: string[] | undefined;
|
|
469
|
+
output_matches?: {
|
|
470
|
+
path: string;
|
|
471
|
+
equals?: unknown;
|
|
472
|
+
in?: unknown[] | undefined;
|
|
473
|
+
matches?: string | undefined;
|
|
474
|
+
}[] | undefined;
|
|
411
475
|
}, {
|
|
412
476
|
any_tool_called?: string[] | undefined;
|
|
477
|
+
all_tools_called?: string[] | undefined;
|
|
478
|
+
no_tool_called?: string[] | undefined;
|
|
479
|
+
output_required?: string[] | undefined;
|
|
480
|
+
output_matches?: {
|
|
481
|
+
path: string;
|
|
482
|
+
equals?: unknown;
|
|
483
|
+
in?: unknown[] | undefined;
|
|
484
|
+
matches?: string | undefined;
|
|
485
|
+
}[] | undefined;
|
|
413
486
|
}>, {
|
|
414
487
|
any_tool_called?: string[] | undefined;
|
|
488
|
+
all_tools_called?: string[] | undefined;
|
|
489
|
+
no_tool_called?: string[] | undefined;
|
|
490
|
+
output_required?: string[] | undefined;
|
|
491
|
+
output_matches?: {
|
|
492
|
+
path: string;
|
|
493
|
+
equals?: unknown;
|
|
494
|
+
in?: unknown[] | undefined;
|
|
495
|
+
matches?: string | undefined;
|
|
496
|
+
}[] | undefined;
|
|
415
497
|
}, {
|
|
416
498
|
any_tool_called?: string[] | undefined;
|
|
499
|
+
all_tools_called?: string[] | undefined;
|
|
500
|
+
no_tool_called?: string[] | undefined;
|
|
501
|
+
output_required?: string[] | undefined;
|
|
502
|
+
output_matches?: {
|
|
503
|
+
path: string;
|
|
504
|
+
equals?: unknown;
|
|
505
|
+
in?: unknown[] | undefined;
|
|
506
|
+
matches?: string | undefined;
|
|
507
|
+
}[] | undefined;
|
|
417
508
|
}>;
|
|
418
509
|
export declare const nodeZ: z.ZodObject<{
|
|
419
510
|
name: z.ZodString;
|
|
@@ -576,14 +667,79 @@ export declare const nodeZ: z.ZodObject<{
|
|
|
576
667
|
}>]>>;
|
|
577
668
|
verify: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
578
669
|
any_tool_called: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
670
|
+
all_tools_called: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
671
|
+
no_tool_called: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
672
|
+
output_required: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
673
|
+
output_matches: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
674
|
+
path: z.ZodString;
|
|
675
|
+
equals: z.ZodOptional<z.ZodUnknown>;
|
|
676
|
+
in: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
|
|
677
|
+
matches: z.ZodOptional<z.ZodString>;
|
|
678
|
+
}, "strip", z.ZodTypeAny, {
|
|
679
|
+
path: string;
|
|
680
|
+
equals?: unknown;
|
|
681
|
+
in?: unknown[] | undefined;
|
|
682
|
+
matches?: string | undefined;
|
|
683
|
+
}, {
|
|
684
|
+
path: string;
|
|
685
|
+
equals?: unknown;
|
|
686
|
+
in?: unknown[] | undefined;
|
|
687
|
+
matches?: string | undefined;
|
|
688
|
+
}>, {
|
|
689
|
+
path: string;
|
|
690
|
+
equals?: unknown;
|
|
691
|
+
in?: unknown[] | undefined;
|
|
692
|
+
matches?: string | undefined;
|
|
693
|
+
}, {
|
|
694
|
+
path: string;
|
|
695
|
+
equals?: unknown;
|
|
696
|
+
in?: unknown[] | undefined;
|
|
697
|
+
matches?: string | undefined;
|
|
698
|
+
}>, "many">>;
|
|
579
699
|
}, "strip", z.ZodTypeAny, {
|
|
580
700
|
any_tool_called?: string[] | undefined;
|
|
701
|
+
all_tools_called?: string[] | undefined;
|
|
702
|
+
no_tool_called?: string[] | undefined;
|
|
703
|
+
output_required?: string[] | undefined;
|
|
704
|
+
output_matches?: {
|
|
705
|
+
path: string;
|
|
706
|
+
equals?: unknown;
|
|
707
|
+
in?: unknown[] | undefined;
|
|
708
|
+
matches?: string | undefined;
|
|
709
|
+
}[] | undefined;
|
|
581
710
|
}, {
|
|
582
711
|
any_tool_called?: string[] | undefined;
|
|
712
|
+
all_tools_called?: string[] | undefined;
|
|
713
|
+
no_tool_called?: string[] | undefined;
|
|
714
|
+
output_required?: string[] | undefined;
|
|
715
|
+
output_matches?: {
|
|
716
|
+
path: string;
|
|
717
|
+
equals?: unknown;
|
|
718
|
+
in?: unknown[] | undefined;
|
|
719
|
+
matches?: string | undefined;
|
|
720
|
+
}[] | undefined;
|
|
583
721
|
}>, {
|
|
584
722
|
any_tool_called?: string[] | undefined;
|
|
723
|
+
all_tools_called?: string[] | undefined;
|
|
724
|
+
no_tool_called?: string[] | undefined;
|
|
725
|
+
output_required?: string[] | undefined;
|
|
726
|
+
output_matches?: {
|
|
727
|
+
path: string;
|
|
728
|
+
equals?: unknown;
|
|
729
|
+
in?: unknown[] | undefined;
|
|
730
|
+
matches?: string | undefined;
|
|
731
|
+
}[] | undefined;
|
|
585
732
|
}, {
|
|
586
733
|
any_tool_called?: string[] | undefined;
|
|
734
|
+
all_tools_called?: string[] | undefined;
|
|
735
|
+
no_tool_called?: string[] | undefined;
|
|
736
|
+
output_required?: string[] | undefined;
|
|
737
|
+
output_matches?: {
|
|
738
|
+
path: string;
|
|
739
|
+
equals?: unknown;
|
|
740
|
+
in?: unknown[] | undefined;
|
|
741
|
+
matches?: string | undefined;
|
|
742
|
+
}[] | undefined;
|
|
587
743
|
}>>;
|
|
588
744
|
}, "strip", z.ZodTypeAny, {
|
|
589
745
|
instruction: string | {
|
|
@@ -636,6 +792,15 @@ export declare const nodeZ: z.ZodObject<{
|
|
|
636
792
|
max_turns?: number | undefined;
|
|
637
793
|
verify?: {
|
|
638
794
|
any_tool_called?: string[] | undefined;
|
|
795
|
+
all_tools_called?: string[] | undefined;
|
|
796
|
+
no_tool_called?: string[] | undefined;
|
|
797
|
+
output_required?: string[] | undefined;
|
|
798
|
+
output_matches?: {
|
|
799
|
+
path: string;
|
|
800
|
+
equals?: unknown;
|
|
801
|
+
in?: unknown[] | undefined;
|
|
802
|
+
matches?: string | undefined;
|
|
803
|
+
}[] | undefined;
|
|
639
804
|
} | undefined;
|
|
640
805
|
}, {
|
|
641
806
|
instruction: string | {
|
|
@@ -688,6 +853,15 @@ export declare const nodeZ: z.ZodObject<{
|
|
|
688
853
|
max_turns?: number | undefined;
|
|
689
854
|
verify?: {
|
|
690
855
|
any_tool_called?: string[] | undefined;
|
|
856
|
+
all_tools_called?: string[] | undefined;
|
|
857
|
+
no_tool_called?: string[] | undefined;
|
|
858
|
+
output_required?: string[] | undefined;
|
|
859
|
+
output_matches?: {
|
|
860
|
+
path: string;
|
|
861
|
+
equals?: unknown;
|
|
862
|
+
in?: unknown[] | undefined;
|
|
863
|
+
matches?: string | undefined;
|
|
864
|
+
}[] | undefined;
|
|
691
865
|
} | undefined;
|
|
692
866
|
}>;
|
|
693
867
|
export declare const edgeZ: z.ZodObject<{
|
|
@@ -871,14 +1045,79 @@ export declare const workflowZ: z.ZodObject<{
|
|
|
871
1045
|
}>]>>;
|
|
872
1046
|
verify: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
873
1047
|
any_tool_called: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1048
|
+
all_tools_called: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1049
|
+
no_tool_called: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1050
|
+
output_required: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1051
|
+
output_matches: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
1052
|
+
path: z.ZodString;
|
|
1053
|
+
equals: z.ZodOptional<z.ZodUnknown>;
|
|
1054
|
+
in: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
|
|
1055
|
+
matches: z.ZodOptional<z.ZodString>;
|
|
1056
|
+
}, "strip", z.ZodTypeAny, {
|
|
1057
|
+
path: string;
|
|
1058
|
+
equals?: unknown;
|
|
1059
|
+
in?: unknown[] | undefined;
|
|
1060
|
+
matches?: string | undefined;
|
|
1061
|
+
}, {
|
|
1062
|
+
path: string;
|
|
1063
|
+
equals?: unknown;
|
|
1064
|
+
in?: unknown[] | undefined;
|
|
1065
|
+
matches?: string | undefined;
|
|
1066
|
+
}>, {
|
|
1067
|
+
path: string;
|
|
1068
|
+
equals?: unknown;
|
|
1069
|
+
in?: unknown[] | undefined;
|
|
1070
|
+
matches?: string | undefined;
|
|
1071
|
+
}, {
|
|
1072
|
+
path: string;
|
|
1073
|
+
equals?: unknown;
|
|
1074
|
+
in?: unknown[] | undefined;
|
|
1075
|
+
matches?: string | undefined;
|
|
1076
|
+
}>, "many">>;
|
|
874
1077
|
}, "strip", z.ZodTypeAny, {
|
|
875
1078
|
any_tool_called?: string[] | undefined;
|
|
1079
|
+
all_tools_called?: string[] | undefined;
|
|
1080
|
+
no_tool_called?: string[] | undefined;
|
|
1081
|
+
output_required?: string[] | undefined;
|
|
1082
|
+
output_matches?: {
|
|
1083
|
+
path: string;
|
|
1084
|
+
equals?: unknown;
|
|
1085
|
+
in?: unknown[] | undefined;
|
|
1086
|
+
matches?: string | undefined;
|
|
1087
|
+
}[] | undefined;
|
|
876
1088
|
}, {
|
|
877
1089
|
any_tool_called?: string[] | undefined;
|
|
1090
|
+
all_tools_called?: string[] | undefined;
|
|
1091
|
+
no_tool_called?: string[] | undefined;
|
|
1092
|
+
output_required?: string[] | undefined;
|
|
1093
|
+
output_matches?: {
|
|
1094
|
+
path: string;
|
|
1095
|
+
equals?: unknown;
|
|
1096
|
+
in?: unknown[] | undefined;
|
|
1097
|
+
matches?: string | undefined;
|
|
1098
|
+
}[] | undefined;
|
|
878
1099
|
}>, {
|
|
879
1100
|
any_tool_called?: string[] | undefined;
|
|
1101
|
+
all_tools_called?: string[] | undefined;
|
|
1102
|
+
no_tool_called?: string[] | undefined;
|
|
1103
|
+
output_required?: string[] | undefined;
|
|
1104
|
+
output_matches?: {
|
|
1105
|
+
path: string;
|
|
1106
|
+
equals?: unknown;
|
|
1107
|
+
in?: unknown[] | undefined;
|
|
1108
|
+
matches?: string | undefined;
|
|
1109
|
+
}[] | undefined;
|
|
880
1110
|
}, {
|
|
881
1111
|
any_tool_called?: string[] | undefined;
|
|
1112
|
+
all_tools_called?: string[] | undefined;
|
|
1113
|
+
no_tool_called?: string[] | undefined;
|
|
1114
|
+
output_required?: string[] | undefined;
|
|
1115
|
+
output_matches?: {
|
|
1116
|
+
path: string;
|
|
1117
|
+
equals?: unknown;
|
|
1118
|
+
in?: unknown[] | undefined;
|
|
1119
|
+
matches?: string | undefined;
|
|
1120
|
+
}[] | undefined;
|
|
882
1121
|
}>>;
|
|
883
1122
|
}, "strip", z.ZodTypeAny, {
|
|
884
1123
|
instruction: string | {
|
|
@@ -931,6 +1170,15 @@ export declare const workflowZ: z.ZodObject<{
|
|
|
931
1170
|
max_turns?: number | undefined;
|
|
932
1171
|
verify?: {
|
|
933
1172
|
any_tool_called?: string[] | undefined;
|
|
1173
|
+
all_tools_called?: string[] | undefined;
|
|
1174
|
+
no_tool_called?: string[] | undefined;
|
|
1175
|
+
output_required?: string[] | undefined;
|
|
1176
|
+
output_matches?: {
|
|
1177
|
+
path: string;
|
|
1178
|
+
equals?: unknown;
|
|
1179
|
+
in?: unknown[] | undefined;
|
|
1180
|
+
matches?: string | undefined;
|
|
1181
|
+
}[] | undefined;
|
|
934
1182
|
} | undefined;
|
|
935
1183
|
}, {
|
|
936
1184
|
instruction: string | {
|
|
@@ -983,6 +1231,15 @@ export declare const workflowZ: z.ZodObject<{
|
|
|
983
1231
|
max_turns?: number | undefined;
|
|
984
1232
|
verify?: {
|
|
985
1233
|
any_tool_called?: string[] | undefined;
|
|
1234
|
+
all_tools_called?: string[] | undefined;
|
|
1235
|
+
no_tool_called?: string[] | undefined;
|
|
1236
|
+
output_required?: string[] | undefined;
|
|
1237
|
+
output_matches?: {
|
|
1238
|
+
path: string;
|
|
1239
|
+
equals?: unknown;
|
|
1240
|
+
in?: unknown[] | undefined;
|
|
1241
|
+
matches?: string | undefined;
|
|
1242
|
+
}[] | undefined;
|
|
986
1243
|
} | undefined;
|
|
987
1244
|
}>>;
|
|
988
1245
|
edges: z.ZodArray<z.ZodObject<{
|
|
@@ -1203,6 +1460,15 @@ export declare const workflowZ: z.ZodObject<{
|
|
|
1203
1460
|
max_turns?: number | undefined;
|
|
1204
1461
|
verify?: {
|
|
1205
1462
|
any_tool_called?: string[] | undefined;
|
|
1463
|
+
all_tools_called?: string[] | undefined;
|
|
1464
|
+
no_tool_called?: string[] | undefined;
|
|
1465
|
+
output_required?: string[] | undefined;
|
|
1466
|
+
output_matches?: {
|
|
1467
|
+
path: string;
|
|
1468
|
+
equals?: unknown;
|
|
1469
|
+
in?: unknown[] | undefined;
|
|
1470
|
+
matches?: string | undefined;
|
|
1471
|
+
}[] | undefined;
|
|
1206
1472
|
} | undefined;
|
|
1207
1473
|
}>;
|
|
1208
1474
|
edges: {
|
|
@@ -1282,6 +1548,15 @@ export declare const workflowZ: z.ZodObject<{
|
|
|
1282
1548
|
max_turns?: number | undefined;
|
|
1283
1549
|
verify?: {
|
|
1284
1550
|
any_tool_called?: string[] | undefined;
|
|
1551
|
+
all_tools_called?: string[] | undefined;
|
|
1552
|
+
no_tool_called?: string[] | undefined;
|
|
1553
|
+
output_required?: string[] | undefined;
|
|
1554
|
+
output_matches?: {
|
|
1555
|
+
path: string;
|
|
1556
|
+
equals?: unknown;
|
|
1557
|
+
in?: unknown[] | undefined;
|
|
1558
|
+
matches?: string | undefined;
|
|
1559
|
+
}[] | undefined;
|
|
1285
1560
|
} | undefined;
|
|
1286
1561
|
}>;
|
|
1287
1562
|
edges: {
|
|
@@ -1391,6 +1666,15 @@ export declare function parseWorkflow(raw: unknown): {
|
|
|
1391
1666
|
max_turns?: number | undefined;
|
|
1392
1667
|
verify?: {
|
|
1393
1668
|
any_tool_called?: string[] | undefined;
|
|
1669
|
+
all_tools_called?: string[] | undefined;
|
|
1670
|
+
no_tool_called?: string[] | undefined;
|
|
1671
|
+
output_required?: string[] | undefined;
|
|
1672
|
+
output_matches?: {
|
|
1673
|
+
path: string;
|
|
1674
|
+
equals?: unknown;
|
|
1675
|
+
in?: unknown[] | undefined;
|
|
1676
|
+
matches?: string | undefined;
|
|
1677
|
+
}[] | undefined;
|
|
1394
1678
|
} | undefined;
|
|
1395
1679
|
}>;
|
|
1396
1680
|
edges: {
|
package/dist/schema.js
CHANGED
|
@@ -75,12 +75,31 @@ export const nodeSourcesZ = z.union([
|
|
|
75
75
|
sources: z.array(sourceZ),
|
|
76
76
|
}),
|
|
77
77
|
]);
|
|
78
|
+
export const outputMatchZ = z
|
|
79
|
+
.object({
|
|
80
|
+
path: z.string().min(1),
|
|
81
|
+
equals: z.unknown().optional(),
|
|
82
|
+
in: z.array(z.unknown()).optional(),
|
|
83
|
+
matches: z.string().min(1).optional(),
|
|
84
|
+
})
|
|
85
|
+
.refine((m) => {
|
|
86
|
+
const operators = [m.equals !== undefined, m.in !== undefined, m.matches !== undefined];
|
|
87
|
+
return operators.filter(Boolean).length === 1;
|
|
88
|
+
}, { message: "output_matches entry must declare exactly one of: equals, in, matches" });
|
|
78
89
|
export const nodeVerifyZ = z
|
|
79
90
|
.object({
|
|
80
91
|
any_tool_called: z.array(z.string().min(1)).min(1).optional(),
|
|
92
|
+
all_tools_called: z.array(z.string().min(1)).min(1).optional(),
|
|
93
|
+
no_tool_called: z.array(z.string().min(1)).min(1).optional(),
|
|
94
|
+
output_required: z.array(z.string().min(1)).min(1).optional(),
|
|
95
|
+
output_matches: z.array(outputMatchZ).min(1).optional(),
|
|
81
96
|
})
|
|
82
|
-
.refine((v) => v.any_tool_called !== undefined
|
|
83
|
-
|
|
97
|
+
.refine((v) => v.any_tool_called !== undefined ||
|
|
98
|
+
v.all_tools_called !== undefined ||
|
|
99
|
+
v.no_tool_called !== undefined ||
|
|
100
|
+
v.output_required !== undefined ||
|
|
101
|
+
v.output_matches !== undefined, {
|
|
102
|
+
message: "verify must declare at least one check (any_tool_called, all_tools_called, no_tool_called, output_required, or output_matches)",
|
|
84
103
|
});
|
|
85
104
|
export const nodeZ = z.object({
|
|
86
105
|
name: z.string().min(1),
|
package/dist/types.d.ts
CHANGED
|
@@ -52,22 +52,41 @@ export type NodeSources = _Source[] | {
|
|
|
52
52
|
/**
|
|
53
53
|
* Machine-checked post-condition for a node.
|
|
54
54
|
*
|
|
55
|
-
* Evaluated by the executor AFTER the LLM finishes. If
|
|
56
|
-
* node is marked `failed` even if the LLM itself returned success
|
|
57
|
-
* catches the common case of the model claiming success without actually
|
|
58
|
-
* invoking the side-effectful tool (e.g. reporting "issue created" when no
|
|
59
|
-
* `linear_create_issue` call was made, or the call errored).
|
|
55
|
+
* Evaluated by the executor AFTER the LLM finishes. If any declared check
|
|
56
|
+
* fails, the node is marked `failed` even if the LLM itself returned success.
|
|
60
57
|
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
58
|
+
* All declared checks are AND-ed. The executor runs every check (no fast-fail)
|
|
59
|
+
* and concatenates failures into a single error string on `result.data.error`.
|
|
60
|
+
*
|
|
61
|
+
* Keep the shape small and declarative. Anything richer should be a skill or
|
|
62
|
+
* a dedicated workflow node, not a verify clause.
|
|
63
63
|
*/
|
|
64
64
|
export interface NodeVerify {
|
|
65
|
-
/**
|
|
66
|
-
* At least one of the named tools must have been invoked successfully during
|
|
67
|
-
* this node's execution (no `output.error` recorded in `toolCalls`). The
|
|
68
|
-
* node is marked failed otherwise.
|
|
69
|
-
*/
|
|
65
|
+
/** At least one of these tools was called and succeeded during this node. */
|
|
70
66
|
any_tool_called?: string[];
|
|
67
|
+
/** Every named tool was called and succeeded at least once during this node. */
|
|
68
|
+
all_tools_called?: string[];
|
|
69
|
+
/** None of these tools may have been invoked during this node. */
|
|
70
|
+
no_tool_called?: string[];
|
|
71
|
+
/** Listed paths must be present and non-null in `result.data` (see Path resolution in the spec). */
|
|
72
|
+
output_required?: string[];
|
|
73
|
+
/** Each assertion must hold against `result.data`. */
|
|
74
|
+
output_matches?: OutputMatch[];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A single output assertion. Exactly one of `equals | in | matches` must be set.
|
|
78
|
+
*
|
|
79
|
+
* `path` is a dotted path that may include `[*]` wildcard segments and may be
|
|
80
|
+
* prefixed with `all:` or `any:` to set wildcard semantics (default `all:`).
|
|
81
|
+
*
|
|
82
|
+
* Examples: `prUrl`, `findings[*].severity`, `any:checks[*].conclusion`.
|
|
83
|
+
*/
|
|
84
|
+
export interface OutputMatch {
|
|
85
|
+
path: string;
|
|
86
|
+
equals?: unknown;
|
|
87
|
+
in?: unknown[];
|
|
88
|
+
/** Regex source (no surrounding slashes, no flags). Value is coerced to string. */
|
|
89
|
+
matches?: string;
|
|
71
90
|
}
|
|
72
91
|
/** A node in the workflow DAG */
|
|
73
92
|
export interface Node {
|
package/dist/verify.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { NodeResult, NodeVerify, OutputMatch, ToolCall } from "./types.js";
|
|
2
|
+
export type Resolution = {
|
|
3
|
+
ok: true;
|
|
4
|
+
mode: "all" | "any";
|
|
5
|
+
values: unknown[];
|
|
6
|
+
} | {
|
|
7
|
+
ok: false;
|
|
8
|
+
reason: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function resolvePath(data: unknown, path: string): Resolution;
|
|
11
|
+
export declare function checkAnyToolCalled(required: string[], toolCalls: ToolCall[]): string | null;
|
|
12
|
+
export declare function checkAllToolsCalled(required: string[], toolCalls: ToolCall[]): string | null;
|
|
13
|
+
export declare function checkNoToolCalled(forbidden: string[], toolCalls: ToolCall[]): string | null;
|
|
14
|
+
export declare function checkOutputRequired(paths: string[], data: unknown): string | null;
|
|
15
|
+
export declare function checkOutputMatches(matches: OutputMatch[], data: unknown): string | null;
|
|
16
|
+
/**
|
|
17
|
+
* Evaluate every declared check and return a concatenated error string,
|
|
18
|
+
* or null when the node passes verification (or has no verify block).
|
|
19
|
+
*
|
|
20
|
+
* Deterministic and side-effect free — the executor calls this synchronously
|
|
21
|
+
* after the LLM finishes.
|
|
22
|
+
*/
|
|
23
|
+
export declare function evaluateVerify(verify: NodeVerify | undefined, result: NodeResult): string | null;
|