@keystrokehq/keystroke 1.0.19 → 1.0.21
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/action.cjs +1 -1
- package/dist/action.mjs +1 -1
- package/dist/agent.cjs +4 -4
- package/dist/agent.mjs +3 -3
- package/dist/app.cjs +1 -1
- package/dist/app.mjs +1 -1
- package/dist/{awk2-LA3USKJP-Bsg1yxMI.cjs → awk2-LA3USKJP-XeySM1ul.cjs} +3 -3
- package/dist/{awk2-LA3USKJP-Bsg1yxMI.cjs.map → awk2-LA3USKJP-XeySM1ul.cjs.map} +1 -1
- package/dist/{base64-C2AIWVNC-CAa6k7ry.cjs → base64-C2AIWVNC-DrPwCXm9.cjs} +2 -2
- package/dist/{base64-C2AIWVNC-CAa6k7ry.cjs.map → base64-C2AIWVNC-DrPwCXm9.cjs.map} +1 -1
- package/dist/{bash-YZ33HQZQ-D0giTv18.cjs → bash-YZ33HQZQ-BQQtKpnm.cjs} +3 -3
- package/dist/{bash-YZ33HQZQ-D0giTv18.cjs.map → bash-YZ33HQZQ-BQQtKpnm.cjs.map} +1 -1
- package/dist/{cat-TSFMZVYS-Agr76aCC.cjs → cat-TSFMZVYS-ClWyn05t.cjs} +4 -4
- package/dist/{cat-TSFMZVYS-Agr76aCC.cjs.map → cat-TSFMZVYS-ClWyn05t.cjs.map} +1 -1
- package/dist/{chunk-2JIPICV3-68V6ZUjO.cjs → chunk-2JIPICV3-BrRGqqh-.cjs} +2 -2
- package/dist/{chunk-2JIPICV3-68V6ZUjO.cjs.map → chunk-2JIPICV3-BrRGqqh-.cjs.map} +1 -1
- package/dist/{chunk-2VDTE5BV-BQqrRidX.cjs → chunk-2VDTE5BV-DIR6gQHC.cjs} +2 -2
- package/dist/{chunk-2VDTE5BV-BQqrRidX.cjs.map → chunk-2VDTE5BV-DIR6gQHC.cjs.map} +1 -1
- package/dist/{chunk-46RN27KI-Ix8DoKSJ.cjs → chunk-46RN27KI-CdSJriZa.cjs} +2 -2
- package/dist/{chunk-46RN27KI-Ix8DoKSJ.cjs.map → chunk-46RN27KI-CdSJriZa.cjs.map} +1 -1
- package/dist/{chunk-4JLVZKHC-DjiHpNEw.cjs → chunk-4JLVZKHC-BHn_tf7f.cjs} +2 -2
- package/dist/{chunk-4JLVZKHC-DjiHpNEw.cjs.map → chunk-4JLVZKHC-BHn_tf7f.cjs.map} +1 -1
- package/dist/{chunk-4N6J7B5P-DhOH1Syh.cjs → chunk-4N6J7B5P-KYJHQOBl.cjs} +2 -2
- package/dist/{chunk-4N6J7B5P-DhOH1Syh.cjs.map → chunk-4N6J7B5P-KYJHQOBl.cjs.map} +1 -1
- package/dist/{chunk-5H5SCKJM-Tnv523v9.cjs → chunk-5H5SCKJM-gj2XZLFt.cjs} +2 -2
- package/dist/{chunk-5H5SCKJM-Tnv523v9.cjs.map → chunk-5H5SCKJM-gj2XZLFt.cjs.map} +1 -1
- package/dist/{chunk-6LASZU3O-D_JFhTJE.cjs → chunk-6LASZU3O-DY4HiL1j.cjs} +2 -2
- package/dist/{chunk-6LASZU3O-D_JFhTJE.cjs.map → chunk-6LASZU3O-DY4HiL1j.cjs.map} +1 -1
- package/dist/{chunk-6VAT5Z2D-u0kcsLTj.cjs → chunk-6VAT5Z2D-dBFyz7S5.cjs} +3 -3
- package/dist/{chunk-6VAT5Z2D-u0kcsLTj.cjs.map → chunk-6VAT5Z2D-dBFyz7S5.cjs.map} +1 -1
- package/dist/{chunk-7JHM3L42-mvOABw38.cjs → chunk-7JHM3L42-Ci7VptmU.cjs} +3 -3
- package/dist/{chunk-7JHM3L42-mvOABw38.cjs.map → chunk-7JHM3L42-Ci7VptmU.cjs.map} +1 -1
- package/dist/{chunk-A4R2GWRF-BGEfai-r.cjs → chunk-A4R2GWRF-Bw0bFSwh.cjs} +2 -2
- package/dist/{chunk-A4R2GWRF-BGEfai-r.cjs.map → chunk-A4R2GWRF-Bw0bFSwh.cjs.map} +1 -1
- package/dist/{chunk-ACSZB4FE-B0N-X9Dz.cjs → chunk-ACSZB4FE-BcgKmI0V.cjs} +2 -2
- package/dist/{chunk-ACSZB4FE-B0N-X9Dz.cjs.map → chunk-ACSZB4FE-BcgKmI0V.cjs.map} +1 -1
- package/dist/{chunk-BVKWRAS6-DVtQSbtn.cjs → chunk-BVKWRAS6-BN2MZXW6.cjs} +2 -2
- package/dist/{chunk-BVKWRAS6-DVtQSbtn.cjs.map → chunk-BVKWRAS6-BN2MZXW6.cjs.map} +1 -1
- package/dist/{chunk-CBJVD2XA-D5HCpyR8.cjs → chunk-CBJVD2XA-DAx-d6Kw.cjs} +2 -2
- package/dist/{chunk-CBJVD2XA-D5HCpyR8.cjs.map → chunk-CBJVD2XA-DAx-d6Kw.cjs.map} +1 -1
- package/dist/{chunk-EBAPSGAO-D9TSE7uP.cjs → chunk-EBAPSGAO-CTlGCUl5.cjs} +2 -2
- package/dist/{chunk-EBAPSGAO-D9TSE7uP.cjs.map → chunk-EBAPSGAO-CTlGCUl5.cjs.map} +1 -1
- package/dist/{chunk-FAXLQUCQ-CjMjzZ2I.cjs → chunk-FAXLQUCQ-UipnjfNf.cjs} +2 -2
- package/dist/{chunk-FAXLQUCQ-CjMjzZ2I.cjs.map → chunk-FAXLQUCQ-UipnjfNf.cjs.map} +1 -1
- package/dist/{chunk-FJK43EBQ-Cuos7IK5.cjs → chunk-FJK43EBQ-3PnBCRo8.cjs} +2 -2
- package/dist/{chunk-FJK43EBQ-Cuos7IK5.cjs.map → chunk-FJK43EBQ-3PnBCRo8.cjs.map} +1 -1
- package/dist/{chunk-FW54FHZR-DLKAjtJl.cjs → chunk-FW54FHZR-CqDpu94r.cjs} +2 -2
- package/dist/{chunk-FW54FHZR-DLKAjtJl.cjs.map → chunk-FW54FHZR-CqDpu94r.cjs.map} +1 -1
- package/dist/{chunk-FX7KQCEA-Bk2TXrav.cjs → chunk-FX7KQCEA-DoYP2gf4.cjs} +2 -2
- package/dist/{chunk-FX7KQCEA-Bk2TXrav.cjs.map → chunk-FX7KQCEA-DoYP2gf4.cjs.map} +1 -1
- package/dist/{chunk-FZRQOL3C-CendgWMm.cjs → chunk-FZRQOL3C-3p1BNqqw.cjs} +2 -2
- package/dist/{chunk-FZRQOL3C-CendgWMm.cjs.map → chunk-FZRQOL3C-3p1BNqqw.cjs.map} +1 -1
- package/dist/{chunk-GGC5NEPZ-CAGLViKl.cjs → chunk-GGC5NEPZ-D_pB4XbU.cjs} +2 -2
- package/dist/{chunk-GGC5NEPZ-CAGLViKl.cjs.map → chunk-GGC5NEPZ-D_pB4XbU.cjs.map} +1 -1
- package/dist/{chunk-GIUR5SNU-DoYdeYwo.cjs → chunk-GIUR5SNU-xqqqaFfL.cjs} +2 -2
- package/dist/{chunk-GIUR5SNU-DoYdeYwo.cjs.map → chunk-GIUR5SNU-xqqqaFfL.cjs.map} +1 -1
- package/dist/{chunk-GJC3WVOW-e51hHrUv.cjs → chunk-GJC3WVOW-CpcIL9Y6.cjs} +2 -2
- package/dist/{chunk-GJC3WVOW-e51hHrUv.cjs.map → chunk-GJC3WVOW-CpcIL9Y6.cjs.map} +1 -1
- package/dist/{chunk-GSPYNYZA-BFTwDcSE.cjs → chunk-GSPYNYZA-COw3VUno.cjs} +2 -2
- package/dist/{chunk-GSPYNYZA-BFTwDcSE.cjs.map → chunk-GSPYNYZA-COw3VUno.cjs.map} +1 -1
- package/dist/{chunk-GTQIUQM6-BJ3uRl49.cjs → chunk-GTQIUQM6-DWT0sKaX.cjs} +2 -2
- package/dist/{chunk-GTQIUQM6-BJ3uRl49.cjs.map → chunk-GTQIUQM6-DWT0sKaX.cjs.map} +1 -1
- package/dist/{chunk-HJBTD7PY-BrF_3AqA.cjs → chunk-HJBTD7PY-CKZQpc_h.cjs} +2 -2
- package/dist/{chunk-HJBTD7PY-BrF_3AqA.cjs.map → chunk-HJBTD7PY-CKZQpc_h.cjs.map} +1 -1
- package/dist/{chunk-ICIEVHY5-DwD_mBxQ.cjs → chunk-ICIEVHY5-Cw2mPFoM.cjs} +3 -3
- package/dist/{chunk-ICIEVHY5-DwD_mBxQ.cjs.map → chunk-ICIEVHY5-Cw2mPFoM.cjs.map} +1 -1
- package/dist/{chunk-KD3KENL6-Cjqq9zgg.cjs → chunk-KD3KENL6-BA94hNks.cjs} +2 -2
- package/dist/{chunk-KD3KENL6-Cjqq9zgg.cjs.map → chunk-KD3KENL6-BA94hNks.cjs.map} +1 -1
- package/dist/{chunk-LEKBROJD-Dan-FkfJ.cjs → chunk-LEKBROJD-D6BOe6FQ.cjs} +2 -2
- package/dist/{chunk-LEKBROJD-Dan-FkfJ.cjs.map → chunk-LEKBROJD-D6BOe6FQ.cjs.map} +1 -1
- package/dist/{chunk-LNBPBRV4-i9oD7RNK.cjs → chunk-LNBPBRV4-spqBTlMR.cjs} +2 -2
- package/dist/{chunk-LNBPBRV4-i9oD7RNK.cjs.map → chunk-LNBPBRV4-spqBTlMR.cjs.map} +1 -1
- package/dist/{chunk-LPJEKUCB-D2Vshvt5.cjs → chunk-LPJEKUCB-DOgg2opJ.cjs} +2 -2
- package/dist/{chunk-LPJEKUCB-D2Vshvt5.cjs.map → chunk-LPJEKUCB-DOgg2opJ.cjs.map} +1 -1
- package/dist/{chunk-MLIO3BK2-8o-YWlna.cjs → chunk-MLIO3BK2-C8YjN7y9.cjs} +2 -2
- package/dist/{chunk-MLIO3BK2-8o-YWlna.cjs.map → chunk-MLIO3BK2-C8YjN7y9.cjs.map} +1 -1
- package/dist/{chunk-MQKGGNPS-DYzifY7S.cjs → chunk-MQKGGNPS-0LEqz-xf.cjs} +2 -2
- package/dist/{chunk-MQKGGNPS-DYzifY7S.cjs.map → chunk-MQKGGNPS-0LEqz-xf.cjs.map} +1 -1
- package/dist/{chunk-MZFCCXPZ-Cnv2B_Hu.cjs → chunk-MZFCCXPZ-C2-OqnUD.cjs} +2 -2
- package/dist/{chunk-MZFCCXPZ-Cnv2B_Hu.cjs.map → chunk-MZFCCXPZ-C2-OqnUD.cjs.map} +1 -1
- package/dist/{chunk-N6DXJ2JN-KqAa8cwh.cjs → chunk-N6DXJ2JN-C-D4d95Q.cjs} +3 -3
- package/dist/{chunk-N6DXJ2JN-KqAa8cwh.cjs.map → chunk-N6DXJ2JN-C-D4d95Q.cjs.map} +1 -1
- package/dist/{chunk-OVGANXCG-Dw-aZ-C-.cjs → chunk-OVGANXCG-CSxkKDAs.cjs} +2 -2
- package/dist/{chunk-OVGANXCG-Dw-aZ-C-.cjs.map → chunk-OVGANXCG-CSxkKDAs.cjs.map} +1 -1
- package/dist/{chunk-Q7H5W7YE-Dpax_RCC.cjs → chunk-Q7H5W7YE-InWpKZY5.cjs} +5 -5
- package/dist/{chunk-Q7H5W7YE-Dpax_RCC.cjs.map → chunk-Q7H5W7YE-InWpKZY5.cjs.map} +1 -1
- package/dist/{chunk-R74UQCKX-EZdevyKE.cjs → chunk-R74UQCKX-B8n0-8sL.cjs} +2 -2
- package/dist/{chunk-R74UQCKX-EZdevyKE.cjs.map → chunk-R74UQCKX-B8n0-8sL.cjs.map} +1 -1
- package/dist/{chunk-S3LEJEPP-BsUig8Jg.cjs → chunk-S3LEJEPP-Cx4wRlId.cjs} +2 -2
- package/dist/{chunk-S3LEJEPP-BsUig8Jg.cjs.map → chunk-S3LEJEPP-Cx4wRlId.cjs.map} +1 -1
- package/dist/{chunk-S443BAN4-CusYVjOU.cjs → chunk-S443BAN4-CK4Jd3Wr.cjs} +2 -2
- package/dist/{chunk-S443BAN4-CusYVjOU.cjs.map → chunk-S443BAN4-CK4Jd3Wr.cjs.map} +1 -1
- package/dist/{chunk-SJYEXC2Z-Cn51vvkR.cjs → chunk-SJYEXC2Z-DeDkIz68.cjs} +2 -2
- package/dist/{chunk-SJYEXC2Z-Cn51vvkR.cjs.map → chunk-SJYEXC2Z-DeDkIz68.cjs.map} +1 -1
- package/dist/{chunk-T4TFLF3R-CHr2VGrs.cjs → chunk-T4TFLF3R-CM1rHZ8N.cjs} +3 -3
- package/dist/{chunk-T4TFLF3R-CHr2VGrs.cjs.map → chunk-T4TFLF3R-CM1rHZ8N.cjs.map} +1 -1
- package/dist/{chunk-U73A73IE-DyTD9Bif.cjs → chunk-U73A73IE-D99RG5Wc.cjs} +2 -2
- package/dist/{chunk-U73A73IE-DyTD9Bif.cjs.map → chunk-U73A73IE-D99RG5Wc.cjs.map} +1 -1
- package/dist/{chunk-UP6MSJGD-BDPikXkp.cjs → chunk-UP6MSJGD-GmcmfQft.cjs} +2 -2
- package/dist/{chunk-UP6MSJGD-BDPikXkp.cjs.map → chunk-UP6MSJGD-GmcmfQft.cjs.map} +1 -1
- package/dist/{chunk-VLCHOJWK-syZp3Vmw.cjs → chunk-VLCHOJWK-DLOEC7xs.cjs} +3 -3
- package/dist/{chunk-VLCHOJWK-syZp3Vmw.cjs.map → chunk-VLCHOJWK-DLOEC7xs.cjs.map} +1 -1
- package/dist/{chunk-WVRWIZF5-DsIdQVnx.cjs → chunk-WVRWIZF5-B5z8SbAq.cjs} +3 -2
- package/dist/{chunk-WVRWIZF5-DsIdQVnx.cjs.map → chunk-WVRWIZF5-B5z8SbAq.cjs.map} +1 -1
- package/dist/{chunk-XCQWV4AU-DRpOqSMs.cjs → chunk-XCQWV4AU-BMG-IH_J.cjs} +2 -2
- package/dist/{chunk-XCQWV4AU-DRpOqSMs.cjs.map → chunk-XCQWV4AU-BMG-IH_J.cjs.map} +1 -1
- package/dist/{chunk-XDGLKIHR-SUFrvh5B.cjs → chunk-XDGLKIHR-BuEIWoRU.cjs} +2 -2
- package/dist/{chunk-XDGLKIHR-SUFrvh5B.cjs.map → chunk-XDGLKIHR-BuEIWoRU.cjs.map} +1 -1
- package/dist/{chunk-XHLMAZX2-DiuICHhP.cjs → chunk-XHLMAZX2-iZ14pqog.cjs} +2 -2
- package/dist/{chunk-XHLMAZX2-DiuICHhP.cjs.map → chunk-XHLMAZX2-iZ14pqog.cjs.map} +1 -1
- package/dist/{chunk-XYXUMFSU-D9CT51kI.cjs → chunk-XYXUMFSU-BeZU9dGd.cjs} +4 -4
- package/dist/{chunk-XYXUMFSU-D9CT51kI.cjs.map → chunk-XYXUMFSU-BeZU9dGd.cjs.map} +1 -1
- package/dist/{chunk-YCLFEX4T-DtyEjr9g.cjs → chunk-YCLFEX4T-BZYE_CVn.cjs} +2 -2
- package/dist/{chunk-YCLFEX4T-DtyEjr9g.cjs.map → chunk-YCLFEX4T-BZYE_CVn.cjs.map} +1 -1
- package/dist/{chunk-YS4NUBYX-7Ku8CDer.cjs → chunk-YS4NUBYX-BWAuwW1l.cjs} +2 -2
- package/dist/{chunk-YS4NUBYX-7Ku8CDer.cjs.map → chunk-YS4NUBYX-BWAuwW1l.cjs.map} +1 -1
- package/dist/{chunk-ZDIT6ST5-6YvPqwJ7.cjs → chunk-ZDIT6ST5-mgVtGdzi.cjs} +2 -2
- package/dist/{chunk-ZDIT6ST5-6YvPqwJ7.cjs.map → chunk-ZDIT6ST5-mgVtGdzi.cjs.map} +1 -1
- package/dist/{chunk-ZZKH2ELC-BxZGGGBF.cjs → chunk-ZZKH2ELC-IqguEy81.cjs} +2 -2
- package/dist/{chunk-ZZKH2ELC-BxZGGGBF.cjs.map → chunk-ZZKH2ELC-IqguEy81.cjs.map} +1 -1
- package/dist/client.cjs +33 -8
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts.map +1 -1
- package/dist/client.d.mts.map +1 -1
- package/dist/client.mjs +33 -8
- package/dist/client.mjs.map +1 -1
- package/dist/{column-XT6UFXNQ-CXUm4HFt.cjs → column-XT6UFXNQ-D2u-CrDc.cjs} +3 -3
- package/dist/{column-XT6UFXNQ-CXUm4HFt.cjs.map → column-XT6UFXNQ-D2u-CrDc.cjs.map} +1 -1
- package/dist/{comm-VV2LDX2J-BARQTdLU.cjs → comm-VV2LDX2J-Yy42VYO9.cjs} +3 -3
- package/dist/{comm-VV2LDX2J-BARQTdLU.cjs.map → comm-VV2LDX2J-Yy42VYO9.cjs.map} +1 -1
- package/dist/config.d.cts +4 -3
- package/dist/config.d.cts.map +1 -1
- package/dist/config.d.mts +4 -3
- package/dist/config.d.mts.map +1 -1
- package/dist/{cp-BISAAS7A-BoFio3Zq.cjs → cp-BISAAS7A-XSnvjsGB.cjs} +3 -3
- package/dist/{cp-BISAAS7A-BoFio3Zq.cjs.map → cp-BISAAS7A-XSnvjsGB.cjs.map} +1 -1
- package/dist/credentials.cjs +1 -1
- package/dist/credentials.mjs +1 -1
- package/dist/{curl-LV5Y3AMS-Cdx6P1bc.cjs → curl-LV5Y3AMS-9HTFdNV4.cjs} +2 -2
- package/dist/{curl-LV5Y3AMS-Cdx6P1bc.cjs.map → curl-LV5Y3AMS-9HTFdNV4.cjs.map} +1 -1
- package/dist/{cut-OKARJCCV-DDw10hRu.cjs → cut-OKARJCCV-BkQDHldN.cjs} +4 -4
- package/dist/{cut-OKARJCCV-DDw10hRu.cjs.map → cut-OKARJCCV-BkQDHldN.cjs.map} +1 -1
- package/dist/{diff-MWJFIG7X-NvtUFxir.cjs → diff-MWJFIG7X-BHO0AB7d.cjs} +3 -3
- package/dist/{diff-MWJFIG7X-NvtUFxir.cjs.map → diff-MWJFIG7X-BHO0AB7d.cjs.map} +1 -1
- package/dist/{dist-D-5MaYYx.cjs → dist-CE8Bys_M.cjs} +227 -11
- package/dist/dist-CE8Bys_M.cjs.map +1 -0
- package/dist/{dist-DyZkmfD4.mjs → dist-CYP5TXGO.mjs} +3 -3
- package/dist/{dist-DyZkmfD4.mjs.map → dist-CYP5TXGO.mjs.map} +1 -1
- package/dist/{dist-ubYcMOAC.cjs → dist-CbLrJ50M.cjs} +102 -48
- package/dist/dist-CbLrJ50M.cjs.map +1 -0
- package/dist/{dist-B6Dt7UbH.cjs → dist-CwfjWo4B.cjs} +3 -3
- package/dist/{dist-B6Dt7UbH.cjs.map → dist-CwfjWo4B.cjs.map} +1 -1
- package/dist/{dist-Brxtvkcs.mjs → dist-DN31JPna.mjs} +100 -46
- package/dist/dist-DN31JPna.mjs.map +1 -0
- package/dist/{dist-DO51rYHS.cjs → dist-DqOzVzWO.cjs} +76 -76
- package/dist/{dist-DO51rYHS.cjs.map → dist-DqOzVzWO.cjs.map} +1 -1
- package/dist/{dist-B2xZReHP.mjs → dist-Kz_xVVMR.mjs} +216 -12
- package/dist/dist-Kz_xVVMR.mjs.map +1 -0
- package/dist/{du-572XNP42-dDEEbTX1.cjs → du-572XNP42-Ci5n1Ogx.cjs} +2 -2
- package/dist/{du-572XNP42-dDEEbTX1.cjs.map → du-572XNP42-Ci5n1Ogx.cjs.map} +1 -1
- package/dist/{env-36M5BO7M-BAXuvwk7.cjs → env-36M5BO7M-BenXvlK4.cjs} +3 -3
- package/dist/{env-36M5BO7M-BAXuvwk7.cjs.map → env-36M5BO7M-BenXvlK4.cjs.map} +1 -1
- package/dist/{expand-JSPG6VOP-CeMMDAbH.cjs → expand-JSPG6VOP-CjkEn3pX.cjs} +3 -3
- package/dist/{expand-JSPG6VOP-CeMMDAbH.cjs.map → expand-JSPG6VOP-CjkEn3pX.cjs.map} +1 -1
- package/dist/{expansion-R25BK4W3-km42UsJs.cjs → expansion-R25BK4W3-DZdAzRFy.cjs} +2 -2
- package/dist/{expansion-R25BK4W3-km42UsJs.cjs.map → expansion-R25BK4W3-DZdAzRFy.cjs.map} +1 -1
- package/dist/{expr-5JAACS4X-DN6RUYi_.cjs → expr-5JAACS4X-BE97Pj1C.cjs} +3 -3
- package/dist/{expr-5JAACS4X-DN6RUYi_.cjs.map → expr-5JAACS4X-BE97Pj1C.cjs.map} +1 -1
- package/dist/{file-IPZJC3FQ-D8YmozYf.cjs → file-IPZJC3FQ-BHvdw59X.cjs} +2 -2
- package/dist/{file-IPZJC3FQ-D8YmozYf.cjs.map → file-IPZJC3FQ-BHvdw59X.cjs.map} +1 -1
- package/dist/{find-INTH3OLC-cCsh7QUd.cjs → find-INTH3OLC-CBMMzyRQ.cjs} +3 -3
- package/dist/{find-INTH3OLC-cCsh7QUd.cjs.map → find-INTH3OLC-CBMMzyRQ.cjs.map} +1 -1
- package/dist/{flag-coverage-XWSYNE72-xsiUZ2Uv.cjs → flag-coverage-XWSYNE72-TZpcGHnc.cjs} +54 -54
- package/dist/{flag-coverage-XWSYNE72-xsiUZ2Uv.cjs.map → flag-coverage-XWSYNE72-TZpcGHnc.cjs.map} +1 -1
- package/dist/{fold-4TQNYMSW-BgRS35yE.cjs → fold-4TQNYMSW-CgFJiPKu.cjs} +3 -3
- package/dist/{fold-4TQNYMSW-BgRS35yE.cjs.map → fold-4TQNYMSW-CgFJiPKu.cjs.map} +1 -1
- package/dist/{grep-V3LQVMRQ-D-wFiXtO.cjs → grep-V3LQVMRQ-DK2kayRm.cjs} +3 -3
- package/dist/{grep-V3LQVMRQ-D-wFiXtO.cjs.map → grep-V3LQVMRQ-DK2kayRm.cjs.map} +1 -1
- package/dist/{gzip-O5ASJAFY-lhZQgzvc.cjs → gzip-O5ASJAFY-CjSYBejX.cjs} +2 -2
- package/dist/{gzip-O5ASJAFY-lhZQgzvc.cjs.map → gzip-O5ASJAFY-CjSYBejX.cjs.map} +1 -1
- package/dist/{head-442HYESI-wfQsPgRD.cjs → head-442HYESI-CJR7SSlN.cjs} +2 -2
- package/dist/{head-442HYESI-wfQsPgRD.cjs.map → head-442HYESI-CJR7SSlN.cjs.map} +1 -1
- package/dist/{help-HZ6M2CKN-CvhvGBWT.cjs → help-HZ6M2CKN-CjWNE4rI.cjs} +3 -3
- package/dist/{help-HZ6M2CKN-CvhvGBWT.cjs.map → help-HZ6M2CKN-CjWNE4rI.cjs.map} +1 -1
- package/dist/{html-to-markdown-JW4MSQZO-DYP7i3n_.cjs → html-to-markdown-JW4MSQZO-BE1zSBBb.cjs} +3 -3
- package/dist/{html-to-markdown-JW4MSQZO-DYP7i3n_.cjs.map → html-to-markdown-JW4MSQZO-BE1zSBBb.cjs.map} +1 -1
- package/dist/index-BTz2OMAM.d.cts.map +1 -1
- package/dist/index-Cq2F2XdS.d.mts.map +1 -1
- package/dist/index-WT4ULMiw.d.cts.map +1 -1
- package/dist/index-WT4ULMiw.d.mts.map +1 -1
- package/dist/{join-TBRGI3LQ-bHNmcV0E.cjs → join-TBRGI3LQ-pEfJS23I.cjs} +3 -3
- package/dist/{join-TBRGI3LQ-bHNmcV0E.cjs.map → join-TBRGI3LQ-pEfJS23I.cjs.map} +1 -1
- package/dist/{jq-4XLYLOS5-DJJGyuG8.cjs → jq-4XLYLOS5-2vuSbClV.cjs} +5 -5
- package/dist/{jq-4XLYLOS5-DJJGyuG8.cjs.map → jq-4XLYLOS5-2vuSbClV.cjs.map} +1 -1
- package/dist/{js-exec-N5KEZBH7-D4Lzs88c.cjs → js-exec-N5KEZBH7-aU0Z-PSz.cjs} +4 -4
- package/dist/{js-exec-N5KEZBH7-D4Lzs88c.cjs.map → js-exec-N5KEZBH7-aU0Z-PSz.cjs.map} +1 -1
- package/dist/{ln-4LGSXXGD-Dea9eT1o.cjs → ln-4LGSXXGD-YmC44ShY.cjs} +3 -3
- package/dist/{ln-4LGSXXGD-Dea9eT1o.cjs.map → ln-4LGSXXGD-YmC44ShY.cjs.map} +1 -1
- package/dist/{ls-ZJGQER7M-D3JTk2Ir.cjs → ls-ZJGQER7M-C1sbxE97.cjs} +2 -2
- package/dist/{ls-ZJGQER7M-D3JTk2Ir.cjs.map → ls-ZJGQER7M-C1sbxE97.cjs.map} +1 -1
- package/dist/{lzma-B-M5XH2f.cjs → lzma-BKh11ciM.cjs} +2 -2
- package/dist/{lzma-B-M5XH2f.cjs.map → lzma-BKh11ciM.cjs.map} +1 -1
- package/dist/{md5sum-SPU24VSG-Bgoo_S_9.cjs → md5sum-SPU24VSG-b5Te6zur.cjs} +4 -4
- package/dist/{md5sum-SPU24VSG-Bgoo_S_9.cjs.map → md5sum-SPU24VSG-b5Te6zur.cjs.map} +1 -1
- package/dist/{microsandbox-CFgApCam-BbimRbAs.cjs → microsandbox-CFgApCam-DfQPNLy0.cjs} +3 -3
- package/dist/{microsandbox-CFgApCam-BbimRbAs.cjs.map → microsandbox-CFgApCam-DfQPNLy0.cjs.map} +1 -1
- package/dist/{mistral-D8-c0BKD.cjs → mistral-BrDQAJSw.cjs} +2 -2
- package/dist/{mistral-D8-c0BKD.cjs.map → mistral-BrDQAJSw.cjs.map} +1 -1
- package/dist/{mistral-BsgTgXrv.mjs → mistral-j9b3vM0i.mjs} +2 -2
- package/dist/{mistral-BsgTgXrv.mjs.map → mistral-j9b3vM0i.mjs.map} +1 -1
- package/dist/{mkdir-MEPGZOB6-C92GPZZj.cjs → mkdir-MEPGZOB6-7B2tAIJv.cjs} +3 -3
- package/dist/{mkdir-MEPGZOB6-C92GPZZj.cjs.map → mkdir-MEPGZOB6-7B2tAIJv.cjs.map} +1 -1
- package/dist/{mv-W5BIQ646-C6uESvHR.cjs → mv-W5BIQ646-yyXc-Ujb.cjs} +3 -3
- package/dist/{mv-W5BIQ646-C6uESvHR.cjs.map → mv-W5BIQ646-yyXc-Ujb.cjs.map} +1 -1
- package/dist/{nl-WSDW7I4O-WUHtx6ar.cjs → nl-WSDW7I4O-DsbEGL-D.cjs} +3 -3
- package/dist/{nl-WSDW7I4O-WUHtx6ar.cjs.map → nl-WSDW7I4O-DsbEGL-D.cjs.map} +1 -1
- package/dist/{od-WOKFDJTP-DZ_PhGba.cjs → od-WOKFDJTP-DjE2_lCr.cjs} +3 -3
- package/dist/{od-WOKFDJTP-DZ_PhGba.cjs.map → od-WOKFDJTP-DjE2_lCr.cjs.map} +1 -1
- package/dist/{paste-7JC6S4DX-BNnL5s0G.cjs → paste-7JC6S4DX-DmPxl6a5.cjs} +3 -3
- package/dist/{paste-7JC6S4DX-BNnL5s0G.cjs.map → paste-7JC6S4DX-DmPxl6a5.cjs.map} +1 -1
- package/dist/{printf-TWGXF445-DGYRYvFv.cjs → printf-TWGXF445-B3BKBgxE.cjs} +3 -3
- package/dist/{printf-TWGXF445-DGYRYvFv.cjs.map → printf-TWGXF445-B3BKBgxE.cjs.map} +1 -1
- package/dist/{python3-POMOR4OA-UrjbAdgU.cjs → python3-POMOR4OA-BP_CZEWk.cjs} +4 -4
- package/dist/{python3-POMOR4OA-UrjbAdgU.cjs.map → python3-POMOR4OA-BP_CZEWk.cjs.map} +1 -1
- package/dist/{rev-5EHFX4EJ-C6bEospo.cjs → rev-5EHFX4EJ-DAakI-6k.cjs} +3 -3
- package/dist/{rev-5EHFX4EJ-C6bEospo.cjs.map → rev-5EHFX4EJ-DAakI-6k.cjs.map} +1 -1
- package/dist/{rg-S4FXYXWB-eo-s3QO6.cjs → rg-S4FXYXWB-DEomHCwR.cjs} +3 -3
- package/dist/{rg-S4FXYXWB-eo-s3QO6.cjs.map → rg-S4FXYXWB-DEomHCwR.cjs.map} +1 -1
- package/dist/{rm-SSGETQVQ-pVbmfXAZ.cjs → rm-SSGETQVQ-DdpxhvsO.cjs} +3 -3
- package/dist/{rm-SSGETQVQ-pVbmfXAZ.cjs.map → rm-SSGETQVQ-DdpxhvsO.cjs.map} +1 -1
- package/dist/{rmdir-OC4ZLPYA-joHTq5dL.cjs → rmdir-OC4ZLPYA-BZhaWGT-.cjs} +3 -3
- package/dist/{rmdir-OC4ZLPYA-joHTq5dL.cjs.map → rmdir-OC4ZLPYA-BZhaWGT-.cjs.map} +1 -1
- package/dist/sandbox.cjs +1 -1
- package/dist/{sed-S5UIK574-CjEsIkX0.cjs → sed-S5UIK574-CI-fUrPh.cjs} +3 -3
- package/dist/{sed-S5UIK574-CjEsIkX0.cjs.map → sed-S5UIK574-CI-fUrPh.cjs.map} +1 -1
- package/dist/{sha1sum-2PTOAFR6-Zxn2YEQ7.cjs → sha1sum-2PTOAFR6-CAJd2y1J.cjs} +4 -4
- package/dist/{sha1sum-2PTOAFR6-Zxn2YEQ7.cjs.map → sha1sum-2PTOAFR6-CAJd2y1J.cjs.map} +1 -1
- package/dist/{sha256sum-NS7D3IXX-D2UBSHMT.cjs → sha256sum-NS7D3IXX-CPZ2P-c1.cjs} +4 -4
- package/dist/{sha256sum-NS7D3IXX-D2UBSHMT.cjs.map → sha256sum-NS7D3IXX-CPZ2P-c1.cjs.map} +1 -1
- package/dist/{sleep-X22JJINO-Dw3qJ3u5.cjs → sleep-X22JJINO-B76R-Pss.cjs} +3 -3
- package/dist/{sleep-X22JJINO-Dw3qJ3u5.cjs.map → sleep-X22JJINO-B76R-Pss.cjs.map} +1 -1
- package/dist/{sort-SW2YEO5B-CY3xZvLH.cjs → sort-SW2YEO5B-CZdvp6Km.cjs} +4 -4
- package/dist/{sort-SW2YEO5B-CY3xZvLH.cjs.map → sort-SW2YEO5B-CZdvp6Km.cjs.map} +1 -1
- package/dist/{split-4KKZZXXE-C0nde5vb.cjs → split-4KKZZXXE-B5lroooe.cjs} +3 -3
- package/dist/{split-4KKZZXXE-C0nde5vb.cjs.map → split-4KKZZXXE-B5lroooe.cjs.map} +1 -1
- package/dist/{sqlite3-CGOEFJAO-DEljm7cX.cjs → sqlite3-CGOEFJAO-PLMgG_Q5.cjs} +3 -3
- package/dist/{sqlite3-CGOEFJAO-DEljm7cX.cjs.map → sqlite3-CGOEFJAO-PLMgG_Q5.cjs.map} +1 -1
- package/dist/{sse-uALvPXss.mjs → sse-DUu9Naud.mjs} +2 -2
- package/dist/{sse-uALvPXss.mjs.map → sse-DUu9Naud.mjs.map} +1 -1
- package/dist/{sse-iAjqagFU.cjs → sse-DaIihZIC.cjs} +2 -2
- package/dist/{sse-iAjqagFU.cjs.map → sse-DaIihZIC.cjs.map} +1 -1
- package/dist/{strings-6WDHLGMX-h7oJ16OF.cjs → strings-6WDHLGMX-BrcsGUuA.cjs} +2 -2
- package/dist/{strings-6WDHLGMX-h7oJ16OF.cjs.map → strings-6WDHLGMX-BrcsGUuA.cjs.map} +1 -1
- package/dist/{tac-2STMMJYW-BtWvKy2f.cjs → tac-2STMMJYW-B9Oin-rx.cjs} +2 -2
- package/dist/{tac-2STMMJYW-BtWvKy2f.cjs.map → tac-2STMMJYW-B9Oin-rx.cjs.map} +1 -1
- package/dist/{tail-R4PCA2C4-BU60h82S.cjs → tail-R4PCA2C4-CFsgIEI9.cjs} +2 -2
- package/dist/{tail-R4PCA2C4-BU60h82S.cjs.map → tail-R4PCA2C4-CFsgIEI9.cjs.map} +1 -1
- package/dist/{tar-STHHZTZ6-qjKeyHOT.cjs → tar-STHHZTZ6-gaTqCHHf.cjs} +3 -3
- package/dist/{tar-STHHZTZ6-qjKeyHOT.cjs.map → tar-STHHZTZ6-gaTqCHHf.cjs.map} +1 -1
- package/dist/{tee-YUZ2FKCJ-BFNL3v2H.cjs → tee-YUZ2FKCJ-DrbSvUds.cjs} +2 -2
- package/dist/{tee-YUZ2FKCJ-BFNL3v2H.cjs.map → tee-YUZ2FKCJ-DrbSvUds.cjs.map} +1 -1
- package/dist/{time-D4LNBSWX-C4MkGGMR.cjs → time-D4LNBSWX-Ct8F4-NH.cjs} +3 -3
- package/dist/{time-D4LNBSWX-C4MkGGMR.cjs.map → time-D4LNBSWX-Ct8F4-NH.cjs.map} +1 -1
- package/dist/{timeout-YDCRSLPQ-B0LndT3y.cjs → timeout-YDCRSLPQ-D7PLQA8X.cjs} +3 -3
- package/dist/{timeout-YDCRSLPQ-B0LndT3y.cjs.map → timeout-YDCRSLPQ-D7PLQA8X.cjs.map} +1 -1
- package/dist/{touch-UA33VN3N-ChlyRE9Q.cjs → touch-UA33VN3N-uwgwvBAt.cjs} +3 -3
- package/dist/{touch-UA33VN3N-ChlyRE9Q.cjs.map → touch-UA33VN3N-uwgwvBAt.cjs.map} +1 -1
- package/dist/{tr-36LHWFRQ-BTAACzqK.cjs → tr-36LHWFRQ-Ddbm-R1a.cjs} +3 -3
- package/dist/{tr-36LHWFRQ-BTAACzqK.cjs.map → tr-36LHWFRQ-Ddbm-R1a.cjs.map} +1 -1
- package/dist/{tree-YLD52CNT-BwNhql16.cjs → tree-YLD52CNT-CxN8fkK7.cjs} +2 -2
- package/dist/{tree-YLD52CNT-BwNhql16.cjs.map → tree-YLD52CNT-CxN8fkK7.cjs.map} +1 -1
- package/dist/trigger.cjs +68 -12
- package/dist/trigger.cjs.map +1 -1
- package/dist/trigger.d.cts +29 -5
- package/dist/trigger.d.cts.map +1 -1
- package/dist/trigger.d.mts +29 -5
- package/dist/trigger.d.mts.map +1 -1
- package/dist/trigger.mjs +66 -13
- package/dist/trigger.mjs.map +1 -1
- package/dist/{unexpand-CADSA4VO-rkuYIkQz.cjs → unexpand-CADSA4VO-DDe4J1y5.cjs} +3 -3
- package/dist/{unexpand-CADSA4VO-rkuYIkQz.cjs.map → unexpand-CADSA4VO-DDe4J1y5.cjs.map} +1 -1
- package/dist/{uniq-XSIZR6PB-DhpovdZb.cjs → uniq-XSIZR6PB-Cp2d_Goe.cjs} +4 -4
- package/dist/{uniq-XSIZR6PB-DhpovdZb.cjs.map → uniq-XSIZR6PB-Cp2d_Goe.cjs.map} +1 -1
- package/dist/{wc-LF7NU4LA-wQgdjpdx.cjs → wc-LF7NU4LA-BRf69_3M.cjs} +4 -4
- package/dist/{wc-LF7NU4LA-wQgdjpdx.cjs.map → wc-LF7NU4LA-BRf69_3M.cjs.map} +1 -1
- package/dist/workflow.cjs +1 -1
- package/dist/workflow.mjs +1 -1
- package/dist/{xan-Y6WF3IRG-CMqV7U0I.cjs → xan-Y6WF3IRG-CDOh5uPZ.cjs} +5 -5
- package/dist/{xan-Y6WF3IRG-CMqV7U0I.cjs.map → xan-Y6WF3IRG-CDOh5uPZ.cjs.map} +1 -1
- package/dist/{xan-view-HDVKHFC2-DLpnDKhQ.cjs → xan-view-HDVKHFC2-BlBCPKgW.cjs} +3 -3
- package/dist/{xan-view-HDVKHFC2-DLpnDKhQ.cjs.map → xan-view-HDVKHFC2-BlBCPKgW.cjs.map} +1 -1
- package/dist/{xargs-MGZPH7AX-d_x__ghK.cjs → xargs-MGZPH7AX-CjfUpqN_.cjs} +3 -3
- package/dist/{xargs-MGZPH7AX-d_x__ghK.cjs.map → xargs-MGZPH7AX-CjfUpqN_.cjs.map} +1 -1
- package/dist/{yq-4QJW3EQG-CDSPxkds.cjs → yq-4QJW3EQG-BRt0uAiw.cjs} +4 -4
- package/dist/{yq-4QJW3EQG-CDSPxkds.cjs.map → yq-4QJW3EQG-BRt0uAiw.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/dist-B2xZReHP.mjs.map +0 -1
- package/dist/dist-Brxtvkcs.mjs.map +0 -1
- package/dist/dist-D-5MaYYx.cjs.map +0 -1
- package/dist/dist-ubYcMOAC.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dist-DyZkmfD4.mjs","names":[],"sources":["../../workflow/dist/index.mjs"],"sourcesContent":["import { z } from \"zod\";\nimport { executeAction, getActionCredentialRequirements, getRunSignal, getWorkflowRunHandle, normalizeCredentialList, registerWorkflowRunGetter, runWithMcpCredentialContext } from \"@keystrokehq/action\";\nimport { captureConsole, logSystem, withSpan } from \"@keystrokehq/tracing\";\nimport { resolveActionCredentials } from \"@keystrokehq/credentials\";\nimport { AsyncLocalStorage } from \"node:async_hooks\";\n//#region src/run-canceled-error.ts\nvar RunCanceledError = class extends Error {\n\tconstructor(runId) {\n\t\tsuper(runId ? `Workflow run ${runId} was canceled` : \"Workflow run was canceled\");\n\t\tthis.name = \"RunCanceledError\";\n\t}\n};\nfunction isRunCanceledError(error) {\n\treturn error instanceof RunCanceledError;\n}\n//#endregion\n//#region src/workflow-definition.ts\nconst zodSchema = z.custom((v) => v instanceof z.ZodType, \"must be a Zod schema\");\n/** Runtime validation for an unbranded workflow definition. */\nconst workflowCoreSchema = z.object({\n\tslug: z.string().trim().min(1),\n\tname: z.string().optional(),\n\tdescription: z.string().optional(),\n\tsubscription: z.object({ mode: z.enum([\"system\", \"subscribable\"]).optional() }).optional(),\n\tinput: zodSchema,\n\toutput: zodSchema,\n\trun: z.function()\n});\nconst WORKFLOW = Symbol.for(\"keystroke.workflow\");\n/**\n* Validates brand + shape via `workflowCoreSchema` so discovery and guards\n* reject malformed definitions.\n*/\nfunction isWorkflow(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tif (!(WORKFLOW in value) || value[WORKFLOW] !== true) return false;\n\treturn workflowCoreSchema.safeParse(value).success;\n}\n//#endregion\n//#region src/define-workflow.ts\nfunction defineWorkflow(def) {\n\tconst result = workflowCoreSchema.safeParse(def);\n\tif (!result.success) throw new Error(`Invalid workflow definition: ${formatIssues(result.error.issues)}`);\n\treturn {\n\t\t...result.data,\n\t\t[WORKFLOW]: true\n\t};\n}\nfunction formatIssues(issues) {\n\treturn issues.map((issue) => {\n\t\treturn `${issue.path.length > 0 ? `${issue.path.join(\".\")}: ` : \"\"}${issue.message}`;\n\t}).join(\"; \");\n}\n//#endregion\n//#region src/replay/error.ts\nfunction serializeWorkflowError(error) {\n\tif (error instanceof Error) return {\n\t\tname: error.name,\n\t\tmessage: error.message\n\t};\n\treturn { message: String(error) };\n}\n/** Rebuild an Error from a recorded error so replay re-raises the same failure. */\nfunction deserializeWorkflowError(data) {\n\tconst serialized = data;\n\tconst error = new Error(serialized?.message ?? \"Workflow step failed\");\n\tif (serialized?.name) error.name = serialized.name;\n\treturn error;\n}\n//#endregion\n//#region src/replay/duration.ts\nconst UNIT_MS = {\n\tms: 1,\n\ts: 1e3,\n\tm: 6e4,\n\th: 36e5,\n\td: 864e5\n};\n/** Resolve a sleep duration to an absolute resume time. */\nfunction resolveResumeAt(duration, now = /* @__PURE__ */ new Date()) {\n\tif (duration instanceof Date) return duration;\n\tif (typeof duration === \"number\") return new Date(now.getTime() + Math.max(0, duration));\n\treturn new Date(now.getTime() + parseDurationToMs(duration));\n}\nfunction parseDurationToMs(value) {\n\tconst match = /^(\\d+(?:\\.\\d+)?)\\s*(ms|s|m|h|d)$/.exec(value.trim());\n\tif (!match) throw new Error(`Invalid sleep duration \"${value}\". Use a number of ms, a Date, or a string like \"5s\", \"10m\", \"1h\".`);\n\tconst amount = Number(match[1]);\n\tconst unit = match[2];\n\treturn Math.round(amount * UNIT_MS[unit]);\n}\n//#endregion\n//#region src/replay/events-consumer.ts\n/** Indexes replay events by correlationId for O(1) cache-hit checks during replay. */\nvar EventsConsumer = class {\n\tbyCorrelationId = /* @__PURE__ */ new Map();\n\tconstructor(events) {\n\t\tfor (const event of events) {\n\t\t\tif (!event.correlationId) continue;\n\t\t\tconst list = this.byCorrelationId.get(event.correlationId);\n\t\t\tif (list) list.push(event);\n\t\t\telse this.byCorrelationId.set(event.correlationId, [event]);\n\t\t}\n\t}\n\tevents(correlationId) {\n\t\treturn this.byCorrelationId.get(correlationId) ?? [];\n\t}\n\thasEventType(correlationId, type) {\n\t\treturn this.events(correlationId).some((event) => event.type === type);\n\t}\n\t/**\n\t* Cache lookup for a step. Returns the recorded output on a `step_completed`,\n\t* re-raises the recorded error on a terminal `step_failed` (so a permanently\n\t* failed step is not re-executed), and otherwise reports a miss — including\n\t* when only `step_retrying` events exist (the step re-runs on the next pass).\n\t*/\n\tgetStepResult(correlationId) {\n\t\tconst events = this.events(correlationId);\n\t\tconst failed = events.find((event) => event.type === \"step_failed\");\n\t\tif (failed) throw deserializeWorkflowError(failed.data);\n\t\tconst completed = events.find((event) => event.type === \"step_completed\");\n\t\tif (completed) return {\n\t\t\tcompleted: true,\n\t\t\tresult: completed.data\n\t\t};\n\t\treturn { completed: false };\n\t}\n\t/** Number of prior `step_retrying` events recorded for a step (= failed attempts so far). */\n\tcountRetrying(correlationId) {\n\t\treturn this.events(correlationId).filter((event) => event.type === \"step_retrying\").length;\n\t}\n\tisSleepCompleted(correlationId) {\n\t\treturn this.hasEventType(correlationId, \"sleep_completed\");\n\t}\n\t/** Returns the persisted resumeAt for a scheduled-but-not-completed sleep, if any. */\n\tgetSleepResumeAt(correlationId) {\n\t\tconst scheduled = this.events(correlationId).find((event) => event.type === \"sleep_scheduled\");\n\t\tif (!scheduled) return;\n\t\tconst data = scheduled.data;\n\t\treturn data?.resumeAt ? new Date(data.resumeAt) : void 0;\n\t}\n\tgetHookToken(correlationId) {\n\t\treturn (this.events(correlationId).find((event) => event.type === \"hook_created\")?.data)?.token;\n\t}\n\tgetHookResult(correlationId) {\n\t\tconst resumed = this.events(correlationId).find((event) => event.type === \"hook_resumed\");\n\t\tif (!resumed) return { resolved: false };\n\t\treturn {\n\t\t\tresolved: true,\n\t\t\tpayload: resumed.data?.payload\n\t\t};\n\t}\n};\n//#endregion\n//#region src/replay/suspension.ts\n/** A promise that never settles — returned by a suspending primitive so the body parks. */\nfunction createPendingPromise() {\n\treturn new Promise(() => {});\n}\n/**\n* Collects pending items requested within a single tick and resolves once, so\n* parallel suspensions (e.g. Promise.all of two sleeps) batch into one suspension.\n*/\nvar SuspensionCoordinator = class {\n\titems = /* @__PURE__ */ new Map();\n\tscheduled = false;\n\tresolve;\n\tpromise;\n\tconstructor() {\n\t\tthis.promise = new Promise((resolve) => {\n\t\t\tthis.resolve = resolve;\n\t\t});\n\t}\n\trequest(item) {\n\t\tthis.items.set(item.correlationId, item);\n\t\tif (!this.scheduled) {\n\t\t\tthis.scheduled = true;\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tthis.resolve([...this.items.values()]);\n\t\t\t});\n\t\t}\n\t}\n\twaitForSuspension() {\n\t\treturn this.promise;\n\t}\n};\n//#endregion\n//#region src/replay/replay-context.ts\nfunction createReplayState(params) {\n\treturn {\n\t\trunId: params.runId,\n\t\tconsumer: params.consumer,\n\t\tcoordinator: params.coordinator,\n\t\teventLog: params.eventLog,\n\t\tnewEvents: [],\n\t\tnow: params.now ?? /* @__PURE__ */ new Date(),\n\t\thookBaseUrl: params.hookBaseUrl,\n\t\tsleepCounter: 0,\n\t\thookCounter: 0,\n\t\tstepOccurrences: /* @__PURE__ */ new Map(),\n\t\tstepCorrelationIds: /* @__PURE__ */ new Set()\n\t};\n}\n/**\n* Allocate the correlation id for a step. An explicit `.stepId(x)` maps to\n* `step:x` (and must be unique within a run); otherwise the key is\n* `step:<actionKey>#<occurrence>` so that two calls to the same action get\n* distinct, replay-stable ids and inserting an unrelated call never shifts the\n* ids of later calls (unlike a single global ordinal).\n*/\nfunction nextStepCorrelationId(state, actionKey, explicitId) {\n\tif (explicitId !== void 0) {\n\t\tconst correlationId = `step:${explicitId}`;\n\t\tif (state.stepCorrelationIds.has(correlationId)) throw new Error(`Duplicate step id \"${explicitId}\" in workflow run ${state.runId}`);\n\t\tstate.stepCorrelationIds.add(correlationId);\n\t\treturn correlationId;\n\t}\n\tconst occurrence = state.stepOccurrences.get(actionKey) ?? 0;\n\tstate.stepOccurrences.set(actionKey, occurrence + 1);\n\tconst correlationId = `step:${actionKey}#${occurrence}`;\n\tstate.stepCorrelationIds.add(correlationId);\n\treturn correlationId;\n}\nfunction createSleep(state) {\n\treturn function sleep(duration) {\n\t\tconst correlationId = `sleep#${state.sleepCounter++}`;\n\t\tif (state.consumer.isSleepCompleted(correlationId)) return Promise.resolve();\n\t\tconst scheduledResumeAt = state.consumer.getSleepResumeAt(correlationId);\n\t\tconst resumeAt = scheduledResumeAt ?? resolveResumeAt(duration, state.now);\n\t\tif (scheduledResumeAt && resumeAt.getTime() <= state.now.getTime()) {\n\t\t\tstate.newEvents.push({\n\t\t\t\tid: `sleep_completed:${state.runId}:${correlationId}`,\n\t\t\t\trunId: state.runId,\n\t\t\t\ttype: \"sleep_completed\",\n\t\t\t\tcorrelationId\n\t\t\t});\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\tif (!scheduledResumeAt) state.newEvents.push({\n\t\t\tid: `sleep_scheduled:${state.runId}:${correlationId}`,\n\t\t\trunId: state.runId,\n\t\t\ttype: \"sleep_scheduled\",\n\t\t\tcorrelationId,\n\t\t\tdata: { resumeAt: resumeAt.toISOString() }\n\t\t});\n\t\tstate.coordinator.request({\n\t\t\tkind: \"sleep\",\n\t\t\tcorrelationId,\n\t\t\tresumeAt\n\t\t});\n\t\treturn createPendingPromise();\n\t};\n}\nfunction createHook(state) {\n\treturn function hook(options) {\n\t\tconst correlationId = `hook#${state.hookCounter++}`;\n\t\tconst token = options?.token ?? state.consumer.getHookToken(correlationId) ?? `hook_${crypto.randomUUID()}`;\n\t\treturn {\n\t\t\ttoken,\n\t\t\tresumeUrl: state.hookBaseUrl ? `${state.hookBaseUrl}/hooks/${token}/resume` : `/hooks/${token}/resume`,\n\t\t\tthen(onFulfilled, onRejected) {\n\t\t\t\tconst result = state.consumer.getHookResult(correlationId);\n\t\t\t\tif (result.resolved) {\n\t\t\t\t\tconst payload = options?.schema ? options.schema.parse(result.payload) : result.payload;\n\t\t\t\t\treturn Promise.resolve(payload).then(onFulfilled, onRejected);\n\t\t\t\t}\n\t\t\t\tif (!state.consumer.hasEventType(correlationId, \"hook_created\")) state.newEvents.push({\n\t\t\t\t\tid: `hook_created:${state.runId}:${correlationId}`,\n\t\t\t\t\trunId: state.runId,\n\t\t\t\t\ttype: \"hook_created\",\n\t\t\t\t\tcorrelationId,\n\t\t\t\t\tdata: { token }\n\t\t\t\t});\n\t\t\t\tstate.coordinator.request({\n\t\t\t\t\tkind: \"hook\",\n\t\t\t\t\tcorrelationId,\n\t\t\t\t\ttoken\n\t\t\t\t});\n\t\t\t\treturn createPendingPromise().then(onFulfilled, onRejected);\n\t\t\t}\n\t\t};\n\t};\n}\n//#endregion\n//#region src/run-durable-step.ts\n/**\n* Shared durable-step shell: resolve a stable `correlation_id`, short-circuit\n* from the event log on a cache hit, otherwise execute and append\n* `step_completed` immediately (per-step crash durability). A thrown step\n* appends `step_retrying` (non-fatal, re-run on the next attempt) and\n* rethrows; the terminal `step_failed` is written by the job handler once the\n* queue exhausts retries.\n*/\nasync function runDurableStep(state, options) {\n\tconst { runId, consumer, eventLog } = state;\n\tgetRunSignal().throwIfAborted();\n\tconst correlationId = nextStepCorrelationId(state, options.key, options.id);\n\tconst cached = consumer.getStepResult(correlationId);\n\tconst metadata = {\n\t\trunId,\n\t\t[options.metadataKey]: options.key,\n\t\tcorrelationId\n\t};\n\tif (cached.completed) {\n\t\tawait withSpan({\n\t\t\tkind: options.kind,\n\t\t\tname: options.key,\n\t\t\trefId: `${runId}:${correlationId}`,\n\t\t\tmetadata: {\n\t\t\t\t...metadata,\n\t\t\t\treplayed: true\n\t\t\t}\n\t\t}, async () => {\n\t\t\tawait logSystem(\"info\", options.replayMessage, metadata);\n\t\t});\n\t\treturn options.parseCached ? options.parseCached(cached.result) : cached.result;\n\t}\n\treturn withSpan({\n\t\tkind: options.kind,\n\t\tname: options.key,\n\t\trefId: `${runId}:${correlationId}`,\n\t\tmetadata\n\t}, async () => captureConsole(async () => {\n\t\ttry {\n\t\t\tconst result = await options.execute(correlationId);\n\t\t\tawait eventLog.append({\n\t\t\t\tid: `step_completed:${runId}:${correlationId}`,\n\t\t\t\trunId,\n\t\t\t\ttype: \"step_completed\",\n\t\t\t\tcorrelationId,\n\t\t\t\tdata: result\n\t\t\t});\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tconst attempt = consumer.countRetrying(correlationId);\n\t\t\tawait eventLog.append({\n\t\t\t\tid: `step_retrying:${runId}:${correlationId}:${attempt}`,\n\t\t\t\trunId,\n\t\t\t\ttype: \"step_retrying\",\n\t\t\t\tcorrelationId,\n\t\t\t\tdata: serializeWorkflowError(error)\n\t\t\t});\n\t\t\tstate.failedCorrelationId = correlationId;\n\t\t\tthrow error;\n\t\t}\n\t}));\n}\n//#endregion\n//#region src/create-action-runner.ts\nfunction withCredentialScopeOverride(requirements, scope) {\n\tif (!requirements || !scope) return requirements;\n\treturn normalizeCredentialList(requirements).map((requirement) => ({\n\t\t...requirement,\n\t\tscope\n\t}));\n}\n/** Builds the per-run action runner; durability lives in {@link runDurableStep}. */\nfunction createActionRunner(state, options = {}) {\n\treturn (action, input, runOptions) => runDurableStep(state, {\n\t\tkind: \"action\",\n\t\tkey: action.slug,\n\t\tid: runOptions?.id,\n\t\tmetadataKey: \"actionKey\",\n\t\treplayMessage: \"action replayed from checkpoint\",\n\t\tparseCached: (cached) => action.output.parse(cached),\n\t\texecute: async (correlationId) => {\n\t\t\tconst requirements = withCredentialScopeOverride(getActionCredentialRequirements(action), runOptions?.credentialScope);\n\t\t\tconst credentials = requirements?.length ? await resolveActionCredentials(requirements, {\n\t\t\t\tresolveCredentials: options.resolveCredentials,\n\t\t\t\tcontext: options.credentialContext,\n\t\t\t\toauthAdapter: options.oauthAdapter,\n\t\t\t\tconsumer: {\n\t\t\t\t\tkind: \"action\",\n\t\t\t\t\tname: action.slug,\n\t\t\t\t\tid: correlationId\n\t\t\t\t}\n\t\t\t}) : {};\n\t\t\treturn runWithMcpCredentialContext({\n\t\t\t\t...options.mcpCredentialContext,\n\t\t\t\tconsumerId: correlationId\n\t\t\t}, () => executeAction(action, input, credentials));\n\t\t}\n\t});\n}\n//#endregion\n//#region src/create-agent-step-runner.ts\n/**\n* Builds the per-run agent runner: each `agent.prompt()` in a workflow body\n* becomes a durable step keyed `step:<agentKey>#<occurrence>` (same scheme as\n* actions). The actual prompt execution is delegated to `runAgent`, supplied\n* by the host (server) via `executeWorkflow({ runAgent })`.\n*/\nfunction createAgentStepRunner(state, runAgent) {\n\treturn (agent, input, options) => {\n\t\tconst slug = agent.slug;\n\t\treturn runDurableStep(state, {\n\t\t\tkind: \"agent_session\",\n\t\t\tkey: slug,\n\t\t\tid: options?.id,\n\t\t\tmetadataKey: \"agentKey\",\n\t\t\treplayMessage: \"agent step replayed from checkpoint\",\n\t\t\texecute: (_correlationId) => runAgent(agent, input, options?.runPrompt)\n\t\t});\n\t};\n}\n//#endregion\n//#region src/create-llm-step-runner.ts\n/**\n* Builds the per-run LLM runner: each `promptLlm()` in a workflow body becomes a\n* durable step keyed `step:promptLlm#<occurrence>`. The actual LLM call is\n* delegated to `runLlm`, supplied by the host (server) via `executeWorkflow({ runLlm })`.\n*/\nfunction createLlmStepRunner(state, runLlm) {\n\treturn (opts) => runDurableStep(state, {\n\t\tkind: \"llm\",\n\t\tkey: \"promptLlm\",\n\t\tid: opts.stepId,\n\t\tmetadataKey: \"llmKey\",\n\t\treplayMessage: \"llm step replayed from checkpoint\",\n\t\tparseCached: (cached) => opts.outputSchema ? opts.outputSchema.parse(cached) : cached,\n\t\texecute: (_correlationId) => runLlm(opts)\n\t});\n}\n//#endregion\n//#region src/run-context.ts\nconst storage = new AsyncLocalStorage();\nregisterWorkflowRunGetter(() => {\n\tconst store = storage.getStore();\n\tif (!store) return;\n\treturn {\n\t\tactionRunner: store.actionRunner,\n\t\tagentRunner: store.agentRunner,\n\t\tllmRunner: store.llmRunner\n\t};\n});\nfunction runWithWorkflowContext(store, fn) {\n\treturn storage.run(store, fn);\n}\n//#endregion\n//#region src/replay/memory-event-log.ts\n/** In-memory durable log for inline execution and tests. */\nvar MemoryEventLog = class {\n\tevents = [];\n\tids = /* @__PURE__ */ new Set();\n\tasync append(event) {\n\t\tconst id = event.id ?? crypto.randomUUID();\n\t\tif (this.ids.has(id)) return false;\n\t\tthis.ids.add(id);\n\t\tthis.events.push({\n\t\t\tid,\n\t\t\trunId: event.runId,\n\t\t\tseq: this.events.length,\n\t\t\ttype: event.type,\n\t\t\tcorrelationId: event.correlationId ?? null,\n\t\t\tdata: event.data ?? null\n\t\t});\n\t\treturn true;\n\t}\n\tasync listReplay(runId) {\n\t\treturn this.events.filter((event) => event.runId === runId).map((event) => ({ ...event }));\n\t}\n};\n//#endregion\n//#region src/execute-workflow.ts\n/**\n* The single way to run a workflow: replay its event log from the top, execute\n* un-cached primitives, and either complete/fail or suspend at the first\n* un-satisfied sleep/hook. New events (sleep_scheduled/sleep_completed/\n* hook_created/run_completed/run_failed) are flushed before returning.\n*\n* Durability comes entirely from the log — a suspended run resumes by calling\n* this again with the same `runId` and event log once the sleep is due or the\n* hook is resumed.\n*/\nasync function executeWorkflow(workflow, input, options = {}) {\n\tconst runId = options.runId ?? crypto.randomUUID();\n\tconst eventLog = options.eventLog ?? new MemoryEventLog();\n\tconst signal = getRunSignal();\n\tconst consumer = new EventsConsumer(await eventLog.listReplay(runId));\n\tconst coordinator = new SuspensionCoordinator();\n\tconst state = createReplayState({\n\t\trunId,\n\t\tconsumer,\n\t\tcoordinator,\n\t\teventLog,\n\t\thookBaseUrl: options.hookBaseUrl,\n\t\tnow: options.now\n\t});\n\tconst actionRunner = createActionRunner(state, {\n\t\tresolveCredentials: options.resolveCredentials,\n\t\tcredentialContext: options.credentialContext,\n\t\toauthAdapter: options.oauthAdapter,\n\t\tmcpCredentialContext: { assignmentTarget: {\n\t\t\ttype: \"workflow\",\n\t\t\tkey: workflow.slug\n\t\t} }\n\t});\n\tconst ctx = {\n\t\trunId,\n\t\tsleep: createSleep(state),\n\t\thook: createHook(state),\n\t\t...options.context\n\t};\n\tconst agentRunner = options.runAgent ? createAgentStepRunner(state, options.runAgent) : void 0;\n\tconst llmRunner = options.runLlm ? createLlmStepRunner(state, options.runLlm) : void 0;\n\tconst validatedInput = workflow.input.parse(input);\n\tconst bodyPromise = runWithWorkflowContext({\n\t\tactionRunner,\n\t\tagentRunner,\n\t\tllmRunner,\n\t\trunId\n\t}, () => captureConsole(async () => workflow.run(validatedInput, ctx)));\n\tlet onAbort;\n\tconst waitForAbort = signal.aborted ? Promise.resolve({ type: \"canceled\" }) : new Promise((resolve) => {\n\t\tonAbort = () => resolve({ type: \"canceled\" });\n\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t});\n\tconst outcome = await Promise.race([\n\t\tbodyPromise.then((output) => ({\n\t\t\ttype: \"done\",\n\t\t\toutput\n\t\t}), (error) => ({\n\t\t\ttype: \"error\",\n\t\t\terror\n\t\t})),\n\t\tcoordinator.waitForSuspension().then((items) => ({\n\t\t\ttype: \"suspended\",\n\t\t\titems\n\t\t})),\n\t\twaitForAbort\n\t]);\n\tif (onAbort) signal.removeEventListener(\"abort\", onAbort);\n\tlet result;\n\tif (outcome.type === \"suspended\") {\n\t\tbodyPromise.catch(() => {});\n\t\tresult = {\n\t\t\tstatus: \"suspended\",\n\t\t\titems: outcome.items\n\t\t};\n\t} else if (outcome.type === \"done\") {\n\t\tconst output = workflow.output.parse(outcome.output);\n\t\tstate.newEvents.push({\n\t\t\tid: `run_completed:${runId}`,\n\t\t\trunId,\n\t\t\ttype: \"run_completed\",\n\t\t\tdata: { output }\n\t\t});\n\t\tresult = {\n\t\t\tstatus: \"completed\",\n\t\t\toutput\n\t\t};\n\t} else if (outcome.type === \"canceled\" || isRunCanceledError(outcome.error)) {\n\t\tbodyPromise.catch(() => {});\n\t\tstate.newEvents.push({\n\t\t\tid: `run_canceled:${runId}`,\n\t\t\trunId,\n\t\t\ttype: \"run_canceled\"\n\t\t});\n\t\tresult = { status: \"canceled\" };\n\t} else result = {\n\t\tstatus: \"failed\",\n\t\terror: outcome.error,\n\t\tfailedCorrelationId: state.failedCorrelationId\n\t};\n\tfor (const event of state.newEvents) await eventLog.append(event);\n\treturn result;\n}\n//#endregion\n//#region src/prompt-llm.ts\nfunction promptLlm(prompt, opts) {\n\tconst handle = getWorkflowRunHandle();\n\tif (!handle?.llmRunner) throw new Error(\"promptLlm must run inside a workflow with an injected llm executor (executeWorkflow({ runLlm })).\");\n\treturn handle.llmRunner({\n\t\tprompt,\n\t\t...opts\n\t});\n}\n//#endregion\nexport { MemoryEventLog, RunCanceledError, defineWorkflow, deserializeWorkflowError, executeWorkflow, isRunCanceledError, isWorkflow, promptLlm, serializeWorkflowError };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;AAMA,IAAI,mBAAmB,cAAc,MAAM;CAC1C,YAAY,OAAO;EAClB,MAAM,QAAQ,gBAAgB,MAAM,iBAAiB,2BAA2B;EAChF,KAAK,OAAO;CACb;AACD;AACA,SAAS,mBAAmB,OAAO;CAClC,OAAO,iBAAiB;AACzB;AAGA,MAAM,YAAY,EAAE,QAAQ,MAAM,aAAa,EAAE,SAAS,sBAAsB;;AAEhF,MAAM,qBAAqB,EAAE,OAAO;CACnC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC;CAC7B,MAAM,EAAE,OAAO,EAAE,SAAS;CAC1B,aAAa,EAAE,OAAO,EAAE,SAAS;CACjC,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,UAAU,cAAc,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS;CACzF,OAAO;CACP,QAAQ;CACR,KAA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","names":[],"sources":["../../workflow/dist/index.mjs"],"sourcesContent":["import { z } from \"zod\";\nimport { executeAction, getActionCredentialRequirements, getRunSignal, getWorkflowRunHandle, normalizeCredentialList, registerWorkflowRunGetter, runWithMcpCredentialContext } from \"@keystrokehq/action\";\nimport { captureConsole, logSystem, withSpan } from \"@keystrokehq/tracing\";\nimport { resolveActionCredentials } from \"@keystrokehq/credentials\";\nimport { AsyncLocalStorage } from \"node:async_hooks\";\n//#region src/run-canceled-error.ts\nvar RunCanceledError = class extends Error {\n\tconstructor(runId) {\n\t\tsuper(runId ? `Workflow run ${runId} was canceled` : \"Workflow run was canceled\");\n\t\tthis.name = \"RunCanceledError\";\n\t}\n};\nfunction isRunCanceledError(error) {\n\treturn error instanceof RunCanceledError;\n}\n//#endregion\n//#region src/workflow-definition.ts\nconst zodSchema = z.custom((v) => v instanceof z.ZodType, \"must be a Zod schema\");\n/** Runtime validation for an unbranded workflow definition. */\nconst workflowCoreSchema = z.object({\n\tslug: z.string().trim().min(1),\n\tname: z.string().optional(),\n\tdescription: z.string().optional(),\n\tsubscription: z.object({ mode: z.enum([\"system\", \"subscribable\"]).optional() }).optional(),\n\tinput: zodSchema,\n\toutput: zodSchema,\n\trun: z.function()\n});\nconst WORKFLOW = Symbol.for(\"keystroke.workflow\");\n/**\n* Validates brand + shape via `workflowCoreSchema` so discovery and guards\n* reject malformed definitions.\n*/\nfunction isWorkflow(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tif (!(WORKFLOW in value) || value[WORKFLOW] !== true) return false;\n\treturn workflowCoreSchema.safeParse(value).success;\n}\n//#endregion\n//#region src/define-workflow.ts\nfunction defineWorkflow(def) {\n\tconst result = workflowCoreSchema.safeParse(def);\n\tif (!result.success) throw new Error(`Invalid workflow definition: ${formatIssues(result.error.issues)}`);\n\treturn {\n\t\t...result.data,\n\t\t[WORKFLOW]: true\n\t};\n}\nfunction formatIssues(issues) {\n\treturn issues.map((issue) => {\n\t\treturn `${issue.path.length > 0 ? `${issue.path.join(\".\")}: ` : \"\"}${issue.message}`;\n\t}).join(\"; \");\n}\n//#endregion\n//#region src/replay/error.ts\nfunction serializeWorkflowError(error) {\n\tif (error instanceof Error) return {\n\t\tname: error.name,\n\t\tmessage: error.message\n\t};\n\treturn { message: String(error) };\n}\n/** Rebuild an Error from a recorded error so replay re-raises the same failure. */\nfunction deserializeWorkflowError(data) {\n\tconst serialized = data;\n\tconst error = new Error(serialized?.message ?? \"Workflow step failed\");\n\tif (serialized?.name) error.name = serialized.name;\n\treturn error;\n}\n//#endregion\n//#region src/replay/duration.ts\nconst UNIT_MS = {\n\tms: 1,\n\ts: 1e3,\n\tm: 6e4,\n\th: 36e5,\n\td: 864e5\n};\n/** Resolve a sleep duration to an absolute resume time. */\nfunction resolveResumeAt(duration, now = /* @__PURE__ */ new Date()) {\n\tif (duration instanceof Date) return duration;\n\tif (typeof duration === \"number\") return new Date(now.getTime() + Math.max(0, duration));\n\treturn new Date(now.getTime() + parseDurationToMs(duration));\n}\nfunction parseDurationToMs(value) {\n\tconst match = /^(\\d+(?:\\.\\d+)?)\\s*(ms|s|m|h|d)$/.exec(value.trim());\n\tif (!match) throw new Error(`Invalid sleep duration \"${value}\". Use a number of ms, a Date, or a string like \"5s\", \"10m\", \"1h\".`);\n\tconst amount = Number(match[1]);\n\tconst unit = match[2];\n\treturn Math.round(amount * UNIT_MS[unit]);\n}\n//#endregion\n//#region src/replay/events-consumer.ts\n/** Indexes replay events by correlationId for O(1) cache-hit checks during replay. */\nvar EventsConsumer = class {\n\tbyCorrelationId = /* @__PURE__ */ new Map();\n\tconstructor(events) {\n\t\tfor (const event of events) {\n\t\t\tif (!event.correlationId) continue;\n\t\t\tconst list = this.byCorrelationId.get(event.correlationId);\n\t\t\tif (list) list.push(event);\n\t\t\telse this.byCorrelationId.set(event.correlationId, [event]);\n\t\t}\n\t}\n\tevents(correlationId) {\n\t\treturn this.byCorrelationId.get(correlationId) ?? [];\n\t}\n\thasEventType(correlationId, type) {\n\t\treturn this.events(correlationId).some((event) => event.type === type);\n\t}\n\t/**\n\t* Cache lookup for a step. Returns the recorded output on a `step_completed`,\n\t* re-raises the recorded error on a terminal `step_failed` (so a permanently\n\t* failed step is not re-executed), and otherwise reports a miss — including\n\t* when only `step_retrying` events exist (the step re-runs on the next pass).\n\t*/\n\tgetStepResult(correlationId) {\n\t\tconst events = this.events(correlationId);\n\t\tconst failed = events.find((event) => event.type === \"step_failed\");\n\t\tif (failed) throw deserializeWorkflowError(failed.data);\n\t\tconst completed = events.find((event) => event.type === \"step_completed\");\n\t\tif (completed) return {\n\t\t\tcompleted: true,\n\t\t\tresult: completed.data\n\t\t};\n\t\treturn { completed: false };\n\t}\n\t/** Number of prior `step_retrying` events recorded for a step (= failed attempts so far). */\n\tcountRetrying(correlationId) {\n\t\treturn this.events(correlationId).filter((event) => event.type === \"step_retrying\").length;\n\t}\n\tisSleepCompleted(correlationId) {\n\t\treturn this.hasEventType(correlationId, \"sleep_completed\");\n\t}\n\t/** Returns the persisted resumeAt for a scheduled-but-not-completed sleep, if any. */\n\tgetSleepResumeAt(correlationId) {\n\t\tconst scheduled = this.events(correlationId).find((event) => event.type === \"sleep_scheduled\");\n\t\tif (!scheduled) return;\n\t\tconst data = scheduled.data;\n\t\treturn data?.resumeAt ? new Date(data.resumeAt) : void 0;\n\t}\n\tgetHookToken(correlationId) {\n\t\treturn (this.events(correlationId).find((event) => event.type === \"hook_created\")?.data)?.token;\n\t}\n\tgetHookResult(correlationId) {\n\t\tconst resumed = this.events(correlationId).find((event) => event.type === \"hook_resumed\");\n\t\tif (!resumed) return { resolved: false };\n\t\treturn {\n\t\t\tresolved: true,\n\t\t\tpayload: resumed.data?.payload\n\t\t};\n\t}\n};\n//#endregion\n//#region src/replay/suspension.ts\n/** A promise that never settles — returned by a suspending primitive so the body parks. */\nfunction createPendingPromise() {\n\treturn new Promise(() => {});\n}\n/**\n* Collects pending items requested within a single tick and resolves once, so\n* parallel suspensions (e.g. Promise.all of two sleeps) batch into one suspension.\n*/\nvar SuspensionCoordinator = class {\n\titems = /* @__PURE__ */ new Map();\n\tscheduled = false;\n\tresolve;\n\tpromise;\n\tconstructor() {\n\t\tthis.promise = new Promise((resolve) => {\n\t\t\tthis.resolve = resolve;\n\t\t});\n\t}\n\trequest(item) {\n\t\tthis.items.set(item.correlationId, item);\n\t\tif (!this.scheduled) {\n\t\t\tthis.scheduled = true;\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tthis.resolve([...this.items.values()]);\n\t\t\t});\n\t\t}\n\t}\n\twaitForSuspension() {\n\t\treturn this.promise;\n\t}\n};\n//#endregion\n//#region src/replay/replay-context.ts\nfunction createReplayState(params) {\n\treturn {\n\t\trunId: params.runId,\n\t\tconsumer: params.consumer,\n\t\tcoordinator: params.coordinator,\n\t\teventLog: params.eventLog,\n\t\tnewEvents: [],\n\t\tnow: params.now ?? /* @__PURE__ */ new Date(),\n\t\thookBaseUrl: params.hookBaseUrl,\n\t\tsleepCounter: 0,\n\t\thookCounter: 0,\n\t\tstepOccurrences: /* @__PURE__ */ new Map(),\n\t\tstepCorrelationIds: /* @__PURE__ */ new Set()\n\t};\n}\n/**\n* Allocate the correlation id for a step. An explicit `.stepId(x)` maps to\n* `step:x` (and must be unique within a run); otherwise the key is\n* `step:<actionKey>#<occurrence>` so that two calls to the same action get\n* distinct, replay-stable ids and inserting an unrelated call never shifts the\n* ids of later calls (unlike a single global ordinal).\n*/\nfunction nextStepCorrelationId(state, actionKey, explicitId) {\n\tif (explicitId !== void 0) {\n\t\tconst correlationId = `step:${explicitId}`;\n\t\tif (state.stepCorrelationIds.has(correlationId)) throw new Error(`Duplicate step id \"${explicitId}\" in workflow run ${state.runId}`);\n\t\tstate.stepCorrelationIds.add(correlationId);\n\t\treturn correlationId;\n\t}\n\tconst occurrence = state.stepOccurrences.get(actionKey) ?? 0;\n\tstate.stepOccurrences.set(actionKey, occurrence + 1);\n\tconst correlationId = `step:${actionKey}#${occurrence}`;\n\tstate.stepCorrelationIds.add(correlationId);\n\treturn correlationId;\n}\nfunction createSleep(state) {\n\treturn function sleep(duration) {\n\t\tconst correlationId = `sleep#${state.sleepCounter++}`;\n\t\tif (state.consumer.isSleepCompleted(correlationId)) return Promise.resolve();\n\t\tconst scheduledResumeAt = state.consumer.getSleepResumeAt(correlationId);\n\t\tconst resumeAt = scheduledResumeAt ?? resolveResumeAt(duration, state.now);\n\t\tif (scheduledResumeAt && resumeAt.getTime() <= state.now.getTime()) {\n\t\t\tstate.newEvents.push({\n\t\t\t\tid: `sleep_completed:${state.runId}:${correlationId}`,\n\t\t\t\trunId: state.runId,\n\t\t\t\ttype: \"sleep_completed\",\n\t\t\t\tcorrelationId\n\t\t\t});\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\tif (!scheduledResumeAt) state.newEvents.push({\n\t\t\tid: `sleep_scheduled:${state.runId}:${correlationId}`,\n\t\t\trunId: state.runId,\n\t\t\ttype: \"sleep_scheduled\",\n\t\t\tcorrelationId,\n\t\t\tdata: { resumeAt: resumeAt.toISOString() }\n\t\t});\n\t\tstate.coordinator.request({\n\t\t\tkind: \"sleep\",\n\t\t\tcorrelationId,\n\t\t\tresumeAt\n\t\t});\n\t\treturn createPendingPromise();\n\t};\n}\nfunction createHook(state) {\n\treturn function hook(options) {\n\t\tconst correlationId = `hook#${state.hookCounter++}`;\n\t\tconst token = options?.token ?? state.consumer.getHookToken(correlationId) ?? `hook_${crypto.randomUUID()}`;\n\t\treturn {\n\t\t\ttoken,\n\t\t\tresumeUrl: state.hookBaseUrl ? `${state.hookBaseUrl}/hooks/${token}/resume` : `/hooks/${token}/resume`,\n\t\t\tthen(onFulfilled, onRejected) {\n\t\t\t\tconst result = state.consumer.getHookResult(correlationId);\n\t\t\t\tif (result.resolved) {\n\t\t\t\t\tconst payload = options?.schema ? options.schema.parse(result.payload) : result.payload;\n\t\t\t\t\treturn Promise.resolve(payload).then(onFulfilled, onRejected);\n\t\t\t\t}\n\t\t\t\tif (!state.consumer.hasEventType(correlationId, \"hook_created\")) state.newEvents.push({\n\t\t\t\t\tid: `hook_created:${state.runId}:${correlationId}`,\n\t\t\t\t\trunId: state.runId,\n\t\t\t\t\ttype: \"hook_created\",\n\t\t\t\t\tcorrelationId,\n\t\t\t\t\tdata: { token }\n\t\t\t\t});\n\t\t\t\tstate.coordinator.request({\n\t\t\t\t\tkind: \"hook\",\n\t\t\t\t\tcorrelationId,\n\t\t\t\t\ttoken\n\t\t\t\t});\n\t\t\t\treturn createPendingPromise().then(onFulfilled, onRejected);\n\t\t\t}\n\t\t};\n\t};\n}\n//#endregion\n//#region src/run-durable-step.ts\n/**\n* Shared durable-step shell: resolve a stable `correlation_id`, short-circuit\n* from the event log on a cache hit, otherwise execute and append\n* `step_completed` immediately (per-step crash durability). A thrown step\n* appends `step_retrying` (non-fatal, re-run on the next attempt) and\n* rethrows; the terminal `step_failed` is written by the job handler once the\n* queue exhausts retries.\n*/\nasync function runDurableStep(state, options) {\n\tconst { runId, consumer, eventLog } = state;\n\tgetRunSignal().throwIfAborted();\n\tconst correlationId = nextStepCorrelationId(state, options.key, options.id);\n\tconst cached = consumer.getStepResult(correlationId);\n\tconst metadata = {\n\t\trunId,\n\t\t[options.metadataKey]: options.key,\n\t\tcorrelationId\n\t};\n\tif (cached.completed) {\n\t\tawait withSpan({\n\t\t\tkind: options.kind,\n\t\t\tname: options.key,\n\t\t\trefId: `${runId}:${correlationId}`,\n\t\t\tmetadata: {\n\t\t\t\t...metadata,\n\t\t\t\treplayed: true\n\t\t\t}\n\t\t}, async () => {\n\t\t\tawait logSystem(\"info\", options.replayMessage, metadata);\n\t\t});\n\t\treturn options.parseCached ? options.parseCached(cached.result) : cached.result;\n\t}\n\treturn withSpan({\n\t\tkind: options.kind,\n\t\tname: options.key,\n\t\trefId: `${runId}:${correlationId}`,\n\t\tmetadata\n\t}, async () => captureConsole(async () => {\n\t\ttry {\n\t\t\tconst result = await options.execute(correlationId);\n\t\t\tawait eventLog.append({\n\t\t\t\tid: `step_completed:${runId}:${correlationId}`,\n\t\t\t\trunId,\n\t\t\t\ttype: \"step_completed\",\n\t\t\t\tcorrelationId,\n\t\t\t\tdata: result\n\t\t\t});\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tconst attempt = consumer.countRetrying(correlationId);\n\t\t\tawait eventLog.append({\n\t\t\t\tid: `step_retrying:${runId}:${correlationId}:${attempt}`,\n\t\t\t\trunId,\n\t\t\t\ttype: \"step_retrying\",\n\t\t\t\tcorrelationId,\n\t\t\t\tdata: serializeWorkflowError(error)\n\t\t\t});\n\t\t\tstate.failedCorrelationId = correlationId;\n\t\t\tthrow error;\n\t\t}\n\t}));\n}\n//#endregion\n//#region src/create-action-runner.ts\nfunction withCredentialScopeOverride(requirements, scope) {\n\tif (!requirements || !scope) return requirements;\n\treturn normalizeCredentialList(requirements).map((requirement) => ({\n\t\t...requirement,\n\t\tscope\n\t}));\n}\n/** Builds the per-run action runner; durability lives in {@link runDurableStep}. */\nfunction createActionRunner(state, options = {}) {\n\treturn (action, input, runOptions) => runDurableStep(state, {\n\t\tkind: \"action\",\n\t\tkey: action.slug,\n\t\tid: runOptions?.id,\n\t\tmetadataKey: \"actionKey\",\n\t\treplayMessage: \"action replayed from checkpoint\",\n\t\tparseCached: (cached) => action.output.parse(cached),\n\t\texecute: async (correlationId) => {\n\t\t\tconst requirements = withCredentialScopeOverride(getActionCredentialRequirements(action), runOptions?.credentialScope);\n\t\t\tconst credentials = requirements?.length ? await resolveActionCredentials(requirements, {\n\t\t\t\tresolveCredentials: options.resolveCredentials,\n\t\t\t\tcontext: options.credentialContext,\n\t\t\t\toauthAdapter: options.oauthAdapter,\n\t\t\t\tconsumer: {\n\t\t\t\t\tkind: \"action\",\n\t\t\t\t\tname: action.slug,\n\t\t\t\t\tid: correlationId\n\t\t\t\t}\n\t\t\t}) : {};\n\t\t\treturn runWithMcpCredentialContext({\n\t\t\t\t...options.mcpCredentialContext,\n\t\t\t\tconsumerId: correlationId\n\t\t\t}, () => executeAction(action, input, credentials));\n\t\t}\n\t});\n}\n//#endregion\n//#region src/create-agent-step-runner.ts\n/**\n* Builds the per-run agent runner: each `agent.prompt()` in a workflow body\n* becomes a durable step keyed `step:<agentKey>#<occurrence>` (same scheme as\n* actions). The actual prompt execution is delegated to `runAgent`, supplied\n* by the host (server) via `executeWorkflow({ runAgent })`.\n*/\nfunction createAgentStepRunner(state, runAgent) {\n\treturn (agent, input, options) => {\n\t\tconst slug = agent.slug;\n\t\treturn runDurableStep(state, {\n\t\t\tkind: \"agent_session\",\n\t\t\tkey: slug,\n\t\t\tid: options?.id,\n\t\t\tmetadataKey: \"agentKey\",\n\t\t\treplayMessage: \"agent step replayed from checkpoint\",\n\t\t\texecute: (_correlationId) => runAgent(agent, input, options?.runPrompt)\n\t\t});\n\t};\n}\n//#endregion\n//#region src/create-llm-step-runner.ts\n/**\n* Builds the per-run LLM runner: each `promptLlm()` in a workflow body becomes a\n* durable step keyed `step:promptLlm#<occurrence>`. The actual LLM call is\n* delegated to `runLlm`, supplied by the host (server) via `executeWorkflow({ runLlm })`.\n*/\nfunction createLlmStepRunner(state, runLlm) {\n\treturn (opts) => runDurableStep(state, {\n\t\tkind: \"llm\",\n\t\tkey: \"promptLlm\",\n\t\tid: opts.stepId,\n\t\tmetadataKey: \"llmKey\",\n\t\treplayMessage: \"llm step replayed from checkpoint\",\n\t\tparseCached: (cached) => opts.outputSchema ? opts.outputSchema.parse(cached) : cached,\n\t\texecute: (_correlationId) => runLlm(opts)\n\t});\n}\n//#endregion\n//#region src/run-context.ts\nconst storage = new AsyncLocalStorage();\nregisterWorkflowRunGetter(() => {\n\tconst store = storage.getStore();\n\tif (!store) return;\n\treturn {\n\t\tactionRunner: store.actionRunner,\n\t\tagentRunner: store.agentRunner,\n\t\tllmRunner: store.llmRunner\n\t};\n});\nfunction runWithWorkflowContext(store, fn) {\n\treturn storage.run(store, fn);\n}\n//#endregion\n//#region src/replay/memory-event-log.ts\n/** In-memory durable log for inline execution and tests. */\nvar MemoryEventLog = class {\n\tevents = [];\n\tids = /* @__PURE__ */ new Set();\n\tasync append(event) {\n\t\tconst id = event.id ?? crypto.randomUUID();\n\t\tif (this.ids.has(id)) return false;\n\t\tthis.ids.add(id);\n\t\tthis.events.push({\n\t\t\tid,\n\t\t\trunId: event.runId,\n\t\t\tseq: this.events.length,\n\t\t\ttype: event.type,\n\t\t\tcorrelationId: event.correlationId ?? null,\n\t\t\tdata: event.data ?? null\n\t\t});\n\t\treturn true;\n\t}\n\tasync listReplay(runId) {\n\t\treturn this.events.filter((event) => event.runId === runId).map((event) => ({ ...event }));\n\t}\n};\n//#endregion\n//#region src/execute-workflow.ts\n/**\n* The single way to run a workflow: replay its event log from the top, execute\n* un-cached primitives, and either complete/fail or suspend at the first\n* un-satisfied sleep/hook. New events (sleep_scheduled/sleep_completed/\n* hook_created/run_completed/run_failed) are flushed before returning.\n*\n* Durability comes entirely from the log — a suspended run resumes by calling\n* this again with the same `runId` and event log once the sleep is due or the\n* hook is resumed.\n*/\nasync function executeWorkflow(workflow, input, options = {}) {\n\tconst runId = options.runId ?? crypto.randomUUID();\n\tconst eventLog = options.eventLog ?? new MemoryEventLog();\n\tconst signal = getRunSignal();\n\tconst consumer = new EventsConsumer(await eventLog.listReplay(runId));\n\tconst coordinator = new SuspensionCoordinator();\n\tconst state = createReplayState({\n\t\trunId,\n\t\tconsumer,\n\t\tcoordinator,\n\t\teventLog,\n\t\thookBaseUrl: options.hookBaseUrl,\n\t\tnow: options.now\n\t});\n\tconst actionRunner = createActionRunner(state, {\n\t\tresolveCredentials: options.resolveCredentials,\n\t\tcredentialContext: options.credentialContext,\n\t\toauthAdapter: options.oauthAdapter,\n\t\tmcpCredentialContext: { assignmentTarget: {\n\t\t\ttype: \"workflow\",\n\t\t\tkey: workflow.slug\n\t\t} }\n\t});\n\tconst ctx = {\n\t\trunId,\n\t\tsleep: createSleep(state),\n\t\thook: createHook(state),\n\t\t...options.context\n\t};\n\tconst agentRunner = options.runAgent ? createAgentStepRunner(state, options.runAgent) : void 0;\n\tconst llmRunner = options.runLlm ? createLlmStepRunner(state, options.runLlm) : void 0;\n\tconst validatedInput = workflow.input.parse(input);\n\tconst bodyPromise = runWithWorkflowContext({\n\t\tactionRunner,\n\t\tagentRunner,\n\t\tllmRunner,\n\t\trunId\n\t}, () => captureConsole(async () => workflow.run(validatedInput, ctx)));\n\tlet onAbort;\n\tconst waitForAbort = signal.aborted ? Promise.resolve({ type: \"canceled\" }) : new Promise((resolve) => {\n\t\tonAbort = () => resolve({ type: \"canceled\" });\n\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t});\n\tconst outcome = await Promise.race([\n\t\tbodyPromise.then((output) => ({\n\t\t\ttype: \"done\",\n\t\t\toutput\n\t\t}), (error) => ({\n\t\t\ttype: \"error\",\n\t\t\terror\n\t\t})),\n\t\tcoordinator.waitForSuspension().then((items) => ({\n\t\t\ttype: \"suspended\",\n\t\t\titems\n\t\t})),\n\t\twaitForAbort\n\t]);\n\tif (onAbort) signal.removeEventListener(\"abort\", onAbort);\n\tlet result;\n\tif (outcome.type === \"suspended\") {\n\t\tbodyPromise.catch(() => {});\n\t\tresult = {\n\t\t\tstatus: \"suspended\",\n\t\t\titems: outcome.items\n\t\t};\n\t} else if (outcome.type === \"done\") {\n\t\tconst output = workflow.output.parse(outcome.output);\n\t\tstate.newEvents.push({\n\t\t\tid: `run_completed:${runId}`,\n\t\t\trunId,\n\t\t\ttype: \"run_completed\",\n\t\t\tdata: { output }\n\t\t});\n\t\tresult = {\n\t\t\tstatus: \"completed\",\n\t\t\toutput\n\t\t};\n\t} else if (outcome.type === \"canceled\" || isRunCanceledError(outcome.error)) {\n\t\tbodyPromise.catch(() => {});\n\t\tstate.newEvents.push({\n\t\t\tid: `run_canceled:${runId}`,\n\t\t\trunId,\n\t\t\ttype: \"run_canceled\"\n\t\t});\n\t\tresult = { status: \"canceled\" };\n\t} else result = {\n\t\tstatus: \"failed\",\n\t\terror: outcome.error,\n\t\tfailedCorrelationId: state.failedCorrelationId\n\t};\n\tfor (const event of state.newEvents) await eventLog.append(event);\n\treturn result;\n}\n//#endregion\n//#region src/prompt-llm.ts\nfunction promptLlm(prompt, opts) {\n\tconst handle = getWorkflowRunHandle();\n\tif (!handle?.llmRunner) throw new Error(\"promptLlm must run inside a workflow with an injected llm executor (executeWorkflow({ runLlm })).\");\n\treturn handle.llmRunner({\n\t\tprompt,\n\t\t...opts\n\t});\n}\n//#endregion\nexport { MemoryEventLog, RunCanceledError, defineWorkflow, deserializeWorkflowError, executeWorkflow, isRunCanceledError, isWorkflow, promptLlm, serializeWorkflowError };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;AAMA,IAAI,mBAAmB,cAAc,MAAM;CAC1C,YAAY,OAAO;EAClB,MAAM,QAAQ,gBAAgB,MAAM,iBAAiB,2BAA2B;EAChF,KAAK,OAAO;CACb;AACD;AACA,SAAS,mBAAmB,OAAO;CAClC,OAAO,iBAAiB;AACzB;AAGA,MAAM,YAAY,EAAE,QAAQ,MAAM,aAAa,EAAE,SAAS,sBAAsB;;AAEhF,MAAM,qBAAqB,EAAE,OAAO;CACnC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC;CAC7B,MAAM,EAAE,OAAO,EAAE,SAAS;CAC1B,aAAa,EAAE,OAAO,EAAE,SAAS;CACjC,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,UAAU,cAAc,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS;CACzF,OAAO;CACP,QAAQ;CACR,KAAK,EAAE,SAAS;AACjB,CAAC;AACD,MAAM,WAAW,OAAO,IAAI,oBAAoB;;;;;AAKhD,SAAS,WAAW,OAAO;CAC1B,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO;CACxD,IAAI,EAAE,YAAY,UAAU,MAAM,cAAc,MAAM,OAAO;CAC7D,OAAO,mBAAmB,UAAU,KAAK,EAAE;AAC5C;AAGA,SAAS,eAAe,KAAK;CAC5B,M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AAC;CACD,IAAI,SAAS,OAAO,oBAAoB,SAAS,OAAO;CACxD,IAAI;CACJ,IAAI,QAAQ,SAAS,aAAa;EACjC,YAAY,YAAY,CAAC,CAAC;EAC1B,SAAS;GACR,QAAQ;GACR,OAAO,QAAQ;EAChB;CACD,OAAO,IAAI,QAAQ,SAAS,QAAQ;EACnC,MAAM,SAAS,SAAS,OAAO,MAAM,QAAQ,MAAM;EACnD,MAAM,UAAU,KAAK;GACpB,IAAI,iBAAiB;GACrB;GACA,MAAM;GACN,MAAM,EAAE,OAAO;EAChB,CAAC;EACD,SAAS;GACR,QAAQ;GACR;EACD;CACD,OAAO,IAAI,QAAQ,SAAS,cAAc,mBAAmB,QAAQ,KAAK,GAAG;EAC5E,YAAY,YAAY,CAAC,CAAC;EAC1B,MAAM,UAAU,KAAK;GACpB,IAAI,gBAAgB;GACpB;GACA,MAAM;EACP,CAAC;EACD,SAAS,EAAE,QAAQ,WAAW;CAC/B,OAAO,SAAS;EACf,QAAQ;EACR,OAAO,QAAQ;EACf,qBAAqB,MAAM;CAC5B;CACA,KAAK,MAAM,SAAS,MAAM,WAAW,MAAM,SAAS,OAAO,KAAK;CAChE,OAAO;AACR;AAGA,SAAS,UAAU,QAAQ,MAAM;CAChC,MAAM,SAAS,qBAAqB;CACpC,IAAI,CAAC,QAAQ,WAAW,MAAM,IAAI,MAAM,mGAAmG;CAC3I,OAAO,OAAO,UAAU;EACvB;EACA,GAAG;CACJ,CAAC;AACF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-DHdmVzO2.cjs");
|
|
2
|
-
const require_dist$1 = require("./dist-
|
|
2
|
+
const require_dist$1 = require("./dist-CE8Bys_M.cjs");
|
|
3
3
|
let node_async_hooks = require("node:async_hooks");
|
|
4
|
+
let node_module = require("node:module");
|
|
4
5
|
require("node:fs");
|
|
5
6
|
require("node:path");
|
|
6
7
|
let node_crypto = require("node:crypto");
|
|
@@ -3130,8 +3131,9 @@ function getDatabaseHandle$1() {
|
|
|
3130
3131
|
function getDbFromContext$1() {
|
|
3131
3132
|
return getDatabaseHandle$1().db;
|
|
3132
3133
|
}
|
|
3134
|
+
(0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
3133
3135
|
function buildPgSchema$1(registry) {
|
|
3134
|
-
return Object.fromEntries(Object.entries(registry).map(([name, { pg
|
|
3136
|
+
return Object.fromEntries(Object.entries(registry).map(([name, { pg }]) => [name, pg]));
|
|
3135
3137
|
}
|
|
3136
3138
|
function buildSqliteSchema$1(registry) {
|
|
3137
3139
|
return Object.fromEntries(Object.entries(registry).map(([name, { sqlite }]) => [name, sqlite]));
|
|
@@ -3244,82 +3246,106 @@ const usageRecordsSqlite = sqliteTable("usage_records", {
|
|
|
3244
3246
|
metadata: text("metadata", { mode: "json" }),
|
|
3245
3247
|
createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull()
|
|
3246
3248
|
}, (table) => [index("usage_records_run_run_kind_idx").on(table.runId, table.runKind), index("usage_records_kind_idx").on(table.kind)]);
|
|
3247
|
-
const
|
|
3249
|
+
const triggers = pgTable("triggers", {
|
|
3248
3250
|
id: text$1("id").primaryKey(),
|
|
3249
3251
|
projectId: text$1("project_id").notNull(),
|
|
3250
3252
|
slug: text$1("slug").notNull(),
|
|
3253
|
+
kind: text$1("kind").$type().notNull(),
|
|
3251
3254
|
name: text$1("name"),
|
|
3252
3255
|
description: text$1("description"),
|
|
3253
|
-
targetKind: text$1("target_kind").$type().notNull().default("workflow"),
|
|
3254
|
-
workflowSlug: text$1("workflow_slug"),
|
|
3255
|
-
agentSlug: text$1("agent_slug"),
|
|
3256
3256
|
moduleFile: text$1("module_file").notNull(),
|
|
3257
|
-
source: jsonb("source").$type().notNull(),
|
|
3258
3257
|
origin: text$1("origin").$type().notNull().default("project"),
|
|
3259
|
-
|
|
3258
|
+
config: jsonb("config").$type(),
|
|
3259
|
+
schedule: text$1("schedule"),
|
|
3260
|
+
nextRunAt: timestamp("next_run_at", { withTimezone: true }),
|
|
3261
|
+
enabled: integer$1("enabled").notNull().default(1),
|
|
3260
3262
|
lifecycle: jsonb("lifecycle").$type(),
|
|
3261
3263
|
createdBySessionId: text$1("created_by_session_id"),
|
|
3264
|
+
triggerHash: text$1("trigger_hash"),
|
|
3265
|
+
overviewMarkdown: text$1("overview_markdown"),
|
|
3266
|
+
overviewHash: text$1("overview_hash"),
|
|
3267
|
+
overviewModel: text$1("overview_model"),
|
|
3268
|
+
overviewStatus: text$1("overview_status").$type().notNull().default("idle"),
|
|
3269
|
+
overviewGeneratedAt: timestamp("overview_generated_at", { withTimezone: true }),
|
|
3262
3270
|
registeredAt: timestamp("registered_at", { withTimezone: true }).notNull(),
|
|
3263
3271
|
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
3264
3272
|
deletedAt: timestamp("deleted_at", { withTimezone: true })
|
|
3265
|
-
}, (table) => [uniqueIndex$1("
|
|
3266
|
-
const
|
|
3273
|
+
}, (table) => [uniqueIndex$1("triggers_project_id_slug_idx").on(table.projectId, table.slug), index$1("triggers_next_run_at_enabled_idx").on(table.nextRunAt, table.enabled)]);
|
|
3274
|
+
const triggersSqlite = sqliteTable("triggers", {
|
|
3267
3275
|
id: text("id").primaryKey(),
|
|
3268
3276
|
projectId: text("project_id").notNull(),
|
|
3269
3277
|
slug: text("slug").notNull(),
|
|
3278
|
+
kind: text("kind").$type().notNull(),
|
|
3270
3279
|
name: text("name"),
|
|
3271
3280
|
description: text("description"),
|
|
3272
|
-
targetKind: text("target_kind").$type().notNull().default("workflow"),
|
|
3273
|
-
workflowSlug: text("workflow_slug"),
|
|
3274
|
-
agentSlug: text("agent_slug"),
|
|
3275
3281
|
moduleFile: text("module_file").notNull(),
|
|
3276
|
-
source: text("source", { mode: "json" }).$type().notNull(),
|
|
3277
3282
|
origin: text("origin").$type().notNull().default("project"),
|
|
3278
|
-
|
|
3283
|
+
config: text("config", { mode: "json" }).$type(),
|
|
3284
|
+
schedule: text("schedule"),
|
|
3285
|
+
nextRunAt: integer("next_run_at", { mode: "timestamp_ms" }),
|
|
3286
|
+
enabled: integer("enabled").notNull().default(1),
|
|
3279
3287
|
lifecycle: text("lifecycle", { mode: "json" }).$type(),
|
|
3280
3288
|
createdBySessionId: text("created_by_session_id"),
|
|
3289
|
+
triggerHash: text("trigger_hash"),
|
|
3290
|
+
overviewMarkdown: text("overview_markdown"),
|
|
3291
|
+
overviewHash: text("overview_hash"),
|
|
3292
|
+
overviewModel: text("overview_model"),
|
|
3293
|
+
overviewStatus: text("overview_status").$type().notNull().default("idle"),
|
|
3294
|
+
overviewGeneratedAt: integer("overview_generated_at", { mode: "timestamp_ms" }),
|
|
3281
3295
|
registeredAt: integer("registered_at", { mode: "timestamp_ms" }).notNull(),
|
|
3282
3296
|
updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull(),
|
|
3283
3297
|
deletedAt: integer("deleted_at", { mode: "timestamp_ms" })
|
|
3284
|
-
}, (table) => [uniqueIndex("
|
|
3285
|
-
const
|
|
3298
|
+
}, (table) => [uniqueIndex("triggers_project_id_slug_idx").on(table.projectId, table.slug), index("triggers_next_run_at_enabled_idx").on(table.nextRunAt, table.enabled)]);
|
|
3299
|
+
const triggerAttachments = pgTable("trigger_attachments", {
|
|
3286
3300
|
id: text$1("id").primaryKey(),
|
|
3287
3301
|
projectId: text$1("project_id").notNull(),
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3302
|
+
triggerId: text$1("trigger_id").notNull().references(() => triggers.id),
|
|
3303
|
+
slug: text$1("slug").notNull(),
|
|
3304
|
+
targetKind: text$1("target_kind").$type().notNull().default("workflow"),
|
|
3305
|
+
workflowSlug: text$1("workflow_slug"),
|
|
3306
|
+
agentSlug: text$1("agent_slug"),
|
|
3307
|
+
prompt: text$1("prompt"),
|
|
3308
|
+
registeredAt: timestamp("registered_at", { withTimezone: true }).notNull(),
|
|
3309
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
3310
|
+
deletedAt: timestamp("deleted_at", { withTimezone: true })
|
|
3311
|
+
}, (table) => [uniqueIndex$1("trigger_attachments_project_id_slug_idx").on(table.projectId, table.slug)]);
|
|
3312
|
+
const triggerAttachmentsSqlite = sqliteTable("trigger_attachments", {
|
|
3296
3313
|
id: text("id").primaryKey(),
|
|
3297
3314
|
projectId: text("project_id").notNull(),
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3315
|
+
triggerId: text("trigger_id").notNull().references(() => triggersSqlite.id),
|
|
3316
|
+
slug: text("slug").notNull(),
|
|
3317
|
+
targetKind: text("target_kind").$type().notNull().default("workflow"),
|
|
3318
|
+
workflowSlug: text("workflow_slug"),
|
|
3319
|
+
agentSlug: text("agent_slug"),
|
|
3320
|
+
prompt: text("prompt"),
|
|
3321
|
+
registeredAt: integer("registered_at", { mode: "timestamp_ms" }).notNull(),
|
|
3322
|
+
updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull(),
|
|
3323
|
+
deletedAt: integer("deleted_at", { mode: "timestamp_ms" })
|
|
3324
|
+
}, (table) => [uniqueIndex("trigger_attachments_project_id_slug_idx").on(table.projectId, table.slug)]);
|
|
3305
3325
|
const triggerRuns = pgTable("trigger_runs", {
|
|
3306
3326
|
id: text$1("id").primaryKey(),
|
|
3307
3327
|
projectId: text$1("project_id").notNull(),
|
|
3308
|
-
|
|
3328
|
+
triggerId: text$1("trigger_id").notNull().references(() => triggers.id),
|
|
3309
3329
|
sourcePath: text$1("source_path"),
|
|
3310
3330
|
triggerType: text$1("trigger_type").$type().notNull(),
|
|
3331
|
+
outcome: text$1("outcome").$type().notNull().default("dispatched"),
|
|
3332
|
+
reason: text$1("reason").$type(),
|
|
3333
|
+
detail: text$1("detail"),
|
|
3311
3334
|
payload: jsonb("payload"),
|
|
3312
3335
|
triggeredAt: timestamp("triggered_at", { withTimezone: true }).notNull()
|
|
3313
|
-
});
|
|
3336
|
+
}, (table) => [index$1("trigger_runs_project_trigger_triggered_idx").on(table.projectId, table.triggerId, table.triggeredAt), index$1("trigger_runs_project_triggered_idx").on(table.projectId, table.triggeredAt)]);
|
|
3314
3337
|
const triggerRunsSqlite = sqliteTable("trigger_runs", {
|
|
3315
3338
|
id: text("id").primaryKey(),
|
|
3316
3339
|
projectId: text("project_id").notNull(),
|
|
3317
|
-
|
|
3340
|
+
triggerId: text("trigger_id").notNull().references(() => triggersSqlite.id),
|
|
3318
3341
|
sourcePath: text("source_path"),
|
|
3319
3342
|
triggerType: text("trigger_type").$type().notNull(),
|
|
3343
|
+
outcome: text("outcome").$type().notNull().default("dispatched"),
|
|
3344
|
+
reason: text("reason").$type(),
|
|
3345
|
+
detail: text("detail"),
|
|
3320
3346
|
payload: text("payload", { mode: "json" }),
|
|
3321
3347
|
triggeredAt: integer("triggered_at", { mode: "timestamp_ms" }).notNull()
|
|
3322
|
-
});
|
|
3348
|
+
}, (table) => [index("trigger_runs_project_trigger_triggered_idx").on(table.projectId, table.triggerId, table.triggeredAt), index("trigger_runs_project_triggered_idx").on(table.projectId, table.triggeredAt)]);
|
|
3323
3349
|
const workflowSubscriptions = pgTable("workflow_subscriptions", {
|
|
3324
3350
|
id: text$1("id").primaryKey(),
|
|
3325
3351
|
projectId: text$1("project_id").notNull(),
|
|
@@ -3451,7 +3477,8 @@ const credentialInstances = pgTable("credential_instances", {
|
|
|
3451
3477
|
sharedConnectionId: text$1("shared_connection_id"),
|
|
3452
3478
|
grantedScopes: jsonb("granted_scopes").$type(),
|
|
3453
3479
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
3454
|
-
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
3480
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
3481
|
+
lastUsedAt: timestamp("last_used_at", { withTimezone: true })
|
|
3455
3482
|
}, (table) => [uniqueIndex$1("credential_instances_project_scope_slug_unique").on(table.projectId, table.scopeType, table.scopeId, table.slug), index$1("credential_instances_project_app_slug_scope_idx").on(table.projectId, table.appSlug, table.scopeType, table.scopeId)]);
|
|
3456
3483
|
const credentialInstancesSqlite = sqliteTable("credential_instances", {
|
|
3457
3484
|
id: text("id").primaryKey(),
|
|
@@ -3470,7 +3497,8 @@ const credentialInstancesSqlite = sqliteTable("credential_instances", {
|
|
|
3470
3497
|
sharedConnectionId: text("shared_connection_id"),
|
|
3471
3498
|
grantedScopes: text("granted_scopes", { mode: "json" }).$type(),
|
|
3472
3499
|
createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
3473
|
-
updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull()
|
|
3500
|
+
updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull(),
|
|
3501
|
+
lastUsedAt: integer("last_used_at", { mode: "timestamp_ms" })
|
|
3474
3502
|
}, (table) => [uniqueIndex("credential_instances_project_scope_slug_unique").on(table.projectId, table.scopeType, table.scopeId, table.slug), index("credential_instances_project_app_slug_scope_idx").on(table.projectId, table.appSlug, table.scopeType, table.scopeId)]);
|
|
3475
3503
|
const credentialAssignments = pgTable("credential_assignments", {
|
|
3476
3504
|
id: text$1("id").primaryKey(),
|
|
@@ -3703,14 +3731,14 @@ const tableRegistry$1 = {
|
|
|
3703
3731
|
pg: usageRecords,
|
|
3704
3732
|
sqlite: usageRecordsSqlite
|
|
3705
3733
|
},
|
|
3734
|
+
triggers: {
|
|
3735
|
+
pg: triggers,
|
|
3736
|
+
sqlite: triggersSqlite
|
|
3737
|
+
},
|
|
3706
3738
|
triggerAttachments: {
|
|
3707
3739
|
pg: triggerAttachments,
|
|
3708
3740
|
sqlite: triggerAttachmentsSqlite
|
|
3709
3741
|
},
|
|
3710
|
-
triggerSchedules: {
|
|
3711
|
-
pg: triggerSchedules,
|
|
3712
|
-
sqlite: triggerSchedulesSqlite
|
|
3713
|
-
},
|
|
3714
3742
|
triggerRuns: {
|
|
3715
3743
|
pg: triggerRuns,
|
|
3716
3744
|
sqlite: triggerRunsSqlite
|
|
@@ -3865,6 +3893,10 @@ async function selectCredentialInstancesForScope(appSlug, scopeType, scopeId) {
|
|
|
3865
3893
|
const scopeCondition = scopeId === null ? and(eq(credentialInstances.scopeType, scopeType), isNull(credentialInstances.scopeId)) : and(eq(credentialInstances.scopeType, scopeType), eq(credentialInstances.scopeId, scopeId));
|
|
3866
3894
|
return db.select().from(credentialInstances).where(credentialScopeAnd(scopeType, eq(credentialInstances.appSlug, appSlug), scopeCondition));
|
|
3867
3895
|
}
|
|
3896
|
+
/** Record that a credential was just resolved/used. Targeted by id; never throws on a missing row. */
|
|
3897
|
+
async function touchCredentialInstanceLastUsed(id) {
|
|
3898
|
+
await getDb$1().update(credentialInstances).set({ lastUsedAt: /* @__PURE__ */ new Date() }).where(eq(credentialInstances.id, id));
|
|
3899
|
+
}
|
|
3868
3900
|
async function listCredentialAssignmentsByTarget(options) {
|
|
3869
3901
|
return getDb$1().select().from(credentialAssignments).where(scopedAnd$1(credentialAssignments, eq(credentialAssignments.targetType, options.targetType), eq(credentialAssignments.targetKey, options.targetKey)));
|
|
3870
3902
|
}
|
|
@@ -17261,7 +17293,7 @@ async function connectMcpServer(name, options) {
|
|
|
17261
17293
|
}
|
|
17262
17294
|
async function createTransport(url, transport, requestInit, fetchImpl) {
|
|
17263
17295
|
if (transport === "sse") {
|
|
17264
|
-
const { SSEClientTransport } = await Promise.resolve().then(() => require("./sse-
|
|
17296
|
+
const { SSEClientTransport } = await Promise.resolve().then(() => require("./sse-DaIihZIC.cjs"));
|
|
17265
17297
|
return new SSEClientTransport(url, {
|
|
17266
17298
|
requestInit,
|
|
17267
17299
|
fetch: fetchImpl
|
|
@@ -17464,10 +17496,9 @@ const authVerificationsSqlite = sqliteTable("verification", {
|
|
|
17464
17496
|
createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
17465
17497
|
updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull()
|
|
17466
17498
|
}, (table) => [index("verification_identifier_idx").on(table.identifier)]);
|
|
17467
|
-
|
|
17468
|
-
//#region ../platform-database/dist/index.mjs
|
|
17499
|
+
(0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
17469
17500
|
function buildPgSchema(registry) {
|
|
17470
|
-
return Object.fromEntries(Object.entries(registry).map(([name, { pg
|
|
17501
|
+
return Object.fromEntries(Object.entries(registry).map(([name, { pg }]) => [name, pg]));
|
|
17471
17502
|
}
|
|
17472
17503
|
function buildSqliteSchema(registry) {
|
|
17473
17504
|
return Object.fromEntries(Object.entries(registry).map(([name, { sqlite }]) => [name, sqlite]));
|
|
@@ -17596,6 +17627,7 @@ const apps = pgTable("apps", {
|
|
|
17596
17627
|
authKind: text$1("auth_kind").$type().notNull(),
|
|
17597
17628
|
oauthScopes: jsonb("oauth_scopes").$type().notNull(),
|
|
17598
17629
|
credentialFields: jsonb("credential_fields").$type().notNull().default({}),
|
|
17630
|
+
credentialScheme: text$1("credential_scheme").$type(),
|
|
17599
17631
|
source: text$1("source").$type().notNull(),
|
|
17600
17632
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
17601
17633
|
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
@@ -17611,6 +17643,7 @@ const appsSqlite = sqliteTable("apps", {
|
|
|
17611
17643
|
authKind: text("auth_kind").$type().notNull(),
|
|
17612
17644
|
oauthScopes: text("oauth_scopes", { mode: "json" }).$type().notNull(),
|
|
17613
17645
|
credentialFields: text("credential_fields", { mode: "json" }).$type().notNull().default({}),
|
|
17646
|
+
credentialScheme: text("credential_scheme").$type(),
|
|
17614
17647
|
source: text("source").$type().notNull(),
|
|
17615
17648
|
createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
17616
17649
|
updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull()
|
|
@@ -18057,7 +18090,7 @@ async function resolveOAuthAccessToken(connection, app, tokenRefresh) {
|
|
|
18057
18090
|
return refreshed.accessToken;
|
|
18058
18091
|
}
|
|
18059
18092
|
//#endregion
|
|
18060
|
-
//#region ../credentials/dist/store-
|
|
18093
|
+
//#region ../credentials/dist/store-Bib92S-M.mjs
|
|
18061
18094
|
function normalizeRow(row) {
|
|
18062
18095
|
const { projectId: _projectId, ...rest } = row;
|
|
18063
18096
|
return rest;
|
|
@@ -18076,6 +18109,9 @@ async function selectCredentialInstanceById$1(id) {
|
|
|
18076
18109
|
async function selectCredentialInstancesForScope$1(appSlug, scopeType, scopeId) {
|
|
18077
18110
|
return (await selectCredentialInstancesForScope(appSlug, scopeType, scopeId)).map(normalizeLocalRow);
|
|
18078
18111
|
}
|
|
18112
|
+
async function touchCredentialInstanceLastUsed$1(id) {
|
|
18113
|
+
await touchCredentialInstanceLastUsed(id);
|
|
18114
|
+
}
|
|
18079
18115
|
//#endregion
|
|
18080
18116
|
//#region ../secrets/dist/index.mjs
|
|
18081
18117
|
const ALGORITHM = "aes-256-gcm";
|
|
@@ -18508,7 +18544,25 @@ function pickInstance(rows, key, consumer) {
|
|
|
18508
18544
|
consumer
|
|
18509
18545
|
});
|
|
18510
18546
|
}
|
|
18547
|
+
/** Throttle window for last-used writes so bursty runs don't hammer the same row. */
|
|
18548
|
+
const LAST_USED_THROTTLE_MS = 6e4;
|
|
18549
|
+
/**
|
|
18550
|
+
* Record that a credential was just resolved. Throttled (skip when touched within
|
|
18551
|
+
* {@link LAST_USED_THROTTLE_MS}) and best-effort: a write failure must never break resolution.
|
|
18552
|
+
*/
|
|
18553
|
+
async function touchLastUsed(row) {
|
|
18554
|
+
const last = row.lastUsedAt?.getTime();
|
|
18555
|
+
if (last !== void 0 && Date.now() - last < LAST_USED_THROTTLE_MS) return;
|
|
18556
|
+
try {
|
|
18557
|
+
await touchCredentialInstanceLastUsed$1(row.id);
|
|
18558
|
+
} catch {}
|
|
18559
|
+
}
|
|
18511
18560
|
async function resolveInstanceValue(row, requirement, backend) {
|
|
18561
|
+
const value = await materializeInstanceValue(row, requirement, backend);
|
|
18562
|
+
await touchLastUsed(row);
|
|
18563
|
+
return value;
|
|
18564
|
+
}
|
|
18565
|
+
async function materializeInstanceValue(row, requirement, backend) {
|
|
18512
18566
|
if (row.authKind === "keystroke") {
|
|
18513
18567
|
if (!row.connectionId) throw new MissingCredentialsError({
|
|
18514
18568
|
key: row.appSlug,
|
|
@@ -19020,4 +19074,4 @@ Object.defineProperty(exports, "zodToJsonSchema", {
|
|
|
19020
19074
|
}
|
|
19021
19075
|
});
|
|
19022
19076
|
|
|
19023
|
-
//# sourceMappingURL=dist-
|
|
19077
|
+
//# sourceMappingURL=dist-CbLrJ50M.cjs.map
|