@uipath/flow-tool 1.204.0-preview.254 → 1.205.0-preview.256
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/README.md +9 -9
- package/dist/THIRD-PARTY-NOTICES.md +36 -12
- package/dist/{authoring-bppe07p0.js → authoring-e1k40hyw.js} +6 -5
- package/dist/{binding-service-9t9gqe9c.js → binding-service-yw91615m.js} +38 -30
- package/dist/{connector-service-xm05bmhz.js → connector-service-ttm75a4n.js} +224 -47
- package/dist/de-UZI7FJDO-awjpqfz0.js +200 -0
- package/dist/{de-MUJPA4EB-dpg7t2rw.js → de-UZI7FJDO-mwvc4cxe.js} +29 -2
- package/dist/{de-FGHEJRCI-rv513mfh.js → de-WLW6KWOJ-2qnsqdtw.js} +238 -31
- package/dist/debug-conversation-trigger-xsm3ycqx.js +30 -0
- package/dist/{debug-http-client-p4kf38yt.js → debug-http-client-yqjzsnhw.js} +5 -4
- package/dist/{debug-service-893erynq.js → debug-service-nra3n02y.js} +6 -5
- package/dist/{edge-service-rms6p69f.js → edge-service-8fv0m681.js} +16 -12
- package/dist/{embedded-file-reader-v8c2yj2a.js → embedded-file-reader-r66242ey.js} +2 -2
- package/dist/en-EJCBA3LK-0wb3b1xy.js +146 -0
- package/dist/{en-FBPVNKFN-dqt573xn.js → en-EJCBA3LK-dtpdghgj.js} +12 -4
- package/dist/{en-BWGKA5OE-1qkvb9rn.js → en-M7GQYBV2-5nfmpnfz.js} +88 -6
- package/dist/{es-7SE7HX2X-8yh1aj2y.js → es-4UBUTCQA-m1ytpyx2.js} +29 -2
- package/dist/es-4UBUTCQA-t7hsackg.js +200 -0
- package/dist/{es-KR3ZSNMP-84zphx0x.js → es-5THCNRFN-tqwyrdgy.js} +235 -28
- package/dist/{es-MX-2MYFZU7X-3rek4r73.js → es-MX-5RELIXKI-9jhqtddc.js} +29 -2
- package/dist/es-MX-5RELIXKI-jtjbcxbb.js +200 -0
- package/dist/{es-MX-XXZJGC4R-2mr8jtgm.js → es-MX-TWZBRAXK-gqd9swzw.js} +237 -30
- package/dist/filter-engine-7ep90g7f.js +11 -0
- package/dist/{flow-api-kjvpsxhw.js → flow-api-sat010z1.js} +16 -10
- package/dist/{flow-debug-service-3wtns3k7.js → flow-debug-service-cgawm96k.js} +96 -58
- package/dist/{flow-eval-node-target-ee6vbq8a.js → flow-eval-node-target-dah1gmmh.js} +17 -17
- package/dist/flow-eval-run-api-xdygjzfv.js +13 -0
- package/dist/{flow-eval-run-service-0ne6bjff.js → flow-eval-run-service-03j1szf6.js} +73 -80
- package/dist/{flow-eval-service-kbbq3wwq.js → flow-eval-service-9j46ta9k.js} +167 -415
- package/dist/{flow-init-sdk-source-z9qx1zkt.js → flow-init-sdk-source-xvdvkq7d.js} +6 -5
- package/dist/{flow-init-service-cefvmek0.js → flow-init-service-0a4y3a46.js} +19 -15
- package/dist/{flow-io-ykx6eb1v.js → flow-io-1wabd32s.js} +15 -11
- package/dist/{flow-migrate-service-c4hcjfc8.js → flow-migrate-service-mkqpbwtv.js} +16 -12
- package/dist/{flow-pack-service-6wqe1mj3.js → flow-pack-service-7dj2hhyz.js} +47 -38
- package/dist/flow-validate-service-1ktjayjv.js +70 -0
- package/dist/{fr-Y6NPVODW-8vr1ja4b.js → fr-CERONSRC-edpxhbmb.js} +237 -30
- package/dist/{fr-MDFKNZ4C-h4a122k9.js → fr-VBM5WRC2-63z7w4mh.js} +29 -2
- package/dist/fr-VBM5WRC2-707ha692.js +200 -0
- package/dist/{governance-fetcher-fgwewrfq.js → governance-fetcher-76hxssjm.js} +7 -6
- package/dist/{hitl-service-0tct4x3e.js → hitl-service-vcbhd4cb.js} +15 -11
- package/dist/{index-aaq9rwfv.js → index-1b2je9n2.js} +1088 -233
- package/dist/index-d090f35d.js +66 -0
- package/dist/{index-yj4xk2aw.js → index-dgdnbb2g.js} +7 -5
- package/dist/{index-ng2f77my.js → index-fyc0k5dd.js} +985 -617
- package/dist/{index-tzky1ynd.js → index-hz008fep.js} +6 -5
- package/dist/{index-vrhcbxnk.js → index-nsn889vf.js} +6 -5
- package/dist/{index-2s8rmmw6.js → index-sqhbn7ew.js} +4 -4
- package/dist/{index-tnz5ks4t.js → index-wycgq0ff.js} +65 -2230
- package/dist/index.js +17 -14
- package/dist/init.js +19 -15
- package/dist/inline-entity-resolver-64pqwk86.js +45 -0
- package/dist/input-reader-n7kzdrev.js +12 -0
- package/dist/{ja-UTQEAP34-8e0q6swp.js → ja-43QL7CGO-c3q8gre9.js} +29 -2
- package/dist/ja-43QL7CGO-h6qfxfay.js +200 -0
- package/dist/{ja-Q5PXKJ2V-p4msxzjd.js → ja-U2MCNHGT-gz0ap1jk.js} +235 -28
- package/dist/{known-types-q6fcyq2e.js → known-types-3025scz1.js} +5 -5
- package/dist/ko-TLL6Z6CD-ag6gjynr.js +200 -0
- package/dist/{ko-AXCHW2OK-askct7f6.js → ko-TLL6Z6CD-wrt3n8a9.js} +29 -2
- package/dist/{ko-AYBDSRZG-41mdmsg1.js → ko-XAUYQWDR-zp81gjp4.js} +237 -30
- package/dist/{maestro-automate-entry-qak46eg0.js → maestro-automate-entry-6f9act3w.js} +2 -2
- package/dist/{node-ey7dteda.js → node-hz6cvp9d.js} +29 -15
- package/dist/{node-service-z8s4nm09.js → node-service-7wz8gx7h.js} +41 -30
- package/dist/{node-strategy-fdnkvq4a.js → node-strategy-1dmmhvf3.js} +1 -1
- package/dist/node-sync-service-yvyf7chw.js +61 -0
- package/dist/packager-tool-10vc8pq4.js +2 -0
- package/dist/{packager-tool-wq9k7pq8.js → packager-tool-2h15x2kb.js} +6 -6
- package/dist/{packager-tool-c4909mw9.js → packager-tool-2z0r1f32.js} +668 -57
- package/dist/packager-tool-4kr6g0zw.js +16 -0
- package/dist/packager-tool-4x7tzvv0.js +1176 -0
- package/dist/{packager-tool-d88rqwk8.js → packager-tool-6z1hsm2h.js} +13 -5
- package/dist/packager-tool-7hw344bt.js +107 -0
- package/dist/{packager-tool-fjcbc1bb.js → packager-tool-7wnxyvf9.js} +519 -437
- package/dist/{packager-tool-m8xtf5ej.js → packager-tool-8g5931fz.js} +7 -4
- package/dist/{packager-tool-h9tzz0qd.js → packager-tool-961vsbsc.js} +15 -10
- package/dist/packager-tool-9era57c0.js +28 -0
- package/dist/packager-tool-9gprvfcy.js +23 -0
- package/dist/packager-tool-9jxzgsxc.js +14 -0
- package/dist/{packager-tool-zxp4hya4.js → packager-tool-a5afh1dc.js} +34 -13
- package/dist/{packager-tool-02f63a08.js → packager-tool-apawc11t.js} +88 -762
- package/dist/{packager-tool-tf3d2y8z.js → packager-tool-aw9v0raw.js} +2 -2
- package/dist/packager-tool-cqtsj6yh.js +2 -0
- package/dist/{packager-tool-5nqhxb9e.js → packager-tool-dwd6cc01.js} +16110 -13031
- package/dist/{packager-tool-t605qewm.js → packager-tool-dxgrhfq5.js} +2 -2
- package/dist/{packager-tool-awkq26v0.js → packager-tool-e7kvq8hf.js} +5 -3
- package/dist/{packager-tool-m6abv2vy.js → packager-tool-fjqpf1y6.js} +6 -24
- package/dist/{packager-tool-3dc9gz35.js → packager-tool-frjt46rb.js} +1 -1
- package/dist/{packager-tool-y8egb0fa.js → packager-tool-gqq3vkgh.js} +2573 -535
- package/dist/{packager-tool-w5a1hhyj.js → packager-tool-hxyjn885.js} +13 -2
- package/dist/packager-tool-j3228zs9.js +35 -0
- package/dist/{packager-tool-hhy1gr2k.js → packager-tool-jgfzfqjm.js} +1 -1
- package/dist/{packager-tool-n4m8yrm2.js → packager-tool-kb520rm5.js} +172 -71
- package/dist/{packager-tool-4fhedj18.js → packager-tool-kmv2p8z4.js} +20 -8
- package/dist/{packager-tool-6h69pd2a.js → packager-tool-kn86394c.js} +127 -61
- package/dist/packager-tool-mgcz986r.js +143 -0
- package/dist/{packager-tool-3h2ktz6q.js → packager-tool-myhbp761.js} +11 -1
- package/dist/{packager-tool-2xycknte.js → packager-tool-ns9xn7zq.js} +13 -13
- package/dist/{packager-tool-vbfz8k7w.js → packager-tool-p8gab24q.js} +52 -32
- package/dist/{packager-tool-stq8800d.js → packager-tool-pacrqxv2.js} +17 -4
- package/dist/{packager-tool-7q6z6npd.js → packager-tool-pcvhcn2k.js} +93 -11
- package/dist/packager-tool-phw8ydjx.js +331 -0
- package/dist/{packager-tool-c7nmvv5g.js → packager-tool-q8akejne.js} +6 -4
- package/dist/packager-tool-qcqb9hf8.js +26 -0
- package/dist/{packager-tool-n89vrpex.js → packager-tool-skcjythd.js} +10907 -25608
- package/dist/{packager-tool-vnwq9t1v.js → packager-tool-sphnextf.js} +5 -6
- package/dist/{packager-tool-1ca047de.js → packager-tool-sqpesv2e.js} +12 -56
- package/dist/packager-tool-t7ahhaer.js +877 -0
- package/dist/{packager-tool-0d375dbz.js → packager-tool-thnkpqwc.js} +1802 -378
- package/dist/{packager-tool-peawy22c.js → packager-tool-tqjfdpda.js} +53 -8
- package/dist/{packager-tool-qsa2nf80.js → packager-tool-vd3rn4fj.js} +463 -327
- package/dist/{packager-tool-5tjzg56t.js → packager-tool-wh660fny.js} +1 -1
- package/dist/{packager-tool-tyg399d6.js → packager-tool-wze74wyk.js} +74 -47
- package/dist/{packager-tool-arbswyqr.js → packager-tool-x20684x5.js} +1 -1
- package/dist/packager-tool-xj0agqpk.js +11 -0
- package/dist/packager-tool-xk78j7dz.js +1256 -0
- package/dist/{packager-tool-py93409h.js → packager-tool-ymma2s85.js} +2 -2
- package/dist/packager-tool-z0yxfhdj.js +40 -0
- package/dist/packager-tool.js +13 -10
- package/dist/{pt-BR-TKHNHMET-sn91xyq0.js → pt-BR-GNQNAAZ2-xadharv4.js} +237 -30
- package/dist/{pt-BR-Y6K6XHXK-mp3hwhw1.js → pt-BR-USP2T7GD-pedn77m1.js} +29 -2
- package/dist/pt-BR-USP2T7GD-rppy42ym.js +200 -0
- package/dist/{pt-3DIO5QWG-59b3f4bc.js → pt-RMIAKZB4-67enhx3m.js} +29 -2
- package/dist/pt-RMIAKZB4-t80exmp7.js +200 -0
- package/dist/{pt-ROXU257Y-2f6bxev4.js → pt-TO2DARY2-ftcce1bv.js} +237 -30
- package/dist/ro-GHOBYW2S-4zevc9dy.js +200 -0
- package/dist/{ro-BWR3ONRR-vzx3hy8a.js → ro-GHOBYW2S-mhnqsgaa.js} +29 -2
- package/dist/{ro-AVAWPKOO-b89pw79r.js → ro-WUYJV6OW-a8d9qy1n.js} +235 -28
- package/dist/ru-WBLQ5B2U-dpqvtfwr.js +10 -0
- package/dist/services/connector-request-buckets.d.ts +1 -0
- package/dist/services/flow-eval-file-store.d.ts +1 -11
- package/dist/services/flow-eval-utils.d.ts +1 -32
- package/dist/services/flow-validate-service.d.ts +51 -0
- package/dist/services/inline-entity-resolver.d.ts +22 -0
- package/dist/services/node-service.d.ts +21 -1
- package/dist/services/packaging-utils.d.ts +15 -2
- package/dist/{shared-utils-pnbvyyb2.js → shared-utils-tqnx96mg.js} +4 -3
- package/dist/solution-auth-8qz5pw7z.js +14 -0
- package/dist/solution-discovery-vqravtkh.js +44 -0
- package/dist/{tidy-service-chs0s9pw.js → tidy-service-tqjea6g2.js} +143 -39
- package/dist/tool.js +17 -14
- package/dist/{tr-5IIHSFW5-hw4cewew.js → tr-GDTLECMM-k5fhmq13.js} +29 -2
- package/dist/tr-GDTLECMM-kngksm3r.js +200 -0
- package/dist/{tr-JMIP7ZSL-c39b6pe4.js → tr-M3F5A6AU-bb0tg39m.js} +235 -28
- package/dist/utils/flow-io.d.ts +2 -1
- package/dist/validation.js +39 -33
- package/dist/{variable-service-6ky17hts.js → variable-service-kqnqxmx2.js} +16 -12
- package/dist/{wait-for-flow-job-d8m6mqb4.js → wait-for-flow-job-b0vj8828.js} +15 -12
- package/dist/{zh-CN-IFFXSEJS-9wm9gmrv.js → zh-CN-C5G4PC7C-ds9gkptg.js} +235 -28
- package/dist/zh-CN-I5D7WHBD-ge92tbx9.js +200 -0
- package/dist/{zh-CN-R2KU4U5L-tc1hat59.js → zh-CN-I5D7WHBD-sr5h0a98.js} +29 -2
- package/dist/{zh-TW-GNKMELBF-j674515r.js → zh-TW-2AVLM723-288pkc1z.js} +29 -2
- package/dist/zh-TW-2AVLM723-xsmap3gk.js +200 -0
- package/dist/{zh-TW-IYBNYAMG-8727c7v2.js → zh-TW-62HZIG6O-787kdwex.js} +234 -27
- package/package.json +2 -2
- package/dist/debug-conversation-trigger-mqzrtt1v.js +0 -44
- package/dist/flow-eval-run-api-byx3cacw.js +0 -13
- package/dist/flow-validate-service-5pbh3s4p.js +0 -64
- package/dist/input-reader-vhar4g0k.js +0 -11
- package/dist/node-sync-service-ak1wgysc.js +0 -40
- package/dist/packager-tool-2m06764j.js +0 -454
- package/dist/packager-tool-6c3szt0w.js +0 -265
- package/dist/packager-tool-8ak76pc3.js +0 -15
- package/dist/packager-tool-pz5nqg0s.js +0 -64
- package/dist/packager-tool-t3ysatjd.js +0 -521
- package/dist/packager-tool-vd6jt4n8.js +0 -208
- package/dist/services/flow-debug-service.d.ts +0 -320
- package/dist/services/flow-eval-schema/deterministic-evaluators.d.ts +0 -110
- package/dist/services/flow-eval-schema/evaluator-fields.d.ts +0 -66
- package/dist/services/flow-eval-schema/helpers.d.ts +0 -9
- package/dist/services/flow-eval-schema/index.d.ts +0 -4
- package/dist/services/flow-eval-schema/llm-judge-evaluators.d.ts +0 -174
- package/dist/services/flow-eval-schema/prompts.d.ts +0 -2
- package/dist/services/flow-eval-schema/registry.d.ts +0 -375
- package/dist/services/flow-eval-schema/tool-call-evaluators.d.ts +0 -93
- package/dist/services/flow-eval-schema/types.d.ts +0 -95
- package/dist/services/flow-eval-types.d.ts +0 -6
- package/dist/utils/write-resolved-flow.d.ts +0 -7
- /package/dist/{headless-45dypanh.js → headless-fw8pwyzm.js} +0 -0
- /package/dist/{localization-xecwjpe2.js → localization-d6gjmrsw.js} +0 -0
|
@@ -1,49 +1,56 @@
|
|
|
1
1
|
import {
|
|
2
|
-
FlowEvalPathResolver
|
|
3
|
-
|
|
4
|
-
findEvaluator,
|
|
5
|
-
getLinkedEvaluators,
|
|
6
|
-
removeEvaluatorRefFromSet
|
|
7
|
-
} from "./packager-tool-1ca047de.js";
|
|
2
|
+
FlowEvalPathResolver
|
|
3
|
+
} from "./packager-tool-sqpesv2e.js";
|
|
8
4
|
import {
|
|
9
5
|
FlowAgentNodeSchemaReader,
|
|
10
6
|
findFlowNode,
|
|
11
|
-
formatTriggerIdsHint,
|
|
12
7
|
isDocumentEvalNode,
|
|
13
8
|
isNodeEvalTarget,
|
|
14
|
-
listTriggerNodeIds,
|
|
15
9
|
readNodeTargetId
|
|
16
|
-
} from "./packager-tool-
|
|
10
|
+
} from "./packager-tool-fjqpf1y6.js";
|
|
11
|
+
import {
|
|
12
|
+
formatTriggerIdsHint,
|
|
13
|
+
listTriggerNodeIds
|
|
14
|
+
} from "./packager-tool-z0yxfhdj.js";
|
|
15
|
+
import"./packager-tool-10vc8pq4.js";
|
|
16
|
+
import"./packager-tool-4kr6g0zw.js";
|
|
17
|
+
import"./packager-tool-cqtsj6yh.js";
|
|
17
18
|
import {
|
|
18
|
-
|
|
19
|
-
} from "./packager-tool-
|
|
19
|
+
findMatchingDefinition
|
|
20
|
+
} from "./packager-tool-hxyjn885.js";
|
|
20
21
|
import {
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
EvalFileStore,
|
|
23
|
+
EvalFiles,
|
|
24
|
+
EvaluationCrud,
|
|
25
|
+
EvaluatorCrud,
|
|
23
26
|
evaluatorTypeAliases,
|
|
24
|
-
|
|
27
|
+
findEvalSet,
|
|
25
28
|
isRecord,
|
|
26
29
|
resolveEvalApiConfig,
|
|
27
|
-
resolveEvaluatorType,
|
|
28
30
|
slugify
|
|
29
|
-
} from "./packager-tool-
|
|
30
|
-
import"./packager-tool-
|
|
31
|
-
import"./packager-tool-
|
|
32
|
-
import
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
import"./packager-tool-
|
|
31
|
+
} from "./packager-tool-xk78j7dz.js";
|
|
32
|
+
import"./packager-tool-kmv2p8z4.js";
|
|
33
|
+
import"./packager-tool-8g5931fz.js";
|
|
34
|
+
import {
|
|
35
|
+
createFlowRefResolver,
|
|
36
|
+
resolveWorkflowRefs
|
|
37
|
+
} from "./packager-tool-thnkpqwc.js";
|
|
38
|
+
import"./packager-tool-961vsbsc.js";
|
|
39
|
+
import"./packager-tool-jgfzfqjm.js";
|
|
40
|
+
import"./packager-tool-qcqb9hf8.js";
|
|
41
|
+
import"./packager-tool-wze74wyk.js";
|
|
42
|
+
import"./packager-tool-pacrqxv2.js";
|
|
37
43
|
import"./packager-tool-nkrmjr3a.js";
|
|
38
|
-
import"./packager-tool-tyg399d6.js";
|
|
39
44
|
import"./packager-tool-rs6jm14d.js";
|
|
40
45
|
import"./packager-tool-hk1gxnth.js";
|
|
41
|
-
import"./packager-tool-
|
|
46
|
+
import"./packager-tool-mgcz986r.js";
|
|
47
|
+
import"./packager-tool-xj0agqpk.js";
|
|
48
|
+
import"./packager-tool-pcvhcn2k.js";
|
|
42
49
|
import"./packager-tool-sc961w0q.js";
|
|
43
50
|
import"./packager-tool-eq46jxm5.js";
|
|
44
51
|
import"./packager-tool-868re2t3.js";
|
|
45
52
|
import"./packager-tool-gbgfwx8f.js";
|
|
46
|
-
import"./packager-tool-
|
|
53
|
+
import"./packager-tool-6z1hsm2h.js";
|
|
47
54
|
import"./packager-tool-jysvpt8p.js";
|
|
48
55
|
import"./packager-tool-bhqx9kez.js";
|
|
49
56
|
import"./packager-tool-p79yh9ww.js";
|
|
@@ -51,12 +58,13 @@ import"./packager-tool-pxqras8k.js";
|
|
|
51
58
|
import"./packager-tool-z83pga0z.js";
|
|
52
59
|
import"./packager-tool-6ejqwbw9.js";
|
|
53
60
|
import"./packager-tool-mcaf4ewf.js";
|
|
61
|
+
import"./packager-tool-apawc11t.js";
|
|
54
62
|
import {
|
|
55
63
|
catchError
|
|
56
|
-
} from "./packager-tool-
|
|
64
|
+
} from "./packager-tool-t7ahhaer.js";
|
|
57
65
|
import {
|
|
58
66
|
getFileSystem
|
|
59
|
-
} from "./packager-tool-
|
|
67
|
+
} from "./packager-tool-myhbp761.js";
|
|
60
68
|
import"./packager-tool-4mna26cc.js";
|
|
61
69
|
import"./packager-tool-c23zrhj8.js";
|
|
62
70
|
import {
|
|
@@ -72,7 +80,7 @@ class FlowEvalOutputSchema {
|
|
|
72
80
|
this.pathResolver = pathResolver;
|
|
73
81
|
}
|
|
74
82
|
async read(projectPath) {
|
|
75
|
-
const root = await this.pathResolver.
|
|
83
|
+
const root = await this.pathResolver.resolveProjectPath(projectPath);
|
|
76
84
|
const [flowError, flowFilePath] = await catchError(this.pathResolver.findFlowFile(root));
|
|
77
85
|
if (flowError || !flowFilePath) {
|
|
78
86
|
return { flowFound: false, outputs: new Map };
|
|
@@ -118,40 +126,135 @@ class FlowNodeOutputSchemaReader {
|
|
|
118
126
|
this.pathResolver = pathResolver;
|
|
119
127
|
}
|
|
120
128
|
async read(projectPath, componentId) {
|
|
121
|
-
const root = await this.pathResolver.
|
|
129
|
+
const root = await this.pathResolver.resolveProjectPath(projectPath);
|
|
122
130
|
const [flowError, flowFilePath] = await catchError(this.pathResolver.findFlowFile(root));
|
|
123
131
|
if (flowError || !flowFilePath) {
|
|
124
132
|
return { schema: undefined, nodeFound: false };
|
|
125
133
|
}
|
|
126
|
-
const
|
|
127
|
-
return this.extract(
|
|
134
|
+
const flow = await readResolvedFlow(this.fs, flowFilePath);
|
|
135
|
+
return this.extract(flow, componentId);
|
|
136
|
+
}
|
|
137
|
+
extract(flow, componentId) {
|
|
138
|
+
return extractNodeOutputSchema(flow, componentId, false);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
async function readResolvedFlow(fs, flowFilePath) {
|
|
142
|
+
let parsed;
|
|
143
|
+
try {
|
|
144
|
+
parsed = JSON.parse(String(await fs.readFile(flowFilePath, "utf-8")));
|
|
145
|
+
} catch (error) {
|
|
146
|
+
throw new Error(`Could not parse ${flowFilePath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
147
|
+
}
|
|
148
|
+
if (!isRecord(parsed)) {
|
|
149
|
+
throw new Error(`Could not parse ${flowFilePath}: not a JSON object.`);
|
|
150
|
+
}
|
|
151
|
+
const missing = [];
|
|
152
|
+
const resolver = createFlowRefResolver(fs, {
|
|
153
|
+
warn: (message) => missing.push(message)
|
|
154
|
+
});
|
|
155
|
+
const [refError, result] = await catchError(resolveWorkflowRefs(parsed, resolver, flowFilePath));
|
|
156
|
+
if (refError || missing.length > 0 || !result || !isRecord(result.resolved)) {
|
|
157
|
+
const reason = refError ? refError.message : missing.length > 0 ? missing.join("; ") : "the resolved flow is not a JSON object";
|
|
158
|
+
throw new Error(`Could not resolve the $ref chunks of ${flowFilePath}: ${reason}`);
|
|
159
|
+
}
|
|
160
|
+
return result.resolved;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
class FlowComponentLocator {
|
|
164
|
+
fs;
|
|
165
|
+
pathResolver;
|
|
166
|
+
constructor(fs, pathResolver) {
|
|
167
|
+
this.fs = fs;
|
|
168
|
+
this.pathResolver = pathResolver;
|
|
169
|
+
}
|
|
170
|
+
async find(projectPath, componentId) {
|
|
171
|
+
const none = { flowRead: false, found: false, suggestions: [] };
|
|
172
|
+
const root = await this.pathResolver.resolveProjectPath(projectPath);
|
|
173
|
+
const [flowError, flowFilePath] = await catchError(this.pathResolver.findFlowFile(root));
|
|
174
|
+
if (flowError || !flowFilePath)
|
|
175
|
+
return none;
|
|
176
|
+
const flow = await readResolvedFlow(this.fs, flowFilePath);
|
|
177
|
+
const scopes = scopesOfNode(flow, componentId);
|
|
178
|
+
if (scopes.length > 1) {
|
|
179
|
+
throw new Error(`Component "${componentId}" names a node in more than one scope of ${flowFilePath} (${scopes.join(", ")}). Node ids must be unique across the flow, top level and subflows.`);
|
|
180
|
+
}
|
|
181
|
+
if (scopes.length === 1) {
|
|
182
|
+
return { flowRead: true, found: true, suggestions: [] };
|
|
183
|
+
}
|
|
184
|
+
const nodes = allNodes(flow);
|
|
185
|
+
return {
|
|
186
|
+
flowRead: true,
|
|
187
|
+
found: false,
|
|
188
|
+
suggestions: suggestComponentIds(nodes, componentId)
|
|
189
|
+
};
|
|
128
190
|
}
|
|
129
|
-
|
|
130
|
-
|
|
191
|
+
}
|
|
192
|
+
function scopesOfNode(flow, componentId) {
|
|
193
|
+
const scopes = [];
|
|
194
|
+
const scan = (list, scope) => {
|
|
195
|
+
if (!Array.isArray(list))
|
|
196
|
+
return;
|
|
197
|
+
for (const n of list) {
|
|
198
|
+
if (isRecord(n) && n.id === componentId)
|
|
199
|
+
scopes.push(scope);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
scan(flow.nodes, "nodes");
|
|
203
|
+
if (isRecord(flow.subflows)) {
|
|
204
|
+
for (const [key, sub] of Object.entries(flow.subflows)) {
|
|
205
|
+
if (isRecord(sub))
|
|
206
|
+
scan(sub.nodes, `subflows.${key}.nodes`);
|
|
207
|
+
}
|
|
131
208
|
}
|
|
209
|
+
return scopes;
|
|
210
|
+
}
|
|
211
|
+
function allNodes(flow) {
|
|
212
|
+
const out = [];
|
|
213
|
+
const push = (list) => {
|
|
214
|
+
if (!Array.isArray(list))
|
|
215
|
+
return;
|
|
216
|
+
for (const n of list)
|
|
217
|
+
if (isRecord(n))
|
|
218
|
+
out.push(n);
|
|
219
|
+
};
|
|
220
|
+
push(flow.nodes);
|
|
221
|
+
if (isRecord(flow.subflows)) {
|
|
222
|
+
for (const sub of Object.values(flow.subflows)) {
|
|
223
|
+
if (isRecord(sub))
|
|
224
|
+
push(sub.nodes);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return out;
|
|
228
|
+
}
|
|
229
|
+
function squash(id) {
|
|
230
|
+
return id.replace(/[^A-Za-z0-9]/g, "").toLowerCase();
|
|
231
|
+
}
|
|
232
|
+
function suggestComponentIds(nodes, componentId) {
|
|
233
|
+
const want = squash(componentId);
|
|
234
|
+
const hits = [];
|
|
235
|
+
for (const n of nodes) {
|
|
236
|
+
if (typeof n.id !== "string")
|
|
237
|
+
continue;
|
|
238
|
+
const display = isRecord(n.display) ? n.display : undefined;
|
|
239
|
+
const label = typeof display?.label === "string" ? display.label : "";
|
|
240
|
+
if (label === componentId || want !== "" && (squash(n.id) === want || squash(label) === want)) {
|
|
241
|
+
hits.push(n.id);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return [...new Set(hits)];
|
|
132
245
|
}
|
|
133
246
|
|
|
134
247
|
class SimulateFlowOutputSchemaReader extends FlowNodeOutputSchemaReader {
|
|
135
|
-
extract(
|
|
136
|
-
const result = extractNodeOutputSchema(
|
|
248
|
+
extract(flow, componentId) {
|
|
249
|
+
const result = extractNodeOutputSchema(flow, componentId, true);
|
|
137
250
|
if (!result.nodeFound || result.schema === undefined) {
|
|
138
251
|
return result;
|
|
139
252
|
}
|
|
140
253
|
return { ...result, schema: cleanOutputSchema(result.schema) };
|
|
141
254
|
}
|
|
142
255
|
}
|
|
143
|
-
function extractNodeOutputSchema(
|
|
144
|
-
|
|
145
|
-
try {
|
|
146
|
-
parsed = JSON.parse(flowContent);
|
|
147
|
-
} catch {
|
|
148
|
-
return { schema: undefined, nodeFound: false };
|
|
149
|
-
}
|
|
150
|
-
if (!isRecord(parsed)) {
|
|
151
|
-
return { schema: undefined, nodeFound: false };
|
|
152
|
-
}
|
|
153
|
-
const nodes = Array.isArray(parsed.nodes) ? parsed.nodes : [];
|
|
154
|
-
const node = nodes.find((n) => isRecord(n) && n.id === componentId);
|
|
256
|
+
function extractNodeOutputSchema(flow, componentId, wrapAllOutputs) {
|
|
257
|
+
const node = allNodes(flow).find((n) => n.id === componentId);
|
|
155
258
|
if (!node) {
|
|
156
259
|
return { schema: undefined, nodeFound: false };
|
|
157
260
|
}
|
|
@@ -284,7 +387,7 @@ class ChildSimulationSchemaReader {
|
|
|
284
387
|
this.pathResolver = pathResolver;
|
|
285
388
|
}
|
|
286
389
|
async read(projectPath, parentComponentId, childComponentId) {
|
|
287
|
-
const root = await this.pathResolver.
|
|
390
|
+
const root = await this.pathResolver.resolveProjectPath(projectPath);
|
|
288
391
|
const [flowError, flowFilePath] = await catchError(this.pathResolver.findFlowFile(root));
|
|
289
392
|
if (flowError || !flowFilePath) {
|
|
290
393
|
return {
|
|
@@ -381,7 +484,7 @@ class ChildSimulationSchemaReader {
|
|
|
381
484
|
errorDetail: authError.message
|
|
382
485
|
};
|
|
383
486
|
}
|
|
384
|
-
const { FlowEvalRunApi } = await import("./flow-eval-run-api-
|
|
487
|
+
const { FlowEvalRunApi } = await import("./flow-eval-run-api-xdygjzfv.js");
|
|
385
488
|
const api = new FlowEvalRunApi;
|
|
386
489
|
const [fetchError, components] = await catchError(api.getSimulatableComponents(config, processKey, processVersion));
|
|
387
490
|
if (fetchError || !components) {
|
|
@@ -615,119 +718,6 @@ function findToolSchemaInResources(resources, childComponentId) {
|
|
|
615
718
|
}
|
|
616
719
|
return;
|
|
617
720
|
}
|
|
618
|
-
|
|
619
|
-
// src/services/flow-eval-files.ts
|
|
620
|
-
import { randomUUID } from "node:crypto";
|
|
621
|
-
var EVAL_FILES_DIR = "eval-files";
|
|
622
|
-
var TOKEN_LENGTH = 12;
|
|
623
|
-
var EVALUATION_BINARY_PREFIX = "BINARY_FILE:";
|
|
624
|
-
var EVALUATION_BINARY_DELIMITER = `
|
|
625
|
-
---BASE64---
|
|
626
|
-
`;
|
|
627
|
-
var TEXT_EXTENSIONS = new Set([
|
|
628
|
-
".json",
|
|
629
|
-
".csv",
|
|
630
|
-
".tsv",
|
|
631
|
-
".txt",
|
|
632
|
-
".md",
|
|
633
|
-
".log",
|
|
634
|
-
".xml",
|
|
635
|
-
".html",
|
|
636
|
-
".htm",
|
|
637
|
-
".yaml",
|
|
638
|
-
".yml"
|
|
639
|
-
]);
|
|
640
|
-
var MIME_BY_EXT = {
|
|
641
|
-
".jpg": "image/jpeg",
|
|
642
|
-
".jpeg": "image/jpeg",
|
|
643
|
-
".png": "image/png",
|
|
644
|
-
".gif": "image/gif",
|
|
645
|
-
".bmp": "image/bmp",
|
|
646
|
-
".webp": "image/webp",
|
|
647
|
-
".tif": "image/tiff",
|
|
648
|
-
".tiff": "image/tiff",
|
|
649
|
-
".svg": "image/svg+xml",
|
|
650
|
-
".pdf": "application/pdf",
|
|
651
|
-
".doc": "application/msword",
|
|
652
|
-
".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
653
|
-
".xls": "application/vnd.ms-excel",
|
|
654
|
-
".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
655
|
-
".ppt": "application/vnd.ms-powerpoint",
|
|
656
|
-
".pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
657
|
-
".csv": "text/csv",
|
|
658
|
-
".tsv": "text/tab-separated-values",
|
|
659
|
-
".json": "application/json",
|
|
660
|
-
".txt": "text/plain",
|
|
661
|
-
".md": "text/markdown",
|
|
662
|
-
".log": "text/plain",
|
|
663
|
-
".xml": "application/xml",
|
|
664
|
-
".html": "text/html",
|
|
665
|
-
".htm": "text/html",
|
|
666
|
-
".yaml": "application/yaml",
|
|
667
|
-
".yml": "application/yaml"
|
|
668
|
-
};
|
|
669
|
-
|
|
670
|
-
class FlowEvalFiles {
|
|
671
|
-
fs;
|
|
672
|
-
pathResolver;
|
|
673
|
-
constructor(fs, pathResolver) {
|
|
674
|
-
this.fs = fs;
|
|
675
|
-
this.pathResolver = pathResolver;
|
|
676
|
-
}
|
|
677
|
-
async materialize(projectPath, sourcePath) {
|
|
678
|
-
const projectRoot = await this.pathResolver.resolveFlowProjectPath(projectPath);
|
|
679
|
-
const sourceAbsolute = this.fs.path.resolve(sourcePath);
|
|
680
|
-
if (!await this.fs.exists(sourceAbsolute)) {
|
|
681
|
-
throw new Error(`Input file not found: ${sourcePath}`);
|
|
682
|
-
}
|
|
683
|
-
const content = await this.fs.readFile(sourceAbsolute);
|
|
684
|
-
if (content === null) {
|
|
685
|
-
throw new Error(`Could not read input file: ${sourcePath}`);
|
|
686
|
-
}
|
|
687
|
-
const fullName = this.fs.path.basename(sourceAbsolute);
|
|
688
|
-
const evalRoot = await this.pathResolver.resolveEvalRoot(projectPath, true);
|
|
689
|
-
const dir = this.fs.path.join(evalRoot, EVAL_FILES_DIR);
|
|
690
|
-
await this.fs.mkdir(dir);
|
|
691
|
-
const targetName = await this.resolveTargetName(dir, fullName);
|
|
692
|
-
const targetPath = this.fs.path.join(dir, targetName);
|
|
693
|
-
const mimeType = mimeFromExt(extOf(fullName));
|
|
694
|
-
if (TEXT_EXTENSIONS.has(extOf(fullName))) {
|
|
695
|
-
await this.fs.writeFile(targetPath, content);
|
|
696
|
-
} else {
|
|
697
|
-
await this.fs.writeFile(targetPath, encodeBinaryEnvelope(content, mimeType));
|
|
698
|
-
}
|
|
699
|
-
const relative = this.fs.path.relative(projectRoot, targetPath).replaceAll("\\", "/");
|
|
700
|
-
return {
|
|
701
|
-
ID: `/${relative}`,
|
|
702
|
-
FullName: fullName,
|
|
703
|
-
MimeType: mimeType
|
|
704
|
-
};
|
|
705
|
-
}
|
|
706
|
-
async resolveTargetName(dir, fullName) {
|
|
707
|
-
if (!await this.fs.exists(this.fs.path.join(dir, fullName))) {
|
|
708
|
-
return fullName;
|
|
709
|
-
}
|
|
710
|
-
const ext = extOf(fullName);
|
|
711
|
-
const stem = ext ? fullName.slice(0, -ext.length) : fullName;
|
|
712
|
-
const token = randomUUID().replaceAll("-", "").slice(0, TOKEN_LENGTH);
|
|
713
|
-
return `${stem}_${token}${ext}`;
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
function encodeBinaryEnvelope(content, mimeType) {
|
|
717
|
-
const base64Content = Buffer.from(content).toString("base64");
|
|
718
|
-
return `${EVALUATION_BINARY_PREFIX}${mimeType}:${content.byteLength}${EVALUATION_BINARY_DELIMITER}${base64Content}`;
|
|
719
|
-
}
|
|
720
|
-
function extOf(name) {
|
|
721
|
-
const dot = name.lastIndexOf(".");
|
|
722
|
-
if (dot <= 0) {
|
|
723
|
-
return "";
|
|
724
|
-
}
|
|
725
|
-
return name.slice(dot).toLowerCase();
|
|
726
|
-
}
|
|
727
|
-
function mimeFromExt(ext) {
|
|
728
|
-
return MIME_BY_EXT[ext] ?? "application/octet-stream";
|
|
729
|
-
}
|
|
730
|
-
|
|
731
721
|
// src/services/flow-eval-input-schema.ts
|
|
732
722
|
class FlowEvalInputSchema {
|
|
733
723
|
fs;
|
|
@@ -737,7 +727,7 @@ class FlowEvalInputSchema {
|
|
|
737
727
|
this.pathResolver = pathResolver;
|
|
738
728
|
}
|
|
739
729
|
async read(projectPath) {
|
|
740
|
-
const root = await this.pathResolver.
|
|
730
|
+
const root = await this.pathResolver.resolveProjectPath(projectPath);
|
|
741
731
|
const [flowError, flowFilePath] = await catchError(this.pathResolver.findFlowFile(root));
|
|
742
732
|
if (flowError || !flowFilePath) {
|
|
743
733
|
return {
|
|
@@ -821,7 +811,7 @@ class FlowEvalSetCrud {
|
|
|
821
811
|
return this.store.readJsonFiles(this.fs.path.join(root, "eval-sets"));
|
|
822
812
|
}
|
|
823
813
|
async add(projectPath, options) {
|
|
824
|
-
const resolvedProjectPath = await this.pathResolver.
|
|
814
|
+
const resolvedProjectPath = await this.pathResolver.resolveProjectPath(projectPath);
|
|
825
815
|
const root = await this.pathResolver.resolveEvalRoot(projectPath, true);
|
|
826
816
|
const id = crypto.randomUUID();
|
|
827
817
|
const fileName = `evaluation-set-${slugify(options.name)}-${id.slice(0, 8)}.json`;
|
|
@@ -901,251 +891,6 @@ class FlowEvalSetCrud {
|
|
|
901
891
|
return true;
|
|
902
892
|
}
|
|
903
893
|
}
|
|
904
|
-
|
|
905
|
-
// src/services/flow-evaluation-crud.ts
|
|
906
|
-
class FlowEvaluationCrud {
|
|
907
|
-
fs;
|
|
908
|
-
store;
|
|
909
|
-
pathResolver;
|
|
910
|
-
constructor(fs, store, pathResolver) {
|
|
911
|
-
this.fs = fs;
|
|
912
|
-
this.store = store;
|
|
913
|
-
this.pathResolver = pathResolver;
|
|
914
|
-
}
|
|
915
|
-
async add(projectPath, setIdOrName, options) {
|
|
916
|
-
const root = await this.pathResolver.resolveEvalRoot(projectPath, true);
|
|
917
|
-
const evalSet = await this.requireEvalSet(projectPath, setIdOrName);
|
|
918
|
-
const evaluators = getLinkedEvaluators(await this.listEvaluators(root), evalSet);
|
|
919
|
-
const now = new Date().toISOString();
|
|
920
|
-
const evaluation = {
|
|
921
|
-
id: crypto.randomUUID(),
|
|
922
|
-
name: options.name,
|
|
923
|
-
inputs: options.inputs,
|
|
924
|
-
expectedOutput: options.expectedOutput,
|
|
925
|
-
evaluationCriterias: options.criteria ?? buildDefaultCriteria(evaluators, options.expectedOutput, options.searchText),
|
|
926
|
-
createdAt: now,
|
|
927
|
-
updatedAt: now
|
|
928
|
-
};
|
|
929
|
-
evalSet.evaluations.push(evaluation);
|
|
930
|
-
evalSet.updatedAt = now;
|
|
931
|
-
await this.writeEvalSet(root, evalSet);
|
|
932
|
-
return evaluation;
|
|
933
|
-
}
|
|
934
|
-
async list(projectPath, setIdOrName) {
|
|
935
|
-
const evalSet = await this.requireEvalSet(projectPath, setIdOrName);
|
|
936
|
-
return evalSet.evaluations;
|
|
937
|
-
}
|
|
938
|
-
async addSimulation(projectPath, setIdOrName, evaluationIdOrName, simulation) {
|
|
939
|
-
const root = await this.pathResolver.resolveEvalRoot(projectPath, true);
|
|
940
|
-
const evalSet = await this.requireEvalSet(projectPath, setIdOrName);
|
|
941
|
-
const evaluation = evalSet.evaluations.find((e) => e.id === evaluationIdOrName || e.name === evaluationIdOrName);
|
|
942
|
-
if (!evaluation) {
|
|
943
|
-
throw new Error(`Data point "${evaluationIdOrName}" not found`);
|
|
944
|
-
}
|
|
945
|
-
if (!evaluation.simulations) {
|
|
946
|
-
evaluation.simulations = [];
|
|
947
|
-
}
|
|
948
|
-
const existing = evaluation.simulations.findIndex((s) => s.componentId === simulation.componentId);
|
|
949
|
-
const now = new Date().toISOString();
|
|
950
|
-
if (existing !== -1) {
|
|
951
|
-
evaluation.simulations[existing] = simulation;
|
|
952
|
-
} else {
|
|
953
|
-
evaluation.simulations.push(simulation);
|
|
954
|
-
}
|
|
955
|
-
evaluation.updatedAt = now;
|
|
956
|
-
evalSet.updatedAt = now;
|
|
957
|
-
await this.writeEvalSet(root, evalSet);
|
|
958
|
-
return simulation;
|
|
959
|
-
}
|
|
960
|
-
async listSimulations(projectPath, setIdOrName, evaluationIdOrName) {
|
|
961
|
-
const evalSet = await this.requireEvalSet(projectPath, setIdOrName);
|
|
962
|
-
const evaluation = evalSet.evaluations.find((e) => e.id === evaluationIdOrName || e.name === evaluationIdOrName);
|
|
963
|
-
if (!evaluation) {
|
|
964
|
-
throw new Error(`Data point "${evaluationIdOrName}" not found`);
|
|
965
|
-
}
|
|
966
|
-
return evaluation.simulations ?? [];
|
|
967
|
-
}
|
|
968
|
-
async addChildSimulation(projectPath, setIdOrName, evaluationIdOrName, parentComponentId, childSimulation) {
|
|
969
|
-
const root = await this.pathResolver.resolveEvalRoot(projectPath, true);
|
|
970
|
-
const evalSet = await this.requireEvalSet(projectPath, setIdOrName);
|
|
971
|
-
const evaluation = evalSet.evaluations.find((e) => e.id === evaluationIdOrName || e.name === evaluationIdOrName);
|
|
972
|
-
if (!evaluation) {
|
|
973
|
-
throw new Error(`Data point "${evaluationIdOrName}" not found`);
|
|
974
|
-
}
|
|
975
|
-
if (!evaluation.simulations) {
|
|
976
|
-
evaluation.simulations = [];
|
|
977
|
-
}
|
|
978
|
-
let parent = evaluation.simulations.find((s) => s.componentId === parentComponentId);
|
|
979
|
-
if (!parent) {
|
|
980
|
-
parent = {
|
|
981
|
-
componentId: parentComponentId,
|
|
982
|
-
componentType: "agent",
|
|
983
|
-
simulationStrategy: "Llm",
|
|
984
|
-
childSimulations: []
|
|
985
|
-
};
|
|
986
|
-
evaluation.simulations.push(parent);
|
|
987
|
-
}
|
|
988
|
-
if (!parent.childSimulations) {
|
|
989
|
-
parent.childSimulations = [];
|
|
990
|
-
}
|
|
991
|
-
const existing = parent.childSimulations.findIndex((s) => s.componentId === childSimulation.componentId);
|
|
992
|
-
const now = new Date().toISOString();
|
|
993
|
-
if (existing !== -1) {
|
|
994
|
-
parent.childSimulations[existing] = childSimulation;
|
|
995
|
-
} else {
|
|
996
|
-
parent.childSimulations.push(childSimulation);
|
|
997
|
-
}
|
|
998
|
-
evaluation.updatedAt = now;
|
|
999
|
-
evalSet.updatedAt = now;
|
|
1000
|
-
await this.writeEvalSet(root, evalSet);
|
|
1001
|
-
return childSimulation;
|
|
1002
|
-
}
|
|
1003
|
-
listChildSimulations(evaluation, parentComponentId) {
|
|
1004
|
-
const parent = (evaluation.simulations ?? []).find((s) => s.componentId === parentComponentId);
|
|
1005
|
-
if (!parent) {
|
|
1006
|
-
throw new Error(`Simulation for component "${parentComponentId}" not found`);
|
|
1007
|
-
}
|
|
1008
|
-
return parent.childSimulations ?? [];
|
|
1009
|
-
}
|
|
1010
|
-
async removeChildSimulation(projectPath, setIdOrName, evaluationIdOrName, parentComponentId, childComponentId) {
|
|
1011
|
-
const root = await this.pathResolver.resolveEvalRoot(projectPath, false);
|
|
1012
|
-
if (!root) {
|
|
1013
|
-
return false;
|
|
1014
|
-
}
|
|
1015
|
-
const evalSet = await this.requireEvalSet(projectPath, setIdOrName);
|
|
1016
|
-
const evaluation = evalSet.evaluations.find((e) => e.id === evaluationIdOrName || e.name === evaluationIdOrName);
|
|
1017
|
-
if (!evaluation) {
|
|
1018
|
-
throw new Error(`Data point "${evaluationIdOrName}" not found`);
|
|
1019
|
-
}
|
|
1020
|
-
const parent = (evaluation.simulations ?? []).find((s) => s.componentId === parentComponentId);
|
|
1021
|
-
if (!parent) {
|
|
1022
|
-
throw new Error(`Simulation for component "${parentComponentId}" not found`);
|
|
1023
|
-
}
|
|
1024
|
-
const index = (parent.childSimulations ?? []).findIndex((s) => s.componentId === childComponentId);
|
|
1025
|
-
if (index === -1) {
|
|
1026
|
-
return false;
|
|
1027
|
-
}
|
|
1028
|
-
parent.childSimulations?.splice(index, 1);
|
|
1029
|
-
evalSet.updatedAt = new Date().toISOString();
|
|
1030
|
-
await this.writeEvalSet(root, evalSet);
|
|
1031
|
-
return true;
|
|
1032
|
-
}
|
|
1033
|
-
async removeSimulation(projectPath, setIdOrName, evaluationIdOrName, componentId) {
|
|
1034
|
-
const root = await this.pathResolver.resolveEvalRoot(projectPath, false);
|
|
1035
|
-
if (!root) {
|
|
1036
|
-
return false;
|
|
1037
|
-
}
|
|
1038
|
-
const evalSet = await this.requireEvalSet(projectPath, setIdOrName);
|
|
1039
|
-
const evaluation = evalSet.evaluations.find((e) => e.id === evaluationIdOrName || e.name === evaluationIdOrName);
|
|
1040
|
-
if (!evaluation) {
|
|
1041
|
-
throw new Error(`Data point "${evaluationIdOrName}" not found`);
|
|
1042
|
-
}
|
|
1043
|
-
const index = (evaluation.simulations ?? []).findIndex((s) => s.componentId === componentId);
|
|
1044
|
-
if (index === -1) {
|
|
1045
|
-
return false;
|
|
1046
|
-
}
|
|
1047
|
-
evaluation.simulations?.splice(index, 1);
|
|
1048
|
-
evalSet.updatedAt = new Date().toISOString();
|
|
1049
|
-
await this.writeEvalSet(root, evalSet);
|
|
1050
|
-
return true;
|
|
1051
|
-
}
|
|
1052
|
-
async remove(projectPath, setIdOrName, evaluationIdOrName) {
|
|
1053
|
-
const root = await this.pathResolver.resolveEvalRoot(projectPath, false);
|
|
1054
|
-
if (!root) {
|
|
1055
|
-
return false;
|
|
1056
|
-
}
|
|
1057
|
-
const evalSet = await this.requireEvalSet(projectPath, setIdOrName);
|
|
1058
|
-
const index = evalSet.evaluations.findIndex((evaluation) => evaluation.id === evaluationIdOrName || evaluation.name === evaluationIdOrName);
|
|
1059
|
-
if (index === -1) {
|
|
1060
|
-
return false;
|
|
1061
|
-
}
|
|
1062
|
-
evalSet.evaluations.splice(index, 1);
|
|
1063
|
-
evalSet.updatedAt = new Date().toISOString();
|
|
1064
|
-
await this.writeEvalSet(root, evalSet);
|
|
1065
|
-
return true;
|
|
1066
|
-
}
|
|
1067
|
-
async requireEvalSet(projectPath, idOrName) {
|
|
1068
|
-
const root = await this.pathResolver.resolveEvalRoot(projectPath, false);
|
|
1069
|
-
const evalSet = root ? findEvalSet(await this.listEvalSets(root), idOrName) : null;
|
|
1070
|
-
if (!evalSet) {
|
|
1071
|
-
throw new Error(`Evaluation set "${idOrName}" not found`);
|
|
1072
|
-
}
|
|
1073
|
-
return evalSet;
|
|
1074
|
-
}
|
|
1075
|
-
async listEvalSets(root) {
|
|
1076
|
-
return this.store.readJsonFiles(this.fs.path.join(root, "eval-sets"));
|
|
1077
|
-
}
|
|
1078
|
-
async listEvaluators(root) {
|
|
1079
|
-
return this.store.readJsonFiles(this.fs.path.join(root, "evaluators"));
|
|
1080
|
-
}
|
|
1081
|
-
async writeEvalSet(root, evalSet) {
|
|
1082
|
-
await this.store.writeJsonFile(this.fs.path.join(root, "eval-sets", evalSet.fileName ?? `${evalSet.id}.json`), evalSet);
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
// src/services/flow-evaluator-crud.ts
|
|
1087
|
-
class FlowEvaluatorCrud {
|
|
1088
|
-
fs;
|
|
1089
|
-
store;
|
|
1090
|
-
pathResolver;
|
|
1091
|
-
constructor(fs, store, pathResolver) {
|
|
1092
|
-
this.fs = fs;
|
|
1093
|
-
this.store = store;
|
|
1094
|
-
this.pathResolver = pathResolver;
|
|
1095
|
-
}
|
|
1096
|
-
async list(projectPath) {
|
|
1097
|
-
const root = await this.pathResolver.resolveEvalRoot(projectPath, false);
|
|
1098
|
-
if (!root) {
|
|
1099
|
-
return [];
|
|
1100
|
-
}
|
|
1101
|
-
return this.store.readJsonFiles(this.fs.path.join(root, "evaluators"));
|
|
1102
|
-
}
|
|
1103
|
-
async add(projectPath, options) {
|
|
1104
|
-
const root = await this.pathResolver.resolveEvalRoot(projectPath, true);
|
|
1105
|
-
const typeId = resolveEvaluatorType(options.type);
|
|
1106
|
-
const id = `${slugify(options.name)}-${crypto.randomUUID().slice(0, 8)}`;
|
|
1107
|
-
const now = new Date().toISOString();
|
|
1108
|
-
const fileName = `${id}.json`;
|
|
1109
|
-
const evaluator = {
|
|
1110
|
-
version: "1.0",
|
|
1111
|
-
id,
|
|
1112
|
-
name: options.name,
|
|
1113
|
-
description: options.description ?? `${options.name} evaluator`,
|
|
1114
|
-
evaluatorTypeId: typeId,
|
|
1115
|
-
evaluatorConfig: buildEvaluatorConfig(typeId, options),
|
|
1116
|
-
fileName,
|
|
1117
|
-
createdAt: now,
|
|
1118
|
-
updatedAt: now
|
|
1119
|
-
};
|
|
1120
|
-
await this.store.writeJsonFile(this.fs.path.join(root, "evaluators", fileName), evaluator);
|
|
1121
|
-
return evaluator;
|
|
1122
|
-
}
|
|
1123
|
-
async remove(projectPath, idOrName) {
|
|
1124
|
-
const root = await this.pathResolver.resolveEvalRoot(projectPath, false);
|
|
1125
|
-
if (!root) {
|
|
1126
|
-
return false;
|
|
1127
|
-
}
|
|
1128
|
-
const evaluator = findEvaluator(await this.list(projectPath), idOrName);
|
|
1129
|
-
if (!evaluator?.fileName) {
|
|
1130
|
-
return false;
|
|
1131
|
-
}
|
|
1132
|
-
await this.store.remove(this.fs.path.join(root, "evaluators", evaluator.fileName));
|
|
1133
|
-
await this.removeEvaluatorRefs(root, evaluator);
|
|
1134
|
-
return true;
|
|
1135
|
-
}
|
|
1136
|
-
async removeEvaluatorRefs(root, evaluator) {
|
|
1137
|
-
const sets = await this.store.readJsonFiles(this.fs.path.join(root, "eval-sets"));
|
|
1138
|
-
for (const set of sets) {
|
|
1139
|
-
if (removeEvaluatorRefFromSet(set, evaluator) && set.fileName) {
|
|
1140
|
-
await this.writeEvalSet(root, set);
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
async writeEvalSet(root, evalSet) {
|
|
1145
|
-
await this.store.writeJsonFile(this.fs.path.join(root, "eval-sets", evalSet.fileName ?? `${evalSet.id}.json`), evalSet);
|
|
1146
|
-
}
|
|
1147
|
-
}
|
|
1148
|
-
|
|
1149
894
|
// src/services/flow-eval-service.ts
|
|
1150
895
|
class FlowEvalService {
|
|
1151
896
|
fs;
|
|
@@ -1156,19 +901,21 @@ class FlowEvalService {
|
|
|
1156
901
|
inputSchema;
|
|
1157
902
|
outputSchema;
|
|
1158
903
|
nodeOutputSchema;
|
|
904
|
+
componentLocator;
|
|
1159
905
|
agentNodeSchema;
|
|
1160
906
|
childSimulationSchema;
|
|
1161
907
|
constructor(fs = getFileSystem()) {
|
|
1162
908
|
this.fs = fs;
|
|
1163
|
-
const store = new
|
|
909
|
+
const store = new EvalFileStore(fs);
|
|
1164
910
|
const pathResolver = new FlowEvalPathResolver(fs);
|
|
1165
|
-
this.evaluators = new
|
|
911
|
+
this.evaluators = new EvaluatorCrud(fs, store, pathResolver);
|
|
1166
912
|
this.evalSets = new FlowEvalSetCrud(fs, store, pathResolver);
|
|
1167
|
-
this.evaluations = new
|
|
1168
|
-
this.files = new
|
|
913
|
+
this.evaluations = new EvaluationCrud(fs, store, pathResolver);
|
|
914
|
+
this.files = new EvalFiles(fs, pathResolver);
|
|
1169
915
|
this.inputSchema = new FlowEvalInputSchema(fs, pathResolver);
|
|
1170
916
|
this.outputSchema = new FlowEvalOutputSchema(fs, pathResolver);
|
|
1171
917
|
this.nodeOutputSchema = new SimulateFlowOutputSchemaReader(fs, pathResolver);
|
|
918
|
+
this.componentLocator = new FlowComponentLocator(fs, pathResolver);
|
|
1172
919
|
this.agentNodeSchema = new FlowAgentNodeSchemaReader(fs, pathResolver);
|
|
1173
920
|
this.childSimulationSchema = new ChildSimulationSchemaReader(fs, pathResolver);
|
|
1174
921
|
}
|
|
@@ -1294,6 +1041,11 @@ class FlowEvalService {
|
|
|
1294
1041
|
return this.evaluations.remove(projectPath, setIdOrName, evaluationIdOrName);
|
|
1295
1042
|
}
|
|
1296
1043
|
async addSimulation(projectPath, setIdOrName, evaluationIdOrName, simulation) {
|
|
1044
|
+
const located = await this.componentLocator.find(projectPath, simulation.componentId);
|
|
1045
|
+
if (located.flowRead && !located.found) {
|
|
1046
|
+
const hint = located.suggestions.length ? ` Did you mean ${located.suggestions.map((id) => `"${id}"`).join(" or ")}? A simulation targets the node's id, not its label.` : " Use a node id from the .flow (nodes[].id or subflows.<id>.nodes[].id).";
|
|
1047
|
+
throw new Error(`Component "${simulation.componentId}" not found in the flow.${hint}`);
|
|
1048
|
+
}
|
|
1297
1049
|
if (simulation.simulationStrategy === "Llm" && simulation.outputSchema === undefined) {
|
|
1298
1050
|
const resolved = await this.nodeOutputSchema.read(projectPath, simulation.componentId);
|
|
1299
1051
|
if (!resolved.nodeFound) {
|
|
@@ -1380,4 +1132,4 @@ export {
|
|
|
1380
1132
|
FlowEvalService
|
|
1381
1133
|
};
|
|
1382
1134
|
|
|
1383
|
-
//# debugId=
|
|
1135
|
+
//# debugId=0488B8F22516EBE964756E2164756E21
|