@langwatch/mcp-server 2.1.0 → 3.0.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/.gitignore +7 -0
- package/.npmignore +41 -0
- package/CHANGELOG.md +218 -201
- package/CONTRIBUTING.md +10 -0
- package/README.md +70 -68
- package/dist/add-dashboard-widget-55UI6H22.js +44 -0
- package/dist/add-dashboard-widget-MJHIC3CC.js +45 -0
- package/dist/{archive-project-W3IKI7UL.js → archive-project-K5UD7A6X.js} +4 -4
- package/dist/archive-project-L4PAKT34.js +19 -0
- package/dist/{archive-run-plan-474OKHHU.js → archive-run-plan-5HSQG2HX.js} +4 -4
- package/dist/archive-run-plan-AOKNYQIO.js +15 -0
- package/dist/archive-scenario-2CWJW2VD.js +19 -0
- package/dist/{archive-scenario-V5UNYK26.js → archive-scenario-5IJQESHH.js} +4 -4
- package/dist/{archive-test-suite-O7FLDMXK.js → archive-test-suite-OPB7NFI7.js} +4 -4
- package/dist/archive-test-suite-ZC3TN6VH.js +15 -0
- package/dist/assign-prompt-tag-6DDE6ZZ5.js +23 -0
- package/dist/{assign-prompt-tag-Q46WRB6P.js → assign-prompt-tag-D7O23MJM.js} +8 -4
- package/dist/chunk-3YLN3ATJ.js +241 -0
- package/dist/{chunk-EYXMLE5X.js → chunk-4RX3G62A.js} +56 -47
- package/dist/{chunk-UF6XIGYR.js → chunk-6YZUOD34.js} +2 -5
- package/dist/{chunk-WVI5CJ6S.js → chunk-7AQLPVFL.js} +2 -2
- package/dist/chunk-7CZQDZ2K.js +319 -0
- package/dist/{chunk-RVAE2MEA.js → chunk-7GETGE6B.js} +7 -7
- package/dist/{chunk-OJLYYJWI.js → chunk-AASW2TO2.js} +7 -10
- package/dist/{chunk-QAMP3CGR.js → chunk-B4RFWIUP.js} +4 -4
- package/dist/{chunk-ZXKLPC2E.js → chunk-BIIKE3EI.js} +1 -1
- package/dist/{chunk-G4ZAZTZW.js → chunk-D2HS73VI.js} +7 -10
- package/dist/{chunk-37SMPMQS.js → chunk-DMM3JQ42.js} +7 -2
- package/dist/{chunk-WT4PO4A3.js → chunk-DULFP3MK.js} +10 -7
- package/dist/chunk-EYPJBL7P.js +516 -0
- package/dist/{chunk-NUFPTHKU.js → chunk-FOKVY3BK.js} +1 -1
- package/dist/chunk-GA5JUSPT.js +64 -0
- package/dist/{chunk-UJPXFA26.js → chunk-HHMNZAPD.js} +101 -74
- package/dist/chunk-HLQJXUR6.js +67 -0
- package/dist/{chunk-JTQJRNFJ.js → chunk-KILVK3FS.js} +4 -4
- package/dist/chunk-MOCU5XWF.js +79 -0
- package/dist/chunk-O2WGVCED.js +41 -0
- package/dist/{chunk-HV4DWKBI.js → chunk-O7EMWEVJ.js} +2 -4
- package/dist/{chunk-UFOYFYI7.js → chunk-QXLMHLRC.js} +6 -9
- package/dist/{chunk-QRO35SOM.js → chunk-R5YJIYPF.js} +981 -747
- package/dist/{chunk-JR6DJZOU.js → chunk-RABYBFX5.js} +4 -10
- package/dist/{chunk-SR6QPRIE.js → chunk-RFC2SBEX.js} +7 -13
- package/dist/chunk-SHSVN3SE.js +21 -0
- package/dist/{chunk-CKNAH5TG.js → chunk-U24EACC4.js} +3 -10
- package/dist/{chunk-56OGTS24.js → chunk-VOUGDY2O.js} +4 -11
- package/dist/chunk-WCKZDOGF.js +31 -0
- package/dist/chunk-XQYH52SI.js +129 -0
- package/dist/{chunk-7E4FZIYJ.js → chunk-XUIJYNRJ.js} +1 -1
- package/dist/{chunk-6DJDEXET.js → chunk-YCIUEZVK.js} +6 -12
- package/dist/config-2WQGMAEN.js +16 -0
- package/dist/config.cjs +109 -0
- package/dist/config.js +5 -4
- package/dist/{create-agent-JFJ2K6X3.js → create-agent-6JNLMYQD.js} +4 -4
- package/dist/create-agent-IRZOU4R5.js +23 -0
- package/dist/create-analytics-report-N4L4V5QL.js +19 -0
- package/dist/create-analytics-report-QEHXG7FU.js +18 -0
- package/dist/{create-annotation-EUXXQ6NS.js → create-annotation-CCEGIZ67.js} +10 -5
- package/dist/create-annotation-DTHCMWHB.js +29 -0
- package/dist/{create-api-key-BGBB76JX.js → create-api-key-JKM2DSZO.js} +5 -7
- package/dist/create-api-key-JPEUIXGM.js +24 -0
- package/dist/create-dataset-DJNXYJ5B.js +22 -0
- package/dist/{create-dataset-FD5VAXU4.js → create-dataset-WON4SOTC.js} +6 -6
- package/dist/create-dataset-records-TMEOTLTO.js +20 -0
- package/dist/{create-dataset-records-WQUXXOHI.js → create-dataset-records-UJBW3C7C.js} +5 -7
- package/dist/create-evaluator-N5AEHI4K.js +27 -0
- package/dist/{create-evaluator-6NV33Z52.js → create-evaluator-XYNY2YFY.js} +4 -4
- package/dist/create-mcp-server.cjs +9712 -0
- package/dist/create-mcp-server.js +2757 -10
- package/dist/{create-project-ZQ7TFIO2.js → create-project-EY4XZ7TH.js} +4 -4
- package/dist/create-project-YL345T5L.js +44 -0
- package/dist/{create-prompt-BS6QRCUU.js → create-prompt-JZQNQ7I3.js} +5 -7
- package/dist/create-prompt-ZUMQHHX7.js +37 -0
- package/dist/create-prompt-tag-CJ5FZ436.js +17 -0
- package/dist/{create-prompt-tag-FCQ5ELSQ.js → create-prompt-tag-JFP2Q3PO.js} +3 -3
- package/dist/create-scenario-CQU2SSFB.js +33 -0
- package/dist/{create-scenario-DRPTPXU3.js → create-scenario-S6OWWKJO.js} +5 -5
- package/dist/create-test-suite-OLGCAGJA.js +36 -0
- package/dist/{create-test-suite-ZIZCCFJ4.js → create-test-suite-Y7P2RI4L.js} +6 -6
- package/dist/create-trigger-4CNBTISJ.js +48 -0
- package/dist/create-trigger-RQ653WYF.js +49 -0
- package/dist/dashboards-BA7M6CMO.js +90 -0
- package/dist/dashboards-U663GUIB.js +91 -0
- package/dist/{delete-agent-SA4JMUZF.js → delete-agent-J2Q4DRZ2.js} +4 -4
- package/dist/delete-agent-ZAU4LTXB.js +18 -0
- package/dist/delete-analytics-report-QK6X7P4S.js +19 -0
- package/dist/delete-analytics-report-YUYLDHLL.js +18 -0
- package/dist/delete-annotation-7X4NYXXM.js +17 -0
- package/dist/{delete-annotation-X3KKK7QY.js → delete-annotation-KJOCDLV3.js} +4 -4
- package/dist/{delete-dataset-W6EZ44HY.js → delete-dataset-NXP7ZPPV.js} +5 -7
- package/dist/delete-dataset-RUTZBBVD.js +18 -0
- package/dist/{delete-dataset-records-7CNOTALB.js → delete-dataset-records-4Z7DZCDW.js} +5 -7
- package/dist/delete-dataset-records-75UAR5IS.js +19 -0
- package/dist/delete-evaluator-E3CUNGTQ.js +16 -0
- package/dist/delete-evaluator-RI4GALGX.js +15 -0
- package/dist/delete-prompt-tag-LE3WJPKS.js +17 -0
- package/dist/{delete-prompt-tag-QB3OCZUV.js → delete-prompt-tag-S4KBZTNG.js} +3 -3
- package/dist/delete-workflow-4CZFIQCQ.js +17 -0
- package/dist/{delete-workflow-NG2VXYYM.js → delete-workflow-PWQPDW6H.js} +4 -4
- package/dist/discover-evaluator-schema-UHWA5HVL.js +120 -0
- package/dist/discover-evaluator-schema-XKCLLCB3.js +118 -0
- package/dist/discover-scenario-schema-NOJY6S7E.js +137 -0
- package/dist/{discover-scenario-schema-W7KBXA4J.js → discover-scenario-schema-OOFIQKOG.js} +37 -17
- package/dist/discover-schema-7WHIIATI.js +442 -0
- package/dist/{discover-schema-L6QDPON3.js → discover-schema-J2ANOBKO.js} +181 -186
- package/dist/get-agent-5T3CXQOR.js +69 -0
- package/dist/{get-agent-7THF7HCU.js → get-agent-ZKYQJUQ7.js} +15 -11
- package/dist/get-analytics-4MPEK4KV.js +79 -0
- package/dist/get-analytics-ZLI3A4F5.js +80 -0
- package/dist/get-analytics-report-JCKYMA2S.js +29 -0
- package/dist/get-analytics-report-SKIP2JWH.js +30 -0
- package/dist/get-dataset-APGZBYMH.js +64 -0
- package/dist/get-dataset-LWXDVMVE.js +63 -0
- package/dist/get-evaluator-3A7BJBAB.js +47 -0
- package/dist/{get-evaluator-RZ44UIN6.js → get-evaluator-IWNJINRY.js} +4 -4
- package/dist/get-project-EQVB4LEL.js +26 -0
- package/dist/{get-project-QSQEAB33.js → get-project-RK6AJTEP.js} +4 -4
- package/dist/{get-prompt-GVKXF5NL.js → get-prompt-TLG2T2DS.js} +53 -58
- package/dist/get-prompt-ZER557X3.js +94 -0
- package/dist/get-run-plan-5X7DDJRN.js +58 -0
- package/dist/{get-run-plan-NY7J5GRE.js → get-run-plan-PEHRO5M3.js} +7 -9
- package/dist/{get-scenario-Q3LLQE4T.js → get-scenario-375W5D6I.js} +5 -5
- package/dist/get-scenario-UQX45ZZO.js +37 -0
- package/dist/{get-simulation-run-WINEYDMK.js → get-simulation-run-2NBXJADG.js} +26 -22
- package/dist/get-simulation-run-QZTLGL7W.js +69 -0
- package/dist/{get-test-suite-4HKA7OKS.js → get-test-suite-GVIBDG7K.js} +5 -5
- package/dist/get-test-suite-OODIR3RI.js +48 -0
- package/dist/{get-trace-RCUV7N4O.js → get-trace-AGCHVPJK.js} +11 -13
- package/dist/get-trace-KJLYAZRC.js +45 -0
- package/dist/get-workflow-3TV2YYC5.js +25 -0
- package/dist/{get-workflow-EEOC7Y45.js → get-workflow-7LZSVPP2.js} +4 -4
- package/dist/{http-security-EU3CHTY7.js → http-security-DNLBNQZL.js} +2 -2
- package/dist/{http-server-WCDUARTH.js → http-server-7CCN3EHJ.js} +4249 -325
- package/dist/index.js +59595 -38027
- package/dist/langwatch-api-analytics-reports-6CF6KUET.js +17 -0
- package/dist/langwatch-api-analytics-reports-RPFB5AO5.js +18 -0
- package/dist/{langwatch-api-annotations-6DHVZWUK.js → langwatch-api-annotations-H4AI4TKG.js} +4 -4
- package/dist/langwatch-api-annotations-QSJNUQQS.js +17 -0
- package/dist/langwatch-api-monitors-ENHLOL3S.js +47 -0
- package/dist/{langwatch-api-monitors-6ISFJ7WX.js → langwatch-api-monitors-OHSGADTH.js} +11 -16
- package/dist/langwatch-api-secrets-AGW6UUMD.js +55 -0
- package/dist/langwatch-api-secrets-CLTS766Q.js +56 -0
- package/dist/langwatch-api-triggers-G5UWFNN2.js +22 -0
- package/dist/langwatch-api-triggers-QMR7KEXW.js +23 -0
- package/dist/langwatch-api-workflows-HKTBIKKY.js +15 -0
- package/dist/{langwatch-api-workflows-6UJL5U4Z.js → langwatch-api-workflows-OMROZH2O.js} +4 -4
- package/dist/{list-agents-AMVDQPQL.js → list-agents-BYWDNAHT.js} +4 -4
- package/dist/list-agents-MG24MHZE.js +42 -0
- package/dist/list-analytics-reports-G3EPWGSQ.js +32 -0
- package/dist/list-analytics-reports-PPWIFRES.js +33 -0
- package/dist/list-annotations-QCLGEK5A.js +38 -0
- package/dist/{list-annotations-6PR5NLIC.js → list-annotations-Y4EUBJHG.js} +10 -5
- package/dist/list-api-keys-DAVOBPFK.js +42 -0
- package/dist/{list-api-keys-GVPNBIHQ.js → list-api-keys-JMW5WRXX.js} +10 -5
- package/dist/list-dashboards-2P3VJFRS.js +29 -0
- package/dist/list-dashboards-MW5O3MKH.js +30 -0
- package/dist/list-dataset-records-KEHT7G6Q.js +43 -0
- package/dist/{list-dataset-records-O67HZ35Y.js → list-dataset-records-KMLLMZAZ.js} +14 -10
- package/dist/{list-datasets-WXZL6UMP.js → list-datasets-P3JK2ZHS.js} +9 -13
- package/dist/list-datasets-Z7OOE4KI.js +56 -0
- package/dist/{list-evaluators-PAX72WCN.js → list-evaluators-7RRESBOU.js} +5 -7
- package/dist/list-evaluators-VATJVOHR.js +32 -0
- package/dist/{list-model-providers-VVLZMLCX.js → list-model-providers-OXDRPUCJ.js} +4 -4
- package/dist/list-model-providers-VXQJWDXU.js +35 -0
- package/dist/{list-projects-AQVI6SUK.js → list-projects-HUVK7L3W.js} +5 -7
- package/dist/list-projects-X72ZXVY5.js +40 -0
- package/dist/{list-prompt-tags-WZFBJOHG.js → list-prompt-tags-3I3LWFIR.js} +3 -3
- package/dist/list-prompt-tags-DRHUH2ND.js +23 -0
- package/dist/list-prompts-6DX3QECJ.js +30 -0
- package/dist/{list-prompts-BQOHRHYT.js → list-prompts-PS423RU3.js} +4 -6
- package/dist/list-run-plans-5SXPOV3X.js +45 -0
- package/dist/{list-run-plans-UBAU2DGH.js → list-run-plans-6VNHINPY.js} +5 -5
- package/dist/list-scenarios-EQWCW7Q4.js +45 -0
- package/dist/{list-scenarios-MS4IUIVM.js → list-scenarios-GKNH3YND.js} +13 -11
- package/dist/{list-simulation-runs-D6YF4ZOU.js → list-simulation-runs-KHY7KALI.js} +12 -8
- package/dist/list-simulation-runs-PUDK32C2.js +53 -0
- package/dist/list-test-suites-7H2DRILK.js +34 -0
- package/dist/{list-test-suites-L7R2O6DR.js → list-test-suites-GY56LGLY.js} +4 -4
- package/dist/list-trigger-fires-7RZUP54Y.js +19 -0
- package/dist/list-trigger-fires-OZUF65LI.js +20 -0
- package/dist/list-triggers-BGUCUXTJ.js +45 -0
- package/dist/list-triggers-XC5KMX4C.js +46 -0
- package/dist/list-workflows-55NYC3PC.js +33 -0
- package/dist/{list-workflows-6MV4XJHF.js → list-workflows-HV7FUWZA.js} +5 -7
- package/dist/{rename-prompt-tag-K5LQ4CY6.js → rename-prompt-tag-2I7Z5FCY.js} +3 -3
- package/dist/rename-prompt-tag-SZYTOWDX.js +18 -0
- package/dist/{rename-test-suite-NTYHAO5X.js → rename-test-suite-27AYY33K.js} +4 -4
- package/dist/rename-test-suite-CLIEPZDO.js +20 -0
- package/dist/report-issue-5HSL7CNB.js +924 -0
- package/dist/{report-issue-RHZZ33IS.js → report-issue-N7ND5TM6.js} +107 -67
- package/dist/{rerun-run-plan-MUDWJBE4.js → rerun-run-plan-O3VUZ6CG.js} +5 -5
- package/dist/rerun-run-plan-OJTVVGJI.js +21 -0
- package/dist/{revoke-api-key-6LAZ3QZZ.js → revoke-api-key-BU6BKGCG.js} +4 -4
- package/dist/revoke-api-key-NZNCFOIR.js +15 -0
- package/dist/run-agent-244O4Y5M.js +75 -0
- package/dist/run-agent-HPCGZGYW.js +74 -0
- package/dist/run-plan-2ZPGGZ4H.js +38 -0
- package/dist/{run-plan-T4ZYOZGA.js → run-plan-KSXUYQT3.js} +7 -7
- package/dist/run-query-4LMOQ5UW.js +47 -0
- package/dist/run-query-BQUHIUC2.js +46 -0
- package/dist/{run-test-suite-L4MZ7G4D.js → run-test-suite-P3WLVPXC.js} +6 -6
- package/dist/run-test-suite-UEOMCON6.js +25 -0
- package/dist/run-workflow-EFZ6HG5B.js +36 -0
- package/dist/{run-workflow-DFIS23AP.js → run-workflow-I4IHEN54.js} +4 -4
- package/dist/search-traces-6IR7PR4L.js +170 -0
- package/dist/search-traces-BYML2NQ4.js +171 -0
- package/dist/set-model-provider-RBNGWFVI.js +33 -0
- package/dist/{set-model-provider-XRNMFOVR.js → set-model-provider-SHEVKWRC.js} +4 -4
- package/dist/{update-agent-DUWNYBNA.js → update-agent-PTKTM2B5.js} +4 -4
- package/dist/update-agent-ZPXWRMS2.js +20 -0
- package/dist/update-dashboard-widget-HKCBXH7X.js +62 -0
- package/dist/update-dashboard-widget-IP2TTQ5G.js +63 -0
- package/dist/update-dataset-GHIN6JR3.js +22 -0
- package/dist/{update-dataset-YSOMDCOB.js → update-dataset-IRVMY5PF.js} +6 -6
- package/dist/update-dataset-record-6VI7K2CL.js +19 -0
- package/dist/{update-dataset-record-DEA2ITYR.js → update-dataset-record-Z3L7ACNF.js} +4 -4
- package/dist/update-evaluator-5NLNE6VY.js +24 -0
- package/dist/{update-evaluator-NH7Q5GWV.js → update-evaluator-FEH7H6NS.js} +4 -4
- package/dist/update-project-75H3LDQT.js +24 -0
- package/dist/{update-project-Q26FBSYH.js → update-project-QPR3QX55.js} +4 -4
- package/dist/update-prompt-BCDFTNLK.js +140 -0
- package/dist/{update-prompt-ZQQ2C3KU.js → update-prompt-NPRXYSWA.js} +27 -29
- package/dist/update-scenario-BNOMDCMV.js +34 -0
- package/dist/{update-scenario-WUX34JAR.js → update-scenario-EM5XGMB7.js} +5 -5
- package/package.json +35 -39
- package/pyproject.toml +23 -8
- package/src/config.d.ts +6 -0
- package/src/config.ts +22 -29
- package/src/create-mcp-server.ts +887 -634
- package/src/documentation-fetch.ts +21 -20
- package/src/http-security.ts +166 -135
- package/src/http-server.ts +189 -224
- package/src/index.ts +14 -16
- package/src/langwatch-api-agents.ts +18 -21
- package/src/langwatch-api-analytics-reports.ts +62 -0
- package/src/langwatch-api-annotations.ts +11 -12
- package/src/langwatch-api-api-keys.ts +8 -9
- package/src/langwatch-api-dashboard-widgets.ts +47 -0
- package/src/langwatch-api-dashboards.ts +109 -24
- package/src/langwatch-api-datasets.ts +98 -32
- package/src/langwatch-api-evaluators.ts +13 -19
- package/src/langwatch-api-model-providers.ts +4 -4
- package/src/langwatch-api-monitors.ts +14 -18
- package/src/langwatch-api-projects.ts +10 -9
- package/src/langwatch-api-query.ts +114 -0
- package/src/langwatch-api-run-plans.ts +12 -29
- package/src/langwatch-api-scenarios.ts +9 -11
- package/src/langwatch-api-secrets.ts +31 -24
- package/src/langwatch-api-simulation-runs.ts +6 -8
- package/src/langwatch-api-test-suites.ts +14 -33
- package/src/langwatch-api-triggers.ts +96 -34
- package/src/langwatch-api-workflows.ts +9 -9
- package/src/langwatch-api.ts +118 -124
- package/src/public-http-request.ts +21 -12
- package/src/schemas/analytics-metrics.ts +3 -15
- package/src/schemas/create-dataset.ts +3 -4
- package/src/schemas/run-plan.ts +13 -29
- package/src/schemas/suite-fields.ts +6 -23
- package/src/schemas/triggers.ts +365 -0
- package/src/schemas/widget-sources.ts +33 -0
- package/src/tools/add-dashboard-widget.ts +51 -0
- package/src/tools/archive-project.ts +2 -4
- package/src/tools/archive-run-plan.ts +2 -4
- package/src/tools/archive-scenario.ts +2 -4
- package/src/tools/archive-test-suite.ts +2 -4
- package/src/tools/assign-prompt-tag.ts +6 -2
- package/src/tools/create-agent.ts +1 -1
- package/src/tools/create-analytics-report.ts +7 -0
- package/src/tools/create-annotation.ts +7 -2
- package/src/tools/create-api-key.ts +4 -6
- package/src/tools/create-dataset-records.ts +4 -8
- package/src/tools/create-dataset.ts +5 -7
- package/src/tools/create-evaluator.ts +3 -5
- package/src/tools/create-project.ts +2 -2
- package/src/tools/create-prompt-tag.ts +2 -4
- package/src/tools/create-prompt.ts +9 -18
- package/src/tools/create-scenario.ts +5 -7
- package/src/tools/create-test-suite.ts +4 -9
- package/src/tools/create-trigger.ts +55 -0
- package/src/tools/dashboard-widget-queries.ts +45 -0
- package/src/tools/dashboards.ts +104 -0
- package/src/tools/delete-agent.ts +1 -1
- package/src/tools/delete-analytics-report.ts +7 -0
- package/src/tools/delete-annotation.ts +1 -1
- package/src/tools/delete-dataset-records.ts +4 -8
- package/src/tools/delete-dataset.ts +3 -7
- package/src/tools/delete-evaluator.ts +4 -6
- package/src/tools/delete-prompt-tag.ts +2 -4
- package/src/tools/delete-workflow.ts +1 -1
- package/src/tools/discover-evaluator-schema.ts +34 -25
- package/src/tools/discover-scenario-schema.ts +41 -21
- package/src/tools/discover-schema.ts +149 -27
- package/src/tools/experiment-run-status.ts +2 -8
- package/src/tools/format-dataset-mutation.ts +5 -10
- package/src/tools/format-run-plan.ts +7 -21
- package/src/tools/format-scenario.ts +2 -4
- package/src/tools/format-suite-details.ts +6 -12
- package/src/tools/get-agent.ts +15 -6
- package/src/tools/get-analytics-report.ts +23 -0
- package/src/tools/get-analytics.ts +52 -46
- package/src/tools/get-dataset.ts +34 -16
- package/src/tools/get-evaluator.ts +4 -11
- package/src/tools/get-experiment-results.ts +219 -186
- package/src/tools/get-project.ts +2 -4
- package/src/tools/get-prompt.ts +63 -84
- package/src/tools/get-run-plan.ts +4 -6
- package/src/tools/get-scenario.ts +4 -6
- package/src/tools/get-simulation-run.ts +27 -24
- package/src/tools/get-test-suite.ts +2 -5
- package/src/tools/get-trace.ts +16 -17
- package/src/tools/get-workflow.ts +1 -1
- package/src/tools/list-agents.ts +1 -1
- package/src/tools/list-analytics-reports.ts +27 -0
- package/src/tools/list-annotations.ts +8 -5
- package/src/tools/list-api-keys.ts +7 -2
- package/src/tools/list-dashboards.ts +20 -21
- package/src/tools/list-dataset-records.ts +8 -6
- package/src/tools/list-datasets.ts +12 -23
- package/src/tools/list-evaluators.ts +4 -8
- package/src/tools/list-experiment-runs.ts +5 -9
- package/src/tools/list-experiments.ts +5 -11
- package/src/tools/list-model-providers.ts +3 -5
- package/src/tools/list-projects.ts +2 -4
- package/src/tools/list-prompt-tags.ts +3 -3
- package/src/tools/list-prompts.ts +4 -8
- package/src/tools/list-run-plans.ts +2 -2
- package/src/tools/list-scenarios.ts +14 -15
- package/src/tools/list-simulation-runs.ts +8 -4
- package/src/tools/list-test-suites.ts +1 -1
- package/src/tools/list-trigger-fires.ts +17 -0
- package/src/tools/list-triggers.ts +39 -0
- package/src/tools/list-workflows.ts +2 -4
- package/src/tools/rename-prompt-tag.ts +1 -1
- package/src/tools/rename-test-suite.ts +2 -5
- package/src/tools/report-issue.ts +7 -9
- package/src/tools/rerun-run-plan.ts +2 -5
- package/src/tools/revoke-api-key.ts +2 -4
- package/src/tools/run-agent.ts +29 -26
- package/src/tools/run-experiment.ts +37 -34
- package/src/tools/run-plan.ts +4 -7
- package/src/tools/run-query.ts +47 -0
- package/src/tools/run-test-suite.ts +4 -7
- package/src/tools/run-workflow.ts +2 -5
- package/src/tools/search-traces.ts +161 -47
- package/src/tools/set-model-provider.ts +4 -6
- package/src/tools/test-agent.ts +2 -2
- package/src/tools/update-agent.ts +1 -1
- package/src/tools/update-dashboard-widget.ts +86 -0
- package/src/tools/update-dataset-record.ts +1 -1
- package/src/tools/update-dataset.ts +5 -7
- package/src/tools/update-evaluator.ts +3 -5
- package/src/tools/update-project.ts +1 -1
- package/src/tools/update-prompt.ts +44 -59
- package/src/tools/update-scenario.ts +5 -7
- package/src/tools/update-test-suite.ts +6 -11
- package/src/utils/date-parsing.ts +1 -1
- package/src/utils/escape-markdown.ts +3 -8
- package/src/utils/format-evaluations.ts +6 -6
- package/src/utils/markdown-table.ts +58 -0
- package/src/utils/trace-id-shape.ts +20 -0
- package/tsconfig.app.json +24 -0
- package/tsconfig.json +14 -12
- package/uv.lock +667 -341
- package/vitest.integration.config.js +10 -0
- package/vitest.scenario.config.js +9 -0
- package/.eslintrc.cjs +0 -36
- package/dist/chunk-AN4OUA4D.js +0 -86
- package/dist/chunk-GELJ2MQR.js +0 -226
- package/dist/chunk-K37ZNPXK.js +0 -24
- package/dist/chunk-S4GVX36W.js +0 -39
- package/dist/config.d.ts +0 -17
- package/dist/create-dashboard-Z76AIPLS.js +0 -19
- package/dist/create-mcp-server.d.ts +0 -10
- package/dist/delete-dashboard-LYMRPF27.js +0 -19
- package/dist/delete-evaluator-RKYC4TNB.js +0 -16
- package/dist/discover-evaluator-schema-ESSHQGPY.js +0 -1912
- package/dist/get-analytics-R6AZD3AW.js +0 -73
- package/dist/get-dashboard-P4WWVHFU.js +0 -30
- package/dist/get-dataset-AKTYSQDI.js +0 -49
- package/dist/index.d.ts +0 -2
- package/dist/langwatch-api-dashboards-2KJL2M42.js +0 -18
- package/dist/langwatch-api-secrets-OEBD6GBU.js +0 -41
- package/dist/langwatch-api-triggers-5E6DDGX6.js +0 -31
- package/dist/list-dashboards-Z3BZKDGF.js +0 -33
- package/dist/run-agent-CAGWGTYT.js +0 -72
- package/dist/search-traces-4XTJYXIK.js +0 -79
- package/src/__tests__/agent-tools.unit.test.ts +0 -257
- package/src/__tests__/all-tools.integration.test.ts +0 -1872
- package/src/__tests__/config.unit.test.ts +0 -202
- package/src/__tests__/datasets.integration.test.ts +0 -620
- package/src/__tests__/datasets.unit.test.ts +0 -244
- package/src/__tests__/date-parsing.unit.test.ts +0 -78
- package/src/__tests__/discover-evaluator-schema.unit.test.ts +0 -89
- package/src/__tests__/discover-schema.unit.test.ts +0 -118
- package/src/__tests__/docker.integration.test.ts +0 -318
- package/src/__tests__/documentation-fetch-security.integration.test.ts +0 -182
- package/src/__tests__/evaluator-tools.unit.test.ts +0 -262
- package/src/__tests__/experiment-list-tools.unit.test.ts +0 -157
- package/src/__tests__/experiment-status.unit.test.ts +0 -194
- package/src/__tests__/feature-map-tool-drift.unit.test.ts +0 -93
- package/src/__tests__/get-experiment-results.unit.test.ts +0 -313
- package/src/__tests__/http-security-origin.unit.test.ts +0 -97
- package/src/__tests__/http-security-sessions.unit.test.ts +0 -209
- package/src/__tests__/http-security-verifier.unit.test.ts +0 -248
- package/src/__tests__/http-server-allocation.integration.test.ts +0 -279
- package/src/__tests__/http-server-origin.integration.test.ts +0 -169
- package/src/__tests__/http-server-session-auth.integration.test.ts +0 -341
- package/src/__tests__/http-transport.integration.test.ts +0 -395
- package/src/__tests__/integration.integration.test.ts +0 -284
- package/src/__tests__/langwatch-api.unit.test.ts +0 -661
- package/src/__tests__/model-provider-tools.unit.test.ts +0 -190
- package/src/__tests__/project-api-key-tools.unit.test.ts +0 -451
- package/src/__tests__/prompt-response-types.unit.test.ts +0 -51
- package/src/__tests__/prompts.integration.test.ts +0 -736
- package/src/__tests__/public-http-request-security.integration.test.ts +0 -118
- package/src/__tests__/report-issue.integration.test.ts +0 -147
- package/src/__tests__/run-plan-tools.unit.test.ts +0 -565
- package/src/__tests__/scenario-tools.integration.test.ts +0 -286
- package/src/__tests__/scenario-tools.unit.test.ts +0 -207
- package/src/__tests__/schemas.unit.test.ts +0 -85
- package/src/__tests__/simulation-run-tools.unit.test.ts +0 -116
- package/src/__tests__/support/http-server-harness.ts +0 -138
- package/src/__tests__/test-suite-tools.unit.test.ts +0 -615
- package/src/__tests__/tools.integration.test.ts +0 -896
- package/src/schemas/filter-fields.ts +0 -119
- package/src/schemas/index.ts +0 -9
- package/src/tools/create-dashboard.ts +0 -7
- package/src/tools/delete-dashboard.ts +0 -7
- package/src/tools/get-dashboard.ts +0 -22
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
// src/schemas/triggers.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var triggerActionSchema = z.enum([
|
|
4
|
+
"SEND_EMAIL",
|
|
5
|
+
"SEND_SLACK_MESSAGE",
|
|
6
|
+
"SEND_WEBHOOK",
|
|
7
|
+
"ADD_TO_DATASET",
|
|
8
|
+
"ADD_TO_ANNOTATION_QUEUE"
|
|
9
|
+
]);
|
|
10
|
+
var alertTypeSchema = z.enum(["CRITICAL", "WARNING", "INFO"]);
|
|
11
|
+
var emailActionParamsSchema = z.object({
|
|
12
|
+
members: z.array(z.string()).min(1).describe("Who receives the email. Any address, not only teammates.")
|
|
13
|
+
}).passthrough();
|
|
14
|
+
var slackActionParamsSchema = z.object({
|
|
15
|
+
slackIntegrationId: z.string().optional().describe(
|
|
16
|
+
"The Slack connection to post through (an organization connection or one of this project's; they are listed in LangWatch under Settings, Integrations, Slack). A bot connection also needs `slackChannelId`; a webhook connection needs nothing else. Preferred over `slackWebhook` and `slackBotToken`."
|
|
17
|
+
),
|
|
18
|
+
slackDelivery: z.enum(["webhook", "bot"]).optional().describe(
|
|
19
|
+
"How the message reaches Slack. `webhook` posts to an incoming webhook URL, `bot` posts as the LangWatch Slack app. With `slackIntegrationId` it follows the connection's kind. Absent without a connection means `webhook`."
|
|
20
|
+
),
|
|
21
|
+
slackWebhook: z.string().optional().describe(
|
|
22
|
+
"Legacy, accepted for one release: an incoming webhook URL (https://hooks.slack.com/...). It is stored as a Slack connection and the automation keeps only the connection id. Send `slackIntegrationId` instead."
|
|
23
|
+
),
|
|
24
|
+
slackChannelId: z.string().optional().describe("The channel the bot posts in, for a bot connection or `bot` delivery."),
|
|
25
|
+
slackBotToken: z.string().optional().describe(
|
|
26
|
+
"Legacy, accepted for one release: a bot token, stored as a Slack connection. It never reads back. Send `slackIntegrationId` instead."
|
|
27
|
+
),
|
|
28
|
+
slackBotTokenSet: z.boolean().optional().describe(
|
|
29
|
+
"Legacy. Read: whether an automation not yet moved to a connection stores its own bot token. Write: true keeps it."
|
|
30
|
+
)
|
|
31
|
+
}).passthrough();
|
|
32
|
+
var webhookActionParamsSchema = z.object({
|
|
33
|
+
url: z.string().describe("Where the request goes. https only, and not a private host."),
|
|
34
|
+
method: z.enum(["POST", "PUT", "PATCH"]).optional(),
|
|
35
|
+
headers: z.record(z.string(), z.string()).optional().describe(
|
|
36
|
+
"Static headers sent with every delivery. The values are credentials: they read back as [redacted], and sending [redacted] back keeps the stored ones. Changing `url` means sending the values again in the same call."
|
|
37
|
+
),
|
|
38
|
+
bodyTemplate: z.string().nullable().optional().describe(
|
|
39
|
+
"A Liquid template for the JSON body. Absent sends the standard LangWatch envelope."
|
|
40
|
+
),
|
|
41
|
+
signingSecret: z.string().nullable().optional().describe("Signs every delivery so the receiver can verify it.")
|
|
42
|
+
}).passthrough();
|
|
43
|
+
var datasetActionParamsSchema = z.object({
|
|
44
|
+
datasetId: z.string().describe("The dataset matched traces are appended to."),
|
|
45
|
+
datasetMapping: z.object({
|
|
46
|
+
mapping: z.record(z.string(), z.unknown()),
|
|
47
|
+
expansions: z.array(z.string()).optional()
|
|
48
|
+
}).describe("How a trace becomes a row in that dataset.")
|
|
49
|
+
}).passthrough();
|
|
50
|
+
var annotationQueueActionParamsSchema = z.object({
|
|
51
|
+
annotators: z.array(z.object({ id: z.string(), name: z.string() })).min(1).describe("Who the queued items go to.")
|
|
52
|
+
}).passthrough();
|
|
53
|
+
var actionParamsSchema = z.union([
|
|
54
|
+
emailActionParamsSchema,
|
|
55
|
+
slackActionParamsSchema,
|
|
56
|
+
webhookActionParamsSchema,
|
|
57
|
+
datasetActionParamsSchema,
|
|
58
|
+
annotationQueueActionParamsSchema
|
|
59
|
+
]);
|
|
60
|
+
var slackActionParamsWriteSchema = slackActionParamsSchema.superRefine((params, ctx) => {
|
|
61
|
+
const delivery = params.slackDelivery ?? "webhook";
|
|
62
|
+
if (delivery === "bot" && !params.slackChannelId) {
|
|
63
|
+
ctx.addIssue({
|
|
64
|
+
code: "custom",
|
|
65
|
+
path: ["slackChannelId"],
|
|
66
|
+
message: params.slackIntegrationId ? "a bot connection needs the channel to post in" : "bot delivery needs the channel to post in"
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
if (params.slackIntegrationId) return;
|
|
70
|
+
if (delivery === "webhook" && !params.slackWebhook) {
|
|
71
|
+
ctx.addIssue({
|
|
72
|
+
code: "custom",
|
|
73
|
+
path: ["slackIntegrationId"],
|
|
74
|
+
message: "name the Slack connection to post through"
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
if (delivery === "bot" && !params.slackBotToken && params.slackBotTokenSet !== true) {
|
|
78
|
+
ctx.addIssue({
|
|
79
|
+
code: "custom",
|
|
80
|
+
path: ["slackIntegrationId"],
|
|
81
|
+
message: "bot delivery needs the Slack connection to post through"
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
var ACTION_PARAMS_SCHEMA_BY_ACTION = {
|
|
86
|
+
SEND_EMAIL: emailActionParamsSchema,
|
|
87
|
+
SEND_SLACK_MESSAGE: slackActionParamsWriteSchema,
|
|
88
|
+
SEND_WEBHOOK: webhookActionParamsSchema,
|
|
89
|
+
ADD_TO_DATASET: datasetActionParamsSchema,
|
|
90
|
+
ADD_TO_ANNOTATION_QUEUE: annotationQueueActionParamsSchema
|
|
91
|
+
};
|
|
92
|
+
function validateActionParamsForAction({
|
|
93
|
+
action,
|
|
94
|
+
actionParams
|
|
95
|
+
}) {
|
|
96
|
+
const schema = ACTION_PARAMS_SCHEMA_BY_ACTION[action] ?? actionParamsSchema;
|
|
97
|
+
const parsed = schema.safeParse(actionParams);
|
|
98
|
+
if (parsed.success) return { ok: true };
|
|
99
|
+
const issues = parsed.error.issues.map((issue) => `${issue.path.join(".") || "(actionParams)"}: ${issue.message}`).join("; ");
|
|
100
|
+
return {
|
|
101
|
+
ok: false,
|
|
102
|
+
message: `actionParams does not fit ${action} \u2014 ${issues}`
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
var TRIGGER_FILTERS_DESCRIPTION = [
|
|
106
|
+
"Trace conditions as a JSON object string.",
|
|
107
|
+
'Unkeyed fields take a list of values: {"traces.error":["true"]}.',
|
|
108
|
+
'Keyed fields nest a key above the list. evaluations.* is keyed by the MONITOR id (the `id` from `platform_list_monitors` / GET /api/v1/monitors, not its evaluatorId): {"evaluations.passed":{"<monitorId>":["false"]}}.',
|
|
109
|
+
'metadata.value is keyed by the metadata key: {"metadata.value":{"<key>":["true"]}}.',
|
|
110
|
+
"A keyed field sent as a bare list, or keyed by anything but a monitor id, is refused."
|
|
111
|
+
].join(" ");
|
|
112
|
+
var TRIGGER_FILTER_QUERY_DESCRIPTION = [
|
|
113
|
+
"Trace query in the syntax the traces view uses; the alternative to `filters`, and it supersedes them.",
|
|
114
|
+
'Examples: status:error \xB7 evaluator:"<evaluator name>" AND evaluatorVerdict:fail \xB7 trace.attribute.<key>:<value>.'
|
|
115
|
+
].join(" ");
|
|
116
|
+
var SLACK_DELIVERY_NOTE = 'For SEND_SLACK_MESSAGE, send {"slackIntegrationId":"<connection id>"} for a webhook connection, or {"slackIntegrationId":"<connection id>","slackChannelId":"C..."} for a bot connection. Slack connections are listed and added in LangWatch under Settings, Integrations, Slack (organization-wide or for one project); they are also listed by GET /api/v1/slack-connections and `langwatch slack-connection list`, or ask the user for the id. slackIntegrationId is preferred: a legacy {"slackWebhook":"https://hooks.slack.com/..."} or {"slackDelivery":"bot","slackBotToken":"xoxb-...","slackChannelId":"C..."} is still accepted for one release and is stored as a connection. A Slack automation with no connection will never post.';
|
|
117
|
+
var graphAlertSchema = z.object({
|
|
118
|
+
seriesName: z.string().describe("The series on the graph to watch."),
|
|
119
|
+
operator: z.enum(["gt", "lt", "gte", "lte", "eq"]),
|
|
120
|
+
threshold: z.number(),
|
|
121
|
+
timePeriod: z.union([
|
|
122
|
+
z.literal(1),
|
|
123
|
+
z.literal(5),
|
|
124
|
+
z.literal(15),
|
|
125
|
+
z.literal(30),
|
|
126
|
+
z.literal(60),
|
|
127
|
+
z.literal(1440)
|
|
128
|
+
]).describe("The window, in minutes, the series is read over.")
|
|
129
|
+
}).describe("The rule an alert fires by. Send it with `customGraphId` and `alertType`.");
|
|
130
|
+
var reportSchema = z.object({
|
|
131
|
+
source: z.discriminatedUnion("kind", [
|
|
132
|
+
z.object({
|
|
133
|
+
kind: z.literal("dashboard"),
|
|
134
|
+
dashboardId: z.string()
|
|
135
|
+
}),
|
|
136
|
+
z.object({
|
|
137
|
+
kind: z.literal("customGraph"),
|
|
138
|
+
customGraphId: z.string()
|
|
139
|
+
}),
|
|
140
|
+
z.object({
|
|
141
|
+
kind: z.literal("traceQuery"),
|
|
142
|
+
filters: z.record(z.string(), z.unknown()).optional(),
|
|
143
|
+
metric: z.string().optional(),
|
|
144
|
+
topN: z.number().int().min(1).max(100).optional()
|
|
145
|
+
})
|
|
146
|
+
]).describe("What the report renders: a dashboard, one graph, or a table of traces."),
|
|
147
|
+
schedule: z.object({
|
|
148
|
+
cron: z.string().describe(
|
|
149
|
+
'A 5-field cron expression (minute hour day-of-month month day-of-week), for example "0 9 * * 1". It can send at most every 15 minutes.'
|
|
150
|
+
),
|
|
151
|
+
timezone: z.string().describe('An IANA timezone, for example "Europe/Amsterdam" or "UTC".')
|
|
152
|
+
}).describe("When it sends."),
|
|
153
|
+
compareToPrevious: z.boolean().optional().describe("Include a this-period-versus-last comparison.")
|
|
154
|
+
}).describe(
|
|
155
|
+
"What a scheduled report renders and when. Send it with a channel that can carry a message: email or Slack."
|
|
156
|
+
);
|
|
157
|
+
var templatesSchema = z.object({
|
|
158
|
+
slackTemplateType: z.enum(["string", "block_kit"]).nullable().optional(),
|
|
159
|
+
slackTemplate: z.string().nullable().optional(),
|
|
160
|
+
emailSubjectTemplate: z.string().nullable().optional(),
|
|
161
|
+
emailBodyTemplate: z.string().nullable().optional()
|
|
162
|
+
}).describe(
|
|
163
|
+
"The Liquid templates the message is rendered from. Absent fields render the LangWatch default."
|
|
164
|
+
);
|
|
165
|
+
var notificationCadenceSchema = z.enum(["immediate", "5min_digest", "15min_digest", "hourly_digest"]).describe(
|
|
166
|
+
"How often a notification automation may send. A new one starts on a five-minute digest."
|
|
167
|
+
);
|
|
168
|
+
var triggerSchema = z.object({
|
|
169
|
+
id: z.string(),
|
|
170
|
+
name: z.string(),
|
|
171
|
+
action: z.string(),
|
|
172
|
+
/** Where it delivers. The rule it fires by is stated separately, below,
|
|
173
|
+
* the same way a write states it. */
|
|
174
|
+
actionParams: z.record(z.string(), z.unknown()).default({}),
|
|
175
|
+
graphAlert: graphAlertSchema.nullable().optional(),
|
|
176
|
+
// A read stays tolerant of a deployment that words this differently; a
|
|
177
|
+
// write is held to `reportSchema`.
|
|
178
|
+
report: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
179
|
+
filters: z.record(z.string(), z.unknown()).default({}),
|
|
180
|
+
filterQuery: z.string().nullable().optional(),
|
|
181
|
+
kind: z.string().optional(),
|
|
182
|
+
customGraphId: z.string().nullable().optional(),
|
|
183
|
+
notificationCadence: z.string().nullable().optional(),
|
|
184
|
+
traceDebounceMs: z.number().nullable().optional(),
|
|
185
|
+
templates: z.record(z.string(), z.unknown()).optional(),
|
|
186
|
+
active: z.boolean(),
|
|
187
|
+
message: z.string().nullable(),
|
|
188
|
+
alertType: z.string().nullable(),
|
|
189
|
+
createdAt: z.string(),
|
|
190
|
+
updatedAt: z.string(),
|
|
191
|
+
platformUrl: z.string().optional()
|
|
192
|
+
}).passthrough();
|
|
193
|
+
var triggerFireSchema = z.object({
|
|
194
|
+
id: z.string(),
|
|
195
|
+
triggerId: z.string(),
|
|
196
|
+
customGraphId: z.string().nullable(),
|
|
197
|
+
firedAt: z.string(),
|
|
198
|
+
resolvedAt: z.string().nullable()
|
|
199
|
+
}).passthrough();
|
|
200
|
+
var triggerFirePageSchema = z.union([
|
|
201
|
+
z.array(triggerFireSchema).transform((fires) => ({ fires, nextCursor: null })),
|
|
202
|
+
z.object({
|
|
203
|
+
fires: z.array(triggerFireSchema).optional(),
|
|
204
|
+
data: z.array(triggerFireSchema).optional(),
|
|
205
|
+
nextCursor: z.string().nullable().optional()
|
|
206
|
+
}).transform(({ fires, data, nextCursor }) => ({
|
|
207
|
+
fires: fires ?? data ?? [],
|
|
208
|
+
nextCursor: nextCursor ?? null
|
|
209
|
+
}))
|
|
210
|
+
]);
|
|
211
|
+
var testFireResultSchema = z.object({
|
|
212
|
+
channel: z.string(),
|
|
213
|
+
recipientCount: z.number(),
|
|
214
|
+
usedDefault: z.boolean(),
|
|
215
|
+
missingVariables: z.array(z.string()).default([]),
|
|
216
|
+
errors: z.array(z.string()).default([]),
|
|
217
|
+
httpStatus: z.number().optional()
|
|
218
|
+
}).passthrough();
|
|
219
|
+
var deletedTriggerSchema = z.object({
|
|
220
|
+
id: z.string(),
|
|
221
|
+
deleted: z.boolean()
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
export {
|
|
225
|
+
triggerActionSchema,
|
|
226
|
+
alertTypeSchema,
|
|
227
|
+
actionParamsSchema,
|
|
228
|
+
validateActionParamsForAction,
|
|
229
|
+
TRIGGER_FILTERS_DESCRIPTION,
|
|
230
|
+
TRIGGER_FILTER_QUERY_DESCRIPTION,
|
|
231
|
+
SLACK_DELIVERY_NOTE,
|
|
232
|
+
graphAlertSchema,
|
|
233
|
+
reportSchema,
|
|
234
|
+
templatesSchema,
|
|
235
|
+
notificationCadenceSchema,
|
|
236
|
+
triggerSchema,
|
|
237
|
+
triggerFirePageSchema,
|
|
238
|
+
testFireResultSchema,
|
|
239
|
+
deletedTriggerSchema
|
|
240
|
+
};
|
|
241
|
+
//# sourceMappingURL=chunk-3YLN3ATJ.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
makeRequest
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7CZQDZ2K.js";
|
|
4
4
|
|
|
5
5
|
// src/langwatch-api-agents.ts
|
|
6
6
|
import { z } from "zod";
|
|
@@ -11,7 +11,7 @@ import { request as httpRequest } from "http";
|
|
|
11
11
|
import { request as httpsRequest } from "https";
|
|
12
12
|
import { isIP } from "net";
|
|
13
13
|
|
|
14
|
-
// ../../packages/
|
|
14
|
+
// ../../packages/egress/src/ssrf/address.ts
|
|
15
15
|
function ipv4ToBytes(input) {
|
|
16
16
|
const parts = input.split(".");
|
|
17
17
|
if (parts.length !== 4) return null;
|
|
@@ -24,6 +24,25 @@ function ipv4ToBytes(input) {
|
|
|
24
24
|
}
|
|
25
25
|
return bytes;
|
|
26
26
|
}
|
|
27
|
+
function parseIpv6Groups(part) {
|
|
28
|
+
if (part === "") return [];
|
|
29
|
+
const out = [];
|
|
30
|
+
for (const group of part.split(":")) {
|
|
31
|
+
if (!/^[0-9a-fA-F]{1,4}$/.test(group)) return null;
|
|
32
|
+
out.push(parseInt(group, 16));
|
|
33
|
+
}
|
|
34
|
+
return out;
|
|
35
|
+
}
|
|
36
|
+
function expandIpv6Groups(halves) {
|
|
37
|
+
const head = parseIpv6Groups(halves[0]);
|
|
38
|
+
if (head === null) return null;
|
|
39
|
+
if (halves.length !== 2) return head;
|
|
40
|
+
const tail = parseIpv6Groups(halves[1]);
|
|
41
|
+
if (tail === null) return null;
|
|
42
|
+
const missing = 8 - head.length - tail.length;
|
|
43
|
+
if (missing < 0) return null;
|
|
44
|
+
return [...head, ...Array.from({ length: missing }, () => 0), ...tail];
|
|
45
|
+
}
|
|
27
46
|
function ipv6ToBytes(input) {
|
|
28
47
|
let s = input;
|
|
29
48
|
const zone = s.indexOf("%");
|
|
@@ -39,27 +58,8 @@ function ipv6ToBytes(input) {
|
|
|
39
58
|
}
|
|
40
59
|
const halves = s.split("::");
|
|
41
60
|
if (halves.length > 2) return null;
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
const out = [];
|
|
45
|
-
for (const g of part.split(":")) {
|
|
46
|
-
if (!/^[0-9a-fA-F]{1,4}$/.test(g)) return null;
|
|
47
|
-
out.push(parseInt(g, 16));
|
|
48
|
-
}
|
|
49
|
-
return out;
|
|
50
|
-
};
|
|
51
|
-
const head = parseGroups(halves[0]);
|
|
52
|
-
if (head === null) return null;
|
|
53
|
-
let groups;
|
|
54
|
-
if (halves.length === 2) {
|
|
55
|
-
const tail = parseGroups(halves[1]);
|
|
56
|
-
if (tail === null) return null;
|
|
57
|
-
const missing = 8 - head.length - tail.length;
|
|
58
|
-
if (missing < 0) return null;
|
|
59
|
-
groups = [...head, ...new Array(missing).fill(0), ...tail];
|
|
60
|
-
} else {
|
|
61
|
-
groups = head;
|
|
62
|
-
}
|
|
61
|
+
const groups = expandIpv6Groups(halves);
|
|
62
|
+
if (groups === null) return null;
|
|
63
63
|
if (groups.length !== 8) return null;
|
|
64
64
|
const bytes = new Uint8Array(16);
|
|
65
65
|
for (let i = 0; i < 8; i++) {
|
|
@@ -71,24 +71,31 @@ function ipv6ToBytes(input) {
|
|
|
71
71
|
function ipToBytes(ip) {
|
|
72
72
|
return ip.includes(":") ? ipv6ToBytes(ip) : ipv4ToBytes(ip);
|
|
73
73
|
}
|
|
74
|
+
function zeroBetween({
|
|
75
|
+
bytes,
|
|
76
|
+
from,
|
|
77
|
+
to
|
|
78
|
+
}) {
|
|
79
|
+
for (let i = from; i < to; i++) {
|
|
80
|
+
if (bytes[i] !== 0) return false;
|
|
81
|
+
}
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
74
84
|
function unmap(bytes) {
|
|
75
85
|
if (bytes.length !== 16) return bytes;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return bytes;
|
|
86
|
+
if (!zeroBetween({ bytes, from: 0, to: 8 })) return bytes;
|
|
87
|
+
const mapped = zeroBetween({ bytes, from: 8, to: 10 }) && bytes[10] === 255 && bytes[11] === 255;
|
|
88
|
+
const compatible = zeroBetween({ bytes, from: 8, to: 12 });
|
|
89
|
+
const translated = bytes[8] === 255 && bytes[9] === 255 && zeroBetween({ bytes, from: 10, to: 12 });
|
|
90
|
+
return mapped || compatible || translated ? bytes.slice(12, 16) : bytes;
|
|
81
91
|
}
|
|
82
92
|
function parsePrefix({ cidr, rfc }) {
|
|
83
93
|
const slash = cidr.lastIndexOf("/");
|
|
84
94
|
const bytes = ipToBytes(cidr.slice(0, slash));
|
|
85
|
-
if (!bytes) throw new Error(
|
|
95
|
+
if (!bytes) throw new Error(`ssrf: bad prefix ${cidr}`);
|
|
86
96
|
return { bytes, bits: Number(cidr.slice(slash + 1)), rfc };
|
|
87
97
|
}
|
|
88
|
-
function prefixContains({
|
|
89
|
-
prefix,
|
|
90
|
-
addr
|
|
91
|
-
}) {
|
|
98
|
+
function prefixContains({ prefix, addr }) {
|
|
92
99
|
if (prefix.bytes.length !== addr.length) return false;
|
|
93
100
|
let bits = prefix.bits;
|
|
94
101
|
let i = 0;
|
|
@@ -110,6 +117,10 @@ var METADATA_ADDRESSES = [
|
|
|
110
117
|
// AWS ECS/Fargate task metadata
|
|
111
118
|
"168.63.129.16",
|
|
112
119
|
// Azure WireServer / host DNS
|
|
120
|
+
"100.100.100.200",
|
|
121
|
+
// Alibaba Cloud ECS metadata
|
|
122
|
+
"192.0.0.192",
|
|
123
|
+
// Oracle Cloud metadata
|
|
113
124
|
"fd00:ec2::254"
|
|
114
125
|
// AWS EC2 IMDS over IPv6
|
|
115
126
|
].map((ip) => {
|
|
@@ -175,12 +186,14 @@ function bytesEqual({ a, b }) {
|
|
|
175
186
|
}
|
|
176
187
|
return true;
|
|
177
188
|
}
|
|
189
|
+
function isMetadataAddress(addr) {
|
|
190
|
+
return METADATA_ADDRESSES.some((m) => bytesEqual({ a: m, b: addr }));
|
|
191
|
+
}
|
|
178
192
|
function classify(ip) {
|
|
179
193
|
const raw = ipToBytes(ip);
|
|
180
194
|
if (!raw) return "special";
|
|
181
195
|
const addr = unmap(raw);
|
|
182
|
-
if (
|
|
183
|
-
return "metadata";
|
|
196
|
+
if (isMetadataAddress(addr)) return "metadata";
|
|
184
197
|
for (const prefix of SPECIAL_PREFIXES) {
|
|
185
198
|
if (prefixContains({ prefix, addr })) return "special";
|
|
186
199
|
}
|
|
@@ -203,7 +216,9 @@ var SENSITIVE_REDIRECT_HEADERS = /* @__PURE__ */ new Set([
|
|
|
203
216
|
"x-access-token"
|
|
204
217
|
]);
|
|
205
218
|
function unsafeDestinationError() {
|
|
206
|
-
return new Error(
|
|
219
|
+
return new Error(
|
|
220
|
+
"HTTP agent destinations must resolve only to globally routable public addresses"
|
|
221
|
+
);
|
|
207
222
|
}
|
|
208
223
|
function hostnameWithoutBrackets(hostname) {
|
|
209
224
|
return hostname.startsWith("[") && hostname.endsWith("]") ? hostname.slice(1, -1) : hostname;
|
|
@@ -380,10 +395,7 @@ async function listAgents(params) {
|
|
|
380
395
|
return makeRequest("GET", `/api/v1/agents${qs}`);
|
|
381
396
|
}
|
|
382
397
|
async function getAgent(id) {
|
|
383
|
-
return makeRequest(
|
|
384
|
-
"GET",
|
|
385
|
-
`/api/v1/agents/${encodeURIComponent(id)}`
|
|
386
|
-
);
|
|
398
|
+
return makeRequest("GET", `/api/v1/agents/${encodeURIComponent(id)}`);
|
|
387
399
|
}
|
|
388
400
|
async function createAgent(data) {
|
|
389
401
|
return makeRequest("POST", "/api/v1/agents", data);
|
|
@@ -443,7 +455,7 @@ function buildRelayBody({
|
|
|
443
455
|
}
|
|
444
456
|
inputParams = parsed.data;
|
|
445
457
|
}
|
|
446
|
-
if (inputParams || parameters) body.params = { ...inputParams
|
|
458
|
+
if (inputParams || parameters) body.params = { ...inputParams, ...parameters };
|
|
447
459
|
return body;
|
|
448
460
|
}
|
|
449
461
|
async function runAgent({
|
|
@@ -484,15 +496,12 @@ async function runAgent({
|
|
|
484
496
|
`Agent "${agent.name}" (type: ${agent.type}) cannot be executed directly. Only connected agents, HTTP agents and workflow-linked agents can be run.`
|
|
485
497
|
);
|
|
486
498
|
}
|
|
487
|
-
const { runWorkflow } = await import("./langwatch-api-workflows-
|
|
499
|
+
const { runWorkflow } = await import("./langwatch-api-workflows-OMROZH2O.js");
|
|
488
500
|
const result = await runWorkflow(workflowId, input);
|
|
489
501
|
return { agentType: agent.type, result };
|
|
490
502
|
}
|
|
491
503
|
async function deleteAgent(id) {
|
|
492
|
-
return makeRequest(
|
|
493
|
-
"DELETE",
|
|
494
|
-
`/api/v1/agents/${encodeURIComponent(id)}`
|
|
495
|
-
);
|
|
504
|
+
return makeRequest("DELETE", `/api/v1/agents/${encodeURIComponent(id)}`);
|
|
496
505
|
}
|
|
497
506
|
|
|
498
507
|
export {
|
|
@@ -504,4 +513,4 @@ export {
|
|
|
504
513
|
runAgent,
|
|
505
514
|
deleteAgent
|
|
506
515
|
};
|
|
507
|
-
//# sourceMappingURL=chunk-
|
|
516
|
+
//# sourceMappingURL=chunk-4RX3G62A.js.map
|
|
@@ -4,10 +4,7 @@ function describeMapping(mapping) {
|
|
|
4
4
|
}
|
|
5
5
|
function formatSuiteFields(fields) {
|
|
6
6
|
if (!fields || fields.length === 0) return [];
|
|
7
|
-
return [
|
|
8
|
-
"\n## Fields",
|
|
9
|
-
...fields.map((field) => `- ${field.identifier} (${field.type})`)
|
|
10
|
-
];
|
|
7
|
+
return ["\n## Fields", ...fields.map((field) => `- ${field.identifier} (${field.type})`)];
|
|
11
8
|
}
|
|
12
9
|
function formatEvaluatorAttachments(evaluators) {
|
|
13
10
|
if (!evaluators || evaluators.length === 0) return [];
|
|
@@ -55,4 +52,4 @@ export {
|
|
|
55
52
|
pendingEvaluationNote,
|
|
56
53
|
formatEvaluations
|
|
57
54
|
};
|
|
58
|
-
//# sourceMappingURL=chunk-
|
|
55
|
+
//# sourceMappingURL=chunk-6YZUOD34.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
escapeMarkdown
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FOKVY3BK.js";
|
|
4
4
|
|
|
5
5
|
// src/tools/format-dataset-mutation.ts
|
|
6
6
|
function formatDatasetMutationDetails(result) {
|
|
@@ -18,4 +18,4 @@ function formatDatasetMutationDetails(result) {
|
|
|
18
18
|
export {
|
|
19
19
|
formatDatasetMutationDetails
|
|
20
20
|
};
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-7AQLPVFL.js.map
|