@keystrokehq/platform 0.1.128 → 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-D01I685l.cjs → awk2-LA3USKJP-CRpeKCfQ.cjs} +2 -2
- package/dist/{awk2-LA3USKJP-D01I685l.cjs.map → awk2-LA3USKJP-CRpeKCfQ.cjs.map} +1 -1
- package/dist/{awk2-LA3USKJP-4LY5wkvg.mjs → awk2-LA3USKJP-JSEp5Xlg.mjs} +2 -2
- package/dist/{awk2-LA3USKJP-4LY5wkvg.mjs.map → awk2-LA3USKJP-JSEp5Xlg.mjs.map} +1 -1
- package/dist/{base64-C2AIWVNC-dOLZM2j5.cjs → base64-C2AIWVNC-Bkg108Je.cjs} +2 -2
- package/dist/{base64-C2AIWVNC-dOLZM2j5.cjs.map → base64-C2AIWVNC-Bkg108Je.cjs.map} +1 -1
- package/dist/{base64-C2AIWVNC-Dk-efh3D.mjs → base64-C2AIWVNC-CZiWywDB.mjs} +2 -2
- package/dist/{base64-C2AIWVNC-Dk-efh3D.mjs.map → base64-C2AIWVNC-CZiWywDB.mjs.map} +1 -1
- package/dist/{bash-YZ33HQZQ-yrH6nvl2.cjs → bash-YZ33HQZQ-BNCFBZcV.cjs} +2 -2
- package/dist/{bash-YZ33HQZQ-yrH6nvl2.cjs.map → bash-YZ33HQZQ-BNCFBZcV.cjs.map} +1 -1
- package/dist/{bash-YZ33HQZQ-BPKp-NOt.mjs → bash-YZ33HQZQ-v7kXvjMn.mjs} +2 -2
- package/dist/{bash-YZ33HQZQ-BPKp-NOt.mjs.map → bash-YZ33HQZQ-v7kXvjMn.mjs.map} +1 -1
- package/dist/{cat-TSFMZVYS-B9RH-F_i.cjs → cat-TSFMZVYS-6dEqhBmm.cjs} +3 -3
- package/dist/{cat-TSFMZVYS-B9RH-F_i.cjs.map → cat-TSFMZVYS-6dEqhBmm.cjs.map} +1 -1
- package/dist/{cat-TSFMZVYS-ClT4udXs.mjs → cat-TSFMZVYS-BLpD1bZP.mjs} +3 -3
- package/dist/{cat-TSFMZVYS-ClT4udXs.mjs.map → cat-TSFMZVYS-BLpD1bZP.mjs.map} +1 -1
- package/dist/{chunk-5H5SCKJM-VSYoUFtG.mjs → chunk-5H5SCKJM-Bggyg1Jk.mjs} +2 -2
- package/dist/{chunk-5H5SCKJM-VSYoUFtG.mjs.map → chunk-5H5SCKJM-Bggyg1Jk.mjs.map} +1 -1
- package/dist/{chunk-5H5SCKJM-Mm89mBHu.cjs → chunk-5H5SCKJM-D_1eCa9o.cjs} +2 -2
- package/dist/{chunk-5H5SCKJM-Mm89mBHu.cjs.map → chunk-5H5SCKJM-D_1eCa9o.cjs.map} +1 -1
- package/dist/{chunk-AQ6FYS2X-BBpse6WB.mjs → chunk-AQ6FYS2X-DE1rd6hn.mjs} +2 -2
- package/dist/{chunk-AQ6FYS2X-BBpse6WB.mjs.map → chunk-AQ6FYS2X-DE1rd6hn.mjs.map} +1 -1
- package/dist/{chunk-AQ6FYS2X-xGpa9n1I.cjs → chunk-AQ6FYS2X-DoehpZyo.cjs} +2 -2
- package/dist/{chunk-AQ6FYS2X-xGpa9n1I.cjs.map → chunk-AQ6FYS2X-DoehpZyo.cjs.map} +1 -1
- package/dist/{chunk-CHFEPBH4-Xnh-lyRq.cjs → chunk-CHFEPBH4-CJIVvXgB.cjs} +2 -2
- package/dist/{chunk-CHFEPBH4-Xnh-lyRq.cjs.map → chunk-CHFEPBH4-CJIVvXgB.cjs.map} +1 -1
- package/dist/{chunk-CHFEPBH4-DFu_y8bg.mjs → chunk-CHFEPBH4-WBOOOPg2.mjs} +2 -2
- package/dist/{chunk-CHFEPBH4-DFu_y8bg.mjs.map → chunk-CHFEPBH4-WBOOOPg2.mjs.map} +1 -1
- package/dist/{chunk-EBAPSGAO-DrzQ__bY.mjs → chunk-EBAPSGAO-C9KZArcE.mjs} +2 -2
- package/dist/{chunk-EBAPSGAO-DrzQ__bY.mjs.map → chunk-EBAPSGAO-C9KZArcE.mjs.map} +1 -1
- package/dist/{chunk-EBAPSGAO-Lwbjx03e.cjs → chunk-EBAPSGAO-D_EhjwMv.cjs} +2 -2
- package/dist/{chunk-EBAPSGAO-Lwbjx03e.cjs.map → chunk-EBAPSGAO-D_EhjwMv.cjs.map} +1 -1
- package/dist/{chunk-LEKBROJD-DsOS1UXA.mjs → chunk-LEKBROJD-D-IIdlKP.mjs} +2 -2
- package/dist/{chunk-LEKBROJD-DsOS1UXA.mjs.map → chunk-LEKBROJD-D-IIdlKP.mjs.map} +1 -1
- package/dist/{chunk-LEKBROJD-DCryR9nR.cjs → chunk-LEKBROJD-DJdgm-7A.cjs} +2 -2
- package/dist/{chunk-LEKBROJD-DCryR9nR.cjs.map → chunk-LEKBROJD-DJdgm-7A.cjs.map} +1 -1
- package/dist/{chunk-VPADYNBD-BjmnKNE6.cjs → chunk-VPADYNBD-DryEgdfM.cjs} +2 -2
- package/dist/{chunk-VPADYNBD-BjmnKNE6.cjs.map → chunk-VPADYNBD-DryEgdfM.cjs.map} +1 -1
- package/dist/{chunk-VPADYNBD-VQrqD7wB.mjs → chunk-VPADYNBD-ptfxMBmZ.mjs} +2 -2
- package/dist/{chunk-VPADYNBD-VQrqD7wB.mjs.map → chunk-VPADYNBD-ptfxMBmZ.mjs.map} +1 -1
- package/dist/{chunk-YCLFEX4T-t5067YWV.cjs → chunk-YCLFEX4T-B3UMBJ0M.cjs} +2 -2
- package/dist/{chunk-YCLFEX4T-t5067YWV.cjs.map → chunk-YCLFEX4T-B3UMBJ0M.cjs.map} +1 -1
- package/dist/{chunk-YCLFEX4T-CaPeeMe9.mjs → chunk-YCLFEX4T-DL82L8qX.mjs} +2 -2
- package/dist/{chunk-YCLFEX4T-CaPeeMe9.mjs.map → chunk-YCLFEX4T-DL82L8qX.mjs.map} +1 -1
- package/dist/{column-XT6UFXNQ-D-rjZAC3.mjs → column-XT6UFXNQ-B5Y5NTgP.mjs} +2 -2
- package/dist/{column-XT6UFXNQ-D-rjZAC3.mjs.map → column-XT6UFXNQ-B5Y5NTgP.mjs.map} +1 -1
- package/dist/{column-XT6UFXNQ-BRtECFvd.cjs → column-XT6UFXNQ-DiKFWUTy.cjs} +2 -2
- package/dist/{column-XT6UFXNQ-BRtECFvd.cjs.map → column-XT6UFXNQ-DiKFWUTy.cjs.map} +1 -1
- package/dist/{comm-VV2LDX2J-sol38DGO.cjs → comm-VV2LDX2J-BFfsarPx.cjs} +2 -2
- package/dist/{comm-VV2LDX2J-sol38DGO.cjs.map → comm-VV2LDX2J-BFfsarPx.cjs.map} +1 -1
- package/dist/{comm-VV2LDX2J-B7TQzU0V.mjs → comm-VV2LDX2J-C_eMUh7X.mjs} +2 -2
- package/dist/{comm-VV2LDX2J-B7TQzU0V.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-C29DUJaa.mjs → cp-BISAAS7A-B-mVeyDw.mjs} +2 -2
- package/dist/{cp-BISAAS7A-C29DUJaa.mjs.map → cp-BISAAS7A-B-mVeyDw.mjs.map} +1 -1
- package/dist/{cp-BISAAS7A-rmq0vo-O.cjs → cp-BISAAS7A-C2krfNmE.cjs} +2 -2
- package/dist/{cp-BISAAS7A-rmq0vo-O.cjs.map → cp-BISAAS7A-C2krfNmE.cjs.map} +1 -1
- package/dist/{cut-OKARJCCV-iYjjcpsa.cjs → cut-OKARJCCV-BrZy_JBc.cjs} +3 -3
- package/dist/{cut-OKARJCCV-iYjjcpsa.cjs.map → cut-OKARJCCV-BrZy_JBc.cjs.map} +1 -1
- package/dist/{cut-OKARJCCV-Cj1yP7gr.mjs → cut-OKARJCCV-CxsMG1ws.mjs} +3 -3
- package/dist/{cut-OKARJCCV-Cj1yP7gr.mjs.map → cut-OKARJCCV-CxsMG1ws.mjs.map} +1 -1
- package/dist/{diff-MWJFIG7X-BV5Qpmy1.mjs → diff-MWJFIG7X-BwOFX19z.mjs} +2 -2
- package/dist/{diff-MWJFIG7X-BV5Qpmy1.mjs.map → diff-MWJFIG7X-BwOFX19z.mjs.map} +1 -1
- package/dist/{diff-MWJFIG7X-Cxl1QTn7.cjs → diff-MWJFIG7X-_Pn5aMae.cjs} +2 -2
- package/dist/{diff-MWJFIG7X-Cxl1QTn7.cjs.map → diff-MWJFIG7X-_Pn5aMae.cjs.map} +1 -1
- package/dist/{dist-BBoSNbv1.mjs → dist-Bci68KAE.mjs} +453 -467
- package/dist/dist-Bci68KAE.mjs.map +1 -0
- package/dist/{dist-C-bTIDMw.cjs → dist-Bqh3rPbq.cjs} +607 -602
- package/dist/dist-Bqh3rPbq.cjs.map +1 -0
- package/dist/{du-572XNP42-C0XQuV6J.cjs → du-572XNP42-Cd7S5r3G.cjs} +2 -2
- package/dist/{du-572XNP42-C0XQuV6J.cjs.map → du-572XNP42-Cd7S5r3G.cjs.map} +1 -1
- package/dist/{du-572XNP42-BLV0wfbB.mjs → du-572XNP42-DIxq319C.mjs} +2 -2
- package/dist/{du-572XNP42-BLV0wfbB.mjs.map → du-572XNP42-DIxq319C.mjs.map} +1 -1
- package/dist/{env-36M5BO7M-BqZdd6vR.mjs → env-36M5BO7M-BcGUj0ch.mjs} +2 -2
- package/dist/{env-36M5BO7M-BqZdd6vR.mjs.map → env-36M5BO7M-BcGUj0ch.mjs.map} +1 -1
- package/dist/{env-36M5BO7M-DwhMSvj2.cjs → env-36M5BO7M-DUYG60IR.cjs} +2 -2
- package/dist/{env-36M5BO7M-DwhMSvj2.cjs.map → env-36M5BO7M-DUYG60IR.cjs.map} +1 -1
- package/dist/{expand-JSPG6VOP-BLaAfP1e.cjs → expand-JSPG6VOP-BAmgU6tl.cjs} +2 -2
- package/dist/{expand-JSPG6VOP-BLaAfP1e.cjs.map → expand-JSPG6VOP-BAmgU6tl.cjs.map} +1 -1
- package/dist/{expand-JSPG6VOP-CwMj1EKW.mjs → expand-JSPG6VOP-DFjJvHLb.mjs} +2 -2
- package/dist/{expand-JSPG6VOP-CwMj1EKW.mjs.map → expand-JSPG6VOP-DFjJvHLb.mjs.map} +1 -1
- package/dist/{expr-5JAACS4X-BomHAnRn.mjs → expr-5JAACS4X-CYAUFOGr.mjs} +2 -2
- package/dist/{expr-5JAACS4X-BomHAnRn.mjs.map → expr-5JAACS4X-CYAUFOGr.mjs.map} +1 -1
- package/dist/{expr-5JAACS4X-dZtAp65-.cjs → expr-5JAACS4X-sB386XcD.cjs} +2 -2
- package/dist/{expr-5JAACS4X-dZtAp65-.cjs.map → expr-5JAACS4X-sB386XcD.cjs.map} +1 -1
- package/dist/{find-INTH3OLC-s4yABEhi.cjs → find-INTH3OLC-BTShg9xs.cjs} +3 -3
- package/dist/{find-INTH3OLC-s4yABEhi.cjs.map → find-INTH3OLC-BTShg9xs.cjs.map} +1 -1
- package/dist/{find-INTH3OLC-9pHW--b6.mjs → find-INTH3OLC-D5F-4TiK.mjs} +3 -3
- package/dist/{find-INTH3OLC-9pHW--b6.mjs.map → find-INTH3OLC-D5F-4TiK.mjs.map} +1 -1
- package/dist/{fold-4TQNYMSW-QN7Kswbz.mjs → fold-4TQNYMSW-ChWNcaSY.mjs} +2 -2
- package/dist/{fold-4TQNYMSW-QN7Kswbz.mjs.map → fold-4TQNYMSW-ChWNcaSY.mjs.map} +1 -1
- package/dist/{fold-4TQNYMSW-dRlgjAxi.cjs → fold-4TQNYMSW-DYBfLnwa.cjs} +2 -2
- package/dist/{fold-4TQNYMSW-dRlgjAxi.cjs.map → fold-4TQNYMSW-DYBfLnwa.cjs.map} +1 -1
- package/dist/{grep-V3LQVMRQ-CXrtRZBB.mjs → grep-V3LQVMRQ-B0gA4mLR.mjs} +4 -4
- package/dist/{grep-V3LQVMRQ-CXrtRZBB.mjs.map → grep-V3LQVMRQ-B0gA4mLR.mjs.map} +1 -1
- package/dist/{grep-V3LQVMRQ-CzoQrdvP.cjs → grep-V3LQVMRQ-C1PzxoF4.cjs} +4 -4
- package/dist/{grep-V3LQVMRQ-CzoQrdvP.cjs.map → grep-V3LQVMRQ-C1PzxoF4.cjs.map} +1 -1
- package/dist/{gzip-O5ASJAFY-BQXqx1_m.mjs → gzip-O5ASJAFY-BTTHx-WY.mjs} +2 -2
- package/dist/{gzip-O5ASJAFY-BQXqx1_m.mjs.map → gzip-O5ASJAFY-BTTHx-WY.mjs.map} +1 -1
- package/dist/{gzip-O5ASJAFY-DCJ7MEh4.cjs → gzip-O5ASJAFY-DKP63NQf.cjs} +2 -2
- package/dist/{gzip-O5ASJAFY-DCJ7MEh4.cjs.map → gzip-O5ASJAFY-DKP63NQf.cjs.map} +1 -1
- package/dist/{head-442HYESI-D13OMgy4.mjs → head-442HYESI-BLoRrBPY.mjs} +2 -2
- package/dist/{head-442HYESI-D13OMgy4.mjs.map → head-442HYESI-BLoRrBPY.mjs.map} +1 -1
- package/dist/{head-442HYESI-_9Mn90ER.cjs → head-442HYESI-DvzjT244.cjs} +2 -2
- package/dist/{head-442HYESI-_9Mn90ER.cjs.map → head-442HYESI-DvzjT244.cjs.map} +1 -1
- package/dist/{help-HZ6M2CKN-DwTYuA1y.mjs → help-HZ6M2CKN-BlDHQUKv.mjs} +2 -2
- package/dist/{help-HZ6M2CKN-DwTYuA1y.mjs.map → help-HZ6M2CKN-BlDHQUKv.mjs.map} +1 -1
- package/dist/{help-HZ6M2CKN-uYwhLDPg.cjs → help-HZ6M2CKN-F4KWA-Lo.cjs} +2 -2
- package/dist/{help-HZ6M2CKN-uYwhLDPg.cjs.map → help-HZ6M2CKN-F4KWA-Lo.cjs.map} +1 -1
- package/dist/{html-to-markdown-JW4MSQZO-CewaNSVc.cjs → html-to-markdown-JW4MSQZO-B0MrYci-.cjs} +3 -3
- package/dist/{html-to-markdown-JW4MSQZO-CewaNSVc.cjs.map → html-to-markdown-JW4MSQZO-B0MrYci-.cjs.map} +1 -1
- package/dist/{html-to-markdown-JW4MSQZO-CkbEuJeA.mjs → html-to-markdown-JW4MSQZO-D9E7dTrr.mjs} +3 -3
- package/dist/{html-to-markdown-JW4MSQZO-CkbEuJeA.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-BJvgo00B.cjs → join-TBRGI3LQ-8WBxN8S3.cjs} +2 -2
- package/dist/{join-TBRGI3LQ-BJvgo00B.cjs.map → join-TBRGI3LQ-8WBxN8S3.cjs.map} +1 -1
- package/dist/{join-TBRGI3LQ-C42q_3mE.mjs → join-TBRGI3LQ-BBV17RnM.mjs} +2 -2
- package/dist/{join-TBRGI3LQ-C42q_3mE.mjs.map → join-TBRGI3LQ-BBV17RnM.mjs.map} +1 -1
- package/dist/{jq-4XLYLOS5-CQgfk9AD.mjs → jq-4XLYLOS5-BiUPd094.mjs} +4 -4
- package/dist/{jq-4XLYLOS5-CQgfk9AD.mjs.map → jq-4XLYLOS5-BiUPd094.mjs.map} +1 -1
- package/dist/{jq-4XLYLOS5-DS-qViwI.cjs → jq-4XLYLOS5-CgNV85jS.cjs} +4 -4
- package/dist/{jq-4XLYLOS5-DS-qViwI.cjs.map → jq-4XLYLOS5-CgNV85jS.cjs.map} +1 -1
- package/dist/{js-exec-N5KEZBH7-BPsOxcW0.mjs → js-exec-N5KEZBH7-CzUyxAo1.mjs} +3 -3
- package/dist/{js-exec-N5KEZBH7-BPsOxcW0.mjs.map → js-exec-N5KEZBH7-CzUyxAo1.mjs.map} +1 -1
- package/dist/{js-exec-N5KEZBH7-D6Hb2045.cjs → js-exec-N5KEZBH7-D_6MBthG.cjs} +3 -3
- package/dist/{js-exec-N5KEZBH7-D6Hb2045.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-Cwb02yIR.mjs → lib-Nj7svX8P.mjs} +2 -2
- package/dist/{lib-Cwb02yIR.mjs.map → lib-Nj7svX8P.mjs.map} +1 -1
- package/dist/{ln-4LGSXXGD-aea9BcHW.cjs → ln-4LGSXXGD-B1Kkh1ha.cjs} +2 -2
- package/dist/{ln-4LGSXXGD-aea9BcHW.cjs.map → ln-4LGSXXGD-B1Kkh1ha.cjs.map} +1 -1
- package/dist/{ln-4LGSXXGD-B9IgLLKV.mjs → ln-4LGSXXGD-CQbnGxlo.mjs} +2 -2
- package/dist/{ln-4LGSXXGD-B9IgLLKV.mjs.map → ln-4LGSXXGD-CQbnGxlo.mjs.map} +1 -1
- package/dist/{ls-ZJGQER7M-CLaB_Rx_.cjs → ls-ZJGQER7M-Bcn7qAy0.cjs} +2 -2
- package/dist/{ls-ZJGQER7M-CLaB_Rx_.cjs.map → ls-ZJGQER7M-Bcn7qAy0.cjs.map} +1 -1
- package/dist/{ls-ZJGQER7M-CgWcLTpr.mjs → ls-ZJGQER7M-JPY6vzVZ.mjs} +2 -2
- package/dist/{ls-ZJGQER7M-CgWcLTpr.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-R-U3S1zo.mjs → md5sum-SPU24VSG-D91mAXHX.mjs} +3 -3
- package/dist/{md5sum-SPU24VSG-R-U3S1zo.mjs.map → md5sum-SPU24VSG-D91mAXHX.mjs.map} +1 -1
- package/dist/{md5sum-SPU24VSG-BW3PO0fT.cjs → md5sum-SPU24VSG-DS0UmURz.cjs} +3 -3
- package/dist/{md5sum-SPU24VSG-BW3PO0fT.cjs.map → md5sum-SPU24VSG-DS0UmURz.cjs.map} +1 -1
- package/dist/{mkdir-MEPGZOB6-DZsxfutz.mjs → mkdir-MEPGZOB6-B_kzUVTS.mjs} +2 -2
- package/dist/{mkdir-MEPGZOB6-DZsxfutz.mjs.map → mkdir-MEPGZOB6-B_kzUVTS.mjs.map} +1 -1
- package/dist/{mkdir-MEPGZOB6-BtU6JtGG.cjs → mkdir-MEPGZOB6-BiX5Vu18.cjs} +2 -2
- package/dist/{mkdir-MEPGZOB6-BtU6JtGG.cjs.map → mkdir-MEPGZOB6-BiX5Vu18.cjs.map} +1 -1
- package/dist/{mv-W5BIQ646-CD5IOmrl.cjs → mv-W5BIQ646-CfAhGw3i.cjs} +2 -2
- package/dist/{mv-W5BIQ646-CD5IOmrl.cjs.map → mv-W5BIQ646-CfAhGw3i.cjs.map} +1 -1
- package/dist/{mv-W5BIQ646-Dkxrd6PI.mjs → mv-W5BIQ646-DYgpWDpz.mjs} +2 -2
- package/dist/{mv-W5BIQ646-Dkxrd6PI.mjs.map → mv-W5BIQ646-DYgpWDpz.mjs.map} +1 -1
- package/dist/{nl-WSDW7I4O-_3xyp5Zj.cjs → nl-WSDW7I4O-BKbW5dn8.cjs} +2 -2
- package/dist/{nl-WSDW7I4O-_3xyp5Zj.cjs.map → nl-WSDW7I4O-BKbW5dn8.cjs.map} +1 -1
- package/dist/{nl-WSDW7I4O-Do9TjegN.mjs → nl-WSDW7I4O-BgC2r5Cn.mjs} +2 -2
- package/dist/{nl-WSDW7I4O-Do9TjegN.mjs.map → nl-WSDW7I4O-BgC2r5Cn.mjs.map} +1 -1
- package/dist/{od-WOKFDJTP-DzvlQTqR.cjs → od-WOKFDJTP-6_AAfiI2.cjs} +2 -2
- package/dist/{od-WOKFDJTP-DzvlQTqR.cjs.map → od-WOKFDJTP-6_AAfiI2.cjs.map} +1 -1
- package/dist/{od-WOKFDJTP-COtBtIPN.mjs → od-WOKFDJTP-L123BzbX.mjs} +2 -2
- package/dist/{od-WOKFDJTP-COtBtIPN.mjs.map → od-WOKFDJTP-L123BzbX.mjs.map} +1 -1
- package/dist/{paste-7JC6S4DX-C8xh5dEv.cjs → paste-7JC6S4DX-DqexKgEh.cjs} +2 -2
- package/dist/{paste-7JC6S4DX-C8xh5dEv.cjs.map → paste-7JC6S4DX-DqexKgEh.cjs.map} +1 -1
- package/dist/{paste-7JC6S4DX-jRyjEBV8.mjs → paste-7JC6S4DX-NBL0MnKq.mjs} +2 -2
- package/dist/{paste-7JC6S4DX-jRyjEBV8.mjs.map → paste-7JC6S4DX-NBL0MnKq.mjs.map} +1 -1
- package/dist/{printf-TWGXF445-BHk-xqxN.mjs → printf-TWGXF445-DEdEype7.mjs} +3 -3
- package/dist/{printf-TWGXF445-BHk-xqxN.mjs.map → printf-TWGXF445-DEdEype7.mjs.map} +1 -1
- package/dist/{printf-TWGXF445-B3aqIehp.cjs → printf-TWGXF445-DQy9Bsfl.cjs} +3 -3
- package/dist/{printf-TWGXF445-B3aqIehp.cjs.map → printf-TWGXF445-DQy9Bsfl.cjs.map} +1 -1
- package/dist/{python3-POMOR4OA-BhvnM3Ua.cjs → python3-POMOR4OA-DGCWlS6L.cjs} +3 -3
- package/dist/{python3-POMOR4OA-BhvnM3Ua.cjs.map → python3-POMOR4OA-DGCWlS6L.cjs.map} +1 -1
- package/dist/{python3-POMOR4OA-DLE5buxg.mjs → python3-POMOR4OA-G_E-5KrH.mjs} +3 -3
- package/dist/{python3-POMOR4OA-DLE5buxg.mjs.map → python3-POMOR4OA-G_E-5KrH.mjs.map} +1 -1
- package/dist/{rev-5EHFX4EJ-CUpaaQvP.mjs → rev-5EHFX4EJ-DBIij1uT.mjs} +2 -2
- package/dist/{rev-5EHFX4EJ-CUpaaQvP.mjs.map → rev-5EHFX4EJ-DBIij1uT.mjs.map} +1 -1
- package/dist/{rev-5EHFX4EJ-Ce2QBPLt.cjs → rev-5EHFX4EJ-EputkmDM.cjs} +2 -2
- package/dist/{rev-5EHFX4EJ-Ce2QBPLt.cjs.map → rev-5EHFX4EJ-EputkmDM.cjs.map} +1 -1
- package/dist/{rg-S4FXYXWB-BMyOKsxC.cjs → rg-S4FXYXWB-B8lu59hX.cjs} +3 -3
- package/dist/{rg-S4FXYXWB-BMyOKsxC.cjs.map → rg-S4FXYXWB-B8lu59hX.cjs.map} +1 -1
- package/dist/{rg-S4FXYXWB-B8rRxtiU.mjs → rg-S4FXYXWB-Daw1Neeo.mjs} +3 -3
- package/dist/{rg-S4FXYXWB-B8rRxtiU.mjs.map → rg-S4FXYXWB-Daw1Neeo.mjs.map} +1 -1
- package/dist/{rm-SSGETQVQ-hg0gTZb8.cjs → rm-SSGETQVQ-CLfbvtE_.cjs} +2 -2
- package/dist/{rm-SSGETQVQ-hg0gTZb8.cjs.map → rm-SSGETQVQ-CLfbvtE_.cjs.map} +1 -1
- package/dist/{rm-SSGETQVQ-do5mXiDg.mjs → rm-SSGETQVQ-mYn2rfbf.mjs} +2 -2
- package/dist/{rm-SSGETQVQ-do5mXiDg.mjs.map → rm-SSGETQVQ-mYn2rfbf.mjs.map} +1 -1
- package/dist/{rmdir-OC4ZLPYA-BqZzINOV.mjs → rmdir-OC4ZLPYA-CHXC39jd.mjs} +2 -2
- package/dist/{rmdir-OC4ZLPYA-BqZzINOV.mjs.map → rmdir-OC4ZLPYA-CHXC39jd.mjs.map} +1 -1
- package/dist/{rmdir-OC4ZLPYA-BJFvSNDE.cjs → rmdir-OC4ZLPYA-Dxi8KjV_.cjs} +2 -2
- package/dist/{rmdir-OC4ZLPYA-BJFvSNDE.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-D7T4-lAa.cjs → sed-S5UIK574-DGWjrFUp.cjs} +2 -2
- package/dist/{sed-S5UIK574-D7T4-lAa.cjs.map → sed-S5UIK574-DGWjrFUp.cjs.map} +1 -1
- package/dist/{sed-S5UIK574-zjs4Rgvi.mjs → sed-S5UIK574-DK728_n-.mjs} +2 -2
- package/dist/{sed-S5UIK574-zjs4Rgvi.mjs.map → sed-S5UIK574-DK728_n-.mjs.map} +1 -1
- package/dist/{sha1sum-2PTOAFR6-D-UCITiq.cjs → sha1sum-2PTOAFR6-7ywnqQKT.cjs} +3 -3
- package/dist/{sha1sum-2PTOAFR6-D-UCITiq.cjs.map → sha1sum-2PTOAFR6-7ywnqQKT.cjs.map} +1 -1
- package/dist/{sha1sum-2PTOAFR6-DaUrict6.mjs → sha1sum-2PTOAFR6-CQ4zoYdG.mjs} +3 -3
- package/dist/{sha1sum-2PTOAFR6-DaUrict6.mjs.map → sha1sum-2PTOAFR6-CQ4zoYdG.mjs.map} +1 -1
- package/dist/{sha256sum-NS7D3IXX-DMYl5O7j.mjs → sha256sum-NS7D3IXX-BOcxhLhB.mjs} +3 -3
- package/dist/{sha256sum-NS7D3IXX-DMYl5O7j.mjs.map → sha256sum-NS7D3IXX-BOcxhLhB.mjs.map} +1 -1
- package/dist/{sha256sum-NS7D3IXX-D1oqyQ3_.cjs → sha256sum-NS7D3IXX-XJaaj5xs.cjs} +3 -3
- package/dist/{sha256sum-NS7D3IXX-D1oqyQ3_.cjs.map → sha256sum-NS7D3IXX-XJaaj5xs.cjs.map} +1 -1
- package/dist/{sleep-X22JJINO-B0MSVGgi.mjs → sleep-X22JJINO-CwarEW8j.mjs} +2 -2
- package/dist/{sleep-X22JJINO-B0MSVGgi.mjs.map → sleep-X22JJINO-CwarEW8j.mjs.map} +1 -1
- package/dist/{sleep-X22JJINO-BjqX2Nrh.cjs → sleep-X22JJINO-DIXrHD3R.cjs} +2 -2
- package/dist/{sleep-X22JJINO-BjqX2Nrh.cjs.map → sleep-X22JJINO-DIXrHD3R.cjs.map} +1 -1
- package/dist/{sort-SW2YEO5B-Oq-loeB3.cjs → sort-SW2YEO5B-Buo6ev-O.cjs} +3 -3
- package/dist/{sort-SW2YEO5B-Oq-loeB3.cjs.map → sort-SW2YEO5B-Buo6ev-O.cjs.map} +1 -1
- package/dist/{sort-SW2YEO5B-Bsh1zjVa.mjs → sort-SW2YEO5B-Du8oOAyb.mjs} +3 -3
- package/dist/{sort-SW2YEO5B-Bsh1zjVa.mjs.map → sort-SW2YEO5B-Du8oOAyb.mjs.map} +1 -1
- package/dist/{split-4KKZZXXE-UxWoGKng.mjs → split-4KKZZXXE-Dwwdn3bk.mjs} +2 -2
- package/dist/{split-4KKZZXXE-UxWoGKng.mjs.map → split-4KKZZXXE-Dwwdn3bk.mjs.map} +1 -1
- package/dist/{split-4KKZZXXE-5FnMydBw.cjs → split-4KKZZXXE-OddRnGAH.cjs} +2 -2
- package/dist/{split-4KKZZXXE-5FnMydBw.cjs.map → split-4KKZZXXE-OddRnGAH.cjs.map} +1 -1
- package/dist/{sqlite3-CGOEFJAO-BqblLBVU.cjs → sqlite3-CGOEFJAO-BWLdebEu.cjs} +3 -3
- package/dist/{sqlite3-CGOEFJAO-BqblLBVU.cjs.map → sqlite3-CGOEFJAO-BWLdebEu.cjs.map} +1 -1
- package/dist/{sqlite3-CGOEFJAO-D0RMQr2T.mjs → sqlite3-CGOEFJAO-BgS0oHGp.mjs} +3 -3
- package/dist/{sqlite3-CGOEFJAO-D0RMQr2T.mjs.map → sqlite3-CGOEFJAO-BgS0oHGp.mjs.map} +1 -1
- package/dist/{start-BtqSmIUP.cjs → start-CRsvMO8Z.cjs} +660 -657
- package/dist/start-CRsvMO8Z.cjs.map +1 -0
- package/dist/{start-DMOAi4UM.mjs → start-R2WutaaN.mjs} +108 -105
- 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-B28dSdmB.mjs → strings-6WDHLGMX-1pLzaL4-.mjs} +2 -2
- package/dist/{strings-6WDHLGMX-B28dSdmB.mjs.map → strings-6WDHLGMX-1pLzaL4-.mjs.map} +1 -1
- package/dist/{strings-6WDHLGMX-t4cOgNf3.cjs → strings-6WDHLGMX-2JWiKgge.cjs} +2 -2
- package/dist/{strings-6WDHLGMX-t4cOgNf3.cjs.map → strings-6WDHLGMX-2JWiKgge.cjs.map} +1 -1
- package/dist/{tac-2STMMJYW-zzdgyOsm.mjs → tac-2STMMJYW-DS78Z4cv.mjs} +2 -2
- package/dist/{tac-2STMMJYW-zzdgyOsm.mjs.map → tac-2STMMJYW-DS78Z4cv.mjs.map} +1 -1
- package/dist/{tac-2STMMJYW-CN0I3YL6.cjs → tac-2STMMJYW-b3jCsqky.cjs} +2 -2
- package/dist/{tac-2STMMJYW-CN0I3YL6.cjs.map → tac-2STMMJYW-b3jCsqky.cjs.map} +1 -1
- package/dist/{tail-R4PCA2C4-BHZzN395.mjs → tail-R4PCA2C4-BFq1JEoz.mjs} +2 -2
- package/dist/{tail-R4PCA2C4-BHZzN395.mjs.map → tail-R4PCA2C4-BFq1JEoz.mjs.map} +1 -1
- package/dist/{tail-R4PCA2C4-i-B-y3p3.cjs → tail-R4PCA2C4-aFC-IZ-5.cjs} +2 -2
- package/dist/{tail-R4PCA2C4-i-B-y3p3.cjs.map → tail-R4PCA2C4-aFC-IZ-5.cjs.map} +1 -1
- package/dist/{tar-STHHZTZ6-DtxccnMn.mjs → tar-STHHZTZ6-CiLELmgx.mjs} +4 -4
- package/dist/{tar-STHHZTZ6-DtxccnMn.mjs.map → tar-STHHZTZ6-CiLELmgx.mjs.map} +1 -1
- package/dist/{tar-STHHZTZ6-Clod8w-7.cjs → tar-STHHZTZ6-L8XDCiLN.cjs} +5 -5
- package/dist/{tar-STHHZTZ6-Clod8w-7.cjs.map → tar-STHHZTZ6-L8XDCiLN.cjs.map} +1 -1
- package/dist/{tee-YUZ2FKCJ-D-CtYfsh.mjs → tee-YUZ2FKCJ-3s4KqGaV.mjs} +2 -2
- package/dist/{tee-YUZ2FKCJ-D-CtYfsh.mjs.map → tee-YUZ2FKCJ-3s4KqGaV.mjs.map} +1 -1
- package/dist/{tee-YUZ2FKCJ-CA1OTWbX.cjs → tee-YUZ2FKCJ-B60QipOE.cjs} +2 -2
- package/dist/{tee-YUZ2FKCJ-CA1OTWbX.cjs.map → tee-YUZ2FKCJ-B60QipOE.cjs.map} +1 -1
- package/dist/{time-D4LNBSWX-IFH0Z_hE.mjs → time-D4LNBSWX-CYd4omvD.mjs} +2 -2
- package/dist/{time-D4LNBSWX-IFH0Z_hE.mjs.map → time-D4LNBSWX-CYd4omvD.mjs.map} +1 -1
- package/dist/{time-D4LNBSWX-q9wKyv5x.cjs → time-D4LNBSWX-DBg3ccZo.cjs} +2 -2
- package/dist/{time-D4LNBSWX-q9wKyv5x.cjs.map → time-D4LNBSWX-DBg3ccZo.cjs.map} +1 -1
- package/dist/{timeout-YDCRSLPQ-Da0SBn_a.cjs → timeout-YDCRSLPQ-DMiY-QQp.cjs} +2 -2
- package/dist/{timeout-YDCRSLPQ-Da0SBn_a.cjs.map → timeout-YDCRSLPQ-DMiY-QQp.cjs.map} +1 -1
- package/dist/{timeout-YDCRSLPQ-D9VSfglD.mjs → timeout-YDCRSLPQ-xh3AcbT0.mjs} +2 -2
- package/dist/{timeout-YDCRSLPQ-D9VSfglD.mjs.map → timeout-YDCRSLPQ-xh3AcbT0.mjs.map} +1 -1
- package/dist/{touch-UA33VN3N-DGBoWnSy.cjs → touch-UA33VN3N-ChzEhlVJ.cjs} +2 -2
- package/dist/{touch-UA33VN3N-DGBoWnSy.cjs.map → touch-UA33VN3N-ChzEhlVJ.cjs.map} +1 -1
- package/dist/{touch-UA33VN3N-1UUeRAKx.mjs → touch-UA33VN3N-DEM7K4Oi.mjs} +2 -2
- package/dist/{touch-UA33VN3N-1UUeRAKx.mjs.map → touch-UA33VN3N-DEM7K4Oi.mjs.map} +1 -1
- package/dist/{tr-36LHWFRQ-CstIHbkC.mjs → tr-36LHWFRQ-Bs_CFglo.mjs} +2 -2
- package/dist/{tr-36LHWFRQ-CstIHbkC.mjs.map → tr-36LHWFRQ-Bs_CFglo.mjs.map} +1 -1
- package/dist/{tr-36LHWFRQ-MVEkMzHp.cjs → tr-36LHWFRQ-WSAxLcKD.cjs} +2 -2
- package/dist/{tr-36LHWFRQ-MVEkMzHp.cjs.map → tr-36LHWFRQ-WSAxLcKD.cjs.map} +1 -1
- package/dist/{tree-YLD52CNT-DQ6Fwa4k.cjs → tree-YLD52CNT-B55yybrR.cjs} +2 -2
- package/dist/{tree-YLD52CNT-DQ6Fwa4k.cjs.map → tree-YLD52CNT-B55yybrR.cjs.map} +1 -1
- package/dist/{tree-YLD52CNT-C4uRw4dn.mjs → tree-YLD52CNT-Bv7uMDP4.mjs} +2 -2
- package/dist/{tree-YLD52CNT-C4uRw4dn.mjs.map → tree-YLD52CNT-Bv7uMDP4.mjs.map} +1 -1
- package/dist/{unexpand-CADSA4VO-DWPCufVa.mjs → unexpand-CADSA4VO-969cCtfJ.mjs} +2 -2
- package/dist/{unexpand-CADSA4VO-DWPCufVa.mjs.map → unexpand-CADSA4VO-969cCtfJ.mjs.map} +1 -1
- package/dist/{unexpand-CADSA4VO-C-u8zxhr.cjs → unexpand-CADSA4VO-BHkcjme2.cjs} +2 -2
- package/dist/{unexpand-CADSA4VO-C-u8zxhr.cjs.map → unexpand-CADSA4VO-BHkcjme2.cjs.map} +1 -1
- package/dist/{uniq-XSIZR6PB-DeJyhQjC.mjs → uniq-XSIZR6PB-DfO95Apn.mjs} +3 -3
- package/dist/{uniq-XSIZR6PB-DeJyhQjC.mjs.map → uniq-XSIZR6PB-DfO95Apn.mjs.map} +1 -1
- package/dist/{uniq-XSIZR6PB-CVYPCP3L.cjs → uniq-XSIZR6PB-d0jC5yQd.cjs} +3 -3
- package/dist/{uniq-XSIZR6PB-CVYPCP3L.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-DLzVqiA1.cjs → wc-LF7NU4LA-Bz5pTJq5.cjs} +3 -3
- package/dist/{wc-LF7NU4LA-DLzVqiA1.cjs.map → wc-LF7NU4LA-Bz5pTJq5.cjs.map} +1 -1
- package/dist/{wc-LF7NU4LA-BoW08HoQ.mjs → wc-LF7NU4LA-C1zRuin1.mjs} +3 -3
- package/dist/{wc-LF7NU4LA-BoW08HoQ.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-BBVnthzQ.cjs → xan-Y6WF3IRG-BV1K518F.cjs} +6 -6
- package/dist/{xan-Y6WF3IRG-BBVnthzQ.cjs.map → xan-Y6WF3IRG-BV1K518F.cjs.map} +1 -1
- package/dist/{xan-Y6WF3IRG-BRmYEWtu.mjs → xan-Y6WF3IRG-Cc44_DTM.mjs} +6 -6
- package/dist/{xan-Y6WF3IRG-BRmYEWtu.mjs.map → xan-Y6WF3IRG-Cc44_DTM.mjs.map} +1 -1
- package/dist/{xan-view-HDVKHFC2-BhoMJr7X.cjs → xan-view-HDVKHFC2-DV7rblTJ.cjs} +3 -3
- package/dist/{xan-view-HDVKHFC2-BhoMJr7X.cjs.map → xan-view-HDVKHFC2-DV7rblTJ.cjs.map} +1 -1
- package/dist/{xan-view-HDVKHFC2-U4Q7IJQT.mjs → xan-view-HDVKHFC2-DgGc0G3R.mjs} +3 -3
- package/dist/{xan-view-HDVKHFC2-U4Q7IJQT.mjs.map → xan-view-HDVKHFC2-DgGc0G3R.mjs.map} +1 -1
- package/dist/{xargs-MGZPH7AX-xGYncjHI.cjs → xargs-MGZPH7AX-BBKDagR4.cjs} +2 -2
- package/dist/{xargs-MGZPH7AX-xGYncjHI.cjs.map → xargs-MGZPH7AX-BBKDagR4.cjs.map} +1 -1
- package/dist/{xargs-MGZPH7AX-DCtgUZkv.mjs → xargs-MGZPH7AX-DI6LeEQD.mjs} +2 -2
- package/dist/{xargs-MGZPH7AX-DCtgUZkv.mjs.map → xargs-MGZPH7AX-DI6LeEQD.mjs.map} +1 -1
- package/dist/{yq-4QJW3EQG-J6Z08KkE.mjs → yq-4QJW3EQG-B7bWWIWh.mjs} +3 -3
- package/dist/{yq-4QJW3EQG-J6Z08KkE.mjs.map → yq-4QJW3EQG-B7bWWIWh.mjs.map} +1 -1
- package/dist/{yq-4QJW3EQG-CPbYTaKY.cjs → yq-4QJW3EQG-CnQDxlAc.cjs} +3 -3
- package/dist/{yq-4QJW3EQG-CPbYTaKY.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-BBoSNbv1.mjs.map +0 -1
- package/dist/dist-C-bTIDMw.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-BtqSmIUP.cjs.map +0 -1
- package/dist/start-DMOAi4UM.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,7 +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
|
-
return require_dist
|
|
27918
|
+
return require_dist.jsonSchemaToZod(requestSchema).parse(input ?? {});
|
|
27916
27919
|
}
|
|
27917
27920
|
/**
|
|
27918
27921
|
* Manually start a workflow run from the dashboard. Validates the input against
|
|
@@ -27922,20 +27925,20 @@ function parseRunInput$1(requestSchema, input) {
|
|
|
27922
27925
|
const handler$81 = async (c) => {
|
|
27923
27926
|
const { organizationId } = c.get("organization");
|
|
27924
27927
|
const workflowId = c.req.param("workflowId") ?? "";
|
|
27925
|
-
if (!workflowId.trim()) return c.json(require_dist
|
|
27928
|
+
if (!workflowId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid workflow id" }), 400);
|
|
27926
27929
|
const resolved = await resolveWorkflow(c, workflowId);
|
|
27927
|
-
if (!resolved) return c.json(require_dist
|
|
27930
|
+
if (!resolved) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Workflow not found" }), 404);
|
|
27928
27931
|
const { row, projectId } = resolved;
|
|
27929
27932
|
const requestSchema = await resolveWorkflowRequestSchema(projectId, row);
|
|
27930
|
-
if (!requestSchema) return c.json(require_dist
|
|
27933
|
+
if (!requestSchema) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Workflow not deployed" }), 404);
|
|
27931
27934
|
let body = {};
|
|
27932
27935
|
if ((c.req.header("content-type") ?? "").includes("application/json")) try {
|
|
27933
27936
|
body = await c.req.json();
|
|
27934
27937
|
} catch {
|
|
27935
|
-
return c.json(require_dist
|
|
27938
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid JSON body" }), 400);
|
|
27936
27939
|
}
|
|
27937
27940
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
27938
|
-
if (!organization) return c.json(require_dist
|
|
27941
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
27939
27942
|
const userId = c.get("user").id;
|
|
27940
27943
|
try {
|
|
27941
27944
|
const runId = await (0, _keystrokehq_database.runWithProjectScope)(projectId, async () => {
|
|
@@ -27950,14 +27953,14 @@ const handler$81 = async (c) => {
|
|
|
27950
27953
|
});
|
|
27951
27954
|
return c.json({ runId }, 202);
|
|
27952
27955
|
} catch (error) {
|
|
27953
|
-
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);
|
|
27954
27957
|
throw error;
|
|
27955
27958
|
}
|
|
27956
27959
|
};
|
|
27957
27960
|
//#endregion
|
|
27958
27961
|
//#region src/routes/account/workflows/[workflowId]/form/shared.ts
|
|
27959
27962
|
function publishedFormResponse(form, workflowId) {
|
|
27960
|
-
return require_dist
|
|
27963
|
+
return require_dist.PublishedFormSchema.parse({
|
|
27961
27964
|
id: form.id,
|
|
27962
27965
|
workflowId,
|
|
27963
27966
|
workflowSlug: form.workflowSlug,
|
|
@@ -27972,10 +27975,10 @@ function publishedFormResponse(form, workflowId) {
|
|
|
27972
27975
|
}
|
|
27973
27976
|
async function resolveFormWorkflow(c, { requireManageAccess = false } = {}) {
|
|
27974
27977
|
const workflowId = c.req.param("workflowId")?.trim();
|
|
27975
|
-
if (!workflowId) return c.json(require_dist
|
|
27978
|
+
if (!workflowId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid workflow id" }), 400);
|
|
27976
27979
|
const workflow = await resolveWorkflow(c, workflowId);
|
|
27977
|
-
if (!workflow) return c.json(require_dist
|
|
27978
|
-
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);
|
|
27979
27982
|
return {
|
|
27980
27983
|
workflowId,
|
|
27981
27984
|
projectId: workflow.projectId,
|
|
@@ -27985,10 +27988,10 @@ async function resolveFormWorkflow(c, { requireManageAccess = false } = {}) {
|
|
|
27985
27988
|
async function resolvePublishableInputSchema(projectId, row) {
|
|
27986
27989
|
const requestSchema = await resolveWorkflowRequestSchema(projectId, row);
|
|
27987
27990
|
if (!requestSchema) return new Response(JSON.stringify({ error: "Workflow not deployed" }), { status: 404 });
|
|
27988
|
-
const inputSchema = require_dist
|
|
27991
|
+
const inputSchema = require_dist.jsonSchemaToWorkflowInputSchema(requestSchema);
|
|
27989
27992
|
if (inputSchema.fields.length === 0) return new Response(JSON.stringify({ error: "Workflow does not accept inputs" }), { status: 409 });
|
|
27990
|
-
if (require_dist
|
|
27991
|
-
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 });
|
|
27992
27995
|
return inputSchema;
|
|
27993
27996
|
}
|
|
27994
27997
|
//#endregion
|
|
@@ -27998,23 +28001,23 @@ const handler$80 = async (c) => {
|
|
|
27998
28001
|
if (resolved instanceof Response) return resolved;
|
|
27999
28002
|
const { organizationId } = c.get("organization");
|
|
28000
28003
|
const form = await (0, _keystrokehq_platform_database.selectPublishedFormForWorkflow)(organizationId, resolved.projectId, resolved.row.slug);
|
|
28001
|
-
return c.json(require_dist
|
|
28004
|
+
return c.json(require_dist.WorkflowFormResponseSchema.parse(form ? publishedFormResponse(form, resolved.workflowId) : null));
|
|
28002
28005
|
};
|
|
28003
28006
|
//#endregion
|
|
28004
28007
|
//#region src/routes/account/workflows/[workflowId]/form/PUT.ts
|
|
28005
28008
|
const handler$79 = async (c) => {
|
|
28006
28009
|
const resolved = await resolveFormWorkflow(c, { requireManageAccess: true });
|
|
28007
28010
|
if (resolved instanceof Response) return resolved;
|
|
28008
|
-
const body = require_dist
|
|
28011
|
+
const body = require_dist.WorkflowFormUpsertBodySchema.safeParse(await c.req.json().catch(() => null));
|
|
28009
28012
|
if (!body.success) {
|
|
28010
28013
|
const message = body.error.issues[0]?.message ?? "Invalid request body";
|
|
28011
|
-
return c.json(require_dist
|
|
28014
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: message }), 400);
|
|
28012
28015
|
}
|
|
28013
28016
|
const inputSchema = await resolvePublishableInputSchema(resolved.projectId, resolved.row);
|
|
28014
28017
|
if (inputSchema instanceof Response) return inputSchema;
|
|
28015
28018
|
if (body.data.fieldConfig) {
|
|
28016
|
-
const validation = require_dist
|
|
28017
|
-
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);
|
|
28018
28021
|
}
|
|
28019
28022
|
const { organizationId } = c.get("organization");
|
|
28020
28023
|
const form = await (0, _keystrokehq_platform_database.upsertPublishedForm)({
|
|
@@ -28036,7 +28039,7 @@ const handler$78 = async (c) => {
|
|
|
28036
28039
|
if (resolved instanceof Response) return resolved;
|
|
28037
28040
|
const { organizationId } = c.get("organization");
|
|
28038
28041
|
const form = await (0, _keystrokehq_platform_database.unpublishFormForWorkflow)(organizationId, resolved.projectId, resolved.row.slug);
|
|
28039
|
-
if (!form) return c.json(require_dist
|
|
28042
|
+
if (!form) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Form not found" }), 404);
|
|
28040
28043
|
return c.json(publishedFormResponse(form, resolved.workflowId));
|
|
28041
28044
|
};
|
|
28042
28045
|
//#endregion
|
|
@@ -28046,7 +28049,7 @@ const handler$77 = async (c) => {
|
|
|
28046
28049
|
if (resolved instanceof Response) return resolved;
|
|
28047
28050
|
const { organizationId } = c.get("organization");
|
|
28048
28051
|
const form = await (0, _keystrokehq_platform_database.rotatePublishedFormToken)(organizationId, resolved.projectId, resolved.row.slug);
|
|
28049
|
-
if (!form) return c.json(require_dist
|
|
28052
|
+
if (!form) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Form not found" }), 404);
|
|
28050
28053
|
return c.json(publishedFormResponse(form, resolved.workflowId));
|
|
28051
28054
|
};
|
|
28052
28055
|
//#endregion
|
|
@@ -28054,7 +28057,7 @@ const handler$77 = async (c) => {
|
|
|
28054
28057
|
function extensionFromUpload$1(contentType, filename) {
|
|
28055
28058
|
const fromName = filename.includes(".") ? filename.split(".").pop()?.toLowerCase() : void 0;
|
|
28056
28059
|
if (fromName && /^[a-z0-9]+$/.test(fromName)) return fromName;
|
|
28057
|
-
return require_dist
|
|
28060
|
+
return require_dist.chatAttachmentExtension(contentType) ?? "bin";
|
|
28058
28061
|
}
|
|
28059
28062
|
/**
|
|
28060
28063
|
* Presign an upload for a file attached to a manual workflow run. Storage is
|
|
@@ -28066,22 +28069,22 @@ function extensionFromUpload$1(contentType, filename) {
|
|
|
28066
28069
|
const handler$76 = async (c) => {
|
|
28067
28070
|
const { organizationId } = c.get("organization");
|
|
28068
28071
|
const workflowId = c.req.param("workflowId") ?? "";
|
|
28069
|
-
if (!workflowId.trim()) return c.json(require_dist
|
|
28072
|
+
if (!workflowId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid workflow id" }), 400);
|
|
28070
28073
|
const resolved = await resolveWorkflow(c, workflowId);
|
|
28071
|
-
if (!resolved) return c.json(require_dist
|
|
28074
|
+
if (!resolved) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Workflow not found" }), 404);
|
|
28072
28075
|
const { projectId } = resolved;
|
|
28073
|
-
const parsed = require_dist
|
|
28074
|
-
if (!parsed.success) return c.json(require_dist
|
|
28075
|
-
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);
|
|
28076
28079
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
28077
|
-
if (!organization) return c.json(require_dist
|
|
28080
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
28078
28081
|
const ext = extensionFromUpload$1(parsed.data.contentType, parsed.data.filename);
|
|
28079
|
-
const storageKey = require_dist
|
|
28082
|
+
const storageKey = require_dist.chatAttachmentStorageKey(projectId, crypto.randomUUID(), ext);
|
|
28080
28083
|
const uploadUrl = await (0, _keystrokehq_platform_database.createOrgStorageClient)(organization).presignPut({
|
|
28081
28084
|
key: storageKey,
|
|
28082
28085
|
contentType: parsed.data.contentType
|
|
28083
28086
|
});
|
|
28084
|
-
return c.json(require_dist
|
|
28087
|
+
return c.json(require_dist.PresignChatAttachmentResponseSchema.parse({
|
|
28085
28088
|
uploadUrl,
|
|
28086
28089
|
storageKey
|
|
28087
28090
|
}));
|
|
@@ -28090,12 +28093,12 @@ const handler$76 = async (c) => {
|
|
|
28090
28093
|
//#region src/routes/account/workflows/[workflowId]/runs/GET.ts
|
|
28091
28094
|
const handler$75 = async (c) => {
|
|
28092
28095
|
const workflowId = c.req.param("workflowId") ?? "";
|
|
28093
|
-
if (!workflowId.trim()) return c.json(require_dist
|
|
28096
|
+
if (!workflowId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid workflow id" }), 400);
|
|
28094
28097
|
const resolved = await resolveWorkflow(c, workflowId);
|
|
28095
|
-
if (!resolved) return c.json(require_dist
|
|
28098
|
+
if (!resolved) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Workflow not found" }), 404);
|
|
28096
28099
|
const { row, projectId } = resolved;
|
|
28097
28100
|
const scope = listScope(c, projectListScope(accessContext(c)));
|
|
28098
|
-
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([]));
|
|
28099
28102
|
const runs = await (0, _keystrokehq_database.listHistoryRuns)({
|
|
28100
28103
|
kind: "workflow",
|
|
28101
28104
|
projectIds: [projectId],
|
|
@@ -28107,7 +28110,7 @@ const handler$75 = async (c) => {
|
|
|
28107
28110
|
const { organizationId } = c.get("organization");
|
|
28108
28111
|
const projects = await (0, _keystrokehq_platform_database.selectProjectsByOrganizationId)(organizationId, { grantedProjectIds: await grantedProjectIds(c, scope) });
|
|
28109
28112
|
const projectNameById = new Map(projects.map((project) => [project.id, project.name]));
|
|
28110
|
-
return c.json(require_dist
|
|
28113
|
+
return c.json(require_dist.HistoryRunListResponseSchema.parse(await enrichHistoryRuns(runs, projectNameById, organizationId)));
|
|
28111
28114
|
};
|
|
28112
28115
|
//#endregion
|
|
28113
28116
|
//#region src/routes/account/workflows/runs/[runId]/cancel/POST.ts
|
|
@@ -28116,7 +28119,7 @@ const handler$74 = (c) => cancelHistoryRun(c, "workflow", _keystrokehq_database.
|
|
|
28116
28119
|
//#region src/routes/account/resources/skills.ts
|
|
28117
28120
|
function toSkillSummary(row) {
|
|
28118
28121
|
const name = row.name?.trim() || titleCaseKey(row.slug);
|
|
28119
|
-
return require_dist
|
|
28122
|
+
return require_dist.SkillSummarySchema.parse({
|
|
28120
28123
|
id: row.id,
|
|
28121
28124
|
slug: row.slug,
|
|
28122
28125
|
name,
|
|
@@ -28130,23 +28133,23 @@ function toSkillSummary(row) {
|
|
|
28130
28133
|
//#region src/routes/account/skills/GET.ts
|
|
28131
28134
|
const handler$73 = async (c) => {
|
|
28132
28135
|
const filter = await resolveListProjectIds(c, listScope(c, skillListScope(accessContext(c))), c.req.query("projectId"));
|
|
28133
|
-
if (filter === "empty") return c.json(require_dist
|
|
28136
|
+
if (filter === "empty") return c.json(require_dist.SkillSummaryListResponseSchema.parse([]));
|
|
28134
28137
|
const rows = await (0, _keystrokehq_database.listActiveSkills)(filter);
|
|
28135
|
-
return c.json(require_dist
|
|
28138
|
+
return c.json(require_dist.SkillSummaryListResponseSchema.parse(rows.map(toSkillSummary)));
|
|
28136
28139
|
};
|
|
28137
28140
|
//#endregion
|
|
28138
28141
|
//#region src/routes/account/skills/[skillId]/GET.ts
|
|
28139
28142
|
const handler$72 = async (c) => {
|
|
28140
28143
|
const skillId = c.req.param("skillId") ?? "";
|
|
28141
28144
|
const row = skillId ? await (0, _keystrokehq_database.selectActiveSkillById)(skillId) : void 0;
|
|
28142
|
-
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));
|
|
28143
28146
|
touchResourceActivityBestEffort({
|
|
28144
28147
|
userId: c.get("user").id,
|
|
28145
28148
|
projectId: row.projectId,
|
|
28146
28149
|
resourceKind: "skill",
|
|
28147
28150
|
resourceId: row.id
|
|
28148
28151
|
});
|
|
28149
|
-
return c.json(require_dist
|
|
28152
|
+
return c.json(require_dist.SkillSummaryDetailResponseSchema.parse(toSkillSummary(row)));
|
|
28150
28153
|
};
|
|
28151
28154
|
//#endregion
|
|
28152
28155
|
//#region src/routes/account/triggers/enrich.ts
|
|
@@ -28167,7 +28170,7 @@ function buildTriggerWebhookUrl(record, tokenByProjectRoute) {
|
|
|
28167
28170
|
const route = webhookRouteFromEndpoint(record.webhookEndpoint);
|
|
28168
28171
|
const token = tokenByProjectRoute.get(webhookTokenKey(record.projectId, route));
|
|
28169
28172
|
if (!token) return null;
|
|
28170
|
-
const platformOrigin =
|
|
28173
|
+
const platformOrigin = require_wait_for_health_XEzPPQIO.resolveExternalPlatformOrigin();
|
|
28171
28174
|
if (!platformOrigin) return null;
|
|
28172
28175
|
return `${`${platformOrigin.replace(/\/$/, "")}/api/projects/${encodeURIComponent(record.projectId)}`}${route.startsWith("/") ? route : `/${route}`}?token=${encodeURIComponent(token)}`;
|
|
28173
28176
|
}
|
|
@@ -28249,43 +28252,43 @@ const handler$71 = async (c) => {
|
|
|
28249
28252
|
const organization = c.get("organization");
|
|
28250
28253
|
const scope = listScope(c, projectListScope(accessContext(c)));
|
|
28251
28254
|
const filter = await resolveListProjectIds(c, scope, c.req.query("projectId"));
|
|
28252
|
-
if (filter === "empty") return c.json(require_dist
|
|
28255
|
+
if (filter === "empty") return c.json(require_dist.WorkspaceTriggerListResponseSchema.parse([]));
|
|
28253
28256
|
const granted = await grantedProjectIds(c, scope);
|
|
28254
28257
|
const [records, projects] = await Promise.all([(0, _keystrokehq_database.listWorkspaceTriggers)(filter.projectIds), (0, _keystrokehq_platform_database.selectProjectsByOrganizationId)(organization.organizationId, { grantedProjectIds: granted })]);
|
|
28255
28258
|
const projectNameById = new Map(projects.map((project) => [project.id, project.name]));
|
|
28256
|
-
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))));
|
|
28257
28260
|
};
|
|
28258
28261
|
//#endregion
|
|
28259
28262
|
//#region src/routes/account/triggers/[triggerId]/GET.ts
|
|
28260
28263
|
const handler$70 = async (c) => {
|
|
28261
28264
|
const organization = c.get("organization");
|
|
28262
28265
|
const triggerId = c.req.param("triggerId") ?? "";
|
|
28263
|
-
if (!triggerId.trim()) return c.json(require_dist
|
|
28266
|
+
if (!triggerId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid trigger id" }), 400);
|
|
28264
28267
|
const scope = listScope(c, projectListScope(accessContext(c)));
|
|
28265
28268
|
const filter = await resolveListProjectIds(c, scope);
|
|
28266
|
-
if (filter === "empty") return c.json(require_dist
|
|
28269
|
+
if (filter === "empty") return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28267
28270
|
const record = await (0, _keystrokehq_database.getWorkspaceTriggerById)(triggerId, filter.projectIds);
|
|
28268
|
-
if (!record) return c.json(require_dist
|
|
28271
|
+
if (!record) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28269
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)]);
|
|
28270
28273
|
const projectName = projects.find((project) => project.id === record.projectId)?.name ?? "Unknown project";
|
|
28271
28274
|
const webhookUrl = buildTriggerWebhookUrl(record, webhookTokensByProjectRoute(webhookKeys));
|
|
28272
|
-
return c.json(require_dist
|
|
28275
|
+
return c.json(require_dist.WorkspaceTriggerDetailSchema.parse(toWorkspaceTriggerDetail(record, projectName, webhookUrl)));
|
|
28273
28276
|
};
|
|
28274
28277
|
//#endregion
|
|
28275
28278
|
//#region src/routes/account/triggers/[triggerId]/runs/GET.ts
|
|
28276
28279
|
const handler$69 = async (c) => {
|
|
28277
28280
|
const triggerId = c.req.param("triggerId") ?? "";
|
|
28278
|
-
if (!triggerId.trim()) return c.json(require_dist
|
|
28281
|
+
if (!triggerId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid trigger id" }), 400);
|
|
28279
28282
|
const filter = await resolveListProjectIds(c, listScope(c, projectListScope(accessContext(c))));
|
|
28280
|
-
if (filter === "empty") return c.json(require_dist
|
|
28281
|
-
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({
|
|
28282
28285
|
limit: c.req.query("limit"),
|
|
28283
28286
|
cursor: c.req.query("cursor")?.trim() || void 0,
|
|
28284
28287
|
triggerType: c.req.query("triggerType")?.trim() || void 0,
|
|
28285
28288
|
outcome: c.req.query("outcome")?.trim() || void 0
|
|
28286
28289
|
});
|
|
28287
28290
|
const record = await (0, _keystrokehq_database.getWorkspaceTriggerById)(triggerId, filter.projectIds);
|
|
28288
|
-
if (!record) return c.json(require_dist
|
|
28291
|
+
if (!record) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28289
28292
|
const result = await (0, _keystrokehq_database.listWorkspaceTriggerRunRows)({
|
|
28290
28293
|
projectId: record.projectId,
|
|
28291
28294
|
triggerId: record.id,
|
|
@@ -28294,8 +28297,8 @@ const handler$69 = async (c) => {
|
|
|
28294
28297
|
triggerType: query.triggerType,
|
|
28295
28298
|
outcome: query.outcome
|
|
28296
28299
|
});
|
|
28297
|
-
if (!result) return c.json(require_dist
|
|
28298
|
-
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({
|
|
28299
28302
|
items: result.items.map((item) => toWorkspaceTriggerRunSummary(item, record.assignments)),
|
|
28300
28303
|
nextCursor: result.nextCursor
|
|
28301
28304
|
}));
|
|
@@ -28305,25 +28308,25 @@ const handler$69 = async (c) => {
|
|
|
28305
28308
|
const handler$68 = async (c) => {
|
|
28306
28309
|
const { organizationId } = c.get("organization");
|
|
28307
28310
|
const triggerId = c.req.param("triggerId") ?? "";
|
|
28308
|
-
if (!triggerId.trim()) return c.json(require_dist
|
|
28311
|
+
if (!triggerId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid trigger id" }), 400);
|
|
28309
28312
|
const filter = await resolveListProjectIds(c, listScope(c, projectListScope(accessContext(c))));
|
|
28310
|
-
if (filter === "empty") return c.json(require_dist
|
|
28313
|
+
if (filter === "empty") return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28311
28314
|
const record = await (0, _keystrokehq_database.getWorkspaceTriggerById)(triggerId, filter.projectIds);
|
|
28312
|
-
if (!record) return c.json(require_dist
|
|
28315
|
+
if (!record) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28313
28316
|
const artifact = await (0, _keystrokehq_platform_database.selectActiveProjectArtifactForProject)(record.projectId);
|
|
28314
|
-
if (!artifact || !artifact.sourceManifestJson) return c.json(require_dist
|
|
28315
|
-
const file = require_dist
|
|
28316
|
-
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);
|
|
28317
28320
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
28318
|
-
if (!organization) return c.json(require_dist
|
|
28321
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
28319
28322
|
const storage = (0, _keystrokehq_platform_database.createOrgStorageClient)(organization);
|
|
28320
28323
|
let bytes;
|
|
28321
28324
|
try {
|
|
28322
|
-
bytes = await storage.getObject(require_dist
|
|
28325
|
+
bytes = await storage.getObject(require_dist.projectSourceBlobKey(record.projectId, file.hash));
|
|
28323
28326
|
} catch {
|
|
28324
|
-
return c.json(require_dist
|
|
28327
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: "Source file contents not found" }), 404);
|
|
28325
28328
|
}
|
|
28326
|
-
return c.json(require_dist
|
|
28329
|
+
return c.json(require_dist.WorkspaceTriggerFileSchema.parse({
|
|
28327
28330
|
path: record.sourcePath,
|
|
28328
28331
|
contents: new TextDecoder().decode(bytes)
|
|
28329
28332
|
}));
|
|
@@ -28331,7 +28334,7 @@ const handler$68 = async (c) => {
|
|
|
28331
28334
|
//#endregion
|
|
28332
28335
|
//#region src/routes/account/triggers/[triggerId]/overview/GET.ts
|
|
28333
28336
|
function envelope(row, status, hash) {
|
|
28334
|
-
return require_dist
|
|
28337
|
+
return require_dist.WorkspaceTriggerOverviewSchema.parse({
|
|
28335
28338
|
status,
|
|
28336
28339
|
markdown: row.overviewMarkdown ?? "",
|
|
28337
28340
|
hash,
|
|
@@ -28342,25 +28345,25 @@ function envelope(row, status, hash) {
|
|
|
28342
28345
|
const handler$67 = async (c) => {
|
|
28343
28346
|
const { organizationId } = c.get("organization");
|
|
28344
28347
|
const triggerId = c.req.param("triggerId") ?? "";
|
|
28345
|
-
if (!triggerId.trim()) return c.json(require_dist
|
|
28348
|
+
if (!triggerId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid trigger id" }), 400);
|
|
28346
28349
|
const filter = await resolveListProjectIds(c, listScope(c, projectListScope(accessContext(c))));
|
|
28347
|
-
if (filter === "empty") return c.json(require_dist
|
|
28350
|
+
if (filter === "empty") return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28348
28351
|
const record = await (0, _keystrokehq_database.getWorkspaceTriggerById)(triggerId, filter.projectIds);
|
|
28349
|
-
if (!record) return c.json(require_dist
|
|
28352
|
+
if (!record) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28350
28353
|
const row = await (0, _keystrokehq_database.runWithProjectScope)(record.projectId, () => (0, _keystrokehq_database.selectTriggerById)(triggerId));
|
|
28351
|
-
if (!row) return c.json(require_dist
|
|
28354
|
+
if (!row) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28352
28355
|
if (row.triggerHash && row.overviewStatus === "ready" && row.overviewHash === row.triggerHash) return c.json(envelope(row, "ready", row.triggerHash));
|
|
28353
28356
|
if (row.triggerHash && row.overviewStatus === "generating" && row.overviewHash === row.triggerHash) return c.json(envelope(row, "generating", row.triggerHash));
|
|
28354
28357
|
const artifact = await (0, _keystrokehq_platform_database.selectActiveProjectArtifactForProject)(record.projectId);
|
|
28355
|
-
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;
|
|
28356
28359
|
if (!file) return c.json(envelope(row, "ready", row.triggerHash ?? row.overviewHash ?? ""));
|
|
28357
28360
|
const effectiveHash = row.triggerHash ?? file.hash;
|
|
28358
28361
|
if (row.overviewStatus === "ready" && row.overviewHash === effectiveHash) return c.json(envelope(row, "ready", effectiveHash));
|
|
28359
28362
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
28360
|
-
if (!organization) return c.json(require_dist
|
|
28363
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
28361
28364
|
let sourceContents;
|
|
28362
28365
|
try {
|
|
28363
|
-
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));
|
|
28364
28367
|
sourceContents = new TextDecoder().decode(bytes);
|
|
28365
28368
|
} catch {
|
|
28366
28369
|
await (0, _keystrokehq_database.runWithProjectScope)(record.projectId, () => (0, _keystrokehq_database.updateTriggerOverview)(triggerId, { status: "failed" }));
|
|
@@ -28379,7 +28382,7 @@ const handler$67 = async (c) => {
|
|
|
28379
28382
|
triggerId,
|
|
28380
28383
|
projectId: record.projectId,
|
|
28381
28384
|
triggerHash: effectiveHash,
|
|
28382
|
-
model: require_dist
|
|
28385
|
+
model: require_dist.DEFAULT_TRIGGER_OVERVIEW_MODEL,
|
|
28383
28386
|
input: {
|
|
28384
28387
|
name: record.name,
|
|
28385
28388
|
description: record.description,
|
|
@@ -28425,32 +28428,32 @@ const handler$66 = async (c) => {
|
|
|
28425
28428
|
const organization = c.get("organization");
|
|
28426
28429
|
const triggerId = c.req.param("triggerId") ?? "";
|
|
28427
28430
|
const attachmentId = c.req.param("attachmentId") ?? "";
|
|
28428
|
-
if (!triggerId.trim() || !attachmentId.trim()) return c.json(require_dist
|
|
28429
|
-
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));
|
|
28430
28433
|
if (!parsed.success) {
|
|
28431
28434
|
const message = parsed.error.issues[0]?.message ?? "Invalid request body";
|
|
28432
|
-
return c.json(require_dist
|
|
28435
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: message }), 400);
|
|
28433
28436
|
}
|
|
28434
28437
|
const scope = listScope(c, projectListScope(accessContext(c)));
|
|
28435
28438
|
const filter = await resolveListProjectIds(c, scope);
|
|
28436
|
-
if (filter === "empty") return c.json(require_dist
|
|
28439
|
+
if (filter === "empty") return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28437
28440
|
const record = await (0, _keystrokehq_database.getWorkspaceTriggerById)(triggerId, filter.projectIds);
|
|
28438
|
-
if (!record) return c.json(require_dist
|
|
28439
|
-
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);
|
|
28440
28443
|
if (!await canPerformProjectAction(c, record.projectId, projectActions.deploy)) return forbidden(c);
|
|
28441
28444
|
const updated = await (0, _keystrokehq_database.runWithProjectScope)(record.projectId, () => (0, _keystrokehq_database.setTriggerAttachmentEnabledState)({
|
|
28442
28445
|
triggerId,
|
|
28443
28446
|
attachmentId,
|
|
28444
28447
|
enabled: parsed.data.enabled
|
|
28445
28448
|
}));
|
|
28446
|
-
if (!updated) return c.json(require_dist
|
|
28449
|
+
if (!updated) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Attachment not found" }), 404);
|
|
28447
28450
|
await syncNativeTriggerSchedule(organization.row, updated.trigger);
|
|
28448
28451
|
const refreshed = await (0, _keystrokehq_database.getWorkspaceTriggerById)(triggerId, [record.projectId]);
|
|
28449
|
-
if (!refreshed) return c.json(require_dist
|
|
28452
|
+
if (!refreshed) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28450
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)]);
|
|
28451
28454
|
const projectName = projects.find((project) => project.id === refreshed.projectId)?.name ?? "Unknown project";
|
|
28452
28455
|
const webhookUrl = buildTriggerWebhookUrl(refreshed, webhookTokensByProjectRoute(webhookKeys));
|
|
28453
|
-
return c.json(require_dist
|
|
28456
|
+
return c.json(require_dist.WorkspaceTriggerDetailSchema.parse(toWorkspaceTriggerDetail(refreshed, projectName, webhookUrl)));
|
|
28454
28457
|
};
|
|
28455
28458
|
//#endregion
|
|
28456
28459
|
//#region src/routes/account/triggers/[triggerId]/invoke/POST.ts
|
|
@@ -28496,31 +28499,31 @@ var InvokeHttpError = class extends Error {
|
|
|
28496
28499
|
const handler$65 = async (c) => {
|
|
28497
28500
|
const { organizationId } = c.get("organization");
|
|
28498
28501
|
const triggerId = c.req.param("triggerId") ?? "";
|
|
28499
|
-
if (!triggerId.trim()) return c.json(require_dist
|
|
28502
|
+
if (!triggerId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid trigger id" }), 400);
|
|
28500
28503
|
let body = {};
|
|
28501
28504
|
if ((c.req.header("content-type") ?? "").includes("application/json")) try {
|
|
28502
28505
|
body = await c.req.json();
|
|
28503
28506
|
} catch {
|
|
28504
|
-
return c.json(require_dist
|
|
28507
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid JSON body" }), 400);
|
|
28505
28508
|
}
|
|
28506
|
-
const parsed = require_dist
|
|
28509
|
+
const parsed = require_dist.TriggerInvokeRequestSchema.safeParse(body);
|
|
28507
28510
|
if (!parsed.success) {
|
|
28508
28511
|
const message = parsed.error.issues[0]?.message ?? "Invalid request body";
|
|
28509
|
-
return c.json(require_dist
|
|
28512
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: message }), 400);
|
|
28510
28513
|
}
|
|
28511
28514
|
const filter = await resolveListProjectIds(c, listScope(c, projectListScope(accessContext(c))));
|
|
28512
|
-
if (filter === "empty") return c.json(require_dist
|
|
28515
|
+
if (filter === "empty") return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28513
28516
|
const record = await (0, _keystrokehq_database.getWorkspaceTriggerById)(triggerId, filter.projectIds);
|
|
28514
|
-
if (!record) return c.json(require_dist
|
|
28517
|
+
if (!record) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28515
28518
|
if (!await canPerformProjectAction(c, record.projectId, projectActions.deploy)) return forbidden(c);
|
|
28516
|
-
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);
|
|
28517
28520
|
const narrowed = narrowAssignments(record.assignments, parsed.data);
|
|
28518
|
-
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);
|
|
28519
28522
|
const targets = enabledAssignments(narrowed);
|
|
28520
|
-
if (targets.length === 0) return c.json(require_dist
|
|
28521
|
-
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);
|
|
28522
28525
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
28523
|
-
if (!organization) return c.json(require_dist
|
|
28526
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
28524
28527
|
const attachmentSlugs = targets.map((entry) => entry.attachmentSlug);
|
|
28525
28528
|
const manualPayload = parsed.data.workflow || parsed.data.agent ? {
|
|
28526
28529
|
manual: true,
|
|
@@ -28554,9 +28557,9 @@ const handler$65 = async (c) => {
|
|
|
28554
28557
|
}));
|
|
28555
28558
|
return runId;
|
|
28556
28559
|
});
|
|
28557
|
-
return c.json(require_dist
|
|
28560
|
+
return c.json(require_dist.TriggerInvokeResponseSchema.parse({ runId }), 202);
|
|
28558
28561
|
} catch (error) {
|
|
28559
|
-
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);
|
|
28560
28563
|
throw error;
|
|
28561
28564
|
}
|
|
28562
28565
|
};
|
|
@@ -28568,11 +28571,11 @@ const handler$65 = async (c) => {
|
|
|
28568
28571
|
*/
|
|
28569
28572
|
const handler$64 = async (c) => {
|
|
28570
28573
|
const triggerId = c.req.param("triggerId") ?? "";
|
|
28571
|
-
if (!triggerId.trim()) return c.json(require_dist
|
|
28574
|
+
if (!triggerId.trim()) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid trigger id" }), 400);
|
|
28572
28575
|
const filter = await resolveListProjectIds(c, listScope(c, projectListScope(accessContext(c))));
|
|
28573
|
-
if (filter === "empty") return c.json(require_dist
|
|
28576
|
+
if (filter === "empty") return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28574
28577
|
const record = await (0, _keystrokehq_database.getWorkspaceTriggerById)(triggerId, filter.projectIds);
|
|
28575
|
-
if (!record) return c.json(require_dist
|
|
28578
|
+
if (!record) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Trigger not found" }), 404);
|
|
28576
28579
|
const { attachments, staticPayload } = await (0, _keystrokehq_database.runWithProjectScope)(record.projectId, async () => {
|
|
28577
28580
|
const trigger = await (0, _keystrokehq_database.selectTriggerById)(record.id);
|
|
28578
28581
|
const source = trigger ? (0, _keystrokehq_database.storedTriggerSourceFromRow)(trigger) : null;
|
|
@@ -28591,7 +28594,7 @@ const handler$64 = async (c) => {
|
|
|
28591
28594
|
staticPayload: source?.kind === "cron" ? source.payload ?? {} : record.type === "cron" ? {} : void 0
|
|
28592
28595
|
};
|
|
28593
28596
|
});
|
|
28594
|
-
return c.json(require_dist
|
|
28597
|
+
return c.json(require_dist.TriggerInvokeInputsSchema.parse({
|
|
28595
28598
|
type: record.type,
|
|
28596
28599
|
attachments,
|
|
28597
28600
|
...staticPayload !== void 0 ? { staticPayload } : {}
|
|
@@ -28600,7 +28603,7 @@ const handler$64 = async (c) => {
|
|
|
28600
28603
|
//#endregion
|
|
28601
28604
|
//#region src/routes/account/resources/recents.ts
|
|
28602
28605
|
function toRecentResource(activity, resource, projectName) {
|
|
28603
|
-
return require_dist
|
|
28606
|
+
return require_dist.RecentResourceSchema.parse({
|
|
28604
28607
|
id: activity.id,
|
|
28605
28608
|
resourceKind: activity.resourceKind,
|
|
28606
28609
|
resourceId: activity.resourceId,
|
|
@@ -28654,7 +28657,7 @@ const handler$63 = async (c) => {
|
|
|
28654
28657
|
skill: new Map(skills.map((row) => [row.id, hydratedResourceFromAgentRow(row)]))
|
|
28655
28658
|
};
|
|
28656
28659
|
const recents = visibleActivities.map((activity) => hydrateRecentResource(activity, lookup, projectNameById)).filter((recent) => recent !== null).sort((left, right) => latestRecentInteractionAt(right) - latestRecentInteractionAt(left));
|
|
28657
|
-
return c.json(require_dist
|
|
28660
|
+
return c.json(require_dist.RecentResourceListResponseSchema.parse(recents));
|
|
28658
28661
|
};
|
|
28659
28662
|
//#endregion
|
|
28660
28663
|
//#region src/routes/account/projects/GET.ts
|
|
@@ -28662,7 +28665,7 @@ const handler$62 = async (c) => {
|
|
|
28662
28665
|
const organization = c.get("organization");
|
|
28663
28666
|
const grantedProjectIdsList = await grantedProjectIds(c, listScope(c, projectListScope(accessContext(c))));
|
|
28664
28667
|
const projects = await (0, _keystrokehq_platform_database.selectProjectsByOrganizationId)(organization.organizationId, { grantedProjectIds: grantedProjectIdsList });
|
|
28665
|
-
return c.json(require_dist
|
|
28668
|
+
return c.json(require_dist.ListProjectsResponseSchema.parse(projects.map(require_dist.mapProject)));
|
|
28666
28669
|
};
|
|
28667
28670
|
//#endregion
|
|
28668
28671
|
//#region src/routes/account/projects/metrics/merge-project-list-metrics.ts
|
|
@@ -28696,7 +28699,7 @@ const handler$61 = async (c) => {
|
|
|
28696
28699
|
const allowed = new Set(grantedProjectIdsList);
|
|
28697
28700
|
metrics = Object.fromEntries(Object.entries(metrics).filter(([projectId]) => allowed.has(projectId)));
|
|
28698
28701
|
}
|
|
28699
|
-
return c.json(require_dist
|
|
28702
|
+
return c.json(require_dist.ListProjectMetricsResponseSchema.parse(metrics));
|
|
28700
28703
|
};
|
|
28701
28704
|
//#endregion
|
|
28702
28705
|
//#region src/routes/account/projects/POST.ts
|
|
@@ -28705,11 +28708,11 @@ function createCreateProjectHandler(projectQuotaGate) {
|
|
|
28705
28708
|
const organization = c.get("organization");
|
|
28706
28709
|
const user = c.get("user");
|
|
28707
28710
|
const body = await c.req.json().catch(() => null);
|
|
28708
|
-
const parsed = require_dist
|
|
28709
|
-
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);
|
|
28710
28713
|
if (projectQuotaGate) {
|
|
28711
28714
|
const verdict = await projectQuotaGate(organization.organizationId);
|
|
28712
|
-
if (!verdict.allow) return c.json(require_dist
|
|
28715
|
+
if (!verdict.allow) return c.json(require_dist.ErrorResponseSchema.parse({ error: verdict.reason }), 403);
|
|
28713
28716
|
}
|
|
28714
28717
|
const project = await (0, _keystrokehq_platform_database.createProjectForOrganization)(organization.organizationId, parsed.data.name, parsed.data.description, user.id);
|
|
28715
28718
|
const projectCount = await (0, _keystrokehq_platform_database.countActiveProjectsForOrganization)(organization.organizationId).catch(() => void 0);
|
|
@@ -28724,25 +28727,25 @@ function createCreateProjectHandler(projectQuotaGate) {
|
|
|
28724
28727
|
organizationId: organization.organizationId,
|
|
28725
28728
|
properties: { project_count: projectCount }
|
|
28726
28729
|
}).catch(() => {});
|
|
28727
|
-
return c.json(require_dist
|
|
28730
|
+
return c.json(require_dist.CreateProjectResponseSchema.parse(require_dist.mapProject(project)), 201);
|
|
28728
28731
|
};
|
|
28729
28732
|
}
|
|
28730
28733
|
//#endregion
|
|
28731
28734
|
//#region src/routes/account/projects/slug-available/GET.ts
|
|
28732
28735
|
const handler$59 = async (c) => {
|
|
28733
28736
|
const organization = c.get("organization");
|
|
28734
|
-
const parsed = require_dist
|
|
28737
|
+
const parsed = require_dist.ProjectSlugAvailabilityQuerySchema.safeParse({
|
|
28735
28738
|
slug: c.req.query("slug"),
|
|
28736
28739
|
excludeProjectId: c.req.query("excludeProjectId")
|
|
28737
28740
|
});
|
|
28738
|
-
if (!parsed.success) return c.json(require_dist
|
|
28741
|
+
if (!parsed.success) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid slug query" }), 400);
|
|
28739
28742
|
const availability = await (0, _keystrokehq_platform_database.checkProjectSlugAvailability)(organization.organizationId, parsed.data.slug, parsed.data.excludeProjectId);
|
|
28740
|
-
return c.json(require_dist
|
|
28743
|
+
return c.json(require_dist.ProjectSlugAvailabilityResponseSchema.parse(availability));
|
|
28741
28744
|
};
|
|
28742
28745
|
//#endregion
|
|
28743
28746
|
//#region src/routes/account/projects/[projectId]/GET.ts
|
|
28744
28747
|
const handler$58 = async (c) => {
|
|
28745
|
-
return c.json(require_dist
|
|
28748
|
+
return c.json(require_dist.ProjectResponseSchema.parse(routeProject(c.get("project"))));
|
|
28746
28749
|
};
|
|
28747
28750
|
//#endregion
|
|
28748
28751
|
//#region src/routes/account/projects/[projectId]/PATCH.ts
|
|
@@ -28750,31 +28753,31 @@ const handler$57 = async (c) => {
|
|
|
28750
28753
|
const organization = c.get("organization");
|
|
28751
28754
|
const project = c.get("project");
|
|
28752
28755
|
const body = await c.req.json().catch(() => null);
|
|
28753
|
-
const parsed = require_dist
|
|
28754
|
-
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);
|
|
28755
28758
|
let updated;
|
|
28756
28759
|
try {
|
|
28757
28760
|
updated = await (0, _keystrokehq_platform_database.updateProjectForOrganization)(organization.organizationId, project.id, parsed.data);
|
|
28758
28761
|
} catch (error) {
|
|
28759
|
-
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);
|
|
28760
28763
|
throw error;
|
|
28761
28764
|
}
|
|
28762
|
-
if (!updated) return c.json(require_dist
|
|
28763
|
-
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)));
|
|
28764
28767
|
};
|
|
28765
28768
|
//#endregion
|
|
28766
28769
|
//#region src/routes/account/projects/[projectId]/DELETE.ts
|
|
28767
28770
|
const handler$56 = async (c) => {
|
|
28768
28771
|
const organization = c.get("organization");
|
|
28769
28772
|
const project = c.get("project");
|
|
28770
|
-
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);
|
|
28771
28774
|
return c.body(null, 204);
|
|
28772
28775
|
};
|
|
28773
28776
|
//#endregion
|
|
28774
28777
|
//#region src/routes/account/projects/[projectId]/deployments/GET.ts
|
|
28775
28778
|
const handler$55 = async (c) => {
|
|
28776
28779
|
const rows = await (0, _keystrokehq_platform_database.selectProjectDeployments)(c.get("project").id);
|
|
28777
|
-
return c.json(require_dist
|
|
28780
|
+
return c.json(require_dist.ListProjectDeploymentsResponseSchema.parse(rows.map(require_dist.mapProjectDeployment)));
|
|
28778
28781
|
};
|
|
28779
28782
|
//#endregion
|
|
28780
28783
|
//#region src/routes/account/projects/[projectId]/artifacts/POST.ts
|
|
@@ -28786,7 +28789,7 @@ const handler$54 = async (c) => {
|
|
|
28786
28789
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
28787
28790
|
if (!organization) return c.json({ error: "Organization not found" }, 404);
|
|
28788
28791
|
const artifactId = crypto.randomUUID();
|
|
28789
|
-
const storageKey = require_dist
|
|
28792
|
+
const storageKey = require_dist.projectArtifactKey(project.id, artifactId);
|
|
28790
28793
|
const storage = (0, _keystrokehq_platform_database.createOrgStorageClient)(organization);
|
|
28791
28794
|
const artifact = await (0, _keystrokehq_platform_database.insertProjectArtifact)({
|
|
28792
28795
|
id: artifactId,
|
|
@@ -28799,8 +28802,8 @@ const handler$54 = async (c) => {
|
|
|
28799
28802
|
contentType: ARTIFACT_CONTENT_TYPE,
|
|
28800
28803
|
expiresInSeconds: DEFAULT_PRESIGN_TTL_SECONDS$1
|
|
28801
28804
|
});
|
|
28802
|
-
return c.json(require_dist
|
|
28803
|
-
artifact: require_dist
|
|
28805
|
+
return c.json(require_dist.CreateProjectArtifactResponseSchema.parse({
|
|
28806
|
+
artifact: require_dist.mapProjectArtifact(artifact),
|
|
28804
28807
|
uploadUrl,
|
|
28805
28808
|
expiresInSeconds: DEFAULT_PRESIGN_TTL_SECONDS$1
|
|
28806
28809
|
}), 201);
|
|
@@ -28819,7 +28822,7 @@ const handler$53 = async (c) => {
|
|
|
28819
28822
|
key: artifact.storageKey,
|
|
28820
28823
|
expiresInSeconds: DEFAULT_PRESIGN_TTL_SECONDS
|
|
28821
28824
|
});
|
|
28822
|
-
return c.json(require_dist
|
|
28825
|
+
return c.json(require_dist.DownloadActiveProjectArtifactResponseSchema.parse({
|
|
28823
28826
|
artifactId: artifact.id,
|
|
28824
28827
|
downloadUrl,
|
|
28825
28828
|
expiresInSeconds: DEFAULT_PRESIGN_TTL_SECONDS
|
|
@@ -28830,20 +28833,20 @@ const handler$53 = async (c) => {
|
|
|
28830
28833
|
const handler$52 = async (c) => {
|
|
28831
28834
|
const project = c.get("project");
|
|
28832
28835
|
const active = await (0, _keystrokehq_platform_database.selectActiveArtifactSourceManifestForProject)(project.id);
|
|
28833
|
-
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);
|
|
28834
28837
|
const { organizationId } = c.get("organization");
|
|
28835
28838
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
28836
|
-
if (!organization) return c.json(require_dist
|
|
28837
|
-
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);
|
|
28838
28841
|
const storage = (0, _keystrokehq_platform_database.createOrgStorageClient)(organization);
|
|
28839
28842
|
let files;
|
|
28840
28843
|
try {
|
|
28841
|
-
files = await require_dist
|
|
28844
|
+
files = await require_dist.loadProjectSourceFiles(storage, project.id, manifest);
|
|
28842
28845
|
} catch (error) {
|
|
28843
28846
|
const message = error instanceof Error ? error.message : "Failed to load source files";
|
|
28844
|
-
return c.json(require_dist
|
|
28847
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: message }), 400);
|
|
28845
28848
|
}
|
|
28846
|
-
return c.json(require_dist
|
|
28849
|
+
return c.json(require_dist.DownloadActiveProjectSourceResponseSchema.parse({
|
|
28847
28850
|
artifactId: active.artifactId,
|
|
28848
28851
|
files
|
|
28849
28852
|
}));
|
|
@@ -28860,20 +28863,20 @@ const handler$51 = async (c) => {
|
|
|
28860
28863
|
const project = c.get("project");
|
|
28861
28864
|
const user = c.get("user");
|
|
28862
28865
|
const artifactId = c.req.param("artifactId");
|
|
28863
|
-
if (!artifactId) return c.json(require_dist
|
|
28866
|
+
if (!artifactId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Artifact id is required" }), 400);
|
|
28864
28867
|
const existing = await (0, _keystrokehq_platform_database.selectProjectArtifactForProject)(artifactId, project.id);
|
|
28865
|
-
if (!existing) return c.json(require_dist
|
|
28866
|
-
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);
|
|
28867
28870
|
const { organizationId } = c.get("organization");
|
|
28868
28871
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
28869
|
-
if (!organization) return c.json(require_dist
|
|
28872
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
28870
28873
|
const storage = (0, _keystrokehq_platform_database.createOrgStorageClient)(organization);
|
|
28871
28874
|
const head = await storage.headObject(existing.storageKey);
|
|
28872
|
-
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);
|
|
28873
28876
|
try {
|
|
28874
28877
|
const artifactBytes = await storage.getObject(existing.storageKey);
|
|
28875
|
-
if (!artifactBytes || artifactBytes.byteLength <= 0) return c.json(require_dist
|
|
28876
|
-
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)));
|
|
28877
28880
|
await validateAgentModelIds(agentModelIdsFromStoredManifest(manifestJson));
|
|
28878
28881
|
const isFirstDeploy = project.activeArtifactId == null;
|
|
28879
28882
|
const workflowCount = manifestJson.entries.filter((entry) => entry.kind === "workflow").length;
|
|
@@ -28882,7 +28885,7 @@ const handler$51 = async (c) => {
|
|
|
28882
28885
|
const skillCount = manifestJson.skills.length;
|
|
28883
28886
|
const hasCustomContent = manifestJson.entries.some((entry) => {
|
|
28884
28887
|
if (entry.kind !== "workflow" && entry.kind !== "agent" && entry.kind !== "action") return false;
|
|
28885
|
-
return !require_dist
|
|
28888
|
+
return !require_dist.isHelloWorldTemplateSlug(entry.slug);
|
|
28886
28889
|
});
|
|
28887
28890
|
const result = await (0, _keystrokehq_platform_database.completeProjectArtifact)({
|
|
28888
28891
|
artifactId,
|
|
@@ -28908,13 +28911,13 @@ const handler$51 = async (c) => {
|
|
|
28908
28911
|
has_custom_content: hasCustomContent
|
|
28909
28912
|
}
|
|
28910
28913
|
}).catch(() => {});
|
|
28911
|
-
return c.json(require_dist
|
|
28912
|
-
artifact: require_dist
|
|
28913
|
-
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)
|
|
28914
28917
|
}));
|
|
28915
28918
|
} catch (error) {
|
|
28916
28919
|
const message = error instanceof Error ? error.message : "Failed to complete artifact";
|
|
28917
|
-
return c.json(require_dist
|
|
28920
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: message }), 400);
|
|
28918
28921
|
}
|
|
28919
28922
|
};
|
|
28920
28923
|
//#endregion
|
|
@@ -28923,17 +28926,17 @@ const SOURCE_BLOB_CONTENT_TYPE = "text/plain; charset=utf-8";
|
|
|
28923
28926
|
const handler$50 = async (c) => {
|
|
28924
28927
|
const project = c.get("project");
|
|
28925
28928
|
const artifactId = c.req.param("artifactId");
|
|
28926
|
-
if (!artifactId) return c.json(require_dist
|
|
28927
|
-
if (!await (0, _keystrokehq_platform_database.selectProjectArtifactForProject)(artifactId, project.id)) return c.json(require_dist
|
|
28928
|
-
const parsed = require_dist
|
|
28929
|
-
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);
|
|
28930
28933
|
const { organizationId } = c.get("organization");
|
|
28931
28934
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
28932
|
-
if (!organization) return c.json(require_dist
|
|
28935
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
28933
28936
|
const storage = (0, _keystrokehq_platform_database.createOrgStorageClient)(organization);
|
|
28934
28937
|
const hashes = [...new Set(parsed.data.blobs.map((blob) => blob.hash))];
|
|
28935
28938
|
const uploads = await Promise.all(hashes.map(async (hash) => {
|
|
28936
|
-
const key = require_dist
|
|
28939
|
+
const key = require_dist.projectSourceBlobKey(project.id, hash);
|
|
28937
28940
|
const head = await storage.headObject(key);
|
|
28938
28941
|
if (head && head.contentLength > 0) return null;
|
|
28939
28942
|
return {
|
|
@@ -28944,20 +28947,20 @@ const handler$50 = async (c) => {
|
|
|
28944
28947
|
})
|
|
28945
28948
|
};
|
|
28946
28949
|
}));
|
|
28947
|
-
return c.json(require_dist
|
|
28950
|
+
return c.json(require_dist.PresignProjectSourceResponseSchema.parse({ uploads: uploads.filter((upload) => upload !== null) }));
|
|
28948
28951
|
};
|
|
28949
28952
|
//#endregion
|
|
28950
28953
|
//#region src/routes/account/projects/[projectId]/artifacts/[artifactId]/source/manifest/POST.ts
|
|
28951
28954
|
const handler$49 = async (c) => {
|
|
28952
28955
|
const project = c.get("project");
|
|
28953
28956
|
const artifactId = c.req.param("artifactId");
|
|
28954
|
-
if (!artifactId) return c.json(require_dist
|
|
28955
|
-
if (!await (0, _keystrokehq_platform_database.selectProjectArtifactForProject)(artifactId, project.id)) return c.json(require_dist
|
|
28956
|
-
const parsed = require_dist
|
|
28957
|
-
if (!parsed.success) return c.json(require_dist
|
|
28958
|
-
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({
|
|
28959
28962
|
files: parsed.data.files.map((file) => ({
|
|
28960
|
-
id: require_dist
|
|
28963
|
+
id: require_dist.projectFileId(file.path),
|
|
28961
28964
|
path: file.path,
|
|
28962
28965
|
hash: file.hash
|
|
28963
28966
|
})),
|
|
@@ -28968,7 +28971,7 @@ const handler$49 = async (c) => {
|
|
|
28968
28971
|
projectId: project.id,
|
|
28969
28972
|
sourceManifestJson: manifest
|
|
28970
28973
|
});
|
|
28971
|
-
return c.json(require_dist
|
|
28974
|
+
return c.json(require_dist.UploadProjectSourceResponseSchema.parse({
|
|
28972
28975
|
ok: true,
|
|
28973
28976
|
fileCount: manifest.files.length
|
|
28974
28977
|
}), 201);
|
|
@@ -28978,27 +28981,27 @@ const handler$49 = async (c) => {
|
|
|
28978
28981
|
function extensionFromUpload(contentType, filename) {
|
|
28979
28982
|
const fromName = filename.includes(".") ? filename.split(".").pop()?.toLowerCase() : void 0;
|
|
28980
28983
|
if (fromName && /^[a-z0-9]+$/.test(fromName)) return fromName;
|
|
28981
|
-
return require_dist
|
|
28984
|
+
return require_dist.chatAttachmentExtension(contentType) ?? "bin";
|
|
28982
28985
|
}
|
|
28983
28986
|
const handler$48 = async (c) => {
|
|
28984
28987
|
const project = c.get("project");
|
|
28985
28988
|
const slug = c.req.param("slug");
|
|
28986
|
-
if (!slug) return c.json(require_dist
|
|
28989
|
+
if (!slug) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Agent slug is required" }), 400);
|
|
28987
28990
|
const agent = await (0, _keystrokehq_database.runWithProjectScope)(project.id, () => (0, _keystrokehq_database.selectAgentBySlug)(slug));
|
|
28988
|
-
if (!agent || agent.projectId !== project.id) return c.json(require_dist
|
|
28989
|
-
const parsed = require_dist
|
|
28990
|
-
if (!parsed.success) return c.json(require_dist
|
|
28991
|
-
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);
|
|
28992
28995
|
const { organizationId } = c.get("organization");
|
|
28993
28996
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
28994
|
-
if (!organization) return c.json(require_dist
|
|
28997
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
28995
28998
|
const ext = extensionFromUpload(parsed.data.contentType, parsed.data.filename);
|
|
28996
|
-
const storageKey = require_dist
|
|
28999
|
+
const storageKey = require_dist.chatAttachmentStorageKey(project.id, crypto.randomUUID(), ext);
|
|
28997
29000
|
const uploadUrl = await (0, _keystrokehq_platform_database.createOrgStorageClient)(organization).presignPut({
|
|
28998
29001
|
key: storageKey,
|
|
28999
29002
|
contentType: parsed.data.contentType
|
|
29000
29003
|
});
|
|
29001
|
-
return c.json(require_dist
|
|
29004
|
+
return c.json(require_dist.PresignChatAttachmentResponseSchema.parse({
|
|
29002
29005
|
uploadUrl,
|
|
29003
29006
|
storageKey
|
|
29004
29007
|
}));
|
|
@@ -29009,14 +29012,14 @@ const handler$47 = async (c) => {
|
|
|
29009
29012
|
const project = c.get("project");
|
|
29010
29013
|
const slug = c.req.param("slug");
|
|
29011
29014
|
const keyParam = c.req.param("key");
|
|
29012
|
-
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);
|
|
29013
29016
|
const storageKey = keyParam.split("/").map((segment) => decodeURIComponent(segment)).join("/");
|
|
29014
|
-
if (!require_dist
|
|
29017
|
+
if (!require_dist.isChatAttachmentStorageKey(storageKey, project.id)) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Attachment not found" }), 404);
|
|
29015
29018
|
const agent = await (0, _keystrokehq_database.runWithProjectScope)(project.id, () => (0, _keystrokehq_database.selectAgentBySlug)(slug));
|
|
29016
|
-
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);
|
|
29017
29020
|
const { organizationId } = c.get("organization");
|
|
29018
29021
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(organizationId);
|
|
29019
|
-
if (!organization) return c.json(require_dist
|
|
29022
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
29020
29023
|
const url = await (0, _keystrokehq_platform_database.createOrgStorageClient)(organization).presignGet({ key: storageKey });
|
|
29021
29024
|
return c.redirect(url, 302);
|
|
29022
29025
|
};
|
|
@@ -29054,18 +29057,18 @@ function resolveSourcePaths(rows, kindDir, filePaths) {
|
|
|
29054
29057
|
const handler$46 = async (c) => {
|
|
29055
29058
|
const project = c.get("project");
|
|
29056
29059
|
const active = await (0, _keystrokehq_platform_database.selectActiveArtifactSourceManifestForProject)(project.id);
|
|
29057
|
-
if (!active || !active.sourceManifestJson) return c.json(require_dist
|
|
29060
|
+
if (!active || !active.sourceManifestJson) return c.json(require_dist.ListProjectFilesResponseSchema.parse({
|
|
29058
29061
|
artifactId: active?.artifactId ?? null,
|
|
29059
29062
|
files: []
|
|
29060
29063
|
}));
|
|
29061
|
-
const manifest = require_dist
|
|
29064
|
+
const manifest = require_dist.StoredProjectSourceManifestSchema.parse(active.sourceManifestJson);
|
|
29062
29065
|
const [agents, workflows, skills] = await Promise.all([
|
|
29063
29066
|
(0, _keystrokehq_database.listActiveAgents)({ projectIds: [project.id] }),
|
|
29064
29067
|
(0, _keystrokehq_database.listActiveWorkflows)({ projectIds: [project.id] }),
|
|
29065
29068
|
(0, _keystrokehq_database.listActiveSkills)({ projectIds: [project.id] })
|
|
29066
29069
|
]);
|
|
29067
29070
|
const filePaths = manifest.files.map((file) => file.path);
|
|
29068
|
-
const resources = require_dist
|
|
29071
|
+
const resources = require_dist.ProjectSourceResourcesSchema.parse({
|
|
29069
29072
|
agents: resolveSourcePaths(agents, "agents", filePaths),
|
|
29070
29073
|
workflows: resolveSourcePaths(workflows, "workflows", filePaths),
|
|
29071
29074
|
skills: skills.map((row) => ({
|
|
@@ -29073,7 +29076,7 @@ const handler$46 = async (c) => {
|
|
|
29073
29076
|
path: row.moduleFile
|
|
29074
29077
|
}))
|
|
29075
29078
|
});
|
|
29076
|
-
return c.json(require_dist
|
|
29079
|
+
return c.json(require_dist.ListProjectFilesResponseSchema.parse({
|
|
29077
29080
|
artifactId: active.artifactId,
|
|
29078
29081
|
files: manifest.files.map((file) => ({
|
|
29079
29082
|
id: file.id,
|
|
@@ -29099,13 +29102,13 @@ function ifNoneMatchMatches(ifNoneMatch, etag) {
|
|
|
29099
29102
|
const handler$45 = async (c) => {
|
|
29100
29103
|
const project = c.get("project");
|
|
29101
29104
|
const artifactId = c.req.param("artifactId");
|
|
29102
|
-
if (!artifactId) return c.json(require_dist
|
|
29105
|
+
if (!artifactId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Artifact id is required" }), 400);
|
|
29103
29106
|
const path = c.req.query("path");
|
|
29104
|
-
if (!path) return c.json(require_dist
|
|
29107
|
+
if (!path) return c.json(require_dist.ErrorResponseSchema.parse({ error: "File path is required" }), 400);
|
|
29105
29108
|
const artifact = await (0, _keystrokehq_platform_database.selectProjectArtifactSourceManifestForProject)(artifactId, project.id);
|
|
29106
|
-
if (!artifact || !artifact.sourceManifestJson) return c.json(require_dist
|
|
29107
|
-
const file = require_dist
|
|
29108
|
-
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);
|
|
29109
29112
|
const etag = `"${file.hash}"`;
|
|
29110
29113
|
const cacheControl = "private, max-age=31536000, immutable";
|
|
29111
29114
|
if (ifNoneMatchMatches(c.req.header("If-None-Match"), etag)) {
|
|
@@ -29117,9 +29120,9 @@ const handler$45 = async (c) => {
|
|
|
29117
29120
|
const storage = (0, _keystrokehq_platform_database.createOrgStorageClient)(organization);
|
|
29118
29121
|
let bytes;
|
|
29119
29122
|
try {
|
|
29120
|
-
bytes = await storage.getObject(require_dist
|
|
29123
|
+
bytes = await storage.getObject(require_dist.projectSourceBlobKey(project.id, file.hash));
|
|
29121
29124
|
} catch {
|
|
29122
|
-
return c.json(require_dist
|
|
29125
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: "File contents not found" }), 404);
|
|
29123
29126
|
}
|
|
29124
29127
|
c.header("ETag", etag);
|
|
29125
29128
|
c.header("Cache-Control", cacheControl);
|
|
@@ -29131,13 +29134,13 @@ const handler$45 = async (c) => {
|
|
|
29131
29134
|
function createProjectReachabilityHandler(hosting) {
|
|
29132
29135
|
return async (c) => {
|
|
29133
29136
|
const project = c.get("project");
|
|
29134
|
-
if (project.status !== "active") return c.json(require_dist
|
|
29137
|
+
if (project.status !== "active") return c.json(require_dist.ProjectReachabilityResponseSchema.parse({ reachable: false }));
|
|
29135
29138
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(project.organizationId);
|
|
29136
|
-
const reachable = await
|
|
29139
|
+
const reachable = await require_with_project_scope.pingProjectTarget({
|
|
29137
29140
|
baseUrl: organization?.baseUrl ?? project.baseUrl,
|
|
29138
29141
|
runtimeId: organization?.runtimeId ?? project.runtimeId
|
|
29139
29142
|
}, { plugin: hosting });
|
|
29140
|
-
return c.json(require_dist
|
|
29143
|
+
return c.json(require_dist.ProjectReachabilityResponseSchema.parse({ reachable }));
|
|
29141
29144
|
};
|
|
29142
29145
|
}
|
|
29143
29146
|
//#endregion
|
|
@@ -29146,7 +29149,7 @@ const handler$44 = async (c) => {
|
|
|
29146
29149
|
const project = c.get("project");
|
|
29147
29150
|
const currentUserId = c.get("user").id;
|
|
29148
29151
|
const members = await (0, _keystrokehq_platform_database.selectProjectMembers)(project.id);
|
|
29149
|
-
return c.json(require_dist
|
|
29152
|
+
return c.json(require_dist.ListProjectMembersResponseSchema.parse(members.map((member) => require_dist.mapProjectMember(member, { isCurrentUser: member.id === currentUserId }))));
|
|
29150
29153
|
};
|
|
29151
29154
|
//#endregion
|
|
29152
29155
|
//#region src/routes/account/projects/[projectId]/members/POST.ts
|
|
@@ -29154,15 +29157,15 @@ const handler$43 = async (c) => {
|
|
|
29154
29157
|
const organization = c.get("organization");
|
|
29155
29158
|
const project = c.get("project");
|
|
29156
29159
|
const body = await c.req.json().catch(() => null);
|
|
29157
|
-
const parsed = require_dist
|
|
29158
|
-
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);
|
|
29159
29162
|
const results = await (0, _keystrokehq_platform_database.inviteProjectMembers)({
|
|
29160
29163
|
projectId: project.id,
|
|
29161
29164
|
organizationId: organization.organizationId,
|
|
29162
29165
|
emails: parsed.data.emails,
|
|
29163
29166
|
role: parsed.data.role
|
|
29164
29167
|
});
|
|
29165
|
-
return c.json(require_dist
|
|
29168
|
+
return c.json(require_dist.InviteProjectMembersResponseSchema.parse(results));
|
|
29166
29169
|
};
|
|
29167
29170
|
//#endregion
|
|
29168
29171
|
//#region src/routes/account/projects/[projectId]/members/[userId]/PATCH.ts
|
|
@@ -29170,14 +29173,14 @@ const handler$42 = async (c) => {
|
|
|
29170
29173
|
const project = c.get("project");
|
|
29171
29174
|
const userId = c.req.param("userId");
|
|
29172
29175
|
const body = await c.req.json().catch(() => null);
|
|
29173
|
-
const parsed = require_dist
|
|
29174
|
-
if (!userId) return c.json(require_dist
|
|
29175
|
-
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);
|
|
29176
29179
|
try {
|
|
29177
29180
|
const member = await (0, _keystrokehq_platform_database.updateProjectMemberRole)(project.id, userId, parsed.data.role);
|
|
29178
|
-
return c.json(require_dist
|
|
29181
|
+
return c.json(require_dist.UpdateProjectMemberResponseSchema.parse(require_dist.mapProjectMember(member)));
|
|
29179
29182
|
} catch (error) {
|
|
29180
|
-
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);
|
|
29181
29184
|
throw error;
|
|
29182
29185
|
}
|
|
29183
29186
|
};
|
|
@@ -29186,12 +29189,12 @@ const handler$42 = async (c) => {
|
|
|
29186
29189
|
const handler$41 = async (c) => {
|
|
29187
29190
|
const project = c.get("project");
|
|
29188
29191
|
const userId = c.req.param("userId");
|
|
29189
|
-
if (!userId) return c.json(require_dist
|
|
29192
|
+
if (!userId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "User id is required" }), 400);
|
|
29190
29193
|
try {
|
|
29191
29194
|
await (0, _keystrokehq_platform_database.removeProjectMember)(project.id, userId);
|
|
29192
29195
|
return c.body(null, 204);
|
|
29193
29196
|
} catch (error) {
|
|
29194
|
-
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);
|
|
29195
29198
|
throw error;
|
|
29196
29199
|
}
|
|
29197
29200
|
};
|
|
@@ -29204,7 +29207,7 @@ const handler$40 = async (c) => {
|
|
|
29204
29207
|
await (0, _keystrokehq_platform_database.removeProjectMember)(project.id, userId);
|
|
29205
29208
|
return c.body(null, 204);
|
|
29206
29209
|
} catch (error) {
|
|
29207
|
-
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);
|
|
29208
29211
|
throw error;
|
|
29209
29212
|
}
|
|
29210
29213
|
};
|
|
@@ -29212,7 +29215,7 @@ const handler$40 = async (c) => {
|
|
|
29212
29215
|
//#region src/routes/account/projects/[projectId]/settings/GET.ts
|
|
29213
29216
|
const handler$39 = async (c) => {
|
|
29214
29217
|
const project = c.get("project");
|
|
29215
|
-
return c.json(require_dist
|
|
29218
|
+
return c.json(require_dist.ProjectSettingsResponseSchema.parse(require_dist.mapProjectSettings(project)));
|
|
29216
29219
|
};
|
|
29217
29220
|
//#endregion
|
|
29218
29221
|
//#region src/routes/account/projects/[projectId]/settings/PATCH.ts
|
|
@@ -29220,15 +29223,15 @@ const handler$38 = async (c) => {
|
|
|
29220
29223
|
const organization = c.get("organization");
|
|
29221
29224
|
const project = c.get("project");
|
|
29222
29225
|
const body = await c.req.json().catch(() => null);
|
|
29223
|
-
const parsed = require_dist
|
|
29224
|
-
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);
|
|
29225
29228
|
const updated = await (0, _keystrokehq_platform_database.updateProjectSettings)(organization.organizationId, project.id, {
|
|
29226
29229
|
description: parsed.data.description,
|
|
29227
29230
|
defaultMemberRole: parsed.data.defaultRole,
|
|
29228
29231
|
invitePermission: parsed.data.invitePermission
|
|
29229
29232
|
});
|
|
29230
|
-
if (!updated) return c.json(require_dist
|
|
29231
|
-
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)));
|
|
29232
29235
|
};
|
|
29233
29236
|
//#endregion
|
|
29234
29237
|
//#region src/routes/account/credentials/enrich.ts
|
|
@@ -29253,10 +29256,10 @@ function canManageCredential(row, userId) {
|
|
|
29253
29256
|
/** Display name derived from the app slug (org-custom slugs use the segment after `/`). */
|
|
29254
29257
|
function displayAppName(appId) {
|
|
29255
29258
|
try {
|
|
29256
|
-
const parsed = require_dist
|
|
29257
|
-
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);
|
|
29258
29261
|
} catch {}
|
|
29259
|
-
return require_dist
|
|
29262
|
+
return require_dist.displayCredentialAppName(appId);
|
|
29260
29263
|
}
|
|
29261
29264
|
function ownerFields(owner) {
|
|
29262
29265
|
if (!owner) return {};
|
|
@@ -29344,7 +29347,7 @@ async function enrichCredentialInstances(rows, organizationId) {
|
|
|
29344
29347
|
const handler$37 = async (c) => {
|
|
29345
29348
|
const organization = c.get("organization");
|
|
29346
29349
|
const user = c.get("user");
|
|
29347
|
-
const query = require_dist
|
|
29350
|
+
const query = require_dist.ListCredentialsPageQuerySchema.parse({
|
|
29348
29351
|
limit: c.req.query("limit") || void 0,
|
|
29349
29352
|
cursor: c.req.query("cursor")?.trim() || void 0
|
|
29350
29353
|
});
|
|
@@ -29359,7 +29362,7 @@ const handler$37 = async (c) => {
|
|
|
29359
29362
|
userId: user.id,
|
|
29360
29363
|
projectIds
|
|
29361
29364
|
})), organization.organizationId);
|
|
29362
|
-
return c.json(require_dist
|
|
29365
|
+
return c.json(require_dist.ListCredentialsPageResponseSchema.parse({
|
|
29363
29366
|
items: credentials,
|
|
29364
29367
|
nextCursor: page.nextCursor
|
|
29365
29368
|
}));
|
|
@@ -29373,7 +29376,7 @@ function withTargetScope$1(target, fn) {
|
|
|
29373
29376
|
const handler$36 = async (c) => {
|
|
29374
29377
|
const organization = c.get("organization");
|
|
29375
29378
|
const user = c.get("user");
|
|
29376
|
-
const parsed = require_dist
|
|
29379
|
+
const parsed = require_dist.CreateCredentialsRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
29377
29380
|
if (!parsed.success) {
|
|
29378
29381
|
const message = parsed.error.issues[0]?.message ?? "Invalid request body";
|
|
29379
29382
|
return c.json({ error: message }, 400);
|
|
@@ -29382,7 +29385,7 @@ const handler$36 = async (c) => {
|
|
|
29382
29385
|
if (input.connectionKind === "manual" && input.value) {
|
|
29383
29386
|
const app = await (0, _keystrokehq_platform_database.selectAppForOrganization)(organization.organizationId, input.appId);
|
|
29384
29387
|
if (app && (0, _keystrokehq_platform_database.hasCredentialFieldTemplate)(app)) {
|
|
29385
|
-
const validation = require_dist
|
|
29388
|
+
const validation = require_dist.validateCredentialValueAgainstFields(app.credentialFields, input.value);
|
|
29386
29389
|
if (!validation.ok) return c.json({ error: validation.message }, 400);
|
|
29387
29390
|
}
|
|
29388
29391
|
}
|
|
@@ -29411,7 +29414,7 @@ const handler$36 = async (c) => {
|
|
|
29411
29414
|
scopeId: user.id
|
|
29412
29415
|
}] : []
|
|
29413
29416
|
];
|
|
29414
|
-
const appName = require_dist
|
|
29417
|
+
const appName = require_dist.displayCredentialAppName(input.appId);
|
|
29415
29418
|
const siblingCounts = /* @__PURE__ */ new Map();
|
|
29416
29419
|
for (const target of targets) {
|
|
29417
29420
|
const siblings = await withTargetScope$1(target, () => (0, _keystrokehq_database.selectCredentialInstancesForScope)(input.appId, target.scopeType, target.scopeId));
|
|
@@ -29421,8 +29424,8 @@ const handler$36 = async (c) => {
|
|
|
29421
29424
|
const createdIds = [];
|
|
29422
29425
|
for (const target of targets) {
|
|
29423
29426
|
const siblings = await withTargetScope$1(target, () => (0, _keystrokehq_database.selectCredentialInstancesForScope)(input.appId, target.scopeType, target.scopeId));
|
|
29424
|
-
const label = require_dist
|
|
29425
|
-
baseLabel: input.label?.trim() || require_dist
|
|
29427
|
+
const label = require_dist.resolveUniqueCredentialInstanceLabel({
|
|
29428
|
+
baseLabel: input.label?.trim() || require_dist.buildCredentialInstanceLabel({
|
|
29426
29429
|
scopeType: target.scopeType,
|
|
29427
29430
|
appName,
|
|
29428
29431
|
projectName: target.projectName
|
|
@@ -29430,7 +29433,7 @@ const handler$36 = async (c) => {
|
|
|
29430
29433
|
takenLabels: siblings.map((row) => row.label)
|
|
29431
29434
|
});
|
|
29432
29435
|
const id = crypto.randomUUID();
|
|
29433
|
-
await withTargetScope$1(target, () => require_dist
|
|
29436
|
+
await withTargetScope$1(target, () => require_dist.setCredentialInstanceSecret({
|
|
29434
29437
|
id,
|
|
29435
29438
|
key: input.appId,
|
|
29436
29439
|
scopeType: target.scopeType,
|
|
@@ -29465,7 +29468,7 @@ const handler$36 = async (c) => {
|
|
|
29465
29468
|
...app?.authKind ? { auth_kind: app.authKind } : {}
|
|
29466
29469
|
}
|
|
29467
29470
|
}).catch(() => {});
|
|
29468
|
-
return c.json(require_dist
|
|
29471
|
+
return c.json(require_dist.CreateCredentialsResponseSchema.parse(credentials), 201);
|
|
29469
29472
|
};
|
|
29470
29473
|
//#endregion
|
|
29471
29474
|
//#region src/routes/account/credentials/access.ts
|
|
@@ -29493,7 +29496,7 @@ const handler$35 = async (c) => {
|
|
|
29493
29496
|
if (!row || toAppCredentialScope(row.scopeType) === null) return c.json({ error: "Credential not found" }, 404);
|
|
29494
29497
|
if (!await canAccessCredentialRow(c, row)) return c.json({ error: "Credential not found" }, 404);
|
|
29495
29498
|
const [credential] = await enrichCredentialInstances([row], organization.organizationId);
|
|
29496
|
-
return c.json(require_dist
|
|
29499
|
+
return c.json(require_dist.GetCredentialResponseSchema.parse(credential));
|
|
29497
29500
|
};
|
|
29498
29501
|
//#endregion
|
|
29499
29502
|
//#region src/routes/account/credentials/[credentialId]/PATCH.ts
|
|
@@ -29545,7 +29548,7 @@ function withDestinationScope(destination, fn) {
|
|
|
29545
29548
|
function sharedConnectionIdFor(row, scopeType, scopeId) {
|
|
29546
29549
|
if (row.authKind !== "oauth_managed" && row.authKind !== "keystroke") return row.sharedConnectionId;
|
|
29547
29550
|
if (!row.connectionId) return row.sharedConnectionId;
|
|
29548
|
-
return require_dist
|
|
29551
|
+
return require_dist.mcpEntityId(scopeType, scopeId);
|
|
29549
29552
|
}
|
|
29550
29553
|
const handler$34 = async (c) => {
|
|
29551
29554
|
const organization = c.get("organization");
|
|
@@ -29554,7 +29557,7 @@ const handler$34 = async (c) => {
|
|
|
29554
29557
|
const existing = credentialId ? await (0, _keystrokehq_database.selectCredentialInstanceById)(credentialId) : void 0;
|
|
29555
29558
|
if (!existing || toAppCredentialScope(existing.scopeType) === null) return c.json({ error: "Credential not found" }, 404);
|
|
29556
29559
|
if (!await canAccessCredentialRow(c, existing) || !canManageCredential(existing, user.id)) return c.json({ error: "Forbidden" }, 403);
|
|
29557
|
-
const parsed = require_dist
|
|
29560
|
+
const parsed = require_dist.UpdateCredentialRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
29558
29561
|
if (!parsed.success) {
|
|
29559
29562
|
const message = parsed.error.issues[0]?.message ?? "Invalid request body";
|
|
29560
29563
|
return c.json({ error: message }, 400);
|
|
@@ -29585,13 +29588,13 @@ const handler$34 = async (c) => {
|
|
|
29585
29588
|
let slug = existing.slug;
|
|
29586
29589
|
let name = existing.name;
|
|
29587
29590
|
if (labelChanged) {
|
|
29588
|
-
slug = require_dist
|
|
29591
|
+
slug = require_dist.deriveCredentialInstanceSlug({
|
|
29589
29592
|
appSlug: existing.appSlug,
|
|
29590
29593
|
name: label,
|
|
29591
29594
|
takenSlugs: siblings.filter((row) => row.id !== credentialId).map((row) => row.slug)
|
|
29592
29595
|
});
|
|
29593
29596
|
name = label;
|
|
29594
|
-
} 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({
|
|
29595
29598
|
appSlug: existing.appSlug,
|
|
29596
29599
|
name: label,
|
|
29597
29600
|
takenSlugs: siblings.filter((row) => row.id !== credentialId).map((row) => row.slug)
|
|
@@ -29599,7 +29602,7 @@ const handler$34 = async (c) => {
|
|
|
29599
29602
|
const sharedConnectionId = sharedConnectionIdFor(existing, scopeType, scopeId ?? "");
|
|
29600
29603
|
const persist = async () => {
|
|
29601
29604
|
if (parsed.data.value) {
|
|
29602
|
-
await require_dist
|
|
29605
|
+
await require_dist.setCredentialInstanceSecret({
|
|
29603
29606
|
id: existing.id,
|
|
29604
29607
|
key: existing.appSlug,
|
|
29605
29608
|
slug,
|
|
@@ -29640,7 +29643,7 @@ const handler$34 = async (c) => {
|
|
|
29640
29643
|
else await withCredentialRowScope(existing, persist);
|
|
29641
29644
|
const updated = await (0, _keystrokehq_database.selectCredentialInstanceById)(credentialId);
|
|
29642
29645
|
const [credential] = await enrichCredentialInstances(updated ? [updated] : [], organization.organizationId);
|
|
29643
|
-
return c.json(require_dist
|
|
29646
|
+
return c.json(require_dist.GetCredentialResponseSchema.parse(credential));
|
|
29644
29647
|
};
|
|
29645
29648
|
//#endregion
|
|
29646
29649
|
//#region src/routes/account/credentials/[credentialId]/duplicate/POST.ts
|
|
@@ -29655,7 +29658,7 @@ const handler$33 = async (c) => {
|
|
|
29655
29658
|
const source = credentialId ? await (0, _keystrokehq_database.selectCredentialInstanceById)(credentialId) : void 0;
|
|
29656
29659
|
if (!source || toAppCredentialScope(source.scopeType) === null) return c.json({ error: "Credential not found" }, 404);
|
|
29657
29660
|
if (!await canAccessCredentialRow(c, source) || !canManageCredential(source, user.id)) return c.json({ error: "Forbidden" }, 403);
|
|
29658
|
-
const parsed = require_dist
|
|
29661
|
+
const parsed = require_dist.DuplicateCredentialRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
29659
29662
|
if (!parsed.success) {
|
|
29660
29663
|
const message = parsed.error.issues[0]?.message ?? "Invalid request body";
|
|
29661
29664
|
return c.json({ error: message }, 400);
|
|
@@ -29685,7 +29688,7 @@ const handler$33 = async (c) => {
|
|
|
29685
29688
|
let apiKeyValue;
|
|
29686
29689
|
let keystrokeSecretValue;
|
|
29687
29690
|
if (source.authKind === "api_key") {
|
|
29688
|
-
const raw = await require_dist
|
|
29691
|
+
const raw = await require_dist.readCredentialInstanceSecret(source.id);
|
|
29689
29692
|
if (!raw) return c.json({ error: "Credential secret not found" }, 400);
|
|
29690
29693
|
try {
|
|
29691
29694
|
apiKeyValue = JSON.parse(raw);
|
|
@@ -29693,7 +29696,7 @@ const handler$33 = async (c) => {
|
|
|
29693
29696
|
return c.json({ error: "Credential secret is invalid" }, 400);
|
|
29694
29697
|
}
|
|
29695
29698
|
} else if (source.authKind === "keystroke") {
|
|
29696
|
-
const raw = await require_dist
|
|
29699
|
+
const raw = await require_dist.readCredentialInstanceSecret(source.id);
|
|
29697
29700
|
if (raw) try {
|
|
29698
29701
|
keystrokeSecretValue = JSON.parse(raw);
|
|
29699
29702
|
} catch {
|
|
@@ -29705,11 +29708,11 @@ const handler$33 = async (c) => {
|
|
|
29705
29708
|
const createdIds = [];
|
|
29706
29709
|
for (const target of targets) {
|
|
29707
29710
|
const siblings = await withTargetScope(target, () => (0, _keystrokehq_database.selectCredentialInstancesForScope)(source.appSlug, target.scopeType, target.scopeId));
|
|
29708
|
-
const label = require_dist
|
|
29711
|
+
const label = require_dist.resolveUniqueCredentialInstanceLabel({
|
|
29709
29712
|
baseLabel,
|
|
29710
29713
|
takenLabels: siblings.map((row) => row.label)
|
|
29711
29714
|
});
|
|
29712
|
-
const slug = require_dist
|
|
29715
|
+
const slug = require_dist.deriveCredentialInstanceSlug({
|
|
29713
29716
|
appSlug: source.appSlug,
|
|
29714
29717
|
name: label,
|
|
29715
29718
|
takenSlugs: siblings.map((row) => row.slug)
|
|
@@ -29717,7 +29720,7 @@ const handler$33 = async (c) => {
|
|
|
29717
29720
|
const id = crypto.randomUUID();
|
|
29718
29721
|
await withTargetScope(target, async () => {
|
|
29719
29722
|
if (source.authKind === "api_key") {
|
|
29720
|
-
await require_dist
|
|
29723
|
+
await require_dist.setCredentialInstanceSecret({
|
|
29721
29724
|
id,
|
|
29722
29725
|
key: source.appSlug,
|
|
29723
29726
|
slug,
|
|
@@ -29743,12 +29746,12 @@ const handler$33 = async (c) => {
|
|
|
29743
29746
|
authKind: source.authKind,
|
|
29744
29747
|
ciphertext: null,
|
|
29745
29748
|
connectionId: source.connectionId,
|
|
29746
|
-
sharedConnectionId: source.connectionId ? require_dist
|
|
29749
|
+
sharedConnectionId: source.connectionId ? require_dist.mcpEntityId(target.scopeType, target.scopeId) : source.sharedConnectionId,
|
|
29747
29750
|
grantedScopes: source.grantedScopes,
|
|
29748
29751
|
createdAt: now,
|
|
29749
29752
|
updatedAt: now
|
|
29750
29753
|
});
|
|
29751
|
-
if (source.authKind === "keystroke" && keystrokeSecretValue !== void 0) await require_dist
|
|
29754
|
+
if (source.authKind === "keystroke" && keystrokeSecretValue !== void 0) await require_dist.setCredentialInstanceSecretValue(id, keystrokeSecretValue);
|
|
29752
29755
|
});
|
|
29753
29756
|
createdIds.push(id);
|
|
29754
29757
|
}
|
|
@@ -29758,7 +29761,7 @@ const handler$33 = async (c) => {
|
|
|
29758
29761
|
if (row) rows.push(row);
|
|
29759
29762
|
}
|
|
29760
29763
|
const credentials = await enrichCredentialInstances(rows, organization.organizationId);
|
|
29761
|
-
return c.json(require_dist
|
|
29764
|
+
return c.json(require_dist.DuplicateCredentialsResponseSchema.parse(credentials), 201);
|
|
29762
29765
|
};
|
|
29763
29766
|
//#endregion
|
|
29764
29767
|
//#region src/routes/account/credentials/[credentialId]/DELETE.ts
|
|
@@ -29780,8 +29783,8 @@ function createDeleteCredentialHandler(options = {}) {
|
|
|
29780
29783
|
await options.mcp.revokeConnection((0, _keystrokehq_http.resolveMcpEntityId)(existing), existing.connectionId);
|
|
29781
29784
|
}
|
|
29782
29785
|
}
|
|
29783
|
-
await require_dist
|
|
29784
|
-
} else await require_dist
|
|
29786
|
+
await require_dist.deleteCredentialInstanceSecret(existing.id);
|
|
29787
|
+
} else await require_dist.deleteCredentialInstanceSecret(existing.id);
|
|
29785
29788
|
await (0, _keystrokehq_database.deleteCredentialInstanceById)(credentialId);
|
|
29786
29789
|
return c.body(null, 204);
|
|
29787
29790
|
};
|
|
@@ -29790,7 +29793,7 @@ function createDeleteCredentialHandler(options = {}) {
|
|
|
29790
29793
|
//#region src/routes/account/members/GET.ts
|
|
29791
29794
|
const handler$32 = async (c) => {
|
|
29792
29795
|
const { organizationId } = c.get("organization");
|
|
29793
|
-
const query = require_dist
|
|
29796
|
+
const query = require_dist.ListOrganizationMembersPageQuerySchema.parse({
|
|
29794
29797
|
limit: c.req.query("limit") || void 0,
|
|
29795
29798
|
cursor: c.req.query("cursor")?.trim() || void 0
|
|
29796
29799
|
});
|
|
@@ -29798,8 +29801,8 @@ const handler$32 = async (c) => {
|
|
|
29798
29801
|
...query.limit ? { limit: query.limit } : {},
|
|
29799
29802
|
...query.cursor ? { cursor: query.cursor } : {}
|
|
29800
29803
|
});
|
|
29801
|
-
return c.json(require_dist
|
|
29802
|
-
items: page.items.map(require_dist
|
|
29804
|
+
return c.json(require_dist.ListOrganizationMembersPageResponseSchema.parse({
|
|
29805
|
+
items: page.items.map(require_dist.mapOrganizationMember),
|
|
29803
29806
|
nextCursor: page.nextCursor
|
|
29804
29807
|
}));
|
|
29805
29808
|
};
|
|
@@ -29809,7 +29812,7 @@ function envValue(name) {
|
|
|
29809
29812
|
return process.env[name]?.trim() || void 0;
|
|
29810
29813
|
}
|
|
29811
29814
|
function resolveOrganizationInviteUrl(invitationId) {
|
|
29812
|
-
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)}`;
|
|
29813
29816
|
}
|
|
29814
29817
|
function resolveResendApiKey() {
|
|
29815
29818
|
return envValue("RESEND_API_KEY");
|
|
@@ -29850,8 +29853,8 @@ const handler$31 = async (c) => {
|
|
|
29850
29853
|
const user = c.get("user");
|
|
29851
29854
|
const organization = c.get("organization");
|
|
29852
29855
|
const body = await c.req.json().catch(() => null);
|
|
29853
|
-
const parsed = require_dist
|
|
29854
|
-
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);
|
|
29855
29858
|
const results = await (0, _keystrokehq_platform_database.inviteOrganizationMembers)({
|
|
29856
29859
|
organizationId: organization.organizationId,
|
|
29857
29860
|
invitedByUserId: user.id,
|
|
@@ -29868,7 +29871,7 @@ const handler$31 = async (c) => {
|
|
|
29868
29871
|
inviterName: inviter?.name
|
|
29869
29872
|
});
|
|
29870
29873
|
}
|
|
29871
|
-
return c.json(require_dist
|
|
29874
|
+
return c.json(require_dist.InviteOrganizationMembersResponseSchema.parse(results));
|
|
29872
29875
|
};
|
|
29873
29876
|
//#endregion
|
|
29874
29877
|
//#region src/routes/account/members/[userId]/PATCH.ts
|
|
@@ -29876,14 +29879,14 @@ const handler$30 = async (c) => {
|
|
|
29876
29879
|
const { organizationId } = c.get("organization");
|
|
29877
29880
|
const userId = c.req.param("userId");
|
|
29878
29881
|
const body = await c.req.json().catch(() => null);
|
|
29879
|
-
const parsed = require_dist
|
|
29880
|
-
if (!userId) return c.json(require_dist
|
|
29881
|
-
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);
|
|
29882
29885
|
try {
|
|
29883
29886
|
const member = await (0, _keystrokehq_platform_database.updateOrganizationMemberRole)(organizationId, userId, parsed.data.role);
|
|
29884
|
-
return c.json(require_dist
|
|
29887
|
+
return c.json(require_dist.UpdateOrganizationMemberResponseSchema.parse(require_dist.mapOrganizationMember(member)));
|
|
29885
29888
|
} catch (error) {
|
|
29886
|
-
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);
|
|
29887
29890
|
throw error;
|
|
29888
29891
|
}
|
|
29889
29892
|
};
|
|
@@ -29892,12 +29895,12 @@ const handler$30 = async (c) => {
|
|
|
29892
29895
|
const handler$29 = async (c) => {
|
|
29893
29896
|
const { organizationId } = c.get("organization");
|
|
29894
29897
|
const userId = c.req.param("userId");
|
|
29895
|
-
if (!userId) return c.json(require_dist
|
|
29898
|
+
if (!userId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "User id is required" }), 400);
|
|
29896
29899
|
try {
|
|
29897
29900
|
await (0, _keystrokehq_platform_database.removeOrganizationMember)(organizationId, userId);
|
|
29898
29901
|
return c.body(null, 204);
|
|
29899
29902
|
} catch (error) {
|
|
29900
|
-
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);
|
|
29901
29904
|
throw error;
|
|
29902
29905
|
}
|
|
29903
29906
|
};
|
|
@@ -29905,14 +29908,14 @@ const handler$29 = async (c) => {
|
|
|
29905
29908
|
//#region src/routes/account/invitations/GET.ts
|
|
29906
29909
|
const handler$28 = async (c) => {
|
|
29907
29910
|
const invitations = await (0, _keystrokehq_platform_database.selectPendingInvitationsForUser)(c.get("user").id);
|
|
29908
|
-
return c.json(require_dist
|
|
29911
|
+
return c.json(require_dist.ListOrganizationInvitationsResponseSchema.parse(invitations.map(require_dist.mapOrganizationInvitation)));
|
|
29909
29912
|
};
|
|
29910
29913
|
//#endregion
|
|
29911
29914
|
//#region src/routes/account/invitations/[invitationId]/accept/POST.ts
|
|
29912
29915
|
const handler$27 = async (c) => {
|
|
29913
29916
|
const user = c.get("user");
|
|
29914
29917
|
const invitationId = c.req.param("invitationId");
|
|
29915
|
-
if (!invitationId) return c.json(require_dist
|
|
29918
|
+
if (!invitationId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invitation id is required" }), 400);
|
|
29916
29919
|
try {
|
|
29917
29920
|
const membership = await (0, _keystrokehq_platform_database.acceptInvitation)(invitationId, user.id);
|
|
29918
29921
|
const memberCount = await (0, _keystrokehq_platform_database.countActiveMembersForOrganization)(membership.organization.id).catch(() => void 0);
|
|
@@ -29920,11 +29923,11 @@ const handler$27 = async (c) => {
|
|
|
29920
29923
|
organizationId: membership.organization.id,
|
|
29921
29924
|
properties: { member_count: memberCount }
|
|
29922
29925
|
}).catch(() => {});
|
|
29923
|
-
return c.json(require_dist
|
|
29926
|
+
return c.json(require_dist.AcceptOrganizationInvitationResponseSchema.parse(require_dist.mapUserOrganization(membership)));
|
|
29924
29927
|
} catch (error) {
|
|
29925
|
-
if (error instanceof _keystrokehq_platform_database.OrganizationInvitationNotFoundError) return c.json(require_dist
|
|
29926
|
-
if (error instanceof _keystrokehq_platform_database.OrganizationInvitationForbiddenError) return c.json(require_dist
|
|
29927
|
-
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);
|
|
29928
29931
|
throw error;
|
|
29929
29932
|
}
|
|
29930
29933
|
};
|
|
@@ -29933,13 +29936,13 @@ const handler$27 = async (c) => {
|
|
|
29933
29936
|
const handler$26 = async (c) => {
|
|
29934
29937
|
const user = c.get("user");
|
|
29935
29938
|
const invitationId = c.req.param("invitationId");
|
|
29936
|
-
if (!invitationId) return c.json(require_dist
|
|
29939
|
+
if (!invitationId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invitation id is required" }), 400);
|
|
29937
29940
|
try {
|
|
29938
29941
|
await (0, _keystrokehq_platform_database.declineInvitation)(invitationId, user.id);
|
|
29939
|
-
return c.json(require_dist
|
|
29942
|
+
return c.json(require_dist.DeclineOrganizationInvitationResponseSchema.parse({ success: true }));
|
|
29940
29943
|
} catch (error) {
|
|
29941
|
-
if (error instanceof _keystrokehq_platform_database.OrganizationInvitationNotFoundError) return c.json(require_dist
|
|
29942
|
-
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);
|
|
29943
29946
|
throw error;
|
|
29944
29947
|
}
|
|
29945
29948
|
};
|
|
@@ -30020,22 +30023,22 @@ function appRowToCustomAppDetail(row) {
|
|
|
30020
30023
|
//#region src/routes/account/apps/GET.ts
|
|
30021
30024
|
const handler$25 = async (c) => {
|
|
30022
30025
|
const apps = (await (0, _keystrokehq_platform_database.listAppsForOrganization)(c.get("organization").organizationId)).map(appRowToCatalogSummary);
|
|
30023
|
-
return c.json(require_dist
|
|
30026
|
+
return c.json(require_dist.ListAppsResponseSchema.parse(apps));
|
|
30024
30027
|
};
|
|
30025
30028
|
//#endregion
|
|
30026
30029
|
//#region src/routes/account/apps/POST.ts
|
|
30027
30030
|
const handler$24 = async (c) => {
|
|
30028
30031
|
const organization = c.get("organization");
|
|
30029
30032
|
const user = c.get("user");
|
|
30030
|
-
const parsed = require_dist
|
|
30033
|
+
const parsed = require_dist.CreateCustomAppRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
30031
30034
|
if (!parsed.success) {
|
|
30032
30035
|
const message = parsed.error.issues[0]?.message ?? "Invalid request body";
|
|
30033
|
-
return c.json(require_dist
|
|
30036
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: message }), 400);
|
|
30034
30037
|
}
|
|
30035
30038
|
const org = await (0, _keystrokehq_platform_database.selectOrganizationById)(organization.organizationId);
|
|
30036
|
-
if (!org) return c.json(require_dist
|
|
30039
|
+
if (!org) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
30037
30040
|
const authKind = parsed.data.authKind ?? (parsed.data.source === "custom" ? "api_key" : void 0);
|
|
30038
|
-
if (!authKind) return c.json(require_dist
|
|
30041
|
+
if (!authKind) return c.json(require_dist.ErrorResponseSchema.parse({ error: "authKind is required" }), 400);
|
|
30039
30042
|
try {
|
|
30040
30043
|
const row = await (0, _keystrokehq_platform_database.createOrgApp)({
|
|
30041
30044
|
organizationId: organization.organizationId,
|
|
@@ -30061,41 +30064,41 @@ const handler$24 = async (c) => {
|
|
|
30061
30064
|
auth_kind: row.authKind
|
|
30062
30065
|
}
|
|
30063
30066
|
}).catch(() => {});
|
|
30064
|
-
return c.json(require_dist
|
|
30067
|
+
return c.json(require_dist.CreateCustomAppResponseSchema.parse(appRowToCustomAppDetail(row)), 201);
|
|
30065
30068
|
} catch (error) {
|
|
30066
|
-
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);
|
|
30067
30070
|
throw error;
|
|
30068
30071
|
}
|
|
30069
30072
|
};
|
|
30070
30073
|
//#endregion
|
|
30071
30074
|
//#region src/routes/account/apps/logo/POST.ts
|
|
30072
30075
|
const handler$23 = async (c) => {
|
|
30073
|
-
const parsed = require_dist
|
|
30074
|
-
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);
|
|
30075
30078
|
const { organizationId } = c.get("organization");
|
|
30076
30079
|
const finalized = await finalizeStoredImageUpload({
|
|
30077
|
-
storage: require_dist
|
|
30080
|
+
storage: require_dist.createAssetsStorageClient(),
|
|
30078
30081
|
storageKey: parsed.data.storageKey,
|
|
30079
|
-
isValidStorageKey: (key) => require_dist
|
|
30080
|
-
buildPublicUrl: require_dist
|
|
30082
|
+
isValidStorageKey: (key) => require_dist.isAppLogoStorageKey(key, organizationId),
|
|
30083
|
+
buildPublicUrl: require_dist.publicKeystrokeAssetsObjectUrl
|
|
30081
30084
|
});
|
|
30082
|
-
if (!finalized.ok) return c.json(require_dist
|
|
30083
|
-
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 }));
|
|
30084
30087
|
};
|
|
30085
30088
|
//#endregion
|
|
30086
30089
|
//#region src/routes/account/apps/logo/presign/POST.ts
|
|
30087
30090
|
const handler$22 = async (c) => {
|
|
30088
|
-
const parsed = require_dist
|
|
30089
|
-
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);
|
|
30090
30093
|
const extension = avatarExtensionForContentType(parsed.data.contentType);
|
|
30091
|
-
if (!extension) return c.json(require_dist
|
|
30094
|
+
if (!extension) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Unsupported image type" }), 400);
|
|
30092
30095
|
const { organizationId } = c.get("organization");
|
|
30093
|
-
const storageKey = require_dist
|
|
30094
|
-
const uploadUrl = await require_dist
|
|
30096
|
+
const storageKey = require_dist.appLogoStorageKey(organizationId, crypto.randomUUID(), extension);
|
|
30097
|
+
const uploadUrl = await require_dist.createAssetsStorageClient().presignPut({
|
|
30095
30098
|
key: storageKey,
|
|
30096
30099
|
contentType: parsed.data.contentType
|
|
30097
30100
|
});
|
|
30098
|
-
return c.json(require_dist
|
|
30101
|
+
return c.json(require_dist.PresignCustomAppLogoResponseSchema.parse({
|
|
30099
30102
|
uploadUrl,
|
|
30100
30103
|
storageKey
|
|
30101
30104
|
}));
|
|
@@ -30103,13 +30106,13 @@ const handler$22 = async (c) => {
|
|
|
30103
30106
|
//#endregion
|
|
30104
30107
|
//#region src/routes/account/apps/discover/POST.ts
|
|
30105
30108
|
const handler$21 = async (c) => {
|
|
30106
|
-
const parsed = require_dist
|
|
30109
|
+
const parsed = require_dist.McpDiscoverRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
30107
30110
|
if (!parsed.success) return c.json({ error: "Invalid request body" }, 400);
|
|
30108
30111
|
try {
|
|
30109
|
-
const result = await require_dist
|
|
30110
|
-
return c.json(require_dist
|
|
30112
|
+
const result = await require_dist.discoverMcpApp(parsed.data.url);
|
|
30113
|
+
return c.json(require_dist.McpDiscoverResponseSchema.parse(result));
|
|
30111
30114
|
} catch (error) {
|
|
30112
|
-
if (error instanceof require_dist
|
|
30115
|
+
if (error instanceof require_dist.PublicHttpUrlError) return c.json({ error: error.message }, 400);
|
|
30113
30116
|
const message = error instanceof Error ? error.message : "Failed to discover MCP server";
|
|
30114
30117
|
return c.json({ error: message }, 502);
|
|
30115
30118
|
}
|
|
@@ -30117,13 +30120,13 @@ const handler$21 = async (c) => {
|
|
|
30117
30120
|
//#endregion
|
|
30118
30121
|
//#region src/routes/account/apps/discover-openapi/POST.ts
|
|
30119
30122
|
const handler$20 = async (c) => {
|
|
30120
|
-
const parsed = require_dist
|
|
30123
|
+
const parsed = require_dist.OpenApiDiscoverRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
30121
30124
|
if (!parsed.success) return c.json({ error: "Invalid request body" }, 400);
|
|
30122
30125
|
try {
|
|
30123
|
-
const result = await require_dist
|
|
30124
|
-
return c.json(require_dist
|
|
30126
|
+
const result = await require_dist.discoverOpenApiApp(parsed.data.url);
|
|
30127
|
+
return c.json(require_dist.OpenApiDiscoverResponseSchema.parse(result));
|
|
30125
30128
|
} catch (error) {
|
|
30126
|
-
if (require_dist
|
|
30129
|
+
if (require_dist.isDiscoveryError(error)) return c.json({
|
|
30127
30130
|
error: error.message,
|
|
30128
30131
|
code: error.code
|
|
30129
30132
|
}, error.status);
|
|
@@ -30134,13 +30137,13 @@ const handler$20 = async (c) => {
|
|
|
30134
30137
|
//#endregion
|
|
30135
30138
|
//#region src/routes/account/apps/discover-graphql/POST.ts
|
|
30136
30139
|
const handler$19 = async (c) => {
|
|
30137
|
-
const parsed = require_dist
|
|
30140
|
+
const parsed = require_dist.GraphqlDiscoverRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
30138
30141
|
if (!parsed.success) return c.json({ error: "Invalid request body" }, 400);
|
|
30139
30142
|
try {
|
|
30140
|
-
const result = await require_dist
|
|
30141
|
-
return c.json(require_dist
|
|
30143
|
+
const result = await require_dist.discoverGraphqlApp(parsed.data.url);
|
|
30144
|
+
return c.json(require_dist.GraphqlDiscoverResponseSchema.parse(result));
|
|
30142
30145
|
} catch (error) {
|
|
30143
|
-
if (require_dist
|
|
30146
|
+
if (require_dist.isDiscoveryError(error)) return c.json({
|
|
30144
30147
|
error: error.message,
|
|
30145
30148
|
code: error.code
|
|
30146
30149
|
}, error.status);
|
|
@@ -30170,7 +30173,7 @@ const handler$18 = async (c) => {
|
|
|
30170
30173
|
const user = c.get("user");
|
|
30171
30174
|
const appSlug = c.req.param("slug")?.trim();
|
|
30172
30175
|
if (!appSlug) return c.json({ error: "App slug is required" }, 400);
|
|
30173
|
-
const parsed = require_dist
|
|
30176
|
+
const parsed = require_dist.StartMcpOAuthConnectionInputSchema.safeParse({
|
|
30174
30177
|
...await c.req.json().catch(() => ({})),
|
|
30175
30178
|
appSlug
|
|
30176
30179
|
});
|
|
@@ -30189,7 +30192,7 @@ const handler$18 = async (c) => {
|
|
|
30189
30192
|
projectNamesById[project.id] = project.name;
|
|
30190
30193
|
}
|
|
30191
30194
|
try {
|
|
30192
|
-
const result = await require_dist
|
|
30195
|
+
const result = await require_dist.beginMcpOAuthConnect({
|
|
30193
30196
|
app,
|
|
30194
30197
|
input: parsed.data,
|
|
30195
30198
|
organizationId: organization.organizationId,
|
|
@@ -30204,10 +30207,10 @@ const handler$18 = async (c) => {
|
|
|
30204
30207
|
},
|
|
30205
30208
|
projectNamesById
|
|
30206
30209
|
});
|
|
30207
|
-
return c.json(require_dist
|
|
30210
|
+
return c.json(require_dist.StartMcpOAuthConnectionResultSchema.parse(result));
|
|
30208
30211
|
} catch (error) {
|
|
30209
|
-
const message = error instanceof require_dist
|
|
30210
|
-
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";
|
|
30211
30214
|
log.error("mcp.oauth.connect.failed", {
|
|
30212
30215
|
app_slug: appSlug,
|
|
30213
30216
|
...app.url && sanitizedUrl(app.url) ? { app_url: sanitizedUrl(app.url) } : {},
|
|
@@ -30216,7 +30219,7 @@ const handler$18 = async (c) => {
|
|
|
30216
30219
|
error_name: error instanceof Error ? error.name : "UnknownError",
|
|
30217
30220
|
error_message: message,
|
|
30218
30221
|
failure_phase: failurePhase,
|
|
30219
|
-
...error instanceof require_dist
|
|
30222
|
+
...error instanceof require_dist.McpOAuthConnectError ? {
|
|
30220
30223
|
...error.diagnostics.correlationId ? { correlation_id: error.diagnostics.correlationId } : {},
|
|
30221
30224
|
...error.diagnostics.authorizationServerUrl ? { authorization_server_url: sanitizedUrl(error.diagnostics.authorizationServerUrl) } : {},
|
|
30222
30225
|
...error.diagnostics.registrationEndpoint ? { registration_endpoint: sanitizedUrl(error.diagnostics.registrationEndpoint) } : {},
|
|
@@ -30267,7 +30270,7 @@ const handler$17 = async (c) => {
|
|
|
30267
30270
|
if (!state) return c.json({ error: "Missing or invalid OAuth state" }, 400);
|
|
30268
30271
|
let payload;
|
|
30269
30272
|
try {
|
|
30270
|
-
payload = await require_dist
|
|
30273
|
+
payload = await require_dist.decodeOAuthState(state);
|
|
30271
30274
|
} catch (error) {
|
|
30272
30275
|
log.error("mcp.oauth.connect.failed", {
|
|
30273
30276
|
failure_phase: "authorization_callback",
|
|
@@ -30311,12 +30314,12 @@ const handler$17 = async (c) => {
|
|
|
30311
30314
|
let appSlug = "mcp";
|
|
30312
30315
|
let callbackPayload;
|
|
30313
30316
|
try {
|
|
30314
|
-
const payload = await require_dist
|
|
30317
|
+
const payload = await require_dist.decodeOAuthState(state);
|
|
30315
30318
|
callbackPayload = payload;
|
|
30316
30319
|
appSlug = payload.appSlug;
|
|
30317
30320
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(payload.organizationId);
|
|
30318
30321
|
if (!organization) return c.json({ error: "Organization not found" }, 404);
|
|
30319
|
-
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({
|
|
30320
30323
|
payload,
|
|
30321
30324
|
code
|
|
30322
30325
|
}))));
|
|
@@ -30350,8 +30353,8 @@ const handler$17 = async (c) => {
|
|
|
30350
30353
|
app: result.appSlug
|
|
30351
30354
|
});
|
|
30352
30355
|
} catch (error) {
|
|
30353
|
-
const failurePhase = error instanceof require_dist
|
|
30354
|
-
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";
|
|
30355
30358
|
log.error("mcp.oauth.connect.failed", {
|
|
30356
30359
|
...callbackPayload ? {
|
|
30357
30360
|
app_slug: callbackPayload.appSlug,
|
|
@@ -30362,7 +30365,7 @@ const handler$17 = async (c) => {
|
|
|
30362
30365
|
failure_phase: failurePhase,
|
|
30363
30366
|
error_name: error instanceof Error ? error.name : "UnknownError",
|
|
30364
30367
|
error_message: message,
|
|
30365
|
-
...error instanceof require_dist
|
|
30368
|
+
...error instanceof require_dist.McpOAuthConnectError ? {
|
|
30366
30369
|
...error.diagnostics.authorizationServerUrl ? { authorization_server_url: sanitizedUrl(error.diagnostics.authorizationServerUrl) } : {},
|
|
30367
30370
|
...error.diagnostics.providerHttpStatus ? { provider_http_status: error.diagnostics.providerHttpStatus } : {},
|
|
30368
30371
|
...error.diagnostics.oauthError ? { oauth_error: error.diagnostics.oauthError } : {}
|
|
@@ -30394,25 +30397,25 @@ const handler$17 = async (c) => {
|
|
|
30394
30397
|
//#region src/routes/account/apps/slug-available/GET.ts
|
|
30395
30398
|
const handler$16 = async (c) => {
|
|
30396
30399
|
const organization = c.get("organization");
|
|
30397
|
-
const parsed = require_dist
|
|
30398
|
-
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);
|
|
30399
30402
|
const org = await (0, _keystrokehq_platform_database.selectOrganizationById)(organization.organizationId);
|
|
30400
|
-
if (!org) return c.json(require_dist
|
|
30403
|
+
if (!org) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Organization not found" }), 404);
|
|
30401
30404
|
const availability = await (0, _keystrokehq_platform_database.checkOrgAppSlugAvailability)(org.slug, parsed.data.slug);
|
|
30402
|
-
return c.json(require_dist
|
|
30405
|
+
return c.json(require_dist.AppSlugAvailabilityResponseSchema.parse(availability));
|
|
30403
30406
|
};
|
|
30404
30407
|
//#endregion
|
|
30405
30408
|
//#region src/routes/account/apps/[slug]/GET.ts
|
|
30406
30409
|
const handler$15 = async (c) => {
|
|
30407
30410
|
const organization = c.get("organization");
|
|
30408
30411
|
const slug = c.req.param("slug") ?? "";
|
|
30409
|
-
if (!slug) return c.json(require_dist
|
|
30412
|
+
if (!slug) return c.json(require_dist.ErrorResponseSchema.parse({ error: "App not found" }), 404);
|
|
30410
30413
|
const row = await (0, _keystrokehq_platform_database.selectAppForOrganization)(organization.organizationId, decodeURIComponent(slug));
|
|
30411
|
-
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);
|
|
30412
30415
|
try {
|
|
30413
|
-
return c.json(require_dist
|
|
30416
|
+
return c.json(require_dist.GetCustomAppResponseSchema.parse(appRowToCustomAppDetail(row)));
|
|
30414
30417
|
} catch {
|
|
30415
|
-
return c.json(require_dist
|
|
30418
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: "App not found" }), 404);
|
|
30416
30419
|
}
|
|
30417
30420
|
};
|
|
30418
30421
|
//#endregion
|
|
@@ -30421,10 +30424,10 @@ const handler$15 = async (c) => {
|
|
|
30421
30424
|
const handler$14 = async (c) => {
|
|
30422
30425
|
const organization = c.get("organization");
|
|
30423
30426
|
const slug = c.req.param("slug") ?? "";
|
|
30424
|
-
if (!slug) return c.json(require_dist
|
|
30427
|
+
if (!slug) return c.json(require_dist.ErrorResponseSchema.parse({ error: "App not found" }), 404);
|
|
30425
30428
|
const row = await (0, _keystrokehq_platform_database.selectAppForOrganization)(organization.organizationId, decodeURIComponent(slug));
|
|
30426
|
-
if (!row) return c.json(require_dist
|
|
30427
|
-
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)));
|
|
30428
30431
|
};
|
|
30429
30432
|
//#endregion
|
|
30430
30433
|
//#region src/routes/account/channel-platforms/GET.ts
|
|
@@ -30432,7 +30435,7 @@ const PLATFORM_FALLBACK_DOMAINS = { slack: "slack.com" };
|
|
|
30432
30435
|
function projectChannelPlatform(row) {
|
|
30433
30436
|
const gateway = GATEWAY_BY_APP_SLUG[row.slug];
|
|
30434
30437
|
if (!gateway) throw new Error(`App ${row.slug} does not support gateway bindings`);
|
|
30435
|
-
return require_dist
|
|
30438
|
+
return require_dist.ChannelPlatformSchema.parse({
|
|
30436
30439
|
key: row.slug,
|
|
30437
30440
|
name: row.name,
|
|
30438
30441
|
appLogoId: row.slug,
|
|
@@ -30454,7 +30457,7 @@ function projectChannelPlatform(row) {
|
|
|
30454
30457
|
const handler$13 = async (c) => {
|
|
30455
30458
|
const organization = c.get("organization");
|
|
30456
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)] : []);
|
|
30457
|
-
return c.json(require_dist
|
|
30460
|
+
return c.json(require_dist.ListChannelPlatformsResponseSchema.parse(platforms));
|
|
30458
30461
|
};
|
|
30459
30462
|
//#endregion
|
|
30460
30463
|
//#region src/routes/account/api-keys/GET.ts
|
|
@@ -30464,7 +30467,7 @@ const handler$12 = async (c) => {
|
|
|
30464
30467
|
const records = apiKeyListScope(accessContext(c)).kind === "all" ? await (0, _keystrokehq_platform_database.listOrgPlatformApiKeysForOrganization)(organizationId) : await (0, _keystrokehq_platform_database.listOrgPlatformApiKeysForUser)(organizationId, user.id);
|
|
30465
30468
|
const creators = await (0, _keystrokehq_platform_database.selectUsersByIds)([...new Set(records.map((record) => record.createdByUserId))]);
|
|
30466
30469
|
const creatorsById = new Map(creators.map((creator) => [creator.id, creator]));
|
|
30467
|
-
return c.json(require_dist
|
|
30470
|
+
return c.json(require_dist.ListApiKeysResponseSchema.parse(records.map((record) => ({
|
|
30468
30471
|
id: record.id,
|
|
30469
30472
|
name: record.name,
|
|
30470
30473
|
keyPreview: record.keyPreview,
|
|
@@ -30478,7 +30481,7 @@ const handler$12 = async (c) => {
|
|
|
30478
30481
|
const handler$11 = async (c) => {
|
|
30479
30482
|
const { organizationId } = c.get("organization");
|
|
30480
30483
|
const user = c.get("user");
|
|
30481
|
-
const body = require_dist
|
|
30484
|
+
const body = require_dist.CreateApiKeyRequestSchema.parse(await c.req.json());
|
|
30482
30485
|
const created = await (0, _keystrokehq_platform_database.createOrgPlatformApiKey)({
|
|
30483
30486
|
organizationId,
|
|
30484
30487
|
userId: user.id,
|
|
@@ -30486,7 +30489,7 @@ const handler$11 = async (c) => {
|
|
|
30486
30489
|
});
|
|
30487
30490
|
const creator = await (0, _keystrokehq_platform_database.loadOrgPlatformApiKeyUser)(user.id);
|
|
30488
30491
|
if (!creator) return c.json({ error: "User not found" }, 404);
|
|
30489
|
-
return c.json(require_dist
|
|
30492
|
+
return c.json(require_dist.CreateApiKeyResponseSchema.parse({
|
|
30490
30493
|
id: created.id,
|
|
30491
30494
|
name: created.name,
|
|
30492
30495
|
keyPreview: created.keyPreview,
|
|
@@ -30502,13 +30505,13 @@ const handler$10 = async (c) => {
|
|
|
30502
30505
|
const { organizationId } = c.get("organization");
|
|
30503
30506
|
const user = c.get("user");
|
|
30504
30507
|
const apiKeyId = c.req.param("apiKeyId");
|
|
30505
|
-
if (!apiKeyId) return c.json(require_dist
|
|
30508
|
+
if (!apiKeyId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "API key id is required" }), 400);
|
|
30506
30509
|
const apiKey = await (0, _keystrokehq_platform_database.selectOrgPlatformApiKeyForOrganization)(apiKeyId, organizationId);
|
|
30507
|
-
if (!apiKey) return c.json(require_dist
|
|
30510
|
+
if (!apiKey) return c.json(require_dist.ErrorResponseSchema.parse({ error: "API key not found" }), 404);
|
|
30508
30511
|
if (!canReadApiKey(accessContext(c), {
|
|
30509
30512
|
userId: user.id,
|
|
30510
30513
|
createdByUserId: apiKey.createdByUserId
|
|
30511
|
-
})) return c.json(require_dist
|
|
30514
|
+
})) return c.json(require_dist.ErrorResponseSchema.parse({ error: "API key not found" }), 404);
|
|
30512
30515
|
if (!canRevokeApiKey(accessContext(c), {
|
|
30513
30516
|
userId: user.id,
|
|
30514
30517
|
createdByUserId: apiKey.createdByUserId
|
|
@@ -30517,7 +30520,7 @@ const handler$10 = async (c) => {
|
|
|
30517
30520
|
await (0, _keystrokehq_platform_database.revokeOrgPlatformApiKey)(apiKeyId, organizationId);
|
|
30518
30521
|
return c.body(null, 204);
|
|
30519
30522
|
} catch (error) {
|
|
30520
|
-
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);
|
|
30521
30524
|
throw error;
|
|
30522
30525
|
}
|
|
30523
30526
|
};
|
|
@@ -30529,14 +30532,14 @@ const handler$9 = async (c) => {
|
|
|
30529
30532
|
const kindParam = c.req.query("kind");
|
|
30530
30533
|
let kind;
|
|
30531
30534
|
if (kindParam) {
|
|
30532
|
-
const kindParsed = require_dist
|
|
30533
|
-
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);
|
|
30534
30537
|
kind = kindParsed.data;
|
|
30535
30538
|
}
|
|
30536
30539
|
const records = await (0, _keystrokehq_platform_database.listManagedServiceCredentialsForOrganization)(organizationId, kind);
|
|
30537
30540
|
const creators = await (0, _keystrokehq_platform_database.selectUsersByIds)([...new Set(records.map((record) => record.createdByUserId))]);
|
|
30538
30541
|
const creatorsById = new Map(creators.map((creator) => [creator.id, creator]));
|
|
30539
|
-
return c.json(require_dist
|
|
30542
|
+
return c.json(require_dist.ListManagedServiceCredentialsResponseSchema.parse(records.map((record) => ({
|
|
30540
30543
|
id: record.id,
|
|
30541
30544
|
kind: record.kind,
|
|
30542
30545
|
provider: record.provider,
|
|
@@ -30556,14 +30559,14 @@ const handler$8 = async (c) => {
|
|
|
30556
30559
|
try {
|
|
30557
30560
|
raw = await c.req.json();
|
|
30558
30561
|
} catch {
|
|
30559
|
-
return c.json(require_dist
|
|
30562
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid JSON body" }), 400);
|
|
30560
30563
|
}
|
|
30561
|
-
const parsed = require_dist
|
|
30562
|
-
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);
|
|
30563
30566
|
const body = parsed.data;
|
|
30564
|
-
if (body.kind === "llm" && !require_dist
|
|
30565
|
-
if (await (0, _keystrokehq_platform_database.getManagedServiceCredential)(organizationId, body.kind, body.provider)) return c.json(require_dist
|
|
30566
|
-
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({
|
|
30567
30570
|
organizationId,
|
|
30568
30571
|
kind: body.kind,
|
|
30569
30572
|
provider: body.provider,
|
|
@@ -30572,8 +30575,8 @@ const handler$8 = async (c) => {
|
|
|
30572
30575
|
});
|
|
30573
30576
|
const row = await (0, _keystrokehq_platform_database.getManagedServiceCredential)(organizationId, body.kind, body.provider);
|
|
30574
30577
|
const creator = await (0, _keystrokehq_platform_database.loadOrgPlatformApiKeyUser)(user.id);
|
|
30575
|
-
if (!row || !creator) return c.json(require_dist
|
|
30576
|
-
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({
|
|
30577
30580
|
id,
|
|
30578
30581
|
kind: row.kind,
|
|
30579
30582
|
provider: row.provider,
|
|
@@ -30590,19 +30593,19 @@ const handler$7 = async (c) => {
|
|
|
30590
30593
|
const { organizationId } = c.get("organization");
|
|
30591
30594
|
const user = c.get("user");
|
|
30592
30595
|
const credentialId = c.req.param("id");
|
|
30593
|
-
if (!credentialId) return c.json(require_dist
|
|
30596
|
+
if (!credentialId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Credential id is required" }), 400);
|
|
30594
30597
|
let raw;
|
|
30595
30598
|
try {
|
|
30596
30599
|
raw = await c.req.json();
|
|
30597
30600
|
} catch {
|
|
30598
|
-
return c.json(require_dist
|
|
30601
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: "Invalid JSON body" }), 400);
|
|
30599
30602
|
}
|
|
30600
|
-
const parsed = require_dist
|
|
30601
|
-
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);
|
|
30602
30605
|
const body = parsed.data;
|
|
30603
30606
|
const existing = await (0, _keystrokehq_platform_database.selectManagedServiceCredentialById)(credentialId);
|
|
30604
|
-
if (!existing || existing.organizationId !== organizationId) return c.json(require_dist
|
|
30605
|
-
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({
|
|
30606
30609
|
organizationId,
|
|
30607
30610
|
kind: existing.kind,
|
|
30608
30611
|
provider: existing.provider,
|
|
@@ -30611,8 +30614,8 @@ const handler$7 = async (c) => {
|
|
|
30611
30614
|
});
|
|
30612
30615
|
const row = await (0, _keystrokehq_platform_database.selectManagedServiceCredentialById)(credentialId);
|
|
30613
30616
|
const creator = await (0, _keystrokehq_platform_database.loadOrgPlatformApiKeyUser)(existing.createdByUserId);
|
|
30614
|
-
if (!row || !creator) return c.json(require_dist
|
|
30615
|
-
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({
|
|
30616
30619
|
id: row.id,
|
|
30617
30620
|
kind: row.kind,
|
|
30618
30621
|
provider: row.provider,
|
|
@@ -30628,10 +30631,10 @@ const handler$7 = async (c) => {
|
|
|
30628
30631
|
const handler$6 = async (c) => {
|
|
30629
30632
|
const { organizationId } = c.get("organization");
|
|
30630
30633
|
const credentialId = c.req.param("id");
|
|
30631
|
-
if (!credentialId) return c.json(require_dist
|
|
30634
|
+
if (!credentialId) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Credential id is required" }), 400);
|
|
30632
30635
|
const existing = await (0, _keystrokehq_platform_database.selectManagedServiceCredentialById)(credentialId);
|
|
30633
|
-
if (!existing || existing.organizationId !== organizationId) return c.json(require_dist
|
|
30634
|
-
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);
|
|
30635
30638
|
return c.body(null, 204);
|
|
30636
30639
|
};
|
|
30637
30640
|
//#endregion
|
|
@@ -30753,7 +30756,7 @@ async function postTeamRequestToSlack(input) {
|
|
|
30753
30756
|
const handler$5 = async (c) => {
|
|
30754
30757
|
const user = c.get("user");
|
|
30755
30758
|
const organizationContext = c.get("organization");
|
|
30756
|
-
const parsed = require_dist
|
|
30759
|
+
const parsed = require_dist.SubmitTeamRequestRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
30757
30760
|
if (!parsed.success) {
|
|
30758
30761
|
const message = parsed.error.issues[0]?.message ?? "Invalid request body";
|
|
30759
30762
|
return c.json({ error: message }, 400);
|
|
@@ -30789,7 +30792,7 @@ const handler$5 = async (c) => {
|
|
|
30789
30792
|
...parsed.data.appSlug ? { app_slug: parsed.data.appSlug } : {}
|
|
30790
30793
|
}
|
|
30791
30794
|
}).catch(() => {});
|
|
30792
|
-
return c.json(require_dist
|
|
30795
|
+
return c.json(require_dist.SubmitTeamRequestResponseSchema.parse({ ok: true }), 200);
|
|
30793
30796
|
};
|
|
30794
30797
|
//#endregion
|
|
30795
30798
|
//#region src/lib/agent-feedback-slack.ts
|
|
@@ -30833,7 +30836,7 @@ async function postAgentFeedbackToSlack(input) {
|
|
|
30833
30836
|
const handler$4 = async (c) => {
|
|
30834
30837
|
const user = c.get("user");
|
|
30835
30838
|
const organizationContext = c.get("organization");
|
|
30836
|
-
const parsed = require_dist
|
|
30839
|
+
const parsed = require_dist.SubmitAgentFeedbackRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
30837
30840
|
if (!parsed.success) {
|
|
30838
30841
|
const message = parsed.error.issues[0]?.message ?? "Invalid request body";
|
|
30839
30842
|
return c.json({ error: message }, 400);
|
|
@@ -30869,7 +30872,7 @@ const handler$4 = async (c) => {
|
|
|
30869
30872
|
message_length: parsed.data.message.length
|
|
30870
30873
|
}
|
|
30871
30874
|
}).catch(() => {});
|
|
30872
|
-
return c.json(require_dist
|
|
30875
|
+
return c.json(require_dist.SubmitAgentFeedbackResponseSchema.parse({ ok: true }), 200);
|
|
30873
30876
|
};
|
|
30874
30877
|
//#endregion
|
|
30875
30878
|
//#region src/routes/account/templates/GET.ts
|
|
@@ -30877,9 +30880,9 @@ function toIso(date) {
|
|
|
30877
30880
|
return date.toISOString();
|
|
30878
30881
|
}
|
|
30879
30882
|
const listTemplatesHandler = async (c) => {
|
|
30880
|
-
const parsedKind = require_dist
|
|
30883
|
+
const parsedKind = require_dist.TemplateKindSchema.safeParse(c.req.query("kind"));
|
|
30881
30884
|
const rows = await (0, _keystrokehq_platform_database.listTemplates)(parsedKind.success ? parsedKind.data : void 0);
|
|
30882
|
-
return c.json(require_dist
|
|
30885
|
+
return c.json(require_dist.ListTemplatesResponseSchema.parse(rows.map((row) => ({
|
|
30883
30886
|
slug: row.slug,
|
|
30884
30887
|
kind: row.kind,
|
|
30885
30888
|
title: row.title,
|
|
@@ -30892,7 +30895,7 @@ const listTemplatesHandler = async (c) => {
|
|
|
30892
30895
|
const getTemplateHandler = async (c) => {
|
|
30893
30896
|
const row = await (0, _keystrokehq_platform_database.selectTemplateBySlug)(c.req.param("slug") ?? "");
|
|
30894
30897
|
if (!row) return c.json({ error: "Template not found" }, 404);
|
|
30895
|
-
return c.json(require_dist
|
|
30898
|
+
return c.json(require_dist.GetTemplateResponseSchema.parse({
|
|
30896
30899
|
slug: row.slug,
|
|
30897
30900
|
kind: row.kind,
|
|
30898
30901
|
title: row.title,
|
|
@@ -30906,7 +30909,7 @@ const getTemplateHandler = async (c) => {
|
|
|
30906
30909
|
const getTemplateFilesHandler = async (c) => {
|
|
30907
30910
|
const row = await (0, _keystrokehq_platform_database.selectTemplateBySlug)(c.req.param("slug") ?? "");
|
|
30908
30911
|
if (!row) return c.json({ error: "Template not found" }, 404);
|
|
30909
|
-
return c.json(require_dist
|
|
30912
|
+
return c.json(require_dist.TemplateFilesResponseSchema.parse({
|
|
30910
30913
|
slug: row.slug,
|
|
30911
30914
|
files: row.files
|
|
30912
30915
|
}));
|
|
@@ -30933,13 +30936,13 @@ function mountAccountRoutes(options) {
|
|
|
30933
30936
|
const requireApiKeyCreate = authorize(apiKeysActions.create);
|
|
30934
30937
|
const requireManagedServicesRead = authorize(managedServicesActions.read);
|
|
30935
30938
|
const requireManagedServicesManage = authorize(managedServicesActions.manage);
|
|
30936
|
-
const requireInvitableRole = authorizePayload(require_dist
|
|
30939
|
+
const requireInvitableRole = authorizePayload(require_dist.InviteOrganizationMembersRequestSchema, ({ ctx, body }) => canInviteRole(ctx.orgRole, body.role));
|
|
30937
30940
|
const requireProjectMember = requireProjectMembership();
|
|
30938
30941
|
const requireProjectDeploy = authorize(projectActions.deploy);
|
|
30939
30942
|
const requireProjectUpdate = authorize(projectActions.update);
|
|
30940
30943
|
const requireProjectDelete = authorize(projectActions.delete);
|
|
30941
30944
|
const requireProjectManageMembers = authorize(projectActions.manageMembers);
|
|
30942
|
-
const requireInvitableProjectRole = authorizePayload(require_dist
|
|
30945
|
+
const requireInvitableProjectRole = authorizePayload(require_dist.InviteProjectMembersRequestSchema, ({ c, ctx, body }) => canInviteToProject(ctx, { invitePermission: getProjectInvitePermission(c) }, body.role));
|
|
30943
30946
|
const requireOrgParam = requireOrganizationParam();
|
|
30944
30947
|
account.get("/organizations", handler$106);
|
|
30945
30948
|
account.get("/organizations/slug-available", handler$105);
|
|
@@ -31188,7 +31191,7 @@ function mountInternalRoutes(workerToken, tokenRefresh, llmProxy, mcp) {
|
|
|
31188
31191
|
const protect = require_with_project_scope.requireWorkerToken(workerToken);
|
|
31189
31192
|
const materialize = (0, _keystrokehq_runtime.createCredentialMaterializeHandler)(tokenRefresh, { resolveSandboxAccessToken: mcp ? (connectionId) => mcp.resolveSandboxAccessToken(connectionId) : void 0 });
|
|
31190
31193
|
internal.use("/orgs/:organizationId/db/*", async (c, next) => {
|
|
31191
|
-
const verified =
|
|
31194
|
+
const verified = require_wait_for_health_XEzPPQIO.verifyOrgWorkerToken(workerToken, require_with_project_scope.readWorkerTokenFromRequest(c));
|
|
31192
31195
|
if (!verified || verified.organizationId !== c.req.param("organizationId")) return c.json({
|
|
31193
31196
|
error: "unauthorized",
|
|
31194
31197
|
message: "Invalid database proxy token."
|
|
@@ -31199,7 +31202,7 @@ function mountInternalRoutes(workerToken, tokenRefresh, llmProxy, mcp) {
|
|
|
31199
31202
|
const organizationId = c.req.param("organizationId");
|
|
31200
31203
|
const organization = await getCachedOrganization(organizationId);
|
|
31201
31204
|
if (!organization) return c.json({ error: "Organization not found" }, 404);
|
|
31202
|
-
const parsed = require_dist
|
|
31205
|
+
const parsed = require_dist.DbProxyQueryRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
31203
31206
|
if (!parsed.success) return c.json({
|
|
31204
31207
|
error: "Invalid request body",
|
|
31205
31208
|
details: parsed.error.flatten()
|
|
@@ -31230,7 +31233,7 @@ function mountInternalRoutes(workerToken, tokenRefresh, llmProxy, mcp) {
|
|
|
31230
31233
|
await next();
|
|
31231
31234
|
});
|
|
31232
31235
|
internal.use("/projects/:projectId/*", async (c, next) => {
|
|
31233
|
-
const verified =
|
|
31236
|
+
const verified = require_wait_for_health_XEzPPQIO.verifyOrgWorkerToken(workerToken, require_with_project_scope.readWorkerTokenFromRequest(c));
|
|
31234
31237
|
if (verified) {
|
|
31235
31238
|
const project = await (0, _keystrokehq_platform_database.selectProjectById)(c.req.param("projectId"));
|
|
31236
31239
|
if (project && project.organizationId !== verified.organizationId) return c.json({
|
|
@@ -31336,9 +31339,9 @@ async function loadModelIds() {
|
|
|
31336
31339
|
async function handler$3(c) {
|
|
31337
31340
|
try {
|
|
31338
31341
|
const models = await loadModelIds();
|
|
31339
|
-
return c.json(require_dist
|
|
31342
|
+
return c.json(require_dist.PublicModelsResponseSchema.parse({ models }));
|
|
31340
31343
|
} catch (error) {
|
|
31341
|
-
if (cache) return c.json(require_dist
|
|
31344
|
+
if (cache) return c.json(require_dist.PublicModelsResponseSchema.parse({ models: cache.models }));
|
|
31342
31345
|
const message = error instanceof Error ? error.message : "Failed to load models";
|
|
31343
31346
|
return c.json({ error: message }, 502);
|
|
31344
31347
|
}
|
|
@@ -31429,12 +31432,12 @@ async function postMarketingContactToSlack(input) {
|
|
|
31429
31432
|
//#region src/routes/public/contact/POST.ts
|
|
31430
31433
|
async function handler$2(c) {
|
|
31431
31434
|
if (!consumeContactRateLimit(clientIp(c))) return c.json({ error: "Too many requests" }, 429);
|
|
31432
|
-
const parsed = require_dist
|
|
31435
|
+
const parsed = require_dist.SubmitMarketingContactRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
31433
31436
|
if (!parsed.success) {
|
|
31434
31437
|
const message = parsed.error.issues[0]?.message ?? "Invalid request body";
|
|
31435
31438
|
return c.json({ error: message }, 400);
|
|
31436
31439
|
}
|
|
31437
|
-
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);
|
|
31438
31441
|
try {
|
|
31439
31442
|
await postMarketingContactToSlack({
|
|
31440
31443
|
fullName: parsed.data.fullName,
|
|
@@ -31446,7 +31449,7 @@ async function handler$2(c) {
|
|
|
31446
31449
|
console.error("Failed to deliver marketing contact to Slack", error);
|
|
31447
31450
|
return c.json({ error: "Failed to deliver contact request" }, 502);
|
|
31448
31451
|
}
|
|
31449
|
-
return c.json(require_dist
|
|
31452
|
+
return c.json(require_dist.SubmitMarketingContactResponseSchema.parse({ ok: true }), 200);
|
|
31450
31453
|
}
|
|
31451
31454
|
//#endregion
|
|
31452
31455
|
//#region src/routes/public/forms/resolve.ts
|
|
@@ -31457,8 +31460,8 @@ async function resolvePublicWorkflowForm(token) {
|
|
|
31457
31460
|
if (!workflow) return null;
|
|
31458
31461
|
const requestSchema = await resolveWorkflowRequestSchema(publishedForm.project.id, workflow);
|
|
31459
31462
|
if (!requestSchema) return null;
|
|
31460
|
-
const inputSchema = require_dist
|
|
31461
|
-
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;
|
|
31462
31465
|
return {
|
|
31463
31466
|
publishedForm,
|
|
31464
31467
|
workflow,
|
|
@@ -31470,15 +31473,15 @@ async function resolvePublicWorkflowForm(token) {
|
|
|
31470
31473
|
//#region src/routes/public/forms/GET.ts
|
|
31471
31474
|
async function handler$1(c) {
|
|
31472
31475
|
const token = c.req.param("token")?.trim();
|
|
31473
|
-
if (!token) return c.json(require_dist
|
|
31476
|
+
if (!token) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Form not found" }), 404);
|
|
31474
31477
|
const resolved = await resolvePublicWorkflowForm(token);
|
|
31475
|
-
if (!resolved) return c.json(require_dist
|
|
31478
|
+
if (!resolved) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Form not found" }), 404);
|
|
31476
31479
|
const { publishedForm, workflow, inputSchema } = resolved;
|
|
31477
31480
|
const branding = publishedForm.organization;
|
|
31478
|
-
return c.json(require_dist
|
|
31481
|
+
return c.json(require_dist.PublicFormMetadataSchema.parse({
|
|
31479
31482
|
title: publishedForm.form.title ?? workflow.name,
|
|
31480
31483
|
description: publishedForm.form.description ?? workflow.description,
|
|
31481
|
-
fields: require_dist
|
|
31484
|
+
fields: require_dist.resolvePublicFormFields(inputSchema, publishedForm.form.fieldConfig),
|
|
31482
31485
|
branding: {
|
|
31483
31486
|
organizationName: branding.name,
|
|
31484
31487
|
projectName: publishedForm.project.name,
|
|
@@ -31512,25 +31515,25 @@ function consumePublicFormRateLimit(formToken, ip) {
|
|
|
31512
31515
|
//#endregion
|
|
31513
31516
|
//#region src/routes/public/forms/submit/POST.ts
|
|
31514
31517
|
function parseRunInput(requestSchema, input) {
|
|
31515
|
-
return require_dist
|
|
31518
|
+
return require_dist.jsonSchemaToZod(requestSchema).parse(input ?? {});
|
|
31516
31519
|
}
|
|
31517
31520
|
function createHandler(promptCreditGate) {
|
|
31518
31521
|
return async (c) => {
|
|
31519
31522
|
const token = c.req.param("token")?.trim();
|
|
31520
|
-
if (!token) return c.json(require_dist
|
|
31523
|
+
if (!token) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Form not found" }), 404);
|
|
31521
31524
|
const resolved = await resolvePublicWorkflowForm(token);
|
|
31522
|
-
if (!resolved) return c.json(require_dist
|
|
31523
|
-
if (!consumePublicFormRateLimit(token, clientIp(c))) return c.json(require_dist
|
|
31524
|
-
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));
|
|
31525
31528
|
if (!parsed.success) {
|
|
31526
31529
|
const message = parsed.error.issues[0]?.message ?? "Invalid request body";
|
|
31527
|
-
return c.json(require_dist
|
|
31530
|
+
return c.json(require_dist.ErrorResponseSchema.parse({ error: message }), 400);
|
|
31528
31531
|
}
|
|
31529
|
-
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);
|
|
31530
31533
|
const { publishedForm, requestSchema, workflow } = resolved;
|
|
31531
31534
|
if (promptCreditGate) try {
|
|
31532
31535
|
const creditResult = await promptCreditGate(publishedForm.organization.id);
|
|
31533
|
-
if (!creditResult.allow) return c.json(require_dist
|
|
31536
|
+
if (!creditResult.allow) return c.json(require_dist.ErrorResponseSchema.parse({
|
|
31534
31537
|
error: creditResult.reason,
|
|
31535
31538
|
message: "This workspace is out of credits. Add credits in billing settings to run workflows."
|
|
31536
31539
|
}), 402);
|
|
@@ -31538,7 +31541,7 @@ function createHandler(promptCreditGate) {
|
|
|
31538
31541
|
console.error("[public-forms] prompt credit gate failed (allowing):", error);
|
|
31539
31542
|
}
|
|
31540
31543
|
const organization = await (0, _keystrokehq_platform_database.selectOrganizationById)(publishedForm.organization.id);
|
|
31541
|
-
if (!organization) return c.json(require_dist
|
|
31544
|
+
if (!organization) return c.json(require_dist.ErrorResponseSchema.parse({ error: "Form not found" }), 404);
|
|
31542
31545
|
try {
|
|
31543
31546
|
await require_with_project_scope.withProjectScope(publishedForm.project.id, async () => {
|
|
31544
31547
|
const scheduler = await (0, _keystrokehq_http.getProjectScheduler)(organization, publishedForm.project.id);
|
|
@@ -31550,10 +31553,10 @@ function createHandler(promptCreditGate) {
|
|
|
31550
31553
|
});
|
|
31551
31554
|
});
|
|
31552
31555
|
} catch (error) {
|
|
31553
|
-
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);
|
|
31554
31557
|
throw error;
|
|
31555
31558
|
}
|
|
31556
|
-
return c.json(require_dist
|
|
31559
|
+
return c.json(require_dist.PublicFormSubmitResponseSchema.parse({ ok: true }), 202);
|
|
31557
31560
|
};
|
|
31558
31561
|
}
|
|
31559
31562
|
//#endregion
|
|
@@ -31632,7 +31635,7 @@ function resolvePlatformListenPort() {
|
|
|
31632
31635
|
const { hostname } = new URL(publicUrl);
|
|
31633
31636
|
if (hostname !== "localhost" && hostname !== "127.0.0.1") return PRODUCTION_PLATFORM_LISTEN_PORT;
|
|
31634
31637
|
} catch {}
|
|
31635
|
-
return require_dist
|
|
31638
|
+
return require_dist.listenPortFromPublicUrl(process.env.PUBLIC_PLATFORM_URL, LOCAL_PLATFORM_PORT);
|
|
31636
31639
|
}
|
|
31637
31640
|
function usesPgBossScheduler(platformConfig) {
|
|
31638
31641
|
return platformConfig.scheduler.name === "pg-boss" || platformConfig.scheduler.name === "default";
|
|
@@ -31641,7 +31644,7 @@ async function startPlatformServer(platformConfig, hooks = {}) {
|
|
|
31641
31644
|
const runtime = platformConfig.hosting.createRuntime();
|
|
31642
31645
|
await (0, _keystrokehq_platform_database.initDatabase)();
|
|
31643
31646
|
startOfficialTemplateSeedInBackground();
|
|
31644
|
-
await require_dist
|
|
31647
|
+
await require_dist.ensureKeystrokeAssetsBucket();
|
|
31645
31648
|
await (0, _keystrokehq_runtime.seedOAuthAppsFromEnvForAllOrganizations)();
|
|
31646
31649
|
if (usesPgBossScheduler(platformConfig)) await (0, _keystrokehq_platform_database.ensureProjectPgBossGrants)();
|
|
31647
31650
|
configureProjectRuntimeScheduler(platformConfig.scheduler);
|
|
@@ -31652,7 +31655,7 @@ async function startPlatformServer(platformConfig, hooks = {}) {
|
|
|
31652
31655
|
if (!organization) throw new Error(`Organization ${job.organizationId} not found`);
|
|
31653
31656
|
const database = await (0, _keystrokehq_platform_database.resolveOrgRuntimeDatabase)(job.organizationId);
|
|
31654
31657
|
const workerRuntime = platformConfig.hosting.workerRuntime;
|
|
31655
|
-
const orgWorkerToken =
|
|
31658
|
+
const orgWorkerToken = require_wait_for_health_XEzPPQIO.mintOrgWorkerToken(workerRuntime.workerToken, job.organizationId);
|
|
31656
31659
|
return {
|
|
31657
31660
|
organizationId: job.organizationId,
|
|
31658
31661
|
projects: [],
|
|
@@ -31866,4 +31869,4 @@ Object.defineProperty(exports, "x$1", {
|
|
|
31866
31869
|
}
|
|
31867
31870
|
});
|
|
31868
31871
|
|
|
31869
|
-
//# sourceMappingURL=start-
|
|
31872
|
+
//# sourceMappingURL=start-CRsvMO8Z.cjs.map
|