@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.
Files changed (300) hide show
  1. package/dist/action.cjs +1 -1
  2. package/dist/action.mjs +1 -1
  3. package/dist/agent.cjs +4 -4
  4. package/dist/agent.mjs +3 -3
  5. package/dist/app.cjs +1 -1
  6. package/dist/app.mjs +1 -1
  7. package/dist/{awk2-LA3USKJP-Bsg1yxMI.cjs → awk2-LA3USKJP-XeySM1ul.cjs} +3 -3
  8. package/dist/{awk2-LA3USKJP-Bsg1yxMI.cjs.map → awk2-LA3USKJP-XeySM1ul.cjs.map} +1 -1
  9. package/dist/{base64-C2AIWVNC-CAa6k7ry.cjs → base64-C2AIWVNC-DrPwCXm9.cjs} +2 -2
  10. package/dist/{base64-C2AIWVNC-CAa6k7ry.cjs.map → base64-C2AIWVNC-DrPwCXm9.cjs.map} +1 -1
  11. package/dist/{bash-YZ33HQZQ-D0giTv18.cjs → bash-YZ33HQZQ-BQQtKpnm.cjs} +3 -3
  12. package/dist/{bash-YZ33HQZQ-D0giTv18.cjs.map → bash-YZ33HQZQ-BQQtKpnm.cjs.map} +1 -1
  13. package/dist/{cat-TSFMZVYS-Agr76aCC.cjs → cat-TSFMZVYS-ClWyn05t.cjs} +4 -4
  14. package/dist/{cat-TSFMZVYS-Agr76aCC.cjs.map → cat-TSFMZVYS-ClWyn05t.cjs.map} +1 -1
  15. package/dist/{chunk-2JIPICV3-68V6ZUjO.cjs → chunk-2JIPICV3-BrRGqqh-.cjs} +2 -2
  16. package/dist/{chunk-2JIPICV3-68V6ZUjO.cjs.map → chunk-2JIPICV3-BrRGqqh-.cjs.map} +1 -1
  17. package/dist/{chunk-2VDTE5BV-BQqrRidX.cjs → chunk-2VDTE5BV-DIR6gQHC.cjs} +2 -2
  18. package/dist/{chunk-2VDTE5BV-BQqrRidX.cjs.map → chunk-2VDTE5BV-DIR6gQHC.cjs.map} +1 -1
  19. package/dist/{chunk-46RN27KI-Ix8DoKSJ.cjs → chunk-46RN27KI-CdSJriZa.cjs} +2 -2
  20. package/dist/{chunk-46RN27KI-Ix8DoKSJ.cjs.map → chunk-46RN27KI-CdSJriZa.cjs.map} +1 -1
  21. package/dist/{chunk-4JLVZKHC-DjiHpNEw.cjs → chunk-4JLVZKHC-BHn_tf7f.cjs} +2 -2
  22. package/dist/{chunk-4JLVZKHC-DjiHpNEw.cjs.map → chunk-4JLVZKHC-BHn_tf7f.cjs.map} +1 -1
  23. package/dist/{chunk-4N6J7B5P-DhOH1Syh.cjs → chunk-4N6J7B5P-KYJHQOBl.cjs} +2 -2
  24. package/dist/{chunk-4N6J7B5P-DhOH1Syh.cjs.map → chunk-4N6J7B5P-KYJHQOBl.cjs.map} +1 -1
  25. package/dist/{chunk-5H5SCKJM-Tnv523v9.cjs → chunk-5H5SCKJM-gj2XZLFt.cjs} +2 -2
  26. package/dist/{chunk-5H5SCKJM-Tnv523v9.cjs.map → chunk-5H5SCKJM-gj2XZLFt.cjs.map} +1 -1
  27. package/dist/{chunk-6LASZU3O-D_JFhTJE.cjs → chunk-6LASZU3O-DY4HiL1j.cjs} +2 -2
  28. package/dist/{chunk-6LASZU3O-D_JFhTJE.cjs.map → chunk-6LASZU3O-DY4HiL1j.cjs.map} +1 -1
  29. package/dist/{chunk-6VAT5Z2D-u0kcsLTj.cjs → chunk-6VAT5Z2D-dBFyz7S5.cjs} +3 -3
  30. package/dist/{chunk-6VAT5Z2D-u0kcsLTj.cjs.map → chunk-6VAT5Z2D-dBFyz7S5.cjs.map} +1 -1
  31. package/dist/{chunk-7JHM3L42-mvOABw38.cjs → chunk-7JHM3L42-Ci7VptmU.cjs} +3 -3
  32. package/dist/{chunk-7JHM3L42-mvOABw38.cjs.map → chunk-7JHM3L42-Ci7VptmU.cjs.map} +1 -1
  33. package/dist/{chunk-A4R2GWRF-BGEfai-r.cjs → chunk-A4R2GWRF-Bw0bFSwh.cjs} +2 -2
  34. package/dist/{chunk-A4R2GWRF-BGEfai-r.cjs.map → chunk-A4R2GWRF-Bw0bFSwh.cjs.map} +1 -1
  35. package/dist/{chunk-ACSZB4FE-B0N-X9Dz.cjs → chunk-ACSZB4FE-BcgKmI0V.cjs} +2 -2
  36. package/dist/{chunk-ACSZB4FE-B0N-X9Dz.cjs.map → chunk-ACSZB4FE-BcgKmI0V.cjs.map} +1 -1
  37. package/dist/{chunk-BVKWRAS6-DVtQSbtn.cjs → chunk-BVKWRAS6-BN2MZXW6.cjs} +2 -2
  38. package/dist/{chunk-BVKWRAS6-DVtQSbtn.cjs.map → chunk-BVKWRAS6-BN2MZXW6.cjs.map} +1 -1
  39. package/dist/{chunk-CBJVD2XA-D5HCpyR8.cjs → chunk-CBJVD2XA-DAx-d6Kw.cjs} +2 -2
  40. package/dist/{chunk-CBJVD2XA-D5HCpyR8.cjs.map → chunk-CBJVD2XA-DAx-d6Kw.cjs.map} +1 -1
  41. package/dist/{chunk-EBAPSGAO-D9TSE7uP.cjs → chunk-EBAPSGAO-CTlGCUl5.cjs} +2 -2
  42. package/dist/{chunk-EBAPSGAO-D9TSE7uP.cjs.map → chunk-EBAPSGAO-CTlGCUl5.cjs.map} +1 -1
  43. package/dist/{chunk-FAXLQUCQ-CjMjzZ2I.cjs → chunk-FAXLQUCQ-UipnjfNf.cjs} +2 -2
  44. package/dist/{chunk-FAXLQUCQ-CjMjzZ2I.cjs.map → chunk-FAXLQUCQ-UipnjfNf.cjs.map} +1 -1
  45. package/dist/{chunk-FJK43EBQ-Cuos7IK5.cjs → chunk-FJK43EBQ-3PnBCRo8.cjs} +2 -2
  46. package/dist/{chunk-FJK43EBQ-Cuos7IK5.cjs.map → chunk-FJK43EBQ-3PnBCRo8.cjs.map} +1 -1
  47. package/dist/{chunk-FW54FHZR-DLKAjtJl.cjs → chunk-FW54FHZR-CqDpu94r.cjs} +2 -2
  48. package/dist/{chunk-FW54FHZR-DLKAjtJl.cjs.map → chunk-FW54FHZR-CqDpu94r.cjs.map} +1 -1
  49. package/dist/{chunk-FX7KQCEA-Bk2TXrav.cjs → chunk-FX7KQCEA-DoYP2gf4.cjs} +2 -2
  50. package/dist/{chunk-FX7KQCEA-Bk2TXrav.cjs.map → chunk-FX7KQCEA-DoYP2gf4.cjs.map} +1 -1
  51. package/dist/{chunk-FZRQOL3C-CendgWMm.cjs → chunk-FZRQOL3C-3p1BNqqw.cjs} +2 -2
  52. package/dist/{chunk-FZRQOL3C-CendgWMm.cjs.map → chunk-FZRQOL3C-3p1BNqqw.cjs.map} +1 -1
  53. package/dist/{chunk-GGC5NEPZ-CAGLViKl.cjs → chunk-GGC5NEPZ-D_pB4XbU.cjs} +2 -2
  54. package/dist/{chunk-GGC5NEPZ-CAGLViKl.cjs.map → chunk-GGC5NEPZ-D_pB4XbU.cjs.map} +1 -1
  55. package/dist/{chunk-GIUR5SNU-DoYdeYwo.cjs → chunk-GIUR5SNU-xqqqaFfL.cjs} +2 -2
  56. package/dist/{chunk-GIUR5SNU-DoYdeYwo.cjs.map → chunk-GIUR5SNU-xqqqaFfL.cjs.map} +1 -1
  57. package/dist/{chunk-GJC3WVOW-e51hHrUv.cjs → chunk-GJC3WVOW-CpcIL9Y6.cjs} +2 -2
  58. package/dist/{chunk-GJC3WVOW-e51hHrUv.cjs.map → chunk-GJC3WVOW-CpcIL9Y6.cjs.map} +1 -1
  59. package/dist/{chunk-GSPYNYZA-BFTwDcSE.cjs → chunk-GSPYNYZA-COw3VUno.cjs} +2 -2
  60. package/dist/{chunk-GSPYNYZA-BFTwDcSE.cjs.map → chunk-GSPYNYZA-COw3VUno.cjs.map} +1 -1
  61. package/dist/{chunk-GTQIUQM6-BJ3uRl49.cjs → chunk-GTQIUQM6-DWT0sKaX.cjs} +2 -2
  62. package/dist/{chunk-GTQIUQM6-BJ3uRl49.cjs.map → chunk-GTQIUQM6-DWT0sKaX.cjs.map} +1 -1
  63. package/dist/{chunk-HJBTD7PY-BrF_3AqA.cjs → chunk-HJBTD7PY-CKZQpc_h.cjs} +2 -2
  64. package/dist/{chunk-HJBTD7PY-BrF_3AqA.cjs.map → chunk-HJBTD7PY-CKZQpc_h.cjs.map} +1 -1
  65. package/dist/{chunk-ICIEVHY5-DwD_mBxQ.cjs → chunk-ICIEVHY5-Cw2mPFoM.cjs} +3 -3
  66. package/dist/{chunk-ICIEVHY5-DwD_mBxQ.cjs.map → chunk-ICIEVHY5-Cw2mPFoM.cjs.map} +1 -1
  67. package/dist/{chunk-KD3KENL6-Cjqq9zgg.cjs → chunk-KD3KENL6-BA94hNks.cjs} +2 -2
  68. package/dist/{chunk-KD3KENL6-Cjqq9zgg.cjs.map → chunk-KD3KENL6-BA94hNks.cjs.map} +1 -1
  69. package/dist/{chunk-LEKBROJD-Dan-FkfJ.cjs → chunk-LEKBROJD-D6BOe6FQ.cjs} +2 -2
  70. package/dist/{chunk-LEKBROJD-Dan-FkfJ.cjs.map → chunk-LEKBROJD-D6BOe6FQ.cjs.map} +1 -1
  71. package/dist/{chunk-LNBPBRV4-i9oD7RNK.cjs → chunk-LNBPBRV4-spqBTlMR.cjs} +2 -2
  72. package/dist/{chunk-LNBPBRV4-i9oD7RNK.cjs.map → chunk-LNBPBRV4-spqBTlMR.cjs.map} +1 -1
  73. package/dist/{chunk-LPJEKUCB-D2Vshvt5.cjs → chunk-LPJEKUCB-DOgg2opJ.cjs} +2 -2
  74. package/dist/{chunk-LPJEKUCB-D2Vshvt5.cjs.map → chunk-LPJEKUCB-DOgg2opJ.cjs.map} +1 -1
  75. package/dist/{chunk-MLIO3BK2-8o-YWlna.cjs → chunk-MLIO3BK2-C8YjN7y9.cjs} +2 -2
  76. package/dist/{chunk-MLIO3BK2-8o-YWlna.cjs.map → chunk-MLIO3BK2-C8YjN7y9.cjs.map} +1 -1
  77. package/dist/{chunk-MQKGGNPS-DYzifY7S.cjs → chunk-MQKGGNPS-0LEqz-xf.cjs} +2 -2
  78. package/dist/{chunk-MQKGGNPS-DYzifY7S.cjs.map → chunk-MQKGGNPS-0LEqz-xf.cjs.map} +1 -1
  79. package/dist/{chunk-MZFCCXPZ-Cnv2B_Hu.cjs → chunk-MZFCCXPZ-C2-OqnUD.cjs} +2 -2
  80. package/dist/{chunk-MZFCCXPZ-Cnv2B_Hu.cjs.map → chunk-MZFCCXPZ-C2-OqnUD.cjs.map} +1 -1
  81. package/dist/{chunk-N6DXJ2JN-KqAa8cwh.cjs → chunk-N6DXJ2JN-C-D4d95Q.cjs} +3 -3
  82. package/dist/{chunk-N6DXJ2JN-KqAa8cwh.cjs.map → chunk-N6DXJ2JN-C-D4d95Q.cjs.map} +1 -1
  83. package/dist/{chunk-OVGANXCG-Dw-aZ-C-.cjs → chunk-OVGANXCG-CSxkKDAs.cjs} +2 -2
  84. package/dist/{chunk-OVGANXCG-Dw-aZ-C-.cjs.map → chunk-OVGANXCG-CSxkKDAs.cjs.map} +1 -1
  85. package/dist/{chunk-Q7H5W7YE-Dpax_RCC.cjs → chunk-Q7H5W7YE-InWpKZY5.cjs} +5 -5
  86. package/dist/{chunk-Q7H5W7YE-Dpax_RCC.cjs.map → chunk-Q7H5W7YE-InWpKZY5.cjs.map} +1 -1
  87. package/dist/{chunk-R74UQCKX-EZdevyKE.cjs → chunk-R74UQCKX-B8n0-8sL.cjs} +2 -2
  88. package/dist/{chunk-R74UQCKX-EZdevyKE.cjs.map → chunk-R74UQCKX-B8n0-8sL.cjs.map} +1 -1
  89. package/dist/{chunk-S3LEJEPP-BsUig8Jg.cjs → chunk-S3LEJEPP-Cx4wRlId.cjs} +2 -2
  90. package/dist/{chunk-S3LEJEPP-BsUig8Jg.cjs.map → chunk-S3LEJEPP-Cx4wRlId.cjs.map} +1 -1
  91. package/dist/{chunk-S443BAN4-CusYVjOU.cjs → chunk-S443BAN4-CK4Jd3Wr.cjs} +2 -2
  92. package/dist/{chunk-S443BAN4-CusYVjOU.cjs.map → chunk-S443BAN4-CK4Jd3Wr.cjs.map} +1 -1
  93. package/dist/{chunk-SJYEXC2Z-Cn51vvkR.cjs → chunk-SJYEXC2Z-DeDkIz68.cjs} +2 -2
  94. package/dist/{chunk-SJYEXC2Z-Cn51vvkR.cjs.map → chunk-SJYEXC2Z-DeDkIz68.cjs.map} +1 -1
  95. package/dist/{chunk-T4TFLF3R-CHr2VGrs.cjs → chunk-T4TFLF3R-CM1rHZ8N.cjs} +3 -3
  96. package/dist/{chunk-T4TFLF3R-CHr2VGrs.cjs.map → chunk-T4TFLF3R-CM1rHZ8N.cjs.map} +1 -1
  97. package/dist/{chunk-U73A73IE-DyTD9Bif.cjs → chunk-U73A73IE-D99RG5Wc.cjs} +2 -2
  98. package/dist/{chunk-U73A73IE-DyTD9Bif.cjs.map → chunk-U73A73IE-D99RG5Wc.cjs.map} +1 -1
  99. package/dist/{chunk-UP6MSJGD-BDPikXkp.cjs → chunk-UP6MSJGD-GmcmfQft.cjs} +2 -2
  100. package/dist/{chunk-UP6MSJGD-BDPikXkp.cjs.map → chunk-UP6MSJGD-GmcmfQft.cjs.map} +1 -1
  101. package/dist/{chunk-VLCHOJWK-syZp3Vmw.cjs → chunk-VLCHOJWK-DLOEC7xs.cjs} +3 -3
  102. package/dist/{chunk-VLCHOJWK-syZp3Vmw.cjs.map → chunk-VLCHOJWK-DLOEC7xs.cjs.map} +1 -1
  103. package/dist/{chunk-WVRWIZF5-DsIdQVnx.cjs → chunk-WVRWIZF5-B5z8SbAq.cjs} +3 -2
  104. package/dist/{chunk-WVRWIZF5-DsIdQVnx.cjs.map → chunk-WVRWIZF5-B5z8SbAq.cjs.map} +1 -1
  105. package/dist/{chunk-XCQWV4AU-DRpOqSMs.cjs → chunk-XCQWV4AU-BMG-IH_J.cjs} +2 -2
  106. package/dist/{chunk-XCQWV4AU-DRpOqSMs.cjs.map → chunk-XCQWV4AU-BMG-IH_J.cjs.map} +1 -1
  107. package/dist/{chunk-XDGLKIHR-SUFrvh5B.cjs → chunk-XDGLKIHR-BuEIWoRU.cjs} +2 -2
  108. package/dist/{chunk-XDGLKIHR-SUFrvh5B.cjs.map → chunk-XDGLKIHR-BuEIWoRU.cjs.map} +1 -1
  109. package/dist/{chunk-XHLMAZX2-DiuICHhP.cjs → chunk-XHLMAZX2-iZ14pqog.cjs} +2 -2
  110. package/dist/{chunk-XHLMAZX2-DiuICHhP.cjs.map → chunk-XHLMAZX2-iZ14pqog.cjs.map} +1 -1
  111. package/dist/{chunk-XYXUMFSU-D9CT51kI.cjs → chunk-XYXUMFSU-BeZU9dGd.cjs} +4 -4
  112. package/dist/{chunk-XYXUMFSU-D9CT51kI.cjs.map → chunk-XYXUMFSU-BeZU9dGd.cjs.map} +1 -1
  113. package/dist/{chunk-YCLFEX4T-DtyEjr9g.cjs → chunk-YCLFEX4T-BZYE_CVn.cjs} +2 -2
  114. package/dist/{chunk-YCLFEX4T-DtyEjr9g.cjs.map → chunk-YCLFEX4T-BZYE_CVn.cjs.map} +1 -1
  115. package/dist/{chunk-YS4NUBYX-7Ku8CDer.cjs → chunk-YS4NUBYX-BWAuwW1l.cjs} +2 -2
  116. package/dist/{chunk-YS4NUBYX-7Ku8CDer.cjs.map → chunk-YS4NUBYX-BWAuwW1l.cjs.map} +1 -1
  117. package/dist/{chunk-ZDIT6ST5-6YvPqwJ7.cjs → chunk-ZDIT6ST5-mgVtGdzi.cjs} +2 -2
  118. package/dist/{chunk-ZDIT6ST5-6YvPqwJ7.cjs.map → chunk-ZDIT6ST5-mgVtGdzi.cjs.map} +1 -1
  119. package/dist/{chunk-ZZKH2ELC-BxZGGGBF.cjs → chunk-ZZKH2ELC-IqguEy81.cjs} +2 -2
  120. package/dist/{chunk-ZZKH2ELC-BxZGGGBF.cjs.map → chunk-ZZKH2ELC-IqguEy81.cjs.map} +1 -1
  121. package/dist/client.cjs +33 -8
  122. package/dist/client.cjs.map +1 -1
  123. package/dist/client.d.cts.map +1 -1
  124. package/dist/client.d.mts.map +1 -1
  125. package/dist/client.mjs +33 -8
  126. package/dist/client.mjs.map +1 -1
  127. package/dist/{column-XT6UFXNQ-CXUm4HFt.cjs → column-XT6UFXNQ-D2u-CrDc.cjs} +3 -3
  128. package/dist/{column-XT6UFXNQ-CXUm4HFt.cjs.map → column-XT6UFXNQ-D2u-CrDc.cjs.map} +1 -1
  129. package/dist/{comm-VV2LDX2J-BARQTdLU.cjs → comm-VV2LDX2J-Yy42VYO9.cjs} +3 -3
  130. package/dist/{comm-VV2LDX2J-BARQTdLU.cjs.map → comm-VV2LDX2J-Yy42VYO9.cjs.map} +1 -1
  131. package/dist/config.d.cts +4 -3
  132. package/dist/config.d.cts.map +1 -1
  133. package/dist/config.d.mts +4 -3
  134. package/dist/config.d.mts.map +1 -1
  135. package/dist/{cp-BISAAS7A-BoFio3Zq.cjs → cp-BISAAS7A-XSnvjsGB.cjs} +3 -3
  136. package/dist/{cp-BISAAS7A-BoFio3Zq.cjs.map → cp-BISAAS7A-XSnvjsGB.cjs.map} +1 -1
  137. package/dist/credentials.cjs +1 -1
  138. package/dist/credentials.mjs +1 -1
  139. package/dist/{curl-LV5Y3AMS-Cdx6P1bc.cjs → curl-LV5Y3AMS-9HTFdNV4.cjs} +2 -2
  140. package/dist/{curl-LV5Y3AMS-Cdx6P1bc.cjs.map → curl-LV5Y3AMS-9HTFdNV4.cjs.map} +1 -1
  141. package/dist/{cut-OKARJCCV-DDw10hRu.cjs → cut-OKARJCCV-BkQDHldN.cjs} +4 -4
  142. package/dist/{cut-OKARJCCV-DDw10hRu.cjs.map → cut-OKARJCCV-BkQDHldN.cjs.map} +1 -1
  143. package/dist/{diff-MWJFIG7X-NvtUFxir.cjs → diff-MWJFIG7X-BHO0AB7d.cjs} +3 -3
  144. package/dist/{diff-MWJFIG7X-NvtUFxir.cjs.map → diff-MWJFIG7X-BHO0AB7d.cjs.map} +1 -1
  145. package/dist/{dist-D-5MaYYx.cjs → dist-CE8Bys_M.cjs} +227 -11
  146. package/dist/dist-CE8Bys_M.cjs.map +1 -0
  147. package/dist/{dist-DyZkmfD4.mjs → dist-CYP5TXGO.mjs} +3 -3
  148. package/dist/{dist-DyZkmfD4.mjs.map → dist-CYP5TXGO.mjs.map} +1 -1
  149. package/dist/{dist-ubYcMOAC.cjs → dist-CbLrJ50M.cjs} +102 -48
  150. package/dist/dist-CbLrJ50M.cjs.map +1 -0
  151. package/dist/{dist-B6Dt7UbH.cjs → dist-CwfjWo4B.cjs} +3 -3
  152. package/dist/{dist-B6Dt7UbH.cjs.map → dist-CwfjWo4B.cjs.map} +1 -1
  153. package/dist/{dist-Brxtvkcs.mjs → dist-DN31JPna.mjs} +100 -46
  154. package/dist/dist-DN31JPna.mjs.map +1 -0
  155. package/dist/{dist-DO51rYHS.cjs → dist-DqOzVzWO.cjs} +76 -76
  156. package/dist/{dist-DO51rYHS.cjs.map → dist-DqOzVzWO.cjs.map} +1 -1
  157. package/dist/{dist-B2xZReHP.mjs → dist-Kz_xVVMR.mjs} +216 -12
  158. package/dist/dist-Kz_xVVMR.mjs.map +1 -0
  159. package/dist/{du-572XNP42-dDEEbTX1.cjs → du-572XNP42-Ci5n1Ogx.cjs} +2 -2
  160. package/dist/{du-572XNP42-dDEEbTX1.cjs.map → du-572XNP42-Ci5n1Ogx.cjs.map} +1 -1
  161. package/dist/{env-36M5BO7M-BAXuvwk7.cjs → env-36M5BO7M-BenXvlK4.cjs} +3 -3
  162. package/dist/{env-36M5BO7M-BAXuvwk7.cjs.map → env-36M5BO7M-BenXvlK4.cjs.map} +1 -1
  163. package/dist/{expand-JSPG6VOP-CeMMDAbH.cjs → expand-JSPG6VOP-CjkEn3pX.cjs} +3 -3
  164. package/dist/{expand-JSPG6VOP-CeMMDAbH.cjs.map → expand-JSPG6VOP-CjkEn3pX.cjs.map} +1 -1
  165. package/dist/{expansion-R25BK4W3-km42UsJs.cjs → expansion-R25BK4W3-DZdAzRFy.cjs} +2 -2
  166. package/dist/{expansion-R25BK4W3-km42UsJs.cjs.map → expansion-R25BK4W3-DZdAzRFy.cjs.map} +1 -1
  167. package/dist/{expr-5JAACS4X-DN6RUYi_.cjs → expr-5JAACS4X-BE97Pj1C.cjs} +3 -3
  168. package/dist/{expr-5JAACS4X-DN6RUYi_.cjs.map → expr-5JAACS4X-BE97Pj1C.cjs.map} +1 -1
  169. package/dist/{file-IPZJC3FQ-D8YmozYf.cjs → file-IPZJC3FQ-BHvdw59X.cjs} +2 -2
  170. package/dist/{file-IPZJC3FQ-D8YmozYf.cjs.map → file-IPZJC3FQ-BHvdw59X.cjs.map} +1 -1
  171. package/dist/{find-INTH3OLC-cCsh7QUd.cjs → find-INTH3OLC-CBMMzyRQ.cjs} +3 -3
  172. package/dist/{find-INTH3OLC-cCsh7QUd.cjs.map → find-INTH3OLC-CBMMzyRQ.cjs.map} +1 -1
  173. package/dist/{flag-coverage-XWSYNE72-xsiUZ2Uv.cjs → flag-coverage-XWSYNE72-TZpcGHnc.cjs} +54 -54
  174. package/dist/{flag-coverage-XWSYNE72-xsiUZ2Uv.cjs.map → flag-coverage-XWSYNE72-TZpcGHnc.cjs.map} +1 -1
  175. package/dist/{fold-4TQNYMSW-BgRS35yE.cjs → fold-4TQNYMSW-CgFJiPKu.cjs} +3 -3
  176. package/dist/{fold-4TQNYMSW-BgRS35yE.cjs.map → fold-4TQNYMSW-CgFJiPKu.cjs.map} +1 -1
  177. package/dist/{grep-V3LQVMRQ-D-wFiXtO.cjs → grep-V3LQVMRQ-DK2kayRm.cjs} +3 -3
  178. package/dist/{grep-V3LQVMRQ-D-wFiXtO.cjs.map → grep-V3LQVMRQ-DK2kayRm.cjs.map} +1 -1
  179. package/dist/{gzip-O5ASJAFY-lhZQgzvc.cjs → gzip-O5ASJAFY-CjSYBejX.cjs} +2 -2
  180. package/dist/{gzip-O5ASJAFY-lhZQgzvc.cjs.map → gzip-O5ASJAFY-CjSYBejX.cjs.map} +1 -1
  181. package/dist/{head-442HYESI-wfQsPgRD.cjs → head-442HYESI-CJR7SSlN.cjs} +2 -2
  182. package/dist/{head-442HYESI-wfQsPgRD.cjs.map → head-442HYESI-CJR7SSlN.cjs.map} +1 -1
  183. package/dist/{help-HZ6M2CKN-CvhvGBWT.cjs → help-HZ6M2CKN-CjWNE4rI.cjs} +3 -3
  184. package/dist/{help-HZ6M2CKN-CvhvGBWT.cjs.map → help-HZ6M2CKN-CjWNE4rI.cjs.map} +1 -1
  185. package/dist/{html-to-markdown-JW4MSQZO-DYP7i3n_.cjs → html-to-markdown-JW4MSQZO-BE1zSBBb.cjs} +3 -3
  186. package/dist/{html-to-markdown-JW4MSQZO-DYP7i3n_.cjs.map → html-to-markdown-JW4MSQZO-BE1zSBBb.cjs.map} +1 -1
  187. package/dist/index-BTz2OMAM.d.cts.map +1 -1
  188. package/dist/index-Cq2F2XdS.d.mts.map +1 -1
  189. package/dist/index-WT4ULMiw.d.cts.map +1 -1
  190. package/dist/index-WT4ULMiw.d.mts.map +1 -1
  191. package/dist/{join-TBRGI3LQ-bHNmcV0E.cjs → join-TBRGI3LQ-pEfJS23I.cjs} +3 -3
  192. package/dist/{join-TBRGI3LQ-bHNmcV0E.cjs.map → join-TBRGI3LQ-pEfJS23I.cjs.map} +1 -1
  193. package/dist/{jq-4XLYLOS5-DJJGyuG8.cjs → jq-4XLYLOS5-2vuSbClV.cjs} +5 -5
  194. package/dist/{jq-4XLYLOS5-DJJGyuG8.cjs.map → jq-4XLYLOS5-2vuSbClV.cjs.map} +1 -1
  195. package/dist/{js-exec-N5KEZBH7-D4Lzs88c.cjs → js-exec-N5KEZBH7-aU0Z-PSz.cjs} +4 -4
  196. package/dist/{js-exec-N5KEZBH7-D4Lzs88c.cjs.map → js-exec-N5KEZBH7-aU0Z-PSz.cjs.map} +1 -1
  197. package/dist/{ln-4LGSXXGD-Dea9eT1o.cjs → ln-4LGSXXGD-YmC44ShY.cjs} +3 -3
  198. package/dist/{ln-4LGSXXGD-Dea9eT1o.cjs.map → ln-4LGSXXGD-YmC44ShY.cjs.map} +1 -1
  199. package/dist/{ls-ZJGQER7M-D3JTk2Ir.cjs → ls-ZJGQER7M-C1sbxE97.cjs} +2 -2
  200. package/dist/{ls-ZJGQER7M-D3JTk2Ir.cjs.map → ls-ZJGQER7M-C1sbxE97.cjs.map} +1 -1
  201. package/dist/{lzma-B-M5XH2f.cjs → lzma-BKh11ciM.cjs} +2 -2
  202. package/dist/{lzma-B-M5XH2f.cjs.map → lzma-BKh11ciM.cjs.map} +1 -1
  203. package/dist/{md5sum-SPU24VSG-Bgoo_S_9.cjs → md5sum-SPU24VSG-b5Te6zur.cjs} +4 -4
  204. package/dist/{md5sum-SPU24VSG-Bgoo_S_9.cjs.map → md5sum-SPU24VSG-b5Te6zur.cjs.map} +1 -1
  205. package/dist/{microsandbox-CFgApCam-BbimRbAs.cjs → microsandbox-CFgApCam-DfQPNLy0.cjs} +3 -3
  206. package/dist/{microsandbox-CFgApCam-BbimRbAs.cjs.map → microsandbox-CFgApCam-DfQPNLy0.cjs.map} +1 -1
  207. package/dist/{mistral-D8-c0BKD.cjs → mistral-BrDQAJSw.cjs} +2 -2
  208. package/dist/{mistral-D8-c0BKD.cjs.map → mistral-BrDQAJSw.cjs.map} +1 -1
  209. package/dist/{mistral-BsgTgXrv.mjs → mistral-j9b3vM0i.mjs} +2 -2
  210. package/dist/{mistral-BsgTgXrv.mjs.map → mistral-j9b3vM0i.mjs.map} +1 -1
  211. package/dist/{mkdir-MEPGZOB6-C92GPZZj.cjs → mkdir-MEPGZOB6-7B2tAIJv.cjs} +3 -3
  212. package/dist/{mkdir-MEPGZOB6-C92GPZZj.cjs.map → mkdir-MEPGZOB6-7B2tAIJv.cjs.map} +1 -1
  213. package/dist/{mv-W5BIQ646-C6uESvHR.cjs → mv-W5BIQ646-yyXc-Ujb.cjs} +3 -3
  214. package/dist/{mv-W5BIQ646-C6uESvHR.cjs.map → mv-W5BIQ646-yyXc-Ujb.cjs.map} +1 -1
  215. package/dist/{nl-WSDW7I4O-WUHtx6ar.cjs → nl-WSDW7I4O-DsbEGL-D.cjs} +3 -3
  216. package/dist/{nl-WSDW7I4O-WUHtx6ar.cjs.map → nl-WSDW7I4O-DsbEGL-D.cjs.map} +1 -1
  217. package/dist/{od-WOKFDJTP-DZ_PhGba.cjs → od-WOKFDJTP-DjE2_lCr.cjs} +3 -3
  218. package/dist/{od-WOKFDJTP-DZ_PhGba.cjs.map → od-WOKFDJTP-DjE2_lCr.cjs.map} +1 -1
  219. package/dist/{paste-7JC6S4DX-BNnL5s0G.cjs → paste-7JC6S4DX-DmPxl6a5.cjs} +3 -3
  220. package/dist/{paste-7JC6S4DX-BNnL5s0G.cjs.map → paste-7JC6S4DX-DmPxl6a5.cjs.map} +1 -1
  221. package/dist/{printf-TWGXF445-DGYRYvFv.cjs → printf-TWGXF445-B3BKBgxE.cjs} +3 -3
  222. package/dist/{printf-TWGXF445-DGYRYvFv.cjs.map → printf-TWGXF445-B3BKBgxE.cjs.map} +1 -1
  223. package/dist/{python3-POMOR4OA-UrjbAdgU.cjs → python3-POMOR4OA-BP_CZEWk.cjs} +4 -4
  224. package/dist/{python3-POMOR4OA-UrjbAdgU.cjs.map → python3-POMOR4OA-BP_CZEWk.cjs.map} +1 -1
  225. package/dist/{rev-5EHFX4EJ-C6bEospo.cjs → rev-5EHFX4EJ-DAakI-6k.cjs} +3 -3
  226. package/dist/{rev-5EHFX4EJ-C6bEospo.cjs.map → rev-5EHFX4EJ-DAakI-6k.cjs.map} +1 -1
  227. package/dist/{rg-S4FXYXWB-eo-s3QO6.cjs → rg-S4FXYXWB-DEomHCwR.cjs} +3 -3
  228. package/dist/{rg-S4FXYXWB-eo-s3QO6.cjs.map → rg-S4FXYXWB-DEomHCwR.cjs.map} +1 -1
  229. package/dist/{rm-SSGETQVQ-pVbmfXAZ.cjs → rm-SSGETQVQ-DdpxhvsO.cjs} +3 -3
  230. package/dist/{rm-SSGETQVQ-pVbmfXAZ.cjs.map → rm-SSGETQVQ-DdpxhvsO.cjs.map} +1 -1
  231. package/dist/{rmdir-OC4ZLPYA-joHTq5dL.cjs → rmdir-OC4ZLPYA-BZhaWGT-.cjs} +3 -3
  232. package/dist/{rmdir-OC4ZLPYA-joHTq5dL.cjs.map → rmdir-OC4ZLPYA-BZhaWGT-.cjs.map} +1 -1
  233. package/dist/sandbox.cjs +1 -1
  234. package/dist/{sed-S5UIK574-CjEsIkX0.cjs → sed-S5UIK574-CI-fUrPh.cjs} +3 -3
  235. package/dist/{sed-S5UIK574-CjEsIkX0.cjs.map → sed-S5UIK574-CI-fUrPh.cjs.map} +1 -1
  236. package/dist/{sha1sum-2PTOAFR6-Zxn2YEQ7.cjs → sha1sum-2PTOAFR6-CAJd2y1J.cjs} +4 -4
  237. package/dist/{sha1sum-2PTOAFR6-Zxn2YEQ7.cjs.map → sha1sum-2PTOAFR6-CAJd2y1J.cjs.map} +1 -1
  238. package/dist/{sha256sum-NS7D3IXX-D2UBSHMT.cjs → sha256sum-NS7D3IXX-CPZ2P-c1.cjs} +4 -4
  239. package/dist/{sha256sum-NS7D3IXX-D2UBSHMT.cjs.map → sha256sum-NS7D3IXX-CPZ2P-c1.cjs.map} +1 -1
  240. package/dist/{sleep-X22JJINO-Dw3qJ3u5.cjs → sleep-X22JJINO-B76R-Pss.cjs} +3 -3
  241. package/dist/{sleep-X22JJINO-Dw3qJ3u5.cjs.map → sleep-X22JJINO-B76R-Pss.cjs.map} +1 -1
  242. package/dist/{sort-SW2YEO5B-CY3xZvLH.cjs → sort-SW2YEO5B-CZdvp6Km.cjs} +4 -4
  243. package/dist/{sort-SW2YEO5B-CY3xZvLH.cjs.map → sort-SW2YEO5B-CZdvp6Km.cjs.map} +1 -1
  244. package/dist/{split-4KKZZXXE-C0nde5vb.cjs → split-4KKZZXXE-B5lroooe.cjs} +3 -3
  245. package/dist/{split-4KKZZXXE-C0nde5vb.cjs.map → split-4KKZZXXE-B5lroooe.cjs.map} +1 -1
  246. package/dist/{sqlite3-CGOEFJAO-DEljm7cX.cjs → sqlite3-CGOEFJAO-PLMgG_Q5.cjs} +3 -3
  247. package/dist/{sqlite3-CGOEFJAO-DEljm7cX.cjs.map → sqlite3-CGOEFJAO-PLMgG_Q5.cjs.map} +1 -1
  248. package/dist/{sse-uALvPXss.mjs → sse-DUu9Naud.mjs} +2 -2
  249. package/dist/{sse-uALvPXss.mjs.map → sse-DUu9Naud.mjs.map} +1 -1
  250. package/dist/{sse-iAjqagFU.cjs → sse-DaIihZIC.cjs} +2 -2
  251. package/dist/{sse-iAjqagFU.cjs.map → sse-DaIihZIC.cjs.map} +1 -1
  252. package/dist/{strings-6WDHLGMX-h7oJ16OF.cjs → strings-6WDHLGMX-BrcsGUuA.cjs} +2 -2
  253. package/dist/{strings-6WDHLGMX-h7oJ16OF.cjs.map → strings-6WDHLGMX-BrcsGUuA.cjs.map} +1 -1
  254. package/dist/{tac-2STMMJYW-BtWvKy2f.cjs → tac-2STMMJYW-B9Oin-rx.cjs} +2 -2
  255. package/dist/{tac-2STMMJYW-BtWvKy2f.cjs.map → tac-2STMMJYW-B9Oin-rx.cjs.map} +1 -1
  256. package/dist/{tail-R4PCA2C4-BU60h82S.cjs → tail-R4PCA2C4-CFsgIEI9.cjs} +2 -2
  257. package/dist/{tail-R4PCA2C4-BU60h82S.cjs.map → tail-R4PCA2C4-CFsgIEI9.cjs.map} +1 -1
  258. package/dist/{tar-STHHZTZ6-qjKeyHOT.cjs → tar-STHHZTZ6-gaTqCHHf.cjs} +3 -3
  259. package/dist/{tar-STHHZTZ6-qjKeyHOT.cjs.map → tar-STHHZTZ6-gaTqCHHf.cjs.map} +1 -1
  260. package/dist/{tee-YUZ2FKCJ-BFNL3v2H.cjs → tee-YUZ2FKCJ-DrbSvUds.cjs} +2 -2
  261. package/dist/{tee-YUZ2FKCJ-BFNL3v2H.cjs.map → tee-YUZ2FKCJ-DrbSvUds.cjs.map} +1 -1
  262. package/dist/{time-D4LNBSWX-C4MkGGMR.cjs → time-D4LNBSWX-Ct8F4-NH.cjs} +3 -3
  263. package/dist/{time-D4LNBSWX-C4MkGGMR.cjs.map → time-D4LNBSWX-Ct8F4-NH.cjs.map} +1 -1
  264. package/dist/{timeout-YDCRSLPQ-B0LndT3y.cjs → timeout-YDCRSLPQ-D7PLQA8X.cjs} +3 -3
  265. package/dist/{timeout-YDCRSLPQ-B0LndT3y.cjs.map → timeout-YDCRSLPQ-D7PLQA8X.cjs.map} +1 -1
  266. package/dist/{touch-UA33VN3N-ChlyRE9Q.cjs → touch-UA33VN3N-uwgwvBAt.cjs} +3 -3
  267. package/dist/{touch-UA33VN3N-ChlyRE9Q.cjs.map → touch-UA33VN3N-uwgwvBAt.cjs.map} +1 -1
  268. package/dist/{tr-36LHWFRQ-BTAACzqK.cjs → tr-36LHWFRQ-Ddbm-R1a.cjs} +3 -3
  269. package/dist/{tr-36LHWFRQ-BTAACzqK.cjs.map → tr-36LHWFRQ-Ddbm-R1a.cjs.map} +1 -1
  270. package/dist/{tree-YLD52CNT-BwNhql16.cjs → tree-YLD52CNT-CxN8fkK7.cjs} +2 -2
  271. package/dist/{tree-YLD52CNT-BwNhql16.cjs.map → tree-YLD52CNT-CxN8fkK7.cjs.map} +1 -1
  272. package/dist/trigger.cjs +68 -12
  273. package/dist/trigger.cjs.map +1 -1
  274. package/dist/trigger.d.cts +29 -5
  275. package/dist/trigger.d.cts.map +1 -1
  276. package/dist/trigger.d.mts +29 -5
  277. package/dist/trigger.d.mts.map +1 -1
  278. package/dist/trigger.mjs +66 -13
  279. package/dist/trigger.mjs.map +1 -1
  280. package/dist/{unexpand-CADSA4VO-rkuYIkQz.cjs → unexpand-CADSA4VO-DDe4J1y5.cjs} +3 -3
  281. package/dist/{unexpand-CADSA4VO-rkuYIkQz.cjs.map → unexpand-CADSA4VO-DDe4J1y5.cjs.map} +1 -1
  282. package/dist/{uniq-XSIZR6PB-DhpovdZb.cjs → uniq-XSIZR6PB-Cp2d_Goe.cjs} +4 -4
  283. package/dist/{uniq-XSIZR6PB-DhpovdZb.cjs.map → uniq-XSIZR6PB-Cp2d_Goe.cjs.map} +1 -1
  284. package/dist/{wc-LF7NU4LA-wQgdjpdx.cjs → wc-LF7NU4LA-BRf69_3M.cjs} +4 -4
  285. package/dist/{wc-LF7NU4LA-wQgdjpdx.cjs.map → wc-LF7NU4LA-BRf69_3M.cjs.map} +1 -1
  286. package/dist/workflow.cjs +1 -1
  287. package/dist/workflow.mjs +1 -1
  288. package/dist/{xan-Y6WF3IRG-CMqV7U0I.cjs → xan-Y6WF3IRG-CDOh5uPZ.cjs} +5 -5
  289. package/dist/{xan-Y6WF3IRG-CMqV7U0I.cjs.map → xan-Y6WF3IRG-CDOh5uPZ.cjs.map} +1 -1
  290. package/dist/{xan-view-HDVKHFC2-DLpnDKhQ.cjs → xan-view-HDVKHFC2-BlBCPKgW.cjs} +3 -3
  291. package/dist/{xan-view-HDVKHFC2-DLpnDKhQ.cjs.map → xan-view-HDVKHFC2-BlBCPKgW.cjs.map} +1 -1
  292. package/dist/{xargs-MGZPH7AX-d_x__ghK.cjs → xargs-MGZPH7AX-CjfUpqN_.cjs} +3 -3
  293. package/dist/{xargs-MGZPH7AX-d_x__ghK.cjs.map → xargs-MGZPH7AX-CjfUpqN_.cjs.map} +1 -1
  294. package/dist/{yq-4QJW3EQG-CDSPxkds.cjs → yq-4QJW3EQG-BRt0uAiw.cjs} +4 -4
  295. package/dist/{yq-4QJW3EQG-CDSPxkds.cjs.map → yq-4QJW3EQG-BRt0uAiw.cjs.map} +1 -1
  296. package/package.json +1 -1
  297. package/dist/dist-B2xZReHP.mjs.map +0 -1
  298. package/dist/dist-Brxtvkcs.mjs.map +0 -1
  299. package/dist/dist-D-5MaYYx.cjs.map +0 -1
  300. package/dist/dist-ubYcMOAC.cjs.map +0 -1
@@ -1,5 +1,5 @@
1
- const require_dist = require("./dist-D-5MaYYx.cjs");
2
- const require_dist$1 = require("./dist-ubYcMOAC.cjs");
1
+ const require_dist = require("./dist-CE8Bys_M.cjs");
2
+ const require_dist$1 = require("./dist-CbLrJ50M.cjs");
3
3
  let zod = require("zod");
4
4
  let node_async_hooks = require("node:async_hooks");
5
5
  //#region ../workflow/dist/index.mjs
@@ -600,4 +600,4 @@ Object.defineProperty(exports, "serializeWorkflowError", {
600
600
  }
601
601
  });
602
602
 
603
- //# sourceMappingURL=dist-B6Dt7UbH.cjs.map
603
+ //# sourceMappingURL=dist-CwfjWo4B.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"dist-B6Dt7UbH.cjs","names":["z","withSpan","logSystem","captureConsole","normalizeCredentialList","getActionCredentialRequirements","resolveActionCredentials","runWithMcpCredentialContext","executeAction","AsyncLocalStorage","registerWorkflowRunGetter","getRunSignal","getWorkflowRunHandle"],"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,YAAYA,IAAAA,EAAE,QAAQ,MAAM,aAAaA,IAAAA,EAAE,SAAS,sBAAsB;;AAEhF,MAAM,qBAAqBA,IAAAA,EAAE,OAAO;CACnC,MAAMA,IAAAA,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC;CAC7B,MAAMA,IAAAA,EAAE,OAAO,EAAE,SAAS;CAC1B,aAAaA,IAAAA,EAAE,OAAO,EAAE,SAAS;CACjC,cAAcA,IAAAA,EAAE,OAAO,EAAE,MAAMA,IAAAA,EAAE,KAAK,CAA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AS,UAAU,QAAQ,MAAM;CAChC,MAAM,SAASS,aAAAA,qBAAqB;CACpC,IAAI,CAAC,QAAQ,WAAW,MAAM,IAAI,MAAM,mGAAmG;CAC3I,OAAO,OAAO,UAAU;EACvB;EACA,GAAG;CACJ,CAAC;AACF"}
1
+ {"version":3,"file":"dist-CwfjWo4B.cjs","names":["z","withSpan","logSystem","captureConsole","normalizeCredentialList","getActionCredentialRequirements","resolveActionCredentials","runWithMcpCredentialContext","executeAction","AsyncLocalStorage","registerWorkflowRunGetter","getRunSignal","getWorkflowRunHandle"],"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,YAAYA,IAAAA,EAAE,QAAQ,MAAM,aAAaA,IAAAA,EAAE,SAAS,sBAAsB;;AAEhF,MAAM,qBAAqBA,IAAAA,EAAE,OAAO;CACnC,MAAMA,IAAAA,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC;CAC7B,MAAMA,IAAAA,EAAE,OAAO,EAAE,SAAS;CAC1B,aAAaA,IAAAA,EAAE,OAAO,EAAE,SAAS;CACjC,cAAcA,IAAAA,EA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M,SAAS,OAAO,KAAK;CAChE,OAAO;AACR;AAGA,SAAS,UAAU,QAAQ,MAAM;CAChC,MAAM,SAASS,aAAAA,qBAAqB;CACpC,IAAI,CAAC,QAAQ,WAAW,MAAM,IAAI,MAAM,mGAAmG;CAC3I,OAAO,OAAO,UAAU;EACvB;EACA,GAAG;CACJ,CAAC;AACF"}
@@ -1,5 +1,6 @@
1
1
  import { a as __toESM, i as __require, t as __commonJSMin } from "./chunk-D0VCBZRD.mjs";
2
- import { D as normalizeCredentialList, E as mcpEntityId, x as buildConnectDeeplink } from "./dist-B2xZReHP.mjs";
2
+ import { O as mcpEntityId, S as buildConnectDeeplink, k as normalizeCredentialList } from "./dist-Kz_xVVMR.mjs";
3
+ import { createRequire } from "node:module";
3
4
  import { AsyncLocalStorage } from "node:async_hooks";
4
5
  import "node:fs";
5
6
  import "node:path";
@@ -3126,6 +3127,7 @@ function getDatabaseHandle$1() {
3126
3127
  function getDbFromContext$1() {
3127
3128
  return getDatabaseHandle$1().db;
3128
3129
  }
3130
+ createRequire(import.meta.url);
3129
3131
  function buildPgSchema$1(registry) {
3130
3132
  return Object.fromEntries(Object.entries(registry).map(([name, { pg }]) => [name, pg]));
3131
3133
  }
@@ -3240,82 +3242,106 @@ const usageRecordsSqlite = sqliteTable("usage_records", {
3240
3242
  metadata: text("metadata", { mode: "json" }),
3241
3243
  createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull()
3242
3244
  }, (table) => [index("usage_records_run_run_kind_idx").on(table.runId, table.runKind), index("usage_records_kind_idx").on(table.kind)]);
3243
- const triggerAttachments = pgTable("trigger_attachments", {
3245
+ const triggers = pgTable("triggers", {
3244
3246
  id: text$1("id").primaryKey(),
3245
3247
  projectId: text$1("project_id").notNull(),
3246
3248
  slug: text$1("slug").notNull(),
3249
+ kind: text$1("kind").$type().notNull(),
3247
3250
  name: text$1("name"),
3248
3251
  description: text$1("description"),
3249
- targetKind: text$1("target_kind").$type().notNull().default("workflow"),
3250
- workflowSlug: text$1("workflow_slug"),
3251
- agentSlug: text$1("agent_slug"),
3252
3252
  moduleFile: text$1("module_file").notNull(),
3253
- source: jsonb("source").$type().notNull(),
3254
3253
  origin: text$1("origin").$type().notNull().default("project"),
3255
- prompt: text$1("prompt"),
3254
+ config: jsonb("config").$type(),
3255
+ schedule: text$1("schedule"),
3256
+ nextRunAt: timestamp("next_run_at", { withTimezone: true }),
3257
+ enabled: integer$1("enabled").notNull().default(1),
3256
3258
  lifecycle: jsonb("lifecycle").$type(),
3257
3259
  createdBySessionId: text$1("created_by_session_id"),
3260
+ triggerHash: text$1("trigger_hash"),
3261
+ overviewMarkdown: text$1("overview_markdown"),
3262
+ overviewHash: text$1("overview_hash"),
3263
+ overviewModel: text$1("overview_model"),
3264
+ overviewStatus: text$1("overview_status").$type().notNull().default("idle"),
3265
+ overviewGeneratedAt: timestamp("overview_generated_at", { withTimezone: true }),
3258
3266
  registeredAt: timestamp("registered_at", { withTimezone: true }).notNull(),
3259
3267
  updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
3260
3268
  deletedAt: timestamp("deleted_at", { withTimezone: true })
3261
- }, (table) => [uniqueIndex$1("trigger_attachments_project_id_slug_idx").on(table.projectId, table.slug)]);
3262
- const triggerAttachmentsSqlite = sqliteTable("trigger_attachments", {
3269
+ }, (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)]);
3270
+ const triggersSqlite = sqliteTable("triggers", {
3263
3271
  id: text("id").primaryKey(),
3264
3272
  projectId: text("project_id").notNull(),
3265
3273
  slug: text("slug").notNull(),
3274
+ kind: text("kind").$type().notNull(),
3266
3275
  name: text("name"),
3267
3276
  description: text("description"),
3268
- targetKind: text("target_kind").$type().notNull().default("workflow"),
3269
- workflowSlug: text("workflow_slug"),
3270
- agentSlug: text("agent_slug"),
3271
3277
  moduleFile: text("module_file").notNull(),
3272
- source: text("source", { mode: "json" }).$type().notNull(),
3273
3278
  origin: text("origin").$type().notNull().default("project"),
3274
- prompt: text("prompt"),
3279
+ config: text("config", { mode: "json" }).$type(),
3280
+ schedule: text("schedule"),
3281
+ nextRunAt: integer("next_run_at", { mode: "timestamp_ms" }),
3282
+ enabled: integer("enabled").notNull().default(1),
3275
3283
  lifecycle: text("lifecycle", { mode: "json" }).$type(),
3276
3284
  createdBySessionId: text("created_by_session_id"),
3285
+ triggerHash: text("trigger_hash"),
3286
+ overviewMarkdown: text("overview_markdown"),
3287
+ overviewHash: text("overview_hash"),
3288
+ overviewModel: text("overview_model"),
3289
+ overviewStatus: text("overview_status").$type().notNull().default("idle"),
3290
+ overviewGeneratedAt: integer("overview_generated_at", { mode: "timestamp_ms" }),
3277
3291
  registeredAt: integer("registered_at", { mode: "timestamp_ms" }).notNull(),
3278
3292
  updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull(),
3279
3293
  deletedAt: integer("deleted_at", { mode: "timestamp_ms" })
3280
- }, (table) => [uniqueIndex("trigger_attachments_project_id_slug_idx").on(table.projectId, table.slug)]);
3281
- const triggerSchedules = pgTable("trigger_schedules", {
3294
+ }, (table) => [uniqueIndex("triggers_project_id_slug_idx").on(table.projectId, table.slug), index("triggers_next_run_at_enabled_idx").on(table.nextRunAt, table.enabled)]);
3295
+ const triggerAttachments = pgTable("trigger_attachments", {
3282
3296
  id: text$1("id").primaryKey(),
3283
3297
  projectId: text$1("project_id").notNull(),
3284
- attachmentSlug: text$1("attachment_slug").notNull(),
3285
- kind: text$1("kind").$type().notNull(),
3286
- schedule: text$1("schedule").notNull(),
3287
- nextRunAt: timestamp("next_run_at", { withTimezone: true }).notNull(),
3288
- enabled: integer$1("enabled").notNull(),
3289
- updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
3290
- }, (table) => [uniqueIndex$1("trigger_schedules_project_id_attachment_slug_idx").on(table.projectId, table.attachmentSlug), index$1("trigger_schedules_next_run_at_idx").on(table.nextRunAt, table.enabled)]);
3291
- const triggerSchedulesSqlite = sqliteTable("trigger_schedules", {
3298
+ triggerId: text$1("trigger_id").notNull().references(() => triggers.id),
3299
+ slug: text$1("slug").notNull(),
3300
+ targetKind: text$1("target_kind").$type().notNull().default("workflow"),
3301
+ workflowSlug: text$1("workflow_slug"),
3302
+ agentSlug: text$1("agent_slug"),
3303
+ prompt: text$1("prompt"),
3304
+ registeredAt: timestamp("registered_at", { withTimezone: true }).notNull(),
3305
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
3306
+ deletedAt: timestamp("deleted_at", { withTimezone: true })
3307
+ }, (table) => [uniqueIndex$1("trigger_attachments_project_id_slug_idx").on(table.projectId, table.slug)]);
3308
+ const triggerAttachmentsSqlite = sqliteTable("trigger_attachments", {
3292
3309
  id: text("id").primaryKey(),
3293
3310
  projectId: text("project_id").notNull(),
3294
- attachmentSlug: text("attachment_slug").notNull(),
3295
- kind: text("kind").$type().notNull(),
3296
- schedule: text("schedule").notNull(),
3297
- nextRunAt: integer("next_run_at", { mode: "timestamp_ms" }).notNull(),
3298
- enabled: integer("enabled").notNull(),
3299
- updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull()
3300
- }, (table) => [uniqueIndex("trigger_schedules_project_id_attachment_slug_idx").on(table.projectId, table.attachmentSlug), index("trigger_schedules_next_run_at_idx").on(table.nextRunAt, table.enabled)]);
3311
+ triggerId: text("trigger_id").notNull().references(() => triggersSqlite.id),
3312
+ slug: text("slug").notNull(),
3313
+ targetKind: text("target_kind").$type().notNull().default("workflow"),
3314
+ workflowSlug: text("workflow_slug"),
3315
+ agentSlug: text("agent_slug"),
3316
+ prompt: text("prompt"),
3317
+ registeredAt: integer("registered_at", { mode: "timestamp_ms" }).notNull(),
3318
+ updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull(),
3319
+ deletedAt: integer("deleted_at", { mode: "timestamp_ms" })
3320
+ }, (table) => [uniqueIndex("trigger_attachments_project_id_slug_idx").on(table.projectId, table.slug)]);
3301
3321
  const triggerRuns = pgTable("trigger_runs", {
3302
3322
  id: text$1("id").primaryKey(),
3303
3323
  projectId: text$1("project_id").notNull(),
3304
- attachmentId: text$1("attachment_id").notNull().references(() => triggerAttachments.id),
3324
+ triggerId: text$1("trigger_id").notNull().references(() => triggers.id),
3305
3325
  sourcePath: text$1("source_path"),
3306
3326
  triggerType: text$1("trigger_type").$type().notNull(),
3327
+ outcome: text$1("outcome").$type().notNull().default("dispatched"),
3328
+ reason: text$1("reason").$type(),
3329
+ detail: text$1("detail"),
3307
3330
  payload: jsonb("payload"),
3308
3331
  triggeredAt: timestamp("triggered_at", { withTimezone: true }).notNull()
3309
- });
3332
+ }, (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)]);
3310
3333
  const triggerRunsSqlite = sqliteTable("trigger_runs", {
3311
3334
  id: text("id").primaryKey(),
3312
3335
  projectId: text("project_id").notNull(),
3313
- attachmentId: text("attachment_id").notNull().references(() => triggerAttachmentsSqlite.id),
3336
+ triggerId: text("trigger_id").notNull().references(() => triggersSqlite.id),
3314
3337
  sourcePath: text("source_path"),
3315
3338
  triggerType: text("trigger_type").$type().notNull(),
3339
+ outcome: text("outcome").$type().notNull().default("dispatched"),
3340
+ reason: text("reason").$type(),
3341
+ detail: text("detail"),
3316
3342
  payload: text("payload", { mode: "json" }),
3317
3343
  triggeredAt: integer("triggered_at", { mode: "timestamp_ms" }).notNull()
3318
- });
3344
+ }, (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)]);
3319
3345
  const workflowSubscriptions = pgTable("workflow_subscriptions", {
3320
3346
  id: text$1("id").primaryKey(),
3321
3347
  projectId: text$1("project_id").notNull(),
@@ -3447,7 +3473,8 @@ const credentialInstances = pgTable("credential_instances", {
3447
3473
  sharedConnectionId: text$1("shared_connection_id"),
3448
3474
  grantedScopes: jsonb("granted_scopes").$type(),
3449
3475
  createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
3450
- updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
3476
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
3477
+ lastUsedAt: timestamp("last_used_at", { withTimezone: true })
3451
3478
  }, (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)]);
3452
3479
  const credentialInstancesSqlite = sqliteTable("credential_instances", {
3453
3480
  id: text("id").primaryKey(),
@@ -3466,7 +3493,8 @@ const credentialInstancesSqlite = sqliteTable("credential_instances", {
3466
3493
  sharedConnectionId: text("shared_connection_id"),
3467
3494
  grantedScopes: text("granted_scopes", { mode: "json" }).$type(),
3468
3495
  createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull(),
3469
- updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull()
3496
+ updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull(),
3497
+ lastUsedAt: integer("last_used_at", { mode: "timestamp_ms" })
3470
3498
  }, (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)]);
3471
3499
  const credentialAssignments = pgTable("credential_assignments", {
3472
3500
  id: text$1("id").primaryKey(),
@@ -3699,14 +3727,14 @@ const tableRegistry$1 = {
3699
3727
  pg: usageRecords,
3700
3728
  sqlite: usageRecordsSqlite
3701
3729
  },
3730
+ triggers: {
3731
+ pg: triggers,
3732
+ sqlite: triggersSqlite
3733
+ },
3702
3734
  triggerAttachments: {
3703
3735
  pg: triggerAttachments,
3704
3736
  sqlite: triggerAttachmentsSqlite
3705
3737
  },
3706
- triggerSchedules: {
3707
- pg: triggerSchedules,
3708
- sqlite: triggerSchedulesSqlite
3709
- },
3710
3738
  triggerRuns: {
3711
3739
  pg: triggerRuns,
3712
3740
  sqlite: triggerRunsSqlite
@@ -3861,6 +3889,10 @@ async function selectCredentialInstancesForScope(appSlug, scopeType, scopeId) {
3861
3889
  const scopeCondition = scopeId === null ? and(eq(credentialInstances.scopeType, scopeType), isNull(credentialInstances.scopeId)) : and(eq(credentialInstances.scopeType, scopeType), eq(credentialInstances.scopeId, scopeId));
3862
3890
  return db.select().from(credentialInstances).where(credentialScopeAnd(scopeType, eq(credentialInstances.appSlug, appSlug), scopeCondition));
3863
3891
  }
3892
+ /** Record that a credential was just resolved/used. Targeted by id; never throws on a missing row. */
3893
+ async function touchCredentialInstanceLastUsed(id) {
3894
+ await getDb$1().update(credentialInstances).set({ lastUsedAt: /* @__PURE__ */ new Date() }).where(eq(credentialInstances.id, id));
3895
+ }
3864
3896
  async function listCredentialAssignmentsByTarget(options) {
3865
3897
  return getDb$1().select().from(credentialAssignments).where(scopedAnd$1(credentialAssignments, eq(credentialAssignments.targetType, options.targetType), eq(credentialAssignments.targetKey, options.targetKey)));
3866
3898
  }
@@ -17254,7 +17286,7 @@ async function connectMcpServer(name, options) {
17254
17286
  }
17255
17287
  async function createTransport(url, transport, requestInit, fetchImpl) {
17256
17288
  if (transport === "sse") {
17257
- const { SSEClientTransport } = await import("./sse-uALvPXss.mjs");
17289
+ const { SSEClientTransport } = await import("./sse-DUu9Naud.mjs");
17258
17290
  return new SSEClientTransport(url, {
17259
17291
  requestInit,
17260
17292
  fetch: fetchImpl
@@ -17457,8 +17489,7 @@ const authVerificationsSqlite = sqliteTable("verification", {
17457
17489
  createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull(),
17458
17490
  updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull()
17459
17491
  }, (table) => [index("verification_identifier_idx").on(table.identifier)]);
17460
- //#endregion
17461
- //#region ../platform-database/dist/index.mjs
17492
+ createRequire(import.meta.url);
17462
17493
  function buildPgSchema(registry) {
17463
17494
  return Object.fromEntries(Object.entries(registry).map(([name, { pg }]) => [name, pg]));
17464
17495
  }
@@ -17589,6 +17620,7 @@ const apps = pgTable("apps", {
17589
17620
  authKind: text$1("auth_kind").$type().notNull(),
17590
17621
  oauthScopes: jsonb("oauth_scopes").$type().notNull(),
17591
17622
  credentialFields: jsonb("credential_fields").$type().notNull().default({}),
17623
+ credentialScheme: text$1("credential_scheme").$type(),
17592
17624
  source: text$1("source").$type().notNull(),
17593
17625
  createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
17594
17626
  updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
@@ -17604,6 +17636,7 @@ const appsSqlite = sqliteTable("apps", {
17604
17636
  authKind: text("auth_kind").$type().notNull(),
17605
17637
  oauthScopes: text("oauth_scopes", { mode: "json" }).$type().notNull(),
17606
17638
  credentialFields: text("credential_fields", { mode: "json" }).$type().notNull().default({}),
17639
+ credentialScheme: text("credential_scheme").$type(),
17607
17640
  source: text("source").$type().notNull(),
17608
17641
  createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull(),
17609
17642
  updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull()
@@ -18050,7 +18083,7 @@ async function resolveOAuthAccessToken(connection, app, tokenRefresh) {
18050
18083
  return refreshed.accessToken;
18051
18084
  }
18052
18085
  //#endregion
18053
- //#region ../credentials/dist/store-BokhwcCi.mjs
18086
+ //#region ../credentials/dist/store-Bib92S-M.mjs
18054
18087
  function normalizeRow(row) {
18055
18088
  const { projectId: _projectId, ...rest } = row;
18056
18089
  return rest;
@@ -18069,6 +18102,9 @@ async function selectCredentialInstanceById$1(id) {
18069
18102
  async function selectCredentialInstancesForScope$1(appSlug, scopeType, scopeId) {
18070
18103
  return (await selectCredentialInstancesForScope(appSlug, scopeType, scopeId)).map(normalizeLocalRow);
18071
18104
  }
18105
+ async function touchCredentialInstanceLastUsed$1(id) {
18106
+ await touchCredentialInstanceLastUsed(id);
18107
+ }
18072
18108
  //#endregion
18073
18109
  //#region ../secrets/dist/index.mjs
18074
18110
  const ALGORITHM = "aes-256-gcm";
@@ -18501,7 +18537,25 @@ function pickInstance(rows, key, consumer) {
18501
18537
  consumer
18502
18538
  });
18503
18539
  }
18540
+ /** Throttle window for last-used writes so bursty runs don't hammer the same row. */
18541
+ const LAST_USED_THROTTLE_MS = 6e4;
18542
+ /**
18543
+ * Record that a credential was just resolved. Throttled (skip when touched within
18544
+ * {@link LAST_USED_THROTTLE_MS}) and best-effort: a write failure must never break resolution.
18545
+ */
18546
+ async function touchLastUsed(row) {
18547
+ const last = row.lastUsedAt?.getTime();
18548
+ if (last !== void 0 && Date.now() - last < LAST_USED_THROTTLE_MS) return;
18549
+ try {
18550
+ await touchCredentialInstanceLastUsed$1(row.id);
18551
+ } catch {}
18552
+ }
18504
18553
  async function resolveInstanceValue(row, requirement, backend) {
18554
+ const value = await materializeInstanceValue(row, requirement, backend);
18555
+ await touchLastUsed(row);
18556
+ return value;
18557
+ }
18558
+ async function materializeInstanceValue(row, requirement, backend) {
18505
18559
  if (row.authKind === "keystroke") {
18506
18560
  if (!row.connectionId) throw new MissingCredentialsError({
18507
18561
  key: row.appSlug,
@@ -18786,4 +18840,4 @@ async function resolveActionCredentials(requirements, options) {
18786
18840
  //#endregion
18787
18841
  export { recordLlmUsageFromAssistantMessage as A, appendEvent as C, getProjectScopeId as D, getAgentByRoute as E, captureConsole as F, getTraceContext as I, logSystem as L, setSessionLiveMessage as M, setSessionTitle as N, getSession as O, touchSession as P, withSpan as R, addAgentSessionDuration as S, createSession as T, createFetchWithInit as _, resolveActionCredentials as a, JSONRPCMessageSchema as b, connectMcpDefinition as c, defineMcp as d, isMcp as f, extractWWWAuthenticateParams as g, auth as h, isCredentialError as i, resolveRunSourceFromTraceContext as j, listMessageEvents as k, connectMcpServer as l, UnauthorizedError as m, captureCredentialToolErrors as n, resolveMcpTools as o, createParser as p, createCredentialResolver as r, withCredentialAssignments as s, buildCredentialRunContext as t, connectMcpStdio as u, normalizeHeaders as v, clearLiveMessage as w, MESSAGE_EVENT_TYPE as x, zodToJsonSchema as y };
18788
18842
 
18789
- //# sourceMappingURL=dist-Brxtvkcs.mjs.map
18843
+ //# sourceMappingURL=dist-DN31JPna.mjs.map