@chrisjowen/wheelhouse 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -1
- package/build/client/_app/immutable/assets/0.CS9-5c8D.css +1 -0
- package/build/client/_app/immutable/assets/0.CS9-5c8D.css.br +0 -0
- package/build/client/_app/immutable/assets/0.CS9-5c8D.css.gz +0 -0
- package/build/client/_app/immutable/chunks/{CTLz5ghs.js → 8JUY7TGF.js} +1 -1
- package/build/client/_app/immutable/chunks/8JUY7TGF.js.br +0 -0
- package/build/client/_app/immutable/chunks/8JUY7TGF.js.gz +0 -0
- package/build/client/_app/immutable/chunks/B78SKOml.js +23 -0
- package/build/client/_app/immutable/chunks/B78SKOml.js.br +0 -0
- package/build/client/_app/immutable/chunks/B78SKOml.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{DKQe4Tss.js → BCUUi0V0.js} +1 -1
- package/build/client/_app/immutable/chunks/BCUUi0V0.js.br +0 -0
- package/build/client/_app/immutable/chunks/{DKQe4Tss.js.gz → BCUUi0V0.js.gz} +0 -0
- package/build/client/_app/immutable/chunks/{DmYimTF4.js → BIJDRvOc.js} +1 -1
- package/build/client/_app/immutable/chunks/BIJDRvOc.js.br +0 -0
- package/build/client/_app/immutable/chunks/BIJDRvOc.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{DZ6A9wfS.js → BYUAxBPx.js} +1 -1
- package/build/client/_app/immutable/chunks/BYUAxBPx.js.br +0 -0
- package/build/client/_app/immutable/chunks/BYUAxBPx.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{cAfuCUf-.js → BaPx3dni.js} +1 -1
- package/build/client/_app/immutable/chunks/BaPx3dni.js.br +0 -0
- package/build/client/_app/immutable/chunks/BaPx3dni.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BezBg3rs.js +1 -0
- package/build/client/_app/immutable/chunks/BezBg3rs.js.br +0 -0
- package/build/client/_app/immutable/chunks/BezBg3rs.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{HX17oQGV.js → BrlWJk4r.js} +1 -1
- package/build/client/_app/immutable/chunks/BrlWJk4r.js.br +0 -0
- package/build/client/_app/immutable/chunks/BrlWJk4r.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{-UC3yquZ.js → Bw22EWRR.js} +1 -1
- package/build/client/_app/immutable/chunks/Bw22EWRR.js.br +0 -0
- package/build/client/_app/immutable/chunks/Bw22EWRR.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{yLdhLQbD.js → C6B0JAFe.js} +1 -1
- package/build/client/_app/immutable/chunks/C6B0JAFe.js.br +0 -0
- package/build/client/_app/immutable/chunks/C6B0JAFe.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{BfUcVuHG.js → C8OIAOGW.js} +1 -1
- package/build/client/_app/immutable/chunks/C8OIAOGW.js.br +0 -0
- package/build/client/_app/immutable/chunks/C8OIAOGW.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{B6Xfoyj4.js → CEHCs8E4.js} +1 -1
- package/build/client/_app/immutable/chunks/CEHCs8E4.js.br +0 -0
- package/build/client/_app/immutable/chunks/CEHCs8E4.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{CBeiP5A_.js → CL60_qsS.js} +1 -1
- package/build/client/_app/immutable/chunks/CL60_qsS.js.br +0 -0
- package/build/client/_app/immutable/chunks/CL60_qsS.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{4JI5fA27.js → CbTQtfeu.js} +1 -1
- package/build/client/_app/immutable/chunks/CbTQtfeu.js.br +0 -0
- package/build/client/_app/immutable/chunks/CbTQtfeu.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{aicrexzH.js → CeuOu7QI.js} +1 -1
- package/build/client/_app/immutable/chunks/CeuOu7QI.js.br +0 -0
- package/build/client/_app/immutable/chunks/CeuOu7QI.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{CSoC52Vx.js → Cn9pLe1S.js} +1 -1
- package/build/client/_app/immutable/chunks/Cn9pLe1S.js.br +0 -0
- package/build/client/_app/immutable/chunks/Cn9pLe1S.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{CxJQEvmu.js → D1QZsS_n.js} +1 -1
- package/build/client/_app/immutable/chunks/D1QZsS_n.js.br +0 -0
- package/build/client/_app/immutable/chunks/D1QZsS_n.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{BCRg__8v.js → D3z87-GH.js} +5 -5
- package/build/client/_app/immutable/chunks/D3z87-GH.js.br +0 -0
- package/build/client/_app/immutable/chunks/D3z87-GH.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{DebP8q1f.js → D69HGG2e.js} +1 -1
- package/build/client/_app/immutable/chunks/D69HGG2e.js.br +0 -0
- package/build/client/_app/immutable/chunks/D69HGG2e.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{BHmiFpwn.js → D6kQXwLu.js} +1 -1
- package/build/client/_app/immutable/chunks/D6kQXwLu.js.br +0 -0
- package/build/client/_app/immutable/chunks/D6kQXwLu.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{DkrGZW5a.js → D8TgbIKz.js} +1 -1
- package/build/client/_app/immutable/chunks/D8TgbIKz.js.br +0 -0
- package/build/client/_app/immutable/chunks/D8TgbIKz.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{CpqCFuwf.js → DGZVZsEx.js} +1 -1
- package/build/client/_app/immutable/chunks/DGZVZsEx.js.br +0 -0
- package/build/client/_app/immutable/chunks/DGZVZsEx.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{BqMdGvwc.js → Dbi_7cO_.js} +2 -2
- package/build/client/_app/immutable/chunks/Dbi_7cO_.js.br +0 -0
- package/build/client/_app/immutable/chunks/Dbi_7cO_.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{yYKc4xgI.js → Dq4WC4aT.js} +1 -1
- package/build/client/_app/immutable/chunks/Dq4WC4aT.js.br +0 -0
- package/build/client/_app/immutable/chunks/Dq4WC4aT.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{CcafVx98.js → QrHSSdjC.js} +1 -1
- package/build/client/_app/immutable/chunks/QrHSSdjC.js.br +2 -0
- package/build/client/_app/immutable/chunks/QrHSSdjC.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{CA_poXX0.js → bOtONP_M.js} +1 -1
- package/build/client/_app/immutable/chunks/bOtONP_M.js.br +0 -0
- package/build/client/_app/immutable/chunks/bOtONP_M.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.B0SozPUz.js +2 -0
- package/build/client/_app/immutable/entry/app.B0SozPUz.js.br +0 -0
- package/build/client/_app/immutable/entry/app.B0SozPUz.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.BgyXy-5i.js +1 -0
- package/build/client/_app/immutable/entry/start.BgyXy-5i.js.br +0 -0
- package/build/client/_app/immutable/entry/start.BgyXy-5i.js.gz +0 -0
- package/build/client/_app/immutable/nodes/0.BH-p6KNP.js +9 -0
- package/build/client/_app/immutable/nodes/0.BH-p6KNP.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.BH-p6KNP.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{1.DMeNq-MM.js → 1.5bKMe7me.js} +1 -1
- package/build/client/_app/immutable/nodes/1.5bKMe7me.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.5bKMe7me.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{10.C85i7naL.js → 10.CuyB--Be.js} +1 -1
- package/build/client/_app/immutable/nodes/10.CuyB--Be.js.br +0 -0
- package/build/client/_app/immutable/nodes/10.CuyB--Be.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{11.B3oT5Eyb.js → 11.Cp96bYst.js} +1 -1
- package/build/client/_app/immutable/nodes/11.Cp96bYst.js.br +0 -0
- package/build/client/_app/immutable/nodes/11.Cp96bYst.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{12.CzGzD4iD.js → 12.B9kS4-UK.js} +1 -1
- package/build/client/_app/immutable/nodes/12.B9kS4-UK.js.br +0 -0
- package/build/client/_app/immutable/nodes/12.B9kS4-UK.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{13.hmYycyBf.js → 13.ie4sMrRi.js} +1 -1
- package/build/client/_app/immutable/nodes/13.ie4sMrRi.js.br +0 -0
- package/build/client/_app/immutable/nodes/13.ie4sMrRi.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{14.KtuQwZ-C.js → 14.CqfbcQC3.js} +1 -1
- package/build/client/_app/immutable/nodes/14.CqfbcQC3.js.br +0 -0
- package/build/client/_app/immutable/nodes/14.CqfbcQC3.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{15.C7QObash.js → 15.ClcEiTus.js} +1 -1
- package/build/client/_app/immutable/nodes/15.ClcEiTus.js.br +0 -0
- package/build/client/_app/immutable/nodes/15.ClcEiTus.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{16.BJOpVasQ.js → 16.Lubye7rY.js} +1 -1
- package/build/client/_app/immutable/nodes/16.Lubye7rY.js.br +0 -0
- package/build/client/_app/immutable/nodes/16.Lubye7rY.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{17.Bk-1GRlF.js → 17.CZsgvMnU.js} +1 -1
- package/build/client/_app/immutable/nodes/17.CZsgvMnU.js.br +0 -0
- package/build/client/_app/immutable/nodes/17.CZsgvMnU.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{19.lzLFSTUS.js → 19.nb4PEk6e.js} +1 -1
- package/build/client/_app/immutable/nodes/19.nb4PEk6e.js.br +0 -0
- package/build/client/_app/immutable/nodes/19.nb4PEk6e.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.DBpcacIW.js +26 -0
- package/build/client/_app/immutable/nodes/2.DBpcacIW.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.DBpcacIW.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{20.DqOEVNtJ.js → 20.DKDJA76m.js} +1 -1
- package/build/client/_app/immutable/nodes/20.DKDJA76m.js.br +0 -0
- package/build/client/_app/immutable/nodes/20.DKDJA76m.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{21.BmaCB5Rb.js → 21.DDSJrVwV.js} +1 -1
- package/build/client/_app/immutable/nodes/21.DDSJrVwV.js.br +0 -0
- package/build/client/_app/immutable/nodes/21.DDSJrVwV.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{22.D4F9Jlfe.js → 22.Bf2Y4qtK.js} +1 -1
- package/build/client/_app/immutable/nodes/22.Bf2Y4qtK.js.br +0 -0
- package/build/client/_app/immutable/nodes/22.Bf2Y4qtK.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{23.CGv8T_kx.js → 23.CgSRzQDr.js} +1 -1
- package/build/client/_app/immutable/nodes/23.CgSRzQDr.js.br +0 -0
- package/build/client/_app/immutable/nodes/23.CgSRzQDr.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{24.DKrgSigC.js → 24.fKJczgYC.js} +1 -1
- package/build/client/_app/immutable/nodes/24.fKJczgYC.js.br +0 -0
- package/build/client/_app/immutable/nodes/24.fKJczgYC.js.gz +0 -0
- package/build/client/_app/immutable/nodes/25.BzI2N_Dl.js +14 -0
- package/build/client/_app/immutable/nodes/25.BzI2N_Dl.js.br +0 -0
- package/build/client/_app/immutable/nodes/25.BzI2N_Dl.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{26.5XFLLXwF.js → 26.Bl7bQZez.js} +1 -1
- package/build/client/_app/immutable/nodes/26.Bl7bQZez.js.br +0 -0
- package/build/client/_app/immutable/nodes/26.Bl7bQZez.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{27.BgW1QGtl.js → 27.Dn-mDbvz.js} +1 -1
- package/build/client/_app/immutable/nodes/27.Dn-mDbvz.js.br +0 -0
- package/build/client/_app/immutable/nodes/27.Dn-mDbvz.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{28.DeOjXHlX.js → 28.B9EWyQv6.js} +1 -1
- package/build/client/_app/immutable/nodes/28.B9EWyQv6.js.br +0 -0
- package/build/client/_app/immutable/nodes/28.B9EWyQv6.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{3.Dh_akpU9.js → 3.DMxCWZ16.js} +1 -1
- package/build/client/_app/immutable/nodes/3.DMxCWZ16.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.DMxCWZ16.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{4.Bs1kn53S.js → 4.Bj_V5H0A.js} +1 -1
- package/build/client/_app/immutable/nodes/4.Bj_V5H0A.js.br +0 -0
- package/build/client/_app/immutable/nodes/4.Bj_V5H0A.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{6.C71EcMPx.js → 6.BAzIGIXP.js} +1 -1
- package/build/client/_app/immutable/nodes/6.BAzIGIXP.js.br +0 -0
- package/build/client/_app/immutable/nodes/6.BAzIGIXP.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{7.ZTOGuaHI.js → 7.CpRItf5T.js} +1 -1
- package/build/client/_app/immutable/nodes/7.CpRItf5T.js.br +0 -0
- package/build/client/_app/immutable/nodes/7.CpRItf5T.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{8.CvoRv_Q7.js → 8.BRbaXe0L.js} +1 -1
- package/build/client/_app/immutable/nodes/8.BRbaXe0L.js.br +0 -0
- package/build/client/_app/immutable/nodes/8.BRbaXe0L.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{9.BKcDiRzn.js → 9.DpQmfi7O.js} +1 -1
- package/build/client/_app/immutable/nodes/9.DpQmfi7O.js.br +0 -0
- package/build/client/_app/immutable/nodes/9.DpQmfi7O.js.gz +0 -0
- package/build/client/_app/version.json +1 -1
- package/build/client/_app/version.json.br +0 -0
- package/build/client/_app/version.json.gz +0 -0
- package/build/handler.js +4 -4
- package/build/index.js +4 -4
- package/build/server/chunks/chunks/{DecisionCard.js-DNJjQj6y.js → DecisionCard.js-Cim80Nvw.js} +3 -3
- package/build/server/chunks/chunks/{EtaLine.js-B29ZmIHz.js → EtaLine.js-D5L0wIoo.js} +2 -2
- package/build/server/chunks/chunks/{OpenDecision.js-evqpdz3O.js → OpenDecision.js-BVAXM8UF.js} +3 -3
- package/build/server/chunks/chunks/{RemotesPanel.js-0dTa0R21.js → RemotesPanel.js-qXJzfoKH.js} +87 -7
- package/build/server/chunks/chunks/brief.js-TS-K0lZ6.js +54 -0
- package/build/server/chunks/chunks/{chat.svelte.js-PibwBfjx.js → chat.svelte.js-BcKQjH6T.js} +6 -2
- package/build/server/chunks/chunks/{detail.js-Dgv4KmRL.js → detail.js-BBCxJBpU.js} +2 -2
- package/build/server/chunks/chunks/{feedback.js-Czi1E8u9.js → feedback.js-DHLUCzN_.js} +2 -2
- package/build/server/chunks/chunks/harness.js-DPojOlFJ.js +16 -0
- package/build/server/chunks/chunks/{insights.svelte.js-BLHg5qc-.js → insights.svelte.js-CLCl4593.js} +5 -5
- package/build/server/chunks/chunks/{internal.js-BP2QIFKY.js → internal.js-CedW099c.js} +3 -3
- package/build/server/chunks/chunks/{keychain.js-DJN5Zq29.js → keychain.js-CspIw1lK.js} +2 -2
- package/build/server/chunks/chunks/{live.svelte.js-DmaKnCsQ.js → live.svelte.js-qalupdld.js} +2 -2
- package/build/server/chunks/chunks/{marketplace-service.js-DJa250U3.js → marketplace-service.js-O-2c34nr.js} +2 -2
- package/build/server/chunks/chunks/{page.js-DfEGGxtv.js → page.js-BRRl6mg_.js} +2 -2
- package/build/server/chunks/chunks/{brief.js-DyAlUufG.js → plain.js-Dc97sYaJ.js} +2 -53
- package/build/server/chunks/chunks/{plugins.js-Dfplrp6Q.js → plugins.js-DoEQ8bDp.js} +2 -2
- package/build/server/chunks/chunks/{previewhelper2.js-oDj1DB3x.js → previewhelper2.js-CLYvgGeM.js} +3 -3
- package/build/server/chunks/chunks/{repo.js-CDmQ4avP.js → repo.js-BQv7p3Qv.js} +2 -2
- package/build/server/chunks/chunks/{runtime.js-OVMyjvFp.js → runtime.js-ja9fpm3a.js} +2113 -789
- package/build/server/chunks/chunks/{service.js-BLOqmXsC.js → service.js-CHB5De_m.js} +2 -2
- package/build/server/chunks/chunks/{service2.js-DlF0JRL_.js → service2.js-BSXaHqaf.js} +24 -10
- package/build/server/chunks/chunks/{starter.js-D0aq1VOH.js → starter.js-BL6kYdY7.js} +227 -9
- package/build/server/chunks/chunks/{terminal.js-BckfZrAP.js → terminal.js-s8yEF1TY.js} +3 -1
- package/build/server/chunks/chunks/{view.js-mOm4Yref.js → view.js-DvrTXTsb.js} +2 -2
- package/build/server/chunks/entries/endpoints/api/apps/_op_/{_server.ts.js-BQM1jaCW.js → _server.ts.js-DJDX8mej.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/cloud/{_server.ts.js-BnfxYZJ4.js → _server.ts.js-ZpNBOdE6.js} +14 -5
- package/build/server/chunks/entries/endpoints/api/cloud/previews/{_server.ts.js-CuYYpy-k.js → _server.ts.js-cLGgBi-L.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/events/{_server.ts.js-v28e8g7l.js → _server.ts.js-DyA-Ftti.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/files/{_server.ts.js-Q9s9qdZ9.js → _server.ts.js-BRutjWld.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/firstmate/chat/{_server.ts.js-BN6RMteU.js → _server.ts.js-CSUsZ_Uy.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/firstmate/commands/{_server.ts.js-C-e8niCf.js → _server.ts.js-CyMAbBop.js} +11 -6
- package/build/server/chunks/entries/endpoints/api/firstmate/dismiss/{_server.ts.js-CulYtEQF.js → _server.ts.js-C1QNh7Fv.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/firstmate/input/{_server.ts.js-C6Bz4_ee.js → _server.ts.js-xAS3zgy6.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/firstmate/interrupt/{_server.ts.js-BqZfV_xz.js → _server.ts.js-C0ChpkPv.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/firstmate/messages/{_server.ts.js-UWIoNytl.js → _server.ts.js-Dg8UqJYL.js} +9 -7
- package/build/server/chunks/entries/endpoints/api/firstmate/pick/{_server.ts.js-DW2s3QXr.js → _server.ts.js-KtXAKUKl.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/firstmate/reactions/{_server.ts.js-CKcueh0v.js → _server.ts.js-SfyGIsms.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/firstmate/start/{_server.ts.js-DIG6BGUw.js → _server.ts.js-uKjVaQqO.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/fleet/{_server.ts.js-DbyPkjMG.js → _server.ts.js-Bh09YMSB.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/gateway/{_server.ts.js-iIWTQNdz.js → _server.ts.js-DiOWY9as.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/health/{_server.ts.js-C6aIFSPp.js → _server.ts.js-BRjxK-9y.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/inbox/{_server.ts.js-KQsJpMC4.js → _server.ts.js-CA3XQih9.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/inbox/report/{_server.ts.js-CnyUgKFG.js → _server.ts.js-B5MRXVz2.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/insights/{_server.ts.js-CuR7nOsT.js → _server.ts.js-Hj5j2VEd.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/plugins/_plugin_/config/{_server.ts.js-B0PprKNy.js → _server.ts.js-CG5hVtIr.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/plugins/_plugin_/feedback/{_server.ts.js-ExGq36cR.js → _server.ts.js-CbfYfN4W.js} +9 -7
- package/build/server/chunks/entries/endpoints/api/plugins/_plugin_/feedback/summary/{_server.ts.js-DEiF7hSn.js → _server.ts.js-Cntqh4w-.js} +9 -7
- package/build/server/chunks/entries/endpoints/api/plugins/_plugin_/icon/_icon_/{_server.ts.js-CNilnIbo.js → _server.ts.js-DbaYfmK8.js} +7 -5
- package/build/server/chunks/entries/endpoints/api/plugins/_plugin_/load/{_server.ts.js-DH8JvoH8.js → _server.ts.js-CMC6khtq.js} +2 -2
- package/build/server/chunks/entries/endpoints/api/plugins/_plugin_/ui/_...path_/{_server.ts.js-BFsGEK3z.js → _server.ts.js-DiCaOT3E.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/plugins/_plugin_/update/{_server.ts.js-D20dZu-e.js → _server.ts.js-DQZxZKa4.js} +2 -2
- package/build/server/chunks/entries/endpoints/api/plugins/{_server.ts.js-CUNuwhSn.js → _server.ts.js-CaQ772k3.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/plugins/inspect/{_server.ts.js-CjBpWyyM.js → _server.ts.js-DkjBSjdS.js} +2 -2
- package/build/server/chunks/entries/endpoints/api/plugins/install/{_server.ts.js-BOj-J5oo.js → _server.ts.js-BLEOrgEt.js} +2 -2
- package/build/server/chunks/entries/endpoints/api/plugins/marketplace/{_server.ts.js-CwwZDf_S.js → _server.ts.js-rrfRBhVX.js} +9 -7
- package/build/server/chunks/entries/endpoints/api/plugins/marketplace/icon/_name_/{_server.ts.js-DyB021Bo.js → _server.ts.js-DEaeguu1.js} +9 -7
- package/build/server/chunks/entries/endpoints/api/plugins/marketplace/registries/{_server.ts.js-Dcw_-YKO.js → _server.ts.js-DGviOddp.js} +9 -7
- package/build/server/chunks/entries/endpoints/api/plugins/updates/{_server.ts.js-Dn8taLal.js → _server.ts.js-BfwOLICk.js} +2 -2
- package/build/server/chunks/entries/endpoints/api/previews/check/{_server.ts.js-CYRaQ1Q9.js → _server.ts.js-C3dZCo79.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/projects/_id_/passage/{_server.ts.js-CKz_IHkS.js → _server.ts.js-QCxCUoaZ.js} +9 -7
- package/build/server/chunks/entries/endpoints/api/projects/_id_/passage/commands/{_server.ts.js-B05Zzw2L.js → _server.ts.js-CIHZWmY6.js} +9 -7
- package/build/server/chunks/entries/endpoints/api/projects/_id_/passage/consent/{_server.ts.js-DIFxtwPN.js → _server.ts.js-9MZ6ZU7W.js} +9 -7
- package/build/server/chunks/entries/endpoints/api/projects/_id_/passage/draft/{_server.ts.js-DKPspl_e.js → _server.ts.js-YJgYZpm2.js} +9 -7
- package/build/server/chunks/entries/endpoints/api/projects/_id_/passage/file/{_server.ts.js-BzvpX8Lp.js → _server.ts.js-DRO0yFlG.js} +9 -7
- package/build/server/chunks/entries/endpoints/api/projects/_id_/passage/test/{_server.ts.js-DaGgjHpa.js → _server.ts.js--78Nc6jj.js} +9 -7
- package/build/server/chunks/entries/endpoints/api/second-mates/_id_/peek/{_server.ts.js-BDtqyF9w.js → _server.ts.js-B92-w9Jt.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/services/{_server.ts.js-CzCXTD-q.js → _server.ts.js-BlgDs2xk.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/setup/{_server.ts.js-f6ZbC1i9.js → _server.ts.js-Cc70st9n.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/slots/{_server.ts.js-DeBR06cu.js → _server.ts.js-COmpO5sc.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/tasks/_id_/{_server.ts.js-CqZJfk6k.js → _server.ts.js-DcHNA_QH.js} +9 -7
- package/build/server/chunks/entries/endpoints/api/tasks/_id_/artifacts/_...name_/{_server.ts.js-BxqmUBCJ.js → _server.ts.js-BIBAGkdF.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/tasks/_id_/diff/{_server.ts.js-BdHMgaY-.js → _server.ts.js-DXKDhcRn.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/tasks/_id_/output/{_server.ts.js-CcwryXxc.js → _server.ts.js-BgJD7i53.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/tasks/_id_/preview/{_server.ts.js-DN6VppQL.js → _server.ts.js-CxKGr5ok.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/tasks/_id_/preview/helper/{_server.ts.js-CVyRxqaq.js → _server.ts.js-k2erXAMq.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/vault/{_server.ts.js-CKtXqbub.js → _server.ts.js-BUmsnNMT.js} +8 -6
- package/build/server/chunks/entries/endpoints/api/wheelhouse/source/{_server.ts.js-iwhW_cdh.js → _server.ts.js-Dic1r8FA.js} +2 -2
- package/build/server/chunks/entries/endpoints/api/wheelhouse/update/{_server.ts.js-DnF0-ymm.js → _server.ts.js-DCDFOP3H.js} +2 -2
- package/build/server/chunks/entries/endpoints/api/wheelhouse/upgrade/{_server.ts.js-B8tzXzqR.js → _server.ts.js-DyaR3iKq.js} +2 -2
- package/build/server/chunks/entries/endpoints/tasks/_id_/review/{_server.ts.js-C_n7oVA8.js → _server.ts.js-Ds9qnblb.js} +8 -6
- package/build/server/chunks/entries/{hooks.server.js-D06ps4Om.js → hooks.server.js-BLsrrww8.js} +8 -6
- package/build/server/chunks/entries/pages/{_layout.server.ts.js-b_JVQfjI.js → _layout.server.ts.js-CWJXWFa8.js} +2 -2
- package/build/server/chunks/entries/pages/{_layout.svelte.js-5WXlsqB3.js → _layout.svelte.js-CuWnZ-US.js} +132 -42
- package/build/server/chunks/entries/pages/{_page.server.ts.js-DBb-K68h.js → _page.server.ts.js-DcIo1Fkt.js} +2 -2
- package/build/server/chunks/entries/pages/{_page.svelte.js-DFWU8yJc.js → _page.svelte.js-CGR2VowD.js} +35 -21
- package/build/server/chunks/entries/pages/decisions/{_page.server.ts.js-C3xd1s3T.js → _page.server.ts.js-Cumc04zT.js} +2 -2
- package/build/server/chunks/entries/pages/deck/{_page.server.ts.js-DruCAu5Z.js → _page.server.ts.js-BvnBsHnq.js} +2 -2
- package/build/server/chunks/entries/pages/deck/{_page.svelte.js-BE2e7Hyi.js → _page.svelte.js-zqjb3tWK.js} +7 -7
- package/build/server/chunks/entries/pages/files/{_page.server.ts.js-CXFi4LV0.js → _page.server.ts.js-DVzHoqMO.js} +2 -2
- package/build/server/chunks/entries/pages/harbour/{_page.server.ts.js-DvOPkrBM.js → _page.server.ts.js-BK7WgAXR.js} +2 -2
- package/build/server/chunks/entries/pages/harbour/{_page.svelte.js-DW1Zg1aI.js → _page.svelte.js-BmsnWRtI.js} +2 -2
- package/build/server/chunks/entries/pages/headroom/{_page.server.ts.js-F2DiEcl8.js → _page.server.ts.js-B_et4vbk.js} +2 -2
- package/build/server/chunks/entries/pages/inbox/{_page.server.ts.js-CaMBSVLS.js → _page.server.ts.js-DWY01zRh.js} +2 -2
- package/build/server/chunks/entries/pages/inbox/{_page.svelte.js-BddxZY9X.js → _page.svelte.js-DLpzhD2s.js} +4 -4
- package/build/server/chunks/entries/pages/more/{_page.svelte.js-CnwXpFY4.js → _page.svelte.js--_4q1cBB.js} +2 -2
- package/build/server/chunks/entries/pages/plugins/{_page.svelte.js-Dk84Z-NW.js → _page.svelte.js-CUCt4Yh6.js} +3 -3
- package/build/server/chunks/entries/pages/plugins/_plugin_/_page_/{_page.server.ts.js-ClGdKDIt.js → _page.server.ts.js-Be_vf2s9.js} +2 -2
- package/build/server/chunks/entries/pages/plugins/_plugin_/_page_/{_page.svelte.js-BYHP64gx.js → _page.svelte.js-pQ6VEL_L.js} +2 -2
- package/build/server/chunks/entries/pages/projects/_id_/{_page.server.ts.js-DEQv1OLm.js → _page.server.ts.js-euICzR6h.js} +3 -3
- package/build/server/chunks/entries/pages/projects/_id_/{_page.svelte.js-B9P8UZOd.js → _page.svelte.js-B0wg_ICE.js} +3 -3
- package/build/server/chunks/entries/pages/projects/_id_/_plugin_/_tab_/{_page.server.ts.js-DJFGO-Cc.js → _page.server.ts.js-CO-iqBAD.js} +3 -3
- package/build/server/chunks/entries/pages/projects/_id_/_plugin_/_tab_/{_page.svelte.js-CcwDpwg7.js → _page.svelte.js-2F9iPWld.js} +2 -2
- package/build/server/chunks/entries/pages/projects/_id_/passage/{_page.server.ts.js-DjGE65vR.js → _page.server.ts.js-DzQmyVut.js} +4 -4
- package/build/server/chunks/entries/pages/projects/_id_/passage/{_page.svelte.js-B3HRzAzL.js → _page.svelte.js-CRoYOdvp.js} +2 -2
- package/build/server/chunks/entries/pages/projects/_id_/passage/edit/{_page.server.ts.js-BmjN06QJ.js → _page.server.ts.js-ByePQa4g.js} +2 -2
- package/build/server/chunks/entries/pages/projects/_id_/passage/edit/{_page.svelte.js-DaA-EDRZ.js → _page.svelte.js-C-4CQ9Vj.js} +2 -2
- package/build/server/chunks/entries/pages/remotes/{_page.server.ts.js-BCYsX8Qf.js → _page.server.ts.js-DRj_7nDd.js} +2 -2
- package/build/server/chunks/entries/pages/remotes/{_page.svelte.js-BSG7dgKM.js → _page.svelte.js-jCBA0xmJ.js} +2 -2
- package/build/server/chunks/entries/pages/second-mates/{_page.svelte.js-Dd467IE0.js → _page.svelte.js-3euUM2q5.js} +2 -2
- package/build/server/chunks/entries/pages/settings/cloud/{_page.server.ts.js-CVexEhWo.js → _page.server.ts.js-QWGL2-Cn.js} +2 -2
- package/build/server/chunks/entries/pages/settings/cloud/{_page.svelte.js-CCSostfV.js → _page.svelte.js-ZcLxf_7V.js} +2 -2
- package/build/server/chunks/entries/pages/settings/gateway/{_page.server.ts.js-BHoaQS8-.js → _page.server.ts.js-DAOkZ-fE.js} +2 -2
- package/build/server/chunks/entries/pages/settings/plugins/{_page.server.ts.js-DnPR5x0p.js → _page.server.ts.js-jeZvTAgT.js} +2 -2
- package/build/server/chunks/entries/pages/settings/plugins/{_page.svelte.js-CtZUu0ww.js → _page.svelte.js-CVkf5sHc.js} +3 -3
- package/build/server/chunks/entries/pages/settings/plugins/_plugin_/{_page.server.ts.js-BBTiKiTp.js → _page.server.ts.js-Bzo5Uals.js} +2 -2
- package/build/server/chunks/entries/pages/settings/plugins/_plugin_/{_page.svelte.js-BL9OERy0.js → _page.svelte.js-Dn6-A1cY.js} +3 -3
- package/build/server/chunks/entries/pages/settings/setup/{_page.server.ts.js-UhPQcuM0.js → _page.server.ts.js-1XiCbDhc.js} +2 -2
- package/build/server/chunks/entries/pages/settings/update/{_page.server.ts.js-DQJnyFPr.js → _page.server.ts.js-DwYnrxXG.js} +2 -2
- package/build/server/chunks/entries/pages/setup/{_page.server.ts.js-ZaOlhvmr.js → _page.server.ts.js-DP--6Ko6.js} +3 -3
- package/build/server/chunks/entries/pages/setup/{_page.svelte.js-BgqCbRCh.js → _page.svelte.js-CB6DNUFE.js} +110 -87
- package/build/server/chunks/entries/pages/tasks/_id_/{_page.server.ts.js-DomAdSYf.js → _page.server.ts.js-Dl0z8pkQ.js} +3 -3
- package/build/server/chunks/entries/pages/tasks/_id_/{_page.svelte.js-016yK-eG.js → _page.svelte.js-Cali_YuK.js} +7 -6
- package/build/server/chunks/entries/pages/tasks/_id_/doc/{_page.server.ts.js-B3OWfHLh.js → _page.server.ts.js-CyPpYkuJ.js} +2 -2
- package/build/server/chunks/entries/pages/time/{_page.server.ts.js-D3R_fKKg.js → _page.server.ts.js-DlcJgtrb.js} +2 -2
- package/build/server/chunks/{handler-LFdZeRhM.js → handler-pU2T6cxW.js} +3 -3
- package/build/server/chunks/{index.js-BXq0LqPz.js → index.js-B3YyBD1_.js} +2 -2
- package/build/server/chunks/{manifest.js-aLGKYQ2c.js → manifest.js-D3OqJAbv.js} +86 -86
- package/build/server/chunks/nodes/{0.js-cZzmSKzn.js → 0.js-DapnlcBu.js} +12 -10
- package/build/server/chunks/nodes/{1.js-OfqTUBqN.js → 1.js-B2zVBiHu.js} +2 -2
- package/build/server/chunks/nodes/{10.js-XZMNgA-_.js → 10.js-CwfaDBrN.js} +3 -3
- package/build/server/chunks/nodes/{11.js-BQsBxnqW.js → 11.js-BSKCzLBk.js} +11 -9
- package/build/server/chunks/nodes/{12.js-BtN6NNws.js → 12.js-Cw0R3pzN.js} +12 -10
- package/build/server/chunks/nodes/{13.js-TYF306j2.js → 13.js-1CllvmKU.js} +12 -10
- package/build/server/chunks/nodes/{14.js-paIqFLgN.js → 14.js-Duo10iYX.js} +13 -11
- package/build/server/chunks/nodes/{15.js-Cnov1YR7.js → 15.js-yyKjbIPm.js} +12 -10
- package/build/server/chunks/nodes/{16.js-ELBvJEOW.js → 16.js-Bw3O413k.js} +7 -7
- package/build/server/chunks/nodes/{17.js-Ca8V-3qj.js → 17.js-CKJWbBiG.js} +3 -3
- package/build/server/chunks/nodes/{19.js-Cnn9fSef.js → 19.js-gqmNp-1X.js} +7 -7
- package/build/server/chunks/nodes/{2.js-CAfs3Ddj.js → 2.js-DbAE0QSU.js} +11 -9
- package/build/server/chunks/nodes/{20.js-Dd2o-zjp.js → 20.js-DyVwaMHk.js} +10 -8
- package/build/server/chunks/nodes/{21.js-BoKvVAba.js → 21.js-UWLpwye1.js} +11 -9
- package/build/server/chunks/nodes/{22.js-Dsqrw0IR.js → 22.js-DjQqtx9a.js} +11 -9
- package/build/server/chunks/nodes/{23.js-DKVqYHOy.js → 23.js-BRxy911D.js} +11 -9
- package/build/server/chunks/nodes/{24.js-BTDlc3cd.js → 24.js-QS0KOwss.js} +4 -4
- package/build/server/chunks/nodes/{25.js-B_TBD0eZ.js → 25.js-PQ5YJuMR.js} +12 -10
- package/build/server/chunks/nodes/{26.js-kw2HsE7Z.js → 26.js-CVgNTrxq.js} +12 -10
- package/build/server/chunks/nodes/{27.js-ChPlnFqh.js → 27.js-D362fjZ7.js} +11 -9
- package/build/server/chunks/nodes/{28.js-gkTtK_J_.js → 28.js-CquKiHnq.js} +10 -8
- package/build/server/chunks/nodes/{3.js-56YxWA1q.js → 3.js-_ZrsIscU.js} +10 -8
- package/build/server/chunks/nodes/{4.js-QNM4W7ly.js → 4.js-CMBAdl6x.js} +11 -9
- package/build/server/chunks/nodes/{5.js-CW12fKyW.js → 5.js-DRAnyeo0.js} +9 -7
- package/build/server/chunks/nodes/{6.js-CJ0pRLBP.js → 6.js-CWsHGKdF.js} +11 -9
- package/build/server/chunks/nodes/{7.js-_jRitR1O.js → 7.js-BzkPQGE-.js} +10 -8
- package/build/server/chunks/nodes/{8.js-Wz8EKcS3.js → 8.js-DppreJ1j.js} +11 -9
- package/build/server/chunks/nodes/{9.js-DWh3J_q7.js → 9.js-CWCKh6Lz.js} +3 -3
- package/dist/cli.js +1043 -261
- package/dist/wh-vault.js +1 -1
- package/package.json +1 -1
- package/skills/manage-wheelhouse/SKILL.md +1 -1
- package/skills/manage-wheelhouse/references/operations.md +5 -4
- package/build/client/_app/immutable/assets/0.CjeOh6H-.css +0 -1
- package/build/client/_app/immutable/assets/0.CjeOh6H-.css.br +0 -0
- package/build/client/_app/immutable/assets/0.CjeOh6H-.css.gz +0 -0
- package/build/client/_app/immutable/chunks/-UC3yquZ.js.br +0 -0
- package/build/client/_app/immutable/chunks/-UC3yquZ.js.gz +0 -0
- package/build/client/_app/immutable/chunks/4JI5fA27.js.br +0 -0
- package/build/client/_app/immutable/chunks/4JI5fA27.js.gz +0 -0
- package/build/client/_app/immutable/chunks/B6Xfoyj4.js.br +0 -0
- package/build/client/_app/immutable/chunks/B6Xfoyj4.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BCRg__8v.js.br +0 -0
- package/build/client/_app/immutable/chunks/BCRg__8v.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BHmiFpwn.js.br +0 -0
- package/build/client/_app/immutable/chunks/BHmiFpwn.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BfUcVuHG.js.br +0 -0
- package/build/client/_app/immutable/chunks/BfUcVuHG.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BqMdGvwc.js.br +0 -0
- package/build/client/_app/immutable/chunks/BqMdGvwc.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CA_poXX0.js.br +0 -0
- package/build/client/_app/immutable/chunks/CA_poXX0.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CBeiP5A_.js.br +0 -0
- package/build/client/_app/immutable/chunks/CBeiP5A_.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CSoC52Vx.js.br +0 -0
- package/build/client/_app/immutable/chunks/CSoC52Vx.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CTLz5ghs.js.br +0 -0
- package/build/client/_app/immutable/chunks/CTLz5ghs.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CcafVx98.js.br +0 -3
- package/build/client/_app/immutable/chunks/CcafVx98.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CpqCFuwf.js.br +0 -0
- package/build/client/_app/immutable/chunks/CpqCFuwf.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CxJQEvmu.js.br +0 -0
- package/build/client/_app/immutable/chunks/CxJQEvmu.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DKQe4Tss.js.br +0 -0
- package/build/client/_app/immutable/chunks/DZ6A9wfS.js.br +0 -0
- package/build/client/_app/immutable/chunks/DZ6A9wfS.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DebP8q1f.js.br +0 -0
- package/build/client/_app/immutable/chunks/DebP8q1f.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DkrGZW5a.js.br +0 -0
- package/build/client/_app/immutable/chunks/DkrGZW5a.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DmYimTF4.js.br +0 -0
- package/build/client/_app/immutable/chunks/DmYimTF4.js.gz +0 -0
- package/build/client/_app/immutable/chunks/HX17oQGV.js.br +0 -0
- package/build/client/_app/immutable/chunks/HX17oQGV.js.gz +0 -0
- package/build/client/_app/immutable/chunks/aicrexzH.js.br +0 -0
- package/build/client/_app/immutable/chunks/aicrexzH.js.gz +0 -0
- package/build/client/_app/immutable/chunks/cAfuCUf-.js.br +0 -0
- package/build/client/_app/immutable/chunks/cAfuCUf-.js.gz +0 -0
- package/build/client/_app/immutable/chunks/vll1K05s.js +0 -12
- package/build/client/_app/immutable/chunks/vll1K05s.js.br +0 -0
- package/build/client/_app/immutable/chunks/vll1K05s.js.gz +0 -0
- package/build/client/_app/immutable/chunks/wU4H_Xw3.js +0 -1
- package/build/client/_app/immutable/chunks/wU4H_Xw3.js.br +0 -0
- package/build/client/_app/immutable/chunks/wU4H_Xw3.js.gz +0 -0
- package/build/client/_app/immutable/chunks/yLdhLQbD.js.br +0 -0
- package/build/client/_app/immutable/chunks/yLdhLQbD.js.gz +0 -0
- package/build/client/_app/immutable/chunks/yYKc4xgI.js.br +0 -0
- package/build/client/_app/immutable/chunks/yYKc4xgI.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.CLSymNWl.js +0 -2
- package/build/client/_app/immutable/entry/app.CLSymNWl.js.br +0 -0
- package/build/client/_app/immutable/entry/app.CLSymNWl.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.D4AIF2Ao.js +0 -1
- package/build/client/_app/immutable/entry/start.D4AIF2Ao.js.br +0 -0
- package/build/client/_app/immutable/entry/start.D4AIF2Ao.js.gz +0 -0
- package/build/client/_app/immutable/nodes/0.Bk5Y_mtP.js +0 -10
- package/build/client/_app/immutable/nodes/0.Bk5Y_mtP.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.Bk5Y_mtP.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.DMeNq-MM.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.DMeNq-MM.js.gz +0 -0
- package/build/client/_app/immutable/nodes/10.C85i7naL.js.br +0 -0
- package/build/client/_app/immutable/nodes/10.C85i7naL.js.gz +0 -0
- package/build/client/_app/immutable/nodes/11.B3oT5Eyb.js.br +0 -0
- package/build/client/_app/immutable/nodes/11.B3oT5Eyb.js.gz +0 -0
- package/build/client/_app/immutable/nodes/12.CzGzD4iD.js.br +0 -0
- package/build/client/_app/immutable/nodes/12.CzGzD4iD.js.gz +0 -0
- package/build/client/_app/immutable/nodes/13.hmYycyBf.js.br +0 -0
- package/build/client/_app/immutable/nodes/13.hmYycyBf.js.gz +0 -0
- package/build/client/_app/immutable/nodes/14.KtuQwZ-C.js.br +0 -0
- package/build/client/_app/immutable/nodes/14.KtuQwZ-C.js.gz +0 -0
- package/build/client/_app/immutable/nodes/15.C7QObash.js.br +0 -0
- package/build/client/_app/immutable/nodes/15.C7QObash.js.gz +0 -0
- package/build/client/_app/immutable/nodes/16.BJOpVasQ.js.br +0 -0
- package/build/client/_app/immutable/nodes/16.BJOpVasQ.js.gz +0 -0
- package/build/client/_app/immutable/nodes/17.Bk-1GRlF.js.br +0 -0
- package/build/client/_app/immutable/nodes/17.Bk-1GRlF.js.gz +0 -0
- package/build/client/_app/immutable/nodes/19.lzLFSTUS.js.br +0 -3
- package/build/client/_app/immutable/nodes/19.lzLFSTUS.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.D1A41fuz.js +0 -25
- package/build/client/_app/immutable/nodes/2.D1A41fuz.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.D1A41fuz.js.gz +0 -0
- package/build/client/_app/immutable/nodes/20.DqOEVNtJ.js.br +0 -0
- package/build/client/_app/immutable/nodes/20.DqOEVNtJ.js.gz +0 -0
- package/build/client/_app/immutable/nodes/21.BmaCB5Rb.js.br +0 -0
- package/build/client/_app/immutable/nodes/21.BmaCB5Rb.js.gz +0 -0
- package/build/client/_app/immutable/nodes/22.D4F9Jlfe.js.br +0 -0
- package/build/client/_app/immutable/nodes/22.D4F9Jlfe.js.gz +0 -0
- package/build/client/_app/immutable/nodes/23.CGv8T_kx.js.br +0 -0
- package/build/client/_app/immutable/nodes/23.CGv8T_kx.js.gz +0 -0
- package/build/client/_app/immutable/nodes/24.DKrgSigC.js.br +0 -0
- package/build/client/_app/immutable/nodes/24.DKrgSigC.js.gz +0 -0
- package/build/client/_app/immutable/nodes/25.DsBTVUcU.js +0 -12
- package/build/client/_app/immutable/nodes/25.DsBTVUcU.js.br +0 -0
- package/build/client/_app/immutable/nodes/25.DsBTVUcU.js.gz +0 -0
- package/build/client/_app/immutable/nodes/26.5XFLLXwF.js.br +0 -0
- package/build/client/_app/immutable/nodes/26.5XFLLXwF.js.gz +0 -0
- package/build/client/_app/immutable/nodes/27.BgW1QGtl.js.br +0 -0
- package/build/client/_app/immutable/nodes/27.BgW1QGtl.js.gz +0 -0
- package/build/client/_app/immutable/nodes/28.DeOjXHlX.js.br +0 -0
- package/build/client/_app/immutable/nodes/28.DeOjXHlX.js.gz +0 -0
- package/build/client/_app/immutable/nodes/3.Dh_akpU9.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.Dh_akpU9.js.gz +0 -0
- package/build/client/_app/immutable/nodes/4.Bs1kn53S.js.br +0 -0
- package/build/client/_app/immutable/nodes/4.Bs1kn53S.js.gz +0 -0
- package/build/client/_app/immutable/nodes/6.C71EcMPx.js.br +0 -0
- package/build/client/_app/immutable/nodes/6.C71EcMPx.js.gz +0 -0
- package/build/client/_app/immutable/nodes/7.ZTOGuaHI.js.br +0 -0
- package/build/client/_app/immutable/nodes/7.ZTOGuaHI.js.gz +0 -0
- package/build/client/_app/immutable/nodes/8.CvoRv_Q7.js.br +0 -0
- package/build/client/_app/immutable/nodes/8.CvoRv_Q7.js.gz +0 -0
- package/build/client/_app/immutable/nodes/9.BKcDiRzn.js.br +0 -0
- package/build/client/_app/immutable/nodes/9.BKcDiRzn.js.gz +0 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { readFile, readdir, stat, open, realpath, mkdir, writeFile, rename, rm, access, constants, lstat, chmod, appendFile } from 'node:fs/promises';
|
|
2
|
+
import os, { homedir, tmpdir } from 'node:os';
|
|
2
3
|
import path from 'node:path';
|
|
3
|
-
import { v as version, d as defaultKeychain } from './keychain.js-
|
|
4
|
+
import { v as version, d as defaultKeychain } from './keychain.js-CspIw1lK.js';
|
|
4
5
|
import { readFileSync, existsSync, mkdirSync, writeFileSync, renameSync, openSync, closeSync, watch, statSync, fstatSync, readSync, accessSync, constants as constants$1, realpathSync, lstatSync, rmSync } from 'node:fs';
|
|
5
6
|
import { spawn, execFileSync } from 'node:child_process';
|
|
6
|
-
import os, { tmpdir } from 'node:os';
|
|
7
7
|
import { l as loopbackPreview, f as frameRefusal } from './preview.js-CbgkVvT_.js';
|
|
8
8
|
import { p as previewNoteOf, a as pageOf } from './previewnote.js-DB6VK2fp.js';
|
|
9
|
-
import {
|
|
9
|
+
import { p as plainStatus, c as clean } from './plain.js-Dc97sYaJ.js';
|
|
10
|
+
import { B as BRIEF_MAX_BYTES, p as parseBrief } from './brief.js-TS-K0lZ6.js';
|
|
10
11
|
import { d as defaultStateDir, i as isInside, s as storeFileFor, M as MessageStore, c as changeRoute, a as isChangeRequest, r as readyTimes, t as taskRuns, D as DECISIVE, C as CI_READY_NOTE, w as workerWindow } from './store.js-H2CHLL0k.js';
|
|
11
12
|
import { parseDocument } from 'yaml';
|
|
12
13
|
import { E as EVIDENCE_WORDS, C as COMMAND_BASE_ENV, F as FACT_WORDS, o as outcomeWords, O as OUTCOMES } from './passage-meta.js-uvNUyJkg.js';
|
|
@@ -14,9 +15,9 @@ import { s as shortTitle } from './format.js-D3lWEg6U.js';
|
|
|
14
15
|
import { r as runStep, c as checksLine } from './checks.js-DGdGhp1G.js';
|
|
15
16
|
import net, { createServer } from 'node:net';
|
|
16
17
|
import { D as DECIDED_MAX, d as detectHosted, p as portInHost, h as hostedAddress } from './decisionform.js-Ds5LU9Wh.js';
|
|
17
|
-
import { T as TERMINAL_PATH, a as TERMINAL_PROTOCOL, b as TERMINAL_CLOSE, S as SETUP_TERMINAL_PATH, c as TOKEN_PROTOCOL_PREFIX } from './terminal.js-
|
|
18
|
+
import { T as TERMINAL_PATH, a as TERMINAL_PROTOCOL, b as TERMINAL_CLOSE, S as SETUP_TERMINAL_PATH, c as TOKEN_PROTOCOL_PREFIX } from './terminal.js-s8yEF1TY.js';
|
|
18
19
|
import WebSocket, { WebSocketServer } from 'ws';
|
|
19
|
-
import { timingSafeEqual, randomBytes, createHash, createHmac } from 'node:crypto';
|
|
20
|
+
import { timingSafeEqual, randomBytes, randomUUID, createHash, createHmac } from 'node:crypto';
|
|
20
21
|
import { r as roundId, t as testLine } from './buildlog.js-BCKtSKOt.js';
|
|
21
22
|
import { a as alertsFor, r as raise, s as sessionAlert, d as digest, A as ALERT_KINDS } from './bell.js-DuW71LLn.js';
|
|
22
23
|
import { C as CHOICES, N as NOTE_MAX, b as closable, p as picksLine, d as closeText, e as answerText, D as DECIDED_LABEL, f as choiceLabel, g as awaitsAnswer, o as optionsFor, h as holdCardId, q as questionLine, a as answerOf } from './inbox.js-CnikIOgr.js';
|
|
@@ -30,6 +31,7 @@ import { p as projectTabHref, a as parseSlotKey } from './keys.js-iHygUPeb.js';
|
|
|
30
31
|
import { v as validPullRequestQuery } from './pullrequests.js-CCzk2sqm.js';
|
|
31
32
|
import { createServer as createServer$1 } from 'node:http';
|
|
32
33
|
import { n as needsYou } from './harbour.js-D3N7u1_p.js';
|
|
34
|
+
import { p as parseHarness, H as HARNESS_NAMES } from './harness.js-DPojOlFJ.js';
|
|
33
35
|
import './urls.js-CM6aklCF.js';
|
|
34
36
|
import './previewhelper.js-D_I_aa96.js';
|
|
35
37
|
|
|
@@ -214,8 +216,8 @@ const CREW_STATES = [
|
|
|
214
216
|
"failed",
|
|
215
217
|
"unknown"
|
|
216
218
|
];
|
|
217
|
-
function parseJson$1(
|
|
218
|
-
const trimmed =
|
|
219
|
+
function parseJson$1(text2, what) {
|
|
220
|
+
const trimmed = text2.trim();
|
|
219
221
|
if (!trimmed) throw new ContractError(`${what} printed nothing`);
|
|
220
222
|
try {
|
|
221
223
|
return JSON.parse(trimmed);
|
|
@@ -297,8 +299,8 @@ function parseTask(v) {
|
|
|
297
299
|
backlog: parseBacklogRecord(v.backlog)
|
|
298
300
|
};
|
|
299
301
|
}
|
|
300
|
-
function parseFleetSnapshot(
|
|
301
|
-
const v = parseJson$1(
|
|
302
|
+
function parseFleetSnapshot(text2) {
|
|
303
|
+
const v = parseJson$1(text2, "fm-fleet-snapshot.sh --json");
|
|
302
304
|
if (!isObj$2(v)) throw new ContractError("fleet snapshot is not a JSON object");
|
|
303
305
|
if (v.schema !== FLEET_SNAPSHOT_SCHEMA) {
|
|
304
306
|
throw new ContractError(
|
|
@@ -323,7 +325,7 @@ function parseFleetSnapshot(text) {
|
|
|
323
325
|
secondMates: parseSecondMates(v.secondmate_current)
|
|
324
326
|
};
|
|
325
327
|
}
|
|
326
|
-
function list(v, f) {
|
|
328
|
+
function list$1(v, f) {
|
|
327
329
|
return Array.isArray(v) ? v.filter(isObj$2).map(f).filter((x) => x !== null) : [];
|
|
328
330
|
}
|
|
329
331
|
function withId(o, f) {
|
|
@@ -356,7 +358,7 @@ function parseSecondMate(v) {
|
|
|
356
358
|
observedAt: nonBlank(freshness.observed_at),
|
|
357
359
|
ageSeconds: num$2(freshness.age_seconds)
|
|
358
360
|
},
|
|
359
|
-
active: list(
|
|
361
|
+
active: list$1(
|
|
360
362
|
v.active_children,
|
|
361
363
|
(c) => withId(c, (cid) => ({
|
|
362
364
|
id: cid,
|
|
@@ -367,7 +369,7 @@ function parseSecondMate(v) {
|
|
|
367
369
|
doing: nonBlank(c.doing)
|
|
368
370
|
}))
|
|
369
371
|
),
|
|
370
|
-
decisions: list(
|
|
372
|
+
decisions: list$1(
|
|
371
373
|
v.decisions_open,
|
|
372
374
|
(d) => withId(d, (did) => ({
|
|
373
375
|
id: did,
|
|
@@ -379,7 +381,7 @@ function parseSecondMate(v) {
|
|
|
379
381
|
source: nonBlank(d.source)
|
|
380
382
|
}))
|
|
381
383
|
),
|
|
382
|
-
holds: list(
|
|
384
|
+
holds: list$1(
|
|
383
385
|
v.holds,
|
|
384
386
|
(h) => withId(h, (hid) => ({
|
|
385
387
|
id: hid,
|
|
@@ -389,7 +391,7 @@ function parseSecondMate(v) {
|
|
|
389
391
|
source: nonBlank(h.source)
|
|
390
392
|
}))
|
|
391
393
|
),
|
|
392
|
-
queued: list(
|
|
394
|
+
queued: list$1(
|
|
393
395
|
v.queued,
|
|
394
396
|
(q) => withId(q, (qid) => ({
|
|
395
397
|
id: qid,
|
|
@@ -405,7 +407,7 @@ function parseSecondMate(v) {
|
|
|
405
407
|
since: nonBlank(q.since)
|
|
406
408
|
}))
|
|
407
409
|
),
|
|
408
|
-
landed: list(
|
|
410
|
+
landed: list$1(
|
|
409
411
|
v.landed,
|
|
410
412
|
(l) => withId(l, (lid) => {
|
|
411
413
|
const completion = obj(l.completion);
|
|
@@ -419,7 +421,7 @@ function parseSecondMate(v) {
|
|
|
419
421
|
};
|
|
420
422
|
})
|
|
421
423
|
),
|
|
422
|
-
endpoints: list(
|
|
424
|
+
endpoints: list$1(
|
|
423
425
|
v.endpoints,
|
|
424
426
|
(e) => withId(e, (eid) => {
|
|
425
427
|
const ep = obj(e.endpoint);
|
|
@@ -439,15 +441,15 @@ function parseSecondMate(v) {
|
|
|
439
441
|
}
|
|
440
442
|
function parseSecondMates(v) {
|
|
441
443
|
if (!isObj$2(v)) return null;
|
|
442
|
-
const records2 = list(v.records, parseSecondMate);
|
|
444
|
+
const records2 = list$1(v.records, parseSecondMate);
|
|
443
445
|
return {
|
|
444
446
|
records: records2,
|
|
445
447
|
total: num$2(v.total) ?? records2.length,
|
|
446
448
|
truncated: num$2(v.truncated) ?? 0
|
|
447
449
|
};
|
|
448
450
|
}
|
|
449
|
-
function parsePrimaryReady(
|
|
450
|
-
const v = parseJson$1(
|
|
451
|
+
function parsePrimaryReady(text2) {
|
|
452
|
+
const v = parseJson$1(text2, "fm-inbox.sh ready");
|
|
451
453
|
if (!isObj$2(v)) throw new ContractError("readiness is not a JSON object");
|
|
452
454
|
if (v.schema !== PRIMARY_READY_SCHEMA) {
|
|
453
455
|
throw new ContractError(
|
|
@@ -471,8 +473,8 @@ function parsePrimaryReady(text) {
|
|
|
471
473
|
canReceive: recv === true ? true : recv === false ? false : "unknown"
|
|
472
474
|
};
|
|
473
475
|
}
|
|
474
|
-
function parseInboxNote(
|
|
475
|
-
const v = parseJson$1(
|
|
476
|
+
function parseInboxNote(text2) {
|
|
477
|
+
const v = parseJson$1(text2, "fm-inbox.sh note --json");
|
|
476
478
|
if (!isObj$2(v)) throw new ContractError("note result is not a JSON object");
|
|
477
479
|
if (v.schema !== INBOX_NOTE_SCHEMA) {
|
|
478
480
|
throw new ContractError(
|
|
@@ -516,8 +518,8 @@ function parseReceipt(v, acknowledged) {
|
|
|
516
518
|
reply: parseReply(v.reply)
|
|
517
519
|
};
|
|
518
520
|
}
|
|
519
|
-
function parseInboxReceipts(
|
|
520
|
-
const v = parseJson$1(
|
|
521
|
+
function parseInboxReceipts(text2) {
|
|
522
|
+
const v = parseJson$1(text2, "fm-inbox.sh receipts");
|
|
521
523
|
if (!isObj$2(v)) throw new ContractError("receipts are not a JSON object");
|
|
522
524
|
if (v.schema !== INBOX_RECEIPTS_SCHEMA) {
|
|
523
525
|
throw new ContractError(
|
|
@@ -540,8 +542,8 @@ function parseInboxReceipts(text) {
|
|
|
540
542
|
}
|
|
541
543
|
const ANSI$1 = /\u001b\[[0-?]*[ -/]*[@-~]|\u001b\][^\u0007\u001b]*(?:\u0007|\u001b\\)|\u001b[@-_]/g;
|
|
542
544
|
const CONTROL = /[\u0000-\u0008\u000b-\u001f\u007f]/g;
|
|
543
|
-
function parsePeekOutput(
|
|
544
|
-
const lines =
|
|
545
|
+
function parsePeekOutput(text2, maxLines) {
|
|
546
|
+
const lines = text2.replace(/\r\n?/g, "\n").replace(ANSI$1, "").replace(CONTROL, "").split("\n");
|
|
545
547
|
while (lines.length && lines[lines.length - 1].trim() === "") lines.pop();
|
|
546
548
|
return lines.slice(-maxLines);
|
|
547
549
|
}
|
|
@@ -685,13 +687,13 @@ async function checkScript(firstmateDir, s) {
|
|
|
685
687
|
} catch {
|
|
686
688
|
return { ...base, ok: false, problem: `${s.name} is not executable` };
|
|
687
689
|
}
|
|
688
|
-
let
|
|
690
|
+
let text2;
|
|
689
691
|
try {
|
|
690
|
-
|
|
692
|
+
text2 = await readHead$1(file);
|
|
691
693
|
} catch (e) {
|
|
692
694
|
return { ...base, ok: false, problem: `${s.name} could not be read: ${e.message}` };
|
|
693
695
|
}
|
|
694
|
-
const missing = s.markers.filter((m) => !
|
|
696
|
+
const missing = s.markers.filter((m) => !text2.includes(m));
|
|
695
697
|
if (missing.length) {
|
|
696
698
|
return {
|
|
697
699
|
...base,
|
|
@@ -784,7 +786,7 @@ const SAFE_REL = /^(?![./])[A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)*$/;
|
|
|
784
786
|
const REMOTE_PEEK_MAX_LINES = 100;
|
|
785
787
|
const REMOTE_UNREACHABLE = 255;
|
|
786
788
|
const PEEK_DEFAULT_LINES = 40;
|
|
787
|
-
const REQUEST_ID = /^(?!\.)[A-Za-z0-9._:-]{1,128}$/;
|
|
789
|
+
const REQUEST_ID$1 = /^(?!\.)[A-Za-z0-9._:-]{1,128}$/;
|
|
788
790
|
const NOTE_MAX_BYTES = 16 * 1024;
|
|
789
791
|
const NOTE_EXIT_UNANNOUNCED = 3;
|
|
790
792
|
const SNAPSHOT_MAX_BYTES = 8 * 1024 * 1024;
|
|
@@ -956,7 +958,7 @@ function createScriptAdapter(install, opts = {}) {
|
|
|
956
958
|
},
|
|
957
959
|
mateNote: async (mate, requestId, body) => {
|
|
958
960
|
if (!TASK_ID$1.test(mate.id)) return invalid("fm-inbox.sh", "invalid second mate id");
|
|
959
|
-
if (!REQUEST_ID.test(requestId)) return invalid("fm-inbox.sh", "invalid request id");
|
|
961
|
+
if (!REQUEST_ID$1.test(requestId)) return invalid("fm-inbox.sh", "invalid request id");
|
|
960
962
|
if (!body.trim()) return invalid("fm-inbox.sh", "the message is empty");
|
|
961
963
|
if (Buffer.byteLength(body) > NOTE_MAX_BYTES) {
|
|
962
964
|
return invalid("fm-inbox.sh", `the message is longer than ${NOTE_MAX_BYTES} bytes`);
|
|
@@ -986,7 +988,7 @@ function createScriptAdapter(install, opts = {}) {
|
|
|
986
988
|
observedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
987
989
|
error: { kind: "invalid-argument", script: "fm-inbox.sh", message: message2 }
|
|
988
990
|
});
|
|
989
|
-
if (!REQUEST_ID.test(requestId)) return invalid2("invalid request id");
|
|
991
|
+
if (!REQUEST_ID$1.test(requestId)) return invalid2("invalid request id");
|
|
990
992
|
if (!body.trim()) return invalid2("the message is empty");
|
|
991
993
|
if (Buffer.byteLength(body) > NOTE_MAX_BYTES) {
|
|
992
994
|
return invalid2(`the message is longer than ${NOTE_MAX_BYTES} bytes`);
|
|
@@ -1133,7 +1135,9 @@ const DROP = /* @__PURE__ */ new Set([
|
|
|
1133
1135
|
"CLAUDE_PID",
|
|
1134
1136
|
"CLAUDE_SESSION_ID",
|
|
1135
1137
|
"CLAUDE_PROJECT_DIR",
|
|
1136
|
-
"CLAUDE_ENV_FILE"
|
|
1138
|
+
"CLAUDE_ENV_FILE",
|
|
1139
|
+
"CODEX_THREAD_ID",
|
|
1140
|
+
"CODEX_INTERNAL_ORIGINATOR_OVERRIDE"
|
|
1137
1141
|
]);
|
|
1138
1142
|
function sessionEnv(env) {
|
|
1139
1143
|
const out = {};
|
|
@@ -1143,14 +1147,189 @@ function sessionEnv(env) {
|
|
|
1143
1147
|
}
|
|
1144
1148
|
return out;
|
|
1145
1149
|
}
|
|
1150
|
+
const FIRSTMATE_TMUX = "wh-firstmate";
|
|
1151
|
+
const TMUX_TIMEOUT_MS$1 = 1e4;
|
|
1152
|
+
const TMUX_FORMAT = "#{socket_path},#{pid},#{session_id}";
|
|
1153
|
+
const BUFFER = "wh-firstmate-input";
|
|
1154
|
+
const PASTE_MAX_INPUT_BYTES = 65 * 1024;
|
|
1155
|
+
const SESSION_OPTIONS = [
|
|
1156
|
+
["mouse", "on"],
|
|
1157
|
+
["status", "off"],
|
|
1158
|
+
["history-limit", "20000"]
|
|
1159
|
+
];
|
|
1160
|
+
const TMUX_KEYS = {
|
|
1161
|
+
Enter: "Enter",
|
|
1162
|
+
Escape: "Escape",
|
|
1163
|
+
Up: "Up",
|
|
1164
|
+
Down: "Down",
|
|
1165
|
+
"0": "0",
|
|
1166
|
+
"1": "1",
|
|
1167
|
+
"2": "2",
|
|
1168
|
+
"3": "3",
|
|
1169
|
+
"4": "4",
|
|
1170
|
+
"5": "5",
|
|
1171
|
+
"6": "6",
|
|
1172
|
+
"7": "7",
|
|
1173
|
+
"8": "8",
|
|
1174
|
+
"9": "9"
|
|
1175
|
+
};
|
|
1176
|
+
function launchArgv(spec) {
|
|
1177
|
+
return [
|
|
1178
|
+
"new-session",
|
|
1179
|
+
"-d",
|
|
1180
|
+
"-s",
|
|
1181
|
+
FIRSTMATE_TMUX,
|
|
1182
|
+
"-x",
|
|
1183
|
+
"160",
|
|
1184
|
+
"-y",
|
|
1185
|
+
"48",
|
|
1186
|
+
"-c",
|
|
1187
|
+
spec.cwd,
|
|
1188
|
+
...Object.entries(spec.env).flatMap(([k, v]) => ["-e", `${k}=${v}`]),
|
|
1189
|
+
"--",
|
|
1190
|
+
...spec.argv
|
|
1191
|
+
];
|
|
1192
|
+
}
|
|
1193
|
+
const attachHint = (socket) => shellLine(["tmux", "-L", socket, "attach", "-t", FIRSTMATE_TMUX]);
|
|
1194
|
+
class TmuxBackend {
|
|
1195
|
+
label = "tmux";
|
|
1196
|
+
socket;
|
|
1197
|
+
env;
|
|
1198
|
+
find;
|
|
1199
|
+
run;
|
|
1200
|
+
constructor(opts) {
|
|
1201
|
+
this.socket = opts.socket || DEFAULT_TMUX_SOCKET;
|
|
1202
|
+
this.env = opts.env;
|
|
1203
|
+
this.find = opts.find;
|
|
1204
|
+
this.run = opts.run ?? runBounded;
|
|
1205
|
+
}
|
|
1206
|
+
unavailable() {
|
|
1207
|
+
if (!TMUX_SOCKET.test(this.socket)) {
|
|
1208
|
+
return `The tmux socket name ${JSON.stringify(this.socket)} is not valid; use letters, digits, '.', '_' or '-'.`;
|
|
1209
|
+
}
|
|
1210
|
+
if (!this.find("tmux")) {
|
|
1211
|
+
return "tmux is not installed or not on PATH. Install tmux (for example `brew install tmux`) and restart Wheelhouse.";
|
|
1212
|
+
}
|
|
1213
|
+
return null;
|
|
1214
|
+
}
|
|
1215
|
+
/** Run tmux on Wheelhouse's own server only; nothing reaches tmux any other way. */
|
|
1216
|
+
tmux(args, extra = {}) {
|
|
1217
|
+
const tmux = this.find("tmux");
|
|
1218
|
+
if (!tmux) return Promise.reject(new Error("tmux is missing"));
|
|
1219
|
+
return this.run(tmux, ["-L", this.socket, ...args], {
|
|
1220
|
+
env: this.env,
|
|
1221
|
+
timeoutMs: TMUX_TIMEOUT_MS$1,
|
|
1222
|
+
maxOutputBytes: 256 * 1024,
|
|
1223
|
+
...extra
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
async running() {
|
|
1227
|
+
if (!this.find("tmux") || !TMUX_SOCKET.test(this.socket)) return null;
|
|
1228
|
+
const r = await this.tmux(["list-sessions", "-F", "#{session_name}"]);
|
|
1229
|
+
if (r.ok) return r.stdout.split("\n").includes(FIRSTMATE_TMUX);
|
|
1230
|
+
if (r.kind === "exit" && NO_SERVER.test(r.stderr)) return false;
|
|
1231
|
+
return null;
|
|
1232
|
+
}
|
|
1233
|
+
async start(spec) {
|
|
1234
|
+
const r = await this.tmux(launchArgv(spec), { cwd: spec.cwd });
|
|
1235
|
+
if (!r.ok) {
|
|
1236
|
+
return {
|
|
1237
|
+
ok: false,
|
|
1238
|
+
error: `tmux could not start Firstmate: ${r.stderr.trim() || r.message}`
|
|
1239
|
+
};
|
|
1240
|
+
}
|
|
1241
|
+
for (const [name2, value] of SESSION_OPTIONS) {
|
|
1242
|
+
await this.tmux(["set-option", "-t", `=${FIRSTMATE_TMUX}:`, name2, value]);
|
|
1243
|
+
}
|
|
1244
|
+
return { ok: true };
|
|
1245
|
+
}
|
|
1246
|
+
async variable(name2) {
|
|
1247
|
+
const r = await this.tmux(["show-environment", "-t", FIRSTMATE_TMUX, name2]);
|
|
1248
|
+
if (r.ok) return r.stdout.trim().replace(new RegExp(`^${name2}=`), "");
|
|
1249
|
+
return /unknown variable/.test(r.stderr) ? "" : null;
|
|
1250
|
+
}
|
|
1251
|
+
async screen() {
|
|
1252
|
+
const r = await this.tmux(["capture-pane", "-p", "-t", `=${FIRSTMATE_TMUX}:`]);
|
|
1253
|
+
return r.ok ? r.stdout : null;
|
|
1254
|
+
}
|
|
1255
|
+
async paste(text2) {
|
|
1256
|
+
const load2 = await this.tmux(["load-buffer", "-b", BUFFER, "-"], {
|
|
1257
|
+
input: text2,
|
|
1258
|
+
maxInputBytes: PASTE_MAX_INPUT_BYTES
|
|
1259
|
+
});
|
|
1260
|
+
if (!load2.ok) {
|
|
1261
|
+
return {
|
|
1262
|
+
ok: false,
|
|
1263
|
+
error: `tmux could not take the message: ${load2.stderr.trim() || load2.message}`
|
|
1264
|
+
};
|
|
1265
|
+
}
|
|
1266
|
+
const paste = await this.tmux([
|
|
1267
|
+
"paste-buffer",
|
|
1268
|
+
"-d",
|
|
1269
|
+
"-p",
|
|
1270
|
+
"-b",
|
|
1271
|
+
BUFFER,
|
|
1272
|
+
"-t",
|
|
1273
|
+
`=${FIRSTMATE_TMUX}:`
|
|
1274
|
+
]);
|
|
1275
|
+
if (!paste.ok) {
|
|
1276
|
+
return {
|
|
1277
|
+
ok: false,
|
|
1278
|
+
error: `tmux could not paste the message: ${paste.stderr.trim() || paste.message}`
|
|
1279
|
+
};
|
|
1280
|
+
}
|
|
1281
|
+
return { ok: true };
|
|
1282
|
+
}
|
|
1283
|
+
async key(key) {
|
|
1284
|
+
const r = await this.tmux(["send-keys", "-t", `=${FIRSTMATE_TMUX}:`, TMUX_KEYS[key]]);
|
|
1285
|
+
if (!r.ok) {
|
|
1286
|
+
return { ok: false, error: `tmux could not send a key: ${r.stderr.trim() || r.message}` };
|
|
1287
|
+
}
|
|
1288
|
+
return { ok: true };
|
|
1289
|
+
}
|
|
1290
|
+
attach() {
|
|
1291
|
+
return {
|
|
1292
|
+
argv: [
|
|
1293
|
+
this.find("tmux"),
|
|
1294
|
+
"-L",
|
|
1295
|
+
this.socket,
|
|
1296
|
+
"attach-session",
|
|
1297
|
+
"-t",
|
|
1298
|
+
`=${FIRSTMATE_TMUX}`
|
|
1299
|
+
],
|
|
1300
|
+
env: { ...this.env, TERM: "xterm-256color" }
|
|
1301
|
+
};
|
|
1302
|
+
}
|
|
1303
|
+
attachHint() {
|
|
1304
|
+
return attachHint(this.socket);
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
function firstmateTmux(opts) {
|
|
1308
|
+
const socket = opts.tmuxSocket || DEFAULT_TMUX_SOCKET;
|
|
1309
|
+
const env = sessionEnv(opts.env ?? process.env);
|
|
1310
|
+
const find = opts.find ?? ((name2) => which(name2, env.PATH));
|
|
1311
|
+
const run = opts.run ?? runBounded;
|
|
1312
|
+
return async () => {
|
|
1313
|
+
const tmux = find("tmux");
|
|
1314
|
+
if (!tmux || !TMUX_SOCKET.test(socket)) return null;
|
|
1315
|
+
const r = await run(
|
|
1316
|
+
tmux,
|
|
1317
|
+
["-L", socket, "display-message", "-p", "-t", `=${FIRSTMATE_TMUX}:`, TMUX_FORMAT],
|
|
1318
|
+
{ env, timeoutMs: TMUX_TIMEOUT_MS$1, maxOutputBytes: 64 * 1024 }
|
|
1319
|
+
);
|
|
1320
|
+
if (!r.ok) return null;
|
|
1321
|
+
const value = r.stdout.trim().replace(/,\$(\d+)$/, ",$1");
|
|
1322
|
+
return /^\/.*,\d+,\d+$/.test(value) ? value : null;
|
|
1323
|
+
};
|
|
1324
|
+
}
|
|
1146
1325
|
const CREW_FALLBACK = DEFAULT_SERVER;
|
|
1147
|
-
const TMUX_TIMEOUT_MS
|
|
1326
|
+
const TMUX_TIMEOUT_MS = 5e3;
|
|
1148
1327
|
const META_MAX_BYTES$1 = 64 * 1024;
|
|
1149
1328
|
const LIST_MAX_BYTES$1 = 1024 * 1024;
|
|
1150
1329
|
const WINDOW_FORMAT = "#{socket_path},#{pid},#{session_id} #{window_id} #{window_index} #{session_name} #{window_name}";
|
|
1151
|
-
function metaGet(
|
|
1330
|
+
function metaGet(text2, key) {
|
|
1152
1331
|
let value = "";
|
|
1153
|
-
for (const line of
|
|
1332
|
+
for (const line of text2.split("\n"))
|
|
1154
1333
|
if (line.startsWith(`${key}=`)) value = line.slice(key.length + 1);
|
|
1155
1334
|
return value;
|
|
1156
1335
|
}
|
|
@@ -1227,7 +1406,7 @@ function crewTmux(opts) {
|
|
|
1227
1406
|
servers().map(async (server) => {
|
|
1228
1407
|
const r = await run(tmux, [...server, "list-windows", "-a", "-F", WINDOW_FORMAT], {
|
|
1229
1408
|
env,
|
|
1230
|
-
timeoutMs: TMUX_TIMEOUT_MS
|
|
1409
|
+
timeoutMs: TMUX_TIMEOUT_MS,
|
|
1231
1410
|
maxOutputBytes: LIST_MAX_BYTES$1
|
|
1232
1411
|
});
|
|
1233
1412
|
return r.ok ? parseWindows(r.stdout) : [];
|
|
@@ -1317,8 +1496,8 @@ const MAX_STAGES = 24;
|
|
|
1317
1496
|
const MAX_CHECKS = 16;
|
|
1318
1497
|
const MAX_COND_DEPTH = 8;
|
|
1319
1498
|
const UNITS = { s: 1e3, m: 6e4, h: 36e5, d: 864e5 };
|
|
1320
|
-
function durationMs(
|
|
1321
|
-
const m = DURATION.exec(
|
|
1499
|
+
function durationMs(text2) {
|
|
1500
|
+
const m = DURATION.exec(text2);
|
|
1322
1501
|
return m ? Number(m[1]) * UNITS[m[2]] : null;
|
|
1323
1502
|
}
|
|
1324
1503
|
const isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
@@ -1448,8 +1627,8 @@ function note(p, where, v) {
|
|
|
1448
1627
|
}
|
|
1449
1628
|
fields(p, where, v, ["when", "text"]);
|
|
1450
1629
|
const when = cond(p, `${where}.when`, v.when);
|
|
1451
|
-
const
|
|
1452
|
-
return when !== void 0 &&
|
|
1630
|
+
const text2 = str$4(p, `${where}.text`, v.text, { required: true, max: 1e3 });
|
|
1631
|
+
return when !== void 0 && text2 !== void 0 ? { when, text: text2 } : void 0;
|
|
1453
1632
|
}
|
|
1454
1633
|
const COMMIT_VALUES = ["merge.commit", "pr.head"];
|
|
1455
1634
|
function check(p, where, v, opts) {
|
|
@@ -1838,11 +2017,11 @@ function validatePassage(doc, opts) {
|
|
|
1838
2017
|
}
|
|
1839
2018
|
return p.list.length ? { ok: false, errors: p.list } : { ok: true, value: out };
|
|
1840
2019
|
}
|
|
1841
|
-
function parsePassage(
|
|
1842
|
-
if (Buffer.byteLength(
|
|
2020
|
+
function parsePassage(text2, opts) {
|
|
2021
|
+
if (Buffer.byteLength(text2) > MAX_FILE_BYTES$1) {
|
|
1843
2022
|
return { ok: false, errors: [`the file is larger than ${MAX_FILE_BYTES$1 / 1024} KiB`] };
|
|
1844
2023
|
}
|
|
1845
|
-
const doc = parseDocument(
|
|
2024
|
+
const doc = parseDocument(text2, { prettyErrors: false, uniqueKeys: true });
|
|
1846
2025
|
if (doc.errors.length) {
|
|
1847
2026
|
return {
|
|
1848
2027
|
ok: false,
|
|
@@ -1950,8 +2129,8 @@ stages:
|
|
|
1950
2129
|
reached_when: backlog.done
|
|
1951
2130
|
evidence: [landed]
|
|
1952
2131
|
`;
|
|
1953
|
-
function load(
|
|
1954
|
-
const r = parsePassage(
|
|
2132
|
+
function load(text2) {
|
|
2133
|
+
const r = parsePassage(text2, { kind: "base" });
|
|
1955
2134
|
if (!r.ok) throw new Error(`built-in passage is invalid: ${r.errors.join("; ")}`);
|
|
1956
2135
|
return r.value;
|
|
1957
2136
|
}
|
|
@@ -2019,7 +2198,7 @@ function fromBase(file) {
|
|
|
2019
2198
|
liveStep: file.headline?.live ?? null
|
|
2020
2199
|
};
|
|
2021
2200
|
}
|
|
2022
|
-
const give = (
|
|
2201
|
+
const give = (text2) => ({ text: text2, ms: durationMs(text2) ?? 0 });
|
|
2023
2202
|
const CONDITION_FIELDS = ["reached_when", "skip_when", "skip_note", "failed_when"];
|
|
2024
2203
|
function applyLayer(base, layer) {
|
|
2025
2204
|
const errors = [];
|
|
@@ -2568,8 +2747,8 @@ async function gitContains(spec, ctx, deps) {
|
|
|
2568
2747
|
}
|
|
2569
2748
|
const COMMAND_OUTPUT_BYTES = 16 * 1024;
|
|
2570
2749
|
const DEFAULT_COMMAND_TIMEOUT = "5m";
|
|
2571
|
-
function plainOutput(
|
|
2572
|
-
return
|
|
2750
|
+
function plainOutput(text2) {
|
|
2751
|
+
return text2.replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, "").replace(/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g, "").split("\n").map((line) => {
|
|
2573
2752
|
const parts = line.replace(/\r$/, "").split("\r");
|
|
2574
2753
|
return parts[parts.length - 1];
|
|
2575
2754
|
}).join("\n").replace(/[\x00-\x08\x0b-\x1f\x7f]/g, "");
|
|
@@ -2950,9 +3129,9 @@ function trackOf(kind) {
|
|
|
2950
3129
|
}
|
|
2951
3130
|
const isYoloOn = (yolo) => (yolo ?? "").toLowerCase() === "on";
|
|
2952
3131
|
const isoSeconds = (ts) => new Date(ts * 1e3).toISOString();
|
|
2953
|
-
function parseProjectsRegistry(
|
|
3132
|
+
function parseProjectsRegistry(text2) {
|
|
2954
3133
|
const out = [];
|
|
2955
|
-
for (const line of
|
|
3134
|
+
for (const line of text2.split("\n")) {
|
|
2956
3135
|
const m = /^-\s+([A-Za-z0-9._-]+)(?:\s+\[([^\]]*)\])?(?:\s+-\s+(.*))?$/.exec(line.trim());
|
|
2957
3136
|
if (!m) continue;
|
|
2958
3137
|
const description = (m[3] ?? "").replace(/\s*\(added [^)]*\)\s*$/, "").trim();
|
|
@@ -2989,9 +3168,9 @@ function latestStatus(task2, ledger, nowSeconds) {
|
|
|
2989
3168
|
function historySummary(task2, ledger, nowSeconds) {
|
|
2990
3169
|
const last = latestStatus(task2, ledger, nowSeconds);
|
|
2991
3170
|
if (!last) return null;
|
|
2992
|
-
const
|
|
3171
|
+
const text2 = plainStatus(last.state, last.text);
|
|
2993
3172
|
return {
|
|
2994
|
-
text: last.ageSeconds === null ?
|
|
3173
|
+
text: last.ageSeconds === null ? text2 : `${text2} (${ageText(last.ageSeconds)})`,
|
|
2995
3174
|
raw: last.text.trim()
|
|
2996
3175
|
};
|
|
2997
3176
|
}
|
|
@@ -3418,11 +3597,11 @@ const unquote = (s) => {
|
|
|
3418
3597
|
const TABLE = /^([\w-]+)\[\d+\]\{([^}]*)\}:\s*$/;
|
|
3419
3598
|
const LIST = /^([\w-]+)\[\d+\]:\s*(.*)$/;
|
|
3420
3599
|
const FIELD = /^([\w-]+):\s*(.*)$/;
|
|
3421
|
-
function parseToon(
|
|
3600
|
+
function parseToon(text2) {
|
|
3422
3601
|
const root = {};
|
|
3423
3602
|
const stack = [{ indent: -1, block: root }];
|
|
3424
3603
|
let table = null;
|
|
3425
|
-
for (const raw of
|
|
3604
|
+
for (const raw of text2.replace(/\r\n?/g, "\n").split("\n")) {
|
|
3426
3605
|
if (!raw.trim()) continue;
|
|
3427
3606
|
const indent = raw.length - raw.trimStart().length;
|
|
3428
3607
|
const line = raw.trim();
|
|
@@ -3474,8 +3653,8 @@ const num$1 = (s) => {
|
|
|
3474
3653
|
const n = Number(s);
|
|
3475
3654
|
return Number.isFinite(n) ? n : 0;
|
|
3476
3655
|
};
|
|
3477
|
-
function parseRunStatus(
|
|
3478
|
-
const doc = parseToon(
|
|
3656
|
+
function parseRunStatus(text2) {
|
|
3657
|
+
const doc = parseToon(text2);
|
|
3479
3658
|
const run = [doc.run, doc.other_branch_run, doc.current_run].find(isBlock) ?? doc;
|
|
3480
3659
|
const id = scalar(run, "id");
|
|
3481
3660
|
const status2 = scalar(run, "status");
|
|
@@ -3788,8 +3967,8 @@ class EvidenceReader {
|
|
|
3788
3967
|
if (!runId || !RUN_ID$2.test(runId)) return Promise.resolve(null);
|
|
3789
3968
|
const dir = this.logsDir ? path.join(this.logsDir, runId) : null;
|
|
3790
3969
|
return this.pipelines.get(`${runId} ${worktree ?? ""}`, async () => {
|
|
3791
|
-
const
|
|
3792
|
-
const run =
|
|
3970
|
+
const text2 = worktree && path.isAbsolute(worktree) && this.runStatus ? await this.runStatus(runId, worktree).catch(() => null) : null;
|
|
3971
|
+
const run = text2 ? parseRunStatus(text2) : null;
|
|
3793
3972
|
const fromLogs = dir ? await readPipeline(dir).catch(() => null) : null;
|
|
3794
3973
|
if (!run || run.id !== runId || !run.steps.length) return fromLogs;
|
|
3795
3974
|
const fixes = /* @__PURE__ */ new Map();
|
|
@@ -4173,8 +4352,8 @@ async function readRunStatus(runId, worktree, env) {
|
|
|
4173
4352
|
});
|
|
4174
4353
|
return r.ok ? r.stdout : null;
|
|
4175
4354
|
}
|
|
4176
|
-
function diffBody(
|
|
4177
|
-
const all =
|
|
4355
|
+
function diffBody(text2) {
|
|
4356
|
+
const all = text2.replace(/\r\n?/g, "\n").split("\n");
|
|
4178
4357
|
if (all.at(-1) === "") all.pop();
|
|
4179
4358
|
const first = all.findIndex((l) => l.startsWith("@@"));
|
|
4180
4359
|
if (first < 0) return { lines: [], binary: all.some((l) => /^Binary files .* differ$/.test(l)) };
|
|
@@ -4339,11 +4518,11 @@ function parsePrFeedback(answer) {
|
|
|
4339
4518
|
if (a?.__typename === "Bot" || login?.endsWith("[bot]")) return false;
|
|
4340
4519
|
return !login || login !== author || author === viewer;
|
|
4341
4520
|
};
|
|
4342
|
-
const
|
|
4521
|
+
const text2 = (v) => (str2(v) ?? "").trim().slice(0, FEEDBACK_TEXT_MAX);
|
|
4343
4522
|
const items = [];
|
|
4344
4523
|
for (const r of nodes(p?.reviews)) {
|
|
4345
4524
|
const at = seconds(r.submittedAt);
|
|
4346
|
-
const body =
|
|
4525
|
+
const body = text2(r.body);
|
|
4347
4526
|
const asks = r.state === "CHANGES_REQUESTED" || r.state === "COMMENTED" && body;
|
|
4348
4527
|
if (at === null || !asks || !person(r.author) || !str2(r.id)) continue;
|
|
4349
4528
|
items.push({
|
|
@@ -4369,7 +4548,7 @@ function parsePrFeedback(answer) {
|
|
|
4369
4548
|
kind: "thread",
|
|
4370
4549
|
state: null,
|
|
4371
4550
|
author: str2(c.author?.login),
|
|
4372
|
-
text:
|
|
4551
|
+
text: text2(c.body),
|
|
4373
4552
|
at,
|
|
4374
4553
|
url: githubUrl(c.url),
|
|
4375
4554
|
path: str2(t.path),
|
|
@@ -4379,7 +4558,7 @@ function parsePrFeedback(answer) {
|
|
|
4379
4558
|
}
|
|
4380
4559
|
for (const c of nodes(p?.comments)) {
|
|
4381
4560
|
const at = seconds(c.createdAt);
|
|
4382
|
-
const body =
|
|
4561
|
+
const body = text2(c.body);
|
|
4383
4562
|
if (at === null || isApprovalChatter(body) || !person(c.author) || !str2(c.id)) continue;
|
|
4384
4563
|
items.push({
|
|
4385
4564
|
id: c.id,
|
|
@@ -4690,12 +4869,12 @@ const REMOTE_LOOK_MS = 5e3;
|
|
|
4690
4869
|
const REFRESH_AT_ONCE = 2;
|
|
4691
4870
|
const PULL = /https?:\/\/[^\s)]+\/pull\/\d+/g;
|
|
4692
4871
|
const LINE = /^([A-Za-z][A-Za-z_-]*)((?:\s*\[[^\]]*\])*)\s*:\s?(.*)$/;
|
|
4693
|
-
function parseStatusLog(
|
|
4872
|
+
function parseStatusLog(text2) {
|
|
4694
4873
|
const lines = [];
|
|
4695
4874
|
let preview2 = null;
|
|
4696
4875
|
let board2 = null;
|
|
4697
4876
|
let pr = null;
|
|
4698
|
-
for (const raw of
|
|
4877
|
+
for (const raw of text2.split("\n")) {
|
|
4699
4878
|
const m = LINE.exec(raw.trim());
|
|
4700
4879
|
if (!m) continue;
|
|
4701
4880
|
const at = /\[at=(\d{9,11})\]/.exec(m[2])?.[1];
|
|
@@ -4713,21 +4892,21 @@ function parseStatusLog(text) {
|
|
|
4713
4892
|
}
|
|
4714
4893
|
return { lines, preview: preview2, board: board2, pr, truncated: false, cut: false };
|
|
4715
4894
|
}
|
|
4716
|
-
function parseMetaProject(
|
|
4717
|
-
const repo = metaGet(
|
|
4895
|
+
function parseMetaProject(text2, home) {
|
|
4896
|
+
const repo = metaGet(text2, "repo").trim();
|
|
4718
4897
|
if (repo) return repo;
|
|
4719
|
-
const project = metaGet(
|
|
4898
|
+
const project = metaGet(text2, "project").trim();
|
|
4720
4899
|
if (!project) return null;
|
|
4721
4900
|
if (home && path.posix.resolve(project) === path.posix.resolve(home)) return "firstmate";
|
|
4722
4901
|
return path.posix.basename(project) || null;
|
|
4723
4902
|
}
|
|
4724
|
-
function parseMetaPr(
|
|
4725
|
-
return metaGet(
|
|
4903
|
+
function parseMetaPr(text2) {
|
|
4904
|
+
return metaGet(text2, "pr").trim().match(PULL)?.[0] ?? null;
|
|
4726
4905
|
}
|
|
4727
4906
|
function tailText(buf, max) {
|
|
4728
4907
|
if (buf.length <= max) return { text: buf.toString("utf8"), truncated: false };
|
|
4729
|
-
const
|
|
4730
|
-
return { text:
|
|
4908
|
+
const text2 = buf.subarray(buf.length - max).toString("utf8");
|
|
4909
|
+
return { text: text2.slice(text2.indexOf("\n") + 1), truncated: true };
|
|
4731
4910
|
}
|
|
4732
4911
|
const OFFLINE = (host) => `Offline: Firstmate could not reach ${host ?? "its host"}. Wheelhouse does not try again by itself.`;
|
|
4733
4912
|
const tasksOf = (m) => [...m.inFlight, ...m.queued, ...m.landed];
|
|
@@ -5013,19 +5192,19 @@ class MateTasks {
|
|
|
5013
5192
|
const now = this.now();
|
|
5014
5193
|
if (hit && (hit.value && !again ? true : now - hit.at < META_RETRY_MS)) return false;
|
|
5015
5194
|
const rel = `state/${task2.id}.meta`;
|
|
5016
|
-
let
|
|
5195
|
+
let text2;
|
|
5017
5196
|
if (route.remote) {
|
|
5018
5197
|
const r = await this.deps.adapter.remoteFile(mate.id, rel, META_MAX_BYTES);
|
|
5019
5198
|
if (!r.ok && r.error.exitCode === REMOTE_UNREACHABLE) return "offline";
|
|
5020
|
-
|
|
5199
|
+
text2 = r.ok ? r.value : null;
|
|
5021
5200
|
} else {
|
|
5022
|
-
|
|
5201
|
+
text2 = (await readInside(route.home, rel, META_MAX_BYTES))?.text ?? null;
|
|
5023
5202
|
}
|
|
5024
|
-
const value =
|
|
5025
|
-
projectId: parseMetaProject(
|
|
5026
|
-
pr: parseMetaPr(
|
|
5027
|
-
worktree: metaGet(
|
|
5028
|
-
branch: metaGet(
|
|
5203
|
+
const value = text2 === null ? hit?.value ?? null : {
|
|
5204
|
+
projectId: parseMetaProject(text2, mate.home),
|
|
5205
|
+
pr: parseMetaPr(text2),
|
|
5206
|
+
worktree: metaGet(text2, "worktree").trim() || null,
|
|
5207
|
+
branch: metaGet(text2, "branch").trim() || null
|
|
5029
5208
|
};
|
|
5030
5209
|
this.metas.set(id, { at: now, value });
|
|
5031
5210
|
return true;
|
|
@@ -5034,8 +5213,8 @@ class MateTasks {
|
|
|
5034
5213
|
const id = mateTaskId(mate.id, task2.id);
|
|
5035
5214
|
const rel = `state/${task2.id}.status`;
|
|
5036
5215
|
const observedAt = new Date(this.now()).toISOString();
|
|
5037
|
-
const log = ({ text, truncated }) => ({
|
|
5038
|
-
...parseStatusLog(
|
|
5216
|
+
const log = ({ text: text2, truncated }) => ({
|
|
5217
|
+
...parseStatusLog(text2),
|
|
5039
5218
|
truncated
|
|
5040
5219
|
});
|
|
5041
5220
|
if (!route.remote) {
|
|
@@ -5173,12 +5352,12 @@ class MateTasks {
|
|
|
5173
5352
|
* mate's inbox, `Re: <task>` as Wheelhouse's own notes are, with the task's
|
|
5174
5353
|
* `<task>@<mate>` name in the text put back to the id that home knows it by.
|
|
5175
5354
|
*/
|
|
5176
|
-
async send(id, requestId,
|
|
5355
|
+
async send(id, requestId, text2) {
|
|
5177
5356
|
const f = this.find(id);
|
|
5178
5357
|
if (!f.ok) return f;
|
|
5179
5358
|
const { mate, task: task2, route } = f.value;
|
|
5180
5359
|
const body = `Re: ${task2.id}
|
|
5181
|
-
${
|
|
5360
|
+
${text2.split(mateTaskId(mate.id, task2.id)).join(task2.id)}`;
|
|
5182
5361
|
const r = await this.deps.adapter.mateNote(route, requestId, body);
|
|
5183
5362
|
if (r.ok)
|
|
5184
5363
|
return { ok: true, created: r.value.outcome === "created", announced: r.value.announced };
|
|
@@ -5220,8 +5399,8 @@ ${text.split(mateTaskId(mate.id, task2.id)).join(task2.id)}`;
|
|
|
5220
5399
|
async readBrief({ mate, task: task2, route }) {
|
|
5221
5400
|
const rel = `data/${task2.id}/brief.md`;
|
|
5222
5401
|
const none = `${mate.id} kept no brief for this task.`;
|
|
5223
|
-
const value = (
|
|
5224
|
-
...parseBrief(
|
|
5402
|
+
const value = (text2, bytes, truncated, remote) => ({
|
|
5403
|
+
...parseBrief(text2),
|
|
5225
5404
|
path: rel,
|
|
5226
5405
|
bytes,
|
|
5227
5406
|
truncated,
|
|
@@ -5337,8 +5516,8 @@ async function readInside(root, rel, max) {
|
|
|
5337
5516
|
const start = Math.max(0, size - max);
|
|
5338
5517
|
const buf = Buffer.alloc(Math.min(size, max));
|
|
5339
5518
|
const { bytesRead } = await fh.read(buf, 0, buf.length, start);
|
|
5340
|
-
const
|
|
5341
|
-
return start > 0 ? { text:
|
|
5519
|
+
const text2 = buf.subarray(0, bytesRead).toString("utf8");
|
|
5520
|
+
return start > 0 ? { text: text2.slice(text2.indexOf("\n") + 1), truncated: true } : { text: text2, truncated: false };
|
|
5342
5521
|
} finally {
|
|
5343
5522
|
await fh.close();
|
|
5344
5523
|
}
|
|
@@ -5518,7 +5697,7 @@ class RemoteGit {
|
|
|
5518
5697
|
const STOPPED = "The worker will bring it back; it shows here again as soon as it answers.";
|
|
5519
5698
|
const CLOSED = "This work has landed, so its preview is no longer running.";
|
|
5520
5699
|
const TTL_MS = 5e3;
|
|
5521
|
-
const TIMEOUT_MS$
|
|
5700
|
+
const TIMEOUT_MS$2 = 2e3;
|
|
5522
5701
|
class PreviewProber {
|
|
5523
5702
|
fetch;
|
|
5524
5703
|
now;
|
|
@@ -5529,7 +5708,7 @@ class PreviewProber {
|
|
|
5529
5708
|
constructor(opts = {}) {
|
|
5530
5709
|
this.fetch = opts.fetch ?? fetch;
|
|
5531
5710
|
this.now = opts.now ?? Date.now;
|
|
5532
|
-
this.timeoutMs = opts.timeoutMs ?? TIMEOUT_MS$
|
|
5711
|
+
this.timeoutMs = opts.timeoutMs ?? TIMEOUT_MS$2;
|
|
5533
5712
|
}
|
|
5534
5713
|
/**
|
|
5535
5714
|
* The check for a page served at `pageOrigin`, which is what the preview
|
|
@@ -5629,8 +5808,8 @@ function writeRemembered(configDir, r) {
|
|
|
5629
5808
|
}
|
|
5630
5809
|
const SESSION_HEADER = "x-wheelhouse-session";
|
|
5631
5810
|
const LOOPBACK_HOST = /^(127\.0\.0\.1|localhost|\[::1\])(:\d+)?$/i;
|
|
5632
|
-
function servedOrigin(
|
|
5633
|
-
return `http://${(
|
|
5811
|
+
function servedOrigin(request2) {
|
|
5812
|
+
return `http://${(request2.headers.get("host") ?? "").toLowerCase()}`;
|
|
5634
5813
|
}
|
|
5635
5814
|
const KEY$2 = /* @__PURE__ */ Symbol.for("wheelhouse.session-token");
|
|
5636
5815
|
const g$2 = globalThis;
|
|
@@ -5651,10 +5830,10 @@ function tokenMatches(given) {
|
|
|
5651
5830
|
}
|
|
5652
5831
|
const SAFE_METHODS$1 = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
|
|
5653
5832
|
const isMutating = (method) => !SAFE_METHODS$1.has(method.toUpperCase());
|
|
5654
|
-
function refuseMutation(
|
|
5833
|
+
function refuseMutation(request2, servedOrigin2) {
|
|
5655
5834
|
return refuseCaller(
|
|
5656
|
-
|
|
5657
|
-
|
|
5835
|
+
request2.headers.get("origin"),
|
|
5836
|
+
request2.headers.get(SESSION_HEADER),
|
|
5658
5837
|
servedOrigin2
|
|
5659
5838
|
);
|
|
5660
5839
|
}
|
|
@@ -5674,10 +5853,10 @@ const MAX_ROWS = 500;
|
|
|
5674
5853
|
const HIGH_WATER = 1024 * 1024;
|
|
5675
5854
|
const LOW_WATER = 128 * 1024;
|
|
5676
5855
|
const MAX_CLOSE_REASON_BYTES = 123;
|
|
5677
|
-
function closeReason(
|
|
5856
|
+
function closeReason(text2) {
|
|
5678
5857
|
let out = "";
|
|
5679
5858
|
let bytes = 0;
|
|
5680
|
-
for (const ch of
|
|
5859
|
+
for (const ch of text2) {
|
|
5681
5860
|
bytes += Buffer.byteLength(ch);
|
|
5682
5861
|
if (bytes > MAX_CLOSE_REASON_BYTES) break;
|
|
5683
5862
|
out += ch;
|
|
@@ -5963,13 +6142,13 @@ class LedgerReader {
|
|
|
5963
6142
|
skipFirstLine = true;
|
|
5964
6143
|
}
|
|
5965
6144
|
const length = Math.min(size - start, MAX_READ_BYTES$1);
|
|
5966
|
-
let
|
|
6145
|
+
let text2;
|
|
5967
6146
|
try {
|
|
5968
6147
|
const fh = await open(this.file, "r");
|
|
5969
6148
|
try {
|
|
5970
6149
|
const buf = Buffer.alloc(length);
|
|
5971
6150
|
const { bytesRead } = await fh.read(buf, 0, length, start);
|
|
5972
|
-
|
|
6151
|
+
text2 = buf.subarray(0, bytesRead).toString("utf8");
|
|
5973
6152
|
this.offset = start + bytesRead;
|
|
5974
6153
|
} finally {
|
|
5975
6154
|
await fh.close();
|
|
@@ -5978,8 +6157,8 @@ class LedgerReader {
|
|
|
5978
6157
|
this.problem = `Could not read the fleet ledger: ${e.message}`;
|
|
5979
6158
|
return 0;
|
|
5980
6159
|
}
|
|
5981
|
-
|
|
5982
|
-
const lines =
|
|
6160
|
+
text2 = this.partial + text2;
|
|
6161
|
+
const lines = text2.split("\n");
|
|
5983
6162
|
this.partial = lines.pop() ?? "";
|
|
5984
6163
|
if (skipFirstLine) lines.shift();
|
|
5985
6164
|
let count = 0;
|
|
@@ -6446,8 +6625,8 @@ function outputAfter(lines, i, stop) {
|
|
|
6446
6625
|
return bound(out);
|
|
6447
6626
|
}
|
|
6448
6627
|
function parseTestOutput(raw) {
|
|
6449
|
-
const
|
|
6450
|
-
const lines =
|
|
6628
|
+
const text2 = raw.replace(ANSI, "").replace(/\r\n?/g, "\n");
|
|
6629
|
+
const lines = text2.split("\n");
|
|
6451
6630
|
let passed = null;
|
|
6452
6631
|
let failed2 = null;
|
|
6453
6632
|
let skipped = null;
|
|
@@ -6551,11 +6730,11 @@ function failuresIn(lines) {
|
|
|
6551
6730
|
return out;
|
|
6552
6731
|
}
|
|
6553
6732
|
function narration(log) {
|
|
6554
|
-
const
|
|
6555
|
-
const starts = [...
|
|
6733
|
+
const text2 = log.replace(ANSI, "").replace(/\r\n?/g, "\n");
|
|
6734
|
+
const starts = [...text2.matchAll(/^(?:\S+ )?started pid=\d+\s*$/gm)];
|
|
6556
6735
|
const last = starts.at(-1);
|
|
6557
6736
|
if (!last || last.index === void 0) return [];
|
|
6558
|
-
const rest2 =
|
|
6737
|
+
const rest2 = text2.slice(last.index + last[0].length);
|
|
6559
6738
|
const end = /^(?:\S+ )?exited pid=\d+.*$/m.exec(rest2);
|
|
6560
6739
|
const body = (end ? rest2.slice(0, end.index) : rest2).trim();
|
|
6561
6740
|
return body.split(/(?<=[.!?])\s*(?=[A-Z])|\n+/).map((s) => clean(s.trim())).filter((s) => s.length > 2).slice(-12);
|
|
@@ -6565,8 +6744,8 @@ function agentExit(log) {
|
|
|
6565
6744
|
return m ? m[1] === "success" ? "success" : "failure" : null;
|
|
6566
6745
|
}
|
|
6567
6746
|
function parsePrTesting(body) {
|
|
6568
|
-
const
|
|
6569
|
-
const m = /^## Testing\s*\n([\s\S]*?)(?=^## |(?![\s\S]))/m.exec(
|
|
6747
|
+
const text2 = body.replace(/\r\n?/g, "\n");
|
|
6748
|
+
const m = /^## Testing\s*\n([\s\S]*?)(?=^## |(?![\s\S]))/m.exec(text2);
|
|
6570
6749
|
if (!m) return null;
|
|
6571
6750
|
const section = m[1].replace(/<details>[\s\S]*?<\/details>/g, "");
|
|
6572
6751
|
const scenarios = [];
|
|
@@ -6638,7 +6817,7 @@ function report(key, label2, state, findings, durationMs2, log, i, testing) {
|
|
|
6638
6817
|
tests: null,
|
|
6639
6818
|
docs: null
|
|
6640
6819
|
};
|
|
6641
|
-
const
|
|
6820
|
+
const text2 = log ?? "";
|
|
6642
6821
|
const upcoming = state === "upcoming";
|
|
6643
6822
|
const skipped = state === "skipped";
|
|
6644
6823
|
const asked = i.decided.filter((d) => d.step === key);
|
|
@@ -6651,12 +6830,12 @@ function report(key, label2, state, findings, durationMs2, log, i, testing) {
|
|
|
6651
6830
|
r.summary = upcoming ? "Not started" : "Read what the change is for";
|
|
6652
6831
|
break;
|
|
6653
6832
|
case "rebase":
|
|
6654
|
-
r.summary = upcoming ? "Not started" : /conflict/i.test(
|
|
6833
|
+
r.summary = upcoming ? "Not started" : /conflict/i.test(text2) ? "Ran into a conflict with the main branch" : /up to date|already/i.test(text2) ? "Already up to date with the main branch" : state === "done" ? "Brought up to date with the main branch" : "Bringing the branch up to date";
|
|
6655
6834
|
break;
|
|
6656
6835
|
case "review": {
|
|
6657
|
-
const rounds = (
|
|
6658
|
-
const found = [...
|
|
6659
|
-
const fixes = (
|
|
6836
|
+
const rounds = (text2.match(/^reviewing changes/gm) ?? []).length;
|
|
6837
|
+
const found = [...text2.matchAll(/found (\d+) findings?/g)].map((m) => Number(m[1]));
|
|
6838
|
+
const fixes = (text2.match(/^committed agent fixes/gm) ?? []).length;
|
|
6660
6839
|
const total = found.reduce((a, b) => a + b, 0) || findings;
|
|
6661
6840
|
if (upcoming) r.summary = "Not started";
|
|
6662
6841
|
else if (!total && state === "done") r.summary = "Found nothing to change";
|
|
@@ -6670,7 +6849,7 @@ function report(key, label2, state, findings, durationMs2, log, i, testing) {
|
|
|
6670
6849
|
break;
|
|
6671
6850
|
}
|
|
6672
6851
|
case "test": {
|
|
6673
|
-
const parsed = parseTestOutput(
|
|
6852
|
+
const parsed = parseTestOutput(text2);
|
|
6674
6853
|
const scenarios = testing?.scenarios ?? [];
|
|
6675
6854
|
if (parsed || scenarios.length) {
|
|
6676
6855
|
r.tests = {
|
|
@@ -6682,12 +6861,12 @@ function report(key, label2, state, findings, durationMs2, log, i, testing) {
|
|
|
6682
6861
|
basis: parsed ? scenarios.length ? "the test run’s own summary and the pull request’s testing notes" : "the test run’s own summary" : "the pull request’s testing notes"
|
|
6683
6862
|
};
|
|
6684
6863
|
}
|
|
6685
|
-
r.notes = narration(
|
|
6686
|
-
const exit = agentExit(
|
|
6864
|
+
r.notes = narration(text2);
|
|
6865
|
+
const exit = agentExit(text2);
|
|
6687
6866
|
if (upcoming) r.summary = "Not started";
|
|
6688
6867
|
else if (skipped) r.summary = "Skipped for this change";
|
|
6689
6868
|
else if (r.tests) r.summary = testLine(r.tests);
|
|
6690
|
-
else if (/configured test command failed/.test(
|
|
6869
|
+
else if (/configured test command failed/.test(text2) || state === "failed" || exit === "failure")
|
|
6691
6870
|
r.summary = "Tests failed";
|
|
6692
6871
|
else if (state === "done")
|
|
6693
6872
|
r.summary = findings ? `Tests raised ${plural(findings, "problem")}` : "Tests passed";
|
|
@@ -6699,14 +6878,14 @@ function report(key, label2, state, findings, durationMs2, log, i, testing) {
|
|
|
6699
6878
|
}
|
|
6700
6879
|
case "document": {
|
|
6701
6880
|
const commits = [
|
|
6702
|
-
...
|
|
6881
|
+
...text2.matchAll(/^committed agent fixes: (?:no-mistakes\(document\): )?(.+)$/gm)
|
|
6703
6882
|
].map((m) => m[1].trim());
|
|
6704
6883
|
const bullets = i.prBody ? docBullets(i.prBody) : [];
|
|
6705
6884
|
r.docs = { files: i.docs, summary: [...commits, ...bullets] };
|
|
6706
|
-
r.notes = narration(
|
|
6885
|
+
r.notes = narration(text2);
|
|
6707
6886
|
const left = Number(
|
|
6708
6887
|
/document findings: (\d+) unresolved/.exec(
|
|
6709
|
-
[...
|
|
6888
|
+
[...text2.matchAll(/document findings: \d+ unresolved/g)].at(-1)?.[0] ?? ""
|
|
6710
6889
|
)?.[1] ?? 0
|
|
6711
6890
|
);
|
|
6712
6891
|
if (upcoming) r.summary = "Not started";
|
|
@@ -6715,14 +6894,14 @@ function report(key, label2, state, findings, durationMs2, log, i, testing) {
|
|
|
6715
6894
|
r.summary = `Updated the docs${i.docs.length ? `: ${plural(i.docs.length, "document")} changed in all` : ""}`;
|
|
6716
6895
|
else if (i.docs.length)
|
|
6717
6896
|
r.summary = `${plural(i.docs.length, "document")} changed; the docs step had nothing to add`;
|
|
6718
|
-
else if (/no agent changes to commit/.test(
|
|
6897
|
+
else if (/no agent changes to commit/.test(text2) || state === "done")
|
|
6719
6898
|
r.summary = "No documentation changes needed";
|
|
6720
6899
|
else r.summary = "Checking the docs match the change";
|
|
6721
6900
|
if (left) r.summary += `; ${plural(left, "item")} left open`;
|
|
6722
6901
|
break;
|
|
6723
6902
|
}
|
|
6724
6903
|
case "lint": {
|
|
6725
|
-
const m = [...
|
|
6904
|
+
const m = [...text2.matchAll(/(\d+) unresolved items?/g)].at(-1);
|
|
6726
6905
|
r.summary = upcoming ? "Not started" : skipped ? "Skipped for this change" : m ? Number(m[1]) ? `${plural(Number(m[1]), "lint problem")} left` : "No lint problems" : state === "done" ? "No lint problems" : "Checking style and lint";
|
|
6727
6906
|
break;
|
|
6728
6907
|
}
|
|
@@ -6730,13 +6909,13 @@ function report(key, label2, state, findings, durationMs2, log, i, testing) {
|
|
|
6730
6909
|
r.summary = upcoming ? "Not started" : state === "done" ? "Pushed the branch" : "Pushing the branch";
|
|
6731
6910
|
break;
|
|
6732
6911
|
case "pr":
|
|
6733
|
-
r.summary = upcoming ? "Not started" : /updat/i.test(
|
|
6912
|
+
r.summary = upcoming ? "Not started" : /updat/i.test(text2) ? "Updated the pull request" : state === "done" ? "Opened the pull request" : "Opening the pull request";
|
|
6734
6913
|
break;
|
|
6735
6914
|
case "ci": {
|
|
6736
|
-
const ci = log === null ? "unknown" : ciResultFromLog(
|
|
6915
|
+
const ci = log === null ? "unknown" : ciResultFromLog(text2);
|
|
6737
6916
|
if (state === "running" && ci === "green") r.state = "done";
|
|
6738
|
-
r.summary = upcoming ? "Not started" : /no_ci: true|declares no CI/.test(
|
|
6739
|
-
if (/CI repair/i.test(
|
|
6917
|
+
r.summary = upcoming ? "Not started" : /no_ci: true|declares no CI/.test(text2) ? "This repository has no CI checks" : ci === "green" ? "CI checks passed" : ci === "red" ? "CI checks failed" : "Waiting for CI checks";
|
|
6918
|
+
if (/CI repair/i.test(text2)) r.notes = ["Pushed a repair for a failing CI check"];
|
|
6740
6919
|
break;
|
|
6741
6920
|
}
|
|
6742
6921
|
}
|
|
@@ -6750,8 +6929,8 @@ function report(key, label2, state, findings, durationMs2, log, i, testing) {
|
|
|
6750
6929
|
}
|
|
6751
6930
|
return r;
|
|
6752
6931
|
}
|
|
6753
|
-
function parseInboxRecord(name2,
|
|
6754
|
-
const t =
|
|
6932
|
+
function parseInboxRecord(name2, text2, handled) {
|
|
6933
|
+
const t = text2.replace(/\r\n?/g, "\n");
|
|
6755
6934
|
const sep = t.indexOf("\n--\n");
|
|
6756
6935
|
const head2 = sep >= 0 && /^schema=/.test(t) ? t.slice(0, sep) : "";
|
|
6757
6936
|
const body = head2 ? t.slice(sep + 4) : t;
|
|
@@ -6762,9 +6941,9 @@ function parseInboxRecord(name2, text, handled) {
|
|
|
6762
6941
|
const OPS$1 = /\s*(?:In the same response|Run:? no-mistakes|Keep driving|Do not use --yes|Then (?:run|re-?attach)|Reattach with|Acknowledge by moving)[\s\S]*$/;
|
|
6763
6942
|
const PREVIEW = /^Review feedback on the live preview \([^)\n]*\):\n/;
|
|
6764
6943
|
const MAX_BODY$1 = 4e3;
|
|
6765
|
-
function plainBody(
|
|
6944
|
+
function plainBody(text2) {
|
|
6766
6945
|
const out = [];
|
|
6767
|
-
for (const raw of
|
|
6946
|
+
for (const raw of text2.replace(OPS$1, "").split("\n")) {
|
|
6768
6947
|
const line = raw.trim();
|
|
6769
6948
|
if (!line) {
|
|
6770
6949
|
if (out.length && out.at(-1) !== "") out.push("");
|
|
@@ -6777,8 +6956,8 @@ function plainBody(text) {
|
|
|
6777
6956
|
const s = out.join("\n").trim();
|
|
6778
6957
|
return s.length > MAX_BODY$1 ? `${s.slice(0, MAX_BODY$1 - 1)}…` : s;
|
|
6779
6958
|
}
|
|
6780
|
-
function firstLine(
|
|
6781
|
-
const first =
|
|
6959
|
+
function firstLine(text2, max = 140) {
|
|
6960
|
+
const first = text2.split("\n").find((l) => l.trim()) ?? "";
|
|
6782
6961
|
const s = first.replace(/^- /, "").split(/(?<=[.!?])\s/)[0].trim();
|
|
6783
6962
|
return s.length > max ? `${s.slice(0, max - 1).trimEnd()}…` : s;
|
|
6784
6963
|
}
|
|
@@ -6834,11 +7013,11 @@ function conversation(i) {
|
|
|
6834
7013
|
if (at < 0) continue;
|
|
6835
7014
|
const [o] = open2.splice(at, 1);
|
|
6836
7015
|
const answered = /^answered:/i.test(s.text.trim());
|
|
6837
|
-
const
|
|
7016
|
+
const text2 = s.text.replace(/^answered:\s*/i, "").replace(/\s*\[truncated\]\s*$/, "");
|
|
6838
7017
|
const decidedFor = o.entry.questions.some((q) => q.verdict);
|
|
6839
|
-
const msg = answered ? answerMessage(
|
|
7018
|
+
const msg = answered ? answerMessage(text2, s.ts, o.entry.kind === "review") : null;
|
|
6840
7019
|
if (msg) used.add(msg.name);
|
|
6841
|
-
const full = plainBody(msg?.body ??
|
|
7020
|
+
const full = plainBody(msg?.body ?? text2);
|
|
6842
7021
|
o.entry.reply = decidedFor ? null : {
|
|
6843
7022
|
at: iso$1(s.ts),
|
|
6844
7023
|
from: answered ? "firstmate" : "worker",
|
|
@@ -6856,9 +7035,9 @@ function conversation(i) {
|
|
|
6856
7035
|
const fromCaptain = PREVIEW.test(m.body);
|
|
6857
7036
|
const n = norm(m.body);
|
|
6858
7037
|
if (captainProbes.some((p) => p.length > 8 && n.includes(p))) continue;
|
|
6859
|
-
const
|
|
6860
|
-
if (!
|
|
6861
|
-
const title = firstLine(
|
|
7038
|
+
const text2 = plainBody(m.body.replace(PREVIEW, ""));
|
|
7039
|
+
if (!text2) continue;
|
|
7040
|
+
const title = firstLine(text2);
|
|
6862
7041
|
out.push({
|
|
6863
7042
|
id: `inbox-${m.name}`,
|
|
6864
7043
|
at: iso$1(m.at ?? i.dispatchedAt) ?? (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
@@ -6866,7 +7045,7 @@ function conversation(i) {
|
|
|
6866
7045
|
from: fromCaptain ? "captain" : "firstmate",
|
|
6867
7046
|
to: "worker",
|
|
6868
7047
|
title: fromCaptain ? "Your feedback from the live preview, passed on to the worker" : title,
|
|
6869
|
-
body: fromCaptain ?
|
|
7048
|
+
body: fromCaptain ? text2 : rest(text2, title),
|
|
6870
7049
|
questions: [],
|
|
6871
7050
|
reply: null,
|
|
6872
7051
|
outcome: m.handled ? { state: "read", label: "The worker has read it" } : { state: "unread", label: "Not read by the worker yet" }
|
|
@@ -6874,7 +7053,7 @@ function conversation(i) {
|
|
|
6874
7053
|
}
|
|
6875
7054
|
for (const m of i.captain) {
|
|
6876
7055
|
const preview2 = PREVIEW.test(m.text);
|
|
6877
|
-
const
|
|
7056
|
+
const text2 = m.text.replace(PREVIEW, "").trim();
|
|
6878
7057
|
out.push({
|
|
6879
7058
|
id: `captain-${m.requestId}`,
|
|
6880
7059
|
at: m.submittedAt,
|
|
@@ -6882,7 +7061,7 @@ function conversation(i) {
|
|
|
6882
7061
|
from: "captain",
|
|
6883
7062
|
to: "firstmate",
|
|
6884
7063
|
title: preview2 ? "You sent feedback from the live preview" : "You wrote to Firstmate",
|
|
6885
|
-
body:
|
|
7064
|
+
body: text2,
|
|
6886
7065
|
questions: [],
|
|
6887
7066
|
reply: m.reply ? { at: m.reply.at, from: "firstmate", text: m.reply.body } : null,
|
|
6888
7067
|
outcome: {
|
|
@@ -6893,9 +7072,9 @@ function conversation(i) {
|
|
|
6893
7072
|
}
|
|
6894
7073
|
return out.sort((a, b) => a.at.localeCompare(b.at));
|
|
6895
7074
|
}
|
|
6896
|
-
function rest(
|
|
7075
|
+
function rest(text2, title) {
|
|
6897
7076
|
const t = title.replace(/…$/, "");
|
|
6898
|
-
const r =
|
|
7077
|
+
const r = text2.startsWith(t) && !title.endsWith("…") ? text2.slice(t.length).trim() : text2;
|
|
6899
7078
|
return r && r !== title ? r : null;
|
|
6900
7079
|
}
|
|
6901
7080
|
const lower = (s) => s ? s.charAt(0).toLowerCase() + s.slice(1) : s;
|
|
@@ -6949,11 +7128,11 @@ function readableName(p) {
|
|
|
6949
7128
|
}
|
|
6950
7129
|
function docTitle(md, p) {
|
|
6951
7130
|
if (docKind(p) === "readme") return readableName(p);
|
|
6952
|
-
const
|
|
6953
|
-
const front = /^---\n([\s\S]*?)\n---/.exec(
|
|
7131
|
+
const text2 = md.replace(/\r\n?/g, "\n");
|
|
7132
|
+
const front = /^---\n([\s\S]*?)\n---/.exec(text2);
|
|
6954
7133
|
const named = front && /^(?:title|name):\s*["']?(.+?)["']?\s*$/m.exec(front[1]);
|
|
6955
7134
|
if (named) return named[1].trim();
|
|
6956
|
-
const body = front ?
|
|
7135
|
+
const body = front ? text2.slice(front[0].length) : text2;
|
|
6957
7136
|
const h = /^#{1,2}\s+(.+?)\s*#*\s*$/m.exec(body) ?? /^(.+)\n=+\s*$/m.exec(body);
|
|
6958
7137
|
const t = h?.[1].replace(/`([^`]+)`/g, "$1").replace(/\*\*?([^*]+)\*\*?/g, "$1").replace(/\[([^\]]+)\]\([^)]*\)/g, "$1").trim();
|
|
6959
7138
|
return t || readableName(p);
|
|
@@ -7159,8 +7338,8 @@ class BuildReader {
|
|
|
7159
7338
|
let startedAt = null;
|
|
7160
7339
|
await Promise.all(
|
|
7161
7340
|
STEP_KEYS.map(async (k) => {
|
|
7162
|
-
const
|
|
7163
|
-
if (
|
|
7341
|
+
const text2 = await readTail(path.join(dir, `${k}.log`), STEP_LOG_BYTES);
|
|
7342
|
+
if (text2 !== null) logs.set(k, text2);
|
|
7164
7343
|
})
|
|
7165
7344
|
);
|
|
7166
7345
|
const first = await stat(path.join(dir, "intent.log")).catch(() => null);
|
|
@@ -7306,8 +7485,8 @@ class BuildReader {
|
|
|
7306
7485
|
const key = `${c.task.id} ${p}`;
|
|
7307
7486
|
const known = this.titles.get(key);
|
|
7308
7487
|
if (known) return known;
|
|
7309
|
-
const
|
|
7310
|
-
const t =
|
|
7488
|
+
const text2 = await this.docText(c, p, TITLE_BYTES).catch(() => null);
|
|
7489
|
+
const t = text2 ? docTitle(text2.text, p) : readableName(p);
|
|
7311
7490
|
this.titles.set(key, t);
|
|
7312
7491
|
return t;
|
|
7313
7492
|
}
|
|
@@ -7345,8 +7524,8 @@ class BuildReader {
|
|
|
7345
7524
|
const ref = docs.value.find((d) => d.path === p);
|
|
7346
7525
|
if (!ref)
|
|
7347
7526
|
return { available: false, reason: "That document is not in this task’s list of docs." };
|
|
7348
|
-
const
|
|
7349
|
-
if (!
|
|
7527
|
+
const text2 = await this.docText(c, p, DOC_BYTES$1);
|
|
7528
|
+
if (!text2) {
|
|
7350
7529
|
return {
|
|
7351
7530
|
available: false,
|
|
7352
7531
|
reason: ref.github ? "Its text is not on this machine any more; it can still be read on GitHub." : "Its text is not on this machine any more."
|
|
@@ -7354,15 +7533,15 @@ class BuildReader {
|
|
|
7354
7533
|
}
|
|
7355
7534
|
return {
|
|
7356
7535
|
available: true,
|
|
7357
|
-
source:
|
|
7536
|
+
source: text2.from,
|
|
7358
7537
|
observedAt: new Date(this.now()).toISOString(),
|
|
7359
7538
|
value: {
|
|
7360
7539
|
path: ref.path,
|
|
7361
7540
|
name: ref.name,
|
|
7362
7541
|
title: ref.title,
|
|
7363
7542
|
kind: ref.kind,
|
|
7364
|
-
markdown:
|
|
7365
|
-
truncated: !
|
|
7543
|
+
markdown: text2.text,
|
|
7544
|
+
truncated: !text2.whole,
|
|
7366
7545
|
github: ref.github,
|
|
7367
7546
|
changed: ref.changed
|
|
7368
7547
|
}
|
|
@@ -8070,13 +8249,13 @@ function pairRounds(statuses) {
|
|
|
8070
8249
|
} else if (s.state === "resolved" && open2.has(key)) {
|
|
8071
8250
|
const round = open2.get(key);
|
|
8072
8251
|
open2.delete(key);
|
|
8073
|
-
const
|
|
8074
|
-
if (!/^answered:/i.test(s.text) ||
|
|
8252
|
+
const text2 = s.text.replace(/^answered:\s*/i, "");
|
|
8253
|
+
if (!/^answered:/i.test(s.text) || text2.replace(CUT, "").trim().length < 3) {
|
|
8075
8254
|
round.closed = true;
|
|
8076
8255
|
continue;
|
|
8077
8256
|
}
|
|
8078
8257
|
round.decidedAt = s.ts;
|
|
8079
|
-
round.answer =
|
|
8258
|
+
round.answer = text2;
|
|
8080
8259
|
}
|
|
8081
8260
|
}
|
|
8082
8261
|
return out;
|
|
@@ -8092,9 +8271,9 @@ function pairDecisions(statuses) {
|
|
|
8092
8271
|
answer
|
|
8093
8272
|
}));
|
|
8094
8273
|
}
|
|
8095
|
-
function parseFindings(
|
|
8274
|
+
function parseFindings(text2) {
|
|
8096
8275
|
const out = [];
|
|
8097
|
-
for (const block of
|
|
8276
|
+
for (const block of text2.split(/\n\s*\n/)) {
|
|
8098
8277
|
const f = {};
|
|
8099
8278
|
let last = null;
|
|
8100
8279
|
for (const l of block.split("\n")) {
|
|
@@ -8132,11 +8311,11 @@ function fullAnswer(answer, messages) {
|
|
|
8132
8311
|
}
|
|
8133
8312
|
return { text: head2.replace(OPS, "").trim(), cut: cut2 };
|
|
8134
8313
|
}
|
|
8135
|
-
function verdictOf(
|
|
8136
|
-
const none = /\bNO (?:CODE )?CHANGES?\b/.test(
|
|
8137
|
-
const fix = /\bFIX\b/.test(
|
|
8138
|
-
const keep = /\bKEEP\b/.test(
|
|
8139
|
-
const defer = /\bDEFER/.test(
|
|
8314
|
+
function verdictOf(text2) {
|
|
8315
|
+
const none = /\bNO (?:CODE )?CHANGES?\b/.test(text2) || /\bDISCARD\b/.test(text2);
|
|
8316
|
+
const fix = /\bFIX\b/.test(text2) || /:\s*fix it\b/i.test(text2);
|
|
8317
|
+
const keep = /\bKEEP\b/.test(text2) || /keep the omission/i.test(text2);
|
|
8318
|
+
const defer = /\bDEFER/.test(text2) || !fix && !keep && !none && /\bdefer/i.test(text2);
|
|
8140
8319
|
if ([fix, keep, defer, none].filter(Boolean).length > 1) return "Mixed";
|
|
8141
8320
|
return fix ? "Fix it" : keep ? "Keep as is" : none ? "No change" : defer ? "Defer" : "Decided";
|
|
8142
8321
|
}
|
|
@@ -8166,8 +8345,8 @@ function callsFor(answer, findings) {
|
|
|
8166
8345
|
const lead = marks.length ? body.slice(0, marks[0].at) : body;
|
|
8167
8346
|
return findings.map((f) => {
|
|
8168
8347
|
const own = parts.get(f.id);
|
|
8169
|
-
const
|
|
8170
|
-
return { finding: f, verdict: verdictOf(
|
|
8348
|
+
const text2 = own && own.replace(/^[\s:–—-]*/, "").trim() ? own : lead;
|
|
8349
|
+
return { finding: f, verdict: verdictOf(text2), reason: reasonOf$1(text2) };
|
|
8171
8350
|
});
|
|
8172
8351
|
}
|
|
8173
8352
|
function idAt(id, anchored) {
|
|
@@ -8193,8 +8372,8 @@ const RAISED_IN$1 = {
|
|
|
8193
8372
|
lint: "the code style check",
|
|
8194
8373
|
ci: "CI"
|
|
8195
8374
|
};
|
|
8196
|
-
function scrub(
|
|
8197
|
-
let s =
|
|
8375
|
+
function scrub(text2, homeDir) {
|
|
8376
|
+
let s = text2;
|
|
8198
8377
|
if (homeDir) {
|
|
8199
8378
|
const home = homeDir.replace(/\/+$/, "");
|
|
8200
8379
|
s = s.split(home + "/").join("");
|
|
@@ -8543,18 +8722,18 @@ class TranscriptUsage {
|
|
|
8543
8722
|
}
|
|
8544
8723
|
const length = Math.min(size - f.offset, budget);
|
|
8545
8724
|
if (length <= 0) return 0;
|
|
8546
|
-
let
|
|
8725
|
+
let text2;
|
|
8547
8726
|
const fh = await open(file, "r").catch(() => null);
|
|
8548
8727
|
if (!fh) return 0;
|
|
8549
8728
|
try {
|
|
8550
8729
|
const buf = Buffer.alloc(length);
|
|
8551
8730
|
const { bytesRead } = await fh.read(buf, 0, length, f.offset);
|
|
8552
|
-
|
|
8731
|
+
text2 = buf.subarray(0, bytesRead).toString("utf8");
|
|
8553
8732
|
f.offset += bytesRead;
|
|
8554
8733
|
} finally {
|
|
8555
8734
|
await fh.close();
|
|
8556
8735
|
}
|
|
8557
|
-
const lines = (f.partial +
|
|
8736
|
+
const lines = (f.partial + text2).split("\n");
|
|
8558
8737
|
f.partial = lines.pop() ?? "";
|
|
8559
8738
|
for (const l of lines) this.line(f, l, ctx);
|
|
8560
8739
|
return length;
|
|
@@ -8806,8 +8985,8 @@ class InsightsService {
|
|
|
8806
8985
|
this.runTried.set(run, this.now());
|
|
8807
8986
|
let task2 = null;
|
|
8808
8987
|
for (const step of ["rebase", "push", "pr"]) {
|
|
8809
|
-
const
|
|
8810
|
-
const m =
|
|
8988
|
+
const text2 = await head(path.join(this.opts.logsDir, run, `${step}.log`), HEAD_BYTES);
|
|
8989
|
+
const m = text2 ? BRANCH.exec(text2) : null;
|
|
8811
8990
|
if (m) {
|
|
8812
8991
|
task2 = m[1];
|
|
8813
8992
|
break;
|
|
@@ -8869,8 +9048,8 @@ class InsightsService {
|
|
|
8869
9048
|
for (const dir of [inbox, path.join(inbox, "handled")]) {
|
|
8870
9049
|
const names = (await readdir(dir).catch(() => [])).filter((n) => n.endsWith(".msg")).sort().slice(-40);
|
|
8871
9050
|
for (const n of names) {
|
|
8872
|
-
const
|
|
8873
|
-
if (
|
|
9051
|
+
const text2 = await head(path.join(dir, n), 64 * 1024);
|
|
9052
|
+
if (text2) bodies.push(text2);
|
|
8874
9053
|
}
|
|
8875
9054
|
}
|
|
8876
9055
|
if (bodies.length) this.handled.set(t.id, bodies);
|
|
@@ -9117,9 +9296,9 @@ const RETRY_BASE_MS = 15e3;
|
|
|
9117
9296
|
const RETRY_MAX_MS = 5 * 6e4;
|
|
9118
9297
|
const RETRIES_PER_ROUND = 5;
|
|
9119
9298
|
const REPLY_PAGES_PER_ROUND = 10;
|
|
9120
|
-
function noteBody(
|
|
9299
|
+
function noteBody(text2, taskId) {
|
|
9121
9300
|
return taskId ? `Re: ${taskId}
|
|
9122
|
-
${
|
|
9301
|
+
${text2}` : text2;
|
|
9123
9302
|
}
|
|
9124
9303
|
function toBridgeMessage(m) {
|
|
9125
9304
|
return {
|
|
@@ -9136,17 +9315,17 @@ function toBridgeMessage(m) {
|
|
|
9136
9315
|
}
|
|
9137
9316
|
const UNANNOUNCED = "Firstmate has the message but was not woken for it yet. Wheelhouse will retry.";
|
|
9138
9317
|
const UNCERTAIN = "Wheelhouse could not confirm delivery. It is checking with the same request id.";
|
|
9139
|
-
function validateSend(requestId,
|
|
9318
|
+
function validateSend(requestId, text2, taskId) {
|
|
9140
9319
|
if (!requestId)
|
|
9141
9320
|
return { ok: false, status: 400, error: "An Idempotency-Key header is required." };
|
|
9142
|
-
if (!REQUEST_ID.test(requestId)) {
|
|
9321
|
+
if (!REQUEST_ID$1.test(requestId)) {
|
|
9143
9322
|
return {
|
|
9144
9323
|
ok: false,
|
|
9145
9324
|
status: 400,
|
|
9146
9325
|
error: "The Idempotency-Key must be 1-128 characters of A-Z a-z 0-9 . _ : - (no leading dot)."
|
|
9147
9326
|
};
|
|
9148
9327
|
}
|
|
9149
|
-
if (typeof
|
|
9328
|
+
if (typeof text2 !== "string" || !text2.trim()) {
|
|
9150
9329
|
return { ok: false, status: 400, error: "The message is empty." };
|
|
9151
9330
|
}
|
|
9152
9331
|
if (taskId !== void 0 && taskId !== null && (typeof taskId !== "string" || !TASK_ID$1.test(taskId))) {
|
|
@@ -9154,7 +9333,7 @@ function validateSend(requestId, text, taskId) {
|
|
|
9154
9333
|
}
|
|
9155
9334
|
const input = {
|
|
9156
9335
|
requestId,
|
|
9157
|
-
text:
|
|
9336
|
+
text: text2.trim(),
|
|
9158
9337
|
taskId: taskId ?? null
|
|
9159
9338
|
};
|
|
9160
9339
|
const room = isChangeRequest(input) ? ROUTE_ALLOWANCE_BYTES : 0;
|
|
@@ -9513,17 +9692,17 @@ function lettered(body) {
|
|
|
9513
9692
|
if (marks.length < 2) return null;
|
|
9514
9693
|
const then = [];
|
|
9515
9694
|
const options = marks.map((m, i) => {
|
|
9516
|
-
let
|
|
9695
|
+
let text2 = body.slice(m.end, marks[i + 1] ? marks[i + 1].at : body.length);
|
|
9517
9696
|
if (i === marks.length - 1) {
|
|
9518
|
-
const parts = sentences(
|
|
9697
|
+
const parts = sentences(text2);
|
|
9519
9698
|
while (parts.length > 1 && parts[parts.length - 1].endsWith("?")) then.unshift(parts.pop());
|
|
9520
|
-
|
|
9699
|
+
text2 = parts.join(" ");
|
|
9521
9700
|
}
|
|
9522
|
-
const rec = m.rec || isRec(
|
|
9701
|
+
const rec = m.rec || isRec(text2);
|
|
9523
9702
|
return {
|
|
9524
9703
|
id: m.letter,
|
|
9525
9704
|
label: m.letter,
|
|
9526
|
-
detail: trimEnd(
|
|
9705
|
+
detail: trimEnd(text2.replace(REC, "")) || null,
|
|
9527
9706
|
recommended: rec
|
|
9528
9707
|
};
|
|
9529
9708
|
});
|
|
@@ -9620,8 +9799,8 @@ function recommendFirst(calls) {
|
|
|
9620
9799
|
}
|
|
9621
9800
|
}
|
|
9622
9801
|
const isYesNo = (c) => c.options.length === 2 && c.options[0].id === "yes";
|
|
9623
|
-
function choicesIn(
|
|
9624
|
-
const s = tidy(
|
|
9802
|
+
function choicesIn(text2) {
|
|
9803
|
+
const s = tidy(text2 ?? "");
|
|
9625
9804
|
if (!s) return null;
|
|
9626
9805
|
let follow = 0;
|
|
9627
9806
|
const followUps = (qs) => qs.map((q) => questionCall(`then-${++follow}`, null, q, false));
|
|
@@ -9651,41 +9830,41 @@ function choicesIn(text) {
|
|
|
9651
9830
|
}
|
|
9652
9831
|
return null;
|
|
9653
9832
|
}
|
|
9654
|
-
function reportIn(
|
|
9655
|
-
for (const m of (
|
|
9833
|
+
function reportIn(text2) {
|
|
9834
|
+
for (const m of (text2 ?? "").matchAll(/[^\s()'"`]+\.md\b/g)) {
|
|
9656
9835
|
if (/(?:^|\/)data\/[^/]+\//.test(m[0])) return m[0];
|
|
9657
9836
|
}
|
|
9658
9837
|
return null;
|
|
9659
9838
|
}
|
|
9660
9839
|
const FINDINGS = /findings=(\S+)\s+file=(.+?\.txt)\b/;
|
|
9661
9840
|
const RECOMMEND = /\b(?:Firstmate\s+)?recommend(?:s|ed|ation)?(?:\s+is)?\s*[:=–—-]\s*([^\n]+?)(?:\.\s|\.$|\n|$)/i;
|
|
9662
|
-
function recommendationIn(
|
|
9663
|
-
const m =
|
|
9841
|
+
function recommendationIn(text2) {
|
|
9842
|
+
const m = text2 ? RECOMMEND.exec(text2) : null;
|
|
9664
9843
|
return m?.[1]?.trim() || null;
|
|
9665
9844
|
}
|
|
9666
|
-
function withoutRecommendation(
|
|
9667
|
-
const m = RECOMMEND.exec(
|
|
9668
|
-
if (!m) return
|
|
9669
|
-
const out = (
|
|
9670
|
-
return out ||
|
|
9845
|
+
function withoutRecommendation(text2) {
|
|
9846
|
+
const m = RECOMMEND.exec(text2);
|
|
9847
|
+
if (!m) return text2;
|
|
9848
|
+
const out = (text2.slice(0, m.index) + text2.slice(m.index + m[0].length)).trim();
|
|
9849
|
+
return out || text2;
|
|
9671
9850
|
}
|
|
9672
|
-
function reasonOf(
|
|
9673
|
-
const r =
|
|
9674
|
-
return r ? r.charAt(0).toUpperCase() + r.slice(1) :
|
|
9851
|
+
function reasonOf(text2) {
|
|
9852
|
+
const r = text2.replace(/^(?:FIX|KEEP|DEFER\w*|DISCARD|APPROVE|SKIP|MERGE)\b(?:\s+it)?[\s.:,;–—-]*/i, "").trim();
|
|
9853
|
+
return r ? r.charAt(0).toUpperCase() + r.slice(1) : text2;
|
|
9675
9854
|
}
|
|
9676
|
-
function choiceOf(
|
|
9677
|
-
const v = verdictOf(
|
|
9855
|
+
function choiceOf(text2) {
|
|
9856
|
+
const v = verdictOf(text2);
|
|
9678
9857
|
if (v === "Fix it") return "fix";
|
|
9679
9858
|
if (v === "Keep as is") return "approve";
|
|
9680
9859
|
if (v === "Defer" || v === "No change") return "skip";
|
|
9681
|
-
if (/\b(?:approve|merge|go ahead|proceed|accept|ship it|yes)\b/i.test(
|
|
9682
|
-
if (/\b(?:fix|change|rework)\b/i.test(
|
|
9683
|
-
if (/\b(?:skip|defer|later|hold off|leave it)\b/i.test(
|
|
9860
|
+
if (/\b(?:approve|merge|go ahead|proceed|accept|ship it|yes)\b/i.test(text2)) return "approve";
|
|
9861
|
+
if (/\b(?:fix|change|rework)\b/i.test(text2)) return "fix";
|
|
9862
|
+
if (/\b(?:skip|defer|later|hold off|leave it)\b/i.test(text2)) return "skip";
|
|
9684
9863
|
return null;
|
|
9685
9864
|
}
|
|
9686
|
-
function findingRecommendations(
|
|
9865
|
+
function findingRecommendations(text2) {
|
|
9687
9866
|
const out = /* @__PURE__ */ new Map();
|
|
9688
|
-
for (const block of
|
|
9867
|
+
for (const block of text2.split(/\n\s*\n/)) {
|
|
9689
9868
|
const id = /^id:\s?(.*)$/m.exec(block)?.[1]?.trim();
|
|
9690
9869
|
const rec = /^recommend(?:ation)?:\s?(.*)$/m.exec(block)?.[1]?.trim().replace(/\.$/, "");
|
|
9691
9870
|
if (id && rec) out.set(id, rec);
|
|
@@ -9693,13 +9872,13 @@ function findingRecommendations(text) {
|
|
|
9693
9872
|
return out;
|
|
9694
9873
|
}
|
|
9695
9874
|
const META = /\[(?:key|at)=[^\]]*\]/g;
|
|
9696
|
-
const reportOf = (
|
|
9697
|
-
const p = reportIn(
|
|
9875
|
+
const reportOf = (text2) => {
|
|
9876
|
+
const p = reportIn(text2);
|
|
9698
9877
|
return p ? { path: p, url: null } : null;
|
|
9699
9878
|
};
|
|
9700
9879
|
const iso = (ts) => new Date(ts * 1e3).toISOString();
|
|
9701
|
-
function isoOf(
|
|
9702
|
-
const ms =
|
|
9880
|
+
function isoOf(text2) {
|
|
9881
|
+
const ms = text2 ? Date.parse(text2) : NaN;
|
|
9703
9882
|
return Number.isNaN(ms) ? null : new Date(ms).toISOString();
|
|
9704
9883
|
}
|
|
9705
9884
|
function openingLine(ledger, key) {
|
|
@@ -9750,9 +9929,9 @@ function decisionCards(t, src) {
|
|
|
9750
9929
|
let recommendation = recommendationIn(raw);
|
|
9751
9930
|
if (m) {
|
|
9752
9931
|
const ids = m[1].split(",").filter(Boolean);
|
|
9753
|
-
const
|
|
9754
|
-
const all =
|
|
9755
|
-
const recs =
|
|
9932
|
+
const text2 = src.findings(t.id, m[2]);
|
|
9933
|
+
const all = text2 ? parseFindings(text2) : [];
|
|
9934
|
+
const recs = text2 ? findingRecommendations(text2) : /* @__PURE__ */ new Map();
|
|
9756
9935
|
const raised = ids.map(
|
|
9757
9936
|
(id) => all.find((f) => f.id === id) ?? {
|
|
9758
9937
|
id,
|
|
@@ -9914,7 +10093,7 @@ function mateCards(rec, src) {
|
|
|
9914
10093
|
evidence: { ...c.evidence, ...where },
|
|
9915
10094
|
secondMate: { id: rec.id, taskId: null, taskTitle: null }
|
|
9916
10095
|
}));
|
|
9917
|
-
const home = (
|
|
10096
|
+
const home = (text2) => scrub(scrub(text2, rec.home), src.homeDir);
|
|
9918
10097
|
const out = [...own];
|
|
9919
10098
|
rec.decisions.forEach((d, i) => {
|
|
9920
10099
|
const hold = d.verb === "captain-hold" || d.source === "backlog";
|
|
@@ -9989,8 +10168,8 @@ class FindingsFiles {
|
|
|
9989
10168
|
return;
|
|
9990
10169
|
}
|
|
9991
10170
|
if (this.cache.get(resolved)?.mtimeMs === st.mtimeMs) return;
|
|
9992
|
-
const
|
|
9993
|
-
this.cache.set(resolved, { mtimeMs: st.mtimeMs, text });
|
|
10171
|
+
const text2 = await readFile(resolved, "utf8").catch(() => null);
|
|
10172
|
+
this.cache.set(resolved, { mtimeMs: st.mtimeMs, text: text2 });
|
|
9994
10173
|
})
|
|
9995
10174
|
);
|
|
9996
10175
|
}
|
|
@@ -10004,8 +10183,8 @@ function findingsWanted(tasks, row, ledger) {
|
|
|
10004
10183
|
const out = [];
|
|
10005
10184
|
for (const t of tasks) {
|
|
10006
10185
|
for (const d of row(t.id)?.openDecisions ?? []) {
|
|
10007
|
-
const
|
|
10008
|
-
const m = FINDINGS.exec(
|
|
10186
|
+
const text2 = openingLine(ledger(t.id), d.key)?.text ?? d.summary ?? "";
|
|
10187
|
+
const m = FINDINGS.exec(text2) ?? FINDINGS.exec(d.summary ?? "");
|
|
10009
10188
|
if (m) out.push({ taskId: t.id, file: m[2] });
|
|
10010
10189
|
}
|
|
10011
10190
|
}
|
|
@@ -10134,8 +10313,8 @@ class InboxService {
|
|
|
10134
10313
|
if (!p.ok) return { ok: false, status: 400, error: p.error };
|
|
10135
10314
|
line = p.line;
|
|
10136
10315
|
}
|
|
10137
|
-
const
|
|
10138
|
-
const valid = validateSend(requestId,
|
|
10316
|
+
const text2 = closing ? closeText(card, note2 || null) : answerText(card, choice, note2 || null, decided ? null : line, decided || null);
|
|
10317
|
+
const valid = validateSend(requestId, text2, card.taskId);
|
|
10139
10318
|
if (!valid.ok) return valid;
|
|
10140
10319
|
const sent = await messenger.send(valid.input);
|
|
10141
10320
|
if (sent.ok && sent.message.delivery !== "failed") {
|
|
@@ -10255,7 +10434,7 @@ class AnsweredLog {
|
|
|
10255
10434
|
return this.queued;
|
|
10256
10435
|
}
|
|
10257
10436
|
async write() {
|
|
10258
|
-
const
|
|
10437
|
+
const text2 = `${JSON.stringify(
|
|
10259
10438
|
{ schema: ANSWERED_SCHEMA, home: this.home, answered: this.records },
|
|
10260
10439
|
null,
|
|
10261
10440
|
" "
|
|
@@ -10264,7 +10443,7 @@ class AnsweredLog {
|
|
|
10264
10443
|
await mkdir(path.dirname(this.file), { recursive: true });
|
|
10265
10444
|
const tmp = `${this.file}.${randomBytes(6).toString("hex")}.tmp`;
|
|
10266
10445
|
try {
|
|
10267
|
-
await writeFile(tmp,
|
|
10446
|
+
await writeFile(tmp, text2, { mode: 384 });
|
|
10268
10447
|
await rename(tmp, this.file);
|
|
10269
10448
|
} catch (e) {
|
|
10270
10449
|
await rm(tmp, { force: true });
|
|
@@ -10317,12 +10496,12 @@ class ReactionStore {
|
|
|
10317
10496
|
return write2;
|
|
10318
10497
|
}
|
|
10319
10498
|
async write() {
|
|
10320
|
-
const
|
|
10499
|
+
const text2 = `${JSON.stringify({ schema: REACTIONS_SCHEMA, home: this.home, liked: this.ids }, null, " ")}
|
|
10321
10500
|
`;
|
|
10322
10501
|
await mkdir(path.dirname(this.file), { recursive: true });
|
|
10323
10502
|
const tmp = `${this.file}.${randomBytes(6).toString("hex")}.tmp`;
|
|
10324
10503
|
try {
|
|
10325
|
-
await writeFile(tmp,
|
|
10504
|
+
await writeFile(tmp, text2, { mode: 384 });
|
|
10326
10505
|
await rename(tmp, this.file);
|
|
10327
10506
|
} catch (e) {
|
|
10328
10507
|
await rm(tmp, { force: true });
|
|
@@ -10489,7 +10668,7 @@ class WatchStore {
|
|
|
10489
10668
|
save() {
|
|
10490
10669
|
const file = this.file;
|
|
10491
10670
|
if (!file) return Promise.resolve();
|
|
10492
|
-
const
|
|
10671
|
+
const text2 = `${JSON.stringify(
|
|
10493
10672
|
{ schema: WATCH_SCHEMA, projects: Object.fromEntries(this.projects) },
|
|
10494
10673
|
null,
|
|
10495
10674
|
" "
|
|
@@ -10499,7 +10678,7 @@ class WatchStore {
|
|
|
10499
10678
|
await mkdir(path.dirname(file), { recursive: true });
|
|
10500
10679
|
const tmp = `${file}.${randomBytes(6).toString("hex")}.tmp`;
|
|
10501
10680
|
try {
|
|
10502
|
-
await writeFile(tmp,
|
|
10681
|
+
await writeFile(tmp, text2, { mode: 384 });
|
|
10503
10682
|
await rename(tmp, file);
|
|
10504
10683
|
} catch (e) {
|
|
10505
10684
|
await rm(tmp, { force: true });
|
|
@@ -10575,8 +10754,8 @@ class IssueWatcher {
|
|
|
10575
10754
|
*/
|
|
10576
10755
|
async handOver(issue, projectId) {
|
|
10577
10756
|
if (!this.opts.send) return false;
|
|
10578
|
-
const
|
|
10579
|
-
const r = await this.opts.send({ requestId: issueRequestId(issue.url), text, taskId: null });
|
|
10757
|
+
const text2 = `${handoffText(issue, projectId)} Sent by Wheelhouse's issue watcher (auto pick-up).`;
|
|
10758
|
+
const r = await this.opts.send({ requestId: issueRequestId(issue.url), text: text2, taskId: null });
|
|
10580
10759
|
if (r.ok) return r.message.delivery !== "failed";
|
|
10581
10760
|
if (r.status === 422) return true;
|
|
10582
10761
|
this.opts.log?.(`Issue watcher: could not hand ${issue.url} to Firstmate: ${r.error}`);
|
|
@@ -10759,14 +10938,14 @@ async function loadOne(dir, id, r, o = {}) {
|
|
|
10759
10938
|
});
|
|
10760
10939
|
if (!ID$1.test(id)) return fail(`"${id}" is not a plugin id.`);
|
|
10761
10940
|
const root = path.join(dir, id);
|
|
10762
|
-
let
|
|
10941
|
+
let text2 = null;
|
|
10763
10942
|
let readError = "";
|
|
10764
10943
|
try {
|
|
10765
|
-
|
|
10944
|
+
text2 = await readFile(manifestPath(root), "utf8");
|
|
10766
10945
|
} catch (e) {
|
|
10767
10946
|
readError = message$2(e);
|
|
10768
10947
|
}
|
|
10769
|
-
const parsed =
|
|
10948
|
+
const parsed = text2 === null ? null : parseManifest(text2);
|
|
10770
10949
|
if (parsed?.ok) m = parsed.manifest;
|
|
10771
10950
|
if (r && !r.enabled) return { ok: false, status: status(id, r, m, "disabled", null) };
|
|
10772
10951
|
if (!parsed) return fail(`its manifest could not be read: ${readError}`);
|
|
@@ -11580,7 +11759,7 @@ class PluginRegistry {
|
|
|
11580
11759
|
if (hit?.value && !hit.pending && now - hit.at < hit.ttl) return Promise.resolve(hit.value);
|
|
11581
11760
|
const stale = hit?.value?.available && now - hit.at < hit.ttl + MAX_STALE_MS ? hit.value : null;
|
|
11582
11761
|
if (hit?.pending) return stale ? Promise.resolve(stale) : hit.pending;
|
|
11583
|
-
const
|
|
11762
|
+
const pending2 = this.call(plugin, provider, scope).then((value) => {
|
|
11584
11763
|
const ttl = value.available ? provider.ttlMs : Math.min(provider.ttlMs, MAX_FAILURE_TTL_MS);
|
|
11585
11764
|
const at = this.now();
|
|
11586
11765
|
for (const [k, e] of this.cache) {
|
|
@@ -11593,9 +11772,9 @@ class PluginRegistry {
|
|
|
11593
11772
|
at: hit?.at ?? now,
|
|
11594
11773
|
ttl: hit?.ttl ?? 0,
|
|
11595
11774
|
value: hit?.value ?? null,
|
|
11596
|
-
pending
|
|
11775
|
+
pending: pending2
|
|
11597
11776
|
});
|
|
11598
|
-
return stale ? Promise.resolve(stale) :
|
|
11777
|
+
return stale ? Promise.resolve(stale) : pending2;
|
|
11599
11778
|
}
|
|
11600
11779
|
async call(plugin, provider, scope) {
|
|
11601
11780
|
const timeoutMs = Math.min(
|
|
@@ -11860,8 +12039,8 @@ class ServiceManager {
|
|
|
11860
12039
|
* launches of one service share one start.
|
|
11861
12040
|
*/
|
|
11862
12041
|
launch(key, spec) {
|
|
11863
|
-
const
|
|
11864
|
-
if (
|
|
12042
|
+
const pending2 = this.launches.get(key);
|
|
12043
|
+
if (pending2) return pending2.done;
|
|
11865
12044
|
const refused = refuseSpec(spec);
|
|
11866
12045
|
if (refused) {
|
|
11867
12046
|
return Promise.resolve({
|
|
@@ -12025,8 +12204,8 @@ function tail(file) {
|
|
|
12025
12204
|
const size = fstatSync(fd).size;
|
|
12026
12205
|
const buf = Buffer.alloc(Math.min(size, LOG_TAIL));
|
|
12027
12206
|
const n = readSync(fd, buf, 0, buf.length, size - buf.length);
|
|
12028
|
-
const
|
|
12029
|
-
return size > LOG_TAIL ? `…${
|
|
12207
|
+
const text2 = buf.subarray(0, n).toString("utf8");
|
|
12208
|
+
return size > LOG_TAIL ? `…${text2}` : text2;
|
|
12030
12209
|
} catch {
|
|
12031
12210
|
return "";
|
|
12032
12211
|
} finally {
|
|
@@ -12222,9 +12401,9 @@ class McpHttpClient {
|
|
|
12222
12401
|
class Expired extends Error {
|
|
12223
12402
|
}
|
|
12224
12403
|
const isRecord$1 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
12225
|
-
function parseJson(
|
|
12404
|
+
function parseJson(text2) {
|
|
12226
12405
|
try {
|
|
12227
|
-
return JSON.parse(
|
|
12406
|
+
return JSON.parse(text2);
|
|
12228
12407
|
} catch {
|
|
12229
12408
|
throw new McpError("the MCP server answered with something that is not JSON.");
|
|
12230
12409
|
}
|
|
@@ -12710,13 +12889,13 @@ function signedBy(key, csp, sig) {
|
|
|
12710
12889
|
return got.length === want.length && timingSafeEqual(got, want);
|
|
12711
12890
|
}
|
|
12712
12891
|
const sandboxHandler = (key, hosted2 = () => null, hostedPage = () => null) => (req, res) => {
|
|
12713
|
-
const send2 = (status2,
|
|
12892
|
+
const send2 = (status2, text2) => {
|
|
12714
12893
|
res.writeHead(status2, {
|
|
12715
12894
|
"content-type": "text/plain; charset=utf-8",
|
|
12716
12895
|
"cache-control": "no-store",
|
|
12717
12896
|
"x-content-type-options": "nosniff"
|
|
12718
12897
|
});
|
|
12719
|
-
res.end(
|
|
12898
|
+
res.end(text2);
|
|
12720
12899
|
};
|
|
12721
12900
|
const there = hosted2();
|
|
12722
12901
|
const atHosted = !!there && (req.headers.host ?? "").toLowerCase() === there.host;
|
|
@@ -12926,13 +13105,13 @@ class ConsentStore {
|
|
|
12926
13105
|
projects: Object.fromEntries(this.projects),
|
|
12927
13106
|
...this.commands.size ? { commands: Object.fromEntries(this.commands) } : {}
|
|
12928
13107
|
};
|
|
12929
|
-
const
|
|
13108
|
+
const text2 = `${JSON.stringify(doc, null, " ")}
|
|
12930
13109
|
`;
|
|
12931
13110
|
const write2 = this.writing.then(async () => {
|
|
12932
13111
|
await mkdir(path.dirname(this.file), { recursive: true });
|
|
12933
13112
|
const tmp = `${this.file}.${randomBytes(6).toString("hex")}.tmp`;
|
|
12934
13113
|
try {
|
|
12935
|
-
await writeFile(tmp,
|
|
13114
|
+
await writeFile(tmp, text2, { mode: 384 });
|
|
12936
13115
|
await rename(tmp, this.file);
|
|
12937
13116
|
} catch (e) {
|
|
12938
13117
|
await rm(tmp, { force: true });
|
|
@@ -13053,7 +13232,7 @@ class ReachedStore {
|
|
|
13053
13232
|
return this.queued;
|
|
13054
13233
|
}
|
|
13055
13234
|
async write() {
|
|
13056
|
-
const
|
|
13235
|
+
const text2 = `${JSON.stringify(
|
|
13057
13236
|
{ schema: REACHED_SCHEMA, home: this.home, tasks: [...this.entries.values()] },
|
|
13058
13237
|
null,
|
|
13059
13238
|
" "
|
|
@@ -13062,7 +13241,7 @@ class ReachedStore {
|
|
|
13062
13241
|
await mkdir(path.dirname(this.file), { recursive: true });
|
|
13063
13242
|
const tmp = `${this.file}.${randomBytes(6).toString("hex")}.tmp`;
|
|
13064
13243
|
try {
|
|
13065
|
-
await writeFile(tmp,
|
|
13244
|
+
await writeFile(tmp, text2, { mode: 384 });
|
|
13066
13245
|
await rename(tmp, this.file);
|
|
13067
13246
|
} catch (e) {
|
|
13068
13247
|
await rm(tmp, { force: true });
|
|
@@ -13072,7 +13251,7 @@ class ReachedStore {
|
|
|
13072
13251
|
}
|
|
13073
13252
|
const PROJECT_FILE = ".wheelhouse.yaml";
|
|
13074
13253
|
const PROJECT_ID = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
|
|
13075
|
-
const digestOf = (
|
|
13254
|
+
const digestOf = (text2) => createHash("sha256").update(text2).digest("hex");
|
|
13076
13255
|
async function defaultRef(dir, deps) {
|
|
13077
13256
|
const head2 = await deps.git(dir, [
|
|
13078
13257
|
"symbolic-ref",
|
|
@@ -13154,8 +13333,8 @@ async function readCaptainFile(configDir, projectId) {
|
|
|
13154
13333
|
problem: `The file is larger than ${MAX_FILE_BYTES$1 / 1024} KiB.`
|
|
13155
13334
|
};
|
|
13156
13335
|
}
|
|
13157
|
-
const
|
|
13158
|
-
return { state: "read", location: file, text, digest: digestOf(
|
|
13336
|
+
const text2 = buf.subarray(0, bytesRead).toString("utf8");
|
|
13337
|
+
return { state: "read", location: file, text: text2, digest: digestOf(text2), problem: null };
|
|
13159
13338
|
} catch (e) {
|
|
13160
13339
|
return { ...none, state: "unreadable", problem: `Could not read it: ${e.message}` };
|
|
13161
13340
|
} finally {
|
|
@@ -13203,15 +13382,15 @@ async function readEditorFile(target, file) {
|
|
|
13203
13382
|
problem: `The file is larger than ${MAX_FILE_BYTES$1 / 1024} KiB.`
|
|
13204
13383
|
};
|
|
13205
13384
|
}
|
|
13206
|
-
const
|
|
13207
|
-
return { target, exists: true, text, digest: digestOf(
|
|
13385
|
+
const text2 = buf.subarray(0, bytesRead).toString("utf8");
|
|
13386
|
+
return { target, exists: true, text: text2, digest: digestOf(text2), location: file, problem: null };
|
|
13208
13387
|
} catch (e) {
|
|
13209
13388
|
return { ...none, exists: true, problem: `Could not read it: ${e.message}` };
|
|
13210
13389
|
} finally {
|
|
13211
13390
|
await fh?.close();
|
|
13212
13391
|
}
|
|
13213
13392
|
}
|
|
13214
|
-
async function writeEditorFile(target, file,
|
|
13393
|
+
async function writeEditorFile(target, file, text2, baseDigest) {
|
|
13215
13394
|
const now = await readEditorFile(target, file);
|
|
13216
13395
|
if (now.problem && now.exists) return { ok: false, status: 409, message: now.problem };
|
|
13217
13396
|
if (now.digest !== baseDigest) {
|
|
@@ -13226,7 +13405,7 @@ async function writeEditorFile(target, file, text, baseDigest) {
|
|
|
13226
13405
|
if (target === "captain") await mkdir(dir, { recursive: true });
|
|
13227
13406
|
const tmp = path.join(dir, `.${path.basename(file)}.${randomBytes(6).toString("hex")}.tmp`);
|
|
13228
13407
|
try {
|
|
13229
|
-
await writeFile(tmp,
|
|
13408
|
+
await writeFile(tmp, text2, { mode: 420, flag: "wx" });
|
|
13230
13409
|
await rename(tmp, file);
|
|
13231
13410
|
} catch (e) {
|
|
13232
13411
|
await rm(tmp, { force: true });
|
|
@@ -13239,7 +13418,7 @@ async function writeEditorFile(target, file, text, baseDigest) {
|
|
|
13239
13418
|
message: `Wheelhouse could not save the file: ${e.message}`
|
|
13240
13419
|
};
|
|
13241
13420
|
}
|
|
13242
|
-
return { ok: true, digest: digestOf(
|
|
13421
|
+
return { ok: true, digest: digestOf(text2) };
|
|
13243
13422
|
}
|
|
13244
13423
|
class Scheduler {
|
|
13245
13424
|
entries = /* @__PURE__ */ new Map();
|
|
@@ -13745,16 +13924,16 @@ class PassageService {
|
|
|
13745
13924
|
terminal: (r) => r.merged && !!r.refs.mergeCommit
|
|
13746
13925
|
};
|
|
13747
13926
|
const s = this.refs.status(job.key)?.result;
|
|
13748
|
-
const
|
|
13927
|
+
const pending2 = (summary2, state = "waiting") => ({
|
|
13749
13928
|
ok: false,
|
|
13750
13929
|
internal: { ...waiting(summary2, state), refsJob: job }
|
|
13751
13930
|
});
|
|
13752
|
-
if (!s) return
|
|
13753
|
-
if (s.problem) return
|
|
13754
|
-
if (need === "merge.commit" && !f.merged && !s.merged) return
|
|
13931
|
+
if (!s) return pending2("Looking up the pull request’s commits.");
|
|
13932
|
+
if (s.problem) return pending2(`Can't read the pull request: ${s.problem}.`, "unknown");
|
|
13933
|
+
if (need === "merge.commit" && !f.merged && !s.merged) return pending2("Waits for the merge.");
|
|
13755
13934
|
const sha = need === "merge.commit" ? s.refs.mergeCommit : s.refs.prHead;
|
|
13756
13935
|
if (!sha) {
|
|
13757
|
-
return
|
|
13936
|
+
return pending2(
|
|
13758
13937
|
need === "merge.commit" ? "GitHub reports no merge commit yet." : "GitHub reports no head commit."
|
|
13759
13938
|
);
|
|
13760
13939
|
}
|
|
@@ -13974,9 +14153,9 @@ class PassageService {
|
|
|
13974
14153
|
};
|
|
13975
14154
|
}
|
|
13976
14155
|
/** Validate an edited file as it would apply (shape and references). */
|
|
13977
|
-
draft(projectId, target,
|
|
14156
|
+
draft(projectId, target, text2) {
|
|
13978
14157
|
const l = this.loaded.get(projectId);
|
|
13979
|
-
const r = parsePassage(
|
|
14158
|
+
const r = parsePassage(text2, {
|
|
13980
14159
|
kind: "overlay",
|
|
13981
14160
|
captain: target === "captain",
|
|
13982
14161
|
project: projectId
|
|
@@ -14003,7 +14182,7 @@ class PassageService {
|
|
|
14003
14182
|
return { errors, both, track };
|
|
14004
14183
|
}
|
|
14005
14184
|
/** Save an edited file when it still matches what the editor loaded, then re-read the passage. */
|
|
14006
|
-
async saveFile(projectId, target,
|
|
14185
|
+
async saveFile(projectId, target, text2, baseDigest) {
|
|
14007
14186
|
await this.load(projectId);
|
|
14008
14187
|
const l = this.loaded.get(projectId);
|
|
14009
14188
|
const file = this.filePath(projectId, l, target);
|
|
@@ -14014,7 +14193,7 @@ class PassageService {
|
|
|
14014
14193
|
message: target === "project" ? l?.cloneProblem ?? "Firstmate has no clone of this project." : this.opts.configProblem ?? "There is no captain-owned Wheelhouse config directory."
|
|
14015
14194
|
};
|
|
14016
14195
|
}
|
|
14017
|
-
const d = this.draft(projectId, target,
|
|
14196
|
+
const d = this.draft(projectId, target, text2);
|
|
14018
14197
|
if (d.errors.length) {
|
|
14019
14198
|
return {
|
|
14020
14199
|
ok: false,
|
|
@@ -14023,7 +14202,7 @@ class PassageService {
|
|
|
14023
14202
|
errors: d.errors
|
|
14024
14203
|
};
|
|
14025
14204
|
}
|
|
14026
|
-
const w = await writeEditorFile(target, file,
|
|
14205
|
+
const w = await writeEditorFile(target, file, text2, baseDigest);
|
|
14027
14206
|
if (w.ok) {
|
|
14028
14207
|
this.loaded.delete(projectId);
|
|
14029
14208
|
await this.load(projectId);
|
|
@@ -14041,7 +14220,7 @@ class PassageService {
|
|
|
14041
14220
|
* captain ticked the box under, and it is still exactly what the file runs;
|
|
14042
14221
|
* nothing is recorded or cached.
|
|
14043
14222
|
*/
|
|
14044
|
-
async dryRun(projectId, target,
|
|
14223
|
+
async dryRun(projectId, target, text2, taskId, opts) {
|
|
14045
14224
|
const l = this.loaded.get(projectId);
|
|
14046
14225
|
const seen = this.lastFacts.get(taskId);
|
|
14047
14226
|
if (!seen || seen.projectId !== projectId) {
|
|
@@ -14051,7 +14230,7 @@ class PassageService {
|
|
|
14051
14230
|
message: "Wheelhouse has not seen that task in this project recently."
|
|
14052
14231
|
};
|
|
14053
14232
|
}
|
|
14054
|
-
const r = parsePassage(
|
|
14233
|
+
const r = parsePassage(text2, {
|
|
14055
14234
|
kind: "overlay",
|
|
14056
14235
|
captain: target === "captain",
|
|
14057
14236
|
project: projectId
|
|
@@ -14385,11 +14564,11 @@ async function call(transport, token, version2, method, route, what, body) {
|
|
|
14385
14564
|
await sleep(Math.min(10, Math.max(0.1, Number(j.retry_after) || 1)) * 1e3);
|
|
14386
14565
|
continue;
|
|
14387
14566
|
}
|
|
14388
|
-
const
|
|
14567
|
+
const text2 = await res.text().catch(() => "");
|
|
14389
14568
|
if (!res.ok) {
|
|
14390
14569
|
let said = "";
|
|
14391
14570
|
try {
|
|
14392
|
-
said = str$1(JSON.parse(
|
|
14571
|
+
said = str$1(JSON.parse(text2).message) ?? "";
|
|
14393
14572
|
} catch {
|
|
14394
14573
|
}
|
|
14395
14574
|
throw new DiscordError(
|
|
@@ -14397,7 +14576,7 @@ async function call(transport, token, version2, method, route, what, body) {
|
|
|
14397
14576
|
redact(`Discord would not ${what} (${res.status}${said ? `: ${said}` : ""}).`)
|
|
14398
14577
|
);
|
|
14399
14578
|
}
|
|
14400
|
-
return
|
|
14579
|
+
return text2 ? JSON.parse(text2) : void 0;
|
|
14401
14580
|
}
|
|
14402
14581
|
}
|
|
14403
14582
|
function components(buttons) {
|
|
@@ -14689,7 +14868,7 @@ class DiscordAdapter {
|
|
|
14689
14868
|
"add a reaction"
|
|
14690
14869
|
);
|
|
14691
14870
|
}
|
|
14692
|
-
async ack(e,
|
|
14871
|
+
async ack(e, text2) {
|
|
14693
14872
|
const at = e.handle.indexOf(":");
|
|
14694
14873
|
const id = e.handle.slice(0, at);
|
|
14695
14874
|
const token = e.handle.slice(at + 1);
|
|
@@ -14701,7 +14880,7 @@ class DiscordAdapter {
|
|
|
14701
14880
|
`/interactions/${id}/${token}/callback`,
|
|
14702
14881
|
"acknowledge a button",
|
|
14703
14882
|
// 4 with the ephemeral flag answers only the presser; 6 says the message is about to change.
|
|
14704
|
-
|
|
14883
|
+
text2 ? { type: 4, data: { content: text2, flags: 64 } } : { type: 6 }
|
|
14705
14884
|
);
|
|
14706
14885
|
}
|
|
14707
14886
|
}
|
|
@@ -14710,8 +14889,8 @@ const GATEWAY_CHANNELS = [
|
|
|
14710
14889
|
];
|
|
14711
14890
|
const DEFAULT_GATEWAY_ALERTS = ["question", "pr-green", "stuck"];
|
|
14712
14891
|
const PAIRING_MS = 10 * 6e4;
|
|
14713
|
-
function normaliseCode(
|
|
14714
|
-
return
|
|
14892
|
+
function normaliseCode(text2) {
|
|
14893
|
+
return text2.replace(/[\s-]/g, "").toUpperCase();
|
|
14715
14894
|
}
|
|
14716
14895
|
const ALPHABET = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789";
|
|
14717
14896
|
const CODE_LENGTH = 8;
|
|
@@ -14754,9 +14933,9 @@ class Pairing {
|
|
|
14754
14933
|
* account that is not paired, anything else counts as a wrong try; the
|
|
14755
14934
|
* paired account's ordinary messages (`count: false`) do not.
|
|
14756
14935
|
*/
|
|
14757
|
-
offer(
|
|
14936
|
+
offer(text2, { count = true } = {}) {
|
|
14758
14937
|
if (!this.open() || !this.code) return "closed";
|
|
14759
|
-
const given = Buffer.from(normaliseCode(
|
|
14938
|
+
const given = Buffer.from(normaliseCode(text2));
|
|
14760
14939
|
const want = Buffer.from(this.code);
|
|
14761
14940
|
if (given.length === want.length && timingSafeEqual(given, want)) {
|
|
14762
14941
|
this.code = null;
|
|
@@ -14901,14 +15080,14 @@ const HELP_TEXT = [
|
|
|
14901
15080
|
"help: this message.",
|
|
14902
15081
|
"Questions Firstmate asks in its own session, and its permission prompts, are answered at the keyboard only."
|
|
14903
15082
|
].join("\n");
|
|
14904
|
-
function localCommand(
|
|
14905
|
-
const t =
|
|
15083
|
+
function localCommand(text2) {
|
|
15084
|
+
const t = text2.trim().toLowerCase();
|
|
14906
15085
|
return t === "status" || t === "help" ? t : null;
|
|
14907
15086
|
}
|
|
14908
|
-
function splitText(
|
|
15087
|
+
function splitText(text2, limit) {
|
|
14909
15088
|
const out = [];
|
|
14910
15089
|
let cur = "";
|
|
14911
|
-
for (const line of
|
|
15090
|
+
for (const line of text2.split("\n")) {
|
|
14912
15091
|
let rest2 = line;
|
|
14913
15092
|
while (rest2.length > limit) {
|
|
14914
15093
|
if (cur) {
|
|
@@ -14966,11 +15145,11 @@ function parseChannel(v, fallback) {
|
|
|
14966
15145
|
titlesOnly: typeof v.titlesOnly === "boolean" ? v.titlesOnly : fallback.titlesOnly
|
|
14967
15146
|
};
|
|
14968
15147
|
}
|
|
14969
|
-
async function writeAtomic(file,
|
|
15148
|
+
async function writeAtomic(file, text2) {
|
|
14970
15149
|
await mkdir(path.dirname(file), { recursive: true, mode: 448 });
|
|
14971
15150
|
const tmp = `${file}.tmp-${process.pid}-${randomBytes(4).toString("hex")}`;
|
|
14972
15151
|
try {
|
|
14973
|
-
await writeFile(tmp,
|
|
15152
|
+
await writeFile(tmp, text2, { mode: 384 });
|
|
14974
15153
|
await rename(tmp, file);
|
|
14975
15154
|
} catch (e) {
|
|
14976
15155
|
await rm(tmp, { force: true });
|
|
@@ -14993,16 +15172,16 @@ class GatewaySettings {
|
|
|
14993
15172
|
/** The settings, with defaults for anything missing; an unreadable file reads as the defaults, with why. */
|
|
14994
15173
|
async read() {
|
|
14995
15174
|
const settings = defaultSettings();
|
|
14996
|
-
let
|
|
15175
|
+
let text2;
|
|
14997
15176
|
try {
|
|
14998
|
-
|
|
15177
|
+
text2 = await readFile(this.file, "utf8");
|
|
14999
15178
|
} catch (e) {
|
|
15000
15179
|
if (e.code === "ENOENT") return { settings, error: null };
|
|
15001
15180
|
return { settings, error: `${this.file} could not be read: ${e.message}` };
|
|
15002
15181
|
}
|
|
15003
15182
|
let parsed;
|
|
15004
15183
|
try {
|
|
15005
|
-
parsed = JSON.parse(
|
|
15184
|
+
parsed = JSON.parse(text2);
|
|
15006
15185
|
} catch {
|
|
15007
15186
|
return { settings, error: `${this.file} is not valid JSON.` };
|
|
15008
15187
|
}
|
|
@@ -15342,7 +15521,7 @@ class Gateway {
|
|
|
15342
15521
|
await this.change(channel, (s) => s.paired && (s.paired.dm = e.chat));
|
|
15343
15522
|
const peer = { id: captain.id, dm: e.chat };
|
|
15344
15523
|
const ref = { chat: e.chat, id: e.id };
|
|
15345
|
-
const say = (
|
|
15524
|
+
const say = (text22) => this.post(channel, adapter, peer, notice(text22), ref);
|
|
15346
15525
|
const command = localCommand(e.text);
|
|
15347
15526
|
if (command) {
|
|
15348
15527
|
this.log(channel, { event: "accept", from: e.from, id: e.id, what: command });
|
|
@@ -15351,8 +15530,8 @@ class Gateway {
|
|
|
15351
15530
|
);
|
|
15352
15531
|
return;
|
|
15353
15532
|
}
|
|
15354
|
-
const
|
|
15355
|
-
if (!
|
|
15533
|
+
const text2 = e.text.trim();
|
|
15534
|
+
if (!text2) {
|
|
15356
15535
|
this.log(channel, { event: "refuse", from: e.from, id: e.id, reason: "no text" });
|
|
15357
15536
|
if (e.extras)
|
|
15358
15537
|
await say(
|
|
@@ -15363,7 +15542,7 @@ class Gateway {
|
|
|
15363
15542
|
const requestId = `${channel}:${e.id}`;
|
|
15364
15543
|
const taskId = e.inReplyTo ? this.deps.record.sentAt(e.inReplyTo)?.taskId ?? null : null;
|
|
15365
15544
|
const valid = validateSend(requestId, `${provenance(label(channel))}
|
|
15366
|
-
${
|
|
15545
|
+
${text2}`, taskId);
|
|
15367
15546
|
if (!valid.ok) {
|
|
15368
15547
|
this.log(channel, { event: "refuse", from: e.from, id: e.id, reason: valid.error });
|
|
15369
15548
|
await say(valid.error);
|
|
@@ -15539,10 +15718,10 @@ ${text}`, taskId);
|
|
|
15539
15718
|
await this.deps.record.save();
|
|
15540
15719
|
if (!ref) return;
|
|
15541
15720
|
const sent = this.deps.record.sentAt(ref);
|
|
15542
|
-
const
|
|
15721
|
+
const text2 = sent?.text ? `${sent.text}
|
|
15543
15722
|
|
|
15544
15723
|
✓ ${outcome.settled}` : `✓ ${outcome.settled}`;
|
|
15545
|
-
await adapter.update(ref, { text, buttons: (sent?.links ?? []).map((l) => ({ ...l })) }).catch((err) => this.log(channel, { event: "error", reason: err.message }));
|
|
15724
|
+
await adapter.update(ref, { text: text2, buttons: (sent?.links ?? []).map((l) => ({ ...l })) }).catch((err) => this.log(channel, { event: "error", reason: err.message }));
|
|
15546
15725
|
}
|
|
15547
15726
|
/* ------------------------------------------------------------ out */
|
|
15548
15727
|
/** Delivery marks and Firstmate's replies for the notes that came from a channel. */
|
|
@@ -15672,8 +15851,8 @@ ${text}`, taskId);
|
|
|
15672
15851
|
return ref;
|
|
15673
15852
|
}
|
|
15674
15853
|
}
|
|
15675
|
-
function notice(
|
|
15676
|
-
return { text, taskId: null, actions: [], links: [] };
|
|
15854
|
+
function notice(text2) {
|
|
15855
|
+
return { text: text2, taskId: null, actions: [], links: [] };
|
|
15677
15856
|
}
|
|
15678
15857
|
const RECORD_SCHEMA = "wheelhouse-gateway-record.v1";
|
|
15679
15858
|
const sameRef = (a, b) => !!a && !!b && a.chat === b.chat && a.id === b.id;
|
|
@@ -15691,15 +15870,15 @@ class GatewayRecord {
|
|
|
15691
15870
|
/** Load the record; a missing or unreadable one starts empty (an unreadable one is moved aside). */
|
|
15692
15871
|
static async open(file, now = Date.now) {
|
|
15693
15872
|
const r = new GatewayRecord(file, now);
|
|
15694
|
-
let
|
|
15873
|
+
let text2 = null;
|
|
15695
15874
|
try {
|
|
15696
|
-
|
|
15875
|
+
text2 = await readFile(file, "utf8");
|
|
15697
15876
|
} catch (e) {
|
|
15698
15877
|
if (e.code !== "ENOENT") throw e;
|
|
15699
15878
|
}
|
|
15700
|
-
if (
|
|
15879
|
+
if (text2 === null) return r;
|
|
15701
15880
|
try {
|
|
15702
|
-
const parsed = JSON.parse(
|
|
15881
|
+
const parsed = JSON.parse(text2);
|
|
15703
15882
|
if (parsed.schema !== RECORD_SCHEMA) throw new Error("not a gateway record");
|
|
15704
15883
|
r.notes = Array.isArray(parsed.notes) ? parsed.notes : [];
|
|
15705
15884
|
r.sent = Array.isArray(parsed.sent) ? parsed.sent : [];
|
|
@@ -15772,17 +15951,17 @@ class GatewayRecord {
|
|
|
15772
15951
|
sent: this.sent,
|
|
15773
15952
|
buttons: this.buttons
|
|
15774
15953
|
};
|
|
15775
|
-
const
|
|
15954
|
+
const text2 = JSON.stringify(data, null, " ") + "\n";
|
|
15776
15955
|
this.writing = this.writing.catch(() => {
|
|
15777
|
-
}).then(() => write(this.file,
|
|
15956
|
+
}).then(() => write(this.file, text2));
|
|
15778
15957
|
return this.writing;
|
|
15779
15958
|
}
|
|
15780
15959
|
}
|
|
15781
|
-
async function write(file,
|
|
15960
|
+
async function write(file, text2) {
|
|
15782
15961
|
await mkdir(path.dirname(file), { recursive: true, mode: 448 });
|
|
15783
15962
|
const tmp = `${file}.tmp-${process.pid}-${randomBytes(4).toString("hex")}`;
|
|
15784
15963
|
try {
|
|
15785
|
-
await writeFile(tmp,
|
|
15964
|
+
await writeFile(tmp, text2, { mode: 384 });
|
|
15786
15965
|
await rename(tmp, file);
|
|
15787
15966
|
} catch (e) {
|
|
15788
15967
|
await rm(tmp, { force: true });
|
|
@@ -15818,7 +15997,7 @@ class AuditLog {
|
|
|
15818
15997
|
return this.writing;
|
|
15819
15998
|
}
|
|
15820
15999
|
}
|
|
15821
|
-
const OPTION = /^\s*(❯\s+)?(\d{1,2})\.\s+(?:\[([ ✔✓x])\]\s+)?(.*?)\s*$/;
|
|
16000
|
+
const OPTION$1 = /^\s*(❯\s+)?(\d{1,2})\.\s+(?:\[([ ✔✓x])\]\s+)?(.*?)\s*$/;
|
|
15822
16001
|
const SUBMIT_ROW = /^\s*(❯\s+)?Submit\s*$/;
|
|
15823
16002
|
const SEPARATOR = /^\s*[─━-]{8,}\s*$/;
|
|
15824
16003
|
const OVERLINE = /^\s*▔{8,}/;
|
|
@@ -15833,7 +16012,7 @@ function parsePicker(screen) {
|
|
|
15833
16012
|
let last = end;
|
|
15834
16013
|
while (last >= 0) {
|
|
15835
16014
|
const l = lines[last];
|
|
15836
|
-
if (OPTION.test(l) || SUBMIT_ROW.test(l)) break;
|
|
16015
|
+
if (OPTION$1.test(l) || SUBMIT_ROW.test(l)) break;
|
|
15837
16016
|
if (l.trim() && !FOOTER.test(l) && !SEPARATOR.test(l)) return null;
|
|
15838
16017
|
last--;
|
|
15839
16018
|
}
|
|
@@ -15844,7 +16023,7 @@ function parsePicker(screen) {
|
|
|
15844
16023
|
let pendingDescription = [];
|
|
15845
16024
|
for (let i = last; i >= 0; i--) {
|
|
15846
16025
|
const l = lines[i];
|
|
15847
|
-
const m = OPTION.exec(l);
|
|
16026
|
+
const m = OPTION$1.exec(l);
|
|
15848
16027
|
if (m) {
|
|
15849
16028
|
const n = Number(m[2]);
|
|
15850
16029
|
options.unshift({
|
|
@@ -15917,6 +16096,10 @@ function pickerKeys(picker, action) {
|
|
|
15917
16096
|
if ("press" in action) {
|
|
15918
16097
|
const o = picker.options.find((x) => x.n === action.press);
|
|
15919
16098
|
if (!o || o.freeText || o.n > 9) return null;
|
|
16099
|
+
if (picker.navigation) {
|
|
16100
|
+
const moves = o.n - picker.navigation.selected;
|
|
16101
|
+
return [...Array(Math.abs(moves)).fill(moves > 0 ? "Down" : "Up"), "Enter"];
|
|
16102
|
+
}
|
|
15920
16103
|
return [String(o.n)];
|
|
15921
16104
|
}
|
|
15922
16105
|
if (picker.submitMoves === null) return null;
|
|
@@ -16005,410 +16188,283 @@ function registerTrust(store, dir) {
|
|
|
16005
16188
|
}
|
|
16006
16189
|
return `${file} did not keep the trust entry for ${target}`;
|
|
16007
16190
|
}
|
|
16008
|
-
const
|
|
16009
|
-
const
|
|
16010
|
-
|
|
16011
|
-
|
|
16012
|
-
const
|
|
16013
|
-
const
|
|
16014
|
-
|
|
16015
|
-
|
|
16016
|
-
|
|
16017
|
-
|
|
16018
|
-
|
|
16019
|
-
|
|
16020
|
-
const
|
|
16021
|
-
const
|
|
16022
|
-
|
|
16023
|
-
|
|
16024
|
-
|
|
16025
|
-
]
|
|
16026
|
-
|
|
16027
|
-
|
|
16028
|
-
|
|
16029
|
-
|
|
16030
|
-
|
|
16031
|
-
};
|
|
16032
|
-
if (skipPermissions) settings.skipDangerousModePermissionPrompt = true;
|
|
16033
|
-
return JSON.stringify(settings);
|
|
16034
|
-
}
|
|
16035
|
-
function claudeArgv(claude, hookFile, skipPermissions) {
|
|
16036
|
-
const argv = [claude];
|
|
16037
|
-
if (skipPermissions) argv.push("--dangerously-skip-permissions");
|
|
16038
|
-
argv.push("--settings", sessionSettings(hookFile, skipPermissions));
|
|
16039
|
-
return argv;
|
|
16040
|
-
}
|
|
16041
|
-
function launchArgv(claude, firstmateDir, hookFile, skipPermissions, fmHome) {
|
|
16042
|
-
return [
|
|
16043
|
-
"new-session",
|
|
16044
|
-
"-d",
|
|
16045
|
-
"-s",
|
|
16046
|
-
FIRSTMATE_TMUX,
|
|
16047
|
-
"-x",
|
|
16048
|
-
"160",
|
|
16049
|
-
"-y",
|
|
16050
|
-
"48",
|
|
16051
|
-
"-c",
|
|
16052
|
-
firstmateDir,
|
|
16053
|
-
...fmHome ? ["-e", `FM_HOME=${fmHome}`] : [],
|
|
16054
|
-
"--",
|
|
16055
|
-
...claudeArgv(claude, hookFile, skipPermissions)
|
|
16056
|
-
];
|
|
16057
|
-
}
|
|
16058
|
-
const attachHint = (socket) => shellLine(["tmux", "-L", socket, "attach", "-t", FIRSTMATE_TMUX]);
|
|
16059
|
-
function firstmateTmux(opts) {
|
|
16060
|
-
const socket = opts.tmuxSocket || DEFAULT_TMUX_SOCKET;
|
|
16061
|
-
const env = sessionEnv(opts.env ?? process.env);
|
|
16062
|
-
const find = opts.find ?? ((name2) => which(name2, env.PATH));
|
|
16063
|
-
const run = opts.run ?? runBounded;
|
|
16064
|
-
return async () => {
|
|
16065
|
-
const tmux = find("tmux");
|
|
16066
|
-
if (!tmux || !TMUX_SOCKET.test(socket)) return null;
|
|
16067
|
-
const r = await run(
|
|
16068
|
-
tmux,
|
|
16069
|
-
["-L", socket, "display-message", "-p", "-t", `=${FIRSTMATE_TMUX}:`, TMUX_FORMAT],
|
|
16070
|
-
{ env, timeoutMs: TMUX_TIMEOUT_MS, maxOutputBytes: 64 * 1024 }
|
|
16071
|
-
);
|
|
16072
|
-
if (!r.ok) return null;
|
|
16073
|
-
const value = r.stdout.trim().replace(/,\$(\d+)$/, ",$1");
|
|
16074
|
-
return /^\/.*,\d+,\d+$/.test(value) ? value : null;
|
|
16075
|
-
};
|
|
16076
|
-
}
|
|
16077
|
-
class FirstmateSession {
|
|
16078
|
-
firstmateDir;
|
|
16079
|
-
homeDir;
|
|
16080
|
-
hookFile;
|
|
16081
|
-
skipPermissions;
|
|
16082
|
-
tmuxSocket;
|
|
16083
|
-
stateDir;
|
|
16084
|
-
lock;
|
|
16085
|
-
env;
|
|
16086
|
-
find;
|
|
16087
|
-
run;
|
|
16088
|
-
trustStore;
|
|
16089
|
-
sleep;
|
|
16090
|
-
starting = null;
|
|
16091
|
-
/** One input at a time, in order, so two messages never interleave in the paste buffer. */
|
|
16092
|
-
queue = Promise.resolve();
|
|
16093
|
-
constructor(opts) {
|
|
16094
|
-
this.firstmateDir = path.resolve(opts.firstmateDir);
|
|
16095
|
-
this.homeDir = path.resolve(opts.homeDir);
|
|
16096
|
-
this.stateDir = path.resolve(opts.stateDir);
|
|
16097
|
-
this.hookFile = path.join(this.stateDir, HOOK_RECORD);
|
|
16098
|
-
this.lock = opts.lock;
|
|
16099
|
-
this.skipPermissions = opts.skipPermissions ?? true;
|
|
16100
|
-
this.tmuxSocket = opts.tmuxSocket || DEFAULT_TMUX_SOCKET;
|
|
16101
|
-
this.env = sessionEnv(opts.env ?? process.env);
|
|
16102
|
-
this.find = opts.find ?? ((name2) => which(name2, this.env.PATH));
|
|
16103
|
-
this.run = opts.run ?? runBounded;
|
|
16104
|
-
this.trustStore = opts.trustStore === void 0 ? claudeStore(this.env) : opts.trustStore;
|
|
16105
|
-
this.sleep = opts.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
16106
|
-
}
|
|
16107
|
-
/** Why Wheelhouse cannot start or talk to a session here, or null. */
|
|
16108
|
-
unavailable() {
|
|
16109
|
-
if (!TMUX_SOCKET.test(this.tmuxSocket)) {
|
|
16110
|
-
return `The tmux socket name ${JSON.stringify(this.tmuxSocket)} is not valid; use letters, digits, '.', '_' or '-'.`;
|
|
16111
|
-
}
|
|
16112
|
-
if (!this.find("tmux")) {
|
|
16113
|
-
return "tmux is not installed or not on PATH. Install tmux (for example `brew install tmux`) and restart Wheelhouse.";
|
|
16114
|
-
}
|
|
16115
|
-
if (!this.find("claude")) {
|
|
16116
|
-
return "Claude Code (`claude`) is not installed or not on PATH. Install it and restart Wheelhouse.";
|
|
16191
|
+
const OPTION = /^\s*(›\s*)?(\d+)\.\s+(.+)$/;
|
|
16192
|
+
const CONFIRM = /\benter\b.*\b(?:confirm|select|submit|continue)\b/i;
|
|
16193
|
+
function codexScreen(text2) {
|
|
16194
|
+
if (text2 === null) return { kind: "blocked", title: "Codex’s screen could not be read." };
|
|
16195
|
+
const lines = text2.replace(/\r/g, "").trimEnd().split("\n");
|
|
16196
|
+
const cursor = lines.findLastIndex((line) => /^\s*›(?:\s|$)/.test(line));
|
|
16197
|
+
if (cursor < 0) return { kind: "blocked", title: "Codex needs attention in its terminal." };
|
|
16198
|
+
if (OPTION.test(lines[cursor])) {
|
|
16199
|
+
let start = cursor;
|
|
16200
|
+
while (start > 0 && OPTION.test(lines[start - 1])) start--;
|
|
16201
|
+
let end = cursor + 1;
|
|
16202
|
+
while (end < lines.length && OPTION.test(lines[end])) end++;
|
|
16203
|
+
const options = [];
|
|
16204
|
+
for (const line of lines.slice(start, end)) {
|
|
16205
|
+
const m = OPTION.exec(line);
|
|
16206
|
+
if (!m) return { kind: "blocked", title: "Use the terminal to answer Codex." };
|
|
16207
|
+
options.push({
|
|
16208
|
+
n: Number(m[2]),
|
|
16209
|
+
label: m[3],
|
|
16210
|
+
description: "",
|
|
16211
|
+
checked: null,
|
|
16212
|
+
freeText: false
|
|
16213
|
+
});
|
|
16117
16214
|
}
|
|
16118
|
-
if (
|
|
16119
|
-
return
|
|
16215
|
+
if (options.some((option, index) => option.n !== index + 1) || !CONFIRM.test(lines.slice(end).join("\n"))) {
|
|
16216
|
+
return { kind: "blocked", title: "Use the terminal to answer Codex." };
|
|
16120
16217
|
}
|
|
16121
|
-
return null;
|
|
16122
|
-
}
|
|
16123
|
-
opts(extra = {}) {
|
|
16124
|
-
return { env: this.env, timeoutMs: TMUX_TIMEOUT_MS, maxOutputBytes: 256 * 1024, ...extra };
|
|
16125
|
-
}
|
|
16126
|
-
/** Run tmux on Wheelhouse's own server only; nothing reaches tmux any other way. */
|
|
16127
|
-
tmux(args, extra) {
|
|
16128
|
-
const tmux = this.find("tmux");
|
|
16129
|
-
if (!tmux) return Promise.reject(new Error("tmux is missing"));
|
|
16130
|
-
return this.run(tmux, ["-L", this.tmuxSocket, ...args], this.opts(extra));
|
|
16131
|
-
}
|
|
16132
|
-
/** Whether Wheelhouse's `wh-firstmate` session is running; null when tmux cannot say. */
|
|
16133
|
-
async running() {
|
|
16134
|
-
if (!this.find("tmux") || !TMUX_SOCKET.test(this.tmuxSocket)) return null;
|
|
16135
|
-
const r = await this.tmux(["list-sessions", "-F", "#{session_name}"]);
|
|
16136
|
-
if (r.ok) return r.stdout.split("\n").includes(FIRSTMATE_TMUX);
|
|
16137
|
-
if (r.kind === "exit" && NO_SERVER.test(r.stderr)) return false;
|
|
16138
|
-
return null;
|
|
16139
|
-
}
|
|
16140
|
-
view(state, reason, screen = { picker: null, menu: null, busy: false }) {
|
|
16141
16218
|
return {
|
|
16142
|
-
|
|
16143
|
-
|
|
16144
|
-
|
|
16145
|
-
|
|
16146
|
-
|
|
16147
|
-
|
|
16148
|
-
|
|
16219
|
+
kind: "picker",
|
|
16220
|
+
picker: {
|
|
16221
|
+
title: lines.slice(0, start).join("\n").trim(),
|
|
16222
|
+
tabs: [],
|
|
16223
|
+
options,
|
|
16224
|
+
multiSelect: false,
|
|
16225
|
+
submitMoves: null,
|
|
16226
|
+
navigation: { selected: cursor - start + 1 },
|
|
16227
|
+
// Include the command and every visible option, not only the repeated Yes/No labels.
|
|
16228
|
+
signature: createHash("sha256").update(text2).digest("hex").slice(0, 16)
|
|
16229
|
+
}
|
|
16149
16230
|
};
|
|
16150
16231
|
}
|
|
16151
|
-
|
|
16152
|
-
|
|
16153
|
-
|
|
16154
|
-
|
|
16155
|
-
}
|
|
16156
|
-
/** The menu Claude Code is waiting on in Wheelhouse's session, read off its screen, or null. */
|
|
16157
|
-
async picker() {
|
|
16158
|
-
const text = await this.screen();
|
|
16159
|
-
return text === null ? null : parsePicker(text);
|
|
16160
|
-
}
|
|
16161
|
-
/**
|
|
16162
|
-
* What the screen says: a menu Claude Code waits on (as choices when it has
|
|
16163
|
-
* numbered ones), and whether it is busy (it shows "esc to interrupt" while
|
|
16164
|
-
* working, before anything reaches the transcript).
|
|
16165
|
-
*/
|
|
16166
|
-
async onScreen() {
|
|
16167
|
-
const text = await this.screen().catch(() => null);
|
|
16168
|
-
if (text === null) return { picker: null, menu: null, busy: false };
|
|
16232
|
+
const input = lines[cursor].replace(/^\s*›\s*/, "").trim();
|
|
16233
|
+
if (input && !/^(?:Ask Codex to do anything|Ask for changes|Use \/skills to list available skills|Find and fix a bug in @filename|Explain this codebase|Summarize recent commits|Write tests for @filename|Improve documentation in @filename|Implement \{feature\})$/.test(
|
|
16234
|
+
input
|
|
16235
|
+
)) {
|
|
16169
16236
|
return {
|
|
16170
|
-
|
|
16171
|
-
|
|
16172
|
-
busy: /\besc to interrupt\b/i.test(text)
|
|
16237
|
+
kind: "blocked",
|
|
16238
|
+
title: "Codex has unsent input. Send or clear it in the terminal first."
|
|
16173
16239
|
};
|
|
16174
16240
|
}
|
|
16175
|
-
|
|
16176
|
-
|
|
16177
|
-
const reason = this.unavailable();
|
|
16178
|
-
const ours = reason ? null : await this.running();
|
|
16179
|
-
if (ours) return this.view("ours", null, await this.onScreen());
|
|
16180
|
-
const lock = await this.lock();
|
|
16181
|
-
if (lock === "held") {
|
|
16182
|
-
return this.view(
|
|
16183
|
-
"external",
|
|
16184
|
-
"Firstmate is running in another terminal, so Wheelhouse shows its conversation read-only and sends your messages to its inbox. To talk to it here directly, close it there and start it from Wheelhouse."
|
|
16185
|
-
);
|
|
16186
|
-
}
|
|
16187
|
-
if (reason) return this.view("unavailable", reason);
|
|
16188
|
-
if (ours === null)
|
|
16189
|
-
return this.view("unavailable", "Wheelhouse could not ask tmux about the session.");
|
|
16190
|
-
if (this.starting) return this.view("starting", null);
|
|
16191
|
-
return this.view("none", "No Firstmate session is running.");
|
|
16241
|
+
if (cursor < lines.length - 7 || CONFIRM.test(lines.slice(cursor + 1).join("\n"))) {
|
|
16242
|
+
return { kind: "blocked", title: "Codex needs attention in its terminal." };
|
|
16192
16243
|
}
|
|
16193
|
-
|
|
16194
|
-
|
|
16195
|
-
|
|
16196
|
-
|
|
16197
|
-
|
|
16198
|
-
|
|
16199
|
-
|
|
16200
|
-
|
|
16201
|
-
|
|
16202
|
-
|
|
16203
|
-
|
|
16204
|
-
|
|
16205
|
-
|
|
16206
|
-
|
|
16207
|
-
|
|
16208
|
-
|
|
16209
|
-
|
|
16210
|
-
|
|
16211
|
-
|
|
16212
|
-
|
|
16213
|
-
|
|
16214
|
-
|
|
16215
|
-
|
|
16216
|
-
|
|
16217
|
-
|
|
16218
|
-
|
|
16219
|
-
|
|
16220
|
-
|
|
16221
|
-
|
|
16222
|
-
|
|
16223
|
-
|
|
16224
|
-
|
|
16225
|
-
|
|
16226
|
-
|
|
16227
|
-
|
|
16228
|
-
|
|
16229
|
-
|
|
16230
|
-
|
|
16231
|
-
|
|
16232
|
-
|
|
16233
|
-
|
|
16234
|
-
|
|
16235
|
-
|
|
16236
|
-
|
|
16237
|
-
|
|
16238
|
-
|
|
16239
|
-
|
|
16240
|
-
|
|
16241
|
-
|
|
16242
|
-
|
|
16243
|
-
|
|
16244
|
-
|
|
16245
|
-
|
|
16246
|
-
|
|
16247
|
-
|
|
16248
|
-
|
|
16249
|
-
|
|
16250
|
-
|
|
16251
|
-
|
|
16252
|
-
|
|
16253
|
-
|
|
16254
|
-
|
|
16255
|
-
|
|
16256
|
-
|
|
16257
|
-
|
|
16258
|
-
|
|
16259
|
-
|
|
16260
|
-
|
|
16261
|
-
|
|
16262
|
-
|
|
16263
|
-
|
|
16264
|
-
|
|
16265
|
-
|
|
16266
|
-
|
|
16267
|
-
|
|
16268
|
-
|
|
16269
|
-
|
|
16270
|
-
|
|
16271
|
-
|
|
16272
|
-
|
|
16273
|
-
|
|
16274
|
-
|
|
16275
|
-
|
|
16276
|
-
|
|
16277
|
-
|
|
16278
|
-
|
|
16279
|
-
|
|
16280
|
-
|
|
16281
|
-
|
|
16282
|
-
|
|
16283
|
-
|
|
16284
|
-
|
|
16285
|
-
|
|
16286
|
-
|
|
16287
|
-
|
|
16288
|
-
|
|
16244
|
+
return { kind: "prompt", busy: /\besc to interrupt\b/i.test(text2) };
|
|
16245
|
+
}
|
|
16246
|
+
const RECEIPT_BYTES$1 = 64 * 1024;
|
|
16247
|
+
const SESSION_BYTES = 32 * 1024 * 1024;
|
|
16248
|
+
const MAX_RECORDS$1 = 6e3;
|
|
16249
|
+
function piExtensionSource() {
|
|
16250
|
+
return `import { mkdirSync, writeFileSync, renameSync } from 'node:fs';
|
|
16251
|
+
import path from 'node:path';
|
|
16252
|
+
export default function(pi) {
|
|
16253
|
+
const file = process.env.WH_SESSION_RECORD;
|
|
16254
|
+
const nonce = process.env.WH_SESSION_NONCE;
|
|
16255
|
+
if (!file || !nonce) return;
|
|
16256
|
+
let context = null, timer = null, previous = '';
|
|
16257
|
+
const save = () => {
|
|
16258
|
+
if (!context) return;
|
|
16259
|
+
try {
|
|
16260
|
+
const manager = context.sessionManager;
|
|
16261
|
+
const value = JSON.stringify({ wheelhouse_nonce: nonce, session_id: manager.getSessionId(), transcript_path: manager.getSessionFile() ?? null, cwd: context.cwd, leaf_id: manager.getLeafId(), busy: !context.isIdle() });
|
|
16262
|
+
if (value === previous || Buffer.byteLength(value) > 65536) return;
|
|
16263
|
+
mkdirSync(path.dirname(file), { recursive: true });
|
|
16264
|
+
const temp = file + '.tmp.' + process.pid;
|
|
16265
|
+
writeFileSync(temp, value, { mode: 0o600 });
|
|
16266
|
+
renameSync(temp, file);
|
|
16267
|
+
previous = value;
|
|
16268
|
+
} catch { /* Observation must not interrupt Pi's session. */ }
|
|
16269
|
+
};
|
|
16270
|
+
pi.on('session_start', (_event, ctx) => {
|
|
16271
|
+
context = ctx;
|
|
16272
|
+
save();
|
|
16273
|
+
if (timer) clearInterval(timer);
|
|
16274
|
+
// message_end fires before persistence; observe the manager after it has appended the entry.
|
|
16275
|
+
timer = setInterval(save, 250);
|
|
16276
|
+
timer.unref?.();
|
|
16277
|
+
});
|
|
16278
|
+
for (const event of ['session_tree', 'session_compact', 'agent_end']) {
|
|
16279
|
+
pi.on(event, (_event, ctx) => { context = ctx; save(); });
|
|
16280
|
+
}
|
|
16281
|
+
pi.on('session_shutdown', () => { context = null; if (timer) clearInterval(timer); timer = null; });
|
|
16282
|
+
}
|
|
16283
|
+
`;
|
|
16284
|
+
}
|
|
16285
|
+
function object$2(value) {
|
|
16286
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
16287
|
+
}
|
|
16288
|
+
async function readBounded(file, limit) {
|
|
16289
|
+
const handle = await open(file, "r");
|
|
16290
|
+
try {
|
|
16291
|
+
const size = (await handle.stat()).size;
|
|
16292
|
+
if (size > limit) return null;
|
|
16293
|
+
const buffer = Buffer.alloc(size);
|
|
16294
|
+
let offset = 0;
|
|
16295
|
+
while (offset < size) {
|
|
16296
|
+
const { bytesRead } = await handle.read(buffer, offset, size - offset, offset);
|
|
16297
|
+
if (!bytesRead) break;
|
|
16298
|
+
offset += bytesRead;
|
|
16299
|
+
}
|
|
16300
|
+
return buffer.subarray(0, offset).toString("utf8");
|
|
16301
|
+
} finally {
|
|
16302
|
+
await handle.close();
|
|
16303
|
+
}
|
|
16304
|
+
}
|
|
16305
|
+
function contentText(content) {
|
|
16306
|
+
if (typeof content === "string") return content;
|
|
16307
|
+
if (!Array.isArray(content)) return "";
|
|
16308
|
+
return content.flatMap((part) => {
|
|
16309
|
+
const block = object$2(part);
|
|
16310
|
+
if (block?.type === "text" && typeof block.text === "string") return [block.text];
|
|
16311
|
+
return block?.type === "image" ? ["[image]"] : [];
|
|
16312
|
+
}).join("\n");
|
|
16313
|
+
}
|
|
16314
|
+
function normalize(entry, sessionId) {
|
|
16315
|
+
if (entry.type !== "message" || typeof entry.id !== "string" || typeof entry.timestamp !== "string")
|
|
16316
|
+
return [];
|
|
16317
|
+
const message2 = object$2(entry.message);
|
|
16318
|
+
if (!message2 || !Number.isFinite(Date.parse(entry.timestamp))) return [];
|
|
16319
|
+
const uuid = `pi:${sessionId}:${entry.id}`;
|
|
16320
|
+
const timestamp2 = entry.timestamp;
|
|
16321
|
+
if (message2.role === "user") {
|
|
16322
|
+
const content2 = contentText(message2.content);
|
|
16323
|
+
return content2.trim() ? [{ type: "user", uuid, timestamp: timestamp2, message: { role: "user", content: content2 } }] : [];
|
|
16324
|
+
}
|
|
16325
|
+
if (message2.role === "toolResult" && typeof message2.toolCallId === "string") {
|
|
16326
|
+
return [
|
|
16327
|
+
{
|
|
16328
|
+
type: "user",
|
|
16329
|
+
uuid,
|
|
16330
|
+
timestamp: timestamp2,
|
|
16331
|
+
message: {
|
|
16332
|
+
role: "user",
|
|
16333
|
+
content: [
|
|
16334
|
+
{
|
|
16335
|
+
type: "tool_result",
|
|
16336
|
+
tool_use_id: `pi:${sessionId}:${message2.toolCallId}`,
|
|
16337
|
+
content: contentText(message2.content),
|
|
16338
|
+
is_error: message2.isError === true
|
|
16339
|
+
}
|
|
16340
|
+
]
|
|
16341
|
+
}
|
|
16289
16342
|
}
|
|
16290
|
-
|
|
16291
|
-
if (refused) return refused;
|
|
16292
|
-
const shown = await this.onScreen();
|
|
16293
|
-
if (shown.picker || shown.menu) return { ok: false, status: 409, error: MENU_OPEN };
|
|
16294
|
-
const load2 = await this.tmux(["load-buffer", "-b", BUFFER, "-"], {
|
|
16295
|
-
input: body,
|
|
16296
|
-
maxInputBytes: INPUT_MAX_BYTES + 1024
|
|
16297
|
-
});
|
|
16298
|
-
if (!load2.ok)
|
|
16299
|
-
return {
|
|
16300
|
-
ok: false,
|
|
16301
|
-
status: 500,
|
|
16302
|
-
error: `tmux could not take the message: ${load2.stderr.trim() || load2.message}`
|
|
16303
|
-
};
|
|
16304
|
-
const paste = await this.tmux([
|
|
16305
|
-
"paste-buffer",
|
|
16306
|
-
"-d",
|
|
16307
|
-
"-p",
|
|
16308
|
-
"-b",
|
|
16309
|
-
BUFFER,
|
|
16310
|
-
"-t",
|
|
16311
|
-
`=${FIRSTMATE_TMUX}:`
|
|
16312
|
-
]);
|
|
16313
|
-
if (!paste.ok)
|
|
16314
|
-
return {
|
|
16315
|
-
ok: false,
|
|
16316
|
-
status: 500,
|
|
16317
|
-
error: `tmux could not paste the message: ${paste.stderr.trim() || paste.message}`
|
|
16318
|
-
};
|
|
16319
|
-
await this.sleep(PASTE_SETTLE_MS);
|
|
16320
|
-
return this.keys(["Enter"]);
|
|
16321
|
-
});
|
|
16322
|
-
}
|
|
16323
|
-
/** Press Escape: Claude Code stops what it is doing. */
|
|
16324
|
-
interrupt() {
|
|
16325
|
-
return this.serial(async () => await this.ours() ?? this.keys(["Escape"]));
|
|
16343
|
+
];
|
|
16326
16344
|
}
|
|
16327
|
-
|
|
16328
|
-
|
|
16329
|
-
|
|
16330
|
-
|
|
16331
|
-
|
|
16332
|
-
|
|
16333
|
-
|
|
16334
|
-
|
|
16335
|
-
|
|
16336
|
-
|
|
16337
|
-
|
|
16338
|
-
|
|
16339
|
-
|
|
16340
|
-
|
|
16341
|
-
|
|
16342
|
-
|
|
16345
|
+
if (message2.role !== "assistant" || !Array.isArray(message2.content)) return [];
|
|
16346
|
+
const names = {
|
|
16347
|
+
bash: "Bash",
|
|
16348
|
+
read: "Read",
|
|
16349
|
+
edit: "Edit",
|
|
16350
|
+
write: "Write",
|
|
16351
|
+
grep: "Grep",
|
|
16352
|
+
find: "Glob",
|
|
16353
|
+
ls: "Glob"
|
|
16354
|
+
};
|
|
16355
|
+
const content = message2.content.flatMap((part) => {
|
|
16356
|
+
const block = object$2(part);
|
|
16357
|
+
if (!block) return [];
|
|
16358
|
+
if (block.type === "text" && typeof block.text === "string")
|
|
16359
|
+
return [{ type: "text", text: block.text }];
|
|
16360
|
+
if (block.type === "thinking") return [{ type: "thinking", thinking: "", signature: "" }];
|
|
16361
|
+
if (block.type !== "toolCall" || typeof block.id !== "string" || typeof block.name !== "string")
|
|
16362
|
+
return [];
|
|
16363
|
+
const input = object$2(block.arguments);
|
|
16364
|
+
if (!input) return [];
|
|
16365
|
+
return [
|
|
16366
|
+
{
|
|
16367
|
+
type: "tool_use",
|
|
16368
|
+
id: `pi:${sessionId}:${block.id}`,
|
|
16369
|
+
name: names[block.name] ?? block.name,
|
|
16370
|
+
input: { ...input, ...typeof input.path === "string" ? { file_path: input.path } : {} }
|
|
16343
16371
|
}
|
|
16344
|
-
|
|
16345
|
-
|
|
16346
|
-
|
|
16372
|
+
];
|
|
16373
|
+
});
|
|
16374
|
+
if (message2.stopReason === "error" && typeof message2.errorMessage === "string")
|
|
16375
|
+
content.push({ type: "text", text: message2.errorMessage });
|
|
16376
|
+
const records2 = content.length ? [{ type: "assistant", uuid, timestamp: timestamp2, message: { id: uuid, role: "assistant", content } }] : [];
|
|
16377
|
+
if (message2.stopReason === "aborted")
|
|
16378
|
+
records2.push({
|
|
16379
|
+
type: "user",
|
|
16380
|
+
uuid: `${uuid}:interrupted`,
|
|
16381
|
+
timestamp: timestamp2,
|
|
16382
|
+
message: { role: "user", content: "[Request interrupted by user]" }
|
|
16347
16383
|
});
|
|
16348
|
-
|
|
16349
|
-
|
|
16350
|
-
|
|
16351
|
-
|
|
16352
|
-
|
|
16353
|
-
|
|
16354
|
-
|
|
16355
|
-
* Firstmate's own question or permission prompt, which has no heading of
|
|
16356
|
-
* Claude Code's, is the captain's to answer and is never closed.
|
|
16357
|
-
*/
|
|
16358
|
-
dismiss() {
|
|
16359
|
-
return this.serial(async () => {
|
|
16360
|
-
const refused = await this.ours();
|
|
16361
|
-
if (refused) return refused;
|
|
16362
|
-
let text = await this.screen().catch(() => null);
|
|
16363
|
-
for (let i = 0; i < DISMISS_MAX; i++) {
|
|
16364
|
-
const menu = text === null ? null : parseMenu(text);
|
|
16365
|
-
if (!menu) return { ok: true };
|
|
16366
|
-
if (!menu.title && parsePicker(text)) {
|
|
16367
|
-
if (i > 0) return { ok: true };
|
|
16368
|
-
return {
|
|
16369
|
-
ok: false,
|
|
16370
|
-
status: 409,
|
|
16371
|
-
error: "Firstmate is asking you something now; answer it in the chat."
|
|
16372
|
-
};
|
|
16373
|
-
}
|
|
16374
|
-
const r = await this.keys(["Escape"]);
|
|
16375
|
-
if (!r.ok) return r;
|
|
16376
|
-
const before = menuPart(text);
|
|
16377
|
-
for (let w = 0; w < MENU_REDRAW_WAITS && menuPart(text) === before; w++) {
|
|
16378
|
-
await this.sleep(MENU_SETTLE_MS);
|
|
16379
|
-
text = await this.screen().catch(() => null);
|
|
16380
|
-
}
|
|
16381
|
-
if (menuPart(text) === before) break;
|
|
16382
|
-
}
|
|
16383
|
-
return {
|
|
16384
|
-
ok: false,
|
|
16385
|
-
status: 409,
|
|
16386
|
-
error: "The menu is still open after pressing Escape; close it in Firstmate’s terminal."
|
|
16387
|
-
};
|
|
16384
|
+
if (["stop", "length", "error", "aborted"].includes(String(message2.stopReason)))
|
|
16385
|
+
records2.push({
|
|
16386
|
+
type: "system",
|
|
16387
|
+
subtype: "turn_duration",
|
|
16388
|
+
uuid: `${uuid}:done`,
|
|
16389
|
+
timestamp: timestamp2,
|
|
16390
|
+
durationMs: null
|
|
16388
16391
|
});
|
|
16389
|
-
|
|
16390
|
-
|
|
16391
|
-
|
|
16392
|
-
|
|
16393
|
-
|
|
16394
|
-
|
|
16392
|
+
return records2;
|
|
16393
|
+
}
|
|
16394
|
+
async function piSnapshot(opts) {
|
|
16395
|
+
if (!opts.sessionNonce?.trim()) return null;
|
|
16396
|
+
try {
|
|
16397
|
+
const receiptText = await readBounded(opts.hookFile, RECEIPT_BYTES$1);
|
|
16398
|
+
const receipt = receiptText === null ? null : object$2(JSON.parse(receiptText));
|
|
16399
|
+
if (!receipt || receipt.wheelhouse_nonce !== opts.sessionNonce || typeof receipt.session_id !== "string" || !receipt.session_id || typeof receipt.transcript_path !== "string" || !path.isAbsolute(receipt.transcript_path) || typeof receipt.cwd !== "string" || !path.isAbsolute(receipt.cwd) || !(receipt.leaf_id === null || typeof receipt.leaf_id === "string"))
|
|
16400
|
+
return null;
|
|
16401
|
+
const sessionId = receipt.session_id;
|
|
16402
|
+
const [cwd, receiptCwd, root, file] = await Promise.all([
|
|
16403
|
+
realpath(opts.firstmateDir),
|
|
16404
|
+
realpath(receipt.cwd),
|
|
16405
|
+
realpath(path.join(opts.agentDir, "sessions")),
|
|
16406
|
+
realpath(receipt.transcript_path)
|
|
16407
|
+
]);
|
|
16408
|
+
const relative = path.relative(root, file);
|
|
16409
|
+
if (cwd !== receiptCwd || !relative || relative.startsWith("..") || path.isAbsolute(relative))
|
|
16410
|
+
return null;
|
|
16411
|
+
const text2 = await readBounded(file, SESSION_BYTES);
|
|
16412
|
+
if (text2 === null) return null;
|
|
16413
|
+
const lines = text2.split("\n");
|
|
16414
|
+
lines.pop();
|
|
16415
|
+
const header = object$2(JSON.parse(lines.shift() ?? "null"));
|
|
16416
|
+
if (!header || header.type !== "session" || header.version !== 3 || header.id !== receipt.session_id || typeof header.cwd !== "string" || await realpath(header.cwd) !== cwd)
|
|
16417
|
+
return null;
|
|
16418
|
+
const entries = /* @__PURE__ */ new Map();
|
|
16419
|
+
for (const line of lines) {
|
|
16420
|
+
if (!line.trim()) continue;
|
|
16421
|
+
const entry = object$2(JSON.parse(line));
|
|
16422
|
+
if (!entry || typeof entry.id !== "string" || !(entry.parentId === null || typeof entry.parentId === "string") || entries.has(entry.id))
|
|
16423
|
+
return null;
|
|
16424
|
+
entries.set(entry.id, entry);
|
|
16395
16425
|
}
|
|
16396
|
-
const
|
|
16397
|
-
|
|
16398
|
-
|
|
16399
|
-
|
|
16400
|
-
|
|
16401
|
-
|
|
16402
|
-
|
|
16403
|
-
|
|
16404
|
-
|
|
16405
|
-
|
|
16406
|
-
|
|
16426
|
+
const branch = [];
|
|
16427
|
+
const seen = /* @__PURE__ */ new Set();
|
|
16428
|
+
let leaf = receipt.leaf_id;
|
|
16429
|
+
while (leaf !== null) {
|
|
16430
|
+
if (seen.has(leaf)) return null;
|
|
16431
|
+
seen.add(leaf);
|
|
16432
|
+
const entry = entries.get(leaf);
|
|
16433
|
+
if (!entry) return null;
|
|
16434
|
+
branch.push(entry);
|
|
16435
|
+
leaf = typeof entry.parentId === "string" ? entry.parentId : null;
|
|
16436
|
+
}
|
|
16437
|
+
const records2 = branch.reverse().flatMap((entry) => normalize(entry, sessionId));
|
|
16438
|
+
return {
|
|
16439
|
+
source: { how: "hook", file, truncated: records2.length > MAX_RECORDS$1 },
|
|
16440
|
+
records: records2.slice(-MAX_RECORDS$1)
|
|
16407
16441
|
};
|
|
16408
|
-
|
|
16409
|
-
|
|
16442
|
+
} catch {
|
|
16443
|
+
return null;
|
|
16444
|
+
}
|
|
16410
16445
|
}
|
|
16411
|
-
|
|
16446
|
+
function piScreen(text2) {
|
|
16447
|
+
const blocked = { kind: "blocked", title: "Pi needs attention in its terminal." };
|
|
16448
|
+
if (text2 === null) return blocked;
|
|
16449
|
+
const lines = text2.replace(/\r/g, "").trimEnd().split("\n");
|
|
16450
|
+
const rule = /^\s*─{12,}\s*$/;
|
|
16451
|
+
const bottom = lines.findLastIndex((line) => rule.test(line));
|
|
16452
|
+
if (bottom < 2 || bottom < lines.length - 5 || bottom >= lines.length - 1) return blocked;
|
|
16453
|
+
const footer = lines.slice(bottom + 1);
|
|
16454
|
+
if (!/^\s*(?:\/|~(?:\/|$))/.test(footer[0]) || footer.some((line) => /\b(?:select|confirm|cancel)\b/i.test(line)))
|
|
16455
|
+
return blocked;
|
|
16456
|
+
let top = bottom - 1;
|
|
16457
|
+
while (top >= Math.max(0, bottom - 12) && !rule.test(lines[top]) && !/^── .*\bWorking\b.*─{8,}\s*$/.test(lines[top]))
|
|
16458
|
+
top--;
|
|
16459
|
+
if (top < 0 || top < bottom - 12) return blocked;
|
|
16460
|
+
if (lines.slice(top + 1, bottom).some((line) => line.trim()))
|
|
16461
|
+
return {
|
|
16462
|
+
kind: "blocked",
|
|
16463
|
+
title: "Pi has unsent input or a dialog. Send or clear it in the terminal first."
|
|
16464
|
+
};
|
|
16465
|
+
return { kind: "prompt", busy: /\bWorking\b/.test(lines[top]) };
|
|
16466
|
+
}
|
|
16467
|
+
const UUID$1 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
16412
16468
|
const INITIAL_BYTES = 8 * 1024 * 1024;
|
|
16413
16469
|
const MAX_RECORDS = 6e3;
|
|
16414
16470
|
const MAX_RESULT_CHARS = 16e3;
|
|
@@ -16438,7 +16494,7 @@ async function real(p) {
|
|
|
16438
16494
|
async function lockSessionId(homeDir) {
|
|
16439
16495
|
try {
|
|
16440
16496
|
const id = (await readFile(path.join(homeDir, "state", ".lock-session"), "utf8")).split("\n")[0].trim();
|
|
16441
|
-
return UUID.test(id) ? id : null;
|
|
16497
|
+
return UUID$1.test(id) ? id : null;
|
|
16442
16498
|
} catch {
|
|
16443
16499
|
return null;
|
|
16444
16500
|
}
|
|
@@ -16547,7 +16603,7 @@ async function newestCached(o, dir) {
|
|
|
16547
16603
|
const KEEP_TYPES = /* @__PURE__ */ new Set(["user", "assistant", "system", "attachment", "ai-title"]);
|
|
16548
16604
|
const KEEP_ATTACHMENTS = /* @__PURE__ */ new Set(["queued_command", "hook_additional_context"]);
|
|
16549
16605
|
const KEEP_SYSTEM = /* @__PURE__ */ new Set(["turn_duration", "away_summary", "local_command"]);
|
|
16550
|
-
const cut = (s) => s.length > MAX_RESULT_CHARS ? `${s.slice(0, MAX_RESULT_CHARS)}
|
|
16606
|
+
const cut$1 = (s) => s.length > MAX_RESULT_CHARS ? `${s.slice(0, MAX_RESULT_CHARS)}
|
|
16551
16607
|
… (${s.length - MAX_RESULT_CHARS} more characters in the terminal)` : s;
|
|
16552
16608
|
function slim(r) {
|
|
16553
16609
|
if (!r || typeof r !== "object" || !KEEP_TYPES.has(r.type)) return null;
|
|
@@ -16580,8 +16636,8 @@ function slim(r) {
|
|
|
16580
16636
|
if (Array.isArray(content)) {
|
|
16581
16637
|
content = content.map((b) => {
|
|
16582
16638
|
if (b?.type !== "tool_result") return b;
|
|
16583
|
-
const c = typeof b.content === "string" ? cut(b.content) : Array.isArray(b.content) ? b.content.map(
|
|
16584
|
-
(x) => x?.type === "text" ? { ...x, text: cut(String(x.text ?? "")) } : x?.type === "image" ? { type: "image" } : x
|
|
16639
|
+
const c = typeof b.content === "string" ? cut$1(b.content) : Array.isArray(b.content) ? b.content.map(
|
|
16640
|
+
(x) => x?.type === "text" ? { ...x, text: cut$1(String(x.text ?? "")) } : x?.type === "image" ? { type: "image" } : x
|
|
16585
16641
|
) : b.content;
|
|
16586
16642
|
return { ...b, content: c };
|
|
16587
16643
|
});
|
|
@@ -16590,7 +16646,7 @@ function slim(r) {
|
|
|
16590
16646
|
}
|
|
16591
16647
|
return out;
|
|
16592
16648
|
}
|
|
16593
|
-
function toolContent(content) {
|
|
16649
|
+
function toolContent$1(content) {
|
|
16594
16650
|
const blocks = typeof content === "string" ? [{ type: "text", text: content }] : Array.isArray(content) ? content.filter((b) => b?.type === "text").map((b) => ({ type: "text", text: String(b.text ?? "") })) : [];
|
|
16595
16651
|
const bytes = blocks.reduce((n, b) => n + Buffer.byteLength(b.text), 0);
|
|
16596
16652
|
return bytes > MAX_TOOL_RESULT_BYTES ? null : blocks;
|
|
@@ -16646,11 +16702,44 @@ class ChatFeed {
|
|
|
16646
16702
|
}
|
|
16647
16703
|
async step() {
|
|
16648
16704
|
const session = await this.opts.status();
|
|
16649
|
-
if (
|
|
16650
|
-
|
|
16651
|
-
|
|
16705
|
+
if (this.opts.snapshot && (session.harness === "opencode" || session.harness === "pi")) {
|
|
16706
|
+
let snapshot;
|
|
16707
|
+
try {
|
|
16708
|
+
snapshot = await this.opts.snapshot(session);
|
|
16709
|
+
} catch (error) {
|
|
16710
|
+
this.publishSession({
|
|
16711
|
+
...session,
|
|
16712
|
+
canSend: false,
|
|
16713
|
+
reason: error instanceof Error ? error.message : "The conversation could not be read."
|
|
16714
|
+
});
|
|
16715
|
+
return;
|
|
16716
|
+
}
|
|
16717
|
+
this.publishSession(session);
|
|
16718
|
+
this.watcher?.close();
|
|
16719
|
+
this.watcher = null;
|
|
16720
|
+
const source = snapshot?.source ?? null;
|
|
16721
|
+
const changed = source?.file !== this.source?.file;
|
|
16722
|
+
if (changed) this.emit({ type: "reset", data: source });
|
|
16723
|
+
this.source = source;
|
|
16724
|
+
const records2 = [];
|
|
16725
|
+
this.calls.clear();
|
|
16726
|
+
for (const record of snapshot?.records ?? []) {
|
|
16727
|
+
this.noteToolCalls(record);
|
|
16728
|
+
const compact = slim(record);
|
|
16729
|
+
if (compact) records2.push(compact);
|
|
16730
|
+
}
|
|
16731
|
+
if (records2.length > MAX_RECORDS) {
|
|
16732
|
+
records2.splice(0, records2.length - MAX_RECORDS);
|
|
16733
|
+
if (source) source.truncated = true;
|
|
16734
|
+
}
|
|
16735
|
+
if (changed || JSON.stringify(records2) !== JSON.stringify(this.records)) {
|
|
16736
|
+
this.records = records2;
|
|
16737
|
+
this.emit({ type: "replace", data: records2 });
|
|
16738
|
+
}
|
|
16739
|
+
return;
|
|
16652
16740
|
}
|
|
16653
|
-
|
|
16741
|
+
this.publishSession(session);
|
|
16742
|
+
const found = session.harness && session.harness !== "claude" && !this.opts.decode ? null : await this.opts.locate(session.state, session.harness ?? "claude");
|
|
16654
16743
|
if (found?.file !== this.source?.file) {
|
|
16655
16744
|
this.watcher?.close();
|
|
16656
16745
|
this.watcher = null;
|
|
@@ -16671,98 +16760,1304 @@ class ChatFeed {
|
|
|
16671
16760
|
} catch {
|
|
16672
16761
|
}
|
|
16673
16762
|
}
|
|
16674
|
-
this.emit({ type: "reset", data: this.source });
|
|
16763
|
+
this.emit({ type: "reset", data: this.source });
|
|
16764
|
+
}
|
|
16765
|
+
if (this.source && !this.watcher) {
|
|
16766
|
+
try {
|
|
16767
|
+
this.watcher = watch(this.source.file, () => void this.refresh());
|
|
16768
|
+
this.watcher.on("error", () => {
|
|
16769
|
+
});
|
|
16770
|
+
} catch {
|
|
16771
|
+
}
|
|
16772
|
+
}
|
|
16773
|
+
if (this.source) await this.read(this.source.file);
|
|
16774
|
+
}
|
|
16775
|
+
publishSession(session) {
|
|
16776
|
+
if (JSON.stringify(session) !== JSON.stringify(this.session)) {
|
|
16777
|
+
this.session = session;
|
|
16778
|
+
this.emit({ type: "session", data: session });
|
|
16779
|
+
}
|
|
16780
|
+
}
|
|
16781
|
+
async read(file) {
|
|
16782
|
+
let fh;
|
|
16783
|
+
try {
|
|
16784
|
+
const { size } = await stat(file);
|
|
16785
|
+
if (size < this.offset) {
|
|
16786
|
+
this.records = [];
|
|
16787
|
+
this.calls.clear();
|
|
16788
|
+
this.offset = 0;
|
|
16789
|
+
this.partial = Buffer.alloc(0);
|
|
16790
|
+
this.emit({ type: "reset", data: this.source });
|
|
16791
|
+
}
|
|
16792
|
+
if (size === this.offset) return;
|
|
16793
|
+
fh = await open(file, "r");
|
|
16794
|
+
const buf = Buffer.alloc(size - this.offset);
|
|
16795
|
+
const { bytesRead } = await fh.read(buf, 0, buf.length, this.offset);
|
|
16796
|
+
const startedMidway = this.offset > 0 && this.records.length === 0 && this.partial.length === 0 && this.source?.truncated;
|
|
16797
|
+
this.offset += bytesRead;
|
|
16798
|
+
const chunk = Buffer.concat([this.partial, buf.subarray(0, bytesRead)]);
|
|
16799
|
+
const end = chunk.lastIndexOf(10) + 1;
|
|
16800
|
+
this.partial = chunk.subarray(end);
|
|
16801
|
+
const lines = chunk.subarray(0, end).toString("utf8").split("\n");
|
|
16802
|
+
lines.pop();
|
|
16803
|
+
if (startedMidway) lines.shift();
|
|
16804
|
+
const fresh = [];
|
|
16805
|
+
const seen = new Set(this.records.map((record) => record.uuid));
|
|
16806
|
+
for (const line of lines) {
|
|
16807
|
+
if (!line.trim()) continue;
|
|
16808
|
+
try {
|
|
16809
|
+
const raw = JSON.parse(line);
|
|
16810
|
+
const decoded = this.opts.decode ? this.opts.decode(raw, this.session?.harness ?? "claude") : [raw];
|
|
16811
|
+
for (const record of decoded) {
|
|
16812
|
+
if (this.opts.decode && this.session?.harness !== "claude" && seen.has(record.uuid))
|
|
16813
|
+
continue;
|
|
16814
|
+
this.noteToolCalls(record);
|
|
16815
|
+
const r = slim(record);
|
|
16816
|
+
if (r) {
|
|
16817
|
+
fresh.push(r);
|
|
16818
|
+
seen.add(r.uuid);
|
|
16819
|
+
}
|
|
16820
|
+
}
|
|
16821
|
+
} catch {
|
|
16822
|
+
}
|
|
16823
|
+
}
|
|
16824
|
+
if (!fresh.length) return;
|
|
16825
|
+
this.records.push(...fresh);
|
|
16826
|
+
if (this.records.length > MAX_RECORDS)
|
|
16827
|
+
this.records.splice(0, this.records.length - MAX_RECORDS);
|
|
16828
|
+
this.emit({ type: "records", data: fresh });
|
|
16829
|
+
} catch {
|
|
16830
|
+
} finally {
|
|
16831
|
+
await fh?.close();
|
|
16832
|
+
}
|
|
16833
|
+
}
|
|
16834
|
+
/** Keep the MCP tool calls in a raw record, and the results they get, for the chat's apps. */
|
|
16835
|
+
noteToolCalls(r) {
|
|
16836
|
+
if (!r || typeof r !== "object" || r.isSidechain) return;
|
|
16837
|
+
const content = r.message?.content;
|
|
16838
|
+
if (!Array.isArray(content)) return;
|
|
16839
|
+
for (const b of content) {
|
|
16840
|
+
if (r.type === "assistant" && b?.type === "tool_use" && typeof b.id === "string") {
|
|
16841
|
+
const name2 = String(b.name ?? "");
|
|
16842
|
+
if (!name2.startsWith("mcp__")) continue;
|
|
16843
|
+
const input = b.input && typeof b.input === "object" && !Array.isArray(b.input) ? b.input : {};
|
|
16844
|
+
this.calls.set(b.id, { id: b.id, name: name2, input, result: null });
|
|
16845
|
+
if (this.calls.size > MAX_TOOL_CALLS) {
|
|
16846
|
+
this.calls.delete(this.calls.keys().next().value);
|
|
16847
|
+
}
|
|
16848
|
+
} else if (r.type === "user" && b?.type === "tool_result") {
|
|
16849
|
+
const call2 = this.calls.get(b.tool_use_id);
|
|
16850
|
+
if (!call2) continue;
|
|
16851
|
+
const c = toolContent$1(b.content);
|
|
16852
|
+
call2.result = c ? { content: c, isError: !!b.is_error } : { tooLarge: true };
|
|
16853
|
+
}
|
|
16854
|
+
}
|
|
16855
|
+
}
|
|
16856
|
+
/** An MCP tool call in the transcript, by its `tool_use` id, or null. */
|
|
16857
|
+
toolCall(id) {
|
|
16858
|
+
return this.calls.get(id) ?? null;
|
|
16859
|
+
}
|
|
16860
|
+
/** Records currently held (newest last). */
|
|
16861
|
+
snapshot() {
|
|
16862
|
+
return this.records;
|
|
16863
|
+
}
|
|
16864
|
+
stop() {
|
|
16865
|
+
if (this.timer) clearInterval(this.timer);
|
|
16866
|
+
this.timer = null;
|
|
16867
|
+
this.watcher?.close();
|
|
16868
|
+
this.watcher = null;
|
|
16869
|
+
}
|
|
16870
|
+
}
|
|
16871
|
+
class OpenCodeError extends Error {
|
|
16872
|
+
constructor(message2, status2 = 503) {
|
|
16873
|
+
super(message2);
|
|
16874
|
+
this.status = status2;
|
|
16875
|
+
}
|
|
16876
|
+
status;
|
|
16877
|
+
}
|
|
16878
|
+
const REQUEST_BYTES = 8 * 1024 * 1024;
|
|
16879
|
+
const TIMEOUT_MS$1 = 5e3;
|
|
16880
|
+
const SESSION_ID = /^ses_[A-Za-z0-9_-]{1,120}$/;
|
|
16881
|
+
const REQUEST_ID = /^(?:per|que)_[A-Za-z0-9_-]{1,120}$/;
|
|
16882
|
+
function object$1(value) {
|
|
16883
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
16884
|
+
throw new OpenCodeError("OpenCode returned an invalid object.");
|
|
16885
|
+
return value;
|
|
16886
|
+
}
|
|
16887
|
+
function list(value) {
|
|
16888
|
+
if (!Array.isArray(value)) throw new OpenCodeError("OpenCode returned an invalid list.");
|
|
16889
|
+
return value;
|
|
16890
|
+
}
|
|
16891
|
+
function text(value) {
|
|
16892
|
+
if (typeof value !== "string") throw new OpenCodeError("OpenCode returned invalid text.");
|
|
16893
|
+
return value;
|
|
16894
|
+
}
|
|
16895
|
+
function parseOpenCodeConnection(raw) {
|
|
16896
|
+
const value = object$1(raw);
|
|
16897
|
+
const url = text(value.url);
|
|
16898
|
+
let endpoint;
|
|
16899
|
+
try {
|
|
16900
|
+
endpoint = new URL(url);
|
|
16901
|
+
} catch {
|
|
16902
|
+
throw new OpenCodeError("The OpenCode endpoint must be a loopback HTTP URL.");
|
|
16903
|
+
}
|
|
16904
|
+
if (endpoint.protocol !== "http:" || !["127.0.0.1", "[::1]"].includes(endpoint.hostname) || !endpoint.port || url !== endpoint.origin && url !== `${endpoint.origin}/`)
|
|
16905
|
+
throw new OpenCodeError(
|
|
16906
|
+
"The OpenCode endpoint must use 127.0.0.1 or [::1] and an explicit HTTP port."
|
|
16907
|
+
);
|
|
16908
|
+
const sessionId = text(value.sessionId);
|
|
16909
|
+
if (!SESSION_ID.test(sessionId)) throw new OpenCodeError("The OpenCode session ID is invalid.");
|
|
16910
|
+
const directory = text(value.directory);
|
|
16911
|
+
if (!path.isAbsolute(directory) || directory.includes("\0"))
|
|
16912
|
+
throw new OpenCodeError("The OpenCode directory must be absolute.");
|
|
16913
|
+
const username = text(value.username);
|
|
16914
|
+
const password = text(value.password);
|
|
16915
|
+
if (!username || username.length > 128 || /[:\r\n\0]/.test(username) || !password || password.length > 512 || /[\r\n\0]/.test(password))
|
|
16916
|
+
throw new OpenCodeError("The OpenCode connection needs valid private credentials.");
|
|
16917
|
+
return {
|
|
16918
|
+
url: endpoint.origin,
|
|
16919
|
+
sessionId,
|
|
16920
|
+
username,
|
|
16921
|
+
password,
|
|
16922
|
+
directory: path.resolve(directory)
|
|
16923
|
+
};
|
|
16924
|
+
}
|
|
16925
|
+
async function request(connection, route, body, signal, allowMissing = false) {
|
|
16926
|
+
const conn = parseOpenCodeConnection(connection);
|
|
16927
|
+
const controller = new AbortController();
|
|
16928
|
+
const timeout = setTimeout(() => controller.abort(), TIMEOUT_MS$1);
|
|
16929
|
+
try {
|
|
16930
|
+
const response = await fetch(`${conn.url}${route}`, {
|
|
16931
|
+
method: body === void 0 ? "GET" : "POST",
|
|
16932
|
+
redirect: "error",
|
|
16933
|
+
signal: signal ? AbortSignal.any([signal, controller.signal]) : controller.signal,
|
|
16934
|
+
headers: {
|
|
16935
|
+
authorization: `Basic ${Buffer.from(`${conn.username}:${conn.password}`).toString("base64")}`,
|
|
16936
|
+
...body === void 0 ? {} : { "content-type": "application/json" }
|
|
16937
|
+
},
|
|
16938
|
+
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
16939
|
+
});
|
|
16940
|
+
if (response.status === 404 && allowMissing) {
|
|
16941
|
+
await response.body?.cancel();
|
|
16942
|
+
return null;
|
|
16943
|
+
}
|
|
16944
|
+
if (!response.ok) {
|
|
16945
|
+
await response.body?.cancel();
|
|
16946
|
+
throw new OpenCodeError(
|
|
16947
|
+
`OpenCode returned HTTP ${response.status}.`,
|
|
16948
|
+
response.status === 404 ? 409 : 503
|
|
16949
|
+
);
|
|
16950
|
+
}
|
|
16951
|
+
if (response.status === 204) return null;
|
|
16952
|
+
const reader = response.body?.getReader();
|
|
16953
|
+
if (!reader) throw new OpenCodeError("OpenCode returned an empty response.");
|
|
16954
|
+
const chunks = [];
|
|
16955
|
+
let bytes = 0;
|
|
16956
|
+
while (true) {
|
|
16957
|
+
const part = await reader.read();
|
|
16958
|
+
if (part.done) break;
|
|
16959
|
+
bytes += part.value.length;
|
|
16960
|
+
if (bytes > REQUEST_BYTES) {
|
|
16961
|
+
await reader.cancel();
|
|
16962
|
+
throw new OpenCodeError("The OpenCode response exceeded the size limit.");
|
|
16963
|
+
}
|
|
16964
|
+
chunks.push(part.value);
|
|
16965
|
+
}
|
|
16966
|
+
return JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
|
16967
|
+
} catch (error) {
|
|
16968
|
+
if (error instanceof OpenCodeError) throw error;
|
|
16969
|
+
throw new OpenCodeError(
|
|
16970
|
+
"Could not read OpenCode. Check that its private session server is running."
|
|
16971
|
+
);
|
|
16972
|
+
} finally {
|
|
16973
|
+
clearTimeout(timeout);
|
|
16974
|
+
}
|
|
16975
|
+
}
|
|
16976
|
+
function sessionRoute(conn) {
|
|
16977
|
+
return `/api/session/${encodeURIComponent(conn.sessionId)}`;
|
|
16978
|
+
}
|
|
16979
|
+
function verifySession(raw, conn) {
|
|
16980
|
+
const session = object$1(object$1(raw).data);
|
|
16981
|
+
const location = object$1(session.location);
|
|
16982
|
+
if (session.id !== conn.sessionId || typeof location.directory !== "string" || !path.isAbsolute(location.directory) || path.resolve(location.directory) !== path.resolve(conn.directory))
|
|
16983
|
+
throw new OpenCodeError("The OpenCode session does not match this Firstmate checkout.");
|
|
16984
|
+
}
|
|
16985
|
+
async function boundSession(conn, signal) {
|
|
16986
|
+
verifySession(await request(conn, sessionRoute(conn), void 0, signal), conn);
|
|
16987
|
+
}
|
|
16988
|
+
async function createOpenCodeSession(connection) {
|
|
16989
|
+
const conn = parseOpenCodeConnection(connection);
|
|
16990
|
+
const existing = await request(conn, sessionRoute(conn), void 0, void 0, true);
|
|
16991
|
+
if (existing) {
|
|
16992
|
+
verifySession(existing, conn);
|
|
16993
|
+
return;
|
|
16994
|
+
}
|
|
16995
|
+
try {
|
|
16996
|
+
verifySession(
|
|
16997
|
+
await request(conn, "/api/session", {
|
|
16998
|
+
id: conn.sessionId,
|
|
16999
|
+
location: { directory: conn.directory }
|
|
17000
|
+
}),
|
|
17001
|
+
conn
|
|
17002
|
+
);
|
|
17003
|
+
} catch (error) {
|
|
17004
|
+
const created = await request(conn, sessionRoute(conn), void 0, void 0, true);
|
|
17005
|
+
if (!created) throw error;
|
|
17006
|
+
verifySession(created, conn);
|
|
17007
|
+
}
|
|
17008
|
+
}
|
|
17009
|
+
async function selectOpenCodeSession(conn) {
|
|
17010
|
+
await boundSession(conn);
|
|
17011
|
+
const selected = await request(
|
|
17012
|
+
conn,
|
|
17013
|
+
`/tui/select-session?directory=${encodeURIComponent(conn.directory)}`,
|
|
17014
|
+
{ sessionID: conn.sessionId }
|
|
17015
|
+
);
|
|
17016
|
+
if (selected !== true) throw new OpenCodeError("OpenCode did not select the bound session.");
|
|
17017
|
+
}
|
|
17018
|
+
function timestamp(value) {
|
|
17019
|
+
if (typeof value !== "number" || !Number.isFinite(value) || !Number.isFinite(new Date(value).getTime()))
|
|
17020
|
+
throw new OpenCodeError("OpenCode returned an invalid message timestamp.");
|
|
17021
|
+
return new Date(value).toISOString();
|
|
17022
|
+
}
|
|
17023
|
+
function cut(value) {
|
|
17024
|
+
return value.length > MAX_RESULT_CHARS ? `${value.slice(0, MAX_RESULT_CHARS)}
|
|
17025
|
+
… (more in the terminal)` : value;
|
|
17026
|
+
}
|
|
17027
|
+
function toolContent(value) {
|
|
17028
|
+
if (!Array.isArray(value)) return "";
|
|
17029
|
+
return cut(
|
|
17030
|
+
value.flatMap((raw) => {
|
|
17031
|
+
const part = object$1(raw);
|
|
17032
|
+
return part.type === "text" && typeof part.text === "string" ? [part.text] : [];
|
|
17033
|
+
}).join("\n")
|
|
17034
|
+
);
|
|
17035
|
+
}
|
|
17036
|
+
function messageRecords(raw) {
|
|
17037
|
+
const message2 = object$1(raw);
|
|
17038
|
+
const id = text(message2.id);
|
|
17039
|
+
const time = object$1(message2.time);
|
|
17040
|
+
const at = timestamp(time.created);
|
|
17041
|
+
const base = { uuid: `opencode:${id}`, timestamp: at };
|
|
17042
|
+
if (message2.type === "user" || message2.type === "synthetic") {
|
|
17043
|
+
return [
|
|
17044
|
+
{
|
|
17045
|
+
...base,
|
|
17046
|
+
type: "user",
|
|
17047
|
+
isMeta: message2.type === "synthetic",
|
|
17048
|
+
message: { role: "user", content: text(message2.text) }
|
|
17049
|
+
}
|
|
17050
|
+
];
|
|
17051
|
+
}
|
|
17052
|
+
if (message2.type === "compaction")
|
|
17053
|
+
return [
|
|
17054
|
+
{ ...base, type: "system", subtype: "away_summary", content: cut(text(message2.summary)) }
|
|
17055
|
+
];
|
|
17056
|
+
if (message2.type !== "assistant") return [];
|
|
17057
|
+
const records2 = [];
|
|
17058
|
+
const assistant = (suffix, content) => ({
|
|
17059
|
+
type: "assistant",
|
|
17060
|
+
uuid: `${base.uuid}:${suffix}`,
|
|
17061
|
+
timestamp: at,
|
|
17062
|
+
message: { id: base.uuid, role: "assistant", content }
|
|
17063
|
+
});
|
|
17064
|
+
for (const rawPart of list(message2.content)) {
|
|
17065
|
+
const part = object$1(rawPart);
|
|
17066
|
+
const partId = text(part.id);
|
|
17067
|
+
if (part.type === "text")
|
|
17068
|
+
records2.push(assistant(partId, [{ type: "text", text: text(part.text) }]));
|
|
17069
|
+
else if (part.type === "reasoning")
|
|
17070
|
+
records2.push(assistant(partId, [{ type: "thinking", thinking: cut(text(part.text)) }]));
|
|
17071
|
+
else if (part.type === "tool") {
|
|
17072
|
+
const state = object$1(part.state);
|
|
17073
|
+
const name2 = text(part.name);
|
|
17074
|
+
const names = {
|
|
17075
|
+
bash: "Bash",
|
|
17076
|
+
shell: "Bash",
|
|
17077
|
+
read: "Read",
|
|
17078
|
+
write: "Write",
|
|
17079
|
+
edit: "Edit",
|
|
17080
|
+
glob: "Glob",
|
|
17081
|
+
grep: "Grep"
|
|
17082
|
+
};
|
|
17083
|
+
const toolId = `opencode:${partId}`;
|
|
17084
|
+
const input = typeof state.input === "string" ? { input: cut(state.input) } : object$1(state.input);
|
|
17085
|
+
records2.push(
|
|
17086
|
+
assistant(`${partId}:call`, [
|
|
17087
|
+
{ type: "tool_use", id: toolId, name: names[name2] ?? name2, input }
|
|
17088
|
+
])
|
|
17089
|
+
);
|
|
17090
|
+
if (state.status === "completed" || state.status === "error") {
|
|
17091
|
+
const error = state.error ? object$1(state.error) : null;
|
|
17092
|
+
const result2 = toolContent(state.content) || (typeof error?.message === "string" ? cut(error.message) : "");
|
|
17093
|
+
records2.push({
|
|
17094
|
+
type: "user",
|
|
17095
|
+
uuid: `${base.uuid}:${partId}:result`,
|
|
17096
|
+
timestamp: at,
|
|
17097
|
+
message: {
|
|
17098
|
+
role: "user",
|
|
17099
|
+
content: [
|
|
17100
|
+
{
|
|
17101
|
+
type: "tool_result",
|
|
17102
|
+
tool_use_id: toolId,
|
|
17103
|
+
content: result2,
|
|
17104
|
+
is_error: state.status === "error"
|
|
17105
|
+
}
|
|
17106
|
+
]
|
|
17107
|
+
}
|
|
17108
|
+
});
|
|
17109
|
+
}
|
|
17110
|
+
}
|
|
17111
|
+
}
|
|
17112
|
+
if (message2.error) {
|
|
17113
|
+
const error = object$1(message2.error);
|
|
17114
|
+
records2.push(assistant("error", [{ type: "text", text: cut(text(error.message)) }]));
|
|
17115
|
+
}
|
|
17116
|
+
if (time.completed !== void 0 && (message2.error || message2.finish !== "tool-calls")) {
|
|
17117
|
+
const completed = timestamp(time.completed);
|
|
17118
|
+
records2.push({
|
|
17119
|
+
type: "system",
|
|
17120
|
+
uuid: `${base.uuid}:completed`,
|
|
17121
|
+
timestamp: completed,
|
|
17122
|
+
subtype: "turn_duration",
|
|
17123
|
+
durationMs: Math.max(0, Date.parse(completed) - Date.parse(at))
|
|
17124
|
+
});
|
|
17125
|
+
}
|
|
17126
|
+
return records2;
|
|
17127
|
+
}
|
|
17128
|
+
const histories = /* @__PURE__ */ new Map();
|
|
17129
|
+
async function admissions(conn, signal) {
|
|
17130
|
+
const key = JSON.stringify([conn.url, conn.sessionId, conn.directory]);
|
|
17131
|
+
let history = histories.get(key);
|
|
17132
|
+
if (!history) {
|
|
17133
|
+
history = { sequence: 0, admissions: /* @__PURE__ */ new Map() };
|
|
17134
|
+
histories.set(key, history);
|
|
17135
|
+
if (histories.size > 8) histories.delete(histories.keys().next().value ?? "");
|
|
17136
|
+
}
|
|
17137
|
+
for (let page = 0; page < 24; page++) {
|
|
17138
|
+
const response = object$1(
|
|
17139
|
+
await request(
|
|
17140
|
+
conn,
|
|
17141
|
+
`${sessionRoute(conn)}/history?after=${history.sequence}&limit=100`,
|
|
17142
|
+
void 0,
|
|
17143
|
+
signal
|
|
17144
|
+
)
|
|
17145
|
+
);
|
|
17146
|
+
const rows = list(response.data);
|
|
17147
|
+
let sequence = history.sequence;
|
|
17148
|
+
for (const raw of rows) {
|
|
17149
|
+
const event = object$1(raw);
|
|
17150
|
+
const durable = object$1(event.durable);
|
|
17151
|
+
const data = object$1(event.data);
|
|
17152
|
+
if (durable.aggregateID !== conn.sessionId || data.sessionID !== conn.sessionId || typeof durable.seq !== "number" || !Number.isSafeInteger(durable.seq) || durable.seq <= sequence)
|
|
17153
|
+
throw new OpenCodeError("OpenCode returned history outside the bound session or cursor.");
|
|
17154
|
+
sequence = durable.seq;
|
|
17155
|
+
if (event.type === "session.next.prompt.admitted" || event.type === "session.next.prompted") {
|
|
17156
|
+
const prompt = object$1(data.prompt);
|
|
17157
|
+
const id = text(data.messageID);
|
|
17158
|
+
timestamp(data.timestamp);
|
|
17159
|
+
if (typeof data.timestamp !== "number")
|
|
17160
|
+
throw new OpenCodeError("Invalid OpenCode admission timestamp.");
|
|
17161
|
+
history.admissions.set(id, {
|
|
17162
|
+
id,
|
|
17163
|
+
type: "user",
|
|
17164
|
+
text: text(prompt.text),
|
|
17165
|
+
time: { created: data.timestamp }
|
|
17166
|
+
});
|
|
17167
|
+
if (history.admissions.size > MAX_RECORDS)
|
|
17168
|
+
history.admissions.delete(history.admissions.keys().next().value ?? "");
|
|
17169
|
+
}
|
|
17170
|
+
}
|
|
17171
|
+
history.sequence = Math.max(history.sequence, sequence);
|
|
17172
|
+
if (response.hasMore === false) return [...history.admissions.values()];
|
|
17173
|
+
if (response.hasMore !== true || !rows.length)
|
|
17174
|
+
throw new OpenCodeError("OpenCode returned an invalid history cursor.");
|
|
17175
|
+
}
|
|
17176
|
+
throw new OpenCodeError("OpenCode conversation history is still catching up. Retry shortly.");
|
|
17177
|
+
}
|
|
17178
|
+
async function openCodeSnapshot(connection) {
|
|
17179
|
+
const conn = parseOpenCodeConnection(connection);
|
|
17180
|
+
const signal = AbortSignal.timeout(15e3);
|
|
17181
|
+
await boundSession(conn, signal);
|
|
17182
|
+
const messages = [];
|
|
17183
|
+
let cursor = null;
|
|
17184
|
+
let more = false;
|
|
17185
|
+
const seen = /* @__PURE__ */ new Set();
|
|
17186
|
+
do {
|
|
17187
|
+
const query = cursor ? `cursor=${encodeURIComponent(cursor)}` : "order=desc";
|
|
17188
|
+
const page = object$1(
|
|
17189
|
+
await request(conn, `${sessionRoute(conn)}/message?limit=200&${query}`, void 0, signal)
|
|
17190
|
+
);
|
|
17191
|
+
messages.push(...list(page.data));
|
|
17192
|
+
const next = object$1(page.cursor).next;
|
|
17193
|
+
if (next !== null && typeof next !== "string")
|
|
17194
|
+
throw new OpenCodeError("OpenCode returned an invalid message cursor.");
|
|
17195
|
+
cursor = next;
|
|
17196
|
+
more = cursor !== null;
|
|
17197
|
+
if (cursor && seen.has(cursor)) throw new OpenCodeError("OpenCode repeated a message cursor.");
|
|
17198
|
+
if (cursor) seen.add(cursor);
|
|
17199
|
+
} while (more && messages.length < MAX_RECORDS);
|
|
17200
|
+
messages.reverse();
|
|
17201
|
+
const projected = new Set(messages.map((raw) => text(object$1(raw).id)));
|
|
17202
|
+
const queued = (await admissions(conn, signal)).filter((entry) => !projected.has(entry.id));
|
|
17203
|
+
const combined = [...messages, ...queued].map((raw) => {
|
|
17204
|
+
const value = object$1(raw);
|
|
17205
|
+
const at = Date.parse(timestamp(object$1(value.time).created));
|
|
17206
|
+
return { raw, at };
|
|
17207
|
+
}).sort((a, b) => a.at - b.at);
|
|
17208
|
+
const records2 = combined.flatMap(({ raw }) => messageRecords(raw));
|
|
17209
|
+
return {
|
|
17210
|
+
source: {
|
|
17211
|
+
how: "api",
|
|
17212
|
+
file: `opencode:${conn.url}/${conn.sessionId}`,
|
|
17213
|
+
truncated: more || records2.length > MAX_RECORDS
|
|
17214
|
+
},
|
|
17215
|
+
records: records2.slice(-MAX_RECORDS)
|
|
17216
|
+
};
|
|
17217
|
+
}
|
|
17218
|
+
async function pending(conn) {
|
|
17219
|
+
await boundSession(conn);
|
|
17220
|
+
const [permissions, questions] = await Promise.all([
|
|
17221
|
+
request(conn, `${sessionRoute(conn)}/permission`),
|
|
17222
|
+
request(conn, `${sessionRoute(conn)}/question`)
|
|
17223
|
+
]);
|
|
17224
|
+
const permissionList = list(object$1(permissions).data);
|
|
17225
|
+
const questionList = list(object$1(questions).data);
|
|
17226
|
+
const raw = permissionList[0] ?? questionList[0];
|
|
17227
|
+
if (!raw) return null;
|
|
17228
|
+
const item = object$1(raw);
|
|
17229
|
+
const id = text(item.id);
|
|
17230
|
+
if (!REQUEST_ID.test(id) || item.sessionID !== conn.sessionId)
|
|
17231
|
+
throw new OpenCodeError("OpenCode returned an interaction outside the bound session.");
|
|
17232
|
+
const kind = permissionList.length ? "permission" : "question";
|
|
17233
|
+
const signature = `opencode:${createHash("sha256").update(JSON.stringify([conn.sessionId, kind, item])).digest("hex").slice(0, 32)}`;
|
|
17234
|
+
let title;
|
|
17235
|
+
let options;
|
|
17236
|
+
if (kind === "permission") {
|
|
17237
|
+
title = `Allow ${text(item.action)}?
|
|
17238
|
+
${list(item.resources).map(text).join("\n")}`;
|
|
17239
|
+
options = [
|
|
17240
|
+
{
|
|
17241
|
+
n: 1,
|
|
17242
|
+
label: "Allow once",
|
|
17243
|
+
description: "Allow this request only.",
|
|
17244
|
+
checked: null,
|
|
17245
|
+
freeText: false
|
|
17246
|
+
},
|
|
17247
|
+
{
|
|
17248
|
+
n: 2,
|
|
17249
|
+
label: "Reject",
|
|
17250
|
+
description: "Do not allow this request.",
|
|
17251
|
+
checked: null,
|
|
17252
|
+
freeText: false
|
|
17253
|
+
}
|
|
17254
|
+
];
|
|
17255
|
+
} else {
|
|
17256
|
+
const entries = list(item.questions);
|
|
17257
|
+
if (entries.length !== 1)
|
|
17258
|
+
return { menu: { title: "Answer OpenCode’s questions in its terminal.", canDismiss: false } };
|
|
17259
|
+
const question = object$1(entries[0]);
|
|
17260
|
+
if (question.multiple === true)
|
|
17261
|
+
return {
|
|
17262
|
+
menu: {
|
|
17263
|
+
title: "Answer OpenCode’s multiple-choice question in its terminal.",
|
|
17264
|
+
canDismiss: false
|
|
17265
|
+
}
|
|
17266
|
+
};
|
|
17267
|
+
title = text(question.question);
|
|
17268
|
+
options = list(question.options).map((rawOption, i) => {
|
|
17269
|
+
const option = object$1(rawOption);
|
|
17270
|
+
return {
|
|
17271
|
+
n: i + 1,
|
|
17272
|
+
label: text(option.label),
|
|
17273
|
+
description: text(option.description),
|
|
17274
|
+
checked: null,
|
|
17275
|
+
freeText: false
|
|
17276
|
+
};
|
|
17277
|
+
});
|
|
17278
|
+
if (!options.length || options.length > 20)
|
|
17279
|
+
return {
|
|
17280
|
+
menu: { title: "Answer this OpenCode question in its terminal.", canDismiss: false }
|
|
17281
|
+
};
|
|
17282
|
+
if (question.custom !== false)
|
|
17283
|
+
options.push({
|
|
17284
|
+
n: options.length + 1,
|
|
17285
|
+
label: "Type an answer",
|
|
17286
|
+
description: "",
|
|
17287
|
+
checked: null,
|
|
17288
|
+
freeText: true
|
|
17289
|
+
});
|
|
17290
|
+
}
|
|
17291
|
+
if (title.length > 16e3)
|
|
17292
|
+
return { menu: { title: "Review this OpenCode request in its terminal.", canDismiss: false } };
|
|
17293
|
+
return {
|
|
17294
|
+
id,
|
|
17295
|
+
kind,
|
|
17296
|
+
picker: { title, signature, options, tabs: [], multiSelect: false, submitMoves: null }
|
|
17297
|
+
};
|
|
17298
|
+
}
|
|
17299
|
+
async function openCodeStatus(conn) {
|
|
17300
|
+
const [interaction, active] = await Promise.all([
|
|
17301
|
+
pending(conn),
|
|
17302
|
+
request(conn, "/api/session/active")
|
|
17303
|
+
]);
|
|
17304
|
+
const running2 = object$1(object$1(active).data)[conn.sessionId];
|
|
17305
|
+
if (running2 !== void 0 && object$1(running2).type !== "running")
|
|
17306
|
+
throw new OpenCodeError("OpenCode returned an unknown execution state.");
|
|
17307
|
+
return {
|
|
17308
|
+
picker: interaction && "picker" in interaction ? interaction.picker : null,
|
|
17309
|
+
menu: interaction && "menu" in interaction ? interaction.menu : null,
|
|
17310
|
+
busy: running2 !== void 0
|
|
17311
|
+
};
|
|
17312
|
+
}
|
|
17313
|
+
async function pendingOpenCodePicker(conn) {
|
|
17314
|
+
const interaction = await pending(conn);
|
|
17315
|
+
return interaction && "picker" in interaction ? interaction.picker : null;
|
|
17316
|
+
}
|
|
17317
|
+
async function answerOpenCodePicker(conn, signature, action) {
|
|
17318
|
+
const current = await pending(conn);
|
|
17319
|
+
if (!current || !("picker" in current) || current.picker.signature !== signature)
|
|
17320
|
+
throw new OpenCodeError("That OpenCode choice is no longer waiting for an answer.", 409);
|
|
17321
|
+
if (!("press" in action) || !Number.isInteger(action.press))
|
|
17322
|
+
throw new OpenCodeError("Choose one of the available answers.", 400);
|
|
17323
|
+
const option = current.picker.options.find((entry) => entry.n === action.press);
|
|
17324
|
+
if (!option || option.freeText)
|
|
17325
|
+
throw new OpenCodeError("Choose an available answer, or type in the terminal.", 400);
|
|
17326
|
+
const route = `${sessionRoute(conn)}/${current.kind}/${encodeURIComponent(current.id)}/reply`;
|
|
17327
|
+
await request(
|
|
17328
|
+
conn,
|
|
17329
|
+
route,
|
|
17330
|
+
current.kind === "permission" ? { reply: action.press === 1 ? "once" : "reject" } : { answers: [[option.label]] }
|
|
17331
|
+
);
|
|
17332
|
+
}
|
|
17333
|
+
async function sendOpenCode(conn, text2) {
|
|
17334
|
+
const message2 = text2.replace(/\r\n?/g, "\n").trim();
|
|
17335
|
+
if (!message2 || message2.includes("\0") || Buffer.byteLength(message2) > 64 * 1024)
|
|
17336
|
+
throw new OpenCodeError("The message must be valid text of at most 64 KiB.", 400);
|
|
17337
|
+
if (await pending(conn))
|
|
17338
|
+
throw new OpenCodeError(
|
|
17339
|
+
"Answer OpenCode’s pending request before sending another message.",
|
|
17340
|
+
409
|
|
17341
|
+
);
|
|
17342
|
+
await request(conn, `${sessionRoute(conn)}/prompt`, {
|
|
17343
|
+
id: `msg_${randomUUID().replace(/-/g, "")}`,
|
|
17344
|
+
prompt: { text: message2 },
|
|
17345
|
+
delivery: "steer"
|
|
17346
|
+
});
|
|
17347
|
+
}
|
|
17348
|
+
async function interruptOpenCode(conn) {
|
|
17349
|
+
await boundSession(conn);
|
|
17350
|
+
await request(conn, `${sessionRoute(conn)}/interrupt`, {});
|
|
17351
|
+
}
|
|
17352
|
+
const INPUT_MAX_BYTES = 64 * 1024;
|
|
17353
|
+
const HOOK_RECORD = path.join("firstmate", "session-start.json");
|
|
17354
|
+
const PASTE_SETTLE_MS = 400;
|
|
17355
|
+
const KEY_GAP_MS = 120;
|
|
17356
|
+
const DISMISS_MAX = 5;
|
|
17357
|
+
const MENU_SETTLE_MS = 400;
|
|
17358
|
+
const MENU_REDRAW_WAITS = 5;
|
|
17359
|
+
const menuPart = (text2) => text2?.slice(Math.max(0, text2.lastIndexOf("▔"))) ?? null;
|
|
17360
|
+
const MENU_OPEN = "A Claude Code menu is open in Firstmate’s session, so nothing was typed. Answer or close it, then send again.";
|
|
17361
|
+
function sessionSettings(hookFile, skipPermissions) {
|
|
17362
|
+
const tmp = `${hookFile}.tmp`;
|
|
17363
|
+
const command = `cat > ${shellLine([tmp])} && mv -f ${shellLine([tmp])} ${shellLine([hookFile])}`;
|
|
17364
|
+
const settings = {
|
|
17365
|
+
hooks: { SessionStart: [{ hooks: [{ type: "command", command, timeout: 10 }] }] }
|
|
17366
|
+
};
|
|
17367
|
+
if (skipPermissions) settings.skipDangerousModePermissionPrompt = true;
|
|
17368
|
+
return JSON.stringify(settings);
|
|
17369
|
+
}
|
|
17370
|
+
function claudeArgv(claude, hookFile, skipPermissions) {
|
|
17371
|
+
const argv = [claude];
|
|
17372
|
+
if (skipPermissions) argv.push("--dangerously-skip-permissions");
|
|
17373
|
+
argv.push("--settings", sessionSettings(hookFile, skipPermissions));
|
|
17374
|
+
return argv;
|
|
17375
|
+
}
|
|
17376
|
+
function codexArgv(binary) {
|
|
17377
|
+
const script = `const fs = require('node:fs');
|
|
17378
|
+
let input = '';
|
|
17379
|
+
process.stdin.setEncoding('utf8');
|
|
17380
|
+
process.stdin.on('data', chunk => { input += chunk; if (Buffer.byteLength(input) > 65536) process.exit(1); });
|
|
17381
|
+
process.stdin.on('end', () => {
|
|
17382
|
+
const record = JSON.parse(input);
|
|
17383
|
+
const file = process.env.WH_SESSION_RECORD;
|
|
17384
|
+
if (!file || !process.env.WH_SESSION_NONCE) process.exit(1);
|
|
17385
|
+
fs.writeFileSync(file + '.tmp', JSON.stringify({...record, wheelhouse_nonce: process.env.WH_SESSION_NONCE}), {mode: 0o600});
|
|
17386
|
+
fs.renameSync(file + '.tmp', file);
|
|
17387
|
+
});`;
|
|
17388
|
+
const command = shellLine([process.execPath, "-e", script]);
|
|
17389
|
+
return [
|
|
17390
|
+
binary,
|
|
17391
|
+
"-c",
|
|
17392
|
+
`hooks.SessionStart=[{hooks=[{type="command",command=${JSON.stringify(command)},timeout=10}]}]`
|
|
17393
|
+
];
|
|
17394
|
+
}
|
|
17395
|
+
function launchSpec(options) {
|
|
17396
|
+
const { binary, firstmateDir, hookFile, fmHome } = options;
|
|
17397
|
+
let command;
|
|
17398
|
+
const environment = [`WHEELHOUSE_HARNESS=${options.harness}`];
|
|
17399
|
+
switch (options.harness) {
|
|
17400
|
+
case "claude":
|
|
17401
|
+
command = claudeArgv(binary, hookFile, options.skipPermissions);
|
|
17402
|
+
break;
|
|
17403
|
+
case "codex":
|
|
17404
|
+
environment.push(`WH_SESSION_RECORD=${hookFile}`, `WH_SESSION_NONCE=${options.sessionNonce}`);
|
|
17405
|
+
command = codexArgv(binary);
|
|
17406
|
+
break;
|
|
17407
|
+
case "pi":
|
|
17408
|
+
environment.push(`WH_SESSION_RECORD=${hookFile}`, `WH_SESSION_NONCE=${options.sessionNonce}`);
|
|
17409
|
+
command = [binary, "--extension", options.extensionFile];
|
|
17410
|
+
break;
|
|
17411
|
+
case "opencode":
|
|
17412
|
+
environment.push(`WH_OPENCODE_CONNECTION=${options.connectionFile}`);
|
|
17413
|
+
command = [
|
|
17414
|
+
process.execPath,
|
|
17415
|
+
"-e",
|
|
17416
|
+
`const fs = require('node:fs');
|
|
17417
|
+
const {spawn} = require('node:child_process');
|
|
17418
|
+
const connection = JSON.parse(fs.readFileSync(process.argv[1], 'utf8'));
|
|
17419
|
+
const child = spawn(process.argv[2], ['--hostname', '127.0.0.1', '--port', new URL(connection.url).port], {
|
|
17420
|
+
stdio: 'inherit', env: {...process.env, OPENCODE_SERVER_USERNAME: connection.username, OPENCODE_SERVER_PASSWORD: connection.password}
|
|
17421
|
+
});
|
|
17422
|
+
child.on('error', () => { console.error('OpenCode could not start.'); process.exitCode = 1; });
|
|
17423
|
+
child.on('exit', code => { process.exitCode = code ?? 1; })`,
|
|
17424
|
+
options.connectionFile,
|
|
17425
|
+
binary
|
|
17426
|
+
];
|
|
17427
|
+
break;
|
|
17428
|
+
}
|
|
17429
|
+
if (fmHome) environment.push(`FM_HOME=${fmHome}`);
|
|
17430
|
+
const env = {};
|
|
17431
|
+
for (const value of environment) {
|
|
17432
|
+
const at = value.indexOf("=");
|
|
17433
|
+
env[value.slice(0, at)] = value.slice(at + 1);
|
|
17434
|
+
}
|
|
17435
|
+
return { cwd: firstmateDir, argv: command, env };
|
|
17436
|
+
}
|
|
17437
|
+
class FirstmateSession {
|
|
17438
|
+
harness;
|
|
17439
|
+
activeHarness;
|
|
17440
|
+
nativeRecorder = false;
|
|
17441
|
+
nativeNonce = null;
|
|
17442
|
+
openCode = null;
|
|
17443
|
+
get openCodeConnection() {
|
|
17444
|
+
return this.openCode;
|
|
17445
|
+
}
|
|
17446
|
+
get sessionNonce() {
|
|
17447
|
+
return this.nativeNonce;
|
|
17448
|
+
}
|
|
17449
|
+
firstmateDir;
|
|
17450
|
+
homeDir;
|
|
17451
|
+
hookFile;
|
|
17452
|
+
skipPermissions;
|
|
17453
|
+
backend;
|
|
17454
|
+
stateDir;
|
|
17455
|
+
lock;
|
|
17456
|
+
env;
|
|
17457
|
+
find;
|
|
17458
|
+
trustStore;
|
|
17459
|
+
sleep;
|
|
17460
|
+
starting = null;
|
|
17461
|
+
/** One input at a time, in order, so two messages never interleave in the paste buffer. */
|
|
17462
|
+
queue = Promise.resolve();
|
|
17463
|
+
constructor(opts) {
|
|
17464
|
+
this.harness = opts.harness ?? parseHarness((opts.env ?? process.env).WHEELHOUSE_HARNESS);
|
|
17465
|
+
this.activeHarness = this.harness;
|
|
17466
|
+
this.firstmateDir = path.resolve(opts.firstmateDir);
|
|
17467
|
+
this.homeDir = path.resolve(opts.homeDir);
|
|
17468
|
+
this.stateDir = path.resolve(opts.stateDir);
|
|
17469
|
+
this.hookFile = path.join(this.stateDir, HOOK_RECORD);
|
|
17470
|
+
this.lock = opts.lock;
|
|
17471
|
+
this.skipPermissions = this.harness === "claude" && (opts.skipPermissions ?? true);
|
|
17472
|
+
this.env = sessionEnv(opts.env ?? process.env);
|
|
17473
|
+
this.find = opts.find ?? ((name2) => which(name2, this.env.PATH));
|
|
17474
|
+
this.backend = opts.backend ?? new TmuxBackend({ socket: opts.tmuxSocket, env: this.env, find: this.find, run: opts.run });
|
|
17475
|
+
this.trustStore = opts.trustStore === void 0 ? claudeStore(this.env) : opts.trustStore;
|
|
17476
|
+
this.sleep = opts.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
17477
|
+
}
|
|
17478
|
+
/** Why Wheelhouse cannot start or talk to a session here, or null. */
|
|
17479
|
+
unavailable(requireHarness = true) {
|
|
17480
|
+
const backend = this.backend.unavailable();
|
|
17481
|
+
if (backend) return backend;
|
|
17482
|
+
if (requireHarness && !this.find(this.harness)) {
|
|
17483
|
+
return `${HARNESS_NAMES[this.harness]} (\`${this.harness}\`) is not installed or not on PATH. Install it and restart Wheelhouse.`;
|
|
17484
|
+
}
|
|
17485
|
+
if (isInside(this.stateDir, this.homeDir)) {
|
|
17486
|
+
return `The Wheelhouse state directory ${this.stateDir} is inside the Firstmate home; choose one outside it.`;
|
|
17487
|
+
}
|
|
17488
|
+
return null;
|
|
17489
|
+
}
|
|
17490
|
+
/** The backend could not say whether the session runs. */
|
|
17491
|
+
get cannotAsk() {
|
|
17492
|
+
return `Wheelhouse could not ask ${this.backend.label} about the session.`;
|
|
17493
|
+
}
|
|
17494
|
+
/**
|
|
17495
|
+
* Whether the backend's Firstmate session is running; null when the backend
|
|
17496
|
+
* cannot say. A running session's harness, and the recorder or connection
|
|
17497
|
+
* it was started with, are read back from the variables it was launched with.
|
|
17498
|
+
*/
|
|
17499
|
+
async running() {
|
|
17500
|
+
const running2 = await this.backend.running();
|
|
17501
|
+
if (running2 === false) this.activeHarness = this.harness;
|
|
17502
|
+
if (!running2) return running2;
|
|
17503
|
+
const saved = await this.backend.variable("WHEELHOUSE_HARNESS");
|
|
17504
|
+
if (saved === null) return null;
|
|
17505
|
+
try {
|
|
17506
|
+
this.activeHarness = parseHarness(saved || "claude");
|
|
17507
|
+
} catch {
|
|
17508
|
+
return null;
|
|
17509
|
+
}
|
|
17510
|
+
if (this.activeHarness === "codex" || this.activeHarness === "pi") {
|
|
17511
|
+
this.nativeRecorder = await this.backend.variable("WH_SESSION_RECORD") === this.hookFile;
|
|
17512
|
+
const value = await this.backend.variable("WH_SESSION_NONCE") ?? "";
|
|
17513
|
+
this.nativeNonce = /^[0-9a-f-]{36}$/.test(value) ? value : null;
|
|
17514
|
+
this.nativeRecorder &&= this.nativeNonce !== null;
|
|
17515
|
+
}
|
|
17516
|
+
if (this.activeHarness === "opencode") {
|
|
17517
|
+
this.openCode = null;
|
|
17518
|
+
const file = await this.backend.variable("WH_OPENCODE_CONNECTION") ?? "";
|
|
17519
|
+
try {
|
|
17520
|
+
if (!/^opencode-[0-9a-f-]{36}\.json$/.test(path.basename(file)) || await realpath(path.dirname(file)) !== await realpath(path.dirname(this.hookFile)))
|
|
17521
|
+
throw new Error("Wrong state directory");
|
|
17522
|
+
const connection = parseOpenCodeConnection(JSON.parse(await readFile(file, "utf8")));
|
|
17523
|
+
if (await realpath(connection.directory) !== await realpath(this.firstmateDir))
|
|
17524
|
+
throw new Error("Wrong Firstmate checkout");
|
|
17525
|
+
this.openCode = connection;
|
|
17526
|
+
} catch {
|
|
17527
|
+
}
|
|
17528
|
+
}
|
|
17529
|
+
return true;
|
|
17530
|
+
}
|
|
17531
|
+
view(state, reason, screen = { picker: null, menu: null, busy: false }) {
|
|
17532
|
+
const needsRestart = state === "ours" && (this.activeHarness === "codex" || this.activeHarness === "pi" ? !this.nativeRecorder : this.activeHarness === "opencode" && !this.openCode);
|
|
17533
|
+
return {
|
|
17534
|
+
schema: "wheelhouse-firstmate-session.v1",
|
|
17535
|
+
harness: this.activeHarness,
|
|
17536
|
+
state,
|
|
17537
|
+
reason: needsRestart ? `This ${this.activeHarness} session predates chat integration or belongs to another Wheelhouse state directory. Exit it in the terminal, then start Firstmate here again.` : reason,
|
|
17538
|
+
canSend: state === "ours" && !needsRestart,
|
|
17539
|
+
attach: state === "ours" ? this.backend.attachHint() : null,
|
|
17540
|
+
skipPermissions: this.activeHarness === "claude" && this.skipPermissions,
|
|
17541
|
+
...screen
|
|
17542
|
+
};
|
|
17543
|
+
}
|
|
17544
|
+
/** Wheelhouse's session's screen as text, or null. */
|
|
17545
|
+
screen() {
|
|
17546
|
+
return this.backend.screen();
|
|
17547
|
+
}
|
|
17548
|
+
/** The menu Claude Code is waiting on in Wheelhouse's session, read off its screen, or null. */
|
|
17549
|
+
async picker() {
|
|
17550
|
+
if (this.activeHarness === "opencode")
|
|
17551
|
+
return this.openCode ? pendingOpenCodePicker(this.openCode) : null;
|
|
17552
|
+
const text2 = await this.screen();
|
|
17553
|
+
if (this.activeHarness === "codex") {
|
|
17554
|
+
const shown = codexScreen(text2);
|
|
17555
|
+
return shown.kind === "picker" ? shown.picker : null;
|
|
17556
|
+
}
|
|
17557
|
+
if (this.activeHarness !== "claude") return null;
|
|
17558
|
+
return text2 === null ? null : parsePicker(text2);
|
|
17559
|
+
}
|
|
17560
|
+
/**
|
|
17561
|
+
* What the screen says: a menu Claude Code waits on (as choices when it has
|
|
17562
|
+
* numbered ones), and whether it is busy (it shows "esc to interrupt" while
|
|
17563
|
+
* working, before anything reaches the transcript).
|
|
17564
|
+
*/
|
|
17565
|
+
async onScreen() {
|
|
17566
|
+
if (this.activeHarness === "opencode") {
|
|
17567
|
+
try {
|
|
17568
|
+
if (this.openCode) return await openCodeStatus(this.openCode);
|
|
17569
|
+
} catch {
|
|
17570
|
+
}
|
|
17571
|
+
return {
|
|
17572
|
+
picker: null,
|
|
17573
|
+
menu: {
|
|
17574
|
+
title: "OpenCode’s session API is not ready. Retry shortly or open its terminal.",
|
|
17575
|
+
canDismiss: false
|
|
17576
|
+
},
|
|
17577
|
+
busy: false
|
|
17578
|
+
};
|
|
17579
|
+
}
|
|
17580
|
+
if (this.activeHarness === "codex" || this.activeHarness === "pi") {
|
|
17581
|
+
const text22 = await this.screen().catch(() => null);
|
|
17582
|
+
const shown = this.activeHarness === "codex" ? codexScreen(text22) : piScreen(text22);
|
|
17583
|
+
return {
|
|
17584
|
+
picker: shown.kind === "picker" ? shown.picker : null,
|
|
17585
|
+
menu: shown.kind === "blocked" ? { title: shown.title, canDismiss: false } : null,
|
|
17586
|
+
busy: shown.kind === "prompt" && shown.busy
|
|
17587
|
+
};
|
|
17588
|
+
}
|
|
17589
|
+
if (this.activeHarness !== "claude") return { picker: null, menu: null, busy: false };
|
|
17590
|
+
const text2 = await this.screen().catch(() => null);
|
|
17591
|
+
if (text2 === null) return { picker: null, menu: null, busy: false };
|
|
17592
|
+
return {
|
|
17593
|
+
picker: parsePicker(text2),
|
|
17594
|
+
menu: parseMenu(text2),
|
|
17595
|
+
busy: /\besc to interrupt\b/i.test(text2)
|
|
17596
|
+
};
|
|
17597
|
+
}
|
|
17598
|
+
/** Where the Firstmate session stands, as the page shows it. */
|
|
17599
|
+
async status() {
|
|
17600
|
+
const reason = this.unavailable();
|
|
17601
|
+
const ours = this.unavailable(false) ? null : await this.running();
|
|
17602
|
+
if (ours) return this.view("ours", null, await this.onScreen());
|
|
17603
|
+
const lock = await this.lock();
|
|
17604
|
+
if (lock === "held") {
|
|
17605
|
+
return this.view(
|
|
17606
|
+
"external",
|
|
17607
|
+
"Firstmate is running in another terminal, so Wheelhouse shows its conversation read-only and sends your messages to its inbox. To talk to it here directly, close it there and start it from Wheelhouse."
|
|
17608
|
+
);
|
|
17609
|
+
}
|
|
17610
|
+
if (reason) return this.view("unavailable", reason);
|
|
17611
|
+
if (ours === null) return this.view("unavailable", this.cannotAsk);
|
|
17612
|
+
if (this.starting) return this.view("starting", null);
|
|
17613
|
+
return this.view("none", "No Firstmate session is running.");
|
|
17614
|
+
}
|
|
17615
|
+
/**
|
|
17616
|
+
* Start the Firstmate session unless one is already running here or holds
|
|
17617
|
+
* Firstmate's session lock elsewhere. Safe to call repeatedly.
|
|
17618
|
+
*/
|
|
17619
|
+
ensure() {
|
|
17620
|
+
this.starting ??= this.start().finally(() => this.starting = null);
|
|
17621
|
+
return this.starting;
|
|
17622
|
+
}
|
|
17623
|
+
async start() {
|
|
17624
|
+
const boundary = this.unavailable(false);
|
|
17625
|
+
if (boundary) return this.view("unavailable", boundary);
|
|
17626
|
+
const ours = await this.running();
|
|
17627
|
+
if (ours) return this.view("ours", null);
|
|
17628
|
+
const reason = this.unavailable();
|
|
17629
|
+
if (reason) return this.view("unavailable", reason);
|
|
17630
|
+
if (ours === null) return this.view("unavailable", this.cannotAsk);
|
|
17631
|
+
const lock = await this.lock();
|
|
17632
|
+
if (lock === "held") return this.status();
|
|
17633
|
+
if (lock === "unknown") {
|
|
17634
|
+
return this.view(
|
|
17635
|
+
"unavailable",
|
|
17636
|
+
"Wheelhouse could not read Firstmate's session lock, so it did not start a session (it never risks a second one)."
|
|
17637
|
+
);
|
|
17638
|
+
}
|
|
17639
|
+
const binary = this.find(this.harness);
|
|
17640
|
+
if (!binary) return this.view("unavailable", `${this.harness} is no longer on PATH.`);
|
|
17641
|
+
try {
|
|
17642
|
+
await mkdir(path.dirname(this.hookFile), { recursive: true });
|
|
17643
|
+
} catch (e) {
|
|
17644
|
+
return this.view(
|
|
17645
|
+
"unavailable",
|
|
17646
|
+
`Wheelhouse could not create ${path.dirname(this.hookFile)}: ${e.message}`
|
|
17647
|
+
);
|
|
17648
|
+
}
|
|
17649
|
+
if (this.harness === "claude" && this.trustStore)
|
|
17650
|
+
registerTrust(this.trustStore, this.firstmateDir);
|
|
17651
|
+
const fmHome = this.homeDir !== this.firstmateDir ? this.homeDir : null;
|
|
17652
|
+
const nonce = randomUUID();
|
|
17653
|
+
const common = { binary, firstmateDir: this.firstmateDir, hookFile: this.hookFile, fmHome };
|
|
17654
|
+
let launch;
|
|
17655
|
+
try {
|
|
17656
|
+
switch (this.harness) {
|
|
17657
|
+
case "claude":
|
|
17658
|
+
launch = { ...common, harness: "claude", skipPermissions: this.skipPermissions };
|
|
17659
|
+
break;
|
|
17660
|
+
case "codex":
|
|
17661
|
+
launch = { ...common, harness: "codex", sessionNonce: nonce };
|
|
17662
|
+
break;
|
|
17663
|
+
case "pi": {
|
|
17664
|
+
const extensionFile = path.join(path.dirname(this.hookFile), "pi-extension.mjs");
|
|
17665
|
+
await writeFile(`${extensionFile}.${nonce}.tmp`, piExtensionSource(), { mode: 384 });
|
|
17666
|
+
await rename(`${extensionFile}.${nonce}.tmp`, extensionFile);
|
|
17667
|
+
launch = { ...common, harness: "pi", sessionNonce: nonce, extensionFile };
|
|
17668
|
+
break;
|
|
17669
|
+
}
|
|
17670
|
+
case "opencode": {
|
|
17671
|
+
const port = await new ServicePorts(path.join(this.stateDir, "primary-ports.json")).port(
|
|
17672
|
+
"opencode",
|
|
17673
|
+
null,
|
|
17674
|
+
4096,
|
|
17675
|
+
[],
|
|
17676
|
+
[]
|
|
17677
|
+
);
|
|
17678
|
+
const connection = parseOpenCodeConnection({
|
|
17679
|
+
url: `http://127.0.0.1:${port}`,
|
|
17680
|
+
directory: this.firstmateDir,
|
|
17681
|
+
sessionId: `ses_${nonce.replace(/-/g, "")}`,
|
|
17682
|
+
username: "wheelhouse",
|
|
17683
|
+
password: randomBytes(32).toString("hex")
|
|
17684
|
+
});
|
|
17685
|
+
const connectionFile = path.join(path.dirname(this.hookFile), `opencode-${nonce}.json`);
|
|
17686
|
+
await writeFile(connectionFile, JSON.stringify(connection), { mode: 384, flag: "wx" });
|
|
17687
|
+
this.openCode = connection;
|
|
17688
|
+
launch = { ...common, harness: "opencode", connectionFile };
|
|
17689
|
+
break;
|
|
17690
|
+
}
|
|
17691
|
+
}
|
|
17692
|
+
} catch (error) {
|
|
17693
|
+
return this.view(
|
|
17694
|
+
"unavailable",
|
|
17695
|
+
`Could not prepare ${this.harness}: ${error instanceof Error ? error.message : String(error)}`
|
|
17696
|
+
);
|
|
17697
|
+
}
|
|
17698
|
+
const r = await this.backend.start(launchSpec(launch));
|
|
17699
|
+
if (!r.ok) return this.view("unavailable", r.error);
|
|
17700
|
+
this.activeHarness = this.harness;
|
|
17701
|
+
this.nativeRecorder = this.harness === "codex" || this.harness === "pi";
|
|
17702
|
+
this.nativeNonce = this.nativeRecorder ? nonce : null;
|
|
17703
|
+
if (this.openCode && this.harness === "opencode") {
|
|
17704
|
+
const until = Date.now() + 2e4;
|
|
17705
|
+
let failure2 = "The native TUI is not ready.";
|
|
17706
|
+
while (Date.now() < until) {
|
|
17707
|
+
try {
|
|
17708
|
+
if (!(await this.screen())?.includes("┃"))
|
|
17709
|
+
throw new Error("The native TUI is not ready.");
|
|
17710
|
+
await createOpenCodeSession(this.openCode);
|
|
17711
|
+
await selectOpenCodeSession(this.openCode);
|
|
17712
|
+
return this.view("ours", null);
|
|
17713
|
+
} catch (error) {
|
|
17714
|
+
failure2 = error instanceof Error ? error.message : String(error);
|
|
17715
|
+
}
|
|
17716
|
+
await this.sleep(250);
|
|
17717
|
+
}
|
|
17718
|
+
return this.view(
|
|
17719
|
+
"ours",
|
|
17720
|
+
`OpenCode started but its chat could not be connected: ${failure2} Open its terminal, finish setup, then restart the primary.`
|
|
17721
|
+
);
|
|
16675
17722
|
}
|
|
16676
|
-
|
|
16677
|
-
|
|
16678
|
-
|
|
16679
|
-
|
|
16680
|
-
|
|
16681
|
-
|
|
16682
|
-
|
|
17723
|
+
return this.view("ours", null);
|
|
17724
|
+
}
|
|
17725
|
+
serial(work) {
|
|
17726
|
+
const next = this.queue.then(work, work);
|
|
17727
|
+
this.queue = next.catch(() => {
|
|
17728
|
+
});
|
|
17729
|
+
return next;
|
|
17730
|
+
}
|
|
17731
|
+
async ours() {
|
|
17732
|
+
const reason = this.unavailable(false);
|
|
17733
|
+
if (reason) return { ok: false, status: 503, error: reason };
|
|
17734
|
+
const running2 = await this.running();
|
|
17735
|
+
if (running2 === null) return { ok: false, status: 503, error: this.cannotAsk };
|
|
17736
|
+
if (!running2) {
|
|
17737
|
+
return {
|
|
17738
|
+
ok: false,
|
|
17739
|
+
status: 409,
|
|
17740
|
+
error: "Firstmate is not running in Wheelhouse, so there is nothing here to type into."
|
|
17741
|
+
};
|
|
16683
17742
|
}
|
|
16684
|
-
|
|
17743
|
+
return null;
|
|
16685
17744
|
}
|
|
16686
|
-
async
|
|
16687
|
-
|
|
16688
|
-
|
|
16689
|
-
|
|
16690
|
-
|
|
16691
|
-
|
|
16692
|
-
|
|
16693
|
-
|
|
16694
|
-
|
|
16695
|
-
|
|
16696
|
-
|
|
16697
|
-
|
|
16698
|
-
|
|
16699
|
-
|
|
16700
|
-
|
|
16701
|
-
|
|
16702
|
-
|
|
16703
|
-
|
|
16704
|
-
|
|
16705
|
-
|
|
16706
|
-
|
|
16707
|
-
lines.pop();
|
|
16708
|
-
if (startedMidway) lines.shift();
|
|
16709
|
-
const fresh = [];
|
|
16710
|
-
for (const line of lines) {
|
|
16711
|
-
if (!line.trim()) continue;
|
|
16712
|
-
try {
|
|
16713
|
-
const raw = JSON.parse(line);
|
|
16714
|
-
this.noteToolCalls(raw);
|
|
16715
|
-
const r = slim(raw);
|
|
16716
|
-
if (r) fresh.push(r);
|
|
16717
|
-
} catch {
|
|
16718
|
-
}
|
|
17745
|
+
async keys(keys) {
|
|
17746
|
+
for (const key of keys) {
|
|
17747
|
+
const r = await this.backend.key(key);
|
|
17748
|
+
if (!r.ok) return { ok: false, status: 500, error: r.error };
|
|
17749
|
+
await this.sleep(KEY_GAP_MS);
|
|
17750
|
+
}
|
|
17751
|
+
return { ok: true };
|
|
17752
|
+
}
|
|
17753
|
+
/** Type a message into the session and submit it. */
|
|
17754
|
+
send(text2) {
|
|
17755
|
+
return this.serial(async () => {
|
|
17756
|
+
const body = text2.replace(/\r\n?/g, "\n").trim();
|
|
17757
|
+
if (!body) return { ok: false, status: 400, error: "There is nothing to send." };
|
|
17758
|
+
if (body.includes("\0"))
|
|
17759
|
+
return { ok: false, status: 400, error: "The message is not valid text." };
|
|
17760
|
+
if (Buffer.byteLength(body) > INPUT_MAX_BYTES) {
|
|
17761
|
+
return {
|
|
17762
|
+
ok: false,
|
|
17763
|
+
status: 413,
|
|
17764
|
+
error: `A message is limited to ${INPUT_MAX_BYTES / 1024} KiB.`
|
|
17765
|
+
};
|
|
16719
17766
|
}
|
|
16720
|
-
|
|
16721
|
-
|
|
16722
|
-
if (this.
|
|
16723
|
-
|
|
16724
|
-
|
|
16725
|
-
|
|
16726
|
-
|
|
16727
|
-
|
|
17767
|
+
const refused = await this.ours();
|
|
17768
|
+
if (refused) return refused;
|
|
17769
|
+
if ((this.activeHarness === "codex" || this.activeHarness === "pi") && !this.nativeRecorder)
|
|
17770
|
+
return {
|
|
17771
|
+
ok: false,
|
|
17772
|
+
status: 409,
|
|
17773
|
+
error: `Restart the ${this.activeHarness} session from Wheelhouse to enable its chat recorder.`
|
|
17774
|
+
};
|
|
17775
|
+
if (this.activeHarness === "opencode")
|
|
17776
|
+
return this.openCodeAction((connection) => sendOpenCode(connection, body));
|
|
17777
|
+
const shown = await this.onScreen();
|
|
17778
|
+
if (shown.picker || shown.menu)
|
|
17779
|
+
return {
|
|
17780
|
+
ok: false,
|
|
17781
|
+
status: 409,
|
|
17782
|
+
error: this.activeHarness !== "claude" ? `${this.activeHarness} is waiting for attention. Answer the choice or open its terminal before sending.` : MENU_OPEN
|
|
17783
|
+
};
|
|
17784
|
+
const paste = await this.backend.paste(body);
|
|
17785
|
+
if (!paste.ok) return { ok: false, status: 500, error: paste.error };
|
|
17786
|
+
await this.sleep(PASTE_SETTLE_MS);
|
|
17787
|
+
return this.keys(["Enter"]);
|
|
17788
|
+
});
|
|
17789
|
+
}
|
|
17790
|
+
/** Press Escape: Claude Code stops what it is doing. */
|
|
17791
|
+
interrupt() {
|
|
17792
|
+
return this.serial(async () => {
|
|
17793
|
+
const refused = await this.ours();
|
|
17794
|
+
if (refused) return refused;
|
|
17795
|
+
return this.activeHarness === "opencode" ? this.openCodeAction(interruptOpenCode) : this.keys(["Escape"]);
|
|
17796
|
+
});
|
|
17797
|
+
}
|
|
17798
|
+
async openCodeAction(action) {
|
|
17799
|
+
if (!this.openCode)
|
|
17800
|
+
return {
|
|
17801
|
+
ok: false,
|
|
17802
|
+
status: 409,
|
|
17803
|
+
error: "Restart the OpenCode primary from Wheelhouse to enable chat."
|
|
17804
|
+
};
|
|
17805
|
+
try {
|
|
17806
|
+
await action(this.openCode);
|
|
17807
|
+
return { ok: true };
|
|
17808
|
+
} catch (error) {
|
|
17809
|
+
return {
|
|
17810
|
+
ok: false,
|
|
17811
|
+
status: error instanceof OpenCodeError ? error.status : 503,
|
|
17812
|
+
error: error instanceof Error ? error.message : "OpenCode is unavailable."
|
|
17813
|
+
};
|
|
16728
17814
|
}
|
|
16729
17815
|
}
|
|
16730
|
-
/**
|
|
16731
|
-
|
|
16732
|
-
|
|
16733
|
-
|
|
16734
|
-
|
|
16735
|
-
|
|
16736
|
-
|
|
16737
|
-
|
|
16738
|
-
|
|
16739
|
-
|
|
16740
|
-
this.
|
|
16741
|
-
|
|
16742
|
-
|
|
17816
|
+
/**
|
|
17817
|
+
* Choose in the menu Claude Code is waiting on. `signature` names the menu
|
|
17818
|
+
* the page showed; if the screen now shows another (or none), nothing is
|
|
17819
|
+
* pressed. The keys come from the menu on screen, never from the page.
|
|
17820
|
+
*/
|
|
17821
|
+
pick(signature, action) {
|
|
17822
|
+
return this.serial(async () => {
|
|
17823
|
+
const refused = await this.ours();
|
|
17824
|
+
if (refused) return refused;
|
|
17825
|
+
if (this.activeHarness === "opencode")
|
|
17826
|
+
return this.openCodeAction(
|
|
17827
|
+
(connection) => answerOpenCodePicker(connection, signature, action)
|
|
17828
|
+
);
|
|
17829
|
+
const now = await this.picker().catch(() => null);
|
|
17830
|
+
if (!now || now.signature !== signature) {
|
|
17831
|
+
return {
|
|
17832
|
+
ok: false,
|
|
17833
|
+
status: 409,
|
|
17834
|
+
error: "That choice is no longer on Firstmate’s screen."
|
|
17835
|
+
};
|
|
17836
|
+
}
|
|
17837
|
+
const keys = pickerKeys(now, action);
|
|
17838
|
+
if (!keys) return { ok: false, status: 400, error: "That is not one of the choices." };
|
|
17839
|
+
return this.keys(keys);
|
|
17840
|
+
});
|
|
17841
|
+
}
|
|
17842
|
+
/**
|
|
17843
|
+
* Close the menu one of Claude Code's commands opened (such as /mcp):
|
|
17844
|
+
* Escape, as often as it takes to back out of its nested screens. After each
|
|
17845
|
+
* press the screen is read until the menu has redrawn, and only another menu
|
|
17846
|
+
* gets another press, so Escape never reaches the prompt, where it would stop
|
|
17847
|
+
* Firstmate's work or (pressed twice) open the rewind menu.
|
|
17848
|
+
* Firstmate's own question or permission prompt, which has no heading of
|
|
17849
|
+
* Claude Code's, is the captain's to answer and is never closed.
|
|
17850
|
+
*/
|
|
17851
|
+
dismiss() {
|
|
17852
|
+
return this.serial(async () => {
|
|
17853
|
+
const refused = await this.ours();
|
|
17854
|
+
if (refused) return refused;
|
|
17855
|
+
if (this.activeHarness !== "claude")
|
|
17856
|
+
return {
|
|
17857
|
+
ok: false,
|
|
17858
|
+
status: 409,
|
|
17859
|
+
error: "Use the browser terminal to close this harness’s menus."
|
|
17860
|
+
};
|
|
17861
|
+
let text2 = await this.screen().catch(() => null);
|
|
17862
|
+
for (let i = 0; i < DISMISS_MAX; i++) {
|
|
17863
|
+
const menu = text2 === null ? null : parseMenu(text2);
|
|
17864
|
+
if (!menu) return { ok: true };
|
|
17865
|
+
if (!menu.title && parsePicker(text2)) {
|
|
17866
|
+
if (i > 0) return { ok: true };
|
|
17867
|
+
return {
|
|
17868
|
+
ok: false,
|
|
17869
|
+
status: 409,
|
|
17870
|
+
error: "Firstmate is asking you something now; answer it in the chat."
|
|
17871
|
+
};
|
|
16743
17872
|
}
|
|
16744
|
-
|
|
16745
|
-
|
|
16746
|
-
|
|
16747
|
-
|
|
16748
|
-
|
|
17873
|
+
const r = await this.keys(["Escape"]);
|
|
17874
|
+
if (!r.ok) return r;
|
|
17875
|
+
const before = menuPart(text2);
|
|
17876
|
+
for (let w = 0; w < MENU_REDRAW_WAITS && menuPart(text2) === before; w++) {
|
|
17877
|
+
await this.sleep(MENU_SETTLE_MS);
|
|
17878
|
+
text2 = await this.screen().catch(() => null);
|
|
17879
|
+
}
|
|
17880
|
+
if (menuPart(text2) === before) break;
|
|
16749
17881
|
}
|
|
17882
|
+
return {
|
|
17883
|
+
ok: false,
|
|
17884
|
+
status: 409,
|
|
17885
|
+
error: "The menu is still open after pressing Escape; close it in Firstmate’s terminal."
|
|
17886
|
+
};
|
|
17887
|
+
});
|
|
17888
|
+
}
|
|
17889
|
+
/** What the terminal drawer may attach to: only Wheelhouse's own running session, through its backend. */
|
|
17890
|
+
terminal = async () => {
|
|
17891
|
+
const refused = await this.ours();
|
|
17892
|
+
if (refused && !refused.ok) {
|
|
17893
|
+
return { ok: false, status: refused.status === 409 ? 409 : 503, error: refused.error };
|
|
16750
17894
|
}
|
|
17895
|
+
return { ok: true, target: { ...this.backend.attach(), cwd: this.firstmateDir } };
|
|
17896
|
+
};
|
|
17897
|
+
}
|
|
17898
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
17899
|
+
const RECEIPT_BYTES = 64 * 1024;
|
|
17900
|
+
const META_BYTES = 1024 * 1024;
|
|
17901
|
+
function object(value) {
|
|
17902
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
17903
|
+
}
|
|
17904
|
+
async function readJson(file, limit, firstLine2 = false) {
|
|
17905
|
+
const handle = await open(file, "r");
|
|
17906
|
+
try {
|
|
17907
|
+
const size = (await handle.stat()).size;
|
|
17908
|
+
if (!firstLine2 && size > limit) return null;
|
|
17909
|
+
const buffer = Buffer.alloc(Math.min(size, limit));
|
|
17910
|
+
const { bytesRead } = await handle.read(buffer, 0, buffer.length, 0);
|
|
17911
|
+
const text2 = buffer.subarray(0, bytesRead).toString("utf8");
|
|
17912
|
+
const newline = text2.indexOf("\n");
|
|
17913
|
+
if (firstLine2 && newline < 0) return null;
|
|
17914
|
+
return JSON.parse(firstLine2 ? text2.slice(0, newline) : text2);
|
|
17915
|
+
} finally {
|
|
17916
|
+
await handle.close();
|
|
16751
17917
|
}
|
|
16752
|
-
|
|
16753
|
-
|
|
16754
|
-
|
|
17918
|
+
}
|
|
17919
|
+
async function locateCodexTranscript(opts, state) {
|
|
17920
|
+
if (state !== "ours" || !opts.sessionNonce?.trim()) return null;
|
|
17921
|
+
try {
|
|
17922
|
+
const receipt = object(await readJson(opts.hookFile, RECEIPT_BYTES));
|
|
17923
|
+
if (!receipt || receipt.wheelhouse_nonce !== opts.sessionNonce || typeof receipt.session_id !== "string" || !UUID.test(receipt.session_id) || typeof receipt.transcript_path !== "string" || !path.isAbsolute(receipt.transcript_path) || typeof receipt.cwd !== "string" || !path.isAbsolute(receipt.cwd))
|
|
17924
|
+
return null;
|
|
17925
|
+
const [cwd, receiptCwd, root, file] = await Promise.all([
|
|
17926
|
+
realpath(opts.firstmateDir),
|
|
17927
|
+
realpath(receipt.cwd),
|
|
17928
|
+
realpath(path.join(opts.codexHome, "sessions")),
|
|
17929
|
+
realpath(receipt.transcript_path)
|
|
17930
|
+
]);
|
|
17931
|
+
const relative = path.relative(root, file);
|
|
17932
|
+
if (cwd !== receiptCwd || !relative || relative.startsWith("..") || path.isAbsolute(relative))
|
|
17933
|
+
return null;
|
|
17934
|
+
const record = object(await readJson(file, META_BYTES, true));
|
|
17935
|
+
const meta = object(record?.payload);
|
|
17936
|
+
if (record?.type !== "session_meta" || !meta || meta.id !== receipt.session_id || meta.originator !== "codex-tui" || meta.source !== "cli" && meta.source !== "vscode" || typeof meta.cwd !== "string" || !path.isAbsolute(meta.cwd) || await realpath(meta.cwd) !== cwd)
|
|
17937
|
+
return null;
|
|
17938
|
+
return { how: "hook", file };
|
|
17939
|
+
} catch {
|
|
17940
|
+
return null;
|
|
16755
17941
|
}
|
|
16756
|
-
|
|
16757
|
-
|
|
16758
|
-
|
|
17942
|
+
}
|
|
17943
|
+
function textContent(value) {
|
|
17944
|
+
if (!Array.isArray(value)) return "";
|
|
17945
|
+
return value.flatMap((part) => {
|
|
17946
|
+
const block = object(part);
|
|
17947
|
+
if (!block) return [];
|
|
17948
|
+
if ((block.type === "text" || block.type === "Text") && typeof block.text === "string")
|
|
17949
|
+
return [block.text];
|
|
17950
|
+
if (block.type === "image" || block.type === "localImage") return ["[image]"];
|
|
17951
|
+
return [];
|
|
17952
|
+
}).join("\n");
|
|
17953
|
+
}
|
|
17954
|
+
function mcpResult(value) {
|
|
17955
|
+
if (typeof value === "string") return value;
|
|
17956
|
+
const result2 = object(value);
|
|
17957
|
+
if (!result2) return "";
|
|
17958
|
+
if (Array.isArray(result2.content)) {
|
|
17959
|
+
return result2.content.flatMap((part) => {
|
|
17960
|
+
const block = object(part);
|
|
17961
|
+
return block?.type === "text" && typeof block.text === "string" ? [{ type: "text", text: block.text }] : [];
|
|
17962
|
+
});
|
|
16759
17963
|
}
|
|
16760
|
-
|
|
16761
|
-
|
|
16762
|
-
|
|
16763
|
-
|
|
16764
|
-
|
|
17964
|
+
return typeof result2.message === "string" ? result2.message : "";
|
|
17965
|
+
}
|
|
17966
|
+
function codexRecords(raw) {
|
|
17967
|
+
const record = object(raw);
|
|
17968
|
+
const payload = object(record?.payload);
|
|
17969
|
+
if (record?.type !== "event_msg" || !payload || typeof record.timestamp !== "string" || !Number.isFinite(Date.parse(record.timestamp)))
|
|
17970
|
+
return [];
|
|
17971
|
+
const timestamp2 = record.timestamp;
|
|
17972
|
+
const turnId = typeof payload.turn_id === "string" ? payload.turn_id : null;
|
|
17973
|
+
if (payload.type === "task_complete" && turnId) {
|
|
17974
|
+
return [
|
|
17975
|
+
{
|
|
17976
|
+
type: "system",
|
|
17977
|
+
uuid: `codex:${turnId}:completed`,
|
|
17978
|
+
timestamp: timestamp2,
|
|
17979
|
+
subtype: "turn_duration",
|
|
17980
|
+
durationMs: typeof payload.duration_ms === "number" && Number.isFinite(payload.duration_ms) ? Math.max(0, payload.duration_ms) : null
|
|
17981
|
+
}
|
|
17982
|
+
];
|
|
17983
|
+
}
|
|
17984
|
+
if (payload.type === "turn_aborted" && turnId) {
|
|
17985
|
+
return [
|
|
17986
|
+
{
|
|
17987
|
+
type: "user",
|
|
17988
|
+
uuid: `codex:${turnId}:interrupted`,
|
|
17989
|
+
timestamp: timestamp2,
|
|
17990
|
+
message: { role: "user", content: "[Request interrupted by user]" }
|
|
17991
|
+
}
|
|
17992
|
+
];
|
|
17993
|
+
}
|
|
17994
|
+
if (payload.type !== "item_started" && payload.type !== "item_completed") return [];
|
|
17995
|
+
const completed = payload.type === "item_completed";
|
|
17996
|
+
const item = object(payload.item);
|
|
17997
|
+
if (!item || typeof item.id !== "string" || !item.id || typeof item.type !== "string") return [];
|
|
17998
|
+
const id = `codex:${item.id}`;
|
|
17999
|
+
const assistant = (suffix, content) => ({
|
|
18000
|
+
type: "assistant",
|
|
18001
|
+
uuid: `${id}:${suffix}`,
|
|
18002
|
+
timestamp: timestamp2,
|
|
18003
|
+
message: { id, role: "assistant", content }
|
|
18004
|
+
});
|
|
18005
|
+
if (item.type === "UserMessage" || item.type === "AgentMessage") {
|
|
18006
|
+
if (!completed) return [];
|
|
18007
|
+
const text2 = textContent(item.content);
|
|
18008
|
+
if (!text2.trim()) return [];
|
|
18009
|
+
return item.type === "UserMessage" ? [{ type: "user", uuid: `${id}:user`, timestamp: timestamp2, message: { role: "user", content: text2 } }] : [assistant("text", [{ type: "text", text: text2 }])];
|
|
18010
|
+
}
|
|
18011
|
+
if (item.type === "Reasoning") {
|
|
18012
|
+
return completed ? [assistant("thinking", [{ type: "thinking", thinking: "", signature: "" }])] : [];
|
|
18013
|
+
}
|
|
18014
|
+
let name2;
|
|
18015
|
+
let input;
|
|
18016
|
+
let result2 = "";
|
|
18017
|
+
let isError = item.status === "failed" || item.status === "declined";
|
|
18018
|
+
switch (item.type) {
|
|
18019
|
+
case "CommandExecution":
|
|
18020
|
+
if (typeof item.command !== "string" && !(Array.isArray(item.command) && item.command.every((part) => typeof part === "string")))
|
|
18021
|
+
return [];
|
|
18022
|
+
name2 = "Bash";
|
|
18023
|
+
input = {
|
|
18024
|
+
command: typeof item.command === "string" ? item.command : shellLine(item.command)
|
|
18025
|
+
};
|
|
18026
|
+
result2 = typeof item.aggregated_output === "string" ? item.aggregated_output : "";
|
|
18027
|
+
isError ||= typeof item.exit_code === "number" && item.exit_code !== 0;
|
|
18028
|
+
break;
|
|
18029
|
+
case "McpToolCall": {
|
|
18030
|
+
if (typeof item.server !== "string" || typeof item.tool !== "string") return [];
|
|
18031
|
+
name2 = `mcp__${item.server}__${item.tool}`;
|
|
18032
|
+
input = object(item.arguments) ?? {};
|
|
18033
|
+
result2 = mcpResult(item.result ?? item.error);
|
|
18034
|
+
isError ||= object(item.result)?.isError === true || item.error != null;
|
|
18035
|
+
break;
|
|
18036
|
+
}
|
|
18037
|
+
case "FileChange": {
|
|
18038
|
+
const changes = object(item.changes);
|
|
18039
|
+
if (!changes || !Object.keys(changes).length) return [];
|
|
18040
|
+
name2 = "Edit";
|
|
18041
|
+
input = { file_path: Object.keys(changes).join(", ") };
|
|
18042
|
+
result2 = [item.stdout, item.stderr].filter((value) => typeof value === "string").join("\n");
|
|
18043
|
+
break;
|
|
18044
|
+
}
|
|
18045
|
+
default:
|
|
18046
|
+
return [];
|
|
16765
18047
|
}
|
|
18048
|
+
const start = assistant("call", [{ type: "tool_use", id, name: name2, input }]);
|
|
18049
|
+
return completed ? [
|
|
18050
|
+
start,
|
|
18051
|
+
{
|
|
18052
|
+
type: "user",
|
|
18053
|
+
uuid: `${id}:result`,
|
|
18054
|
+
timestamp: timestamp2,
|
|
18055
|
+
message: {
|
|
18056
|
+
role: "user",
|
|
18057
|
+
content: [{ type: "tool_result", tool_use_id: id, content: result2, is_error: isError }]
|
|
18058
|
+
}
|
|
18059
|
+
}
|
|
18060
|
+
] : [start];
|
|
16766
18061
|
}
|
|
16767
18062
|
const SAFE_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
|
|
16768
18063
|
const MISDIRECTED = "Misdirected request";
|
|
@@ -16877,8 +18172,8 @@ class SeenAddresses {
|
|
|
16877
18172
|
try {
|
|
16878
18173
|
const texts = [];
|
|
16879
18174
|
for (const source of await this.opts.sources()) collect(source, texts, 0);
|
|
16880
|
-
for (const
|
|
16881
|
-
for (const address of loopbackAddresses(
|
|
18175
|
+
for (const text2 of texts) {
|
|
18176
|
+
for (const address of loopbackAddresses(text2)) {
|
|
16882
18177
|
this.seen.delete(address);
|
|
16883
18178
|
this.seen.add(address);
|
|
16884
18179
|
}
|
|
@@ -17295,7 +18590,15 @@ async function create(env, opts = {}) {
|
|
|
17295
18590
|
});
|
|
17296
18591
|
const chat = new ChatFeed({
|
|
17297
18592
|
status: () => firstmate.status(),
|
|
17298
|
-
locate: (state) =>
|
|
18593
|
+
locate: (state, harness) => harness === "codex" ? locateCodexTranscript(
|
|
18594
|
+
{
|
|
18595
|
+
firstmateDir: install.firstmateDir,
|
|
18596
|
+
hookFile: firstmate.hookFile,
|
|
18597
|
+
sessionNonce: firstmate.sessionNonce,
|
|
18598
|
+
codexHome: env.CODEX_HOME || path.join(env.HOME || homedir(), ".codex")
|
|
18599
|
+
},
|
|
18600
|
+
state
|
|
18601
|
+
) : harness === "claude" ? locateTranscript(
|
|
17299
18602
|
{
|
|
17300
18603
|
firstmateDir: install.firstmateDir,
|
|
17301
18604
|
homeDir: install.homeDir,
|
|
@@ -17303,7 +18606,24 @@ async function create(env, opts = {}) {
|
|
|
17303
18606
|
projectsDir: projectsDir(env)
|
|
17304
18607
|
},
|
|
17305
18608
|
state
|
|
17306
|
-
)
|
|
18609
|
+
) : Promise.resolve(null),
|
|
18610
|
+
decode: (raw, harness) => harness === "codex" ? codexRecords(raw) : harness === "claude" && raw !== null && typeof raw === "object" && !Array.isArray(raw) ? [raw] : [],
|
|
18611
|
+
snapshot: async (session) => {
|
|
18612
|
+
if (session.state !== "ours") return null;
|
|
18613
|
+
if (session.harness === "pi")
|
|
18614
|
+
return piSnapshot({
|
|
18615
|
+
firstmateDir: install.firstmateDir,
|
|
18616
|
+
hookFile: firstmate.hookFile,
|
|
18617
|
+
sessionNonce: firstmate.sessionNonce,
|
|
18618
|
+
agentDir: env.PI_CODING_AGENT_DIR || path.join(env.HOME || homedir(), ".pi", "agent")
|
|
18619
|
+
});
|
|
18620
|
+
if (session.harness === "opencode") {
|
|
18621
|
+
if (!firstmate.openCodeConnection)
|
|
18622
|
+
throw new OpenCodeError("Restart the OpenCode primary from Wheelhouse to enable chat.");
|
|
18623
|
+
return openCodeSnapshot(firstmate.openCodeConnection);
|
|
18624
|
+
}
|
|
18625
|
+
return null;
|
|
18626
|
+
}
|
|
17307
18627
|
});
|
|
17308
18628
|
const ownPort = Number(URL.parse(env.WHEELHOUSE_URL ?? "")?.port) || null;
|
|
17309
18629
|
const sandbox = new Sandboxes({
|
|
@@ -17334,7 +18654,11 @@ async function create(env, opts = {}) {
|
|
|
17334
18654
|
const seen = new SeenAddresses({
|
|
17335
18655
|
sources: async () => [collector.getFleet(), await inbox.view(), chat.snapshot()]
|
|
17336
18656
|
});
|
|
17337
|
-
const reservedPorts = () => [
|
|
18657
|
+
const reservedPorts = () => [
|
|
18658
|
+
...ownPort ? [ownPort] : [],
|
|
18659
|
+
...sandbox.ports(),
|
|
18660
|
+
...firstmate.openCodeConnection ? [Number(new URL(firstmate.openCodeConnection.url).port)] : []
|
|
18661
|
+
];
|
|
17338
18662
|
const forwards = new PreviewForwards({ env });
|
|
17339
18663
|
const mateTasks = new MateTasks({
|
|
17340
18664
|
adapter,
|
|
@@ -17780,7 +19104,7 @@ async function startFirstmate(session) {
|
|
|
17780
19104
|
const v = await session.ensure();
|
|
17781
19105
|
if (v.state === "ours") {
|
|
17782
19106
|
console.log(
|
|
17783
|
-
`Firstmate: running in
|
|
19107
|
+
`Firstmate: running in ${session.backend.label} (${v.attach}); talk to it on the home page.${v.harness !== "claude" ? ` Using ${v.harness} in chat.` : v.skipPermissions ? "" : " Started without --dangerously-skip-permissions."}`
|
|
17784
19108
|
);
|
|
17785
19109
|
} else {
|
|
17786
19110
|
console.log(`Firstmate: ${v.reason ?? v.state}`);
|
|
@@ -17969,5 +19293,5 @@ const runtime = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
17969
19293
|
upgradeRuntime
|
|
17970
19294
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
17971
19295
|
|
|
17972
|
-
export { checkCompatibility as $, currentPlugins as A, currentPluginPage as B, watchSettingsError as C, changePluginConfig as D, runBounded as E, which as F, GATEWAY_CHANNELS as G, pluginIconFile as H, INPUT_MAX_BYTES as I, pluginUiFile as J, previewProber as K, LOOPBACK_HOST as L, MAX_CHAT_CALLS as M, MAX_FILE_BYTES$1 as N, PEEK_DEFAULT_LINES as O, PROJECT_ID as P, pluginService as Q, REQUEST_ID as R, refusesSetup as S, findFirstmateDir as T, looksLikeFirstmate as U, SETUP_SUGGESTIONS as V, WATCH_PLUGIN as W, writeRemembered as X, reconnectRuntime as Y, setupWorkDir as Z, setupTerminals as _, sessionToken as a, bundledPluginsDir as a0, currentSlots as a1, GAPS as a2, WORKTREE_GONE as a3, PEEK_MAX_LINES as a4, parseChange as a5, MAX_VALUE_BYTES as a6, currentDecisions as a7, readDoc as a8, currentTime as a9, runtime as aa, currentHostedPreviews as b, currentPullRequestTabs as c, currentAddressRewrites as d, currentInbox as e, currentHeadroom as f, getRuntime as g, currentHealth as h, isMutating as i, currentFleet as j, currentRailInsights as k, loadSlots as l, currentPreviewPorts as m, currentMessages as n, serverInstance as o, unconfiguredHealth as p, currentFileRoots as q, refuseMutation as r, servedOrigin as s, readAsset as t, unconfiguredFleet as u, unavailableFirstmate as v, parseMateTaskId as w, validateSend as x, isReactionId as y, currentGateway as z };
|
|
17973
|
-
//# sourceMappingURL=runtime.js-
|
|
19296
|
+
export { checkCompatibility as $, currentPlugins as A, currentPluginPage as B, watchSettingsError as C, changePluginConfig as D, runBounded as E, which as F, GATEWAY_CHANNELS as G, pluginIconFile as H, INPUT_MAX_BYTES as I, pluginUiFile as J, previewProber as K, LOOPBACK_HOST as L, MAX_CHAT_CALLS as M, MAX_FILE_BYTES$1 as N, PEEK_DEFAULT_LINES as O, PROJECT_ID as P, pluginService as Q, REQUEST_ID$1 as R, refusesSetup as S, findFirstmateDir as T, looksLikeFirstmate as U, SETUP_SUGGESTIONS as V, WATCH_PLUGIN as W, writeRemembered as X, reconnectRuntime as Y, setupWorkDir as Z, setupTerminals as _, sessionToken as a, bundledPluginsDir as a0, currentSlots as a1, GAPS as a2, WORKTREE_GONE as a3, PEEK_MAX_LINES as a4, parseChange as a5, MAX_VALUE_BYTES as a6, currentDecisions as a7, readDoc as a8, currentTime as a9, runtime as aa, currentHostedPreviews as b, currentPullRequestTabs as c, currentAddressRewrites as d, currentInbox as e, currentHeadroom as f, getRuntime as g, currentHealth as h, isMutating as i, currentFleet as j, currentRailInsights as k, loadSlots as l, currentPreviewPorts as m, currentMessages as n, serverInstance as o, unconfiguredHealth as p, currentFileRoots as q, refuseMutation as r, servedOrigin as s, readAsset as t, unconfiguredFleet as u, unavailableFirstmate as v, parseMateTaskId as w, validateSend as x, isReactionId as y, currentGateway as z };
|
|
19297
|
+
//# sourceMappingURL=runtime.js-ja9fpm3a.js.map
|