@keystrokehq/platform 0.1.127 → 0.1.129
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/{awk2-LA3USKJP-CpFxkjrn.cjs → awk2-LA3USKJP-CRpeKCfQ.cjs} +2 -2
- package/dist/{awk2-LA3USKJP-CpFxkjrn.cjs.map → awk2-LA3USKJP-CRpeKCfQ.cjs.map} +1 -1
- package/dist/{awk2-LA3USKJP-BVVeBdqr.mjs → awk2-LA3USKJP-JSEp5Xlg.mjs} +2 -2
- package/dist/{awk2-LA3USKJP-BVVeBdqr.mjs.map → awk2-LA3USKJP-JSEp5Xlg.mjs.map} +1 -1
- package/dist/{base64-C2AIWVNC-D_IsSXgm.cjs → base64-C2AIWVNC-Bkg108Je.cjs} +2 -2
- package/dist/{base64-C2AIWVNC-D_IsSXgm.cjs.map → base64-C2AIWVNC-Bkg108Je.cjs.map} +1 -1
- package/dist/{base64-C2AIWVNC-B7sMLVt_.mjs → base64-C2AIWVNC-CZiWywDB.mjs} +2 -2
- package/dist/{base64-C2AIWVNC-B7sMLVt_.mjs.map → base64-C2AIWVNC-CZiWywDB.mjs.map} +1 -1
- package/dist/{bash-YZ33HQZQ-CkeF_eUy.cjs → bash-YZ33HQZQ-BNCFBZcV.cjs} +2 -2
- package/dist/{bash-YZ33HQZQ-CkeF_eUy.cjs.map → bash-YZ33HQZQ-BNCFBZcV.cjs.map} +1 -1
- package/dist/{bash-YZ33HQZQ-DLzbdVxX.mjs → bash-YZ33HQZQ-v7kXvjMn.mjs} +2 -2
- package/dist/{bash-YZ33HQZQ-DLzbdVxX.mjs.map → bash-YZ33HQZQ-v7kXvjMn.mjs.map} +1 -1
- package/dist/{cat-TSFMZVYS-CrxSWZL_.cjs → cat-TSFMZVYS-6dEqhBmm.cjs} +3 -3
- package/dist/{cat-TSFMZVYS-CrxSWZL_.cjs.map → cat-TSFMZVYS-6dEqhBmm.cjs.map} +1 -1
- package/dist/{cat-TSFMZVYS-8YtCIygk.mjs → cat-TSFMZVYS-BLpD1bZP.mjs} +3 -3
- package/dist/{cat-TSFMZVYS-8YtCIygk.mjs.map → cat-TSFMZVYS-BLpD1bZP.mjs.map} +1 -1
- package/dist/{chunk-5H5SCKJM-BNOXbrnw.mjs → chunk-5H5SCKJM-Bggyg1Jk.mjs} +2 -2
- package/dist/{chunk-5H5SCKJM-BNOXbrnw.mjs.map → chunk-5H5SCKJM-Bggyg1Jk.mjs.map} +1 -1
- package/dist/{chunk-5H5SCKJM-pnaBIPk5.cjs → chunk-5H5SCKJM-D_1eCa9o.cjs} +2 -2
- package/dist/{chunk-5H5SCKJM-pnaBIPk5.cjs.map → chunk-5H5SCKJM-D_1eCa9o.cjs.map} +1 -1
- package/dist/{chunk-AQ6FYS2X-DzMZGHWE.mjs → chunk-AQ6FYS2X-DE1rd6hn.mjs} +2 -2
- package/dist/{chunk-AQ6FYS2X-DzMZGHWE.mjs.map → chunk-AQ6FYS2X-DE1rd6hn.mjs.map} +1 -1
- package/dist/{chunk-AQ6FYS2X-CtxLYxF7.cjs → chunk-AQ6FYS2X-DoehpZyo.cjs} +2 -2
- package/dist/{chunk-AQ6FYS2X-CtxLYxF7.cjs.map → chunk-AQ6FYS2X-DoehpZyo.cjs.map} +1 -1
- package/dist/{chunk-CHFEPBH4-C21LC1mF.cjs → chunk-CHFEPBH4-CJIVvXgB.cjs} +2 -2
- package/dist/{chunk-CHFEPBH4-C21LC1mF.cjs.map → chunk-CHFEPBH4-CJIVvXgB.cjs.map} +1 -1
- package/dist/{chunk-CHFEPBH4-Q_JMvcbY.mjs → chunk-CHFEPBH4-WBOOOPg2.mjs} +2 -2
- package/dist/{chunk-CHFEPBH4-Q_JMvcbY.mjs.map → chunk-CHFEPBH4-WBOOOPg2.mjs.map} +1 -1
- package/dist/{chunk-EBAPSGAO-CT-NSJJU.mjs → chunk-EBAPSGAO-C9KZArcE.mjs} +2 -2
- package/dist/{chunk-EBAPSGAO-CT-NSJJU.mjs.map → chunk-EBAPSGAO-C9KZArcE.mjs.map} +1 -1
- package/dist/{chunk-EBAPSGAO-Doo10VRF.cjs → chunk-EBAPSGAO-D_EhjwMv.cjs} +2 -2
- package/dist/{chunk-EBAPSGAO-Doo10VRF.cjs.map → chunk-EBAPSGAO-D_EhjwMv.cjs.map} +1 -1
- package/dist/{chunk-LEKBROJD-BRqXm9at.mjs → chunk-LEKBROJD-D-IIdlKP.mjs} +2 -2
- package/dist/{chunk-LEKBROJD-BRqXm9at.mjs.map → chunk-LEKBROJD-D-IIdlKP.mjs.map} +1 -1
- package/dist/{chunk-LEKBROJD-CajLSq3B.cjs → chunk-LEKBROJD-DJdgm-7A.cjs} +2 -2
- package/dist/{chunk-LEKBROJD-CajLSq3B.cjs.map → chunk-LEKBROJD-DJdgm-7A.cjs.map} +1 -1
- package/dist/{chunk-VPADYNBD-D4G9glTi.cjs → chunk-VPADYNBD-DryEgdfM.cjs} +2 -2
- package/dist/{chunk-VPADYNBD-D4G9glTi.cjs.map → chunk-VPADYNBD-DryEgdfM.cjs.map} +1 -1
- package/dist/{chunk-VPADYNBD-C9AA6p-5.mjs → chunk-VPADYNBD-ptfxMBmZ.mjs} +2 -2
- package/dist/{chunk-VPADYNBD-C9AA6p-5.mjs.map → chunk-VPADYNBD-ptfxMBmZ.mjs.map} +1 -1
- package/dist/{chunk-YCLFEX4T-CXsKbe0Y.cjs → chunk-YCLFEX4T-B3UMBJ0M.cjs} +2 -2
- package/dist/{chunk-YCLFEX4T-CXsKbe0Y.cjs.map → chunk-YCLFEX4T-B3UMBJ0M.cjs.map} +1 -1
- package/dist/{chunk-YCLFEX4T-BRYtP8VY.mjs → chunk-YCLFEX4T-DL82L8qX.mjs} +2 -2
- package/dist/{chunk-YCLFEX4T-BRYtP8VY.mjs.map → chunk-YCLFEX4T-DL82L8qX.mjs.map} +1 -1
- package/dist/{column-XT6UFXNQ-BFRmRg3A.mjs → column-XT6UFXNQ-B5Y5NTgP.mjs} +2 -2
- package/dist/{column-XT6UFXNQ-BFRmRg3A.mjs.map → column-XT6UFXNQ-B5Y5NTgP.mjs.map} +1 -1
- package/dist/{column-XT6UFXNQ-Do4sikzY.cjs → column-XT6UFXNQ-DiKFWUTy.cjs} +2 -2
- package/dist/{column-XT6UFXNQ-Do4sikzY.cjs.map → column-XT6UFXNQ-DiKFWUTy.cjs.map} +1 -1
- package/dist/{comm-VV2LDX2J-B1IA_SoQ.cjs → comm-VV2LDX2J-BFfsarPx.cjs} +2 -2
- package/dist/{comm-VV2LDX2J-B1IA_SoQ.cjs.map → comm-VV2LDX2J-BFfsarPx.cjs.map} +1 -1
- package/dist/{comm-VV2LDX2J-BSsAQPjg.mjs → comm-VV2LDX2J-C_eMUh7X.mjs} +2 -2
- package/dist/{comm-VV2LDX2J-BSsAQPjg.mjs.map → comm-VV2LDX2J-C_eMUh7X.mjs.map} +1 -1
- package/dist/{config-Bz_vaNDC.d.mts → config-B12srbG4.d.mts} +5 -6
- package/dist/config-BKdVL9Hp.mjs +136 -0
- package/dist/config-BKdVL9Hp.mjs.map +1 -0
- package/dist/config-DNjiVgco.cjs +141 -0
- package/dist/config-DNjiVgco.cjs.map +1 -0
- package/dist/{config-CkjEzhym.d.cts → config-DX8D3J-V.d.cts} +5 -5
- package/dist/config.cjs +2 -15
- package/dist/config.d.cts +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +1 -14
- package/dist/{cp-BISAAS7A-LZstLHPP.mjs → cp-BISAAS7A-B-mVeyDw.mjs} +2 -2
- package/dist/{cp-BISAAS7A-LZstLHPP.mjs.map → cp-BISAAS7A-B-mVeyDw.mjs.map} +1 -1
- package/dist/{cp-BISAAS7A-BF3r68hY.cjs → cp-BISAAS7A-C2krfNmE.cjs} +2 -2
- package/dist/{cp-BISAAS7A-BF3r68hY.cjs.map → cp-BISAAS7A-C2krfNmE.cjs.map} +1 -1
- package/dist/{cut-OKARJCCV-DMAT7XIj.cjs → cut-OKARJCCV-BrZy_JBc.cjs} +3 -3
- package/dist/{cut-OKARJCCV-DMAT7XIj.cjs.map → cut-OKARJCCV-BrZy_JBc.cjs.map} +1 -1
- package/dist/{cut-OKARJCCV-SGsEGpPF.mjs → cut-OKARJCCV-CxsMG1ws.mjs} +3 -3
- package/dist/{cut-OKARJCCV-SGsEGpPF.mjs.map → cut-OKARJCCV-CxsMG1ws.mjs.map} +1 -1
- package/dist/{diff-MWJFIG7X-XEmV86SZ.mjs → diff-MWJFIG7X-BwOFX19z.mjs} +2 -2
- package/dist/{diff-MWJFIG7X-XEmV86SZ.mjs.map → diff-MWJFIG7X-BwOFX19z.mjs.map} +1 -1
- package/dist/{diff-MWJFIG7X-ChQ3QNKG.cjs → diff-MWJFIG7X-_Pn5aMae.cjs} +2 -2
- package/dist/{diff-MWJFIG7X-ChQ3QNKG.cjs.map → diff-MWJFIG7X-_Pn5aMae.cjs.map} +1 -1
- package/dist/{dist-BjqTzHjj.mjs → dist-Bci68KAE.mjs} +466 -463
- package/dist/dist-Bci68KAE.mjs.map +1 -0
- package/dist/{dist-CuSODqFN.cjs → dist-Bqh3rPbq.cjs} +626 -598
- package/dist/dist-Bqh3rPbq.cjs.map +1 -0
- package/dist/{du-572XNP42-syW7T5wl.cjs → du-572XNP42-Cd7S5r3G.cjs} +2 -2
- package/dist/{du-572XNP42-syW7T5wl.cjs.map → du-572XNP42-Cd7S5r3G.cjs.map} +1 -1
- package/dist/{du-572XNP42-TUd1DbWa.mjs → du-572XNP42-DIxq319C.mjs} +2 -2
- package/dist/{du-572XNP42-TUd1DbWa.mjs.map → du-572XNP42-DIxq319C.mjs.map} +1 -1
- package/dist/{env-36M5BO7M-5U__78-3.mjs → env-36M5BO7M-BcGUj0ch.mjs} +2 -2
- package/dist/{env-36M5BO7M-5U__78-3.mjs.map → env-36M5BO7M-BcGUj0ch.mjs.map} +1 -1
- package/dist/{env-36M5BO7M-B3UbmHXG.cjs → env-36M5BO7M-DUYG60IR.cjs} +2 -2
- package/dist/{env-36M5BO7M-B3UbmHXG.cjs.map → env-36M5BO7M-DUYG60IR.cjs.map} +1 -1
- package/dist/{expand-JSPG6VOP-D5xYJiCA.cjs → expand-JSPG6VOP-BAmgU6tl.cjs} +2 -2
- package/dist/{expand-JSPG6VOP-D5xYJiCA.cjs.map → expand-JSPG6VOP-BAmgU6tl.cjs.map} +1 -1
- package/dist/{expand-JSPG6VOP-zizVV8ql.mjs → expand-JSPG6VOP-DFjJvHLb.mjs} +2 -2
- package/dist/{expand-JSPG6VOP-zizVV8ql.mjs.map → expand-JSPG6VOP-DFjJvHLb.mjs.map} +1 -1
- package/dist/{expr-5JAACS4X-DDHxu2__.mjs → expr-5JAACS4X-CYAUFOGr.mjs} +2 -2
- package/dist/{expr-5JAACS4X-DDHxu2__.mjs.map → expr-5JAACS4X-CYAUFOGr.mjs.map} +1 -1
- package/dist/{expr-5JAACS4X-RARujgcr.cjs → expr-5JAACS4X-sB386XcD.cjs} +2 -2
- package/dist/{expr-5JAACS4X-RARujgcr.cjs.map → expr-5JAACS4X-sB386XcD.cjs.map} +1 -1
- package/dist/{find-INTH3OLC-lsDyrleI.cjs → find-INTH3OLC-BTShg9xs.cjs} +3 -3
- package/dist/{find-INTH3OLC-lsDyrleI.cjs.map → find-INTH3OLC-BTShg9xs.cjs.map} +1 -1
- package/dist/{find-INTH3OLC-VFv5gQt3.mjs → find-INTH3OLC-D5F-4TiK.mjs} +3 -3
- package/dist/{find-INTH3OLC-VFv5gQt3.mjs.map → find-INTH3OLC-D5F-4TiK.mjs.map} +1 -1
- package/dist/{fold-4TQNYMSW-05CExa1B.mjs → fold-4TQNYMSW-ChWNcaSY.mjs} +2 -2
- package/dist/{fold-4TQNYMSW-05CExa1B.mjs.map → fold-4TQNYMSW-ChWNcaSY.mjs.map} +1 -1
- package/dist/{fold-4TQNYMSW-CivD7wj6.cjs → fold-4TQNYMSW-DYBfLnwa.cjs} +2 -2
- package/dist/{fold-4TQNYMSW-CivD7wj6.cjs.map → fold-4TQNYMSW-DYBfLnwa.cjs.map} +1 -1
- package/dist/{grep-V3LQVMRQ-Dvih6qCn.mjs → grep-V3LQVMRQ-B0gA4mLR.mjs} +4 -4
- package/dist/{grep-V3LQVMRQ-Dvih6qCn.mjs.map → grep-V3LQVMRQ-B0gA4mLR.mjs.map} +1 -1
- package/dist/{grep-V3LQVMRQ-UqfGAJmP.cjs → grep-V3LQVMRQ-C1PzxoF4.cjs} +4 -4
- package/dist/{grep-V3LQVMRQ-UqfGAJmP.cjs.map → grep-V3LQVMRQ-C1PzxoF4.cjs.map} +1 -1
- package/dist/{gzip-O5ASJAFY-ZYtGzW19.mjs → gzip-O5ASJAFY-BTTHx-WY.mjs} +2 -2
- package/dist/{gzip-O5ASJAFY-ZYtGzW19.mjs.map → gzip-O5ASJAFY-BTTHx-WY.mjs.map} +1 -1
- package/dist/{gzip-O5ASJAFY-B3RkVh7f.cjs → gzip-O5ASJAFY-DKP63NQf.cjs} +2 -2
- package/dist/{gzip-O5ASJAFY-B3RkVh7f.cjs.map → gzip-O5ASJAFY-DKP63NQf.cjs.map} +1 -1
- package/dist/{head-442HYESI-Dj3hI9Aw.mjs → head-442HYESI-BLoRrBPY.mjs} +2 -2
- package/dist/{head-442HYESI-Dj3hI9Aw.mjs.map → head-442HYESI-BLoRrBPY.mjs.map} +1 -1
- package/dist/{head-442HYESI-DkIjzY9f.cjs → head-442HYESI-DvzjT244.cjs} +2 -2
- package/dist/{head-442HYESI-DkIjzY9f.cjs.map → head-442HYESI-DvzjT244.cjs.map} +1 -1
- package/dist/{help-HZ6M2CKN-X60dC_RS.mjs → help-HZ6M2CKN-BlDHQUKv.mjs} +2 -2
- package/dist/{help-HZ6M2CKN-X60dC_RS.mjs.map → help-HZ6M2CKN-BlDHQUKv.mjs.map} +1 -1
- package/dist/{help-HZ6M2CKN-Lgy25DqN.cjs → help-HZ6M2CKN-F4KWA-Lo.cjs} +2 -2
- package/dist/{help-HZ6M2CKN-Lgy25DqN.cjs.map → help-HZ6M2CKN-F4KWA-Lo.cjs.map} +1 -1
- package/dist/{html-to-markdown-JW4MSQZO-Ce65h2W-.cjs → html-to-markdown-JW4MSQZO-B0MrYci-.cjs} +3 -3
- package/dist/{html-to-markdown-JW4MSQZO-Ce65h2W-.cjs.map → html-to-markdown-JW4MSQZO-B0MrYci-.cjs.map} +1 -1
- package/dist/{html-to-markdown-JW4MSQZO-BHQ6wayT.mjs → html-to-markdown-JW4MSQZO-D9E7dTrr.mjs} +3 -3
- package/dist/{html-to-markdown-JW4MSQZO-BHQ6wayT.mjs.map → html-to-markdown-JW4MSQZO-D9E7dTrr.mjs.map} +1 -1
- package/dist/internal.cjs +1 -1
- package/dist/internal.mjs +1 -1
- package/dist/{join-TBRGI3LQ-BJzMwSnX.cjs → join-TBRGI3LQ-8WBxN8S3.cjs} +2 -2
- package/dist/{join-TBRGI3LQ-BJzMwSnX.cjs.map → join-TBRGI3LQ-8WBxN8S3.cjs.map} +1 -1
- package/dist/{join-TBRGI3LQ-Btr1bvRg.mjs → join-TBRGI3LQ-BBV17RnM.mjs} +2 -2
- package/dist/{join-TBRGI3LQ-Btr1bvRg.mjs.map → join-TBRGI3LQ-BBV17RnM.mjs.map} +1 -1
- package/dist/{jq-4XLYLOS5-Bt1zmP3d.mjs → jq-4XLYLOS5-BiUPd094.mjs} +4 -4
- package/dist/{jq-4XLYLOS5-Bt1zmP3d.mjs.map → jq-4XLYLOS5-BiUPd094.mjs.map} +1 -1
- package/dist/{jq-4XLYLOS5-BrvCR2u0.cjs → jq-4XLYLOS5-CgNV85jS.cjs} +4 -4
- package/dist/{jq-4XLYLOS5-BrvCR2u0.cjs.map → jq-4XLYLOS5-CgNV85jS.cjs.map} +1 -1
- package/dist/{js-exec-N5KEZBH7-xHcc2BJl.mjs → js-exec-N5KEZBH7-CzUyxAo1.mjs} +3 -3
- package/dist/{js-exec-N5KEZBH7-xHcc2BJl.mjs.map → js-exec-N5KEZBH7-CzUyxAo1.mjs.map} +1 -1
- package/dist/{js-exec-N5KEZBH7-BqxDkyYd.cjs → js-exec-N5KEZBH7-D_6MBthG.cjs} +3 -3
- package/dist/{js-exec-N5KEZBH7-BqxDkyYd.cjs.map → js-exec-N5KEZBH7-D_6MBthG.cjs.map} +1 -1
- package/dist/{lib-DFktrlpV.cjs → lib-DxjjtVCA.cjs} +2 -2
- package/dist/{lib-DFktrlpV.cjs.map → lib-DxjjtVCA.cjs.map} +1 -1
- package/dist/{lib-CdXEtyTW.mjs → lib-Nj7svX8P.mjs} +2 -2
- package/dist/{lib-CdXEtyTW.mjs.map → lib-Nj7svX8P.mjs.map} +1 -1
- package/dist/{ln-4LGSXXGD-B9SxMCPS.cjs → ln-4LGSXXGD-B1Kkh1ha.cjs} +2 -2
- package/dist/{ln-4LGSXXGD-B9SxMCPS.cjs.map → ln-4LGSXXGD-B1Kkh1ha.cjs.map} +1 -1
- package/dist/{ln-4LGSXXGD-B-7juNMY.mjs → ln-4LGSXXGD-CQbnGxlo.mjs} +2 -2
- package/dist/{ln-4LGSXXGD-B-7juNMY.mjs.map → ln-4LGSXXGD-CQbnGxlo.mjs.map} +1 -1
- package/dist/{ls-ZJGQER7M-Bu0PwnvV.cjs → ls-ZJGQER7M-Bcn7qAy0.cjs} +2 -2
- package/dist/{ls-ZJGQER7M-Bu0PwnvV.cjs.map → ls-ZJGQER7M-Bcn7qAy0.cjs.map} +1 -1
- package/dist/{ls-ZJGQER7M-CM0d2HQ5.mjs → ls-ZJGQER7M-JPY6vzVZ.mjs} +2 -2
- package/dist/{ls-ZJGQER7M-CM0d2HQ5.mjs.map → ls-ZJGQER7M-JPY6vzVZ.mjs.map} +1 -1
- package/dist/{lzma-CeMh0Bh-.cjs → lzma-getC1haw.cjs} +2 -2
- package/dist/{lzma-CeMh0Bh-.cjs.map → lzma-getC1haw.cjs.map} +1 -1
- package/dist/{md5sum-SPU24VSG-DCUMzXmA.mjs → md5sum-SPU24VSG-D91mAXHX.mjs} +3 -3
- package/dist/{md5sum-SPU24VSG-DCUMzXmA.mjs.map → md5sum-SPU24VSG-D91mAXHX.mjs.map} +1 -1
- package/dist/{md5sum-SPU24VSG-CJAMIST2.cjs → md5sum-SPU24VSG-DS0UmURz.cjs} +3 -3
- package/dist/{md5sum-SPU24VSG-CJAMIST2.cjs.map → md5sum-SPU24VSG-DS0UmURz.cjs.map} +1 -1
- package/dist/{mkdir-MEPGZOB6-DeXXgZgT.mjs → mkdir-MEPGZOB6-B_kzUVTS.mjs} +2 -2
- package/dist/{mkdir-MEPGZOB6-DeXXgZgT.mjs.map → mkdir-MEPGZOB6-B_kzUVTS.mjs.map} +1 -1
- package/dist/{mkdir-MEPGZOB6-K2lFNH3Q.cjs → mkdir-MEPGZOB6-BiX5Vu18.cjs} +2 -2
- package/dist/{mkdir-MEPGZOB6-K2lFNH3Q.cjs.map → mkdir-MEPGZOB6-BiX5Vu18.cjs.map} +1 -1
- package/dist/{mv-W5BIQ646-H8GsqB1b.cjs → mv-W5BIQ646-CfAhGw3i.cjs} +2 -2
- package/dist/{mv-W5BIQ646-H8GsqB1b.cjs.map → mv-W5BIQ646-CfAhGw3i.cjs.map} +1 -1
- package/dist/{mv-W5BIQ646-D7B4EXtW.mjs → mv-W5BIQ646-DYgpWDpz.mjs} +2 -2
- package/dist/{mv-W5BIQ646-D7B4EXtW.mjs.map → mv-W5BIQ646-DYgpWDpz.mjs.map} +1 -1
- package/dist/{nl-WSDW7I4O-bNeSyyH8.cjs → nl-WSDW7I4O-BKbW5dn8.cjs} +2 -2
- package/dist/{nl-WSDW7I4O-bNeSyyH8.cjs.map → nl-WSDW7I4O-BKbW5dn8.cjs.map} +1 -1
- package/dist/{nl-WSDW7I4O-vSmWj1ix.mjs → nl-WSDW7I4O-BgC2r5Cn.mjs} +2 -2
- package/dist/{nl-WSDW7I4O-vSmWj1ix.mjs.map → nl-WSDW7I4O-BgC2r5Cn.mjs.map} +1 -1
- package/dist/{od-WOKFDJTP-BZroqVaC.cjs → od-WOKFDJTP-6_AAfiI2.cjs} +2 -2
- package/dist/{od-WOKFDJTP-BZroqVaC.cjs.map → od-WOKFDJTP-6_AAfiI2.cjs.map} +1 -1
- package/dist/{od-WOKFDJTP-CkCvG14G.mjs → od-WOKFDJTP-L123BzbX.mjs} +2 -2
- package/dist/{od-WOKFDJTP-CkCvG14G.mjs.map → od-WOKFDJTP-L123BzbX.mjs.map} +1 -1
- package/dist/{paste-7JC6S4DX-ho7gh4i1.cjs → paste-7JC6S4DX-DqexKgEh.cjs} +2 -2
- package/dist/{paste-7JC6S4DX-ho7gh4i1.cjs.map → paste-7JC6S4DX-DqexKgEh.cjs.map} +1 -1
- package/dist/{paste-7JC6S4DX-Dgy_ylMI.mjs → paste-7JC6S4DX-NBL0MnKq.mjs} +2 -2
- package/dist/{paste-7JC6S4DX-Dgy_ylMI.mjs.map → paste-7JC6S4DX-NBL0MnKq.mjs.map} +1 -1
- package/dist/{printf-TWGXF445-jLBM1Y0p.mjs → printf-TWGXF445-DEdEype7.mjs} +3 -3
- package/dist/{printf-TWGXF445-jLBM1Y0p.mjs.map → printf-TWGXF445-DEdEype7.mjs.map} +1 -1
- package/dist/{printf-TWGXF445-s54WWFG_.cjs → printf-TWGXF445-DQy9Bsfl.cjs} +3 -3
- package/dist/{printf-TWGXF445-s54WWFG_.cjs.map → printf-TWGXF445-DQy9Bsfl.cjs.map} +1 -1
- package/dist/{python3-POMOR4OA-BOkIO9mW.cjs → python3-POMOR4OA-DGCWlS6L.cjs} +3 -3
- package/dist/{python3-POMOR4OA-BOkIO9mW.cjs.map → python3-POMOR4OA-DGCWlS6L.cjs.map} +1 -1
- package/dist/{python3-POMOR4OA-Txjrx9HU.mjs → python3-POMOR4OA-G_E-5KrH.mjs} +3 -3
- package/dist/{python3-POMOR4OA-Txjrx9HU.mjs.map → python3-POMOR4OA-G_E-5KrH.mjs.map} +1 -1
- package/dist/{rev-5EHFX4EJ-CsN7canu.mjs → rev-5EHFX4EJ-DBIij1uT.mjs} +2 -2
- package/dist/{rev-5EHFX4EJ-CsN7canu.mjs.map → rev-5EHFX4EJ-DBIij1uT.mjs.map} +1 -1
- package/dist/{rev-5EHFX4EJ-CP4vtR5e.cjs → rev-5EHFX4EJ-EputkmDM.cjs} +2 -2
- package/dist/{rev-5EHFX4EJ-CP4vtR5e.cjs.map → rev-5EHFX4EJ-EputkmDM.cjs.map} +1 -1
- package/dist/{rg-S4FXYXWB-8t2aML36.cjs → rg-S4FXYXWB-B8lu59hX.cjs} +3 -3
- package/dist/{rg-S4FXYXWB-8t2aML36.cjs.map → rg-S4FXYXWB-B8lu59hX.cjs.map} +1 -1
- package/dist/{rg-S4FXYXWB-CK7q5A50.mjs → rg-S4FXYXWB-Daw1Neeo.mjs} +3 -3
- package/dist/{rg-S4FXYXWB-CK7q5A50.mjs.map → rg-S4FXYXWB-Daw1Neeo.mjs.map} +1 -1
- package/dist/{rm-SSGETQVQ-CNUh_4QD.cjs → rm-SSGETQVQ-CLfbvtE_.cjs} +2 -2
- package/dist/{rm-SSGETQVQ-CNUh_4QD.cjs.map → rm-SSGETQVQ-CLfbvtE_.cjs.map} +1 -1
- package/dist/{rm-SSGETQVQ-DT8bFNIg.mjs → rm-SSGETQVQ-mYn2rfbf.mjs} +2 -2
- package/dist/{rm-SSGETQVQ-DT8bFNIg.mjs.map → rm-SSGETQVQ-mYn2rfbf.mjs.map} +1 -1
- package/dist/{rmdir-OC4ZLPYA-BGuH--Qg.mjs → rmdir-OC4ZLPYA-CHXC39jd.mjs} +2 -2
- package/dist/{rmdir-OC4ZLPYA-BGuH--Qg.mjs.map → rmdir-OC4ZLPYA-CHXC39jd.mjs.map} +1 -1
- package/dist/{rmdir-OC4ZLPYA-DLbPxwgg.cjs → rmdir-OC4ZLPYA-Dxi8KjV_.cjs} +2 -2
- package/dist/{rmdir-OC4ZLPYA-DLbPxwgg.cjs.map → rmdir-OC4ZLPYA-Dxi8KjV_.cjs.map} +1 -1
- package/dist/run.cjs +2 -2
- package/dist/run.mjs +2 -2
- package/dist/{sed-S5UIK574-CTf4sPBZ.cjs → sed-S5UIK574-DGWjrFUp.cjs} +2 -2
- package/dist/{sed-S5UIK574-CTf4sPBZ.cjs.map → sed-S5UIK574-DGWjrFUp.cjs.map} +1 -1
- package/dist/{sed-S5UIK574-4Yff0zNC.mjs → sed-S5UIK574-DK728_n-.mjs} +2 -2
- package/dist/{sed-S5UIK574-4Yff0zNC.mjs.map → sed-S5UIK574-DK728_n-.mjs.map} +1 -1
- package/dist/{sha1sum-2PTOAFR6--4STAKU2.cjs → sha1sum-2PTOAFR6-7ywnqQKT.cjs} +3 -3
- package/dist/{sha1sum-2PTOAFR6--4STAKU2.cjs.map → sha1sum-2PTOAFR6-7ywnqQKT.cjs.map} +1 -1
- package/dist/{sha1sum-2PTOAFR6-CEogjUiy.mjs → sha1sum-2PTOAFR6-CQ4zoYdG.mjs} +3 -3
- package/dist/{sha1sum-2PTOAFR6-CEogjUiy.mjs.map → sha1sum-2PTOAFR6-CQ4zoYdG.mjs.map} +1 -1
- package/dist/{sha256sum-NS7D3IXX-wJBTyyph.mjs → sha256sum-NS7D3IXX-BOcxhLhB.mjs} +3 -3
- package/dist/{sha256sum-NS7D3IXX-wJBTyyph.mjs.map → sha256sum-NS7D3IXX-BOcxhLhB.mjs.map} +1 -1
- package/dist/{sha256sum-NS7D3IXX-DtbxSY5M.cjs → sha256sum-NS7D3IXX-XJaaj5xs.cjs} +3 -3
- package/dist/{sha256sum-NS7D3IXX-DtbxSY5M.cjs.map → sha256sum-NS7D3IXX-XJaaj5xs.cjs.map} +1 -1
- package/dist/{sleep-X22JJINO-DT5qptKN.mjs → sleep-X22JJINO-CwarEW8j.mjs} +2 -2
- package/dist/{sleep-X22JJINO-DT5qptKN.mjs.map → sleep-X22JJINO-CwarEW8j.mjs.map} +1 -1
- package/dist/{sleep-X22JJINO-C66SKmwC.cjs → sleep-X22JJINO-DIXrHD3R.cjs} +2 -2
- package/dist/{sleep-X22JJINO-C66SKmwC.cjs.map → sleep-X22JJINO-DIXrHD3R.cjs.map} +1 -1
- package/dist/{sort-SW2YEO5B-D8N9myJQ.cjs → sort-SW2YEO5B-Buo6ev-O.cjs} +3 -3
- package/dist/{sort-SW2YEO5B-D8N9myJQ.cjs.map → sort-SW2YEO5B-Buo6ev-O.cjs.map} +1 -1
- package/dist/{sort-SW2YEO5B-yA7lnhHB.mjs → sort-SW2YEO5B-Du8oOAyb.mjs} +3 -3
- package/dist/{sort-SW2YEO5B-yA7lnhHB.mjs.map → sort-SW2YEO5B-Du8oOAyb.mjs.map} +1 -1
- package/dist/{split-4KKZZXXE-CS08hYCo.mjs → split-4KKZZXXE-Dwwdn3bk.mjs} +2 -2
- package/dist/{split-4KKZZXXE-CS08hYCo.mjs.map → split-4KKZZXXE-Dwwdn3bk.mjs.map} +1 -1
- package/dist/{split-4KKZZXXE-BlY87Dck.cjs → split-4KKZZXXE-OddRnGAH.cjs} +2 -2
- package/dist/{split-4KKZZXXE-BlY87Dck.cjs.map → split-4KKZZXXE-OddRnGAH.cjs.map} +1 -1
- package/dist/{sqlite3-CGOEFJAO-CjonNSD0.cjs → sqlite3-CGOEFJAO-BWLdebEu.cjs} +3 -3
- package/dist/{sqlite3-CGOEFJAO-CjonNSD0.cjs.map → sqlite3-CGOEFJAO-BWLdebEu.cjs.map} +1 -1
- package/dist/{sqlite3-CGOEFJAO-BSZzbrtO.mjs → sqlite3-CGOEFJAO-BgS0oHGp.mjs} +3 -3
- package/dist/{sqlite3-CGOEFJAO-BSZzbrtO.mjs.map → sqlite3-CGOEFJAO-BgS0oHGp.mjs.map} +1 -1
- package/dist/{start-D5FoH6Vb.cjs → start-CRsvMO8Z.cjs} +660 -659
- package/dist/start-CRsvMO8Z.cjs.map +1 -0
- package/dist/{start-DZfsW8bT.mjs → start-R2WutaaN.mjs} +110 -109
- package/dist/start-R2WutaaN.mjs.map +1 -0
- package/dist/start.cjs +1 -1
- package/dist/start.d.cts +1 -1
- package/dist/start.d.mts +1 -1
- package/dist/start.mjs +1 -1
- package/dist/{strings-6WDHLGMX-dBN5riC8.mjs → strings-6WDHLGMX-1pLzaL4-.mjs} +2 -2
- package/dist/{strings-6WDHLGMX-dBN5riC8.mjs.map → strings-6WDHLGMX-1pLzaL4-.mjs.map} +1 -1
- package/dist/{strings-6WDHLGMX-Cg_tqYOb.cjs → strings-6WDHLGMX-2JWiKgge.cjs} +2 -2
- package/dist/{strings-6WDHLGMX-Cg_tqYOb.cjs.map → strings-6WDHLGMX-2JWiKgge.cjs.map} +1 -1
- package/dist/{tac-2STMMJYW-BIGY7sLm.mjs → tac-2STMMJYW-DS78Z4cv.mjs} +2 -2
- package/dist/{tac-2STMMJYW-BIGY7sLm.mjs.map → tac-2STMMJYW-DS78Z4cv.mjs.map} +1 -1
- package/dist/{tac-2STMMJYW-Bzfn3TC9.cjs → tac-2STMMJYW-b3jCsqky.cjs} +2 -2
- package/dist/{tac-2STMMJYW-Bzfn3TC9.cjs.map → tac-2STMMJYW-b3jCsqky.cjs.map} +1 -1
- package/dist/{tail-R4PCA2C4-B9-kVj3s.mjs → tail-R4PCA2C4-BFq1JEoz.mjs} +2 -2
- package/dist/{tail-R4PCA2C4-B9-kVj3s.mjs.map → tail-R4PCA2C4-BFq1JEoz.mjs.map} +1 -1
- package/dist/{tail-R4PCA2C4-BTR-9hUH.cjs → tail-R4PCA2C4-aFC-IZ-5.cjs} +2 -2
- package/dist/{tail-R4PCA2C4-BTR-9hUH.cjs.map → tail-R4PCA2C4-aFC-IZ-5.cjs.map} +1 -1
- package/dist/{tar-STHHZTZ6-CiB-rnha.mjs → tar-STHHZTZ6-CiLELmgx.mjs} +4 -4
- package/dist/{tar-STHHZTZ6-CiB-rnha.mjs.map → tar-STHHZTZ6-CiLELmgx.mjs.map} +1 -1
- package/dist/{tar-STHHZTZ6-BsnOAsov.cjs → tar-STHHZTZ6-L8XDCiLN.cjs} +5 -5
- package/dist/{tar-STHHZTZ6-BsnOAsov.cjs.map → tar-STHHZTZ6-L8XDCiLN.cjs.map} +1 -1
- package/dist/{tee-YUZ2FKCJ-eHcOLY8N.mjs → tee-YUZ2FKCJ-3s4KqGaV.mjs} +2 -2
- package/dist/{tee-YUZ2FKCJ-eHcOLY8N.mjs.map → tee-YUZ2FKCJ-3s4KqGaV.mjs.map} +1 -1
- package/dist/{tee-YUZ2FKCJ-brys1NwD.cjs → tee-YUZ2FKCJ-B60QipOE.cjs} +2 -2
- package/dist/{tee-YUZ2FKCJ-brys1NwD.cjs.map → tee-YUZ2FKCJ-B60QipOE.cjs.map} +1 -1
- package/dist/{time-D4LNBSWX-DqFjGVOx.mjs → time-D4LNBSWX-CYd4omvD.mjs} +2 -2
- package/dist/{time-D4LNBSWX-DqFjGVOx.mjs.map → time-D4LNBSWX-CYd4omvD.mjs.map} +1 -1
- package/dist/{time-D4LNBSWX-DdgE9mfH.cjs → time-D4LNBSWX-DBg3ccZo.cjs} +2 -2
- package/dist/{time-D4LNBSWX-DdgE9mfH.cjs.map → time-D4LNBSWX-DBg3ccZo.cjs.map} +1 -1
- package/dist/{timeout-YDCRSLPQ-CMg13ZRF.cjs → timeout-YDCRSLPQ-DMiY-QQp.cjs} +2 -2
- package/dist/{timeout-YDCRSLPQ-CMg13ZRF.cjs.map → timeout-YDCRSLPQ-DMiY-QQp.cjs.map} +1 -1
- package/dist/{timeout-YDCRSLPQ-DlL8XB3b.mjs → timeout-YDCRSLPQ-xh3AcbT0.mjs} +2 -2
- package/dist/{timeout-YDCRSLPQ-DlL8XB3b.mjs.map → timeout-YDCRSLPQ-xh3AcbT0.mjs.map} +1 -1
- package/dist/{touch-UA33VN3N-Df5QMiBk.cjs → touch-UA33VN3N-ChzEhlVJ.cjs} +2 -2
- package/dist/{touch-UA33VN3N-Df5QMiBk.cjs.map → touch-UA33VN3N-ChzEhlVJ.cjs.map} +1 -1
- package/dist/{touch-UA33VN3N-Drvvex69.mjs → touch-UA33VN3N-DEM7K4Oi.mjs} +2 -2
- package/dist/{touch-UA33VN3N-Drvvex69.mjs.map → touch-UA33VN3N-DEM7K4Oi.mjs.map} +1 -1
- package/dist/{tr-36LHWFRQ-CV15om3i.mjs → tr-36LHWFRQ-Bs_CFglo.mjs} +2 -2
- package/dist/{tr-36LHWFRQ-CV15om3i.mjs.map → tr-36LHWFRQ-Bs_CFglo.mjs.map} +1 -1
- package/dist/{tr-36LHWFRQ-BY9ufPWZ.cjs → tr-36LHWFRQ-WSAxLcKD.cjs} +2 -2
- package/dist/{tr-36LHWFRQ-BY9ufPWZ.cjs.map → tr-36LHWFRQ-WSAxLcKD.cjs.map} +1 -1
- package/dist/{tree-YLD52CNT-B5OMBofY.cjs → tree-YLD52CNT-B55yybrR.cjs} +2 -2
- package/dist/{tree-YLD52CNT-B5OMBofY.cjs.map → tree-YLD52CNT-B55yybrR.cjs.map} +1 -1
- package/dist/{tree-YLD52CNT-CHyXPgTW.mjs → tree-YLD52CNT-Bv7uMDP4.mjs} +2 -2
- package/dist/{tree-YLD52CNT-CHyXPgTW.mjs.map → tree-YLD52CNT-Bv7uMDP4.mjs.map} +1 -1
- package/dist/{unexpand-CADSA4VO-CNHmvRV6.mjs → unexpand-CADSA4VO-969cCtfJ.mjs} +2 -2
- package/dist/{unexpand-CADSA4VO-CNHmvRV6.mjs.map → unexpand-CADSA4VO-969cCtfJ.mjs.map} +1 -1
- package/dist/{unexpand-CADSA4VO-DPjQdMvp.cjs → unexpand-CADSA4VO-BHkcjme2.cjs} +2 -2
- package/dist/{unexpand-CADSA4VO-DPjQdMvp.cjs.map → unexpand-CADSA4VO-BHkcjme2.cjs.map} +1 -1
- package/dist/{uniq-XSIZR6PB-Bs8o84T7.mjs → uniq-XSIZR6PB-DfO95Apn.mjs} +3 -3
- package/dist/{uniq-XSIZR6PB-Bs8o84T7.mjs.map → uniq-XSIZR6PB-DfO95Apn.mjs.map} +1 -1
- package/dist/{uniq-XSIZR6PB-N2XObRnq.cjs → uniq-XSIZR6PB-d0jC5yQd.cjs} +3 -3
- package/dist/{uniq-XSIZR6PB-N2XObRnq.cjs.map → uniq-XSIZR6PB-d0jC5yQd.cjs.map} +1 -1
- package/dist/wait-for-health-XEzPPQIO-ColBOzq6.mjs +222 -0
- package/dist/wait-for-health-XEzPPQIO-ColBOzq6.mjs.map +1 -0
- package/dist/wait-for-health-XEzPPQIO-CzLWGoGw.cjs +281 -0
- package/dist/wait-for-health-XEzPPQIO-CzLWGoGw.cjs.map +1 -0
- package/dist/{wc-LF7NU4LA-DUkKyM1b.cjs → wc-LF7NU4LA-Bz5pTJq5.cjs} +3 -3
- package/dist/{wc-LF7NU4LA-DUkKyM1b.cjs.map → wc-LF7NU4LA-Bz5pTJq5.cjs.map} +1 -1
- package/dist/{wc-LF7NU4LA-q_LVulTk.mjs → wc-LF7NU4LA-C1zRuin1.mjs} +3 -3
- package/dist/{wc-LF7NU4LA-q_LVulTk.mjs.map → wc-LF7NU4LA-C1zRuin1.mjs.map} +1 -1
- package/dist/{with-project-scope-CXKYhKdp.mjs → with-project-scope-7Bm9gYir.mjs} +46 -3
- package/dist/with-project-scope-7Bm9gYir.mjs.map +1 -0
- package/dist/{with-project-scope-Chn_m-kG.cjs → with-project-scope-D18zPGEE.cjs} +58 -3
- package/dist/with-project-scope-D18zPGEE.cjs.map +1 -0
- package/dist/{xan-Y6WF3IRG-B4M0UKhu.cjs → xan-Y6WF3IRG-BV1K518F.cjs} +6 -6
- package/dist/{xan-Y6WF3IRG-B4M0UKhu.cjs.map → xan-Y6WF3IRG-BV1K518F.cjs.map} +1 -1
- package/dist/{xan-Y6WF3IRG-DLTybHjl.mjs → xan-Y6WF3IRG-Cc44_DTM.mjs} +6 -6
- package/dist/{xan-Y6WF3IRG-DLTybHjl.mjs.map → xan-Y6WF3IRG-Cc44_DTM.mjs.map} +1 -1
- package/dist/{xan-view-HDVKHFC2-DKhEN8Yw.cjs → xan-view-HDVKHFC2-DV7rblTJ.cjs} +3 -3
- package/dist/{xan-view-HDVKHFC2-DKhEN8Yw.cjs.map → xan-view-HDVKHFC2-DV7rblTJ.cjs.map} +1 -1
- package/dist/{xan-view-HDVKHFC2-D21CAdoe.mjs → xan-view-HDVKHFC2-DgGc0G3R.mjs} +3 -3
- package/dist/{xan-view-HDVKHFC2-D21CAdoe.mjs.map → xan-view-HDVKHFC2-DgGc0G3R.mjs.map} +1 -1
- package/dist/{xargs-MGZPH7AX-DdrX01gn.cjs → xargs-MGZPH7AX-BBKDagR4.cjs} +2 -2
- package/dist/{xargs-MGZPH7AX-DdrX01gn.cjs.map → xargs-MGZPH7AX-BBKDagR4.cjs.map} +1 -1
- package/dist/{xargs-MGZPH7AX-Dl-NCr4Q.mjs → xargs-MGZPH7AX-DI6LeEQD.mjs} +2 -2
- package/dist/{xargs-MGZPH7AX-Dl-NCr4Q.mjs.map → xargs-MGZPH7AX-DI6LeEQD.mjs.map} +1 -1
- package/dist/{yq-4QJW3EQG-BZ9MoCxj.mjs → yq-4QJW3EQG-B7bWWIWh.mjs} +3 -3
- package/dist/{yq-4QJW3EQG-BZ9MoCxj.mjs.map → yq-4QJW3EQG-B7bWWIWh.mjs.map} +1 -1
- package/dist/{yq-4QJW3EQG-dEY70ZjO.cjs → yq-4QJW3EQG-CnQDxlAc.cjs} +3 -3
- package/dist/{yq-4QJW3EQG-dEY70ZjO.cjs.map → yq-4QJW3EQG-CnQDxlAc.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/config.cjs.map +0 -1
- package/dist/config.mjs.map +0 -1
- package/dist/dist-BjqTzHjj.mjs.map +0 -1
- package/dist/dist-CuSODqFN.cjs.map +0 -1
- package/dist/dist-DBqDiQ-O.cjs +0 -8416
- package/dist/dist-DBqDiQ-O.cjs.map +0 -1
- package/dist/dist-Vzd7f_KW.mjs +0 -8351
- package/dist/dist-Vzd7f_KW.mjs.map +0 -1
- package/dist/start-D5FoH6Vb.cjs.map +0 -1
- package/dist/start-DZfsW8bT.mjs.map +0 -1
- package/dist/with-project-scope-CXKYhKdp.mjs.map +0 -1
- package/dist/with-project-scope-Chn_m-kG.cjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const require_dist = require("./dist-
|
|
2
|
-
const
|
|
1
|
+
const require_dist = require("./dist-Bqh3rPbq.cjs");
|
|
2
|
+
const require_wait_for_health_XEzPPQIO = require("./wait-for-health-XEzPPQIO-CzLWGoGw.cjs");
|
|
3
|
+
const require_with_project_scope = require("./with-project-scope-D18zPGEE.cjs");
|
|
3
4
|
require("./chunk-BZUGFHVS-7RRM7Jpb.cjs");
|
|
4
5
|
const require_chunk_TN7HHBQW = require("./chunk-TN7HHBQW-D_SK6w5n.cjs");
|
|
5
|
-
const require_with_project_scope = require("./with-project-scope-Chn_m-kG.cjs");
|
|
6
6
|
let node_crypto = require("node:crypto");
|
|
7
7
|
require("node:fs/promises");
|
|
8
8
|
let _keystrokehq_database = require("@keystrokehq/database");
|
|
@@ -101,8 +101,9 @@ zod.z.object({
|
|
|
101
101
|
path: zod.z.string().describe("Path under /workspace (e.g. session/out.txt or agent/data.json)"),
|
|
102
102
|
content: zod.z.string().describe("Content to write to the file")
|
|
103
103
|
});
|
|
104
|
+
new node_async_hooks.AsyncLocalStorage();
|
|
104
105
|
//#endregion
|
|
105
|
-
//#region ../../packages/sandbox/dist/files-
|
|
106
|
+
//#region ../../packages/sandbox/dist/files-B-ILJRDm.mjs
|
|
106
107
|
const SandboxModeSchema = zod.z.enum(["in-process", "vm"]);
|
|
107
108
|
const SandboxFileContentSchema = zod.z.object({
|
|
108
109
|
path: zod.z.string(),
|
|
@@ -143,7 +144,7 @@ zod.z.object({
|
|
|
143
144
|
/** Sandbox execution mode. Defaults to in-process when omitted. */
|
|
144
145
|
mode: SandboxModeSchema.optional(),
|
|
145
146
|
files: SandboxFilesInputSchema.optional(),
|
|
146
|
-
credentials: zod.z.array(require_dist
|
|
147
|
+
credentials: zod.z.array(require_dist.credentialInputSchema).optional(),
|
|
147
148
|
env: SandboxEnvFnSchema.optional(),
|
|
148
149
|
git: SandboxGitSchema.optional(),
|
|
149
150
|
setup: SandboxSetupSchema.optional()
|
|
@@ -184,12 +185,11 @@ zod.z.object({
|
|
|
184
185
|
key: zod.z.string().optional(),
|
|
185
186
|
mode: SandboxModeSchema.optional(),
|
|
186
187
|
files: zod.z.array(SandboxFileSchema).optional(),
|
|
187
|
-
credentials: zod.z.array(require_dist
|
|
188
|
+
credentials: zod.z.array(require_dist.credentialInputSchema).optional(),
|
|
188
189
|
env: SandboxEnvFnSchema.optional(),
|
|
189
190
|
git: SandboxGitSchema.optional(),
|
|
190
191
|
setup: SandboxSetupSchema.optional()
|
|
191
192
|
});
|
|
192
|
-
new node_async_hooks.AsyncLocalStorage();
|
|
193
193
|
//#endregion
|
|
194
194
|
//#region ../../node_modules/.pnpm/just-bash@3.0.1/node_modules/just-bash/dist/bundle/chunks/chunk-4RUAZWKT.js
|
|
195
195
|
(0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
@@ -20149,7 +20149,7 @@ var g = class i {
|
|
|
20149
20149
|
endPos() {
|
|
20150
20150
|
return this.end;
|
|
20151
20151
|
}
|
|
20152
|
-
}, z$
|
|
20152
|
+
}, z$8 = class extends L {
|
|
20153
20153
|
constructor(t, e = 0, s = t.length) {
|
|
20154
20154
|
super(), this.bytes = t, this.start = e, this.end = s;
|
|
20155
20155
|
}
|
|
@@ -20206,7 +20206,7 @@ var g = class i {
|
|
|
20206
20206
|
}
|
|
20207
20207
|
}, R = class {
|
|
20208
20208
|
static fromUTF8(t, e = 0, s = t.length) {
|
|
20209
|
-
return new z$
|
|
20209
|
+
return new z$8(t, e, s);
|
|
20210
20210
|
}
|
|
20211
20211
|
static fromUTF16(t, e = 0, s = t.length) {
|
|
20212
20212
|
return new $$1(t, e, s);
|
|
@@ -22992,43 +22992,43 @@ var tt = [
|
|
|
22992
22992
|
},
|
|
22993
22993
|
{
|
|
22994
22994
|
name: "cat",
|
|
22995
|
-
load: async () => (await Promise.resolve().then(() => require("./cat-TSFMZVYS-
|
|
22995
|
+
load: async () => (await Promise.resolve().then(() => require("./cat-TSFMZVYS-6dEqhBmm.cjs"))).catCommand
|
|
22996
22996
|
},
|
|
22997
22997
|
{
|
|
22998
22998
|
name: "printf",
|
|
22999
|
-
load: async () => (await Promise.resolve().then(() => require("./printf-TWGXF445-
|
|
22999
|
+
load: async () => (await Promise.resolve().then(() => require("./printf-TWGXF445-DQy9Bsfl.cjs"))).printfCommand
|
|
23000
23000
|
},
|
|
23001
23001
|
{
|
|
23002
23002
|
name: "ls",
|
|
23003
|
-
load: async () => (await Promise.resolve().then(() => require("./ls-ZJGQER7M-
|
|
23003
|
+
load: async () => (await Promise.resolve().then(() => require("./ls-ZJGQER7M-Bcn7qAy0.cjs"))).lsCommand
|
|
23004
23004
|
},
|
|
23005
23005
|
{
|
|
23006
23006
|
name: "mkdir",
|
|
23007
|
-
load: async () => (await Promise.resolve().then(() => require("./mkdir-MEPGZOB6-
|
|
23007
|
+
load: async () => (await Promise.resolve().then(() => require("./mkdir-MEPGZOB6-BiX5Vu18.cjs"))).mkdirCommand
|
|
23008
23008
|
},
|
|
23009
23009
|
{
|
|
23010
23010
|
name: "rmdir",
|
|
23011
|
-
load: async () => (await Promise.resolve().then(() => require("./rmdir-OC4ZLPYA-
|
|
23011
|
+
load: async () => (await Promise.resolve().then(() => require("./rmdir-OC4ZLPYA-Dxi8KjV_.cjs"))).rmdirCommand
|
|
23012
23012
|
},
|
|
23013
23013
|
{
|
|
23014
23014
|
name: "touch",
|
|
23015
|
-
load: async () => (await Promise.resolve().then(() => require("./touch-UA33VN3N-
|
|
23015
|
+
load: async () => (await Promise.resolve().then(() => require("./touch-UA33VN3N-ChzEhlVJ.cjs"))).touchCommand
|
|
23016
23016
|
},
|
|
23017
23017
|
{
|
|
23018
23018
|
name: "rm",
|
|
23019
|
-
load: async () => (await Promise.resolve().then(() => require("./rm-SSGETQVQ-
|
|
23019
|
+
load: async () => (await Promise.resolve().then(() => require("./rm-SSGETQVQ-CLfbvtE_.cjs"))).rmCommand
|
|
23020
23020
|
},
|
|
23021
23021
|
{
|
|
23022
23022
|
name: "cp",
|
|
23023
|
-
load: async () => (await Promise.resolve().then(() => require("./cp-BISAAS7A-
|
|
23023
|
+
load: async () => (await Promise.resolve().then(() => require("./cp-BISAAS7A-C2krfNmE.cjs"))).cpCommand
|
|
23024
23024
|
},
|
|
23025
23025
|
{
|
|
23026
23026
|
name: "mv",
|
|
23027
|
-
load: async () => (await Promise.resolve().then(() => require("./mv-W5BIQ646-
|
|
23027
|
+
load: async () => (await Promise.resolve().then(() => require("./mv-W5BIQ646-CfAhGw3i.cjs"))).mvCommand
|
|
23028
23028
|
},
|
|
23029
23029
|
{
|
|
23030
23030
|
name: "ln",
|
|
23031
|
-
load: async () => (await Promise.resolve().then(() => require("./ln-4LGSXXGD-
|
|
23031
|
+
load: async () => (await Promise.resolve().then(() => require("./ln-4LGSXXGD-B1Kkh1ha.cjs"))).lnCommand
|
|
23032
23032
|
},
|
|
23033
23033
|
{
|
|
23034
23034
|
name: "chmod",
|
|
@@ -23044,15 +23044,15 @@ var tt = [
|
|
|
23044
23044
|
},
|
|
23045
23045
|
{
|
|
23046
23046
|
name: "head",
|
|
23047
|
-
load: async () => (await Promise.resolve().then(() => require("./head-442HYESI-
|
|
23047
|
+
load: async () => (await Promise.resolve().then(() => require("./head-442HYESI-DvzjT244.cjs"))).headCommand
|
|
23048
23048
|
},
|
|
23049
23049
|
{
|
|
23050
23050
|
name: "tail",
|
|
23051
|
-
load: async () => (await Promise.resolve().then(() => require("./tail-R4PCA2C4-
|
|
23051
|
+
load: async () => (await Promise.resolve().then(() => require("./tail-R4PCA2C4-aFC-IZ-5.cjs"))).tailCommand
|
|
23052
23052
|
},
|
|
23053
23053
|
{
|
|
23054
23054
|
name: "wc",
|
|
23055
|
-
load: async () => (await Promise.resolve().then(() => require("./wc-LF7NU4LA-
|
|
23055
|
+
load: async () => (await Promise.resolve().then(() => require("./wc-LF7NU4LA-Bz5pTJq5.cjs"))).wcCommand
|
|
23056
23056
|
},
|
|
23057
23057
|
{
|
|
23058
23058
|
name: "stat",
|
|
@@ -23060,95 +23060,95 @@ var tt = [
|
|
|
23060
23060
|
},
|
|
23061
23061
|
{
|
|
23062
23062
|
name: "grep",
|
|
23063
|
-
load: async () => (await Promise.resolve().then(() => require("./grep-V3LQVMRQ-
|
|
23063
|
+
load: async () => (await Promise.resolve().then(() => require("./grep-V3LQVMRQ-C1PzxoF4.cjs"))).grepCommand
|
|
23064
23064
|
},
|
|
23065
23065
|
{
|
|
23066
23066
|
name: "fgrep",
|
|
23067
|
-
load: async () => (await Promise.resolve().then(() => require("./grep-V3LQVMRQ-
|
|
23067
|
+
load: async () => (await Promise.resolve().then(() => require("./grep-V3LQVMRQ-C1PzxoF4.cjs"))).fgrepCommand
|
|
23068
23068
|
},
|
|
23069
23069
|
{
|
|
23070
23070
|
name: "egrep",
|
|
23071
|
-
load: async () => (await Promise.resolve().then(() => require("./grep-V3LQVMRQ-
|
|
23071
|
+
load: async () => (await Promise.resolve().then(() => require("./grep-V3LQVMRQ-C1PzxoF4.cjs"))).egrepCommand
|
|
23072
23072
|
},
|
|
23073
23073
|
{
|
|
23074
23074
|
name: "rg",
|
|
23075
|
-
load: async () => (await Promise.resolve().then(() => require("./rg-S4FXYXWB-
|
|
23075
|
+
load: async () => (await Promise.resolve().then(() => require("./rg-S4FXYXWB-B8lu59hX.cjs"))).rgCommand
|
|
23076
23076
|
},
|
|
23077
23077
|
{
|
|
23078
23078
|
name: "sed",
|
|
23079
|
-
load: async () => (await Promise.resolve().then(() => require("./sed-S5UIK574-
|
|
23079
|
+
load: async () => (await Promise.resolve().then(() => require("./sed-S5UIK574-DGWjrFUp.cjs"))).sedCommand
|
|
23080
23080
|
},
|
|
23081
23081
|
{
|
|
23082
23082
|
name: "awk",
|
|
23083
|
-
load: async () => (await Promise.resolve().then(() => require("./awk2-LA3USKJP-
|
|
23083
|
+
load: async () => (await Promise.resolve().then(() => require("./awk2-LA3USKJP-CRpeKCfQ.cjs"))).awkCommand2
|
|
23084
23084
|
},
|
|
23085
23085
|
{
|
|
23086
23086
|
name: "sort",
|
|
23087
|
-
load: async () => (await Promise.resolve().then(() => require("./sort-SW2YEO5B-
|
|
23087
|
+
load: async () => (await Promise.resolve().then(() => require("./sort-SW2YEO5B-Buo6ev-O.cjs"))).sortCommand
|
|
23088
23088
|
},
|
|
23089
23089
|
{
|
|
23090
23090
|
name: "uniq",
|
|
23091
|
-
load: async () => (await Promise.resolve().then(() => require("./uniq-XSIZR6PB-
|
|
23091
|
+
load: async () => (await Promise.resolve().then(() => require("./uniq-XSIZR6PB-d0jC5yQd.cjs"))).uniqCommand
|
|
23092
23092
|
},
|
|
23093
23093
|
{
|
|
23094
23094
|
name: "comm",
|
|
23095
|
-
load: async () => (await Promise.resolve().then(() => require("./comm-VV2LDX2J-
|
|
23095
|
+
load: async () => (await Promise.resolve().then(() => require("./comm-VV2LDX2J-BFfsarPx.cjs"))).commCommand
|
|
23096
23096
|
},
|
|
23097
23097
|
{
|
|
23098
23098
|
name: "cut",
|
|
23099
|
-
load: async () => (await Promise.resolve().then(() => require("./cut-OKARJCCV-
|
|
23099
|
+
load: async () => (await Promise.resolve().then(() => require("./cut-OKARJCCV-BrZy_JBc.cjs"))).cutCommand
|
|
23100
23100
|
},
|
|
23101
23101
|
{
|
|
23102
23102
|
name: "paste",
|
|
23103
|
-
load: async () => (await Promise.resolve().then(() => require("./paste-7JC6S4DX-
|
|
23103
|
+
load: async () => (await Promise.resolve().then(() => require("./paste-7JC6S4DX-DqexKgEh.cjs"))).pasteCommand
|
|
23104
23104
|
},
|
|
23105
23105
|
{
|
|
23106
23106
|
name: "tr",
|
|
23107
|
-
load: async () => (await Promise.resolve().then(() => require("./tr-36LHWFRQ-
|
|
23107
|
+
load: async () => (await Promise.resolve().then(() => require("./tr-36LHWFRQ-WSAxLcKD.cjs"))).trCommand
|
|
23108
23108
|
},
|
|
23109
23109
|
{
|
|
23110
23110
|
name: "rev",
|
|
23111
|
-
load: async () => (await Promise.resolve().then(() => require("./rev-5EHFX4EJ-
|
|
23111
|
+
load: async () => (await Promise.resolve().then(() => require("./rev-5EHFX4EJ-EputkmDM.cjs"))).rev
|
|
23112
23112
|
},
|
|
23113
23113
|
{
|
|
23114
23114
|
name: "nl",
|
|
23115
|
-
load: async () => (await Promise.resolve().then(() => require("./nl-WSDW7I4O-
|
|
23115
|
+
load: async () => (await Promise.resolve().then(() => require("./nl-WSDW7I4O-BKbW5dn8.cjs"))).nl
|
|
23116
23116
|
},
|
|
23117
23117
|
{
|
|
23118
23118
|
name: "fold",
|
|
23119
|
-
load: async () => (await Promise.resolve().then(() => require("./fold-4TQNYMSW-
|
|
23119
|
+
load: async () => (await Promise.resolve().then(() => require("./fold-4TQNYMSW-DYBfLnwa.cjs"))).fold
|
|
23120
23120
|
},
|
|
23121
23121
|
{
|
|
23122
23122
|
name: "expand",
|
|
23123
|
-
load: async () => (await Promise.resolve().then(() => require("./expand-JSPG6VOP-
|
|
23123
|
+
load: async () => (await Promise.resolve().then(() => require("./expand-JSPG6VOP-BAmgU6tl.cjs"))).expand
|
|
23124
23124
|
},
|
|
23125
23125
|
{
|
|
23126
23126
|
name: "unexpand",
|
|
23127
|
-
load: async () => (await Promise.resolve().then(() => require("./unexpand-CADSA4VO-
|
|
23127
|
+
load: async () => (await Promise.resolve().then(() => require("./unexpand-CADSA4VO-BHkcjme2.cjs"))).unexpand
|
|
23128
23128
|
},
|
|
23129
23129
|
{
|
|
23130
23130
|
name: "strings",
|
|
23131
|
-
load: async () => (await Promise.resolve().then(() => require("./strings-6WDHLGMX-
|
|
23131
|
+
load: async () => (await Promise.resolve().then(() => require("./strings-6WDHLGMX-2JWiKgge.cjs"))).strings
|
|
23132
23132
|
},
|
|
23133
23133
|
{
|
|
23134
23134
|
name: "split",
|
|
23135
|
-
load: async () => (await Promise.resolve().then(() => require("./split-4KKZZXXE-
|
|
23135
|
+
load: async () => (await Promise.resolve().then(() => require("./split-4KKZZXXE-OddRnGAH.cjs"))).split
|
|
23136
23136
|
},
|
|
23137
23137
|
{
|
|
23138
23138
|
name: "column",
|
|
23139
|
-
load: async () => (await Promise.resolve().then(() => require("./column-XT6UFXNQ-
|
|
23139
|
+
load: async () => (await Promise.resolve().then(() => require("./column-XT6UFXNQ-DiKFWUTy.cjs"))).column
|
|
23140
23140
|
},
|
|
23141
23141
|
{
|
|
23142
23142
|
name: "join",
|
|
23143
|
-
load: async () => (await Promise.resolve().then(() => require("./join-TBRGI3LQ-
|
|
23143
|
+
load: async () => (await Promise.resolve().then(() => require("./join-TBRGI3LQ-8WBxN8S3.cjs"))).join
|
|
23144
23144
|
},
|
|
23145
23145
|
{
|
|
23146
23146
|
name: "tee",
|
|
23147
|
-
load: async () => (await Promise.resolve().then(() => require("./tee-YUZ2FKCJ-
|
|
23147
|
+
load: async () => (await Promise.resolve().then(() => require("./tee-YUZ2FKCJ-B60QipOE.cjs"))).teeCommand
|
|
23148
23148
|
},
|
|
23149
23149
|
{
|
|
23150
23150
|
name: "find",
|
|
23151
|
-
load: async () => (await Promise.resolve().then(() => require("./find-INTH3OLC-
|
|
23151
|
+
load: async () => (await Promise.resolve().then(() => require("./find-INTH3OLC-BTShg9xs.cjs"))).findCommand
|
|
23152
23152
|
},
|
|
23153
23153
|
{
|
|
23154
23154
|
name: "basename",
|
|
@@ -23160,19 +23160,19 @@ var tt = [
|
|
|
23160
23160
|
},
|
|
23161
23161
|
{
|
|
23162
23162
|
name: "tree",
|
|
23163
|
-
load: async () => (await Promise.resolve().then(() => require("./tree-YLD52CNT-
|
|
23163
|
+
load: async () => (await Promise.resolve().then(() => require("./tree-YLD52CNT-B55yybrR.cjs"))).treeCommand
|
|
23164
23164
|
},
|
|
23165
23165
|
{
|
|
23166
23166
|
name: "du",
|
|
23167
|
-
load: async () => (await Promise.resolve().then(() => require("./du-572XNP42-
|
|
23167
|
+
load: async () => (await Promise.resolve().then(() => require("./du-572XNP42-Cd7S5r3G.cjs"))).duCommand
|
|
23168
23168
|
},
|
|
23169
23169
|
{
|
|
23170
23170
|
name: "env",
|
|
23171
|
-
load: async () => (await Promise.resolve().then(() => require("./env-36M5BO7M-
|
|
23171
|
+
load: async () => (await Promise.resolve().then(() => require("./env-36M5BO7M-DUYG60IR.cjs"))).envCommand
|
|
23172
23172
|
},
|
|
23173
23173
|
{
|
|
23174
23174
|
name: "printenv",
|
|
23175
|
-
load: async () => (await Promise.resolve().then(() => require("./env-36M5BO7M-
|
|
23175
|
+
load: async () => (await Promise.resolve().then(() => require("./env-36M5BO7M-DUYG60IR.cjs"))).printenvCommand
|
|
23176
23176
|
},
|
|
23177
23177
|
{
|
|
23178
23178
|
name: "alias",
|
|
@@ -23188,7 +23188,7 @@ var tt = [
|
|
|
23188
23188
|
},
|
|
23189
23189
|
{
|
|
23190
23190
|
name: "xargs",
|
|
23191
|
-
load: async () => (await Promise.resolve().then(() => require("./xargs-MGZPH7AX-
|
|
23191
|
+
load: async () => (await Promise.resolve().then(() => require("./xargs-MGZPH7AX-BBKDagR4.cjs"))).xargsCommand
|
|
23192
23192
|
},
|
|
23193
23193
|
{
|
|
23194
23194
|
name: "true",
|
|
@@ -23204,23 +23204,23 @@ var tt = [
|
|
|
23204
23204
|
},
|
|
23205
23205
|
{
|
|
23206
23206
|
name: "bash",
|
|
23207
|
-
load: async () => (await Promise.resolve().then(() => require("./bash-YZ33HQZQ-
|
|
23207
|
+
load: async () => (await Promise.resolve().then(() => require("./bash-YZ33HQZQ-BNCFBZcV.cjs"))).bashCommand
|
|
23208
23208
|
},
|
|
23209
23209
|
{
|
|
23210
23210
|
name: "sh",
|
|
23211
|
-
load: async () => (await Promise.resolve().then(() => require("./bash-YZ33HQZQ-
|
|
23211
|
+
load: async () => (await Promise.resolve().then(() => require("./bash-YZ33HQZQ-BNCFBZcV.cjs"))).shCommand
|
|
23212
23212
|
},
|
|
23213
23213
|
{
|
|
23214
23214
|
name: "jq",
|
|
23215
|
-
load: async () => (await Promise.resolve().then(() => require("./jq-4XLYLOS5-
|
|
23215
|
+
load: async () => (await Promise.resolve().then(() => require("./jq-4XLYLOS5-CgNV85jS.cjs"))).jqCommand
|
|
23216
23216
|
},
|
|
23217
23217
|
{
|
|
23218
23218
|
name: "base64",
|
|
23219
|
-
load: async () => (await Promise.resolve().then(() => require("./base64-C2AIWVNC-
|
|
23219
|
+
load: async () => (await Promise.resolve().then(() => require("./base64-C2AIWVNC-Bkg108Je.cjs"))).base64Command
|
|
23220
23220
|
},
|
|
23221
23221
|
{
|
|
23222
23222
|
name: "diff",
|
|
23223
|
-
load: async () => (await Promise.resolve().then(() => require("./diff-MWJFIG7X-
|
|
23223
|
+
load: async () => (await Promise.resolve().then(() => require("./diff-MWJFIG7X-_Pn5aMae.cjs"))).diffCommand
|
|
23224
23224
|
},
|
|
23225
23225
|
{
|
|
23226
23226
|
name: "date",
|
|
@@ -23228,15 +23228,15 @@ var tt = [
|
|
|
23228
23228
|
},
|
|
23229
23229
|
{
|
|
23230
23230
|
name: "sleep",
|
|
23231
|
-
load: async () => (await Promise.resolve().then(() => require("./sleep-X22JJINO-
|
|
23231
|
+
load: async () => (await Promise.resolve().then(() => require("./sleep-X22JJINO-DIXrHD3R.cjs"))).sleepCommand
|
|
23232
23232
|
},
|
|
23233
23233
|
{
|
|
23234
23234
|
name: "timeout",
|
|
23235
|
-
load: async () => (await Promise.resolve().then(() => require("./timeout-YDCRSLPQ-
|
|
23235
|
+
load: async () => (await Promise.resolve().then(() => require("./timeout-YDCRSLPQ-DMiY-QQp.cjs"))).timeoutCommand
|
|
23236
23236
|
},
|
|
23237
23237
|
{
|
|
23238
23238
|
name: "time",
|
|
23239
|
-
load: async () => (await Promise.resolve().then(() => require("./time-D4LNBSWX-
|
|
23239
|
+
load: async () => (await Promise.resolve().then(() => require("./time-D4LNBSWX-DBg3ccZo.cjs"))).timeCommand
|
|
23240
23240
|
},
|
|
23241
23241
|
{
|
|
23242
23242
|
name: "seq",
|
|
@@ -23244,19 +23244,19 @@ var tt = [
|
|
|
23244
23244
|
},
|
|
23245
23245
|
{
|
|
23246
23246
|
name: "expr",
|
|
23247
|
-
load: async () => (await Promise.resolve().then(() => require("./expr-5JAACS4X-
|
|
23247
|
+
load: async () => (await Promise.resolve().then(() => require("./expr-5JAACS4X-sB386XcD.cjs"))).exprCommand
|
|
23248
23248
|
},
|
|
23249
23249
|
{
|
|
23250
23250
|
name: "md5sum",
|
|
23251
|
-
load: async () => (await Promise.resolve().then(() => require("./md5sum-SPU24VSG-
|
|
23251
|
+
load: async () => (await Promise.resolve().then(() => require("./md5sum-SPU24VSG-DS0UmURz.cjs"))).md5sumCommand
|
|
23252
23252
|
},
|
|
23253
23253
|
{
|
|
23254
23254
|
name: "sha1sum",
|
|
23255
|
-
load: async () => (await Promise.resolve().then(() => require("./sha1sum-2PTOAFR6
|
|
23255
|
+
load: async () => (await Promise.resolve().then(() => require("./sha1sum-2PTOAFR6-7ywnqQKT.cjs"))).sha1sumCommand
|
|
23256
23256
|
},
|
|
23257
23257
|
{
|
|
23258
23258
|
name: "sha256sum",
|
|
23259
|
-
load: async () => (await Promise.resolve().then(() => require("./sha256sum-NS7D3IXX-
|
|
23259
|
+
load: async () => (await Promise.resolve().then(() => require("./sha256sum-NS7D3IXX-XJaaj5xs.cjs"))).sha256sumCommand
|
|
23260
23260
|
},
|
|
23261
23261
|
{
|
|
23262
23262
|
name: "file",
|
|
@@ -23264,11 +23264,11 @@ var tt = [
|
|
|
23264
23264
|
},
|
|
23265
23265
|
{
|
|
23266
23266
|
name: "html-to-markdown",
|
|
23267
|
-
load: async () => (await Promise.resolve().then(() => require("./html-to-markdown-JW4MSQZO-
|
|
23267
|
+
load: async () => (await Promise.resolve().then(() => require("./html-to-markdown-JW4MSQZO-B0MrYci-.cjs"))).htmlToMarkdownCommand
|
|
23268
23268
|
},
|
|
23269
23269
|
{
|
|
23270
23270
|
name: "help",
|
|
23271
|
-
load: async () => (await Promise.resolve().then(() => require("./help-HZ6M2CKN-
|
|
23271
|
+
load: async () => (await Promise.resolve().then(() => require("./help-HZ6M2CKN-F4KWA-Lo.cjs"))).helpCommand
|
|
23272
23272
|
},
|
|
23273
23273
|
{
|
|
23274
23274
|
name: "which",
|
|
@@ -23276,7 +23276,7 @@ var tt = [
|
|
|
23276
23276
|
},
|
|
23277
23277
|
{
|
|
23278
23278
|
name: "tac",
|
|
23279
|
-
load: async () => (await Promise.resolve().then(() => require("./tac-2STMMJYW-
|
|
23279
|
+
load: async () => (await Promise.resolve().then(() => require("./tac-2STMMJYW-b3jCsqky.cjs"))).tac
|
|
23280
23280
|
},
|
|
23281
23281
|
{
|
|
23282
23282
|
name: "hostname",
|
|
@@ -23288,49 +23288,49 @@ var tt = [
|
|
|
23288
23288
|
},
|
|
23289
23289
|
{
|
|
23290
23290
|
name: "od",
|
|
23291
|
-
load: async () => (await Promise.resolve().then(() => require("./od-WOKFDJTP-
|
|
23291
|
+
load: async () => (await Promise.resolve().then(() => require("./od-WOKFDJTP-6_AAfiI2.cjs"))).od
|
|
23292
23292
|
},
|
|
23293
23293
|
{
|
|
23294
23294
|
name: "gzip",
|
|
23295
|
-
load: async () => (await Promise.resolve().then(() => require("./gzip-O5ASJAFY-
|
|
23295
|
+
load: async () => (await Promise.resolve().then(() => require("./gzip-O5ASJAFY-DKP63NQf.cjs"))).gzipCommand
|
|
23296
23296
|
},
|
|
23297
23297
|
{
|
|
23298
23298
|
name: "gunzip",
|
|
23299
|
-
load: async () => (await Promise.resolve().then(() => require("./gzip-O5ASJAFY-
|
|
23299
|
+
load: async () => (await Promise.resolve().then(() => require("./gzip-O5ASJAFY-DKP63NQf.cjs"))).gunzipCommand
|
|
23300
23300
|
},
|
|
23301
23301
|
{
|
|
23302
23302
|
name: "zcat",
|
|
23303
|
-
load: async () => (await Promise.resolve().then(() => require("./gzip-O5ASJAFY-
|
|
23303
|
+
load: async () => (await Promise.resolve().then(() => require("./gzip-O5ASJAFY-DKP63NQf.cjs"))).zcatCommand
|
|
23304
23304
|
}
|
|
23305
23305
|
];
|
|
23306
23306
|
(typeof __BROWSER__ > "u" || !__BROWSER__) && (tt.push({
|
|
23307
23307
|
name: "tar",
|
|
23308
|
-
load: async () => (await Promise.resolve().then(() => require("./tar-STHHZTZ6-
|
|
23308
|
+
load: async () => (await Promise.resolve().then(() => require("./tar-STHHZTZ6-L8XDCiLN.cjs"))).tarCommand
|
|
23309
23309
|
}), tt.push({
|
|
23310
23310
|
name: "yq",
|
|
23311
|
-
load: async () => (await Promise.resolve().then(() => require("./yq-4QJW3EQG-
|
|
23311
|
+
load: async () => (await Promise.resolve().then(() => require("./yq-4QJW3EQG-CnQDxlAc.cjs"))).yqCommand
|
|
23312
23312
|
}), tt.push({
|
|
23313
23313
|
name: "xan",
|
|
23314
|
-
load: async () => (await Promise.resolve().then(() => require("./xan-Y6WF3IRG-
|
|
23314
|
+
load: async () => (await Promise.resolve().then(() => require("./xan-Y6WF3IRG-BV1K518F.cjs"))).xanCommand
|
|
23315
23315
|
}), tt.push({
|
|
23316
23316
|
name: "sqlite3",
|
|
23317
|
-
load: async () => (await Promise.resolve().then(() => require("./sqlite3-CGOEFJAO-
|
|
23317
|
+
load: async () => (await Promise.resolve().then(() => require("./sqlite3-CGOEFJAO-BWLdebEu.cjs"))).sqlite3Command
|
|
23318
23318
|
}));
|
|
23319
23319
|
var Yt = [];
|
|
23320
23320
|
(typeof __BROWSER__ > "u" || !__BROWSER__) && (Yt.push({
|
|
23321
23321
|
name: "python3",
|
|
23322
|
-
load: async () => (await Promise.resolve().then(() => require("./python3-POMOR4OA-
|
|
23322
|
+
load: async () => (await Promise.resolve().then(() => require("./python3-POMOR4OA-DGCWlS6L.cjs"))).python3Command
|
|
23323
23323
|
}), Yt.push({
|
|
23324
23324
|
name: "python",
|
|
23325
|
-
load: async () => (await Promise.resolve().then(() => require("./python3-POMOR4OA-
|
|
23325
|
+
load: async () => (await Promise.resolve().then(() => require("./python3-POMOR4OA-DGCWlS6L.cjs"))).pythonCommand
|
|
23326
23326
|
}));
|
|
23327
23327
|
var Qt = [];
|
|
23328
23328
|
(typeof __BROWSER__ > "u" || !__BROWSER__) && (Qt.push({
|
|
23329
23329
|
name: "js-exec",
|
|
23330
|
-
load: async () => (await Promise.resolve().then(() => require("./js-exec-N5KEZBH7-
|
|
23330
|
+
load: async () => (await Promise.resolve().then(() => require("./js-exec-N5KEZBH7-D_6MBthG.cjs"))).jsExecCommand
|
|
23331
23331
|
}), Qt.push({
|
|
23332
23332
|
name: "node",
|
|
23333
|
-
load: async () => (await Promise.resolve().then(() => require("./js-exec-N5KEZBH7-
|
|
23333
|
+
load: async () => (await Promise.resolve().then(() => require("./js-exec-N5KEZBH7-D_6MBthG.cjs"))).nodeStubCommand
|
|
23334
23334
|
}));
|
|
23335
23335
|
new TextEncoder();
|
|
23336
23336
|
Object.freeze({
|
|
@@ -23767,8 +23767,9 @@ JSON.stringify({
|
|
|
23767
23767
|
results: []
|
|
23768
23768
|
}
|
|
23769
23769
|
});
|
|
23770
|
+
new node_async_hooks.AsyncLocalStorage();
|
|
23770
23771
|
//#endregion
|
|
23771
|
-
//#region ../../packages/agent/dist/schemas-
|
|
23772
|
+
//#region ../../packages/agent/dist/schemas-DNVoEYQE.mjs
|
|
23772
23773
|
function capabilitiesFromGatewayTags(tags) {
|
|
23773
23774
|
const set = new Set(tags ?? []);
|
|
23774
23775
|
return {
|
|
@@ -23776,7 +23777,6 @@ function capabilitiesFromGatewayTags(tags) {
|
|
|
23776
23777
|
files: set.has("file-input")
|
|
23777
23778
|
};
|
|
23778
23779
|
}
|
|
23779
|
-
new node_async_hooks.AsyncLocalStorage();
|
|
23780
23780
|
const DEFAULT_GATEWAY_ORIGIN = "https://ai-gateway.vercel.sh";
|
|
23781
23781
|
/** Resolve the model catalog URL for pricing metadata (via platform proxy when configured). */
|
|
23782
23782
|
function resolveGatewayCatalogUrl(modelId) {
|
|
@@ -23956,6 +23956,7 @@ zod.z.object({
|
|
|
23956
23956
|
"Write plain prose the primary agent can continue from. Do not call tools.",
|
|
23957
23957
|
"Respond with ONLY the summary text."
|
|
23958
23958
|
].join("\n");
|
|
23959
|
+
new node_async_hooks.AsyncLocalStorage();
|
|
23959
23960
|
//#endregion
|
|
23960
23961
|
//#region ../../packages/shared/dist/agent-paths.mjs
|
|
23961
23962
|
function agentMemoryStoragePrefix(agentId) {
|
|
@@ -23964,6 +23965,35 @@ function agentMemoryStoragePrefix(agentId) {
|
|
|
23964
23965
|
function agentMemoryFileStorageKey(agentId, relativePath) {
|
|
23965
23966
|
return `${agentMemoryStoragePrefix(agentId)}${relativePath}`;
|
|
23966
23967
|
}
|
|
23968
|
+
globalThis.structuredClone.bind(globalThis);
|
|
23969
|
+
[
|
|
23970
|
+
"You are an expert chat title generator.",
|
|
23971
|
+
"",
|
|
23972
|
+
"Do not overthink this. Read the user's opening message and respond immediately with a concise title.",
|
|
23973
|
+
"",
|
|
23974
|
+
"Given the initial user message, generate a short, clear, and natural title (max 6-8 words) that captures the main topic or goal.",
|
|
23975
|
+
"",
|
|
23976
|
+
"Rules:",
|
|
23977
|
+
"- Be specific and descriptive; avoid vague titles like \"Conversation\" or \"Question\"",
|
|
23978
|
+
"- Prefer action-oriented or outcome-focused phrasing when possible",
|
|
23979
|
+
"- Use title case",
|
|
23980
|
+
"- Keep it under 120 characters when possible",
|
|
23981
|
+
"- Do not use quotes or emojis",
|
|
23982
|
+
"",
|
|
23983
|
+
"CRITICAL: Respond with ONLY the title text and nothing else. No reasoning, no explanation,",
|
|
23984
|
+
"no preamble, no labels, no quotes — just the raw title on a single line.",
|
|
23985
|
+
"",
|
|
23986
|
+
"Examples:",
|
|
23987
|
+
"",
|
|
23988
|
+
"User: How do I set up a new Next.js project with TypeScript?",
|
|
23989
|
+
"Setting Up Next.js Project with TypeScript",
|
|
23990
|
+
"",
|
|
23991
|
+
"User: Help me debug this React hook that's causing infinite re-renders. Here's the code...",
|
|
23992
|
+
"Debugging Infinite Re-render in React Hook",
|
|
23993
|
+
"",
|
|
23994
|
+
"User: Write a cold email sequence for fundraising from YC alums",
|
|
23995
|
+
"YC Alumni Fundraising Cold Email Sequence"
|
|
23996
|
+
].join("\n");
|
|
23967
23997
|
//#endregion
|
|
23968
23998
|
//#region ../../packages/memory/dist/index.mjs
|
|
23969
23999
|
function resolveMemoryRelativePath(memoryDir, inputPath) {
|
|
@@ -24014,39 +24044,12 @@ zod.z.object({
|
|
|
24014
24044
|
limit: zod.z.number().int().min(1).max(50).optional(),
|
|
24015
24045
|
full: zod.z.boolean().describe("When true, return complete archive note files for archive hits, ignored for session hits (search).").optional()
|
|
24016
24046
|
});
|
|
24017
|
-
new node_async_hooks.AsyncLocalStorage();
|
|
24018
|
-
[
|
|
24019
|
-
"You are an expert chat title generator.",
|
|
24020
|
-
"",
|
|
24021
|
-
"Do not overthink this. Read the user's opening message and respond immediately with a concise title.",
|
|
24022
|
-
"",
|
|
24023
|
-
"Given the initial user message, generate a short, clear, and natural title (max 6-8 words) that captures the main topic or goal.",
|
|
24024
|
-
"",
|
|
24025
|
-
"Rules:",
|
|
24026
|
-
"- Be specific and descriptive; avoid vague titles like \"Conversation\" or \"Question\"",
|
|
24027
|
-
"- Prefer action-oriented or outcome-focused phrasing when possible",
|
|
24028
|
-
"- Use title case",
|
|
24029
|
-
"- Keep it under 120 characters when possible",
|
|
24030
|
-
"- Do not use quotes or emojis",
|
|
24031
|
-
"",
|
|
24032
|
-
"CRITICAL: Respond with ONLY the title text and nothing else. No reasoning, no explanation,",
|
|
24033
|
-
"no preamble, no labels, no quotes — just the raw title on a single line.",
|
|
24034
|
-
"",
|
|
24035
|
-
"Examples:",
|
|
24036
|
-
"",
|
|
24037
|
-
"User: How do I set up a new Next.js project with TypeScript?",
|
|
24038
|
-
"Setting Up Next.js Project with TypeScript",
|
|
24039
|
-
"",
|
|
24040
|
-
"User: Help me debug this React hook that's causing infinite re-renders. Here's the code...",
|
|
24041
|
-
"Debugging Infinite Re-render in React Hook",
|
|
24042
|
-
"",
|
|
24043
|
-
"User: Write a cold email sequence for fundraising from YC alums",
|
|
24044
|
-
"YC Alumni Fundraising Cold Email Sequence"
|
|
24045
|
-
].join("\n");
|
|
24046
24047
|
zod.z.object({
|
|
24047
24048
|
message: zod.z.string().describe("Task or question for the subagent"),
|
|
24048
|
-
files: zod.z.array(require_dist
|
|
24049
|
+
files: zod.z.array(require_dist.FilePartSchema).max(5).optional().describe("Optional file attachments (images/PDFs) for the subagent")
|
|
24049
24050
|
});
|
|
24051
|
+
//#endregion
|
|
24052
|
+
//#region ../../packages/agent/dist/index.mjs
|
|
24050
24053
|
const STATIC_MODEL_IDS = new Set([
|
|
24051
24054
|
"alibaba/qwen-3-14b",
|
|
24052
24055
|
"alibaba/qwen-3-235b",
|
|
@@ -24352,7 +24355,7 @@ function resolvePlatformOriginForModelCatalog() {
|
|
|
24352
24355
|
if (fromKeystroke) return fromKeystroke.replace(/\/+$/, "");
|
|
24353
24356
|
const fromPlatform = process.env.PLATFORM_URL?.trim();
|
|
24354
24357
|
if (fromPlatform) return fromPlatform.replace(/\/+$/, "");
|
|
24355
|
-
return
|
|
24358
|
+
return require_wait_for_health_XEzPPQIO.DEFAULT_CLOUD_PLATFORM_ORIGIN;
|
|
24356
24359
|
}
|
|
24357
24360
|
async function fetchPublicModelIds() {
|
|
24358
24361
|
if (cachedModelIds) return cachedModelIds;
|
|
@@ -24362,7 +24365,7 @@ async function fetchPublicModelIds() {
|
|
|
24362
24365
|
try {
|
|
24363
24366
|
const response = await fetch(`${platformOrigin}/api/public/models`, { headers: { accept: "application/json" } });
|
|
24364
24367
|
if (!response.ok) throw new Error(`Failed to fetch public model catalog (${response.status})`);
|
|
24365
|
-
const parsed = require_dist
|
|
24368
|
+
const parsed = require_dist.PublicModelsResponseSchema.safeParse(await response.json());
|
|
24366
24369
|
if (!parsed.success || parsed.data.models.length === 0) throw new Error("Public model catalog response had no models");
|
|
24367
24370
|
cachedModelIds = new Set(parsed.data.models);
|
|
24368
24371
|
return cachedModelIds;
|
|
@@ -24457,7 +24460,7 @@ const cronSourceSchema = zod.z.object({
|
|
|
24457
24460
|
...baseSourceShape,
|
|
24458
24461
|
schedule: cronScheduleSchema,
|
|
24459
24462
|
timezone: zod.z.string().trim().min(1).optional(),
|
|
24460
|
-
payload: require_dist
|
|
24463
|
+
payload: require_dist.cronPayloadSchema.optional()
|
|
24461
24464
|
});
|
|
24462
24465
|
const pollSourceSchema = zod.z.object({
|
|
24463
24466
|
kind: zod.z.literal("poll"),
|
|
@@ -24496,8 +24499,8 @@ zod.z.preprocess(normalizeLegacySlugFields, zod.z.discriminatedUnion("target", [
|
|
|
24496
24499
|
//#endregion
|
|
24497
24500
|
//#region ../../packages/projects/dist/index.mjs
|
|
24498
24501
|
async function resolveDeployManifest(input) {
|
|
24499
|
-
if (input.artifactManifest != null) return require_dist
|
|
24500
|
-
return require_dist
|
|
24502
|
+
if (input.artifactManifest != null) return require_dist.parseStoredRouteManifest(input.artifactManifest);
|
|
24503
|
+
return require_dist.parseStoredRouteManifest(require_dist.extractRouteManifestFromArtifact(input.artifactBytes));
|
|
24501
24504
|
}
|
|
24502
24505
|
/** Cut over activeArtifactId, then sync org project registry from the artifact manifest. */
|
|
24503
24506
|
async function promoteProjectDeploy(input) {
|
|
@@ -24507,7 +24510,7 @@ async function promoteProjectDeploy(input) {
|
|
|
24507
24510
|
if (!artifact || artifact.projectId !== input.projectId) throw new Error(`Artifact ${input.artifactId} not found for project ${input.projectId}`);
|
|
24508
24511
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(project.organizationId);
|
|
24509
24512
|
if (!organization) throw new Error(`Organization not found for project ${input.projectId}`);
|
|
24510
|
-
if (!input.artifactBytes && artifact.manifestJson == null) throw new require_dist
|
|
24513
|
+
if (!input.artifactBytes && artifact.manifestJson == null) throw new require_dist.RouteManifestNotFoundError("Artifact has no stored route manifest; rebuild and redeploy");
|
|
24511
24514
|
const manifest = await resolveDeployManifest({
|
|
24512
24515
|
artifactId: input.artifactId,
|
|
24513
24516
|
artifactManifest: artifact.manifestJson,
|
|
@@ -24581,9 +24584,9 @@ function configureProjectRuntimeScheduler(plugin) {
|
|
|
24581
24584
|
async function getOrgRuntimeQueue() {
|
|
24582
24585
|
if (runtimeQueue) return runtimeQueue;
|
|
24583
24586
|
if (!runtimeQueueInit) runtimeQueueInit = (async () => {
|
|
24584
|
-
const queue = await require_dist
|
|
24587
|
+
const queue = await require_dist.createJobQueue({
|
|
24585
24588
|
scope: "platform",
|
|
24586
|
-
plugin: runtimeSchedulerPlugin ?? require_dist
|
|
24589
|
+
plugin: runtimeSchedulerPlugin ?? require_dist.defaultSchedulerPlugin()
|
|
24587
24590
|
});
|
|
24588
24591
|
runtimeQueue = queue;
|
|
24589
24592
|
return queue;
|
|
@@ -24703,7 +24706,7 @@ async function handleOrgRuntimeJob(runtime, resolveStartInput, payload) {
|
|
|
24703
24706
|
let result;
|
|
24704
24707
|
try {
|
|
24705
24708
|
result = await runtime.start(mergedInput);
|
|
24706
|
-
const deployStatus = await
|
|
24709
|
+
const deployStatus = await require_with_project_scope.fetchDeployStatus(result.baseUrl);
|
|
24707
24710
|
const failedProjects = new Map((deployStatus?.projects ?? []).filter((project) => !project.ok).map((project) => [project.projectId, project.error ?? "Project failed to start"]));
|
|
24708
24711
|
for (const project of projects) {
|
|
24709
24712
|
const failure = failedProjects.get(project.projectId);
|
|
@@ -24789,13 +24792,13 @@ const OAUTH_CLIENT_METADATA_PATH = "/.well-known/oauth-client-metadata";
|
|
|
24789
24792
|
const MCP_OAUTH_CALLBACK_PATH = "/api/mcp/oauth/callback";
|
|
24790
24793
|
/** HTTPS URL of the CIMD document for the current external platform origin. */
|
|
24791
24794
|
function resolveOAuthClientMetadataUrl(env = process.env) {
|
|
24792
|
-
const origin =
|
|
24795
|
+
const origin = require_wait_for_health_XEzPPQIO.resolveExternalPlatformOrigin(env)?.replace(/\/+$/, "");
|
|
24793
24796
|
if (!origin) return;
|
|
24794
24797
|
return `${origin}${OAUTH_CLIENT_METADATA_PATH}`;
|
|
24795
24798
|
}
|
|
24796
24799
|
/** HTTPS redirect URI used for outbound MCP OAuth connects. */
|
|
24797
24800
|
function resolveMcpOAuthCallbackUrl(env = process.env) {
|
|
24798
|
-
const origin =
|
|
24801
|
+
const origin = require_wait_for_health_XEzPPQIO.resolveExternalPlatformOrigin(env)?.replace(/\/+$/, "");
|
|
24799
24802
|
if (!origin) return;
|
|
24800
24803
|
return `${origin}${MCP_OAUTH_CALLBACK_PATH}`;
|
|
24801
24804
|
}
|
|
@@ -24981,7 +24984,7 @@ function getProjectInvitePermission(c) {
|
|
|
24981
24984
|
//#endregion
|
|
24982
24985
|
//#region ../../packages/http/dist/require-session-fERJkKuQ.mjs
|
|
24983
24986
|
function resolveActiveOrganizationId(c) {
|
|
24984
|
-
const header = c.req.header(require_dist
|
|
24987
|
+
const header = c.req.header(require_dist.ACTIVE_ORG_HEADER)?.trim();
|
|
24985
24988
|
if (header) return header;
|
|
24986
24989
|
return c.get("apiKeyAuth")?.organizationId;
|
|
24987
24990
|
}
|
|
@@ -24989,7 +24992,7 @@ async function resolveOrganizationContext(c) {
|
|
|
24989
24992
|
const organizationId = resolveActiveOrganizationId(c);
|
|
24990
24993
|
if (!organizationId) return {
|
|
24991
24994
|
ok: false,
|
|
24992
|
-
response: c.json(require_dist
|
|
24995
|
+
response: c.json(require_dist.ErrorResponseSchema.parse({
|
|
24993
24996
|
error: "Select an organization to continue",
|
|
24994
24997
|
code: "needs_org_selection"
|
|
24995
24998
|
}), 409)
|
|
@@ -24997,12 +25000,12 @@ async function resolveOrganizationContext(c) {
|
|
|
24997
25000
|
const apiKeyAuth = c.get("apiKeyAuth");
|
|
24998
25001
|
if (apiKeyAuth && apiKeyAuth.organizationId !== organizationId) return {
|
|
24999
25002
|
ok: false,
|
|
25000
|
-
response: c.json(require_dist
|
|
25003
|
+
response: c.json(require_dist.ErrorResponseSchema.parse({ error: "Forbidden" }), 403)
|
|
25001
25004
|
};
|
|
25002
25005
|
const membership = await (0, _keystrokehq_platform_database.selectUserOrganizationMembership)(c.get("user").id, organizationId);
|
|
25003
25006
|
if (!membership) return {
|
|
25004
25007
|
ok: false,
|
|
25005
|
-
response: c.json(require_dist
|
|
25008
|
+
response: c.json(require_dist.ErrorResponseSchema.parse({ error: "Forbidden" }), 403)
|
|
25006
25009
|
};
|
|
25007
25010
|
return {
|
|
25008
25011
|
ok: true,
|
|
@@ -25017,7 +25020,7 @@ async function resolveOrganizationContext(c) {
|
|
|
25017
25020
|
}
|
|
25018
25021
|
function requireVerifiedOrganization() {
|
|
25019
25022
|
return async (c, next) => {
|
|
25020
|
-
if (!c.get("organization").verified) return c.json(require_dist
|
|
25023
|
+
if (!c.get("organization").verified) return c.json(require_dist.ErrorResponseSchema.parse({
|
|
25021
25024
|
error: "This organization is pending verification",
|
|
25022
25025
|
code: "org_unverified"
|
|
25023
25026
|
}), 403);
|
|
@@ -25037,9 +25040,9 @@ function requireProject() {
|
|
|
25037
25040
|
return async (c, next) => {
|
|
25038
25041
|
const organization = c.get("organization");
|
|
25039
25042
|
const projectId = c.req.param("projectId")?.trim();
|
|
25040
|
-
if (!projectId) return c.json(require_dist
|
|
25043
|
+
if (!projectId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Project id is required" }), 400);
|
|
25041
25044
|
const project = await (0, _keystrokehq_platform_database.selectProjectForOrganization)(organization.organizationId, projectId);
|
|
25042
|
-
if (!project) return c.json(require_dist
|
|
25045
|
+
if (!project) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Project not found" }), 404);
|
|
25043
25046
|
c.set("project", project);
|
|
25044
25047
|
setTelemetryContext({ projectId: project.id });
|
|
25045
25048
|
await (0, _keystrokehq_platform_database.runWithWorkspaceContext)({
|
|
@@ -25051,13 +25054,13 @@ function requireProject() {
|
|
|
25051
25054
|
};
|
|
25052
25055
|
}
|
|
25053
25056
|
function routeProject(project) {
|
|
25054
|
-
return require_dist
|
|
25057
|
+
return require_dist.mapProject(project);
|
|
25055
25058
|
}
|
|
25056
25059
|
function forbidden(c) {
|
|
25057
|
-
return c.json(require_dist
|
|
25060
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: "Forbidden" }), 403);
|
|
25058
25061
|
}
|
|
25059
25062
|
function notFound(c, message = "Not found") {
|
|
25060
|
-
return c.json(require_dist
|
|
25063
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: message }), 404);
|
|
25061
25064
|
}
|
|
25062
25065
|
function requireProjectMembership() {
|
|
25063
25066
|
return async (c, next) => {
|
|
@@ -25156,9 +25159,9 @@ function authorizePayload(schema, allow) {
|
|
|
25156
25159
|
function requireOrganizationParam() {
|
|
25157
25160
|
return async (c, next) => {
|
|
25158
25161
|
const organizationId = c.req.param("organizationId")?.trim();
|
|
25159
|
-
if (!organizationId) return c.json(require_dist
|
|
25162
|
+
if (!organizationId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization id is required" }), 400);
|
|
25160
25163
|
const membership = await (0, _keystrokehq_platform_database.selectUserOrganizationMembership)(c.get("user").id, organizationId);
|
|
25161
|
-
if (!membership) return c.json(require_dist
|
|
25164
|
+
if (!membership) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Forbidden" }), 403);
|
|
25162
25165
|
c.set("organization", {
|
|
25163
25166
|
organizationId: membership.organization.id,
|
|
25164
25167
|
organizationName: membership.organization.name,
|
|
@@ -26007,8 +26010,8 @@ trace.getTracer("keystroke.http");
|
|
|
26007
26010
|
//#region src/routes/account/users/me/avatar/GET.ts
|
|
26008
26011
|
const handler$111 = async (c) => {
|
|
26009
26012
|
const dbUser = await (0, _keystrokehq_platform_database.selectUserById)(c.get("user").id);
|
|
26010
|
-
if (!dbUser) return c.json(require_dist
|
|
26011
|
-
return c.json(require_dist
|
|
26013
|
+
if (!dbUser) return c.json(require_dist.ErrorResponseSchema.parse({ error: "User not found" }), 404);
|
|
26014
|
+
return c.json(require_dist.UserAvatarSchema.parse({ url: dbUser.image ?? null }));
|
|
26012
26015
|
};
|
|
26013
26016
|
//#endregion
|
|
26014
26017
|
//#region src/lib/user-avatar-content-type.ts
|
|
@@ -26025,16 +26028,16 @@ function avatarExtensionForContentType(contentType) {
|
|
|
26025
26028
|
//#endregion
|
|
26026
26029
|
//#region src/routes/account/users/me/avatar/presign/POST.ts
|
|
26027
26030
|
const handler$110 = async (c) => {
|
|
26028
|
-
const parsed = require_dist
|
|
26029
|
-
if (!parsed.success) return c.json(require_dist
|
|
26031
|
+
const parsed = require_dist.PresignUserAvatarRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
26032
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid avatar upload request" }), 400);
|
|
26030
26033
|
const extension = avatarExtensionForContentType(parsed.data.contentType);
|
|
26031
|
-
if (!extension) return c.json(require_dist
|
|
26032
|
-
const storageKey = require_dist
|
|
26033
|
-
const uploadUrl = await require_dist
|
|
26034
|
+
if (!extension) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Unsupported image type" }), 400);
|
|
26035
|
+
const storageKey = require_dist.userAvatarStorageKey(c.get("user").id, extension);
|
|
26036
|
+
const uploadUrl = await require_dist.createAssetsStorageClient().presignPut({
|
|
26034
26037
|
key: storageKey,
|
|
26035
26038
|
contentType: parsed.data.contentType
|
|
26036
26039
|
});
|
|
26037
|
-
return c.json(require_dist
|
|
26040
|
+
return c.json(require_dist.PresignUserAvatarResponseSchema.parse({
|
|
26038
26041
|
uploadUrl,
|
|
26039
26042
|
storageKey
|
|
26040
26043
|
}));
|
|
@@ -26065,72 +26068,72 @@ async function deleteStoredImageIfOwned(input) {
|
|
|
26065
26068
|
//#endregion
|
|
26066
26069
|
//#region src/routes/account/users/me/avatar/PATCH.ts
|
|
26067
26070
|
const handler$109 = async (c) => {
|
|
26068
|
-
const parsed = require_dist
|
|
26069
|
-
if (!parsed.success) return c.json(require_dist
|
|
26071
|
+
const parsed = require_dist.UserAvatarPatchSchema.safeParse(await c.req.json().catch(() => null));
|
|
26072
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid avatar update" }), 400);
|
|
26070
26073
|
const user = c.get("user");
|
|
26071
26074
|
const dbUser = await (0, _keystrokehq_platform_database.selectUserById)(user.id);
|
|
26072
|
-
if (!dbUser) return c.json(require_dist
|
|
26073
|
-
const storage = require_dist
|
|
26075
|
+
if (!dbUser) return c.json(require_dist.ErrorResponseSchema.parse({ error: "User not found" }), 404);
|
|
26076
|
+
const storage = require_dist.createAssetsStorageClient();
|
|
26074
26077
|
const { storageKey } = parsed.data;
|
|
26075
26078
|
if (storageKey === null) {
|
|
26076
26079
|
await deleteStoredImageIfOwned({
|
|
26077
26080
|
storage,
|
|
26078
26081
|
url: dbUser.image,
|
|
26079
|
-
isOwnedPublicUrl: require_dist
|
|
26080
|
-
keyFromPublicUrl: require_dist
|
|
26082
|
+
isOwnedPublicUrl: require_dist.isKeystrokeAssetsAvatarPublicUrl,
|
|
26083
|
+
keyFromPublicUrl: require_dist.keystrokeAssetsAvatarKeyFromPublicUrl
|
|
26081
26084
|
});
|
|
26082
26085
|
await (0, _keystrokehq_platform_database.updateUserById)(user.id, {
|
|
26083
26086
|
image: null,
|
|
26084
26087
|
updatedAt: /* @__PURE__ */ new Date()
|
|
26085
26088
|
});
|
|
26086
|
-
return c.json(require_dist
|
|
26089
|
+
return c.json(require_dist.UserAvatarSchema.parse({ url: null }));
|
|
26087
26090
|
}
|
|
26088
26091
|
const finalized = await finalizeStoredImageUpload({
|
|
26089
26092
|
storage,
|
|
26090
26093
|
storageKey,
|
|
26091
|
-
isValidStorageKey: (key) => require_dist
|
|
26092
|
-
buildPublicUrl: require_dist
|
|
26094
|
+
isValidStorageKey: (key) => require_dist.isUserAvatarStorageKey(key, user.id),
|
|
26095
|
+
buildPublicUrl: require_dist.publicKeystrokeAssetsObjectUrl
|
|
26093
26096
|
});
|
|
26094
|
-
if (!finalized.ok) return c.json(require_dist
|
|
26097
|
+
if (!finalized.ok) return c.json(require_dist.ErrorResponseSchema.parse({ error: finalized.error }), 400);
|
|
26095
26098
|
if (dbUser.image && dbUser.image !== finalized.publicUrl) await deleteStoredImageIfOwned({
|
|
26096
26099
|
storage,
|
|
26097
26100
|
url: dbUser.image,
|
|
26098
|
-
isOwnedPublicUrl: require_dist
|
|
26099
|
-
keyFromPublicUrl: require_dist
|
|
26101
|
+
isOwnedPublicUrl: require_dist.isKeystrokeAssetsAvatarPublicUrl,
|
|
26102
|
+
keyFromPublicUrl: require_dist.keystrokeAssetsAvatarKeyFromPublicUrl
|
|
26100
26103
|
});
|
|
26101
26104
|
await (0, _keystrokehq_platform_database.updateUserById)(user.id, {
|
|
26102
26105
|
image: finalized.publicUrl,
|
|
26103
26106
|
updatedAt: /* @__PURE__ */ new Date()
|
|
26104
26107
|
});
|
|
26105
|
-
return c.json(require_dist
|
|
26108
|
+
return c.json(require_dist.UserAvatarSchema.parse({ url: finalized.publicUrl }));
|
|
26106
26109
|
};
|
|
26107
26110
|
//#endregion
|
|
26108
26111
|
//#region src/routes/account/users/me/preferences/GET.ts
|
|
26109
26112
|
const handler$108 = async (c) => {
|
|
26110
26113
|
const dbUser = await (0, _keystrokehq_platform_database.selectUserById)(c.get("user").id);
|
|
26111
|
-
if (!dbUser) return c.json(require_dist
|
|
26112
|
-
return c.json(require_dist
|
|
26114
|
+
if (!dbUser) return c.json(require_dist.ErrorResponseSchema.parse({ error: "User not found" }), 404);
|
|
26115
|
+
return c.json(require_dist.UserPreferencesSchema.parse(require_dist.normalizeUserPreferences(dbUser.preferences)));
|
|
26113
26116
|
};
|
|
26114
26117
|
//#endregion
|
|
26115
26118
|
//#region src/routes/account/users/me/preferences/PATCH.ts
|
|
26116
26119
|
const handler$107 = async (c) => {
|
|
26117
|
-
const parsed = require_dist
|
|
26118
|
-
if (!parsed.success) return c.json(require_dist
|
|
26120
|
+
const parsed = require_dist.UserPreferencesPatchSchema.safeParse(await c.req.json().catch(() => null));
|
|
26121
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid preferences update" }), 400);
|
|
26119
26122
|
const user = c.get("user");
|
|
26120
26123
|
const dbUser = await (0, _keystrokehq_platform_database.selectUserById)(user.id);
|
|
26121
|
-
if (!dbUser) return c.json(require_dist
|
|
26122
|
-
const next = require_dist
|
|
26124
|
+
if (!dbUser) return c.json(require_dist.ErrorResponseSchema.parse({ error: "User not found" }), 404);
|
|
26125
|
+
const next = require_dist.mergeUserPreferences(require_dist.normalizeUserPreferences(dbUser.preferences), parsed.data);
|
|
26123
26126
|
await (0, _keystrokehq_platform_database.updateUserById)(user.id, {
|
|
26124
26127
|
preferences: next,
|
|
26125
26128
|
updatedAt: /* @__PURE__ */ new Date()
|
|
26126
26129
|
});
|
|
26127
|
-
return c.json(require_dist
|
|
26130
|
+
return c.json(require_dist.UserPreferencesSchema.parse(next));
|
|
26128
26131
|
};
|
|
26129
26132
|
//#endregion
|
|
26130
26133
|
//#region src/routes/account/organizations/GET.ts
|
|
26131
26134
|
const handler$106 = async (c) => {
|
|
26132
26135
|
const memberships = await (0, _keystrokehq_platform_database.selectUserOrganizations)(c.get("user").id);
|
|
26133
|
-
return c.json(require_dist
|
|
26136
|
+
return c.json(require_dist.ListOrganizationsResponseSchema.parse(memberships.map(require_dist.mapUserOrganization)));
|
|
26134
26137
|
};
|
|
26135
26138
|
//#endregion
|
|
26136
26139
|
//#region src/services/create-organization.ts
|
|
@@ -26208,7 +26211,7 @@ function organizationSlugErrorBody(error) {
|
|
|
26208
26211
|
const message = error.issues[0]?.message ?? "Invalid organization slug";
|
|
26209
26212
|
return {
|
|
26210
26213
|
error: message,
|
|
26211
|
-
code: require_dist
|
|
26214
|
+
code: require_dist.organizationSlugErrorCodeFromMessage(message)
|
|
26212
26215
|
};
|
|
26213
26216
|
}
|
|
26214
26217
|
//#endregion
|
|
@@ -26217,8 +26220,8 @@ function createOrganizationHandler(deps) {
|
|
|
26217
26220
|
return async (c) => {
|
|
26218
26221
|
const user = c.get("user");
|
|
26219
26222
|
const body = await c.req.json().catch(() => null);
|
|
26220
|
-
const parsed = require_dist
|
|
26221
|
-
if (!parsed.success) return c.json(require_dist
|
|
26223
|
+
const parsed = require_dist.CreateOrganizationRequestSchema.safeParse(body);
|
|
26224
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid organization request" }), 400);
|
|
26222
26225
|
try {
|
|
26223
26226
|
const membership = await createOrganizationWithHosting(deps, user.id, parsed.data.name, parsed.data.slug);
|
|
26224
26227
|
const organizationId = membership.organization.id;
|
|
@@ -26241,10 +26244,10 @@ function createOrganizationHandler(deps) {
|
|
|
26241
26244
|
project_count: 0
|
|
26242
26245
|
}
|
|
26243
26246
|
}).catch(() => {});
|
|
26244
|
-
return c.json(require_dist
|
|
26247
|
+
return c.json(require_dist.CreateOrganizationResponseSchema.parse(require_dist.mapUserOrganization(membership)), 201);
|
|
26245
26248
|
} catch (error) {
|
|
26246
|
-
if (error instanceof _keystrokehq_platform_database.OrganizationSlugTakenError) return c.json(require_dist
|
|
26247
|
-
if (error instanceof zod.ZodError) return c.json(require_dist
|
|
26249
|
+
if (error instanceof _keystrokehq_platform_database.OrganizationSlugTakenError) return c.json(require_dist.ErrorResponseSchema.parse(organizationSlugErrorBody(error)), 409);
|
|
26250
|
+
if (error instanceof zod.ZodError) return c.json(require_dist.ErrorResponseSchema.parse(organizationSlugErrorBody(error)), 400);
|
|
26248
26251
|
throw error;
|
|
26249
26252
|
}
|
|
26250
26253
|
};
|
|
@@ -26252,13 +26255,13 @@ function createOrganizationHandler(deps) {
|
|
|
26252
26255
|
//#endregion
|
|
26253
26256
|
//#region src/routes/account/organizations/slug-available/GET.ts
|
|
26254
26257
|
const handler$105 = async (c) => {
|
|
26255
|
-
const parsed = require_dist
|
|
26258
|
+
const parsed = require_dist.SlugAvailabilityQuerySchema.safeParse({
|
|
26256
26259
|
slug: c.req.query("slug"),
|
|
26257
26260
|
excludeOrganizationId: c.req.query("excludeOrganizationId")
|
|
26258
26261
|
});
|
|
26259
|
-
if (!parsed.success) return c.json(require_dist
|
|
26262
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid slug query" }), 400);
|
|
26260
26263
|
const availability = await (0, _keystrokehq_platform_database.checkOrganizationSlugAvailability)(parsed.data.slug, parsed.data.excludeOrganizationId);
|
|
26261
|
-
return c.json(require_dist
|
|
26264
|
+
return c.json(require_dist.SlugAvailabilityResponseSchema.parse(availability));
|
|
26262
26265
|
};
|
|
26263
26266
|
//#endregion
|
|
26264
26267
|
//#region src/routes/account/organizations/[organizationId]/GET.ts
|
|
@@ -26266,30 +26269,30 @@ const handler$104 = async (c) => {
|
|
|
26266
26269
|
const { organizationId } = c.get("organization");
|
|
26267
26270
|
const membership = await (0, _keystrokehq_platform_database.selectUserOrganizationMembership)(c.get("user").id, organizationId);
|
|
26268
26271
|
if (!membership) throw new Error(`Organization membership missing after param guard: ${organizationId}`);
|
|
26269
|
-
return c.json(require_dist
|
|
26272
|
+
return c.json(require_dist.ActiveOrganizationResponseSchema.parse(require_dist.mapUserOrganization(membership)));
|
|
26270
26273
|
};
|
|
26271
26274
|
//#endregion
|
|
26272
26275
|
//#region src/routes/account/organizations/[organizationId]/PATCH.ts
|
|
26273
26276
|
const handler$103 = async (c) => {
|
|
26274
26277
|
const organization = c.get("organization");
|
|
26275
26278
|
const body = await c.req.json().catch(() => null);
|
|
26276
|
-
const parsed = require_dist
|
|
26279
|
+
const parsed = require_dist.UpdateOrganizationRequestSchema.safeParse(body);
|
|
26277
26280
|
if (!parsed.success) {
|
|
26278
|
-
const errorBody = parsed.error.issues.some((issue) => issue.path[0] === "slug") ? organizationSlugErrorBody(parsed.error) : require_dist
|
|
26279
|
-
return c.json(require_dist
|
|
26281
|
+
const errorBody = parsed.error.issues.some((issue) => issue.path[0] === "slug") ? organizationSlugErrorBody(parsed.error) : require_dist.validationErrorResponse(parsed.error, "Invalid organization update");
|
|
26282
|
+
return c.json(require_dist.ErrorResponseSchema.parse(errorBody), 400);
|
|
26280
26283
|
}
|
|
26281
26284
|
try {
|
|
26282
26285
|
let updated;
|
|
26283
26286
|
if (parsed.data.name !== void 0) updated = await (0, _keystrokehq_platform_database.updateOrganizationName)(organization.organizationId, parsed.data.name);
|
|
26284
26287
|
if (parsed.data.slug !== void 0) updated = await (0, _keystrokehq_platform_database.updateOrganizationSlug)(organization.organizationId, parsed.data.slug);
|
|
26285
26288
|
if (!updated) throw new Error(`Organization update produced no result: ${organization.organizationId}`);
|
|
26286
|
-
return c.json(require_dist
|
|
26289
|
+
return c.json(require_dist.ActiveOrganizationResponseSchema.parse(require_dist.mapUserOrganization({
|
|
26287
26290
|
organization: updated,
|
|
26288
26291
|
role: organization.role
|
|
26289
26292
|
})));
|
|
26290
26293
|
} catch (error) {
|
|
26291
|
-
if (error instanceof _keystrokehq_platform_database.OrganizationSlugTakenError) return c.json(require_dist
|
|
26292
|
-
if (error instanceof zod.ZodError) return c.json(require_dist
|
|
26294
|
+
if (error instanceof _keystrokehq_platform_database.OrganizationSlugTakenError) return c.json(require_dist.ErrorResponseSchema.parse(organizationSlugErrorBody(error)), 409);
|
|
26295
|
+
if (error instanceof zod.ZodError) return c.json(require_dist.ErrorResponseSchema.parse(organizationSlugErrorBody(error)), 400);
|
|
26293
26296
|
throw error;
|
|
26294
26297
|
}
|
|
26295
26298
|
};
|
|
@@ -26298,8 +26301,8 @@ const handler$103 = async (c) => {
|
|
|
26298
26301
|
const handler$102 = async (c) => {
|
|
26299
26302
|
const { organizationId } = c.get("organization");
|
|
26300
26303
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
26301
|
-
if (!organization) return c.json(require_dist
|
|
26302
|
-
return c.json(require_dist
|
|
26304
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
26305
|
+
return c.json(require_dist.OrganizationSidebarBrandingSchema.parse((0, _keystrokehq_platform_database.organizationRowToSidebarBranding)(organization)));
|
|
26303
26306
|
};
|
|
26304
26307
|
//#endregion
|
|
26305
26308
|
//#region src/routes/account/organizations/[organizationId]/branding/PATCH.ts
|
|
@@ -26313,13 +26316,13 @@ const LOGO_VARIANTS = [{
|
|
|
26313
26316
|
urlField: "logoDarkUrl"
|
|
26314
26317
|
}];
|
|
26315
26318
|
async function finalizeOrgLogoVariant(input) {
|
|
26316
|
-
const storage = require_dist
|
|
26319
|
+
const storage = require_dist.createAssetsStorageClient();
|
|
26317
26320
|
if (input.storageKey === null) {
|
|
26318
26321
|
await deleteStoredImageIfOwned({
|
|
26319
26322
|
storage,
|
|
26320
26323
|
url: input.currentUrl,
|
|
26321
|
-
isOwnedPublicUrl: require_dist
|
|
26322
|
-
keyFromPublicUrl: require_dist
|
|
26324
|
+
isOwnedPublicUrl: require_dist.isKeystrokeAssetsOrgLogoPublicUrl,
|
|
26325
|
+
keyFromPublicUrl: require_dist.keystrokeAssetsOrgLogoKeyFromPublicUrl
|
|
26323
26326
|
});
|
|
26324
26327
|
return {
|
|
26325
26328
|
ok: true,
|
|
@@ -26329,15 +26332,15 @@ async function finalizeOrgLogoVariant(input) {
|
|
|
26329
26332
|
const finalized = await finalizeStoredImageUpload({
|
|
26330
26333
|
storage,
|
|
26331
26334
|
storageKey: input.storageKey,
|
|
26332
|
-
isValidStorageKey: (key) => require_dist
|
|
26333
|
-
buildPublicUrl: require_dist
|
|
26335
|
+
isValidStorageKey: (key) => require_dist.isOrgLogoStorageKey(key, input.organizationId, input.variant),
|
|
26336
|
+
buildPublicUrl: require_dist.publicKeystrokeAssetsObjectUrl
|
|
26334
26337
|
});
|
|
26335
26338
|
if (!finalized.ok) return finalized;
|
|
26336
26339
|
if (input.currentUrl && input.currentUrl !== finalized.publicUrl) await deleteStoredImageIfOwned({
|
|
26337
26340
|
storage,
|
|
26338
26341
|
url: input.currentUrl,
|
|
26339
|
-
isOwnedPublicUrl: require_dist
|
|
26340
|
-
keyFromPublicUrl: require_dist
|
|
26342
|
+
isOwnedPublicUrl: require_dist.isKeystrokeAssetsOrgLogoPublicUrl,
|
|
26343
|
+
keyFromPublicUrl: require_dist.keystrokeAssetsOrgLogoKeyFromPublicUrl
|
|
26341
26344
|
});
|
|
26342
26345
|
return {
|
|
26343
26346
|
ok: true,
|
|
@@ -26345,11 +26348,11 @@ async function finalizeOrgLogoVariant(input) {
|
|
|
26345
26348
|
};
|
|
26346
26349
|
}
|
|
26347
26350
|
const handler$101 = async (c) => {
|
|
26348
|
-
const parsed = require_dist
|
|
26349
|
-
if (!parsed.success) return c.json(require_dist
|
|
26351
|
+
const parsed = require_dist.OrganizationSidebarBrandingPatchSchema.safeParse(await c.req.json().catch(() => null));
|
|
26352
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid branding update" }), 400);
|
|
26350
26353
|
const { organizationId } = c.get("organization");
|
|
26351
26354
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
26352
|
-
if (!organization) return c.json(require_dist
|
|
26355
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
26353
26356
|
const dbUpdate = {
|
|
26354
26357
|
customLogoEnabled: parsed.data.customLogoEnabled,
|
|
26355
26358
|
customLogoExplicitlyDisabled: parsed.data.customLogoExplicitlyDisabled,
|
|
@@ -26364,26 +26367,26 @@ const handler$101 = async (c) => {
|
|
|
26364
26367
|
storageKey,
|
|
26365
26368
|
currentUrl: organization[urlField]
|
|
26366
26369
|
});
|
|
26367
|
-
if (!result.ok) return c.json(require_dist
|
|
26370
|
+
if (!result.ok) return c.json(require_dist.ErrorResponseSchema.parse({ error: result.error }), 400);
|
|
26368
26371
|
dbUpdate[urlField] = result.publicUrl;
|
|
26369
26372
|
}
|
|
26370
26373
|
const updated = await (0, _keystrokehq_platform_database.updateOrganizationSidebarBranding)(organizationId, dbUpdate);
|
|
26371
|
-
return c.json(require_dist
|
|
26374
|
+
return c.json(require_dist.OrganizationSidebarBrandingSchema.parse((0, _keystrokehq_platform_database.organizationRowToSidebarBranding)(updated)));
|
|
26372
26375
|
};
|
|
26373
26376
|
//#endregion
|
|
26374
26377
|
//#region src/routes/account/organizations/[organizationId]/branding/logo/presign/POST.ts
|
|
26375
26378
|
const handler$100 = async (c) => {
|
|
26376
|
-
const parsed = require_dist
|
|
26377
|
-
if (!parsed.success) return c.json(require_dist
|
|
26379
|
+
const parsed = require_dist.PresignOrgLogoRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
26380
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid logo upload request" }), 400);
|
|
26378
26381
|
const extension = avatarExtensionForContentType(parsed.data.contentType);
|
|
26379
|
-
if (!extension) return c.json(require_dist
|
|
26382
|
+
if (!extension) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Unsupported image type" }), 400);
|
|
26380
26383
|
const { organizationId } = c.get("organization");
|
|
26381
|
-
const storageKey = require_dist
|
|
26382
|
-
const uploadUrl = await require_dist
|
|
26384
|
+
const storageKey = require_dist.orgLogoStorageKey(organizationId, parsed.data.variant, extension);
|
|
26385
|
+
const uploadUrl = await require_dist.createAssetsStorageClient().presignPut({
|
|
26383
26386
|
key: storageKey,
|
|
26384
26387
|
contentType: parsed.data.contentType
|
|
26385
26388
|
});
|
|
26386
|
-
return c.json(require_dist
|
|
26389
|
+
return c.json(require_dist.PresignOrgLogoResponseSchema.parse({
|
|
26387
26390
|
uploadUrl,
|
|
26388
26391
|
storageKey
|
|
26389
26392
|
}));
|
|
@@ -26502,7 +26505,7 @@ function usageKeySource(event) {
|
|
|
26502
26505
|
return event.keySource === "byok" || event.keySource === "platform" ? event.keySource : null;
|
|
26503
26506
|
}
|
|
26504
26507
|
function billedUsd(event) {
|
|
26505
|
-
return event.chargeMicroCredits / require_dist
|
|
26508
|
+
return event.chargeMicroCredits / require_dist.MICRO_CREDITS_PER_CREDIT;
|
|
26506
26509
|
}
|
|
26507
26510
|
/** One aggregate query for the whole list page — full event rows load only on detail. */
|
|
26508
26511
|
async function platformUsageByRunIdForRuns(organizationId, runs) {
|
|
@@ -26520,7 +26523,7 @@ function platformUsageSummary(rollups, fallback) {
|
|
|
26520
26523
|
const otherServicesUsed = /* @__PURE__ */ new Set();
|
|
26521
26524
|
let totalCostUsd = 0;
|
|
26522
26525
|
for (const rollup of rollups) {
|
|
26523
|
-
totalCostUsd += rollup.chargeMicroCredits / require_dist
|
|
26526
|
+
totalCostUsd += rollup.chargeMicroCredits / require_dist.MICRO_CREDITS_PER_CREDIT;
|
|
26524
26527
|
if (rollup.meterKey === "llm") modelsUsed.add(rollup.legacyLabel ?? rollup.model ?? prettyMeterKey(rollup.meterKey));
|
|
26525
26528
|
else otherServicesUsed.add(rollup.legacyKind ?? rollup.meterKey);
|
|
26526
26529
|
}
|
|
@@ -26585,7 +26588,7 @@ function buildPlatformHistoryUsage(events, durationMs) {
|
|
|
26585
26588
|
const handler$99 = async (c) => {
|
|
26586
26589
|
const organization = c.get("organization");
|
|
26587
26590
|
const ctx = accessContext(c);
|
|
26588
|
-
const query = require_dist
|
|
26591
|
+
const query = require_dist.HistoryRunListQuerySchema.parse({
|
|
26589
26592
|
project: c.req.query("project")?.trim() || void 0,
|
|
26590
26593
|
status: c.req.query("status")?.trim() || void 0,
|
|
26591
26594
|
kind: c.req.query("kind")?.trim() || void 0,
|
|
@@ -26593,7 +26596,7 @@ const handler$99 = async (c) => {
|
|
|
26593
26596
|
});
|
|
26594
26597
|
const scope = listScope(c, historyListScope(ctx));
|
|
26595
26598
|
const filter = await resolveListProjectIds(c, scope, query.project);
|
|
26596
|
-
if (filter === "empty") return c.json(require_dist
|
|
26599
|
+
if (filter === "empty") return c.json(require_dist.HistoryRunListResponseSchema.parse([]));
|
|
26597
26600
|
const runs = await (0, _keystrokehq_database.listHistoryRuns)({
|
|
26598
26601
|
...filter,
|
|
26599
26602
|
...query.status ? { status: query.status } : {},
|
|
@@ -26603,7 +26606,7 @@ const handler$99 = async (c) => {
|
|
|
26603
26606
|
const grantedProjectIdsList = await grantedProjectIds(c, scope);
|
|
26604
26607
|
const projects = await (0, _keystrokehq_platform_database.selectProjectsByOrganizationId)(organization.organizationId, { grantedProjectIds: grantedProjectIdsList });
|
|
26605
26608
|
const historyRuns = await enrichHistoryRuns(runs, new Map(projects.map((project) => [project.id, project.name])), organization.organizationId);
|
|
26606
|
-
return c.json(require_dist
|
|
26609
|
+
return c.json(require_dist.HistoryRunListResponseSchema.parse(historyRuns));
|
|
26607
26610
|
};
|
|
26608
26611
|
//#endregion
|
|
26609
26612
|
//#region src/routes/account/history/[runId]/GET.ts
|
|
@@ -26627,14 +26630,14 @@ const handler$98 = async (c) => {
|
|
|
26627
26630
|
if (!detail) return c.json(null, 404);
|
|
26628
26631
|
const { organizationId } = c.get("organization");
|
|
26629
26632
|
const usageEnrichedDetail = await attachPlatformUsageToDetail(organizationId, detail);
|
|
26630
|
-
return c.json(require_dist
|
|
26633
|
+
return c.json(require_dist.HistoryRunDetailResponseSchema.parse(await attachRanAsToDetail(usageEnrichedDetail, core.ranByUserId)));
|
|
26631
26634
|
};
|
|
26632
26635
|
//#endregion
|
|
26633
26636
|
//#region src/routes/account/resources/common.ts
|
|
26634
26637
|
/** Derive a human display name from a resource slug when no explicit name is stored. */
|
|
26635
26638
|
function titleCaseKey(slug) {
|
|
26636
26639
|
const normalized = slug.split(/[/_-]+/).filter(Boolean).join(" ");
|
|
26637
|
-
if (!normalized) return require_dist
|
|
26640
|
+
if (!normalized) return require_dist.PLATFORM_RESOURCE_UNSUPPORTED_TEXT;
|
|
26638
26641
|
return normalized.replace(/\b\w/g, (char) => char.toUpperCase());
|
|
26639
26642
|
}
|
|
26640
26643
|
//#endregion
|
|
@@ -26645,7 +26648,7 @@ function formatModel(model) {
|
|
|
26645
26648
|
}
|
|
26646
26649
|
function toAgentSummary(row, options) {
|
|
26647
26650
|
const name = row.name?.trim() || titleCaseKey(row.slug);
|
|
26648
|
-
return require_dist
|
|
26651
|
+
return require_dist.AgentSummarySchema.parse({
|
|
26649
26652
|
id: row.id,
|
|
26650
26653
|
slug: row.slug,
|
|
26651
26654
|
name,
|
|
@@ -26660,7 +26663,7 @@ function toAgentSummary(row, options) {
|
|
|
26660
26663
|
credentialCount: row.credentialCount ?? void 0,
|
|
26661
26664
|
apps: (row.appSlugs ?? []).map((id) => ({
|
|
26662
26665
|
id,
|
|
26663
|
-
label: require_dist
|
|
26666
|
+
label: require_dist.displayCredentialAppName(id)
|
|
26664
26667
|
})),
|
|
26665
26668
|
lastRunAt: options?.lastRunAt?.toISOString()
|
|
26666
26669
|
});
|
|
@@ -26669,10 +26672,10 @@ function toAgentSummary(row, options) {
|
|
|
26669
26672
|
//#region src/routes/account/agents/GET.ts
|
|
26670
26673
|
const handler$97 = async (c) => {
|
|
26671
26674
|
const filter = await resolveListProjectIds(c, listScope(c, agentListScope(accessContext(c))), c.req.query("projectId"));
|
|
26672
|
-
if (filter === "empty") return c.json(require_dist
|
|
26675
|
+
if (filter === "empty") return c.json(require_dist.AgentSummaryListResponseSchema.parse([]));
|
|
26673
26676
|
const rows = await (0, _keystrokehq_database.listActiveAgents)(filter);
|
|
26674
26677
|
const lastRunAtById = await (0, _keystrokehq_database.selectAgentLastRunAtByIds)(rows.map((row) => row.id));
|
|
26675
|
-
return c.json(require_dist
|
|
26678
|
+
return c.json(require_dist.AgentSummaryListResponseSchema.parse(rows.map((row) => toAgentSummary(row, { lastRunAt: lastRunAtById.get(row.id) ?? null }))));
|
|
26676
26679
|
};
|
|
26677
26680
|
//#endregion
|
|
26678
26681
|
//#region src/routes/account/lib/touch-resource-activity.ts
|
|
@@ -26684,7 +26687,7 @@ function touchResourceActivityBestEffort(options) {
|
|
|
26684
26687
|
const handler$96 = async (c) => {
|
|
26685
26688
|
const agentId = c.req.param("agentId") ?? "";
|
|
26686
26689
|
const row = agentId ? await (0, _keystrokehq_database.selectActiveAgentById)(agentId) : void 0;
|
|
26687
|
-
if (!row || !await canAccessProjectId(c, row.projectId, canAccessAgent)) return c.json(require_dist
|
|
26690
|
+
if (!row || !await canAccessProjectId(c, row.projectId, canAccessAgent)) return c.json(require_dist.AgentSummaryDetailResponseSchema.parse(null));
|
|
26688
26691
|
touchResourceActivityBestEffort({
|
|
26689
26692
|
userId: c.get("user").id,
|
|
26690
26693
|
projectId: row.projectId,
|
|
@@ -26694,7 +26697,7 @@ const handler$96 = async (c) => {
|
|
|
26694
26697
|
const lastRunAtById = await (0, _keystrokehq_database.selectAgentLastRunAtByIds)([row.id]);
|
|
26695
26698
|
const parsedModel = row.model ? AgentModelIdSchema.safeParse(row.model) : void 0;
|
|
26696
26699
|
const capabilities = parsedModel?.success ? await resolveModelCapabilities(parsedModel.data) : void 0;
|
|
26697
|
-
return c.json(require_dist
|
|
26700
|
+
return c.json(require_dist.AgentSummaryDetailResponseSchema.parse(toAgentSummary(row, {
|
|
26698
26701
|
lastRunAt: lastRunAtById.get(row.id) ?? null,
|
|
26699
26702
|
capabilities
|
|
26700
26703
|
})));
|
|
@@ -26707,17 +26710,17 @@ function relativePathsFromStorageKeys(prefix, keys) {
|
|
|
26707
26710
|
const handler$95 = async (c) => {
|
|
26708
26711
|
const agentId = c.req.param("agentId") ?? "";
|
|
26709
26712
|
const row = agentId ? await (0, _keystrokehq_database.selectActiveAgentById)(agentId) : void 0;
|
|
26710
|
-
if (!row || !await canAccessProjectId(c, row.projectId, canAccessAgent)) return c.json(require_dist
|
|
26713
|
+
if (!row || !await canAccessProjectId(c, row.projectId, canAccessAgent)) return c.json(require_dist.ListAgentMemoryFilesResponseSchema.parse({ files: [] }), 404);
|
|
26711
26714
|
const { organizationId } = c.get("organization");
|
|
26712
26715
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
26713
|
-
if (!organization) return c.json(require_dist
|
|
26716
|
+
if (!organization) return c.json(require_dist.ListAgentMemoryFilesResponseSchema.parse({ files: [] }), 404);
|
|
26714
26717
|
const storage = (0, _keystrokehq_platform_database.createOrgStorageClient)(organization);
|
|
26715
26718
|
const prefix = agentMemoryStoragePrefix(row.id);
|
|
26716
|
-
const files = orderMemoryRelativePaths(relativePathsFromStorageKeys(prefix, await storage.listObjects(prefix))).map((path) => require_dist
|
|
26717
|
-
id: require_dist
|
|
26719
|
+
const files = orderMemoryRelativePaths(relativePathsFromStorageKeys(prefix, await storage.listObjects(prefix))).map((path) => require_dist.AgentMemoryFileSummarySchema.parse({
|
|
26720
|
+
id: require_dist.agentMemoryFileId(path),
|
|
26718
26721
|
path
|
|
26719
26722
|
}));
|
|
26720
|
-
return c.json(require_dist
|
|
26723
|
+
return c.json(require_dist.ListAgentMemoryFilesResponseSchema.parse({ files }));
|
|
26721
26724
|
};
|
|
26722
26725
|
//#endregion
|
|
26723
26726
|
//#region src/routes/account/agents/[agentId]/memory/files/content/GET.ts
|
|
@@ -26732,17 +26735,17 @@ function isStorageNotFoundError(error) {
|
|
|
26732
26735
|
const handler$94 = async (c) => {
|
|
26733
26736
|
const agentId = c.req.param("agentId") ?? "";
|
|
26734
26737
|
const path = c.req.query("path");
|
|
26735
|
-
if (!path) return c.json(require_dist
|
|
26738
|
+
if (!path) return c.json(require_dist.ErrorResponseSchema.parse({ error: "File path is required" }), 400);
|
|
26736
26739
|
const row = agentId ? await (0, _keystrokehq_database.selectActiveAgentById)(agentId) : void 0;
|
|
26737
|
-
if (!row || !await canAccessProjectId(c, row.projectId, canAccessAgent)) return c.json(require_dist
|
|
26740
|
+
if (!row || !await canAccessProjectId(c, row.projectId, canAccessAgent)) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Agent not found" }), 404);
|
|
26738
26741
|
const { organizationId } = c.get("organization");
|
|
26739
26742
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
26740
|
-
if (!organization) return c.json(require_dist
|
|
26743
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
26741
26744
|
let relativePath;
|
|
26742
26745
|
try {
|
|
26743
26746
|
relativePath = resolveMemoryRelativePath((0, node_path.join)((0, node_os.tmpdir)(), "agent-memory"), path);
|
|
26744
26747
|
} catch (error) {
|
|
26745
|
-
if ((error instanceof Error ? error.message : "Invalid file path").includes("must stay within")) return c.json(require_dist
|
|
26748
|
+
if ((error instanceof Error ? error.message : "Invalid file path").includes("must stay within")) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid file path" }), 400);
|
|
26746
26749
|
throw error;
|
|
26747
26750
|
}
|
|
26748
26751
|
const storage = (0, _keystrokehq_platform_database.createOrgStorageClient)(organization);
|
|
@@ -26750,7 +26753,7 @@ const handler$94 = async (c) => {
|
|
|
26750
26753
|
try {
|
|
26751
26754
|
bytes = await storage.getObject(agentMemoryFileStorageKey(row.id, relativePath));
|
|
26752
26755
|
} catch (error) {
|
|
26753
|
-
if (isStorageNotFoundError(error)) return c.json(require_dist
|
|
26756
|
+
if (isStorageNotFoundError(error)) return c.json(require_dist.ErrorResponseSchema.parse({ error: "File not found" }), 404);
|
|
26754
26757
|
throw error;
|
|
26755
26758
|
}
|
|
26756
26759
|
c.header("Content-Type", "text/plain; charset=utf-8");
|
|
@@ -26786,40 +26789,40 @@ function workspaceRelativePathsFromStorageKeys(keys) {
|
|
|
26786
26789
|
const handler$93 = async (c) => {
|
|
26787
26790
|
const agentId = c.req.param("agentId") ?? "";
|
|
26788
26791
|
const row = agentId ? await (0, _keystrokehq_database.selectActiveAgentById)(agentId) : void 0;
|
|
26789
|
-
if (!row || !await canAccessProjectId(c, row.projectId, canAccessAgent)) return c.json(require_dist
|
|
26792
|
+
if (!row || !await canAccessProjectId(c, row.projectId, canAccessAgent)) return c.json(require_dist.ListAgentWorkspaceFilesResponseSchema.parse({ files: [] }), 404);
|
|
26790
26793
|
const { organizationId } = c.get("organization");
|
|
26791
26794
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
26792
|
-
if (!organization) return c.json(require_dist
|
|
26795
|
+
if (!organization) return c.json(require_dist.ListAgentWorkspaceFilesResponseSchema.parse({ files: [] }), 404);
|
|
26793
26796
|
const storage = (0, _keystrokehq_platform_database.createOrgAgentStorageClient)(organization, row.id);
|
|
26794
26797
|
let keys;
|
|
26795
26798
|
try {
|
|
26796
26799
|
keys = await storage.listObjects("");
|
|
26797
26800
|
} catch (error) {
|
|
26798
|
-
if (require_dist
|
|
26801
|
+
if (require_dist.isStorageBucketNotFoundError(error)) return c.json(require_dist.ListAgentWorkspaceFilesResponseSchema.parse({ files: [] }));
|
|
26799
26802
|
throw error;
|
|
26800
26803
|
}
|
|
26801
|
-
const files = workspaceRelativePathsFromStorageKeys(keys).map((path) => require_dist
|
|
26802
|
-
id: require_dist
|
|
26804
|
+
const files = workspaceRelativePathsFromStorageKeys(keys).map((path) => require_dist.AgentWorkspaceFileSummarySchema.parse({
|
|
26805
|
+
id: require_dist.agentWorkspaceFileId(path),
|
|
26803
26806
|
path
|
|
26804
26807
|
}));
|
|
26805
|
-
return c.json(require_dist
|
|
26808
|
+
return c.json(require_dist.ListAgentWorkspaceFilesResponseSchema.parse({ files }));
|
|
26806
26809
|
};
|
|
26807
26810
|
//#endregion
|
|
26808
26811
|
//#region src/routes/account/agents/[agentId]/workspace/files/content/GET.ts
|
|
26809
26812
|
const handler$92 = async (c) => {
|
|
26810
26813
|
const agentId = c.req.param("agentId") ?? "";
|
|
26811
26814
|
const path = c.req.query("path");
|
|
26812
|
-
if (!path) return c.json(require_dist
|
|
26815
|
+
if (!path) return c.json(require_dist.ErrorResponseSchema.parse({ error: "File path is required" }), 400);
|
|
26813
26816
|
const row = agentId ? await (0, _keystrokehq_database.selectActiveAgentById)(agentId) : void 0;
|
|
26814
|
-
if (!row || !await canAccessProjectId(c, row.projectId, canAccessAgent)) return c.json(require_dist
|
|
26817
|
+
if (!row || !await canAccessProjectId(c, row.projectId, canAccessAgent)) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Agent not found" }), 404);
|
|
26815
26818
|
const { organizationId } = c.get("organization");
|
|
26816
26819
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
26817
|
-
if (!organization) return c.json(require_dist
|
|
26820
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
26818
26821
|
let relativePath;
|
|
26819
26822
|
try {
|
|
26820
26823
|
relativePath = resolveWorkspaceRelativePath((0, node_path.join)((0, node_os.tmpdir)(), "agent-workspace"), path);
|
|
26821
26824
|
} catch (error) {
|
|
26822
|
-
if ((error instanceof Error ? error.message : "Invalid file path").includes("must stay within")) return c.json(require_dist
|
|
26825
|
+
if ((error instanceof Error ? error.message : "Invalid file path").includes("must stay within")) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid file path" }), 400);
|
|
26823
26826
|
throw error;
|
|
26824
26827
|
}
|
|
26825
26828
|
const storage = (0, _keystrokehq_platform_database.createOrgAgentStorageClient)(organization, row.id);
|
|
@@ -26827,7 +26830,7 @@ const handler$92 = async (c) => {
|
|
|
26827
26830
|
try {
|
|
26828
26831
|
bytes = await storage.getObject(relativePath);
|
|
26829
26832
|
} catch (error) {
|
|
26830
|
-
if (require_dist
|
|
26833
|
+
if (require_dist.isStorageNotFoundError(error)) return c.json(require_dist.ErrorResponseSchema.parse({ error: "File not found" }), 404);
|
|
26831
26834
|
throw error;
|
|
26832
26835
|
}
|
|
26833
26836
|
c.header("Content-Type", "text/plain; charset=utf-8");
|
|
@@ -26854,7 +26857,7 @@ async function cancelHistoryRun(c, kind, cancel) {
|
|
|
26854
26857
|
const grantedProjectIdsList = await grantedProjectIds(c, historyListScope(accessContext(c)));
|
|
26855
26858
|
const projects = await (0, _keystrokehq_platform_database.selectProjectsByOrganizationId)(organizationContext.organizationId, { grantedProjectIds: grantedProjectIdsList });
|
|
26856
26859
|
const historyRun = await enrichHistoryRun(run, new Map(projects.map((project) => [project.id, project.name])));
|
|
26857
|
-
return c.json(require_dist
|
|
26860
|
+
return c.json(require_dist.HistoryRunCancelResponseSchema.parse(historyRun));
|
|
26858
26861
|
}
|
|
26859
26862
|
//#endregion
|
|
26860
26863
|
//#region src/routes/account/agents/sessions/[sessionId]/cancel/POST.ts
|
|
@@ -26862,7 +26865,7 @@ const handler$91 = (c) => cancelHistoryRun(c, "agent", _keystrokehq_database.can
|
|
|
26862
26865
|
//#endregion
|
|
26863
26866
|
//#region src/routes/account/resources/workflows.ts
|
|
26864
26867
|
function toWorkflowSummary(row, options) {
|
|
26865
|
-
return require_dist
|
|
26868
|
+
return require_dist.WorkflowSummarySchema.parse({
|
|
26866
26869
|
id: row.id,
|
|
26867
26870
|
slug: row.slug,
|
|
26868
26871
|
name: row.name.trim(),
|
|
@@ -26877,10 +26880,10 @@ function toWorkflowSummary(row, options) {
|
|
|
26877
26880
|
//#region src/routes/account/workflows/GET.ts
|
|
26878
26881
|
const handler$90 = async (c) => {
|
|
26879
26882
|
const filter = await resolveListProjectIds(c, listScope(c, workflowListScope(accessContext(c))), c.req.query("projectId"));
|
|
26880
|
-
if (filter === "empty") return c.json(require_dist
|
|
26883
|
+
if (filter === "empty") return c.json(require_dist.WorkflowSummaryListResponseSchema.parse([]));
|
|
26881
26884
|
const rows = await (0, _keystrokehq_database.listActiveWorkflows)(filter);
|
|
26882
26885
|
const lastRunAtById = await (0, _keystrokehq_database.selectWorkflowLastRunAtByIds)(rows.map((row) => row.id));
|
|
26883
|
-
return c.json(require_dist
|
|
26886
|
+
return c.json(require_dist.WorkflowSummaryListResponseSchema.parse(rows.map((row) => toWorkflowSummary(row, { lastRunAt: lastRunAtById.get(row.id) ?? null }))));
|
|
26884
26887
|
};
|
|
26885
26888
|
//#endregion
|
|
26886
26889
|
//#region src/lib/public-form-url.ts
|
|
@@ -26892,9 +26895,9 @@ function buildPublicFormUrl(token) {
|
|
|
26892
26895
|
const handler$89 = async (c) => {
|
|
26893
26896
|
const { organizationId } = c.get("organization");
|
|
26894
26897
|
const filter = await resolveListProjectIds(c, listScope(c, workflowListScope(accessContext(c))), c.req.query("projectId"));
|
|
26895
|
-
if (filter === "empty") return c.json(require_dist
|
|
26898
|
+
if (filter === "empty") return c.json(require_dist.PublishedFormListResponseSchema.parse([]));
|
|
26896
26899
|
const forms = await (0, _keystrokehq_platform_database.listPublishedFormsForOrganization)(organizationId, filter);
|
|
26897
|
-
return c.json(require_dist
|
|
26900
|
+
return c.json(require_dist.PublishedFormListResponseSchema.parse(forms.map((form) => ({
|
|
26898
26901
|
id: form.id,
|
|
26899
26902
|
projectId: form.projectId,
|
|
26900
26903
|
workflowSlug: form.workflowSlug,
|
|
@@ -26912,7 +26915,7 @@ const handler$89 = async (c) => {
|
|
|
26912
26915
|
const handler$88 = async (c) => {
|
|
26913
26916
|
const workflowId = c.req.param("workflowId") ?? "";
|
|
26914
26917
|
const row = workflowId ? await (0, _keystrokehq_database.selectActiveWorkflowById)(workflowId) : void 0;
|
|
26915
|
-
if (!row || !await canAccessProjectId(c, row.projectId, canAccessWorkflow)) return c.json(require_dist
|
|
26918
|
+
if (!row || !await canAccessProjectId(c, row.projectId, canAccessWorkflow)) return c.json(require_dist.WorkflowSummaryDetailResponseSchema.parse(null));
|
|
26916
26919
|
touchResourceActivityBestEffort({
|
|
26917
26920
|
userId: c.get("user").id,
|
|
26918
26921
|
projectId: row.projectId,
|
|
@@ -26920,7 +26923,7 @@ const handler$88 = async (c) => {
|
|
|
26920
26923
|
resourceId: row.id
|
|
26921
26924
|
});
|
|
26922
26925
|
const lastRunAtById = await (0, _keystrokehq_database.selectWorkflowLastRunAtByIds)([row.id]);
|
|
26923
|
-
return c.json(require_dist
|
|
26926
|
+
return c.json(require_dist.WorkflowSummaryDetailResponseSchema.parse(toWorkflowSummary(row, { lastRunAt: lastRunAtById.get(row.id) ?? null })));
|
|
26924
26927
|
};
|
|
26925
26928
|
//#endregion
|
|
26926
26929
|
//#region src/lib/ttl-cache.ts
|
|
@@ -27003,7 +27006,7 @@ async function loadActiveManifest(projectId) {
|
|
|
27003
27006
|
const hit = manifestCache.get(projectId, now);
|
|
27004
27007
|
if (hit !== void 0) return hit;
|
|
27005
27008
|
const manifestJson = await (0, _keystrokehq_platform_database.selectActiveArtifactManifestForProject)(projectId);
|
|
27006
|
-
const manifest = manifestJson ? require_dist
|
|
27009
|
+
const manifest = manifestJson ? require_dist.parseStoredRouteManifest(manifestJson) : null;
|
|
27007
27010
|
manifestCache.set(projectId, manifest, now + MANIFEST_CACHE_TTL_MS);
|
|
27008
27011
|
return manifest;
|
|
27009
27012
|
}
|
|
@@ -27023,7 +27026,7 @@ function indexManifest(entries) {
|
|
|
27023
27026
|
};
|
|
27024
27027
|
}
|
|
27025
27028
|
function fieldsFromSchema(schema) {
|
|
27026
|
-
return require_dist
|
|
27029
|
+
return require_dist.jsonSchemaToWorkflowInputSchema(schema ?? {}).fields;
|
|
27027
27030
|
}
|
|
27028
27031
|
/** A read-only inspector row showing a captured llm option as a literal value. */
|
|
27029
27032
|
function llmOptionRow(key, label, value) {
|
|
@@ -27387,13 +27390,13 @@ const ANNOTATIONS_GENERATOR_VERSION = "wf-canvas-annotations-v1";
|
|
|
27387
27390
|
const handler$87 = async (c) => {
|
|
27388
27391
|
const organization = c.get("organization");
|
|
27389
27392
|
const workflowId = c.req.param("workflowId") ?? "";
|
|
27390
|
-
if (!workflowId.trim()) return c.json(require_dist
|
|
27393
|
+
if (!workflowId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid workflow id" }), 400);
|
|
27391
27394
|
const resolved = await resolveWorkflow(c, workflowId);
|
|
27392
|
-
if (!resolved) return c.json(require_dist
|
|
27395
|
+
if (!resolved) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Workflow not found" }), 404);
|
|
27393
27396
|
const { row, projectId } = resolved;
|
|
27394
27397
|
const manifest = await loadActiveManifest(projectId);
|
|
27395
27398
|
const workflowEntry = manifest?.entries.find((entry) => entry.kind === "workflow" && entry.slug === row.slug);
|
|
27396
|
-
if (!workflowEntry || workflowEntry.kind !== "workflow" || !workflowEntry.flowGraph) return c.json(require_dist
|
|
27399
|
+
if (!workflowEntry || workflowEntry.kind !== "workflow" || !workflowEntry.flowGraph) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Canvas not available" }), 404);
|
|
27397
27400
|
const [triggers, publishedForm] = await Promise.all([(0, _keystrokehq_database.listWorkspaceTriggers)([projectId]), (0, _keystrokehq_platform_database.selectPublishedFormForWorkflow)(organization.organizationId, projectId, row.slug)]);
|
|
27398
27401
|
const { graph, nodeMetadata, codeBlocks } = buildWorkflowCanvas({
|
|
27399
27402
|
workflowSlug: row.slug,
|
|
@@ -27402,7 +27405,7 @@ const handler$87 = async (c) => {
|
|
|
27402
27405
|
triggers,
|
|
27403
27406
|
formPublished: publishedForm?.enabled === true
|
|
27404
27407
|
});
|
|
27405
|
-
const model = require_dist
|
|
27408
|
+
const model = require_dist.DEFAULT_WORKFLOW_CANVAS_MODEL;
|
|
27406
27409
|
const graphHash = workflowEntry.flowGraphHash ?? (0, node_crypto.createHash)("sha256").update(JSON.stringify(workflowEntry.flowGraph)).digest("hex");
|
|
27407
27410
|
const hash = (0, node_crypto.createHash)("sha256").update(JSON.stringify({
|
|
27408
27411
|
source: workflowEntry.flowGraphSourceHash ?? "",
|
|
@@ -27410,7 +27413,7 @@ const handler$87 = async (c) => {
|
|
|
27410
27413
|
model,
|
|
27411
27414
|
version: ANNOTATIONS_GENERATOR_VERSION
|
|
27412
27415
|
})).digest("hex");
|
|
27413
|
-
if (codeBlocks.length === 0) return c.json(require_dist
|
|
27416
|
+
if (codeBlocks.length === 0) return c.json(require_dist.WorkflowCanvasSchema.parse({
|
|
27414
27417
|
graph,
|
|
27415
27418
|
nodeMetadata,
|
|
27416
27419
|
annotations: {},
|
|
@@ -27422,7 +27425,7 @@ const handler$87 = async (c) => {
|
|
|
27422
27425
|
const cache = await (0, _keystrokehq_database.runWithProjectScope)(projectId, () => (0, _keystrokehq_database.selectWorkflowCanvasAnnotations)(workflowId));
|
|
27423
27426
|
const cached = cache?.annotations ?? {};
|
|
27424
27427
|
if (cache && cache.hash === hash) {
|
|
27425
|
-
if (cache.status === "ready" || cache.status === "failed") return c.json(require_dist
|
|
27428
|
+
if (cache.status === "ready" || cache.status === "failed") return c.json(require_dist.WorkflowCanvasSchema.parse({
|
|
27426
27429
|
graph,
|
|
27427
27430
|
nodeMetadata,
|
|
27428
27431
|
annotations: cached,
|
|
@@ -27431,7 +27434,7 @@ const handler$87 = async (c) => {
|
|
|
27431
27434
|
generatedAt: cache.generatedAt ? cache.generatedAt.toISOString() : (/* @__PURE__ */ new Date()).toISOString(),
|
|
27432
27435
|
model: cache.model ?? model
|
|
27433
27436
|
}));
|
|
27434
|
-
if (cache.status === "generating") return c.json(require_dist
|
|
27437
|
+
if (cache.status === "generating") return c.json(require_dist.WorkflowCanvasSchema.parse({
|
|
27435
27438
|
graph,
|
|
27436
27439
|
nodeMetadata,
|
|
27437
27440
|
annotations: cached,
|
|
@@ -27464,7 +27467,7 @@ const handler$87 = async (c) => {
|
|
|
27464
27467
|
});
|
|
27465
27468
|
} catch {
|
|
27466
27469
|
await (0, _keystrokehq_database.runWithProjectScope)(projectId, () => (0, _keystrokehq_database.updateWorkflowCanvasAnnotations)(workflowId, { status: "failed" }));
|
|
27467
|
-
return c.json(require_dist
|
|
27470
|
+
return c.json(require_dist.WorkflowCanvasSchema.parse({
|
|
27468
27471
|
graph,
|
|
27469
27472
|
nodeMetadata,
|
|
27470
27473
|
annotations: {},
|
|
@@ -27474,7 +27477,7 @@ const handler$87 = async (c) => {
|
|
|
27474
27477
|
model
|
|
27475
27478
|
}));
|
|
27476
27479
|
}
|
|
27477
|
-
return c.json(require_dist
|
|
27480
|
+
return c.json(require_dist.WorkflowCanvasSchema.parse({
|
|
27478
27481
|
graph,
|
|
27479
27482
|
nodeMetadata,
|
|
27480
27483
|
annotations: {},
|
|
@@ -27560,17 +27563,17 @@ function toBinding(key, description) {
|
|
|
27560
27563
|
*/
|
|
27561
27564
|
const handler$86 = async (c) => {
|
|
27562
27565
|
const workflowId = c.req.param("workflowId") ?? "";
|
|
27563
|
-
if (!workflowId.trim()) return c.json(require_dist
|
|
27566
|
+
if (!workflowId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid workflow id" }), 400);
|
|
27564
27567
|
const resolved = await resolveWorkflow(c, workflowId);
|
|
27565
|
-
if (!resolved) return c.json(require_dist
|
|
27568
|
+
if (!resolved) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Workflow not found" }), 404);
|
|
27566
27569
|
const { row, projectId } = resolved;
|
|
27567
27570
|
const manifest = await loadActiveManifest(projectId);
|
|
27568
27571
|
const workflowEntry = manifest?.entries.find((entry) => entry.kind === "workflow" && entry.slug === row.slug);
|
|
27569
|
-
if (!workflowEntry || workflowEntry.kind !== "workflow" || !workflowEntry.flowGraph) return c.json(require_dist
|
|
27572
|
+
if (!workflowEntry || workflowEntry.kind !== "workflow" || !workflowEntry.flowGraph) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Canvas not available" }), 404);
|
|
27570
27573
|
const nodeRequirements = collectStepCredentialRequirements(workflowEntry.flowGraph, manifest?.entries ?? []);
|
|
27571
27574
|
const userId = c.get("user").id;
|
|
27572
27575
|
const bindings = await (0, _keystrokehq_database.runWithProjectScope)(projectId, async () => {
|
|
27573
|
-
const context = await require_dist
|
|
27576
|
+
const context = await require_dist.withCredentialAssignments({
|
|
27574
27577
|
orgId: (0, _keystrokehq_database.getServerTenantScopeId)(),
|
|
27575
27578
|
projectId: (0, _keystrokehq_database.getProjectScopeId)(),
|
|
27576
27579
|
userId,
|
|
@@ -27585,7 +27588,7 @@ const handler$86 = async (c) => {
|
|
|
27585
27588
|
...requirement.scope ? { scope: requirement.scope } : {},
|
|
27586
27589
|
consumerId: `step:${nodeId}`
|
|
27587
27590
|
})));
|
|
27588
|
-
const descriptions = await require_dist
|
|
27591
|
+
const descriptions = await require_dist.describeCredentialBindings(flat.map(({ key, scope, consumerId }) => ({
|
|
27589
27592
|
key,
|
|
27590
27593
|
...scope ? { scope } : {},
|
|
27591
27594
|
consumerId
|
|
@@ -27600,7 +27603,7 @@ const handler$86 = async (c) => {
|
|
|
27600
27603
|
}
|
|
27601
27604
|
return result;
|
|
27602
27605
|
});
|
|
27603
|
-
return c.json(require_dist
|
|
27606
|
+
return c.json(require_dist.WorkflowCanvasCredentialBindingsSchema.parse(bindings));
|
|
27604
27607
|
};
|
|
27605
27608
|
//#endregion
|
|
27606
27609
|
//#region src/routes/account/workflows/[workflowId]/canvas/build-run-overlay.ts
|
|
@@ -27720,15 +27723,15 @@ function toCanvasRunStatus(status) {
|
|
|
27720
27723
|
const handler$85 = async (c) => {
|
|
27721
27724
|
const workflowId = c.req.param("workflowId") ?? "";
|
|
27722
27725
|
const runId = c.req.param("runId") ?? "";
|
|
27723
|
-
if (!workflowId.trim() || !runId.trim()) return c.json(require_dist
|
|
27726
|
+
if (!workflowId.trim() || !runId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid workflow or run id" }), 400);
|
|
27724
27727
|
const resolved = await resolveWorkflow(c, workflowId);
|
|
27725
|
-
if (!resolved) return c.json(require_dist
|
|
27728
|
+
if (!resolved) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Workflow not found" }), 404);
|
|
27726
27729
|
const { row, projectId } = resolved;
|
|
27727
27730
|
const run = await (0, _keystrokehq_database.runWithProjectScope)(projectId, () => (0, _keystrokehq_database.selectWorkflowRunForWorkflow)(row.slug, runId));
|
|
27728
|
-
if (!run) return c.json(require_dist
|
|
27731
|
+
if (!run) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Run not found" }), 404);
|
|
27729
27732
|
const manifest = await loadActiveManifest(projectId);
|
|
27730
27733
|
const workflowEntry = manifest?.entries.find((entry) => entry.kind === "workflow" && entry.slug === row.slug);
|
|
27731
|
-
if (!workflowEntry || workflowEntry.kind !== "workflow" || !workflowEntry.flowGraph) return c.json(require_dist
|
|
27734
|
+
if (!workflowEntry || workflowEntry.kind !== "workflow" || !workflowEntry.flowGraph) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Canvas not available" }), 404);
|
|
27732
27735
|
const triggers = await (0, _keystrokehq_database.listWorkspaceTriggers)([projectId]);
|
|
27733
27736
|
const { graph } = buildWorkflowCanvas({
|
|
27734
27737
|
workflowSlug: row.slug,
|
|
@@ -27743,7 +27746,7 @@ const handler$85 = async (c) => {
|
|
|
27743
27746
|
events,
|
|
27744
27747
|
runStatus
|
|
27745
27748
|
});
|
|
27746
|
-
return c.json(require_dist
|
|
27749
|
+
return c.json(require_dist.WorkflowCanvasRunSchema.parse({
|
|
27747
27750
|
runId,
|
|
27748
27751
|
status: runStatus,
|
|
27749
27752
|
startedAt: (run.startedAt ?? run.triggeredAt).toISOString(),
|
|
@@ -27764,9 +27767,9 @@ async function loadWorkflowSource(organization, projectId, sourcePath) {
|
|
|
27764
27767
|
try {
|
|
27765
27768
|
const artifact = await (0, _keystrokehq_platform_database.selectActiveProjectArtifactForProject)(projectId);
|
|
27766
27769
|
if (!artifact?.sourceManifestJson) return null;
|
|
27767
|
-
const file = require_dist
|
|
27770
|
+
const file = require_dist.StoredProjectSourceManifestSchema.parse(artifact.sourceManifestJson).files.find((entry) => entry.path === sourcePath);
|
|
27768
27771
|
if (!file) return null;
|
|
27769
|
-
const bytes = await (0, _keystrokehq_platform_database.createOrgStorageClient)(organization).getObject(require_dist
|
|
27772
|
+
const bytes = await (0, _keystrokehq_platform_database.createOrgStorageClient)(organization).getObject(require_dist.projectSourceBlobKey(projectId, file.hash));
|
|
27770
27773
|
return new TextDecoder().decode(bytes);
|
|
27771
27774
|
} catch {
|
|
27772
27775
|
return null;
|
|
@@ -27775,13 +27778,13 @@ async function loadWorkflowSource(organization, projectId, sourcePath) {
|
|
|
27775
27778
|
const handler$84 = async (c) => {
|
|
27776
27779
|
const organization = c.get("organization");
|
|
27777
27780
|
const workflowId = c.req.param("workflowId") ?? "";
|
|
27778
|
-
if (!workflowId.trim()) return c.json(require_dist
|
|
27781
|
+
if (!workflowId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid workflow id" }), 400);
|
|
27779
27782
|
const resolved = await resolveWorkflow(c, workflowId);
|
|
27780
|
-
if (!resolved) return c.json(require_dist
|
|
27783
|
+
if (!resolved) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Workflow not found" }), 404);
|
|
27781
27784
|
const { row, projectId } = resolved;
|
|
27782
27785
|
const manifest = await loadActiveManifest(projectId);
|
|
27783
27786
|
const workflowEntry = manifest?.entries.find((entry) => entry.kind === "workflow" && entry.slug === row.slug);
|
|
27784
|
-
if (!workflowEntry || workflowEntry.kind !== "workflow" || !workflowEntry.flowGraph) return c.json(require_dist
|
|
27787
|
+
if (!workflowEntry || workflowEntry.kind !== "workflow" || !workflowEntry.flowGraph) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Overview not available" }), 404);
|
|
27785
27788
|
const triggers = await (0, _keystrokehq_database.listWorkspaceTriggers)([projectId]);
|
|
27786
27789
|
const { graph, nodeMetadata } = buildWorkflowCanvas({
|
|
27787
27790
|
workflowSlug: row.slug,
|
|
@@ -27806,7 +27809,7 @@ const handler$84 = async (c) => {
|
|
|
27806
27809
|
...meta?.toolCount !== void 0 ? { toolCount: meta.toolCount } : {}
|
|
27807
27810
|
};
|
|
27808
27811
|
});
|
|
27809
|
-
const model = require_dist
|
|
27812
|
+
const model = require_dist.DEFAULT_WORKFLOW_OVERVIEW_MODEL;
|
|
27810
27813
|
const graphHash = workflowEntry.flowGraphHash ?? (0, node_crypto.createHash)("sha256").update(JSON.stringify(workflowEntry.flowGraph)).digest("hex");
|
|
27811
27814
|
const hash = (0, node_crypto.createHash)("sha256").update(JSON.stringify({
|
|
27812
27815
|
source: workflowEntry.flowGraphSourceHash ?? "",
|
|
@@ -27818,7 +27821,7 @@ const handler$84 = async (c) => {
|
|
|
27818
27821
|
const cache = await (0, _keystrokehq_database.runWithProjectScope)(projectId, () => (0, _keystrokehq_database.selectWorkflowOverview)(workflowId));
|
|
27819
27822
|
const cachedPhases = cache?.phases ?? [];
|
|
27820
27823
|
if (cache && cache.hash === hash) {
|
|
27821
|
-
if (cache.status === "ready" || cache.status === "failed") return c.json(require_dist
|
|
27824
|
+
if (cache.status === "ready" || cache.status === "failed") return c.json(require_dist.WorkspaceWorkflowOverviewSchema.parse({
|
|
27822
27825
|
status: "ready",
|
|
27823
27826
|
summary: cache.summary ?? "",
|
|
27824
27827
|
phases: cachedPhases,
|
|
@@ -27826,7 +27829,7 @@ const handler$84 = async (c) => {
|
|
|
27826
27829
|
generatedAt: cache.generatedAt ? cache.generatedAt.toISOString() : (/* @__PURE__ */ new Date()).toISOString(),
|
|
27827
27830
|
model: cache.model ?? model
|
|
27828
27831
|
}));
|
|
27829
|
-
if (cache.status === "generating") return c.json(require_dist
|
|
27832
|
+
if (cache.status === "generating") return c.json(require_dist.WorkspaceWorkflowOverviewSchema.parse({
|
|
27830
27833
|
status: "generating",
|
|
27831
27834
|
summary: cache.summary ?? "",
|
|
27832
27835
|
phases: [],
|
|
@@ -27862,7 +27865,7 @@ const handler$84 = async (c) => {
|
|
|
27862
27865
|
} catch {
|
|
27863
27866
|
await (0, _keystrokehq_database.runWithProjectScope)(projectId, () => (0, _keystrokehq_database.updateWorkflowOverview)(workflowId, { status: "failed" }));
|
|
27864
27867
|
}
|
|
27865
|
-
return c.json(require_dist
|
|
27868
|
+
return c.json(require_dist.WorkspaceWorkflowOverviewSchema.parse({
|
|
27866
27869
|
status: "generating",
|
|
27867
27870
|
summary: "",
|
|
27868
27871
|
phases: [],
|
|
@@ -27875,13 +27878,13 @@ const handler$84 = async (c) => {
|
|
|
27875
27878
|
//#region src/routes/account/workflows/[workflowId]/run-inputs/GET.ts
|
|
27876
27879
|
const handler$83 = async (c) => {
|
|
27877
27880
|
const workflowId = c.req.param("workflowId") ?? "";
|
|
27878
|
-
if (!workflowId.trim()) return c.json(require_dist
|
|
27881
|
+
if (!workflowId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid workflow id" }), 400);
|
|
27879
27882
|
const resolved = await resolveWorkflow(c, workflowId);
|
|
27880
|
-
if (!resolved) return c.json(require_dist
|
|
27883
|
+
if (!resolved) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Workflow not found" }), 404);
|
|
27881
27884
|
const { row, projectId } = resolved;
|
|
27882
|
-
const schema = require_dist
|
|
27885
|
+
const schema = require_dist.jsonSchemaToWorkflowInputSchema(await resolveWorkflowRequestSchema(projectId, row) ?? {});
|
|
27883
27886
|
const values = await (0, _keystrokehq_database.runWithProjectScope)(projectId, () => (0, _keystrokehq_database.selectWorkflowRunInputValues)(workflowId));
|
|
27884
|
-
return c.json(require_dist
|
|
27887
|
+
return c.json(require_dist.WorkflowRunInputsSchema.parse({
|
|
27885
27888
|
schema,
|
|
27886
27889
|
values
|
|
27887
27890
|
}));
|
|
@@ -27890,21 +27893,21 @@ const handler$83 = async (c) => {
|
|
|
27890
27893
|
//#region src/routes/account/workflows/[workflowId]/run-inputs/PUT.ts
|
|
27891
27894
|
const handler$82 = async (c) => {
|
|
27892
27895
|
const workflowId = c.req.param("workflowId") ?? "";
|
|
27893
|
-
if (!workflowId.trim()) return c.json(require_dist
|
|
27896
|
+
if (!workflowId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid workflow id" }), 400);
|
|
27894
27897
|
const resolved = await resolveWorkflow(c, workflowId);
|
|
27895
|
-
if (!resolved) return c.json(require_dist
|
|
27898
|
+
if (!resolved) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Workflow not found" }), 404);
|
|
27896
27899
|
let body;
|
|
27897
27900
|
try {
|
|
27898
|
-
body = require_dist
|
|
27901
|
+
body = require_dist.WorkflowRunInputsPutBodySchema.parse(await c.req.json());
|
|
27899
27902
|
} catch {
|
|
27900
|
-
return c.json(require_dist
|
|
27903
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid request body" }), 400);
|
|
27901
27904
|
}
|
|
27902
27905
|
const { row, projectId } = resolved;
|
|
27903
|
-
const schema = require_dist
|
|
27904
|
-
const validation = require_dist
|
|
27905
|
-
if (!validation.ok) return c.json(require_dist
|
|
27906
|
+
const schema = require_dist.jsonSchemaToWorkflowInputSchema(await resolveWorkflowRequestSchema(projectId, row) ?? {});
|
|
27907
|
+
const validation = require_dist.validateWorkflowRunInputValues(schema, body);
|
|
27908
|
+
if (!validation.ok) return c.json(require_dist.ErrorResponseSchema.parse({ error: validation.error }), 400);
|
|
27906
27909
|
await (0, _keystrokehq_database.runWithProjectScope)(projectId, () => (0, _keystrokehq_database.updateWorkflowRunInputValues)(workflowId, body));
|
|
27907
|
-
return c.json(require_dist
|
|
27910
|
+
return c.json(require_dist.WorkflowRunInputsSchema.parse({
|
|
27908
27911
|
schema,
|
|
27909
27912
|
values: body
|
|
27910
27913
|
}));
|
|
@@ -27912,8 +27915,7 @@ const handler$82 = async (c) => {
|
|
|
27912
27915
|
//#endregion
|
|
27913
27916
|
//#region src/routes/account/workflows/[workflowId]/run/POST.ts
|
|
27914
27917
|
function parseRunInput$1(requestSchema, input) {
|
|
27915
|
-
|
|
27916
|
-
return zod.z.record(zod.z.string(), zod.z.unknown()).parse(input ?? {});
|
|
27918
|
+
return require_dist.jsonSchemaToZod(requestSchema).parse(input ?? {});
|
|
27917
27919
|
}
|
|
27918
27920
|
/**
|
|
27919
27921
|
* Manually start a workflow run from the dashboard. Validates the input against
|
|
@@ -27923,20 +27925,20 @@ function parseRunInput$1(requestSchema, input) {
|
|
|
27923
27925
|
const handler$81 = async (c) => {
|
|
27924
27926
|
const { organizationId } = c.get("organization");
|
|
27925
27927
|
const workflowId = c.req.param("workflowId") ?? "";
|
|
27926
|
-
if (!workflowId.trim()) return c.json(require_dist
|
|
27928
|
+
if (!workflowId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid workflow id" }), 400);
|
|
27927
27929
|
const resolved = await resolveWorkflow(c, workflowId);
|
|
27928
|
-
if (!resolved) return c.json(require_dist
|
|
27930
|
+
if (!resolved) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Workflow not found" }), 404);
|
|
27929
27931
|
const { row, projectId } = resolved;
|
|
27930
27932
|
const requestSchema = await resolveWorkflowRequestSchema(projectId, row);
|
|
27931
|
-
if (!requestSchema) return c.json(require_dist
|
|
27933
|
+
if (!requestSchema) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Workflow not deployed" }), 404);
|
|
27932
27934
|
let body = {};
|
|
27933
27935
|
if ((c.req.header("content-type") ?? "").includes("application/json")) try {
|
|
27934
27936
|
body = await c.req.json();
|
|
27935
27937
|
} catch {
|
|
27936
|
-
return c.json(require_dist
|
|
27938
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid JSON body" }), 400);
|
|
27937
27939
|
}
|
|
27938
27940
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
27939
|
-
if (!organization) return c.json(require_dist
|
|
27941
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
27940
27942
|
const userId = c.get("user").id;
|
|
27941
27943
|
try {
|
|
27942
27944
|
const runId = await (0, _keystrokehq_database.runWithProjectScope)(projectId, async () => {
|
|
@@ -27951,14 +27953,14 @@ const handler$81 = async (c) => {
|
|
|
27951
27953
|
});
|
|
27952
27954
|
return c.json({ runId }, 202);
|
|
27953
27955
|
} catch (error) {
|
|
27954
|
-
if (error instanceof zod.ZodError) return c.json(require_dist
|
|
27956
|
+
if (error instanceof zod.ZodError) return c.json(require_dist.validationErrorResponse(error, "Invalid workflow input"), 400);
|
|
27955
27957
|
throw error;
|
|
27956
27958
|
}
|
|
27957
27959
|
};
|
|
27958
27960
|
//#endregion
|
|
27959
27961
|
//#region src/routes/account/workflows/[workflowId]/form/shared.ts
|
|
27960
27962
|
function publishedFormResponse(form, workflowId) {
|
|
27961
|
-
return require_dist
|
|
27963
|
+
return require_dist.PublishedFormSchema.parse({
|
|
27962
27964
|
id: form.id,
|
|
27963
27965
|
workflowId,
|
|
27964
27966
|
workflowSlug: form.workflowSlug,
|
|
@@ -27973,10 +27975,10 @@ function publishedFormResponse(form, workflowId) {
|
|
|
27973
27975
|
}
|
|
27974
27976
|
async function resolveFormWorkflow(c, { requireManageAccess = false } = {}) {
|
|
27975
27977
|
const workflowId = c.req.param("workflowId")?.trim();
|
|
27976
|
-
if (!workflowId) return c.json(require_dist
|
|
27978
|
+
if (!workflowId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid workflow id" }), 400);
|
|
27977
27979
|
const workflow = await resolveWorkflow(c, workflowId);
|
|
27978
|
-
if (!workflow) return c.json(require_dist
|
|
27979
|
-
if (requireManageAccess && !await canPerformProjectAction(c, workflow.projectId, projectActions.update)) return c.json(require_dist
|
|
27980
|
+
if (!workflow) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Workflow not found" }), 404);
|
|
27981
|
+
if (requireManageAccess && !await canPerformProjectAction(c, workflow.projectId, projectActions.update)) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Forbidden" }), 403);
|
|
27980
27982
|
return {
|
|
27981
27983
|
workflowId,
|
|
27982
27984
|
projectId: workflow.projectId,
|
|
@@ -27986,10 +27988,10 @@ async function resolveFormWorkflow(c, { requireManageAccess = false } = {}) {
|
|
|
27986
27988
|
async function resolvePublishableInputSchema(projectId, row) {
|
|
27987
27989
|
const requestSchema = await resolveWorkflowRequestSchema(projectId, row);
|
|
27988
27990
|
if (!requestSchema) return new Response(JSON.stringify({ error: "Workflow not deployed" }), { status: 404 });
|
|
27989
|
-
const inputSchema = require_dist
|
|
27991
|
+
const inputSchema = require_dist.jsonSchemaToWorkflowInputSchema(requestSchema);
|
|
27990
27992
|
if (inputSchema.fields.length === 0) return new Response(JSON.stringify({ error: "Workflow does not accept inputs" }), { status: 409 });
|
|
27991
|
-
if (require_dist
|
|
27992
|
-
if (require_dist
|
|
27993
|
+
if (require_dist.schemaHasFileFields(inputSchema)) return new Response(JSON.stringify({ error: "Forms do not support file inputs yet" }), { status: 409 });
|
|
27994
|
+
if (require_dist.schemaHasUnsupportedFormFields(inputSchema)) return new Response(JSON.stringify({ error: "Forms support scalar fields and arrays of scalar fields only" }), { status: 409 });
|
|
27993
27995
|
return inputSchema;
|
|
27994
27996
|
}
|
|
27995
27997
|
//#endregion
|
|
@@ -27999,23 +28001,23 @@ const handler$80 = async (c) => {
|
|
|
27999
28001
|
if (resolved instanceof Response) return resolved;
|
|
28000
28002
|
const { organizationId } = c.get("organization");
|
|
28001
28003
|
const form = await (0, _keystrokehq_platform_database.selectPublishedFormForWorkflow)(organizationId, resolved.projectId, resolved.row.slug);
|
|
28002
|
-
return c.json(require_dist
|
|
28004
|
+
return c.json(require_dist.WorkflowFormResponseSchema.parse(form ? publishedFormResponse(form, resolved.workflowId) : null));
|
|
28003
28005
|
};
|
|
28004
28006
|
//#endregion
|
|
28005
28007
|
//#region src/routes/account/workflows/[workflowId]/form/PUT.ts
|
|
28006
28008
|
const handler$79 = async (c) => {
|
|
28007
28009
|
const resolved = await resolveFormWorkflow(c, { requireManageAccess: true });
|
|
28008
28010
|
if (resolved instanceof Response) return resolved;
|
|
28009
|
-
const body = require_dist
|
|
28011
|
+
const body = require_dist.WorkflowFormUpsertBodySchema.safeParse(await c.req.json().catch(() => null));
|
|
28010
28012
|
if (!body.success) {
|
|
28011
28013
|
const message = body.error.issues[0]?.message ?? "Invalid request body";
|
|
28012
|
-
return c.json(require_dist
|
|
28014
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: message }), 400);
|
|
28013
28015
|
}
|
|
28014
28016
|
const inputSchema = await resolvePublishableInputSchema(resolved.projectId, resolved.row);
|
|
28015
28017
|
if (inputSchema instanceof Response) return inputSchema;
|
|
28016
28018
|
if (body.data.fieldConfig) {
|
|
28017
|
-
const validation = require_dist
|
|
28018
|
-
if (!validation.ok) return c.json(require_dist
|
|
28019
|
+
const validation = require_dist.validateFormFieldConfig(inputSchema, body.data.fieldConfig);
|
|
28020
|
+
if (!validation.ok) return c.json(require_dist.ErrorResponseSchema.parse({ error: validation.error }), 400);
|
|
28019
28021
|
}
|
|
28020
28022
|
const { organizationId } = c.get("organization");
|
|
28021
28023
|
const form = await (0, _keystrokehq_platform_database.upsertPublishedForm)({
|
|
@@ -28037,7 +28039,7 @@ const handler$78 = async (c) => {
|
|
|
28037
28039
|
if (resolved instanceof Response) return resolved;
|
|
28038
28040
|
const { organizationId } = c.get("organization");
|
|
28039
28041
|
const form = await (0, _keystrokehq_platform_database.unpublishFormForWorkflow)(organizationId, resolved.projectId, resolved.row.slug);
|
|
28040
|
-
if (!form) return c.json(require_dist
|
|
28042
|
+
if (!form) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Form not found" }), 404);
|
|
28041
28043
|
return c.json(publishedFormResponse(form, resolved.workflowId));
|
|
28042
28044
|
};
|
|
28043
28045
|
//#endregion
|
|
@@ -28047,7 +28049,7 @@ const handler$77 = async (c) => {
|
|
|
28047
28049
|
if (resolved instanceof Response) return resolved;
|
|
28048
28050
|
const { organizationId } = c.get("organization");
|
|
28049
28051
|
const form = await (0, _keystrokehq_platform_database.rotatePublishedFormToken)(organizationId, resolved.projectId, resolved.row.slug);
|
|
28050
|
-
if (!form) return c.json(require_dist
|
|
28052
|
+
if (!form) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Form not found" }), 404);
|
|
28051
28053
|
return c.json(publishedFormResponse(form, resolved.workflowId));
|
|
28052
28054
|
};
|
|
28053
28055
|
//#endregion
|
|
@@ -28055,7 +28057,7 @@ const handler$77 = async (c) => {
|
|
|
28055
28057
|
function extensionFromUpload$1(contentType, filename) {
|
|
28056
28058
|
const fromName = filename.includes(".") ? filename.split(".").pop()?.toLowerCase() : void 0;
|
|
28057
28059
|
if (fromName && /^[a-z0-9]+$/.test(fromName)) return fromName;
|
|
28058
|
-
return require_dist
|
|
28060
|
+
return require_dist.chatAttachmentExtension(contentType) ?? "bin";
|
|
28059
28061
|
}
|
|
28060
28062
|
/**
|
|
28061
28063
|
* Presign an upload for a file attached to a manual workflow run. Storage is
|
|
@@ -28067,22 +28069,22 @@ function extensionFromUpload$1(contentType, filename) {
|
|
|
28067
28069
|
const handler$76 = async (c) => {
|
|
28068
28070
|
const { organizationId } = c.get("organization");
|
|
28069
28071
|
const workflowId = c.req.param("workflowId") ?? "";
|
|
28070
|
-
if (!workflowId.trim()) return c.json(require_dist
|
|
28072
|
+
if (!workflowId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid workflow id" }), 400);
|
|
28071
28073
|
const resolved = await resolveWorkflow(c, workflowId);
|
|
28072
|
-
if (!resolved) return c.json(require_dist
|
|
28074
|
+
if (!resolved) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Workflow not found" }), 404);
|
|
28073
28075
|
const { projectId } = resolved;
|
|
28074
|
-
const parsed = require_dist
|
|
28075
|
-
if (!parsed.success) return c.json(require_dist
|
|
28076
|
-
if (!require_dist
|
|
28076
|
+
const parsed = require_dist.PresignChatAttachmentRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
28077
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid presign request" }), 400);
|
|
28078
|
+
if (!require_dist.isAllowedChatAttachmentMediaType(parsed.data.contentType)) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Unsupported content type" }), 400);
|
|
28077
28079
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
28078
|
-
if (!organization) return c.json(require_dist
|
|
28080
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
28079
28081
|
const ext = extensionFromUpload$1(parsed.data.contentType, parsed.data.filename);
|
|
28080
|
-
const storageKey = require_dist
|
|
28082
|
+
const storageKey = require_dist.chatAttachmentStorageKey(projectId, crypto.randomUUID(), ext);
|
|
28081
28083
|
const uploadUrl = await (0, _keystrokehq_platform_database.createOrgStorageClient)(organization).presignPut({
|
|
28082
28084
|
key: storageKey,
|
|
28083
28085
|
contentType: parsed.data.contentType
|
|
28084
28086
|
});
|
|
28085
|
-
return c.json(require_dist
|
|
28087
|
+
return c.json(require_dist.PresignChatAttachmentResponseSchema.parse({
|
|
28086
28088
|
uploadUrl,
|
|
28087
28089
|
storageKey
|
|
28088
28090
|
}));
|
|
@@ -28091,12 +28093,12 @@ const handler$76 = async (c) => {
|
|
|
28091
28093
|
//#region src/routes/account/workflows/[workflowId]/runs/GET.ts
|
|
28092
28094
|
const handler$75 = async (c) => {
|
|
28093
28095
|
const workflowId = c.req.param("workflowId") ?? "";
|
|
28094
|
-
if (!workflowId.trim()) return c.json(require_dist
|
|
28096
|
+
if (!workflowId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid workflow id" }), 400);
|
|
28095
28097
|
const resolved = await resolveWorkflow(c, workflowId);
|
|
28096
|
-
if (!resolved) return c.json(require_dist
|
|
28098
|
+
if (!resolved) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Workflow not found" }), 404);
|
|
28097
28099
|
const { row, projectId } = resolved;
|
|
28098
28100
|
const scope = listScope(c, projectListScope(accessContext(c)));
|
|
28099
|
-
if (await resolveListProjectIds(c, scope, projectId) === "empty") return c.json(require_dist
|
|
28101
|
+
if (await resolveListProjectIds(c, scope, projectId) === "empty") return c.json(require_dist.HistoryRunListResponseSchema.parse([]));
|
|
28100
28102
|
const runs = await (0, _keystrokehq_database.listHistoryRuns)({
|
|
28101
28103
|
kind: "workflow",
|
|
28102
28104
|
projectIds: [projectId],
|
|
@@ -28108,7 +28110,7 @@ const handler$75 = async (c) => {
|
|
|
28108
28110
|
const { organizationId } = c.get("organization");
|
|
28109
28111
|
const projects = await (0, _keystrokehq_platform_database.selectProjectsByOrganizationId)(organizationId, { grantedProjectIds: await grantedProjectIds(c, scope) });
|
|
28110
28112
|
const projectNameById = new Map(projects.map((project) => [project.id, project.name]));
|
|
28111
|
-
return c.json(require_dist
|
|
28113
|
+
return c.json(require_dist.HistoryRunListResponseSchema.parse(await enrichHistoryRuns(runs, projectNameById, organizationId)));
|
|
28112
28114
|
};
|
|
28113
28115
|
//#endregion
|
|
28114
28116
|
//#region src/routes/account/workflows/runs/[runId]/cancel/POST.ts
|
|
@@ -28117,7 +28119,7 @@ const handler$74 = (c) => cancelHistoryRun(c, "workflow", _keystrokehq_database.
|
|
|
28117
28119
|
//#region src/routes/account/resources/skills.ts
|
|
28118
28120
|
function toSkillSummary(row) {
|
|
28119
28121
|
const name = row.name?.trim() || titleCaseKey(row.slug);
|
|
28120
|
-
return require_dist
|
|
28122
|
+
return require_dist.SkillSummarySchema.parse({
|
|
28121
28123
|
id: row.id,
|
|
28122
28124
|
slug: row.slug,
|
|
28123
28125
|
name,
|
|
@@ -28131,23 +28133,23 @@ function toSkillSummary(row) {
|
|
|
28131
28133
|
//#region src/routes/account/skills/GET.ts
|
|
28132
28134
|
const handler$73 = async (c) => {
|
|
28133
28135
|
const filter = await resolveListProjectIds(c, listScope(c, skillListScope(accessContext(c))), c.req.query("projectId"));
|
|
28134
|
-
if (filter === "empty") return c.json(require_dist
|
|
28136
|
+
if (filter === "empty") return c.json(require_dist.SkillSummaryListResponseSchema.parse([]));
|
|
28135
28137
|
const rows = await (0, _keystrokehq_database.listActiveSkills)(filter);
|
|
28136
|
-
return c.json(require_dist
|
|
28138
|
+
return c.json(require_dist.SkillSummaryListResponseSchema.parse(rows.map(toSkillSummary)));
|
|
28137
28139
|
};
|
|
28138
28140
|
//#endregion
|
|
28139
28141
|
//#region src/routes/account/skills/[skillId]/GET.ts
|
|
28140
28142
|
const handler$72 = async (c) => {
|
|
28141
28143
|
const skillId = c.req.param("skillId") ?? "";
|
|
28142
28144
|
const row = skillId ? await (0, _keystrokehq_database.selectActiveSkillById)(skillId) : void 0;
|
|
28143
|
-
if (!row || !await canAccessProjectId(c, row.projectId, canAccessSkill)) return c.json(require_dist
|
|
28145
|
+
if (!row || !await canAccessProjectId(c, row.projectId, canAccessSkill)) return c.json(require_dist.SkillSummaryDetailResponseSchema.parse(null));
|
|
28144
28146
|
touchResourceActivityBestEffort({
|
|
28145
28147
|
userId: c.get("user").id,
|
|
28146
28148
|
projectId: row.projectId,
|
|
28147
28149
|
resourceKind: "skill",
|
|
28148
28150
|
resourceId: row.id
|
|
28149
28151
|
});
|
|
28150
|
-
return c.json(require_dist
|
|
28152
|
+
return c.json(require_dist.SkillSummaryDetailResponseSchema.parse(toSkillSummary(row)));
|
|
28151
28153
|
};
|
|
28152
28154
|
//#endregion
|
|
28153
28155
|
//#region src/routes/account/triggers/enrich.ts
|
|
@@ -28168,7 +28170,7 @@ function buildTriggerWebhookUrl(record, tokenByProjectRoute) {
|
|
|
28168
28170
|
const route = webhookRouteFromEndpoint(record.webhookEndpoint);
|
|
28169
28171
|
const token = tokenByProjectRoute.get(webhookTokenKey(record.projectId, route));
|
|
28170
28172
|
if (!token) return null;
|
|
28171
|
-
const platformOrigin =
|
|
28173
|
+
const platformOrigin = require_wait_for_health_XEzPPQIO.resolveExternalPlatformOrigin();
|
|
28172
28174
|
if (!platformOrigin) return null;
|
|
28173
28175
|
return `${`${platformOrigin.replace(/\/$/, "")}/api/projects/${encodeURIComponent(record.projectId)}`}${route.startsWith("/") ? route : `/${route}`}?token=${encodeURIComponent(token)}`;
|
|
28174
28176
|
}
|
|
@@ -28250,43 +28252,43 @@ const handler$71 = async (c) => {
|
|
|
28250
28252
|
const organization = c.get("organization");
|
|
28251
28253
|
const scope = listScope(c, projectListScope(accessContext(c)));
|
|
28252
28254
|
const filter = await resolveListProjectIds(c, scope, c.req.query("projectId"));
|
|
28253
|
-
if (filter === "empty") return c.json(require_dist
|
|
28255
|
+
if (filter === "empty") return c.json(require_dist.WorkspaceTriggerListResponseSchema.parse([]));
|
|
28254
28256
|
const granted = await grantedProjectIds(c, scope);
|
|
28255
28257
|
const [records, projects] = await Promise.all([(0, _keystrokehq_database.listWorkspaceTriggers)(filter.projectIds), (0, _keystrokehq_platform_database.selectProjectsByOrganizationId)(organization.organizationId, { grantedProjectIds: granted })]);
|
|
28256
28258
|
const projectNameById = new Map(projects.map((project) => [project.id, project.name]));
|
|
28257
|
-
return c.json(require_dist
|
|
28259
|
+
return c.json(require_dist.WorkspaceTriggerListResponseSchema.parse(records.map((record) => toWorkspaceTriggerDetail(record, projectNameById.get(record.projectId) ?? "Unknown project", null))));
|
|
28258
28260
|
};
|
|
28259
28261
|
//#endregion
|
|
28260
28262
|
//#region src/routes/account/triggers/[triggerId]/GET.ts
|
|
28261
28263
|
const handler$70 = async (c) => {
|
|
28262
28264
|
const organization = c.get("organization");
|
|
28263
28265
|
const triggerId = c.req.param("triggerId") ?? "";
|
|
28264
|
-
if (!triggerId.trim()) return c.json(require_dist
|
|
28266
|
+
if (!triggerId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid trigger id" }), 400);
|
|
28265
28267
|
const scope = listScope(c, projectListScope(accessContext(c)));
|
|
28266
28268
|
const filter = await resolveListProjectIds(c, scope);
|
|
28267
|
-
if (filter === "empty") return c.json(require_dist
|
|
28269
|
+
if (filter === "empty") return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28268
28270
|
const record = await (0, _keystrokehq_database.getWorkspaceTriggerById)(triggerId, filter.projectIds);
|
|
28269
|
-
if (!record) return c.json(require_dist
|
|
28271
|
+
if (!record) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28270
28272
|
const [projects, webhookKeys] = await Promise.all([(0, _keystrokehq_platform_database.selectProjectsByOrganizationId)(organization.organizationId, { grantedProjectIds: await grantedProjectIds(c, scope) }), (0, _keystrokehq_platform_database.listWebhookApiKeysForProject)(record.projectId)]);
|
|
28271
28273
|
const projectName = projects.find((project) => project.id === record.projectId)?.name ?? "Unknown project";
|
|
28272
28274
|
const webhookUrl = buildTriggerWebhookUrl(record, webhookTokensByProjectRoute(webhookKeys));
|
|
28273
|
-
return c.json(require_dist
|
|
28275
|
+
return c.json(require_dist.WorkspaceTriggerDetailSchema.parse(toWorkspaceTriggerDetail(record, projectName, webhookUrl)));
|
|
28274
28276
|
};
|
|
28275
28277
|
//#endregion
|
|
28276
28278
|
//#region src/routes/account/triggers/[triggerId]/runs/GET.ts
|
|
28277
28279
|
const handler$69 = async (c) => {
|
|
28278
28280
|
const triggerId = c.req.param("triggerId") ?? "";
|
|
28279
|
-
if (!triggerId.trim()) return c.json(require_dist
|
|
28281
|
+
if (!triggerId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid trigger id" }), 400);
|
|
28280
28282
|
const filter = await resolveListProjectIds(c, listScope(c, projectListScope(accessContext(c))));
|
|
28281
|
-
if (filter === "empty") return c.json(require_dist
|
|
28282
|
-
const query = require_dist
|
|
28283
|
+
if (filter === "empty") return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28284
|
+
const query = require_dist.TriggerRunListQuerySchema.parse({
|
|
28283
28285
|
limit: c.req.query("limit"),
|
|
28284
28286
|
cursor: c.req.query("cursor")?.trim() || void 0,
|
|
28285
28287
|
triggerType: c.req.query("triggerType")?.trim() || void 0,
|
|
28286
28288
|
outcome: c.req.query("outcome")?.trim() || void 0
|
|
28287
28289
|
});
|
|
28288
28290
|
const record = await (0, _keystrokehq_database.getWorkspaceTriggerById)(triggerId, filter.projectIds);
|
|
28289
|
-
if (!record) return c.json(require_dist
|
|
28291
|
+
if (!record) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28290
28292
|
const result = await (0, _keystrokehq_database.listWorkspaceTriggerRunRows)({
|
|
28291
28293
|
projectId: record.projectId,
|
|
28292
28294
|
triggerId: record.id,
|
|
@@ -28295,8 +28297,8 @@ const handler$69 = async (c) => {
|
|
|
28295
28297
|
triggerType: query.triggerType,
|
|
28296
28298
|
outcome: query.outcome
|
|
28297
28299
|
});
|
|
28298
|
-
if (!result) return c.json(require_dist
|
|
28299
|
-
return c.json(require_dist
|
|
28300
|
+
if (!result) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28301
|
+
return c.json(require_dist.WorkspaceTriggerRunListResponseSchema.parse({
|
|
28300
28302
|
items: result.items.map((item) => toWorkspaceTriggerRunSummary(item, record.assignments)),
|
|
28301
28303
|
nextCursor: result.nextCursor
|
|
28302
28304
|
}));
|
|
@@ -28306,25 +28308,25 @@ const handler$69 = async (c) => {
|
|
|
28306
28308
|
const handler$68 = async (c) => {
|
|
28307
28309
|
const { organizationId } = c.get("organization");
|
|
28308
28310
|
const triggerId = c.req.param("triggerId") ?? "";
|
|
28309
|
-
if (!triggerId.trim()) return c.json(require_dist
|
|
28311
|
+
if (!triggerId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid trigger id" }), 400);
|
|
28310
28312
|
const filter = await resolveListProjectIds(c, listScope(c, projectListScope(accessContext(c))));
|
|
28311
|
-
if (filter === "empty") return c.json(require_dist
|
|
28313
|
+
if (filter === "empty") return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28312
28314
|
const record = await (0, _keystrokehq_database.getWorkspaceTriggerById)(triggerId, filter.projectIds);
|
|
28313
|
-
if (!record) return c.json(require_dist
|
|
28315
|
+
if (!record) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28314
28316
|
const artifact = await (0, _keystrokehq_platform_database.selectActiveProjectArtifactForProject)(record.projectId);
|
|
28315
|
-
if (!artifact || !artifact.sourceManifestJson) return c.json(require_dist
|
|
28316
|
-
const file = require_dist
|
|
28317
|
-
if (!file) return c.json(require_dist
|
|
28317
|
+
if (!artifact || !artifact.sourceManifestJson) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Source not found" }), 404);
|
|
28318
|
+
const file = require_dist.StoredProjectSourceManifestSchema.parse(artifact.sourceManifestJson).files.find((entry) => entry.path === record.sourcePath);
|
|
28319
|
+
if (!file) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Source file not found" }), 404);
|
|
28318
28320
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
28319
|
-
if (!organization) return c.json(require_dist
|
|
28321
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
28320
28322
|
const storage = (0, _keystrokehq_platform_database.createOrgStorageClient)(organization);
|
|
28321
28323
|
let bytes;
|
|
28322
28324
|
try {
|
|
28323
|
-
bytes = await storage.getObject(require_dist
|
|
28325
|
+
bytes = await storage.getObject(require_dist.projectSourceBlobKey(record.projectId, file.hash));
|
|
28324
28326
|
} catch {
|
|
28325
|
-
return c.json(require_dist
|
|
28327
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: "Source file contents not found" }), 404);
|
|
28326
28328
|
}
|
|
28327
|
-
return c.json(require_dist
|
|
28329
|
+
return c.json(require_dist.WorkspaceTriggerFileSchema.parse({
|
|
28328
28330
|
path: record.sourcePath,
|
|
28329
28331
|
contents: new TextDecoder().decode(bytes)
|
|
28330
28332
|
}));
|
|
@@ -28332,7 +28334,7 @@ const handler$68 = async (c) => {
|
|
|
28332
28334
|
//#endregion
|
|
28333
28335
|
//#region src/routes/account/triggers/[triggerId]/overview/GET.ts
|
|
28334
28336
|
function envelope(row, status, hash) {
|
|
28335
|
-
return require_dist
|
|
28337
|
+
return require_dist.WorkspaceTriggerOverviewSchema.parse({
|
|
28336
28338
|
status,
|
|
28337
28339
|
markdown: row.overviewMarkdown ?? "",
|
|
28338
28340
|
hash,
|
|
@@ -28343,25 +28345,25 @@ function envelope(row, status, hash) {
|
|
|
28343
28345
|
const handler$67 = async (c) => {
|
|
28344
28346
|
const { organizationId } = c.get("organization");
|
|
28345
28347
|
const triggerId = c.req.param("triggerId") ?? "";
|
|
28346
|
-
if (!triggerId.trim()) return c.json(require_dist
|
|
28348
|
+
if (!triggerId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid trigger id" }), 400);
|
|
28347
28349
|
const filter = await resolveListProjectIds(c, listScope(c, projectListScope(accessContext(c))));
|
|
28348
|
-
if (filter === "empty") return c.json(require_dist
|
|
28350
|
+
if (filter === "empty") return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28349
28351
|
const record = await (0, _keystrokehq_database.getWorkspaceTriggerById)(triggerId, filter.projectIds);
|
|
28350
|
-
if (!record) return c.json(require_dist
|
|
28352
|
+
if (!record) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28351
28353
|
const row = await (0, _keystrokehq_database.runWithProjectScope)(record.projectId, () => (0, _keystrokehq_database.selectTriggerById)(triggerId));
|
|
28352
|
-
if (!row) return c.json(require_dist
|
|
28354
|
+
if (!row) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28353
28355
|
if (row.triggerHash && row.overviewStatus === "ready" && row.overviewHash === row.triggerHash) return c.json(envelope(row, "ready", row.triggerHash));
|
|
28354
28356
|
if (row.triggerHash && row.overviewStatus === "generating" && row.overviewHash === row.triggerHash) return c.json(envelope(row, "generating", row.triggerHash));
|
|
28355
28357
|
const artifact = await (0, _keystrokehq_platform_database.selectActiveProjectArtifactForProject)(record.projectId);
|
|
28356
|
-
const file = (artifact?.sourceManifestJson ? require_dist
|
|
28358
|
+
const file = (artifact?.sourceManifestJson ? require_dist.StoredProjectSourceManifestSchema.parse(artifact.sourceManifestJson) : null)?.files.find((entry) => entry.path === record.sourcePath) ?? null;
|
|
28357
28359
|
if (!file) return c.json(envelope(row, "ready", row.triggerHash ?? row.overviewHash ?? ""));
|
|
28358
28360
|
const effectiveHash = row.triggerHash ?? file.hash;
|
|
28359
28361
|
if (row.overviewStatus === "ready" && row.overviewHash === effectiveHash) return c.json(envelope(row, "ready", effectiveHash));
|
|
28360
28362
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
28361
|
-
if (!organization) return c.json(require_dist
|
|
28363
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
28362
28364
|
let sourceContents;
|
|
28363
28365
|
try {
|
|
28364
|
-
const bytes = await (0, _keystrokehq_platform_database.createOrgStorageClient)(organization).getObject(require_dist
|
|
28366
|
+
const bytes = await (0, _keystrokehq_platform_database.createOrgStorageClient)(organization).getObject(require_dist.projectSourceBlobKey(record.projectId, file.hash));
|
|
28365
28367
|
sourceContents = new TextDecoder().decode(bytes);
|
|
28366
28368
|
} catch {
|
|
28367
28369
|
await (0, _keystrokehq_database.runWithProjectScope)(record.projectId, () => (0, _keystrokehq_database.updateTriggerOverview)(triggerId, { status: "failed" }));
|
|
@@ -28380,7 +28382,7 @@ const handler$67 = async (c) => {
|
|
|
28380
28382
|
triggerId,
|
|
28381
28383
|
projectId: record.projectId,
|
|
28382
28384
|
triggerHash: effectiveHash,
|
|
28383
|
-
model: require_dist
|
|
28385
|
+
model: require_dist.DEFAULT_TRIGGER_OVERVIEW_MODEL,
|
|
28384
28386
|
input: {
|
|
28385
28387
|
name: record.name,
|
|
28386
28388
|
description: record.description,
|
|
@@ -28426,32 +28428,32 @@ const handler$66 = async (c) => {
|
|
|
28426
28428
|
const organization = c.get("organization");
|
|
28427
28429
|
const triggerId = c.req.param("triggerId") ?? "";
|
|
28428
28430
|
const attachmentId = c.req.param("attachmentId") ?? "";
|
|
28429
|
-
if (!triggerId.trim() || !attachmentId.trim()) return c.json(require_dist
|
|
28430
|
-
const parsed = require_dist
|
|
28431
|
+
if (!triggerId.trim() || !attachmentId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid trigger or attachment id" }), 400);
|
|
28432
|
+
const parsed = require_dist.TriggerAttachmentUpdateRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
28431
28433
|
if (!parsed.success) {
|
|
28432
28434
|
const message = parsed.error.issues[0]?.message ?? "Invalid request body";
|
|
28433
|
-
return c.json(require_dist
|
|
28435
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: message }), 400);
|
|
28434
28436
|
}
|
|
28435
28437
|
const scope = listScope(c, projectListScope(accessContext(c)));
|
|
28436
28438
|
const filter = await resolveListProjectIds(c, scope);
|
|
28437
|
-
if (filter === "empty") return c.json(require_dist
|
|
28439
|
+
if (filter === "empty") return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28438
28440
|
const record = await (0, _keystrokehq_database.getWorkspaceTriggerById)(triggerId, filter.projectIds);
|
|
28439
|
-
if (!record) return c.json(require_dist
|
|
28440
|
-
if (!record.assignments.find((entry) => entry.attachmentId === attachmentId)) return c.json(require_dist
|
|
28441
|
+
if (!record) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28442
|
+
if (!record.assignments.find((entry) => entry.attachmentId === attachmentId)) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Attachment not found" }), 404);
|
|
28441
28443
|
if (!await canPerformProjectAction(c, record.projectId, projectActions.deploy)) return forbidden(c);
|
|
28442
28444
|
const updated = await (0, _keystrokehq_database.runWithProjectScope)(record.projectId, () => (0, _keystrokehq_database.setTriggerAttachmentEnabledState)({
|
|
28443
28445
|
triggerId,
|
|
28444
28446
|
attachmentId,
|
|
28445
28447
|
enabled: parsed.data.enabled
|
|
28446
28448
|
}));
|
|
28447
|
-
if (!updated) return c.json(require_dist
|
|
28449
|
+
if (!updated) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Attachment not found" }), 404);
|
|
28448
28450
|
await syncNativeTriggerSchedule(organization.row, updated.trigger);
|
|
28449
28451
|
const refreshed = await (0, _keystrokehq_database.getWorkspaceTriggerById)(triggerId, [record.projectId]);
|
|
28450
|
-
if (!refreshed) return c.json(require_dist
|
|
28452
|
+
if (!refreshed) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28451
28453
|
const [projects, webhookKeys] = await Promise.all([(0, _keystrokehq_platform_database.selectProjectsByOrganizationId)(organization.organizationId, { grantedProjectIds: await grantedProjectIds(c, scope) }), (0, _keystrokehq_platform_database.listWebhookApiKeysForProject)(refreshed.projectId)]);
|
|
28452
28454
|
const projectName = projects.find((project) => project.id === refreshed.projectId)?.name ?? "Unknown project";
|
|
28453
28455
|
const webhookUrl = buildTriggerWebhookUrl(refreshed, webhookTokensByProjectRoute(webhookKeys));
|
|
28454
|
-
return c.json(require_dist
|
|
28456
|
+
return c.json(require_dist.WorkspaceTriggerDetailSchema.parse(toWorkspaceTriggerDetail(refreshed, projectName, webhookUrl)));
|
|
28455
28457
|
};
|
|
28456
28458
|
//#endregion
|
|
28457
28459
|
//#region src/routes/account/triggers/[triggerId]/invoke/POST.ts
|
|
@@ -28497,31 +28499,31 @@ var InvokeHttpError = class extends Error {
|
|
|
28497
28499
|
const handler$65 = async (c) => {
|
|
28498
28500
|
const { organizationId } = c.get("organization");
|
|
28499
28501
|
const triggerId = c.req.param("triggerId") ?? "";
|
|
28500
|
-
if (!triggerId.trim()) return c.json(require_dist
|
|
28502
|
+
if (!triggerId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid trigger id" }), 400);
|
|
28501
28503
|
let body = {};
|
|
28502
28504
|
if ((c.req.header("content-type") ?? "").includes("application/json")) try {
|
|
28503
28505
|
body = await c.req.json();
|
|
28504
28506
|
} catch {
|
|
28505
|
-
return c.json(require_dist
|
|
28507
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid JSON body" }), 400);
|
|
28506
28508
|
}
|
|
28507
|
-
const parsed = require_dist
|
|
28509
|
+
const parsed = require_dist.TriggerInvokeRequestSchema.safeParse(body);
|
|
28508
28510
|
if (!parsed.success) {
|
|
28509
28511
|
const message = parsed.error.issues[0]?.message ?? "Invalid request body";
|
|
28510
|
-
return c.json(require_dist
|
|
28512
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: message }), 400);
|
|
28511
28513
|
}
|
|
28512
28514
|
const filter = await resolveListProjectIds(c, listScope(c, projectListScope(accessContext(c))));
|
|
28513
|
-
if (filter === "empty") return c.json(require_dist
|
|
28515
|
+
if (filter === "empty") return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28514
28516
|
const record = await (0, _keystrokehq_database.getWorkspaceTriggerById)(triggerId, filter.projectIds);
|
|
28515
|
-
if (!record) return c.json(require_dist
|
|
28517
|
+
if (!record) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28516
28518
|
if (!await canPerformProjectAction(c, record.projectId, projectActions.deploy)) return forbidden(c);
|
|
28517
|
-
if (record.status === "disabled") return c.json(require_dist
|
|
28519
|
+
if (record.status === "disabled") return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger is disabled" }), 409);
|
|
28518
28520
|
const narrowed = narrowAssignments(record.assignments, parsed.data);
|
|
28519
|
-
if ("error" in narrowed) return c.json(require_dist
|
|
28521
|
+
if ("error" in narrowed) return c.json(require_dist.ErrorResponseSchema.parse({ error: narrowed.error }), narrowed.status);
|
|
28520
28522
|
const targets = enabledAssignments(narrowed);
|
|
28521
|
-
if (targets.length === 0) return c.json(require_dist
|
|
28522
|
-
if (parsed.data.input !== void 0 && record.type !== "webhook") return c.json(require_dist
|
|
28523
|
+
if (targets.length === 0) return c.json(require_dist.ErrorResponseSchema.parse({ error: "No enabled attachments to invoke" }), 409);
|
|
28524
|
+
if (parsed.data.input !== void 0 && record.type !== "webhook") return c.json(require_dist.ErrorResponseSchema.parse({ error: `input is only supported for webhook triggers (got ${record.type})` }), 400);
|
|
28523
28525
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
28524
|
-
if (!organization) return c.json(require_dist
|
|
28526
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
28525
28527
|
const attachmentSlugs = targets.map((entry) => entry.attachmentSlug);
|
|
28526
28528
|
const manualPayload = parsed.data.workflow || parsed.data.agent ? {
|
|
28527
28529
|
manual: true,
|
|
@@ -28555,9 +28557,9 @@ const handler$65 = async (c) => {
|
|
|
28555
28557
|
}));
|
|
28556
28558
|
return runId;
|
|
28557
28559
|
});
|
|
28558
|
-
return c.json(require_dist
|
|
28560
|
+
return c.json(require_dist.TriggerInvokeResponseSchema.parse({ runId }), 202);
|
|
28559
28561
|
} catch (error) {
|
|
28560
|
-
if (error instanceof InvokeHttpError) return c.json(require_dist
|
|
28562
|
+
if (error instanceof InvokeHttpError) return c.json(require_dist.ErrorResponseSchema.parse({ error: error.message }), error.status);
|
|
28561
28563
|
throw error;
|
|
28562
28564
|
}
|
|
28563
28565
|
};
|
|
@@ -28569,11 +28571,11 @@ const handler$65 = async (c) => {
|
|
|
28569
28571
|
*/
|
|
28570
28572
|
const handler$64 = async (c) => {
|
|
28571
28573
|
const triggerId = c.req.param("triggerId") ?? "";
|
|
28572
|
-
if (!triggerId.trim()) return c.json(require_dist
|
|
28574
|
+
if (!triggerId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid trigger id" }), 400);
|
|
28573
28575
|
const filter = await resolveListProjectIds(c, listScope(c, projectListScope(accessContext(c))));
|
|
28574
|
-
if (filter === "empty") return c.json(require_dist
|
|
28576
|
+
if (filter === "empty") return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28575
28577
|
const record = await (0, _keystrokehq_database.getWorkspaceTriggerById)(triggerId, filter.projectIds);
|
|
28576
|
-
if (!record) return c.json(require_dist
|
|
28578
|
+
if (!record) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28577
28579
|
const { attachments, staticPayload } = await (0, _keystrokehq_database.runWithProjectScope)(record.projectId, async () => {
|
|
28578
28580
|
const trigger = await (0, _keystrokehq_database.selectTriggerById)(record.id);
|
|
28579
28581
|
const source = trigger ? (0, _keystrokehq_database.storedTriggerSourceFromRow)(trigger) : null;
|
|
@@ -28592,7 +28594,7 @@ const handler$64 = async (c) => {
|
|
|
28592
28594
|
staticPayload: source?.kind === "cron" ? source.payload ?? {} : record.type === "cron" ? {} : void 0
|
|
28593
28595
|
};
|
|
28594
28596
|
});
|
|
28595
|
-
return c.json(require_dist
|
|
28597
|
+
return c.json(require_dist.TriggerInvokeInputsSchema.parse({
|
|
28596
28598
|
type: record.type,
|
|
28597
28599
|
attachments,
|
|
28598
28600
|
...staticPayload !== void 0 ? { staticPayload } : {}
|
|
@@ -28601,7 +28603,7 @@ const handler$64 = async (c) => {
|
|
|
28601
28603
|
//#endregion
|
|
28602
28604
|
//#region src/routes/account/resources/recents.ts
|
|
28603
28605
|
function toRecentResource(activity, resource, projectName) {
|
|
28604
|
-
return require_dist
|
|
28606
|
+
return require_dist.RecentResourceSchema.parse({
|
|
28605
28607
|
id: activity.id,
|
|
28606
28608
|
resourceKind: activity.resourceKind,
|
|
28607
28609
|
resourceId: activity.resourceId,
|
|
@@ -28655,7 +28657,7 @@ const handler$63 = async (c) => {
|
|
|
28655
28657
|
skill: new Map(skills.map((row) => [row.id, hydratedResourceFromAgentRow(row)]))
|
|
28656
28658
|
};
|
|
28657
28659
|
const recents = visibleActivities.map((activity) => hydrateRecentResource(activity, lookup, projectNameById)).filter((recent) => recent !== null).sort((left, right) => latestRecentInteractionAt(right) - latestRecentInteractionAt(left));
|
|
28658
|
-
return c.json(require_dist
|
|
28660
|
+
return c.json(require_dist.RecentResourceListResponseSchema.parse(recents));
|
|
28659
28661
|
};
|
|
28660
28662
|
//#endregion
|
|
28661
28663
|
//#region src/routes/account/projects/GET.ts
|
|
@@ -28663,7 +28665,7 @@ const handler$62 = async (c) => {
|
|
|
28663
28665
|
const organization = c.get("organization");
|
|
28664
28666
|
const grantedProjectIdsList = await grantedProjectIds(c, listScope(c, projectListScope(accessContext(c))));
|
|
28665
28667
|
const projects = await (0, _keystrokehq_platform_database.selectProjectsByOrganizationId)(organization.organizationId, { grantedProjectIds: grantedProjectIdsList });
|
|
28666
|
-
return c.json(require_dist
|
|
28668
|
+
return c.json(require_dist.ListProjectsResponseSchema.parse(projects.map(require_dist.mapProject)));
|
|
28667
28669
|
};
|
|
28668
28670
|
//#endregion
|
|
28669
28671
|
//#region src/routes/account/projects/metrics/merge-project-list-metrics.ts
|
|
@@ -28697,7 +28699,7 @@ const handler$61 = async (c) => {
|
|
|
28697
28699
|
const allowed = new Set(grantedProjectIdsList);
|
|
28698
28700
|
metrics = Object.fromEntries(Object.entries(metrics).filter(([projectId]) => allowed.has(projectId)));
|
|
28699
28701
|
}
|
|
28700
|
-
return c.json(require_dist
|
|
28702
|
+
return c.json(require_dist.ListProjectMetricsResponseSchema.parse(metrics));
|
|
28701
28703
|
};
|
|
28702
28704
|
//#endregion
|
|
28703
28705
|
//#region src/routes/account/projects/POST.ts
|
|
@@ -28706,11 +28708,11 @@ function createCreateProjectHandler(projectQuotaGate) {
|
|
|
28706
28708
|
const organization = c.get("organization");
|
|
28707
28709
|
const user = c.get("user");
|
|
28708
28710
|
const body = await c.req.json().catch(() => null);
|
|
28709
|
-
const parsed = require_dist
|
|
28710
|
-
if (!parsed.success) return c.json(require_dist
|
|
28711
|
+
const parsed = require_dist.CreateProjectRequestSchema.safeParse(body);
|
|
28712
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Project name is required" }), 400);
|
|
28711
28713
|
if (projectQuotaGate) {
|
|
28712
28714
|
const verdict = await projectQuotaGate(organization.organizationId);
|
|
28713
|
-
if (!verdict.allow) return c.json(require_dist
|
|
28715
|
+
if (!verdict.allow) return c.json(require_dist.ErrorResponseSchema.parse({ error: verdict.reason }), 403);
|
|
28714
28716
|
}
|
|
28715
28717
|
const project = await (0, _keystrokehq_platform_database.createProjectForOrganization)(organization.organizationId, parsed.data.name, parsed.data.description, user.id);
|
|
28716
28718
|
const projectCount = await (0, _keystrokehq_platform_database.countActiveProjectsForOrganization)(organization.organizationId).catch(() => void 0);
|
|
@@ -28725,25 +28727,25 @@ function createCreateProjectHandler(projectQuotaGate) {
|
|
|
28725
28727
|
organizationId: organization.organizationId,
|
|
28726
28728
|
properties: { project_count: projectCount }
|
|
28727
28729
|
}).catch(() => {});
|
|
28728
|
-
return c.json(require_dist
|
|
28730
|
+
return c.json(require_dist.CreateProjectResponseSchema.parse(require_dist.mapProject(project)), 201);
|
|
28729
28731
|
};
|
|
28730
28732
|
}
|
|
28731
28733
|
//#endregion
|
|
28732
28734
|
//#region src/routes/account/projects/slug-available/GET.ts
|
|
28733
28735
|
const handler$59 = async (c) => {
|
|
28734
28736
|
const organization = c.get("organization");
|
|
28735
|
-
const parsed = require_dist
|
|
28737
|
+
const parsed = require_dist.ProjectSlugAvailabilityQuerySchema.safeParse({
|
|
28736
28738
|
slug: c.req.query("slug"),
|
|
28737
28739
|
excludeProjectId: c.req.query("excludeProjectId")
|
|
28738
28740
|
});
|
|
28739
|
-
if (!parsed.success) return c.json(require_dist
|
|
28741
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid slug query" }), 400);
|
|
28740
28742
|
const availability = await (0, _keystrokehq_platform_database.checkProjectSlugAvailability)(organization.organizationId, parsed.data.slug, parsed.data.excludeProjectId);
|
|
28741
|
-
return c.json(require_dist
|
|
28743
|
+
return c.json(require_dist.ProjectSlugAvailabilityResponseSchema.parse(availability));
|
|
28742
28744
|
};
|
|
28743
28745
|
//#endregion
|
|
28744
28746
|
//#region src/routes/account/projects/[projectId]/GET.ts
|
|
28745
28747
|
const handler$58 = async (c) => {
|
|
28746
|
-
return c.json(require_dist
|
|
28748
|
+
return c.json(require_dist.ProjectResponseSchema.parse(routeProject(c.get("project"))));
|
|
28747
28749
|
};
|
|
28748
28750
|
//#endregion
|
|
28749
28751
|
//#region src/routes/account/projects/[projectId]/PATCH.ts
|
|
@@ -28751,31 +28753,31 @@ const handler$57 = async (c) => {
|
|
|
28751
28753
|
const organization = c.get("organization");
|
|
28752
28754
|
const project = c.get("project");
|
|
28753
28755
|
const body = await c.req.json().catch(() => null);
|
|
28754
|
-
const parsed = require_dist
|
|
28755
|
-
if (!parsed.success) return c.json(require_dist
|
|
28756
|
+
const parsed = require_dist.UpdateProjectRequestSchema.safeParse(body);
|
|
28757
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid project update request" }), 400);
|
|
28756
28758
|
let updated;
|
|
28757
28759
|
try {
|
|
28758
28760
|
updated = await (0, _keystrokehq_platform_database.updateProjectForOrganization)(organization.organizationId, project.id, parsed.data);
|
|
28759
28761
|
} catch (error) {
|
|
28760
|
-
if (error instanceof _keystrokehq_platform_database.ProjectSlugTakenError) return c.json(require_dist
|
|
28762
|
+
if (error instanceof _keystrokehq_platform_database.ProjectSlugTakenError) return c.json(require_dist.ErrorResponseSchema.parse({ error: require_dist.PROJECT_SLUG_TAKEN_MESSAGE }), 409);
|
|
28761
28763
|
throw error;
|
|
28762
28764
|
}
|
|
28763
|
-
if (!updated) return c.json(require_dist
|
|
28764
|
-
return c.json(require_dist
|
|
28765
|
+
if (!updated) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Project not found" }), 404);
|
|
28766
|
+
return c.json(require_dist.ProjectResponseSchema.parse(require_dist.mapProject(updated)));
|
|
28765
28767
|
};
|
|
28766
28768
|
//#endregion
|
|
28767
28769
|
//#region src/routes/account/projects/[projectId]/DELETE.ts
|
|
28768
28770
|
const handler$56 = async (c) => {
|
|
28769
28771
|
const organization = c.get("organization");
|
|
28770
28772
|
const project = c.get("project");
|
|
28771
|
-
if (!await (0, _keystrokehq_platform_database.deleteProjectForOrganization)(organization.organizationId, project.id)) return c.json(require_dist
|
|
28773
|
+
if (!await (0, _keystrokehq_platform_database.deleteProjectForOrganization)(organization.organizationId, project.id)) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Project not found" }), 404);
|
|
28772
28774
|
return c.body(null, 204);
|
|
28773
28775
|
};
|
|
28774
28776
|
//#endregion
|
|
28775
28777
|
//#region src/routes/account/projects/[projectId]/deployments/GET.ts
|
|
28776
28778
|
const handler$55 = async (c) => {
|
|
28777
28779
|
const rows = await (0, _keystrokehq_platform_database.selectProjectDeployments)(c.get("project").id);
|
|
28778
|
-
return c.json(require_dist
|
|
28780
|
+
return c.json(require_dist.ListProjectDeploymentsResponseSchema.parse(rows.map(require_dist.mapProjectDeployment)));
|
|
28779
28781
|
};
|
|
28780
28782
|
//#endregion
|
|
28781
28783
|
//#region src/routes/account/projects/[projectId]/artifacts/POST.ts
|
|
@@ -28787,7 +28789,7 @@ const handler$54 = async (c) => {
|
|
|
28787
28789
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
28788
28790
|
if (!organization) return c.json({ error: "Organization not found" }, 404);
|
|
28789
28791
|
const artifactId = crypto.randomUUID();
|
|
28790
|
-
const storageKey = require_dist
|
|
28792
|
+
const storageKey = require_dist.projectArtifactKey(project.id, artifactId);
|
|
28791
28793
|
const storage = (0, _keystrokehq_platform_database.createOrgStorageClient)(organization);
|
|
28792
28794
|
const artifact = await (0, _keystrokehq_platform_database.insertProjectArtifact)({
|
|
28793
28795
|
id: artifactId,
|
|
@@ -28800,8 +28802,8 @@ const handler$54 = async (c) => {
|
|
|
28800
28802
|
contentType: ARTIFACT_CONTENT_TYPE,
|
|
28801
28803
|
expiresInSeconds: DEFAULT_PRESIGN_TTL_SECONDS$1
|
|
28802
28804
|
});
|
|
28803
|
-
return c.json(require_dist
|
|
28804
|
-
artifact: require_dist
|
|
28805
|
+
return c.json(require_dist.CreateProjectArtifactResponseSchema.parse({
|
|
28806
|
+
artifact: require_dist.mapProjectArtifact(artifact),
|
|
28805
28807
|
uploadUrl,
|
|
28806
28808
|
expiresInSeconds: DEFAULT_PRESIGN_TTL_SECONDS$1
|
|
28807
28809
|
}), 201);
|
|
@@ -28820,7 +28822,7 @@ const handler$53 = async (c) => {
|
|
|
28820
28822
|
key: artifact.storageKey,
|
|
28821
28823
|
expiresInSeconds: DEFAULT_PRESIGN_TTL_SECONDS
|
|
28822
28824
|
});
|
|
28823
|
-
return c.json(require_dist
|
|
28825
|
+
return c.json(require_dist.DownloadActiveProjectArtifactResponseSchema.parse({
|
|
28824
28826
|
artifactId: artifact.id,
|
|
28825
28827
|
downloadUrl,
|
|
28826
28828
|
expiresInSeconds: DEFAULT_PRESIGN_TTL_SECONDS
|
|
@@ -28831,20 +28833,20 @@ const handler$53 = async (c) => {
|
|
|
28831
28833
|
const handler$52 = async (c) => {
|
|
28832
28834
|
const project = c.get("project");
|
|
28833
28835
|
const active = await (0, _keystrokehq_platform_database.selectActiveArtifactSourceManifestForProject)(project.id);
|
|
28834
|
-
if (!active?.sourceManifestJson) return c.json(require_dist
|
|
28836
|
+
if (!active?.sourceManifestJson) return c.json(require_dist.ErrorResponseSchema.parse({ error: "No active source for project" }), 404);
|
|
28835
28837
|
const { organizationId } = c.get("organization");
|
|
28836
28838
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
28837
|
-
if (!organization) return c.json(require_dist
|
|
28838
|
-
const manifest = require_dist
|
|
28839
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
28840
|
+
const manifest = require_dist.StoredProjectSourceManifestSchema.parse(active.sourceManifestJson);
|
|
28839
28841
|
const storage = (0, _keystrokehq_platform_database.createOrgStorageClient)(organization);
|
|
28840
28842
|
let files;
|
|
28841
28843
|
try {
|
|
28842
|
-
files = await require_dist
|
|
28844
|
+
files = await require_dist.loadProjectSourceFiles(storage, project.id, manifest);
|
|
28843
28845
|
} catch (error) {
|
|
28844
28846
|
const message = error instanceof Error ? error.message : "Failed to load source files";
|
|
28845
|
-
return c.json(require_dist
|
|
28847
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: message }), 400);
|
|
28846
28848
|
}
|
|
28847
|
-
return c.json(require_dist
|
|
28849
|
+
return c.json(require_dist.DownloadActiveProjectSourceResponseSchema.parse({
|
|
28848
28850
|
artifactId: active.artifactId,
|
|
28849
28851
|
files
|
|
28850
28852
|
}));
|
|
@@ -28861,20 +28863,20 @@ const handler$51 = async (c) => {
|
|
|
28861
28863
|
const project = c.get("project");
|
|
28862
28864
|
const user = c.get("user");
|
|
28863
28865
|
const artifactId = c.req.param("artifactId");
|
|
28864
|
-
if (!artifactId) return c.json(require_dist
|
|
28866
|
+
if (!artifactId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Artifact id is required" }), 400);
|
|
28865
28867
|
const existing = await (0, _keystrokehq_platform_database.selectProjectArtifactForProject)(artifactId, project.id);
|
|
28866
|
-
if (!existing) return c.json(require_dist
|
|
28867
|
-
if (existing.status === "ready") return c.json(require_dist
|
|
28868
|
+
if (!existing) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Artifact not found" }), 404);
|
|
28869
|
+
if (existing.status === "ready") return c.json(require_dist.ErrorResponseSchema.parse({ error: "Artifact already completed" }), 409);
|
|
28868
28870
|
const { organizationId } = c.get("organization");
|
|
28869
28871
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
28870
|
-
if (!organization) return c.json(require_dist
|
|
28872
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
28871
28873
|
const storage = (0, _keystrokehq_platform_database.createOrgStorageClient)(organization);
|
|
28872
28874
|
const head = await storage.headObject(existing.storageKey);
|
|
28873
|
-
if (!head || head.contentLength <= 0) return c.json(require_dist
|
|
28875
|
+
if (!head || head.contentLength <= 0) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Artifact upload not found in storage" }), 400);
|
|
28874
28876
|
try {
|
|
28875
28877
|
const artifactBytes = await storage.getObject(existing.storageKey);
|
|
28876
|
-
if (!artifactBytes || artifactBytes.byteLength <= 0) return c.json(require_dist
|
|
28877
|
-
const manifestJson = require_dist
|
|
28878
|
+
if (!artifactBytes || artifactBytes.byteLength <= 0) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Artifact upload not found in storage" }), 400);
|
|
28879
|
+
const manifestJson = require_dist.parseStoredRouteManifest(require_dist.extractRouteManifestFromArtifact(Buffer.from(artifactBytes)));
|
|
28878
28880
|
await validateAgentModelIds(agentModelIdsFromStoredManifest(manifestJson));
|
|
28879
28881
|
const isFirstDeploy = project.activeArtifactId == null;
|
|
28880
28882
|
const workflowCount = manifestJson.entries.filter((entry) => entry.kind === "workflow").length;
|
|
@@ -28883,7 +28885,7 @@ const handler$51 = async (c) => {
|
|
|
28883
28885
|
const skillCount = manifestJson.skills.length;
|
|
28884
28886
|
const hasCustomContent = manifestJson.entries.some((entry) => {
|
|
28885
28887
|
if (entry.kind !== "workflow" && entry.kind !== "agent" && entry.kind !== "action") return false;
|
|
28886
|
-
return !require_dist
|
|
28888
|
+
return !require_dist.isHelloWorldTemplateSlug(entry.slug);
|
|
28887
28889
|
});
|
|
28888
28890
|
const result = await (0, _keystrokehq_platform_database.completeProjectArtifact)({
|
|
28889
28891
|
artifactId,
|
|
@@ -28909,13 +28911,13 @@ const handler$51 = async (c) => {
|
|
|
28909
28911
|
has_custom_content: hasCustomContent
|
|
28910
28912
|
}
|
|
28911
28913
|
}).catch(() => {});
|
|
28912
|
-
return c.json(require_dist
|
|
28913
|
-
artifact: require_dist
|
|
28914
|
-
project: require_dist
|
|
28914
|
+
return c.json(require_dist.CompleteProjectArtifactResponseSchema.parse({
|
|
28915
|
+
artifact: require_dist.mapProjectArtifact(result.artifact),
|
|
28916
|
+
project: require_dist.mapProject(result.project)
|
|
28915
28917
|
}));
|
|
28916
28918
|
} catch (error) {
|
|
28917
28919
|
const message = error instanceof Error ? error.message : "Failed to complete artifact";
|
|
28918
|
-
return c.json(require_dist
|
|
28920
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: message }), 400);
|
|
28919
28921
|
}
|
|
28920
28922
|
};
|
|
28921
28923
|
//#endregion
|
|
@@ -28924,17 +28926,17 @@ const SOURCE_BLOB_CONTENT_TYPE = "text/plain; charset=utf-8";
|
|
|
28924
28926
|
const handler$50 = async (c) => {
|
|
28925
28927
|
const project = c.get("project");
|
|
28926
28928
|
const artifactId = c.req.param("artifactId");
|
|
28927
|
-
if (!artifactId) return c.json(require_dist
|
|
28928
|
-
if (!await (0, _keystrokehq_platform_database.selectProjectArtifactForProject)(artifactId, project.id)) return c.json(require_dist
|
|
28929
|
-
const parsed = require_dist
|
|
28930
|
-
if (!parsed.success) return c.json(require_dist
|
|
28929
|
+
if (!artifactId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Artifact id is required" }), 400);
|
|
28930
|
+
if (!await (0, _keystrokehq_platform_database.selectProjectArtifactForProject)(artifactId, project.id)) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Artifact not found" }), 404);
|
|
28931
|
+
const parsed = require_dist.PresignProjectSourceRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
28932
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid blob list" }), 400);
|
|
28931
28933
|
const { organizationId } = c.get("organization");
|
|
28932
28934
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
28933
|
-
if (!organization) return c.json(require_dist
|
|
28935
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
28934
28936
|
const storage = (0, _keystrokehq_platform_database.createOrgStorageClient)(organization);
|
|
28935
28937
|
const hashes = [...new Set(parsed.data.blobs.map((blob) => blob.hash))];
|
|
28936
28938
|
const uploads = await Promise.all(hashes.map(async (hash) => {
|
|
28937
|
-
const key = require_dist
|
|
28939
|
+
const key = require_dist.projectSourceBlobKey(project.id, hash);
|
|
28938
28940
|
const head = await storage.headObject(key);
|
|
28939
28941
|
if (head && head.contentLength > 0) return null;
|
|
28940
28942
|
return {
|
|
@@ -28945,20 +28947,20 @@ const handler$50 = async (c) => {
|
|
|
28945
28947
|
})
|
|
28946
28948
|
};
|
|
28947
28949
|
}));
|
|
28948
|
-
return c.json(require_dist
|
|
28950
|
+
return c.json(require_dist.PresignProjectSourceResponseSchema.parse({ uploads: uploads.filter((upload) => upload !== null) }));
|
|
28949
28951
|
};
|
|
28950
28952
|
//#endregion
|
|
28951
28953
|
//#region src/routes/account/projects/[projectId]/artifacts/[artifactId]/source/manifest/POST.ts
|
|
28952
28954
|
const handler$49 = async (c) => {
|
|
28953
28955
|
const project = c.get("project");
|
|
28954
28956
|
const artifactId = c.req.param("artifactId");
|
|
28955
|
-
if (!artifactId) return c.json(require_dist
|
|
28956
|
-
if (!await (0, _keystrokehq_platform_database.selectProjectArtifactForProject)(artifactId, project.id)) return c.json(require_dist
|
|
28957
|
-
const parsed = require_dist
|
|
28958
|
-
if (!parsed.success) return c.json(require_dist
|
|
28959
|
-
const manifest = require_dist
|
|
28957
|
+
if (!artifactId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Artifact id is required" }), 400);
|
|
28958
|
+
if (!await (0, _keystrokehq_platform_database.selectProjectArtifactForProject)(artifactId, project.id)) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Artifact not found" }), 404);
|
|
28959
|
+
const parsed = require_dist.UploadProjectSourceManifestRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
28960
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid source manifest" }), 400);
|
|
28961
|
+
const manifest = require_dist.StoredProjectSourceManifestSchema.parse({
|
|
28960
28962
|
files: parsed.data.files.map((file) => ({
|
|
28961
|
-
id: require_dist
|
|
28963
|
+
id: require_dist.projectFileId(file.path),
|
|
28962
28964
|
path: file.path,
|
|
28963
28965
|
hash: file.hash
|
|
28964
28966
|
})),
|
|
@@ -28969,7 +28971,7 @@ const handler$49 = async (c) => {
|
|
|
28969
28971
|
projectId: project.id,
|
|
28970
28972
|
sourceManifestJson: manifest
|
|
28971
28973
|
});
|
|
28972
|
-
return c.json(require_dist
|
|
28974
|
+
return c.json(require_dist.UploadProjectSourceResponseSchema.parse({
|
|
28973
28975
|
ok: true,
|
|
28974
28976
|
fileCount: manifest.files.length
|
|
28975
28977
|
}), 201);
|
|
@@ -28979,27 +28981,27 @@ const handler$49 = async (c) => {
|
|
|
28979
28981
|
function extensionFromUpload(contentType, filename) {
|
|
28980
28982
|
const fromName = filename.includes(".") ? filename.split(".").pop()?.toLowerCase() : void 0;
|
|
28981
28983
|
if (fromName && /^[a-z0-9]+$/.test(fromName)) return fromName;
|
|
28982
|
-
return require_dist
|
|
28984
|
+
return require_dist.chatAttachmentExtension(contentType) ?? "bin";
|
|
28983
28985
|
}
|
|
28984
28986
|
const handler$48 = async (c) => {
|
|
28985
28987
|
const project = c.get("project");
|
|
28986
28988
|
const slug = c.req.param("slug");
|
|
28987
|
-
if (!slug) return c.json(require_dist
|
|
28989
|
+
if (!slug) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Agent slug is required" }), 400);
|
|
28988
28990
|
const agent = await (0, _keystrokehq_database.runWithProjectScope)(project.id, () => (0, _keystrokehq_database.selectAgentBySlug)(slug));
|
|
28989
|
-
if (!agent || agent.projectId !== project.id) return c.json(require_dist
|
|
28990
|
-
const parsed = require_dist
|
|
28991
|
-
if (!parsed.success) return c.json(require_dist
|
|
28992
|
-
if (!require_dist
|
|
28991
|
+
if (!agent || agent.projectId !== project.id) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Agent not found" }), 404);
|
|
28992
|
+
const parsed = require_dist.PresignChatAttachmentRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
28993
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid presign request" }), 400);
|
|
28994
|
+
if (!require_dist.isAllowedChatAttachmentMediaType(parsed.data.contentType)) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Unsupported content type" }), 400);
|
|
28993
28995
|
const { organizationId } = c.get("organization");
|
|
28994
28996
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
28995
|
-
if (!organization) return c.json(require_dist
|
|
28997
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
28996
28998
|
const ext = extensionFromUpload(parsed.data.contentType, parsed.data.filename);
|
|
28997
|
-
const storageKey = require_dist
|
|
28999
|
+
const storageKey = require_dist.chatAttachmentStorageKey(project.id, crypto.randomUUID(), ext);
|
|
28998
29000
|
const uploadUrl = await (0, _keystrokehq_platform_database.createOrgStorageClient)(organization).presignPut({
|
|
28999
29001
|
key: storageKey,
|
|
29000
29002
|
contentType: parsed.data.contentType
|
|
29001
29003
|
});
|
|
29002
|
-
return c.json(require_dist
|
|
29004
|
+
return c.json(require_dist.PresignChatAttachmentResponseSchema.parse({
|
|
29003
29005
|
uploadUrl,
|
|
29004
29006
|
storageKey
|
|
29005
29007
|
}));
|
|
@@ -29010,14 +29012,14 @@ const handler$47 = async (c) => {
|
|
|
29010
29012
|
const project = c.get("project");
|
|
29011
29013
|
const slug = c.req.param("slug");
|
|
29012
29014
|
const keyParam = c.req.param("key");
|
|
29013
|
-
if (!slug || !keyParam) return c.json(require_dist
|
|
29015
|
+
if (!slug || !keyParam) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Attachment key is required" }), 400);
|
|
29014
29016
|
const storageKey = keyParam.split("/").map((segment) => decodeURIComponent(segment)).join("/");
|
|
29015
|
-
if (!require_dist
|
|
29017
|
+
if (!require_dist.isChatAttachmentStorageKey(storageKey, project.id)) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Attachment not found" }), 404);
|
|
29016
29018
|
const agent = await (0, _keystrokehq_database.runWithProjectScope)(project.id, () => (0, _keystrokehq_database.selectAgentBySlug)(slug));
|
|
29017
|
-
if (!agent || agent.projectId !== project.id) return c.json(require_dist
|
|
29019
|
+
if (!agent || agent.projectId !== project.id) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Agent not found" }), 404);
|
|
29018
29020
|
const { organizationId } = c.get("organization");
|
|
29019
29021
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
29020
|
-
if (!organization) return c.json(require_dist
|
|
29022
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
29021
29023
|
const url = await (0, _keystrokehq_platform_database.createOrgStorageClient)(organization).presignGet({ key: storageKey });
|
|
29022
29024
|
return c.redirect(url, 302);
|
|
29023
29025
|
};
|
|
@@ -29055,18 +29057,18 @@ function resolveSourcePaths(rows, kindDir, filePaths) {
|
|
|
29055
29057
|
const handler$46 = async (c) => {
|
|
29056
29058
|
const project = c.get("project");
|
|
29057
29059
|
const active = await (0, _keystrokehq_platform_database.selectActiveArtifactSourceManifestForProject)(project.id);
|
|
29058
|
-
if (!active || !active.sourceManifestJson) return c.json(require_dist
|
|
29060
|
+
if (!active || !active.sourceManifestJson) return c.json(require_dist.ListProjectFilesResponseSchema.parse({
|
|
29059
29061
|
artifactId: active?.artifactId ?? null,
|
|
29060
29062
|
files: []
|
|
29061
29063
|
}));
|
|
29062
|
-
const manifest = require_dist
|
|
29064
|
+
const manifest = require_dist.StoredProjectSourceManifestSchema.parse(active.sourceManifestJson);
|
|
29063
29065
|
const [agents, workflows, skills] = await Promise.all([
|
|
29064
29066
|
(0, _keystrokehq_database.listActiveAgents)({ projectIds: [project.id] }),
|
|
29065
29067
|
(0, _keystrokehq_database.listActiveWorkflows)({ projectIds: [project.id] }),
|
|
29066
29068
|
(0, _keystrokehq_database.listActiveSkills)({ projectIds: [project.id] })
|
|
29067
29069
|
]);
|
|
29068
29070
|
const filePaths = manifest.files.map((file) => file.path);
|
|
29069
|
-
const resources = require_dist
|
|
29071
|
+
const resources = require_dist.ProjectSourceResourcesSchema.parse({
|
|
29070
29072
|
agents: resolveSourcePaths(agents, "agents", filePaths),
|
|
29071
29073
|
workflows: resolveSourcePaths(workflows, "workflows", filePaths),
|
|
29072
29074
|
skills: skills.map((row) => ({
|
|
@@ -29074,7 +29076,7 @@ const handler$46 = async (c) => {
|
|
|
29074
29076
|
path: row.moduleFile
|
|
29075
29077
|
}))
|
|
29076
29078
|
});
|
|
29077
|
-
return c.json(require_dist
|
|
29079
|
+
return c.json(require_dist.ListProjectFilesResponseSchema.parse({
|
|
29078
29080
|
artifactId: active.artifactId,
|
|
29079
29081
|
files: manifest.files.map((file) => ({
|
|
29080
29082
|
id: file.id,
|
|
@@ -29100,13 +29102,13 @@ function ifNoneMatchMatches(ifNoneMatch, etag) {
|
|
|
29100
29102
|
const handler$45 = async (c) => {
|
|
29101
29103
|
const project = c.get("project");
|
|
29102
29104
|
const artifactId = c.req.param("artifactId");
|
|
29103
|
-
if (!artifactId) return c.json(require_dist
|
|
29105
|
+
if (!artifactId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Artifact id is required" }), 400);
|
|
29104
29106
|
const path = c.req.query("path");
|
|
29105
|
-
if (!path) return c.json(require_dist
|
|
29107
|
+
if (!path) return c.json(require_dist.ErrorResponseSchema.parse({ error: "File path is required" }), 400);
|
|
29106
29108
|
const artifact = await (0, _keystrokehq_platform_database.selectProjectArtifactSourceManifestForProject)(artifactId, project.id);
|
|
29107
|
-
if (!artifact || !artifact.sourceManifestJson) return c.json(require_dist
|
|
29108
|
-
const file = require_dist
|
|
29109
|
-
if (!file) return c.json(require_dist
|
|
29109
|
+
if (!artifact || !artifact.sourceManifestJson) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Artifact not found" }), 404);
|
|
29110
|
+
const file = require_dist.StoredProjectSourceManifestSchema.parse(artifact.sourceManifestJson).files.find((entry) => entry.path === path);
|
|
29111
|
+
if (!file) return c.json(require_dist.ErrorResponseSchema.parse({ error: "File not found" }), 404);
|
|
29110
29112
|
const etag = `"${file.hash}"`;
|
|
29111
29113
|
const cacheControl = "private, max-age=31536000, immutable";
|
|
29112
29114
|
if (ifNoneMatchMatches(c.req.header("If-None-Match"), etag)) {
|
|
@@ -29118,9 +29120,9 @@ const handler$45 = async (c) => {
|
|
|
29118
29120
|
const storage = (0, _keystrokehq_platform_database.createOrgStorageClient)(organization);
|
|
29119
29121
|
let bytes;
|
|
29120
29122
|
try {
|
|
29121
|
-
bytes = await storage.getObject(require_dist
|
|
29123
|
+
bytes = await storage.getObject(require_dist.projectSourceBlobKey(project.id, file.hash));
|
|
29122
29124
|
} catch {
|
|
29123
|
-
return c.json(require_dist
|
|
29125
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: "File contents not found" }), 404);
|
|
29124
29126
|
}
|
|
29125
29127
|
c.header("ETag", etag);
|
|
29126
29128
|
c.header("Cache-Control", cacheControl);
|
|
@@ -29132,13 +29134,13 @@ const handler$45 = async (c) => {
|
|
|
29132
29134
|
function createProjectReachabilityHandler(hosting) {
|
|
29133
29135
|
return async (c) => {
|
|
29134
29136
|
const project = c.get("project");
|
|
29135
|
-
if (project.status !== "active") return c.json(require_dist
|
|
29137
|
+
if (project.status !== "active") return c.json(require_dist.ProjectReachabilityResponseSchema.parse({ reachable: false }));
|
|
29136
29138
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(project.organizationId);
|
|
29137
|
-
const reachable = await
|
|
29139
|
+
const reachable = await require_with_project_scope.pingProjectTarget({
|
|
29138
29140
|
baseUrl: organization?.baseUrl ?? project.baseUrl,
|
|
29139
29141
|
runtimeId: organization?.runtimeId ?? project.runtimeId
|
|
29140
29142
|
}, { plugin: hosting });
|
|
29141
|
-
return c.json(require_dist
|
|
29143
|
+
return c.json(require_dist.ProjectReachabilityResponseSchema.parse({ reachable }));
|
|
29142
29144
|
};
|
|
29143
29145
|
}
|
|
29144
29146
|
//#endregion
|
|
@@ -29147,7 +29149,7 @@ const handler$44 = async (c) => {
|
|
|
29147
29149
|
const project = c.get("project");
|
|
29148
29150
|
const currentUserId = c.get("user").id;
|
|
29149
29151
|
const members = await (0, _keystrokehq_platform_database.selectProjectMembers)(project.id);
|
|
29150
|
-
return c.json(require_dist
|
|
29152
|
+
return c.json(require_dist.ListProjectMembersResponseSchema.parse(members.map((member) => require_dist.mapProjectMember(member, { isCurrentUser: member.id === currentUserId }))));
|
|
29151
29153
|
};
|
|
29152
29154
|
//#endregion
|
|
29153
29155
|
//#region src/routes/account/projects/[projectId]/members/POST.ts
|
|
@@ -29155,15 +29157,15 @@ const handler$43 = async (c) => {
|
|
|
29155
29157
|
const organization = c.get("organization");
|
|
29156
29158
|
const project = c.get("project");
|
|
29157
29159
|
const body = await c.req.json().catch(() => null);
|
|
29158
|
-
const parsed = require_dist
|
|
29159
|
-
if (!parsed.success) return c.json(require_dist
|
|
29160
|
+
const parsed = require_dist.InviteProjectMembersRequestSchema.safeParse(body);
|
|
29161
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid invite request" }), 400);
|
|
29160
29162
|
const results = await (0, _keystrokehq_platform_database.inviteProjectMembers)({
|
|
29161
29163
|
projectId: project.id,
|
|
29162
29164
|
organizationId: organization.organizationId,
|
|
29163
29165
|
emails: parsed.data.emails,
|
|
29164
29166
|
role: parsed.data.role
|
|
29165
29167
|
});
|
|
29166
|
-
return c.json(require_dist
|
|
29168
|
+
return c.json(require_dist.InviteProjectMembersResponseSchema.parse(results));
|
|
29167
29169
|
};
|
|
29168
29170
|
//#endregion
|
|
29169
29171
|
//#region src/routes/account/projects/[projectId]/members/[userId]/PATCH.ts
|
|
@@ -29171,14 +29173,14 @@ const handler$42 = async (c) => {
|
|
|
29171
29173
|
const project = c.get("project");
|
|
29172
29174
|
const userId = c.req.param("userId");
|
|
29173
29175
|
const body = await c.req.json().catch(() => null);
|
|
29174
|
-
const parsed = require_dist
|
|
29175
|
-
if (!userId) return c.json(require_dist
|
|
29176
|
-
if (!parsed.success) return c.json(require_dist
|
|
29176
|
+
const parsed = require_dist.UpdateProjectMemberRequestSchema.safeParse(body);
|
|
29177
|
+
if (!userId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "User id is required" }), 400);
|
|
29178
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid member update request" }), 400);
|
|
29177
29179
|
try {
|
|
29178
29180
|
const member = await (0, _keystrokehq_platform_database.updateProjectMemberRole)(project.id, userId, parsed.data.role);
|
|
29179
|
-
return c.json(require_dist
|
|
29181
|
+
return c.json(require_dist.UpdateProjectMemberResponseSchema.parse(require_dist.mapProjectMember(member)));
|
|
29180
29182
|
} catch (error) {
|
|
29181
|
-
if (error instanceof _keystrokehq_platform_database.ProjectMemberNotFoundError) return c.json(require_dist
|
|
29183
|
+
if (error instanceof _keystrokehq_platform_database.ProjectMemberNotFoundError) return c.json(require_dist.ErrorResponseSchema.parse({ error: error.message }), 400);
|
|
29182
29184
|
throw error;
|
|
29183
29185
|
}
|
|
29184
29186
|
};
|
|
@@ -29187,12 +29189,12 @@ const handler$42 = async (c) => {
|
|
|
29187
29189
|
const handler$41 = async (c) => {
|
|
29188
29190
|
const project = c.get("project");
|
|
29189
29191
|
const userId = c.req.param("userId");
|
|
29190
|
-
if (!userId) return c.json(require_dist
|
|
29192
|
+
if (!userId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "User id is required" }), 400);
|
|
29191
29193
|
try {
|
|
29192
29194
|
await (0, _keystrokehq_platform_database.removeProjectMember)(project.id, userId);
|
|
29193
29195
|
return c.body(null, 204);
|
|
29194
29196
|
} catch (error) {
|
|
29195
|
-
if (error instanceof _keystrokehq_platform_database.ProjectMemberNotFoundError) return c.json(require_dist
|
|
29197
|
+
if (error instanceof _keystrokehq_platform_database.ProjectMemberNotFoundError) return c.json(require_dist.ErrorResponseSchema.parse({ error: error.message }), 400);
|
|
29196
29198
|
throw error;
|
|
29197
29199
|
}
|
|
29198
29200
|
};
|
|
@@ -29205,7 +29207,7 @@ const handler$40 = async (c) => {
|
|
|
29205
29207
|
await (0, _keystrokehq_platform_database.removeProjectMember)(project.id, userId);
|
|
29206
29208
|
return c.body(null, 204);
|
|
29207
29209
|
} catch (error) {
|
|
29208
|
-
if (error instanceof _keystrokehq_platform_database.ProjectMemberNotFoundError) return c.json(require_dist
|
|
29210
|
+
if (error instanceof _keystrokehq_platform_database.ProjectMemberNotFoundError) return c.json(require_dist.ErrorResponseSchema.parse({ error: error.message }), 400);
|
|
29209
29211
|
throw error;
|
|
29210
29212
|
}
|
|
29211
29213
|
};
|
|
@@ -29213,7 +29215,7 @@ const handler$40 = async (c) => {
|
|
|
29213
29215
|
//#region src/routes/account/projects/[projectId]/settings/GET.ts
|
|
29214
29216
|
const handler$39 = async (c) => {
|
|
29215
29217
|
const project = c.get("project");
|
|
29216
|
-
return c.json(require_dist
|
|
29218
|
+
return c.json(require_dist.ProjectSettingsResponseSchema.parse(require_dist.mapProjectSettings(project)));
|
|
29217
29219
|
};
|
|
29218
29220
|
//#endregion
|
|
29219
29221
|
//#region src/routes/account/projects/[projectId]/settings/PATCH.ts
|
|
@@ -29221,15 +29223,15 @@ const handler$38 = async (c) => {
|
|
|
29221
29223
|
const organization = c.get("organization");
|
|
29222
29224
|
const project = c.get("project");
|
|
29223
29225
|
const body = await c.req.json().catch(() => null);
|
|
29224
|
-
const parsed = require_dist
|
|
29225
|
-
if (!parsed.success) return c.json(require_dist
|
|
29226
|
+
const parsed = require_dist.UpdateProjectSettingsRequestSchema.safeParse(body);
|
|
29227
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid project settings request" }), 400);
|
|
29226
29228
|
const updated = await (0, _keystrokehq_platform_database.updateProjectSettings)(organization.organizationId, project.id, {
|
|
29227
29229
|
description: parsed.data.description,
|
|
29228
29230
|
defaultMemberRole: parsed.data.defaultRole,
|
|
29229
29231
|
invitePermission: parsed.data.invitePermission
|
|
29230
29232
|
});
|
|
29231
|
-
if (!updated) return c.json(require_dist
|
|
29232
|
-
return c.json(require_dist
|
|
29233
|
+
if (!updated) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Project not found" }), 404);
|
|
29234
|
+
return c.json(require_dist.ProjectSettingsResponseSchema.parse(require_dist.mapProjectSettings(updated)));
|
|
29233
29235
|
};
|
|
29234
29236
|
//#endregion
|
|
29235
29237
|
//#region src/routes/account/credentials/enrich.ts
|
|
@@ -29254,10 +29256,10 @@ function canManageCredential(row, userId) {
|
|
|
29254
29256
|
/** Display name derived from the app slug (org-custom slugs use the segment after `/`). */
|
|
29255
29257
|
function displayAppName(appId) {
|
|
29256
29258
|
try {
|
|
29257
|
-
const parsed = require_dist
|
|
29258
|
-
if (parsed.kind === "org") return require_dist
|
|
29259
|
+
const parsed = require_dist.parseAppSlug(appId);
|
|
29260
|
+
if (parsed.kind === "org") return require_dist.displayCredentialAppName(parsed.name);
|
|
29259
29261
|
} catch {}
|
|
29260
|
-
return require_dist
|
|
29262
|
+
return require_dist.displayCredentialAppName(appId);
|
|
29261
29263
|
}
|
|
29262
29264
|
function ownerFields(owner) {
|
|
29263
29265
|
if (!owner) return {};
|
|
@@ -29345,7 +29347,7 @@ async function enrichCredentialInstances(rows, organizationId) {
|
|
|
29345
29347
|
const handler$37 = async (c) => {
|
|
29346
29348
|
const organization = c.get("organization");
|
|
29347
29349
|
const user = c.get("user");
|
|
29348
|
-
const query = require_dist
|
|
29350
|
+
const query = require_dist.ListCredentialsPageQuerySchema.parse({
|
|
29349
29351
|
limit: c.req.query("limit") || void 0,
|
|
29350
29352
|
cursor: c.req.query("cursor")?.trim() || void 0
|
|
29351
29353
|
});
|
|
@@ -29360,7 +29362,7 @@ const handler$37 = async (c) => {
|
|
|
29360
29362
|
userId: user.id,
|
|
29361
29363
|
projectIds
|
|
29362
29364
|
})), organization.organizationId);
|
|
29363
|
-
return c.json(require_dist
|
|
29365
|
+
return c.json(require_dist.ListCredentialsPageResponseSchema.parse({
|
|
29364
29366
|
items: credentials,
|
|
29365
29367
|
nextCursor: page.nextCursor
|
|
29366
29368
|
}));
|
|
@@ -29374,7 +29376,7 @@ function withTargetScope$1(target, fn) {
|
|
|
29374
29376
|
const handler$36 = async (c) => {
|
|
29375
29377
|
const organization = c.get("organization");
|
|
29376
29378
|
const user = c.get("user");
|
|
29377
|
-
const parsed = require_dist
|
|
29379
|
+
const parsed = require_dist.CreateCredentialsRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
29378
29380
|
if (!parsed.success) {
|
|
29379
29381
|
const message = parsed.error.issues[0]?.message ?? "Invalid request body";
|
|
29380
29382
|
return c.json({ error: message }, 400);
|
|
@@ -29383,7 +29385,7 @@ const handler$36 = async (c) => {
|
|
|
29383
29385
|
if (input.connectionKind === "manual" && input.value) {
|
|
29384
29386
|
const app = await (0, _keystrokehq_platform_database.selectAppForOrganization)(organization.organizationId, input.appId);
|
|
29385
29387
|
if (app && (0, _keystrokehq_platform_database.hasCredentialFieldTemplate)(app)) {
|
|
29386
|
-
const validation = require_dist
|
|
29388
|
+
const validation = require_dist.validateCredentialValueAgainstFields(app.credentialFields, input.value);
|
|
29387
29389
|
if (!validation.ok) return c.json({ error: validation.message }, 400);
|
|
29388
29390
|
}
|
|
29389
29391
|
}
|
|
@@ -29412,7 +29414,7 @@ const handler$36 = async (c) => {
|
|
|
29412
29414
|
scopeId: user.id
|
|
29413
29415
|
}] : []
|
|
29414
29416
|
];
|
|
29415
|
-
const appName = require_dist
|
|
29417
|
+
const appName = require_dist.displayCredentialAppName(input.appId);
|
|
29416
29418
|
const siblingCounts = /* @__PURE__ */ new Map();
|
|
29417
29419
|
for (const target of targets) {
|
|
29418
29420
|
const siblings = await withTargetScope$1(target, () => (0, _keystrokehq_database.selectCredentialInstancesForScope)(input.appId, target.scopeType, target.scopeId));
|
|
@@ -29422,8 +29424,8 @@ const handler$36 = async (c) => {
|
|
|
29422
29424
|
const createdIds = [];
|
|
29423
29425
|
for (const target of targets) {
|
|
29424
29426
|
const siblings = await withTargetScope$1(target, () => (0, _keystrokehq_database.selectCredentialInstancesForScope)(input.appId, target.scopeType, target.scopeId));
|
|
29425
|
-
const label = require_dist
|
|
29426
|
-
baseLabel: input.label?.trim() || require_dist
|
|
29427
|
+
const label = require_dist.resolveUniqueCredentialInstanceLabel({
|
|
29428
|
+
baseLabel: input.label?.trim() || require_dist.buildCredentialInstanceLabel({
|
|
29427
29429
|
scopeType: target.scopeType,
|
|
29428
29430
|
appName,
|
|
29429
29431
|
projectName: target.projectName
|
|
@@ -29431,7 +29433,7 @@ const handler$36 = async (c) => {
|
|
|
29431
29433
|
takenLabels: siblings.map((row) => row.label)
|
|
29432
29434
|
});
|
|
29433
29435
|
const id = crypto.randomUUID();
|
|
29434
|
-
await withTargetScope$1(target, () => require_dist
|
|
29436
|
+
await withTargetScope$1(target, () => require_dist.setCredentialInstanceSecret({
|
|
29435
29437
|
id,
|
|
29436
29438
|
key: input.appId,
|
|
29437
29439
|
scopeType: target.scopeType,
|
|
@@ -29466,7 +29468,7 @@ const handler$36 = async (c) => {
|
|
|
29466
29468
|
...app?.authKind ? { auth_kind: app.authKind } : {}
|
|
29467
29469
|
}
|
|
29468
29470
|
}).catch(() => {});
|
|
29469
|
-
return c.json(require_dist
|
|
29471
|
+
return c.json(require_dist.CreateCredentialsResponseSchema.parse(credentials), 201);
|
|
29470
29472
|
};
|
|
29471
29473
|
//#endregion
|
|
29472
29474
|
//#region src/routes/account/credentials/access.ts
|
|
@@ -29494,7 +29496,7 @@ const handler$35 = async (c) => {
|
|
|
29494
29496
|
if (!row || toAppCredentialScope(row.scopeType) === null) return c.json({ error: "Credential not found" }, 404);
|
|
29495
29497
|
if (!await canAccessCredentialRow(c, row)) return c.json({ error: "Credential not found" }, 404);
|
|
29496
29498
|
const [credential] = await enrichCredentialInstances([row], organization.organizationId);
|
|
29497
|
-
return c.json(require_dist
|
|
29499
|
+
return c.json(require_dist.GetCredentialResponseSchema.parse(credential));
|
|
29498
29500
|
};
|
|
29499
29501
|
//#endregion
|
|
29500
29502
|
//#region src/routes/account/credentials/[credentialId]/PATCH.ts
|
|
@@ -29546,7 +29548,7 @@ function withDestinationScope(destination, fn) {
|
|
|
29546
29548
|
function sharedConnectionIdFor(row, scopeType, scopeId) {
|
|
29547
29549
|
if (row.authKind !== "oauth_managed" && row.authKind !== "keystroke") return row.sharedConnectionId;
|
|
29548
29550
|
if (!row.connectionId) return row.sharedConnectionId;
|
|
29549
|
-
return require_dist
|
|
29551
|
+
return require_dist.mcpEntityId(scopeType, scopeId);
|
|
29550
29552
|
}
|
|
29551
29553
|
const handler$34 = async (c) => {
|
|
29552
29554
|
const organization = c.get("organization");
|
|
@@ -29555,7 +29557,7 @@ const handler$34 = async (c) => {
|
|
|
29555
29557
|
const existing = credentialId ? await (0, _keystrokehq_database.selectCredentialInstanceById)(credentialId) : void 0;
|
|
29556
29558
|
if (!existing || toAppCredentialScope(existing.scopeType) === null) return c.json({ error: "Credential not found" }, 404);
|
|
29557
29559
|
if (!await canAccessCredentialRow(c, existing) || !canManageCredential(existing, user.id)) return c.json({ error: "Forbidden" }, 403);
|
|
29558
|
-
const parsed = require_dist
|
|
29560
|
+
const parsed = require_dist.UpdateCredentialRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
29559
29561
|
if (!parsed.success) {
|
|
29560
29562
|
const message = parsed.error.issues[0]?.message ?? "Invalid request body";
|
|
29561
29563
|
return c.json({ error: message }, 400);
|
|
@@ -29586,13 +29588,13 @@ const handler$34 = async (c) => {
|
|
|
29586
29588
|
let slug = existing.slug;
|
|
29587
29589
|
let name = existing.name;
|
|
29588
29590
|
if (labelChanged) {
|
|
29589
|
-
slug = require_dist
|
|
29591
|
+
slug = require_dist.deriveCredentialInstanceSlug({
|
|
29590
29592
|
appSlug: existing.appSlug,
|
|
29591
29593
|
name: label,
|
|
29592
29594
|
takenSlugs: siblings.filter((row) => row.id !== credentialId).map((row) => row.slug)
|
|
29593
29595
|
});
|
|
29594
29596
|
name = label;
|
|
29595
|
-
} else if (scopeChanged && siblings.some((row) => row.id !== credentialId && row.slug === slug)) slug = require_dist
|
|
29597
|
+
} else if (scopeChanged && siblings.some((row) => row.id !== credentialId && row.slug === slug)) slug = require_dist.deriveCredentialInstanceSlug({
|
|
29596
29598
|
appSlug: existing.appSlug,
|
|
29597
29599
|
name: label,
|
|
29598
29600
|
takenSlugs: siblings.filter((row) => row.id !== credentialId).map((row) => row.slug)
|
|
@@ -29600,7 +29602,7 @@ const handler$34 = async (c) => {
|
|
|
29600
29602
|
const sharedConnectionId = sharedConnectionIdFor(existing, scopeType, scopeId ?? "");
|
|
29601
29603
|
const persist = async () => {
|
|
29602
29604
|
if (parsed.data.value) {
|
|
29603
|
-
await require_dist
|
|
29605
|
+
await require_dist.setCredentialInstanceSecret({
|
|
29604
29606
|
id: existing.id,
|
|
29605
29607
|
key: existing.appSlug,
|
|
29606
29608
|
slug,
|
|
@@ -29641,7 +29643,7 @@ const handler$34 = async (c) => {
|
|
|
29641
29643
|
else await withCredentialRowScope(existing, persist);
|
|
29642
29644
|
const updated = await (0, _keystrokehq_database.selectCredentialInstanceById)(credentialId);
|
|
29643
29645
|
const [credential] = await enrichCredentialInstances(updated ? [updated] : [], organization.organizationId);
|
|
29644
|
-
return c.json(require_dist
|
|
29646
|
+
return c.json(require_dist.GetCredentialResponseSchema.parse(credential));
|
|
29645
29647
|
};
|
|
29646
29648
|
//#endregion
|
|
29647
29649
|
//#region src/routes/account/credentials/[credentialId]/duplicate/POST.ts
|
|
@@ -29656,7 +29658,7 @@ const handler$33 = async (c) => {
|
|
|
29656
29658
|
const source = credentialId ? await (0, _keystrokehq_database.selectCredentialInstanceById)(credentialId) : void 0;
|
|
29657
29659
|
if (!source || toAppCredentialScope(source.scopeType) === null) return c.json({ error: "Credential not found" }, 404);
|
|
29658
29660
|
if (!await canAccessCredentialRow(c, source) || !canManageCredential(source, user.id)) return c.json({ error: "Forbidden" }, 403);
|
|
29659
|
-
const parsed = require_dist
|
|
29661
|
+
const parsed = require_dist.DuplicateCredentialRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
29660
29662
|
if (!parsed.success) {
|
|
29661
29663
|
const message = parsed.error.issues[0]?.message ?? "Invalid request body";
|
|
29662
29664
|
return c.json({ error: message }, 400);
|
|
@@ -29686,7 +29688,7 @@ const handler$33 = async (c) => {
|
|
|
29686
29688
|
let apiKeyValue;
|
|
29687
29689
|
let keystrokeSecretValue;
|
|
29688
29690
|
if (source.authKind === "api_key") {
|
|
29689
|
-
const raw = await require_dist
|
|
29691
|
+
const raw = await require_dist.readCredentialInstanceSecret(source.id);
|
|
29690
29692
|
if (!raw) return c.json({ error: "Credential secret not found" }, 400);
|
|
29691
29693
|
try {
|
|
29692
29694
|
apiKeyValue = JSON.parse(raw);
|
|
@@ -29694,7 +29696,7 @@ const handler$33 = async (c) => {
|
|
|
29694
29696
|
return c.json({ error: "Credential secret is invalid" }, 400);
|
|
29695
29697
|
}
|
|
29696
29698
|
} else if (source.authKind === "keystroke") {
|
|
29697
|
-
const raw = await require_dist
|
|
29699
|
+
const raw = await require_dist.readCredentialInstanceSecret(source.id);
|
|
29698
29700
|
if (raw) try {
|
|
29699
29701
|
keystrokeSecretValue = JSON.parse(raw);
|
|
29700
29702
|
} catch {
|
|
@@ -29706,11 +29708,11 @@ const handler$33 = async (c) => {
|
|
|
29706
29708
|
const createdIds = [];
|
|
29707
29709
|
for (const target of targets) {
|
|
29708
29710
|
const siblings = await withTargetScope(target, () => (0, _keystrokehq_database.selectCredentialInstancesForScope)(source.appSlug, target.scopeType, target.scopeId));
|
|
29709
|
-
const label = require_dist
|
|
29711
|
+
const label = require_dist.resolveUniqueCredentialInstanceLabel({
|
|
29710
29712
|
baseLabel,
|
|
29711
29713
|
takenLabels: siblings.map((row) => row.label)
|
|
29712
29714
|
});
|
|
29713
|
-
const slug = require_dist
|
|
29715
|
+
const slug = require_dist.deriveCredentialInstanceSlug({
|
|
29714
29716
|
appSlug: source.appSlug,
|
|
29715
29717
|
name: label,
|
|
29716
29718
|
takenSlugs: siblings.map((row) => row.slug)
|
|
@@ -29718,7 +29720,7 @@ const handler$33 = async (c) => {
|
|
|
29718
29720
|
const id = crypto.randomUUID();
|
|
29719
29721
|
await withTargetScope(target, async () => {
|
|
29720
29722
|
if (source.authKind === "api_key") {
|
|
29721
|
-
await require_dist
|
|
29723
|
+
await require_dist.setCredentialInstanceSecret({
|
|
29722
29724
|
id,
|
|
29723
29725
|
key: source.appSlug,
|
|
29724
29726
|
slug,
|
|
@@ -29744,12 +29746,12 @@ const handler$33 = async (c) => {
|
|
|
29744
29746
|
authKind: source.authKind,
|
|
29745
29747
|
ciphertext: null,
|
|
29746
29748
|
connectionId: source.connectionId,
|
|
29747
|
-
sharedConnectionId: source.connectionId ? require_dist
|
|
29749
|
+
sharedConnectionId: source.connectionId ? require_dist.mcpEntityId(target.scopeType, target.scopeId) : source.sharedConnectionId,
|
|
29748
29750
|
grantedScopes: source.grantedScopes,
|
|
29749
29751
|
createdAt: now,
|
|
29750
29752
|
updatedAt: now
|
|
29751
29753
|
});
|
|
29752
|
-
if (source.authKind === "keystroke" && keystrokeSecretValue !== void 0) await require_dist
|
|
29754
|
+
if (source.authKind === "keystroke" && keystrokeSecretValue !== void 0) await require_dist.setCredentialInstanceSecretValue(id, keystrokeSecretValue);
|
|
29753
29755
|
});
|
|
29754
29756
|
createdIds.push(id);
|
|
29755
29757
|
}
|
|
@@ -29759,7 +29761,7 @@ const handler$33 = async (c) => {
|
|
|
29759
29761
|
if (row) rows.push(row);
|
|
29760
29762
|
}
|
|
29761
29763
|
const credentials = await enrichCredentialInstances(rows, organization.organizationId);
|
|
29762
|
-
return c.json(require_dist
|
|
29764
|
+
return c.json(require_dist.DuplicateCredentialsResponseSchema.parse(credentials), 201);
|
|
29763
29765
|
};
|
|
29764
29766
|
//#endregion
|
|
29765
29767
|
//#region src/routes/account/credentials/[credentialId]/DELETE.ts
|
|
@@ -29781,8 +29783,8 @@ function createDeleteCredentialHandler(options = {}) {
|
|
|
29781
29783
|
await options.mcp.revokeConnection((0, _keystrokehq_http.resolveMcpEntityId)(existing), existing.connectionId);
|
|
29782
29784
|
}
|
|
29783
29785
|
}
|
|
29784
|
-
await require_dist
|
|
29785
|
-
} else await require_dist
|
|
29786
|
+
await require_dist.deleteCredentialInstanceSecret(existing.id);
|
|
29787
|
+
} else await require_dist.deleteCredentialInstanceSecret(existing.id);
|
|
29786
29788
|
await (0, _keystrokehq_database.deleteCredentialInstanceById)(credentialId);
|
|
29787
29789
|
return c.body(null, 204);
|
|
29788
29790
|
};
|
|
@@ -29791,7 +29793,7 @@ function createDeleteCredentialHandler(options = {}) {
|
|
|
29791
29793
|
//#region src/routes/account/members/GET.ts
|
|
29792
29794
|
const handler$32 = async (c) => {
|
|
29793
29795
|
const { organizationId } = c.get("organization");
|
|
29794
|
-
const query = require_dist
|
|
29796
|
+
const query = require_dist.ListOrganizationMembersPageQuerySchema.parse({
|
|
29795
29797
|
limit: c.req.query("limit") || void 0,
|
|
29796
29798
|
cursor: c.req.query("cursor")?.trim() || void 0
|
|
29797
29799
|
});
|
|
@@ -29799,8 +29801,8 @@ const handler$32 = async (c) => {
|
|
|
29799
29801
|
...query.limit ? { limit: query.limit } : {},
|
|
29800
29802
|
...query.cursor ? { cursor: query.cursor } : {}
|
|
29801
29803
|
});
|
|
29802
|
-
return c.json(require_dist
|
|
29803
|
-
items: page.items.map(require_dist
|
|
29804
|
+
return c.json(require_dist.ListOrganizationMembersPageResponseSchema.parse({
|
|
29805
|
+
items: page.items.map(require_dist.mapOrganizationMember),
|
|
29804
29806
|
nextCursor: page.nextCursor
|
|
29805
29807
|
}));
|
|
29806
29808
|
};
|
|
@@ -29810,7 +29812,7 @@ function envValue(name) {
|
|
|
29810
29812
|
return process.env[name]?.trim() || void 0;
|
|
29811
29813
|
}
|
|
29812
29814
|
function resolveOrganizationInviteUrl(invitationId) {
|
|
29813
|
-
return `${(envValue("PUBLIC_WEB_URL") ?? "http://localhost:3000").replace(/\/$/, "")}${require_dist
|
|
29815
|
+
return `${(envValue("PUBLIC_WEB_URL") ?? "http://localhost:3000").replace(/\/$/, "")}${require_dist.organizationInvitationAcceptPath(invitationId)}`;
|
|
29814
29816
|
}
|
|
29815
29817
|
function resolveResendApiKey() {
|
|
29816
29818
|
return envValue("RESEND_API_KEY");
|
|
@@ -29851,8 +29853,8 @@ const handler$31 = async (c) => {
|
|
|
29851
29853
|
const user = c.get("user");
|
|
29852
29854
|
const organization = c.get("organization");
|
|
29853
29855
|
const body = await c.req.json().catch(() => null);
|
|
29854
|
-
const parsed = require_dist
|
|
29855
|
-
if (!parsed.success) return c.json(require_dist
|
|
29856
|
+
const parsed = require_dist.InviteOrganizationMembersRequestSchema.safeParse(body);
|
|
29857
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid invite request" }), 400);
|
|
29856
29858
|
const results = await (0, _keystrokehq_platform_database.inviteOrganizationMembers)({
|
|
29857
29859
|
organizationId: organization.organizationId,
|
|
29858
29860
|
invitedByUserId: user.id,
|
|
@@ -29869,7 +29871,7 @@ const handler$31 = async (c) => {
|
|
|
29869
29871
|
inviterName: inviter?.name
|
|
29870
29872
|
});
|
|
29871
29873
|
}
|
|
29872
|
-
return c.json(require_dist
|
|
29874
|
+
return c.json(require_dist.InviteOrganizationMembersResponseSchema.parse(results));
|
|
29873
29875
|
};
|
|
29874
29876
|
//#endregion
|
|
29875
29877
|
//#region src/routes/account/members/[userId]/PATCH.ts
|
|
@@ -29877,14 +29879,14 @@ const handler$30 = async (c) => {
|
|
|
29877
29879
|
const { organizationId } = c.get("organization");
|
|
29878
29880
|
const userId = c.req.param("userId");
|
|
29879
29881
|
const body = await c.req.json().catch(() => null);
|
|
29880
|
-
const parsed = require_dist
|
|
29881
|
-
if (!userId) return c.json(require_dist
|
|
29882
|
-
if (!parsed.success) return c.json(require_dist
|
|
29882
|
+
const parsed = require_dist.UpdateOrganizationMemberRequestSchema.safeParse(body);
|
|
29883
|
+
if (!userId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "User id is required" }), 400);
|
|
29884
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid member update request" }), 400);
|
|
29883
29885
|
try {
|
|
29884
29886
|
const member = await (0, _keystrokehq_platform_database.updateOrganizationMemberRole)(organizationId, userId, parsed.data.role);
|
|
29885
|
-
return c.json(require_dist
|
|
29887
|
+
return c.json(require_dist.UpdateOrganizationMemberResponseSchema.parse(require_dist.mapOrganizationMember(member)));
|
|
29886
29888
|
} catch (error) {
|
|
29887
|
-
if (error instanceof _keystrokehq_platform_database.CannotModifyOwnerError || error instanceof _keystrokehq_platform_database.OrganizationMemberNotFoundError) return c.json(require_dist
|
|
29889
|
+
if (error instanceof _keystrokehq_platform_database.CannotModifyOwnerError || error instanceof _keystrokehq_platform_database.OrganizationMemberNotFoundError) return c.json(require_dist.ErrorResponseSchema.parse({ error: error.message }), 400);
|
|
29888
29890
|
throw error;
|
|
29889
29891
|
}
|
|
29890
29892
|
};
|
|
@@ -29893,12 +29895,12 @@ const handler$30 = async (c) => {
|
|
|
29893
29895
|
const handler$29 = async (c) => {
|
|
29894
29896
|
const { organizationId } = c.get("organization");
|
|
29895
29897
|
const userId = c.req.param("userId");
|
|
29896
|
-
if (!userId) return c.json(require_dist
|
|
29898
|
+
if (!userId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "User id is required" }), 400);
|
|
29897
29899
|
try {
|
|
29898
29900
|
await (0, _keystrokehq_platform_database.removeOrganizationMember)(organizationId, userId);
|
|
29899
29901
|
return c.body(null, 204);
|
|
29900
29902
|
} catch (error) {
|
|
29901
|
-
if (error instanceof _keystrokehq_platform_database.CannotModifyOwnerError || error instanceof _keystrokehq_platform_database.OrganizationMemberNotFoundError) return c.json(require_dist
|
|
29903
|
+
if (error instanceof _keystrokehq_platform_database.CannotModifyOwnerError || error instanceof _keystrokehq_platform_database.OrganizationMemberNotFoundError) return c.json(require_dist.ErrorResponseSchema.parse({ error: error.message }), 400);
|
|
29902
29904
|
throw error;
|
|
29903
29905
|
}
|
|
29904
29906
|
};
|
|
@@ -29906,14 +29908,14 @@ const handler$29 = async (c) => {
|
|
|
29906
29908
|
//#region src/routes/account/invitations/GET.ts
|
|
29907
29909
|
const handler$28 = async (c) => {
|
|
29908
29910
|
const invitations = await (0, _keystrokehq_platform_database.selectPendingInvitationsForUser)(c.get("user").id);
|
|
29909
|
-
return c.json(require_dist
|
|
29911
|
+
return c.json(require_dist.ListOrganizationInvitationsResponseSchema.parse(invitations.map(require_dist.mapOrganizationInvitation)));
|
|
29910
29912
|
};
|
|
29911
29913
|
//#endregion
|
|
29912
29914
|
//#region src/routes/account/invitations/[invitationId]/accept/POST.ts
|
|
29913
29915
|
const handler$27 = async (c) => {
|
|
29914
29916
|
const user = c.get("user");
|
|
29915
29917
|
const invitationId = c.req.param("invitationId");
|
|
29916
|
-
if (!invitationId) return c.json(require_dist
|
|
29918
|
+
if (!invitationId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invitation id is required" }), 400);
|
|
29917
29919
|
try {
|
|
29918
29920
|
const membership = await (0, _keystrokehq_platform_database.acceptInvitation)(invitationId, user.id);
|
|
29919
29921
|
const memberCount = await (0, _keystrokehq_platform_database.countActiveMembersForOrganization)(membership.organization.id).catch(() => void 0);
|
|
@@ -29921,11 +29923,11 @@ const handler$27 = async (c) => {
|
|
|
29921
29923
|
organizationId: membership.organization.id,
|
|
29922
29924
|
properties: { member_count: memberCount }
|
|
29923
29925
|
}).catch(() => {});
|
|
29924
|
-
return c.json(require_dist
|
|
29926
|
+
return c.json(require_dist.AcceptOrganizationInvitationResponseSchema.parse(require_dist.mapUserOrganization(membership)));
|
|
29925
29927
|
} catch (error) {
|
|
29926
|
-
if (error instanceof _keystrokehq_platform_database.OrganizationInvitationNotFoundError) return c.json(require_dist
|
|
29927
|
-
if (error instanceof _keystrokehq_platform_database.OrganizationInvitationForbiddenError) return c.json(require_dist
|
|
29928
|
-
if (error instanceof _keystrokehq_platform_database.OrganizationInvitationExpiredError) return c.json(require_dist
|
|
29928
|
+
if (error instanceof _keystrokehq_platform_database.OrganizationInvitationNotFoundError) return c.json(require_dist.ErrorResponseSchema.parse({ error: error.message }), 404);
|
|
29929
|
+
if (error instanceof _keystrokehq_platform_database.OrganizationInvitationForbiddenError) return c.json(require_dist.ErrorResponseSchema.parse({ error: error.message }), 403);
|
|
29930
|
+
if (error instanceof _keystrokehq_platform_database.OrganizationInvitationExpiredError) return c.json(require_dist.ErrorResponseSchema.parse({ error: error.message }), 410);
|
|
29929
29931
|
throw error;
|
|
29930
29932
|
}
|
|
29931
29933
|
};
|
|
@@ -29934,13 +29936,13 @@ const handler$27 = async (c) => {
|
|
|
29934
29936
|
const handler$26 = async (c) => {
|
|
29935
29937
|
const user = c.get("user");
|
|
29936
29938
|
const invitationId = c.req.param("invitationId");
|
|
29937
|
-
if (!invitationId) return c.json(require_dist
|
|
29939
|
+
if (!invitationId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invitation id is required" }), 400);
|
|
29938
29940
|
try {
|
|
29939
29941
|
await (0, _keystrokehq_platform_database.declineInvitation)(invitationId, user.id);
|
|
29940
|
-
return c.json(require_dist
|
|
29942
|
+
return c.json(require_dist.DeclineOrganizationInvitationResponseSchema.parse({ success: true }));
|
|
29941
29943
|
} catch (error) {
|
|
29942
|
-
if (error instanceof _keystrokehq_platform_database.OrganizationInvitationNotFoundError) return c.json(require_dist
|
|
29943
|
-
if (error instanceof _keystrokehq_platform_database.OrganizationInvitationForbiddenError) return c.json(require_dist
|
|
29944
|
+
if (error instanceof _keystrokehq_platform_database.OrganizationInvitationNotFoundError) return c.json(require_dist.ErrorResponseSchema.parse({ error: error.message }), 404);
|
|
29945
|
+
if (error instanceof _keystrokehq_platform_database.OrganizationInvitationForbiddenError) return c.json(require_dist.ErrorResponseSchema.parse({ error: error.message }), 403);
|
|
29944
29946
|
throw error;
|
|
29945
29947
|
}
|
|
29946
29948
|
};
|
|
@@ -30021,22 +30023,22 @@ function appRowToCustomAppDetail(row) {
|
|
|
30021
30023
|
//#region src/routes/account/apps/GET.ts
|
|
30022
30024
|
const handler$25 = async (c) => {
|
|
30023
30025
|
const apps = (await (0, _keystrokehq_platform_database.listAppsForOrganization)(c.get("organization").organizationId)).map(appRowToCatalogSummary);
|
|
30024
|
-
return c.json(require_dist
|
|
30026
|
+
return c.json(require_dist.ListAppsResponseSchema.parse(apps));
|
|
30025
30027
|
};
|
|
30026
30028
|
//#endregion
|
|
30027
30029
|
//#region src/routes/account/apps/POST.ts
|
|
30028
30030
|
const handler$24 = async (c) => {
|
|
30029
30031
|
const organization = c.get("organization");
|
|
30030
30032
|
const user = c.get("user");
|
|
30031
|
-
const parsed = require_dist
|
|
30033
|
+
const parsed = require_dist.CreateCustomAppRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
30032
30034
|
if (!parsed.success) {
|
|
30033
30035
|
const message = parsed.error.issues[0]?.message ?? "Invalid request body";
|
|
30034
|
-
return c.json(require_dist
|
|
30036
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: message }), 400);
|
|
30035
30037
|
}
|
|
30036
30038
|
const org = await (0, _keystrokehq_platform_database.selectOrganizationById)(organization.organizationId);
|
|
30037
|
-
if (!org) return c.json(require_dist
|
|
30039
|
+
if (!org) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
30038
30040
|
const authKind = parsed.data.authKind ?? (parsed.data.source === "custom" ? "api_key" : void 0);
|
|
30039
|
-
if (!authKind) return c.json(require_dist
|
|
30041
|
+
if (!authKind) return c.json(require_dist.ErrorResponseSchema.parse({ error: "authKind is required" }), 400);
|
|
30040
30042
|
try {
|
|
30041
30043
|
const row = await (0, _keystrokehq_platform_database.createOrgApp)({
|
|
30042
30044
|
organizationId: organization.organizationId,
|
|
@@ -30062,41 +30064,41 @@ const handler$24 = async (c) => {
|
|
|
30062
30064
|
auth_kind: row.authKind
|
|
30063
30065
|
}
|
|
30064
30066
|
}).catch(() => {});
|
|
30065
|
-
return c.json(require_dist
|
|
30067
|
+
return c.json(require_dist.CreateCustomAppResponseSchema.parse(appRowToCustomAppDetail(row)), 201);
|
|
30066
30068
|
} catch (error) {
|
|
30067
|
-
if (error instanceof _keystrokehq_platform_database.OrgAppSlugTakenError) return c.json(require_dist
|
|
30069
|
+
if (error instanceof _keystrokehq_platform_database.OrgAppSlugTakenError) return c.json(require_dist.ErrorResponseSchema.parse({ error: error.message }), 409);
|
|
30068
30070
|
throw error;
|
|
30069
30071
|
}
|
|
30070
30072
|
};
|
|
30071
30073
|
//#endregion
|
|
30072
30074
|
//#region src/routes/account/apps/logo/POST.ts
|
|
30073
30075
|
const handler$23 = async (c) => {
|
|
30074
|
-
const parsed = require_dist
|
|
30075
|
-
if (!parsed.success) return c.json(require_dist
|
|
30076
|
+
const parsed = require_dist.FinalizeCustomAppLogoRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
30077
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid logo finalize request" }), 400);
|
|
30076
30078
|
const { organizationId } = c.get("organization");
|
|
30077
30079
|
const finalized = await finalizeStoredImageUpload({
|
|
30078
|
-
storage: require_dist
|
|
30080
|
+
storage: require_dist.createAssetsStorageClient(),
|
|
30079
30081
|
storageKey: parsed.data.storageKey,
|
|
30080
|
-
isValidStorageKey: (key) => require_dist
|
|
30081
|
-
buildPublicUrl: require_dist
|
|
30082
|
+
isValidStorageKey: (key) => require_dist.isAppLogoStorageKey(key, organizationId),
|
|
30083
|
+
buildPublicUrl: require_dist.publicKeystrokeAssetsObjectUrl
|
|
30082
30084
|
});
|
|
30083
|
-
if (!finalized.ok) return c.json(require_dist
|
|
30084
|
-
return c.json(require_dist
|
|
30085
|
+
if (!finalized.ok) return c.json(require_dist.ErrorResponseSchema.parse({ error: finalized.error }), 400);
|
|
30086
|
+
return c.json(require_dist.FinalizeCustomAppLogoResponseSchema.parse({ logo: finalized.publicUrl }));
|
|
30085
30087
|
};
|
|
30086
30088
|
//#endregion
|
|
30087
30089
|
//#region src/routes/account/apps/logo/presign/POST.ts
|
|
30088
30090
|
const handler$22 = async (c) => {
|
|
30089
|
-
const parsed = require_dist
|
|
30090
|
-
if (!parsed.success) return c.json(require_dist
|
|
30091
|
+
const parsed = require_dist.PresignCustomAppLogoRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
30092
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid logo upload request" }), 400);
|
|
30091
30093
|
const extension = avatarExtensionForContentType(parsed.data.contentType);
|
|
30092
|
-
if (!extension) return c.json(require_dist
|
|
30094
|
+
if (!extension) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Unsupported image type" }), 400);
|
|
30093
30095
|
const { organizationId } = c.get("organization");
|
|
30094
|
-
const storageKey = require_dist
|
|
30095
|
-
const uploadUrl = await require_dist
|
|
30096
|
+
const storageKey = require_dist.appLogoStorageKey(organizationId, crypto.randomUUID(), extension);
|
|
30097
|
+
const uploadUrl = await require_dist.createAssetsStorageClient().presignPut({
|
|
30096
30098
|
key: storageKey,
|
|
30097
30099
|
contentType: parsed.data.contentType
|
|
30098
30100
|
});
|
|
30099
|
-
return c.json(require_dist
|
|
30101
|
+
return c.json(require_dist.PresignCustomAppLogoResponseSchema.parse({
|
|
30100
30102
|
uploadUrl,
|
|
30101
30103
|
storageKey
|
|
30102
30104
|
}));
|
|
@@ -30104,13 +30106,13 @@ const handler$22 = async (c) => {
|
|
|
30104
30106
|
//#endregion
|
|
30105
30107
|
//#region src/routes/account/apps/discover/POST.ts
|
|
30106
30108
|
const handler$21 = async (c) => {
|
|
30107
|
-
const parsed = require_dist
|
|
30109
|
+
const parsed = require_dist.McpDiscoverRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
30108
30110
|
if (!parsed.success) return c.json({ error: "Invalid request body" }, 400);
|
|
30109
30111
|
try {
|
|
30110
|
-
const result = await require_dist
|
|
30111
|
-
return c.json(require_dist
|
|
30112
|
+
const result = await require_dist.discoverMcpApp(parsed.data.url);
|
|
30113
|
+
return c.json(require_dist.McpDiscoverResponseSchema.parse(result));
|
|
30112
30114
|
} catch (error) {
|
|
30113
|
-
if (error instanceof require_dist
|
|
30115
|
+
if (error instanceof require_dist.PublicHttpUrlError) return c.json({ error: error.message }, 400);
|
|
30114
30116
|
const message = error instanceof Error ? error.message : "Failed to discover MCP server";
|
|
30115
30117
|
return c.json({ error: message }, 502);
|
|
30116
30118
|
}
|
|
@@ -30118,13 +30120,13 @@ const handler$21 = async (c) => {
|
|
|
30118
30120
|
//#endregion
|
|
30119
30121
|
//#region src/routes/account/apps/discover-openapi/POST.ts
|
|
30120
30122
|
const handler$20 = async (c) => {
|
|
30121
|
-
const parsed = require_dist
|
|
30123
|
+
const parsed = require_dist.OpenApiDiscoverRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
30122
30124
|
if (!parsed.success) return c.json({ error: "Invalid request body" }, 400);
|
|
30123
30125
|
try {
|
|
30124
|
-
const result = await require_dist
|
|
30125
|
-
return c.json(require_dist
|
|
30126
|
+
const result = await require_dist.discoverOpenApiApp(parsed.data.url);
|
|
30127
|
+
return c.json(require_dist.OpenApiDiscoverResponseSchema.parse(result));
|
|
30126
30128
|
} catch (error) {
|
|
30127
|
-
if (require_dist
|
|
30129
|
+
if (require_dist.isDiscoveryError(error)) return c.json({
|
|
30128
30130
|
error: error.message,
|
|
30129
30131
|
code: error.code
|
|
30130
30132
|
}, error.status);
|
|
@@ -30135,13 +30137,13 @@ const handler$20 = async (c) => {
|
|
|
30135
30137
|
//#endregion
|
|
30136
30138
|
//#region src/routes/account/apps/discover-graphql/POST.ts
|
|
30137
30139
|
const handler$19 = async (c) => {
|
|
30138
|
-
const parsed = require_dist
|
|
30140
|
+
const parsed = require_dist.GraphqlDiscoverRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
30139
30141
|
if (!parsed.success) return c.json({ error: "Invalid request body" }, 400);
|
|
30140
30142
|
try {
|
|
30141
|
-
const result = await require_dist
|
|
30142
|
-
return c.json(require_dist
|
|
30143
|
+
const result = await require_dist.discoverGraphqlApp(parsed.data.url);
|
|
30144
|
+
return c.json(require_dist.GraphqlDiscoverResponseSchema.parse(result));
|
|
30143
30145
|
} catch (error) {
|
|
30144
|
-
if (require_dist
|
|
30146
|
+
if (require_dist.isDiscoveryError(error)) return c.json({
|
|
30145
30147
|
error: error.message,
|
|
30146
30148
|
code: error.code
|
|
30147
30149
|
}, error.status);
|
|
@@ -30171,7 +30173,7 @@ const handler$18 = async (c) => {
|
|
|
30171
30173
|
const user = c.get("user");
|
|
30172
30174
|
const appSlug = c.req.param("slug")?.trim();
|
|
30173
30175
|
if (!appSlug) return c.json({ error: "App slug is required" }, 400);
|
|
30174
|
-
const parsed = require_dist
|
|
30176
|
+
const parsed = require_dist.StartMcpOAuthConnectionInputSchema.safeParse({
|
|
30175
30177
|
...await c.req.json().catch(() => ({})),
|
|
30176
30178
|
appSlug
|
|
30177
30179
|
});
|
|
@@ -30190,7 +30192,7 @@ const handler$18 = async (c) => {
|
|
|
30190
30192
|
projectNamesById[project.id] = project.name;
|
|
30191
30193
|
}
|
|
30192
30194
|
try {
|
|
30193
|
-
const result = await require_dist
|
|
30195
|
+
const result = await require_dist.beginMcpOAuthConnect({
|
|
30194
30196
|
app,
|
|
30195
30197
|
input: parsed.data,
|
|
30196
30198
|
organizationId: organization.organizationId,
|
|
@@ -30205,10 +30207,10 @@ const handler$18 = async (c) => {
|
|
|
30205
30207
|
},
|
|
30206
30208
|
projectNamesById
|
|
30207
30209
|
});
|
|
30208
|
-
return c.json(require_dist
|
|
30210
|
+
return c.json(require_dist.StartMcpOAuthConnectionResultSchema.parse(result));
|
|
30209
30211
|
} catch (error) {
|
|
30210
|
-
const message = error instanceof require_dist
|
|
30211
|
-
const failurePhase = error instanceof require_dist
|
|
30212
|
+
const message = error instanceof require_dist.McpOAuthConnectError ? error.message : "Failed to start MCP OAuth connection";
|
|
30213
|
+
const failurePhase = error instanceof require_dist.McpOAuthConnectError ? error.phase : "authorization_start";
|
|
30212
30214
|
log.error("mcp.oauth.connect.failed", {
|
|
30213
30215
|
app_slug: appSlug,
|
|
30214
30216
|
...app.url && sanitizedUrl(app.url) ? { app_url: sanitizedUrl(app.url) } : {},
|
|
@@ -30217,7 +30219,7 @@ const handler$18 = async (c) => {
|
|
|
30217
30219
|
error_name: error instanceof Error ? error.name : "UnknownError",
|
|
30218
30220
|
error_message: message,
|
|
30219
30221
|
failure_phase: failurePhase,
|
|
30220
|
-
...error instanceof require_dist
|
|
30222
|
+
...error instanceof require_dist.McpOAuthConnectError ? {
|
|
30221
30223
|
...error.diagnostics.correlationId ? { correlation_id: error.diagnostics.correlationId } : {},
|
|
30222
30224
|
...error.diagnostics.authorizationServerUrl ? { authorization_server_url: sanitizedUrl(error.diagnostics.authorizationServerUrl) } : {},
|
|
30223
30225
|
...error.diagnostics.registrationEndpoint ? { registration_endpoint: sanitizedUrl(error.diagnostics.registrationEndpoint) } : {},
|
|
@@ -30268,7 +30270,7 @@ const handler$17 = async (c) => {
|
|
|
30268
30270
|
if (!state) return c.json({ error: "Missing or invalid OAuth state" }, 400);
|
|
30269
30271
|
let payload;
|
|
30270
30272
|
try {
|
|
30271
|
-
payload = await require_dist
|
|
30273
|
+
payload = await require_dist.decodeOAuthState(state);
|
|
30272
30274
|
} catch (error) {
|
|
30273
30275
|
log.error("mcp.oauth.connect.failed", {
|
|
30274
30276
|
failure_phase: "authorization_callback",
|
|
@@ -30312,12 +30314,12 @@ const handler$17 = async (c) => {
|
|
|
30312
30314
|
let appSlug = "mcp";
|
|
30313
30315
|
let callbackPayload;
|
|
30314
30316
|
try {
|
|
30315
|
-
const payload = await require_dist
|
|
30317
|
+
const payload = await require_dist.decodeOAuthState(state);
|
|
30316
30318
|
callbackPayload = payload;
|
|
30317
30319
|
appSlug = payload.appSlug;
|
|
30318
30320
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(payload.organizationId);
|
|
30319
30321
|
if (!organization) return c.json({ error: "Organization not found" }, 404);
|
|
30320
|
-
const result = await (0, _keystrokehq_platform_database.runWithOrganizationScope)(organization.id, () => (0, _keystrokehq_database.runWithProjectDatabase)((0, _keystrokehq_platform_database.resolveOrgProjectDatabaseOptions)(organization), () => (0, _keystrokehq_database.runWithTenantScope)(organization.id, () => require_dist
|
|
30322
|
+
const result = await (0, _keystrokehq_platform_database.runWithOrganizationScope)(organization.id, () => (0, _keystrokehq_database.runWithProjectDatabase)((0, _keystrokehq_platform_database.resolveOrgProjectDatabaseOptions)(organization), () => (0, _keystrokehq_database.runWithTenantScope)(organization.id, () => require_dist.completeMcpOAuthConnect({
|
|
30321
30323
|
payload,
|
|
30322
30324
|
code
|
|
30323
30325
|
}))));
|
|
@@ -30351,8 +30353,8 @@ const handler$17 = async (c) => {
|
|
|
30351
30353
|
app: result.appSlug
|
|
30352
30354
|
});
|
|
30353
30355
|
} catch (error) {
|
|
30354
|
-
const failurePhase = error instanceof require_dist
|
|
30355
|
-
const message = error instanceof require_dist
|
|
30356
|
+
const failurePhase = error instanceof require_dist.McpOAuthConnectError ? error.phase : "authorization_callback";
|
|
30357
|
+
const message = error instanceof require_dist.McpOAuthConnectError ? error.message : "OAuth connection failed";
|
|
30356
30358
|
log.error("mcp.oauth.connect.failed", {
|
|
30357
30359
|
...callbackPayload ? {
|
|
30358
30360
|
app_slug: callbackPayload.appSlug,
|
|
@@ -30363,7 +30365,7 @@ const handler$17 = async (c) => {
|
|
|
30363
30365
|
failure_phase: failurePhase,
|
|
30364
30366
|
error_name: error instanceof Error ? error.name : "UnknownError",
|
|
30365
30367
|
error_message: message,
|
|
30366
|
-
...error instanceof require_dist
|
|
30368
|
+
...error instanceof require_dist.McpOAuthConnectError ? {
|
|
30367
30369
|
...error.diagnostics.authorizationServerUrl ? { authorization_server_url: sanitizedUrl(error.diagnostics.authorizationServerUrl) } : {},
|
|
30368
30370
|
...error.diagnostics.providerHttpStatus ? { provider_http_status: error.diagnostics.providerHttpStatus } : {},
|
|
30369
30371
|
...error.diagnostics.oauthError ? { oauth_error: error.diagnostics.oauthError } : {}
|
|
@@ -30395,25 +30397,25 @@ const handler$17 = async (c) => {
|
|
|
30395
30397
|
//#region src/routes/account/apps/slug-available/GET.ts
|
|
30396
30398
|
const handler$16 = async (c) => {
|
|
30397
30399
|
const organization = c.get("organization");
|
|
30398
|
-
const parsed = require_dist
|
|
30399
|
-
if (!parsed.success) return c.json(require_dist
|
|
30400
|
+
const parsed = require_dist.AppSlugAvailabilityQuerySchema.safeParse({ slug: c.req.query("slug") });
|
|
30401
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid slug query" }), 400);
|
|
30400
30402
|
const org = await (0, _keystrokehq_platform_database.selectOrganizationById)(organization.organizationId);
|
|
30401
|
-
if (!org) return c.json(require_dist
|
|
30403
|
+
if (!org) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
30402
30404
|
const availability = await (0, _keystrokehq_platform_database.checkOrgAppSlugAvailability)(org.slug, parsed.data.slug);
|
|
30403
|
-
return c.json(require_dist
|
|
30405
|
+
return c.json(require_dist.AppSlugAvailabilityResponseSchema.parse(availability));
|
|
30404
30406
|
};
|
|
30405
30407
|
//#endregion
|
|
30406
30408
|
//#region src/routes/account/apps/[slug]/GET.ts
|
|
30407
30409
|
const handler$15 = async (c) => {
|
|
30408
30410
|
const organization = c.get("organization");
|
|
30409
30411
|
const slug = c.req.param("slug") ?? "";
|
|
30410
|
-
if (!slug) return c.json(require_dist
|
|
30412
|
+
if (!slug) return c.json(require_dist.ErrorResponseSchema.parse({ error: "App not found" }), 404);
|
|
30411
30413
|
const row = await (0, _keystrokehq_platform_database.selectAppForOrganization)(organization.organizationId, decodeURIComponent(slug));
|
|
30412
|
-
if (!row || row.source !== "custom") return c.json(require_dist
|
|
30414
|
+
if (!row || row.source !== "custom") return c.json(require_dist.ErrorResponseSchema.parse({ error: "App not found" }), 404);
|
|
30413
30415
|
try {
|
|
30414
|
-
return c.json(require_dist
|
|
30416
|
+
return c.json(require_dist.GetCustomAppResponseSchema.parse(appRowToCustomAppDetail(row)));
|
|
30415
30417
|
} catch {
|
|
30416
|
-
return c.json(require_dist
|
|
30418
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: "App not found" }), 404);
|
|
30417
30419
|
}
|
|
30418
30420
|
};
|
|
30419
30421
|
//#endregion
|
|
@@ -30422,10 +30424,10 @@ const handler$15 = async (c) => {
|
|
|
30422
30424
|
const handler$14 = async (c) => {
|
|
30423
30425
|
const organization = c.get("organization");
|
|
30424
30426
|
const slug = c.req.param("slug") ?? "";
|
|
30425
|
-
if (!slug) return c.json(require_dist
|
|
30427
|
+
if (!slug) return c.json(require_dist.ErrorResponseSchema.parse({ error: "App not found" }), 404);
|
|
30426
30428
|
const row = await (0, _keystrokehq_platform_database.selectAppForOrganization)(organization.organizationId, decodeURIComponent(slug));
|
|
30427
|
-
if (!row) return c.json(require_dist
|
|
30428
|
-
return c.json(require_dist
|
|
30429
|
+
if (!row) return c.json(require_dist.ErrorResponseSchema.parse({ error: "App not found" }), 404);
|
|
30430
|
+
return c.json(require_dist.GetAppCatalogEntryResponseSchema.parse(appRowToCatalogEntry(row)));
|
|
30429
30431
|
};
|
|
30430
30432
|
//#endregion
|
|
30431
30433
|
//#region src/routes/account/channel-platforms/GET.ts
|
|
@@ -30433,7 +30435,7 @@ const PLATFORM_FALLBACK_DOMAINS = { slack: "slack.com" };
|
|
|
30433
30435
|
function projectChannelPlatform(row) {
|
|
30434
30436
|
const gateway = GATEWAY_BY_APP_SLUG[row.slug];
|
|
30435
30437
|
if (!gateway) throw new Error(`App ${row.slug} does not support gateway bindings`);
|
|
30436
|
-
return require_dist
|
|
30438
|
+
return require_dist.ChannelPlatformSchema.parse({
|
|
30437
30439
|
key: row.slug,
|
|
30438
30440
|
name: row.name,
|
|
30439
30441
|
appLogoId: row.slug,
|
|
@@ -30455,7 +30457,7 @@ function projectChannelPlatform(row) {
|
|
|
30455
30457
|
const handler$13 = async (c) => {
|
|
30456
30458
|
const organization = c.get("organization");
|
|
30457
30459
|
const platforms = (await Promise.all(Object.keys(GATEWAY_BY_APP_SLUG).map((slug) => (0, _keystrokehq_platform_database.selectAppForOrganization)(organization.organizationId, slug)))).flatMap((row) => row ? [projectChannelPlatform(row)] : []);
|
|
30458
|
-
return c.json(require_dist
|
|
30460
|
+
return c.json(require_dist.ListChannelPlatformsResponseSchema.parse(platforms));
|
|
30459
30461
|
};
|
|
30460
30462
|
//#endregion
|
|
30461
30463
|
//#region src/routes/account/api-keys/GET.ts
|
|
@@ -30465,7 +30467,7 @@ const handler$12 = async (c) => {
|
|
|
30465
30467
|
const records = apiKeyListScope(accessContext(c)).kind === "all" ? await (0, _keystrokehq_platform_database.listOrgPlatformApiKeysForOrganization)(organizationId) : await (0, _keystrokehq_platform_database.listOrgPlatformApiKeysForUser)(organizationId, user.id);
|
|
30466
30468
|
const creators = await (0, _keystrokehq_platform_database.selectUsersByIds)([...new Set(records.map((record) => record.createdByUserId))]);
|
|
30467
30469
|
const creatorsById = new Map(creators.map((creator) => [creator.id, creator]));
|
|
30468
|
-
return c.json(require_dist
|
|
30470
|
+
return c.json(require_dist.ListApiKeysResponseSchema.parse(records.map((record) => ({
|
|
30469
30471
|
id: record.id,
|
|
30470
30472
|
name: record.name,
|
|
30471
30473
|
keyPreview: record.keyPreview,
|
|
@@ -30479,7 +30481,7 @@ const handler$12 = async (c) => {
|
|
|
30479
30481
|
const handler$11 = async (c) => {
|
|
30480
30482
|
const { organizationId } = c.get("organization");
|
|
30481
30483
|
const user = c.get("user");
|
|
30482
|
-
const body = require_dist
|
|
30484
|
+
const body = require_dist.CreateApiKeyRequestSchema.parse(await c.req.json());
|
|
30483
30485
|
const created = await (0, _keystrokehq_platform_database.createOrgPlatformApiKey)({
|
|
30484
30486
|
organizationId,
|
|
30485
30487
|
userId: user.id,
|
|
@@ -30487,7 +30489,7 @@ const handler$11 = async (c) => {
|
|
|
30487
30489
|
});
|
|
30488
30490
|
const creator = await (0, _keystrokehq_platform_database.loadOrgPlatformApiKeyUser)(user.id);
|
|
30489
30491
|
if (!creator) return c.json({ error: "User not found" }, 404);
|
|
30490
|
-
return c.json(require_dist
|
|
30492
|
+
return c.json(require_dist.CreateApiKeyResponseSchema.parse({
|
|
30491
30493
|
id: created.id,
|
|
30492
30494
|
name: created.name,
|
|
30493
30495
|
keyPreview: created.keyPreview,
|
|
@@ -30503,13 +30505,13 @@ const handler$10 = async (c) => {
|
|
|
30503
30505
|
const { organizationId } = c.get("organization");
|
|
30504
30506
|
const user = c.get("user");
|
|
30505
30507
|
const apiKeyId = c.req.param("apiKeyId");
|
|
30506
|
-
if (!apiKeyId) return c.json(require_dist
|
|
30508
|
+
if (!apiKeyId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "API key id is required" }), 400);
|
|
30507
30509
|
const apiKey = await (0, _keystrokehq_platform_database.selectOrgPlatformApiKeyForOrganization)(apiKeyId, organizationId);
|
|
30508
|
-
if (!apiKey) return c.json(require_dist
|
|
30510
|
+
if (!apiKey) return c.json(require_dist.ErrorResponseSchema.parse({ error: "API key not found" }), 404);
|
|
30509
30511
|
if (!canReadApiKey(accessContext(c), {
|
|
30510
30512
|
userId: user.id,
|
|
30511
30513
|
createdByUserId: apiKey.createdByUserId
|
|
30512
|
-
})) return c.json(require_dist
|
|
30514
|
+
})) return c.json(require_dist.ErrorResponseSchema.parse({ error: "API key not found" }), 404);
|
|
30513
30515
|
if (!canRevokeApiKey(accessContext(c), {
|
|
30514
30516
|
userId: user.id,
|
|
30515
30517
|
createdByUserId: apiKey.createdByUserId
|
|
@@ -30518,7 +30520,7 @@ const handler$10 = async (c) => {
|
|
|
30518
30520
|
await (0, _keystrokehq_platform_database.revokeOrgPlatformApiKey)(apiKeyId, organizationId);
|
|
30519
30521
|
return c.body(null, 204);
|
|
30520
30522
|
} catch (error) {
|
|
30521
|
-
if (error instanceof _keystrokehq_platform_database.OrgPlatformApiKeyNotFoundError) return c.json(require_dist
|
|
30523
|
+
if (error instanceof _keystrokehq_platform_database.OrgPlatformApiKeyNotFoundError) return c.json(require_dist.ErrorResponseSchema.parse({ error: error.message }), 404);
|
|
30522
30524
|
throw error;
|
|
30523
30525
|
}
|
|
30524
30526
|
};
|
|
@@ -30530,14 +30532,14 @@ const handler$9 = async (c) => {
|
|
|
30530
30532
|
const kindParam = c.req.query("kind");
|
|
30531
30533
|
let kind;
|
|
30532
30534
|
if (kindParam) {
|
|
30533
|
-
const kindParsed = require_dist
|
|
30534
|
-
if (!kindParsed.success) return c.json(require_dist
|
|
30535
|
+
const kindParsed = require_dist.ManagedServiceKindSchema.safeParse(kindParam);
|
|
30536
|
+
if (!kindParsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: kindParsed.error.issues[0]?.message ?? "Invalid kind" }), 400);
|
|
30535
30537
|
kind = kindParsed.data;
|
|
30536
30538
|
}
|
|
30537
30539
|
const records = await (0, _keystrokehq_platform_database.listManagedServiceCredentialsForOrganization)(organizationId, kind);
|
|
30538
30540
|
const creators = await (0, _keystrokehq_platform_database.selectUsersByIds)([...new Set(records.map((record) => record.createdByUserId))]);
|
|
30539
30541
|
const creatorsById = new Map(creators.map((creator) => [creator.id, creator]));
|
|
30540
|
-
return c.json(require_dist
|
|
30542
|
+
return c.json(require_dist.ListManagedServiceCredentialsResponseSchema.parse(records.map((record) => ({
|
|
30541
30543
|
id: record.id,
|
|
30542
30544
|
kind: record.kind,
|
|
30543
30545
|
provider: record.provider,
|
|
@@ -30557,14 +30559,14 @@ const handler$8 = async (c) => {
|
|
|
30557
30559
|
try {
|
|
30558
30560
|
raw = await c.req.json();
|
|
30559
30561
|
} catch {
|
|
30560
|
-
return c.json(require_dist
|
|
30562
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid JSON body" }), 400);
|
|
30561
30563
|
}
|
|
30562
|
-
const parsed = require_dist
|
|
30563
|
-
if (!parsed.success) return c.json(require_dist
|
|
30564
|
+
const parsed = require_dist.ConnectManagedServiceCredentialRequestSchema.safeParse(raw);
|
|
30565
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: parsed.error.issues[0]?.message ?? "Invalid request body" }), 400);
|
|
30564
30566
|
const body = parsed.data;
|
|
30565
|
-
if (body.kind === "llm" && !require_dist
|
|
30566
|
-
if (await (0, _keystrokehq_platform_database.getManagedServiceCredential)(organizationId, body.kind, body.provider)) return c.json(require_dist
|
|
30567
|
-
const { id } = await require_dist
|
|
30567
|
+
if (body.kind === "llm" && !require_dist.isLlmProviderSlug(body.provider)) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Unsupported LLM provider" }), 400);
|
|
30568
|
+
if (await (0, _keystrokehq_platform_database.getManagedServiceCredential)(organizationId, body.kind, body.provider)) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Managed service credential already connected" }), 409);
|
|
30569
|
+
const { id } = await require_dist.setManagedServiceCredential({
|
|
30568
30570
|
organizationId,
|
|
30569
30571
|
kind: body.kind,
|
|
30570
30572
|
provider: body.provider,
|
|
@@ -30573,8 +30575,8 @@ const handler$8 = async (c) => {
|
|
|
30573
30575
|
});
|
|
30574
30576
|
const row = await (0, _keystrokehq_platform_database.getManagedServiceCredential)(organizationId, body.kind, body.provider);
|
|
30575
30577
|
const creator = await (0, _keystrokehq_platform_database.loadOrgPlatformApiKeyUser)(user.id);
|
|
30576
|
-
if (!row || !creator) return c.json(require_dist
|
|
30577
|
-
return c.json(require_dist
|
|
30578
|
+
if (!row || !creator) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Failed to connect managed service" }), 500);
|
|
30579
|
+
return c.json(require_dist.ManagedServiceCredentialSchema.parse({
|
|
30578
30580
|
id,
|
|
30579
30581
|
kind: row.kind,
|
|
30580
30582
|
provider: row.provider,
|
|
@@ -30591,19 +30593,19 @@ const handler$7 = async (c) => {
|
|
|
30591
30593
|
const { organizationId } = c.get("organization");
|
|
30592
30594
|
const user = c.get("user");
|
|
30593
30595
|
const credentialId = c.req.param("id");
|
|
30594
|
-
if (!credentialId) return c.json(require_dist
|
|
30596
|
+
if (!credentialId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Credential id is required" }), 400);
|
|
30595
30597
|
let raw;
|
|
30596
30598
|
try {
|
|
30597
30599
|
raw = await c.req.json();
|
|
30598
30600
|
} catch {
|
|
30599
|
-
return c.json(require_dist
|
|
30601
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid JSON body" }), 400);
|
|
30600
30602
|
}
|
|
30601
|
-
const parsed = require_dist
|
|
30602
|
-
if (!parsed.success) return c.json(require_dist
|
|
30603
|
+
const parsed = require_dist.UpdateManagedServiceCredentialRequestSchema.safeParse(raw);
|
|
30604
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: parsed.error.issues[0]?.message ?? "Invalid request body" }), 400);
|
|
30603
30605
|
const body = parsed.data;
|
|
30604
30606
|
const existing = await (0, _keystrokehq_platform_database.selectManagedServiceCredentialById)(credentialId);
|
|
30605
|
-
if (!existing || existing.organizationId !== organizationId) return c.json(require_dist
|
|
30606
|
-
await require_dist
|
|
30607
|
+
if (!existing || existing.organizationId !== organizationId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Managed service credential not found" }), 404);
|
|
30608
|
+
await require_dist.setManagedServiceCredential({
|
|
30607
30609
|
organizationId,
|
|
30608
30610
|
kind: existing.kind,
|
|
30609
30611
|
provider: existing.provider,
|
|
@@ -30612,8 +30614,8 @@ const handler$7 = async (c) => {
|
|
|
30612
30614
|
});
|
|
30613
30615
|
const row = await (0, _keystrokehq_platform_database.selectManagedServiceCredentialById)(credentialId);
|
|
30614
30616
|
const creator = await (0, _keystrokehq_platform_database.loadOrgPlatformApiKeyUser)(existing.createdByUserId);
|
|
30615
|
-
if (!row || !creator) return c.json(require_dist
|
|
30616
|
-
return c.json(require_dist
|
|
30617
|
+
if (!row || !creator) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Failed to update managed service" }), 500);
|
|
30618
|
+
return c.json(require_dist.ManagedServiceCredentialSchema.parse({
|
|
30617
30619
|
id: row.id,
|
|
30618
30620
|
kind: row.kind,
|
|
30619
30621
|
provider: row.provider,
|
|
@@ -30629,10 +30631,10 @@ const handler$7 = async (c) => {
|
|
|
30629
30631
|
const handler$6 = async (c) => {
|
|
30630
30632
|
const { organizationId } = c.get("organization");
|
|
30631
30633
|
const credentialId = c.req.param("id");
|
|
30632
|
-
if (!credentialId) return c.json(require_dist
|
|
30634
|
+
if (!credentialId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Credential id is required" }), 400);
|
|
30633
30635
|
const existing = await (0, _keystrokehq_platform_database.selectManagedServiceCredentialById)(credentialId);
|
|
30634
|
-
if (!existing || existing.organizationId !== organizationId) return c.json(require_dist
|
|
30635
|
-
await require_dist
|
|
30636
|
+
if (!existing || existing.organizationId !== organizationId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Managed service credential not found" }), 404);
|
|
30637
|
+
await require_dist.deleteManagedServiceCredential(credentialId);
|
|
30636
30638
|
return c.body(null, 204);
|
|
30637
30639
|
};
|
|
30638
30640
|
//#endregion
|
|
@@ -30754,7 +30756,7 @@ async function postTeamRequestToSlack(input) {
|
|
|
30754
30756
|
const handler$5 = async (c) => {
|
|
30755
30757
|
const user = c.get("user");
|
|
30756
30758
|
const organizationContext = c.get("organization");
|
|
30757
|
-
const parsed = require_dist
|
|
30759
|
+
const parsed = require_dist.SubmitTeamRequestRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
30758
30760
|
if (!parsed.success) {
|
|
30759
30761
|
const message = parsed.error.issues[0]?.message ?? "Invalid request body";
|
|
30760
30762
|
return c.json({ error: message }, 400);
|
|
@@ -30790,7 +30792,7 @@ const handler$5 = async (c) => {
|
|
|
30790
30792
|
...parsed.data.appSlug ? { app_slug: parsed.data.appSlug } : {}
|
|
30791
30793
|
}
|
|
30792
30794
|
}).catch(() => {});
|
|
30793
|
-
return c.json(require_dist
|
|
30795
|
+
return c.json(require_dist.SubmitTeamRequestResponseSchema.parse({ ok: true }), 200);
|
|
30794
30796
|
};
|
|
30795
30797
|
//#endregion
|
|
30796
30798
|
//#region src/lib/agent-feedback-slack.ts
|
|
@@ -30834,7 +30836,7 @@ async function postAgentFeedbackToSlack(input) {
|
|
|
30834
30836
|
const handler$4 = async (c) => {
|
|
30835
30837
|
const user = c.get("user");
|
|
30836
30838
|
const organizationContext = c.get("organization");
|
|
30837
|
-
const parsed = require_dist
|
|
30839
|
+
const parsed = require_dist.SubmitAgentFeedbackRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
30838
30840
|
if (!parsed.success) {
|
|
30839
30841
|
const message = parsed.error.issues[0]?.message ?? "Invalid request body";
|
|
30840
30842
|
return c.json({ error: message }, 400);
|
|
@@ -30870,7 +30872,7 @@ const handler$4 = async (c) => {
|
|
|
30870
30872
|
message_length: parsed.data.message.length
|
|
30871
30873
|
}
|
|
30872
30874
|
}).catch(() => {});
|
|
30873
|
-
return c.json(require_dist
|
|
30875
|
+
return c.json(require_dist.SubmitAgentFeedbackResponseSchema.parse({ ok: true }), 200);
|
|
30874
30876
|
};
|
|
30875
30877
|
//#endregion
|
|
30876
30878
|
//#region src/routes/account/templates/GET.ts
|
|
@@ -30878,9 +30880,9 @@ function toIso(date) {
|
|
|
30878
30880
|
return date.toISOString();
|
|
30879
30881
|
}
|
|
30880
30882
|
const listTemplatesHandler = async (c) => {
|
|
30881
|
-
const parsedKind = require_dist
|
|
30883
|
+
const parsedKind = require_dist.TemplateKindSchema.safeParse(c.req.query("kind"));
|
|
30882
30884
|
const rows = await (0, _keystrokehq_platform_database.listTemplates)(parsedKind.success ? parsedKind.data : void 0);
|
|
30883
|
-
return c.json(require_dist
|
|
30885
|
+
return c.json(require_dist.ListTemplatesResponseSchema.parse(rows.map((row) => ({
|
|
30884
30886
|
slug: row.slug,
|
|
30885
30887
|
kind: row.kind,
|
|
30886
30888
|
title: row.title,
|
|
@@ -30893,7 +30895,7 @@ const listTemplatesHandler = async (c) => {
|
|
|
30893
30895
|
const getTemplateHandler = async (c) => {
|
|
30894
30896
|
const row = await (0, _keystrokehq_platform_database.selectTemplateBySlug)(c.req.param("slug") ?? "");
|
|
30895
30897
|
if (!row) return c.json({ error: "Template not found" }, 404);
|
|
30896
|
-
return c.json(require_dist
|
|
30898
|
+
return c.json(require_dist.GetTemplateResponseSchema.parse({
|
|
30897
30899
|
slug: row.slug,
|
|
30898
30900
|
kind: row.kind,
|
|
30899
30901
|
title: row.title,
|
|
@@ -30907,7 +30909,7 @@ const getTemplateHandler = async (c) => {
|
|
|
30907
30909
|
const getTemplateFilesHandler = async (c) => {
|
|
30908
30910
|
const row = await (0, _keystrokehq_platform_database.selectTemplateBySlug)(c.req.param("slug") ?? "");
|
|
30909
30911
|
if (!row) return c.json({ error: "Template not found" }, 404);
|
|
30910
|
-
return c.json(require_dist
|
|
30912
|
+
return c.json(require_dist.TemplateFilesResponseSchema.parse({
|
|
30911
30913
|
slug: row.slug,
|
|
30912
30914
|
files: row.files
|
|
30913
30915
|
}));
|
|
@@ -30934,13 +30936,13 @@ function mountAccountRoutes(options) {
|
|
|
30934
30936
|
const requireApiKeyCreate = authorize(apiKeysActions.create);
|
|
30935
30937
|
const requireManagedServicesRead = authorize(managedServicesActions.read);
|
|
30936
30938
|
const requireManagedServicesManage = authorize(managedServicesActions.manage);
|
|
30937
|
-
const requireInvitableRole = authorizePayload(require_dist
|
|
30939
|
+
const requireInvitableRole = authorizePayload(require_dist.InviteOrganizationMembersRequestSchema, ({ ctx, body }) => canInviteRole(ctx.orgRole, body.role));
|
|
30938
30940
|
const requireProjectMember = requireProjectMembership();
|
|
30939
30941
|
const requireProjectDeploy = authorize(projectActions.deploy);
|
|
30940
30942
|
const requireProjectUpdate = authorize(projectActions.update);
|
|
30941
30943
|
const requireProjectDelete = authorize(projectActions.delete);
|
|
30942
30944
|
const requireProjectManageMembers = authorize(projectActions.manageMembers);
|
|
30943
|
-
const requireInvitableProjectRole = authorizePayload(require_dist
|
|
30945
|
+
const requireInvitableProjectRole = authorizePayload(require_dist.InviteProjectMembersRequestSchema, ({ c, ctx, body }) => canInviteToProject(ctx, { invitePermission: getProjectInvitePermission(c) }, body.role));
|
|
30944
30946
|
const requireOrgParam = requireOrganizationParam();
|
|
30945
30947
|
account.get("/organizations", handler$106);
|
|
30946
30948
|
account.get("/organizations/slug-available", handler$105);
|
|
@@ -31189,7 +31191,7 @@ function mountInternalRoutes(workerToken, tokenRefresh, llmProxy, mcp) {
|
|
|
31189
31191
|
const protect = require_with_project_scope.requireWorkerToken(workerToken);
|
|
31190
31192
|
const materialize = (0, _keystrokehq_runtime.createCredentialMaterializeHandler)(tokenRefresh, { resolveSandboxAccessToken: mcp ? (connectionId) => mcp.resolveSandboxAccessToken(connectionId) : void 0 });
|
|
31191
31193
|
internal.use("/orgs/:organizationId/db/*", async (c, next) => {
|
|
31192
|
-
const verified =
|
|
31194
|
+
const verified = require_wait_for_health_XEzPPQIO.verifyOrgWorkerToken(workerToken, require_with_project_scope.readWorkerTokenFromRequest(c));
|
|
31193
31195
|
if (!verified || verified.organizationId !== c.req.param("organizationId")) return c.json({
|
|
31194
31196
|
error: "unauthorized",
|
|
31195
31197
|
message: "Invalid database proxy token."
|
|
@@ -31200,7 +31202,7 @@ function mountInternalRoutes(workerToken, tokenRefresh, llmProxy, mcp) {
|
|
|
31200
31202
|
const organizationId = c.req.param("organizationId");
|
|
31201
31203
|
const organization = await getCachedOrganization(organizationId);
|
|
31202
31204
|
if (!organization) return c.json({ error: "Organization not found" }, 404);
|
|
31203
|
-
const parsed = require_dist
|
|
31205
|
+
const parsed = require_dist.DbProxyQueryRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
31204
31206
|
if (!parsed.success) return c.json({
|
|
31205
31207
|
error: "Invalid request body",
|
|
31206
31208
|
details: parsed.error.flatten()
|
|
@@ -31231,7 +31233,7 @@ function mountInternalRoutes(workerToken, tokenRefresh, llmProxy, mcp) {
|
|
|
31231
31233
|
await next();
|
|
31232
31234
|
});
|
|
31233
31235
|
internal.use("/projects/:projectId/*", async (c, next) => {
|
|
31234
|
-
const verified =
|
|
31236
|
+
const verified = require_wait_for_health_XEzPPQIO.verifyOrgWorkerToken(workerToken, require_with_project_scope.readWorkerTokenFromRequest(c));
|
|
31235
31237
|
if (verified) {
|
|
31236
31238
|
const project = await (0, _keystrokehq_platform_database.selectProjectById)(c.req.param("projectId"));
|
|
31237
31239
|
if (project && project.organizationId !== verified.organizationId) return c.json({
|
|
@@ -31337,9 +31339,9 @@ async function loadModelIds() {
|
|
|
31337
31339
|
async function handler$3(c) {
|
|
31338
31340
|
try {
|
|
31339
31341
|
const models = await loadModelIds();
|
|
31340
|
-
return c.json(require_dist
|
|
31342
|
+
return c.json(require_dist.PublicModelsResponseSchema.parse({ models }));
|
|
31341
31343
|
} catch (error) {
|
|
31342
|
-
if (cache) return c.json(require_dist
|
|
31344
|
+
if (cache) return c.json(require_dist.PublicModelsResponseSchema.parse({ models: cache.models }));
|
|
31343
31345
|
const message = error instanceof Error ? error.message : "Failed to load models";
|
|
31344
31346
|
return c.json({ error: message }, 502);
|
|
31345
31347
|
}
|
|
@@ -31430,12 +31432,12 @@ async function postMarketingContactToSlack(input) {
|
|
|
31430
31432
|
//#region src/routes/public/contact/POST.ts
|
|
31431
31433
|
async function handler$2(c) {
|
|
31432
31434
|
if (!consumeContactRateLimit(clientIp(c))) return c.json({ error: "Too many requests" }, 429);
|
|
31433
|
-
const parsed = require_dist
|
|
31435
|
+
const parsed = require_dist.SubmitMarketingContactRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
31434
31436
|
if (!parsed.success) {
|
|
31435
31437
|
const message = parsed.error.issues[0]?.message ?? "Invalid request body";
|
|
31436
31438
|
return c.json({ error: message }, 400);
|
|
31437
31439
|
}
|
|
31438
|
-
if (parsed.data.companyWebsite?.trim()) return c.json(require_dist
|
|
31440
|
+
if (parsed.data.companyWebsite?.trim()) return c.json(require_dist.SubmitMarketingContactResponseSchema.parse({ ok: true }), 200);
|
|
31439
31441
|
try {
|
|
31440
31442
|
await postMarketingContactToSlack({
|
|
31441
31443
|
fullName: parsed.data.fullName,
|
|
@@ -31447,7 +31449,7 @@ async function handler$2(c) {
|
|
|
31447
31449
|
console.error("Failed to deliver marketing contact to Slack", error);
|
|
31448
31450
|
return c.json({ error: "Failed to deliver contact request" }, 502);
|
|
31449
31451
|
}
|
|
31450
|
-
return c.json(require_dist
|
|
31452
|
+
return c.json(require_dist.SubmitMarketingContactResponseSchema.parse({ ok: true }), 200);
|
|
31451
31453
|
}
|
|
31452
31454
|
//#endregion
|
|
31453
31455
|
//#region src/routes/public/forms/resolve.ts
|
|
@@ -31458,8 +31460,8 @@ async function resolvePublicWorkflowForm(token) {
|
|
|
31458
31460
|
if (!workflow) return null;
|
|
31459
31461
|
const requestSchema = await resolveWorkflowRequestSchema(publishedForm.project.id, workflow);
|
|
31460
31462
|
if (!requestSchema) return null;
|
|
31461
|
-
const inputSchema = require_dist
|
|
31462
|
-
if (inputSchema.fields.length === 0 || require_dist
|
|
31463
|
+
const inputSchema = require_dist.jsonSchemaToWorkflowInputSchema(requestSchema);
|
|
31464
|
+
if (inputSchema.fields.length === 0 || require_dist.schemaHasFileFields(inputSchema) || require_dist.schemaHasUnsupportedFormFields(inputSchema)) return null;
|
|
31463
31465
|
return {
|
|
31464
31466
|
publishedForm,
|
|
31465
31467
|
workflow,
|
|
@@ -31471,15 +31473,15 @@ async function resolvePublicWorkflowForm(token) {
|
|
|
31471
31473
|
//#region src/routes/public/forms/GET.ts
|
|
31472
31474
|
async function handler$1(c) {
|
|
31473
31475
|
const token = c.req.param("token")?.trim();
|
|
31474
|
-
if (!token) return c.json(require_dist
|
|
31476
|
+
if (!token) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Form not found" }), 404);
|
|
31475
31477
|
const resolved = await resolvePublicWorkflowForm(token);
|
|
31476
|
-
if (!resolved) return c.json(require_dist
|
|
31478
|
+
if (!resolved) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Form not found" }), 404);
|
|
31477
31479
|
const { publishedForm, workflow, inputSchema } = resolved;
|
|
31478
31480
|
const branding = publishedForm.organization;
|
|
31479
|
-
return c.json(require_dist
|
|
31481
|
+
return c.json(require_dist.PublicFormMetadataSchema.parse({
|
|
31480
31482
|
title: publishedForm.form.title ?? workflow.name,
|
|
31481
31483
|
description: publishedForm.form.description ?? workflow.description,
|
|
31482
|
-
fields: require_dist
|
|
31484
|
+
fields: require_dist.resolvePublicFormFields(inputSchema, publishedForm.form.fieldConfig),
|
|
31483
31485
|
branding: {
|
|
31484
31486
|
organizationName: branding.name,
|
|
31485
31487
|
projectName: publishedForm.project.name,
|
|
@@ -31513,26 +31515,25 @@ function consumePublicFormRateLimit(formToken, ip) {
|
|
|
31513
31515
|
//#endregion
|
|
31514
31516
|
//#region src/routes/public/forms/submit/POST.ts
|
|
31515
31517
|
function parseRunInput(requestSchema, input) {
|
|
31516
|
-
|
|
31517
|
-
return zod.z.record(zod.z.string(), zod.z.unknown()).parse(input ?? {});
|
|
31518
|
+
return require_dist.jsonSchemaToZod(requestSchema).parse(input ?? {});
|
|
31518
31519
|
}
|
|
31519
31520
|
function createHandler(promptCreditGate) {
|
|
31520
31521
|
return async (c) => {
|
|
31521
31522
|
const token = c.req.param("token")?.trim();
|
|
31522
|
-
if (!token) return c.json(require_dist
|
|
31523
|
+
if (!token) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Form not found" }), 404);
|
|
31523
31524
|
const resolved = await resolvePublicWorkflowForm(token);
|
|
31524
|
-
if (!resolved) return c.json(require_dist
|
|
31525
|
-
if (!consumePublicFormRateLimit(token, clientIp(c))) return c.json(require_dist
|
|
31526
|
-
const parsed = require_dist
|
|
31525
|
+
if (!resolved) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Form not found" }), 404);
|
|
31526
|
+
if (!consumePublicFormRateLimit(token, clientIp(c))) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Too many requests" }), 429);
|
|
31527
|
+
const parsed = require_dist.PublicFormSubmitBodySchema.safeParse(await c.req.json().catch(() => null));
|
|
31527
31528
|
if (!parsed.success) {
|
|
31528
31529
|
const message = parsed.error.issues[0]?.message ?? "Invalid request body";
|
|
31529
|
-
return c.json(require_dist
|
|
31530
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: message }), 400);
|
|
31530
31531
|
}
|
|
31531
|
-
if (parsed.data.website?.trim()) return c.json(require_dist
|
|
31532
|
+
if (parsed.data.website?.trim()) return c.json(require_dist.PublicFormSubmitResponseSchema.parse({ ok: true }), 202);
|
|
31532
31533
|
const { publishedForm, requestSchema, workflow } = resolved;
|
|
31533
31534
|
if (promptCreditGate) try {
|
|
31534
31535
|
const creditResult = await promptCreditGate(publishedForm.organization.id);
|
|
31535
|
-
if (!creditResult.allow) return c.json(require_dist
|
|
31536
|
+
if (!creditResult.allow) return c.json(require_dist.ErrorResponseSchema.parse({
|
|
31536
31537
|
error: creditResult.reason,
|
|
31537
31538
|
message: "This workspace is out of credits. Add credits in billing settings to run workflows."
|
|
31538
31539
|
}), 402);
|
|
@@ -31540,7 +31541,7 @@ function createHandler(promptCreditGate) {
|
|
|
31540
31541
|
console.error("[public-forms] prompt credit gate failed (allowing):", error);
|
|
31541
31542
|
}
|
|
31542
31543
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(publishedForm.organization.id);
|
|
31543
|
-
if (!organization) return c.json(require_dist
|
|
31544
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Form not found" }), 404);
|
|
31544
31545
|
try {
|
|
31545
31546
|
await require_with_project_scope.withProjectScope(publishedForm.project.id, async () => {
|
|
31546
31547
|
const scheduler = await (0, _keystrokehq_http.getProjectScheduler)(organization, publishedForm.project.id);
|
|
@@ -31552,10 +31553,10 @@ function createHandler(promptCreditGate) {
|
|
|
31552
31553
|
});
|
|
31553
31554
|
});
|
|
31554
31555
|
} catch (error) {
|
|
31555
|
-
if (error instanceof zod.ZodError) return c.json(require_dist
|
|
31556
|
+
if (error instanceof zod.ZodError) return c.json(require_dist.validationErrorResponse(error, "Invalid workflow input"), 400);
|
|
31556
31557
|
throw error;
|
|
31557
31558
|
}
|
|
31558
|
-
return c.json(require_dist
|
|
31559
|
+
return c.json(require_dist.PublicFormSubmitResponseSchema.parse({ ok: true }), 202);
|
|
31559
31560
|
};
|
|
31560
31561
|
}
|
|
31561
31562
|
//#endregion
|
|
@@ -31634,7 +31635,7 @@ function resolvePlatformListenPort() {
|
|
|
31634
31635
|
const { hostname } = new URL(publicUrl);
|
|
31635
31636
|
if (hostname !== "localhost" && hostname !== "127.0.0.1") return PRODUCTION_PLATFORM_LISTEN_PORT;
|
|
31636
31637
|
} catch {}
|
|
31637
|
-
return require_dist
|
|
31638
|
+
return require_dist.listenPortFromPublicUrl(process.env.PUBLIC_PLATFORM_URL, LOCAL_PLATFORM_PORT);
|
|
31638
31639
|
}
|
|
31639
31640
|
function usesPgBossScheduler(platformConfig) {
|
|
31640
31641
|
return platformConfig.scheduler.name === "pg-boss" || platformConfig.scheduler.name === "default";
|
|
@@ -31643,7 +31644,7 @@ async function startPlatformServer(platformConfig, hooks = {}) {
|
|
|
31643
31644
|
const runtime = platformConfig.hosting.createRuntime();
|
|
31644
31645
|
await (0, _keystrokehq_platform_database.initDatabase)();
|
|
31645
31646
|
startOfficialTemplateSeedInBackground();
|
|
31646
|
-
await require_dist
|
|
31647
|
+
await require_dist.ensureKeystrokeAssetsBucket();
|
|
31647
31648
|
await (0, _keystrokehq_runtime.seedOAuthAppsFromEnvForAllOrganizations)();
|
|
31648
31649
|
if (usesPgBossScheduler(platformConfig)) await (0, _keystrokehq_platform_database.ensureProjectPgBossGrants)();
|
|
31649
31650
|
configureProjectRuntimeScheduler(platformConfig.scheduler);
|
|
@@ -31654,7 +31655,7 @@ async function startPlatformServer(platformConfig, hooks = {}) {
|
|
|
31654
31655
|
if (!organization) throw new Error(`Organization ${job.organizationId} not found`);
|
|
31655
31656
|
const database = await (0, _keystrokehq_platform_database.resolveOrgRuntimeDatabase)(job.organizationId);
|
|
31656
31657
|
const workerRuntime = platformConfig.hosting.workerRuntime;
|
|
31657
|
-
const orgWorkerToken =
|
|
31658
|
+
const orgWorkerToken = require_wait_for_health_XEzPPQIO.mintOrgWorkerToken(workerRuntime.workerToken, job.organizationId);
|
|
31658
31659
|
return {
|
|
31659
31660
|
organizationId: job.organizationId,
|
|
31660
31661
|
projects: [],
|
|
@@ -31868,4 +31869,4 @@ Object.defineProperty(exports, "x$1", {
|
|
|
31868
31869
|
}
|
|
31869
31870
|
});
|
|
31870
31871
|
|
|
31871
|
-
//# sourceMappingURL=start-
|
|
31872
|
+
//# sourceMappingURL=start-CRsvMO8Z.cjs.map
|