@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
package/dist/cli.js
CHANGED
|
@@ -4,58 +4,31 @@
|
|
|
4
4
|
import { fork, spawn as spawn4 } from "node:child_process";
|
|
5
5
|
import { existsSync as existsSync3 } from "node:fs";
|
|
6
6
|
import { createServer } from "node:http";
|
|
7
|
-
import
|
|
7
|
+
import path20 from "node:path";
|
|
8
8
|
import { fileURLToPath as fileURLToPath2, pathToFileURL } from "node:url";
|
|
9
9
|
import { Command as Command5, InvalidArgumentError as InvalidArgumentError3 } from "commander";
|
|
10
10
|
|
|
11
11
|
// package.json
|
|
12
|
-
var version = "0.
|
|
13
|
-
|
|
14
|
-
// src/lib/chat/attachments.ts
|
|
15
|
-
var UPLOAD_MAX_BYTES = 25 * 1024 * 1024;
|
|
16
|
-
var UNIT = { B: 1, KB: 1024, MB: 1024 * 1024 };
|
|
12
|
+
var version = "0.12.0";
|
|
17
13
|
|
|
18
|
-
// src/lib/
|
|
19
|
-
var
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (!m) return null;
|
|
26
|
-
const u = URL.parse(v.replace("{port}", "1"));
|
|
27
|
-
return u && u.hostname === m[1].replace("{port}", "1").toLowerCase() ? v : null;
|
|
28
|
-
}
|
|
29
|
-
function workspaceHost(raw) {
|
|
30
|
-
const u = URL.parse(raw?.trim() ?? "");
|
|
31
|
-
if (!u || u.protocol !== "https:" || u.username || u.password || u.port) return null;
|
|
32
|
-
return /^[a-z0-9-]+(?:\.[a-z0-9-]+)+$/i.test(u.hostname) ? u.hostname.toLowerCase() : null;
|
|
33
|
-
}
|
|
34
|
-
function detectHosted(env) {
|
|
35
|
-
const set = env[PREVIEW_URL_ENV]?.trim();
|
|
36
|
-
let problem = null;
|
|
37
|
-
if (set) {
|
|
38
|
-
if (set.toLowerCase() === "off") return { hosted: null, problem: null };
|
|
39
|
-
const pattern = previewPattern(set);
|
|
40
|
-
if (pattern) return { hosted: { pattern, source: "configured" }, problem: null };
|
|
41
|
-
problem = `${PREVIEW_URL_ENV} is not a preview URL pattern (an http(s) URL with {port} once in its host or path, such as https://{port}.example.dev), so it is ignored.`;
|
|
42
|
-
}
|
|
43
|
-
const gitpod = workspaceHost(env.GITPOD_WORKSPACE_URL);
|
|
44
|
-
if (gitpod) return { hosted: { pattern: `https://{port}-${gitpod}`, source: "gitpod" }, problem };
|
|
45
|
-
const name = env.CODESPACE_NAME?.trim().toLowerCase();
|
|
46
|
-
const domain = env.GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN?.trim().toLowerCase();
|
|
47
|
-
if (name && domain && /^[a-z0-9-]+$/.test(name) && /^[a-z0-9-]+(?:\.[a-z0-9-]+)+$/.test(domain)) {
|
|
48
|
-
return {
|
|
49
|
-
hosted: { pattern: `https://${name}-{port}.${domain}`, source: "codespaces" },
|
|
50
|
-
problem
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
return { hosted: null, problem };
|
|
14
|
+
// src/lib/harness.ts
|
|
15
|
+
var HARNESSES = ["claude", "codex", "opencode", "pi"];
|
|
16
|
+
function parseHarness(value = "claude") {
|
|
17
|
+
const harness = HARNESSES.find((name) => name === value);
|
|
18
|
+
if (!harness)
|
|
19
|
+
throw new Error(`Unknown harness ${JSON.stringify(value)}. Choose ${HARNESSES.join(", ")}.`);
|
|
20
|
+
return harness;
|
|
54
21
|
}
|
|
55
22
|
|
|
56
|
-
//
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
23
|
+
// cli/harness.ts
|
|
24
|
+
import { spawnSync } from "node:child_process";
|
|
25
|
+
import { randomBytes } from "node:crypto";
|
|
26
|
+
import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
27
|
+
import path2 from "node:path";
|
|
28
|
+
import { createInterface } from "node:readline/promises";
|
|
29
|
+
|
|
30
|
+
// src/lib/server/sessions/tmux.ts
|
|
31
|
+
import { accessSync, constants, statSync } from "node:fs";
|
|
59
32
|
import path from "node:path";
|
|
60
33
|
|
|
61
34
|
// src/lib/server/firstmate/exec.ts
|
|
@@ -213,7 +186,167 @@ function runBounded(file, args, opts) {
|
|
|
213
186
|
});
|
|
214
187
|
}
|
|
215
188
|
|
|
189
|
+
// src/lib/server/sessions/tmux.ts
|
|
190
|
+
function which(name, envPath) {
|
|
191
|
+
for (const dir of (envPath ?? "").split(path.delimiter)) {
|
|
192
|
+
if (!dir) continue;
|
|
193
|
+
const file = path.join(dir, name);
|
|
194
|
+
try {
|
|
195
|
+
accessSync(file, constants.X_OK);
|
|
196
|
+
if (statSync(file).isFile()) return file;
|
|
197
|
+
} catch {
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
var PASTE_MAX_INPUT_BYTES = 65 * 1024;
|
|
203
|
+
|
|
204
|
+
// cli/harness.ts
|
|
205
|
+
async function savedHarness(file) {
|
|
206
|
+
let text2;
|
|
207
|
+
try {
|
|
208
|
+
text2 = await readFile(file, "utf8");
|
|
209
|
+
} catch (error) {
|
|
210
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") return null;
|
|
211
|
+
throw new Error(`Cannot read ${file}. Check its permissions.`, { cause: error });
|
|
212
|
+
}
|
|
213
|
+
try {
|
|
214
|
+
const value = JSON.parse(text2);
|
|
215
|
+
if (!value || typeof value !== "object" || !("harness" in value) || typeof value.harness !== "string") {
|
|
216
|
+
throw new Error("Expected an object with a harness name.");
|
|
217
|
+
}
|
|
218
|
+
return parseHarness(value.harness);
|
|
219
|
+
} catch (error) {
|
|
220
|
+
throw new Error(
|
|
221
|
+
`Invalid saved tool choice in ${file}. Set --harness to replace it, or edit or remove this file.`,
|
|
222
|
+
{ cause: error }
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
async function saveHarness(file, harness) {
|
|
227
|
+
await mkdir(path2.dirname(file), { recursive: true, mode: 448 });
|
|
228
|
+
const temporary = `${file}.${process.pid}.${randomBytes(8).toString("hex")}.tmp`;
|
|
229
|
+
try {
|
|
230
|
+
await writeFile(temporary, `${JSON.stringify({ harness })}
|
|
231
|
+
`, { flag: "wx", mode: 384 });
|
|
232
|
+
await rename(temporary, file);
|
|
233
|
+
} finally {
|
|
234
|
+
await rm(temporary, { force: true });
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
async function chooseHarness(installed, find, env) {
|
|
238
|
+
const fzf = find("fzf");
|
|
239
|
+
if (fzf) {
|
|
240
|
+
const result = spawnSync(fzf, ["--prompt=Firstmate tool > ", "--height=~10", "--no-multi"], {
|
|
241
|
+
input: `${installed.join("\n")}
|
|
242
|
+
`,
|
|
243
|
+
encoding: "utf8",
|
|
244
|
+
env,
|
|
245
|
+
stdio: ["pipe", "pipe", "inherit"]
|
|
246
|
+
});
|
|
247
|
+
if (result.error) throw result.error;
|
|
248
|
+
if (result.status === 1 || result.status === 130 || result.signal === "SIGINT") return null;
|
|
249
|
+
if (result.status !== 0)
|
|
250
|
+
throw new Error("The tool picker failed. Run again with --harness <name>.");
|
|
251
|
+
return result.stdout.trim() || null;
|
|
252
|
+
}
|
|
253
|
+
const input = createInterface({ input: process.stdin, output: process.stdout });
|
|
254
|
+
const controller = new AbortController();
|
|
255
|
+
input.once("SIGINT", () => controller.abort());
|
|
256
|
+
input.once("close", () => controller.abort());
|
|
257
|
+
try {
|
|
258
|
+
const choices = installed.map((name, index) => `${index + 1}. ${name}`).join("\n");
|
|
259
|
+
const answer = (await input.question(`Choose Firstmate's tool:
|
|
260
|
+
${choices}
|
|
261
|
+
Number (blank to cancel): `, {
|
|
262
|
+
signal: controller.signal
|
|
263
|
+
})).trim();
|
|
264
|
+
if (!answer) return null;
|
|
265
|
+
const choice = /^\d+$/.test(answer) ? installed[Number(answer) - 1] : void 0;
|
|
266
|
+
if (!choice)
|
|
267
|
+
throw new Error(`Choose a number from 1 to ${installed.length}, or use --harness <name>.`);
|
|
268
|
+
return choice;
|
|
269
|
+
} catch (error) {
|
|
270
|
+
if (controller.signal.aborted) return null;
|
|
271
|
+
throw error;
|
|
272
|
+
} finally {
|
|
273
|
+
input.close();
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
async function resolveHarness(options2) {
|
|
277
|
+
const { env } = options2;
|
|
278
|
+
const file = path2.join(options2.configDir, "harness.json");
|
|
279
|
+
const requested = options2.explicit ?? env.WHEELHOUSE_HARNESS;
|
|
280
|
+
if (requested !== void 0) {
|
|
281
|
+
const harness2 = parseHarness(requested);
|
|
282
|
+
await saveHarness(file, harness2);
|
|
283
|
+
return harness2;
|
|
284
|
+
}
|
|
285
|
+
const saved = await savedHarness(file);
|
|
286
|
+
if (saved) return saved;
|
|
287
|
+
const interactive = options2.interactive ?? (process.stdin.isTTY === true && process.stdout.isTTY === true);
|
|
288
|
+
if (!interactive) return "claude";
|
|
289
|
+
const find = options2.find ?? ((name) => which(name, env.PATH));
|
|
290
|
+
const installed = HARNESSES.filter((harness2) => find(harness2));
|
|
291
|
+
if (!installed.length) return "claude";
|
|
292
|
+
const selected = installed.length === 1 ? installed[0] : await (options2.choose ?? ((choices) => chooseHarness(choices, find, env)))(installed);
|
|
293
|
+
if (selected === null)
|
|
294
|
+
throw new Error("Tool selection cancelled. No Firstmate session was started.");
|
|
295
|
+
const harness = installed.find((name) => name === selected);
|
|
296
|
+
if (!harness)
|
|
297
|
+
throw new Error(
|
|
298
|
+
"The selected tool is not installed. Choose an installed tool or use --harness <name>."
|
|
299
|
+
);
|
|
300
|
+
await saveHarness(file, harness);
|
|
301
|
+
return harness;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// src/lib/chat/attachments.ts
|
|
305
|
+
var UPLOAD_MAX_BYTES = 25 * 1024 * 1024;
|
|
306
|
+
var UNIT = { B: 1, KB: 1024, MB: 1024 * 1024 };
|
|
307
|
+
|
|
308
|
+
// src/lib/hosted.ts
|
|
309
|
+
var PREVIEW_URL_ENV = "WHEELHOUSE_PREVIEW_URL";
|
|
310
|
+
function previewPattern(raw) {
|
|
311
|
+
if (typeof raw !== "string") return null;
|
|
312
|
+
const v = raw.trim();
|
|
313
|
+
if (v.length > 300 || v.split("{port}").length !== 2) return null;
|
|
314
|
+
const m = /^https?:\/\/([a-z0-9.-]*(?:\{port\}[a-z0-9.-]*)?)(?::\d{1,5})?(\/[^?#]*)?$/i.exec(v);
|
|
315
|
+
if (!m) return null;
|
|
316
|
+
const u = URL.parse(v.replace("{port}", "1"));
|
|
317
|
+
return u && u.hostname === m[1].replace("{port}", "1").toLowerCase() ? v : null;
|
|
318
|
+
}
|
|
319
|
+
function workspaceHost(raw) {
|
|
320
|
+
const u = URL.parse(raw?.trim() ?? "");
|
|
321
|
+
if (!u || u.protocol !== "https:" || u.username || u.password || u.port) return null;
|
|
322
|
+
return /^[a-z0-9-]+(?:\.[a-z0-9-]+)+$/i.test(u.hostname) ? u.hostname.toLowerCase() : null;
|
|
323
|
+
}
|
|
324
|
+
function detectHosted(env) {
|
|
325
|
+
const set = env[PREVIEW_URL_ENV]?.trim();
|
|
326
|
+
let problem = null;
|
|
327
|
+
if (set) {
|
|
328
|
+
if (set.toLowerCase() === "off") return { hosted: null, problem: null };
|
|
329
|
+
const pattern = previewPattern(set);
|
|
330
|
+
if (pattern) return { hosted: { pattern, source: "configured" }, problem: null };
|
|
331
|
+
problem = `${PREVIEW_URL_ENV} is not a preview URL pattern (an http(s) URL with {port} once in its host or path, such as https://{port}.example.dev), so it is ignored.`;
|
|
332
|
+
}
|
|
333
|
+
const gitpod = workspaceHost(env.GITPOD_WORKSPACE_URL);
|
|
334
|
+
if (gitpod) return { hosted: { pattern: `https://{port}-${gitpod}`, source: "gitpod" }, problem };
|
|
335
|
+
const name = env.CODESPACE_NAME?.trim().toLowerCase();
|
|
336
|
+
const domain = env.GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN?.trim().toLowerCase();
|
|
337
|
+
if (name && domain && /^[a-z0-9-]+$/.test(name) && /^[a-z0-9-]+(?:\.[a-z0-9-]+)+$/.test(domain)) {
|
|
338
|
+
return {
|
|
339
|
+
hosted: { pattern: `https://${name}-{port}.${domain}`, source: "codespaces" },
|
|
340
|
+
problem
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
return { hosted: null, problem };
|
|
344
|
+
}
|
|
345
|
+
|
|
216
346
|
// src/lib/server/firstmate/install.ts
|
|
347
|
+
import { access, constants as constants2, open, stat } from "node:fs/promises";
|
|
348
|
+
import { existsSync, statSync as statSync2 } from "node:fs";
|
|
349
|
+
import path3 from "node:path";
|
|
217
350
|
var MESSAGING_PURPOSE = "messages to Firstmate";
|
|
218
351
|
var SUPPORTED_SCRIPTS = [
|
|
219
352
|
{
|
|
@@ -242,10 +375,10 @@ var SUPPORTED_SCRIPTS = [
|
|
|
242
375
|
purpose: "worker terminal output"
|
|
243
376
|
}
|
|
244
377
|
];
|
|
245
|
-
var scriptPath = (firstmateDir, name) =>
|
|
378
|
+
var scriptPath = (firstmateDir, name) => path3.join(firstmateDir, "bin", name);
|
|
246
379
|
var isDir = (p) => {
|
|
247
380
|
try {
|
|
248
|
-
return
|
|
381
|
+
return statSync2(p).isDirectory();
|
|
249
382
|
} catch {
|
|
250
383
|
return false;
|
|
251
384
|
}
|
|
@@ -254,15 +387,15 @@ function looksLikeFirstmate(dir) {
|
|
|
254
387
|
return existsSync(scriptPath(dir, "fm-fleet-snapshot.sh"));
|
|
255
388
|
}
|
|
256
389
|
function findFirstmateDir(start) {
|
|
257
|
-
let dir =
|
|
390
|
+
let dir = path3.resolve(start);
|
|
258
391
|
for (; ; ) {
|
|
259
392
|
if (looksLikeFirstmate(dir)) return dir;
|
|
260
|
-
const parent =
|
|
393
|
+
const parent = path3.dirname(dir);
|
|
261
394
|
if (parent === dir) return null;
|
|
262
395
|
dir = parent;
|
|
263
396
|
}
|
|
264
397
|
}
|
|
265
|
-
var expandHome = (p, env) => p === "~" || p.startsWith("~/") ?
|
|
398
|
+
var expandHome = (p, env) => p === "~" || p.startsWith("~/") ? path3.join(env.HOME ?? "", p.slice(1)) : p;
|
|
266
399
|
function notFirstmate(dir) {
|
|
267
400
|
if (!isDir(dir)) return `Firstmate directory not found: ${dir}`;
|
|
268
401
|
if (!looksLikeFirstmate(dir)) {
|
|
@@ -275,7 +408,7 @@ function resolveInstall(input) {
|
|
|
275
408
|
let firstmateDir;
|
|
276
409
|
let source;
|
|
277
410
|
if (input.firstmate) {
|
|
278
|
-
firstmateDir =
|
|
411
|
+
firstmateDir = path3.resolve(input.cwd, expandHome(input.firstmate, input.env));
|
|
279
412
|
const wrong = notFirstmate(firstmateDir);
|
|
280
413
|
if (wrong) return { ok: false, error: wrong, missing: false };
|
|
281
414
|
source = "flag";
|
|
@@ -286,7 +419,7 @@ function resolveInstall(input) {
|
|
|
286
419
|
source = "cwd";
|
|
287
420
|
notes.push(`Found Firstmate at ${firstmateDir}`);
|
|
288
421
|
} else if (input.remembered) {
|
|
289
|
-
firstmateDir =
|
|
422
|
+
firstmateDir = path3.resolve(input.remembered.firstmate);
|
|
290
423
|
const wrong = notFirstmate(firstmateDir);
|
|
291
424
|
if (wrong) {
|
|
292
425
|
return {
|
|
@@ -307,12 +440,12 @@ function resolveInstall(input) {
|
|
|
307
440
|
}
|
|
308
441
|
let homeDir;
|
|
309
442
|
if (input.home) {
|
|
310
|
-
homeDir =
|
|
443
|
+
homeDir = path3.resolve(input.cwd, expandHome(input.home, input.env));
|
|
311
444
|
} else if (input.env.FM_HOME) {
|
|
312
|
-
homeDir =
|
|
445
|
+
homeDir = path3.resolve(input.cwd, expandHome(input.env.FM_HOME, input.env));
|
|
313
446
|
notes.push(`Using the operational home from FM_HOME: ${homeDir}`);
|
|
314
447
|
} else if (source === "remembered" && input.remembered?.home) {
|
|
315
|
-
homeDir =
|
|
448
|
+
homeDir = path3.resolve(input.remembered.home);
|
|
316
449
|
} else {
|
|
317
450
|
homeDir = firstmateDir;
|
|
318
451
|
}
|
|
@@ -320,7 +453,7 @@ function resolveInstall(input) {
|
|
|
320
453
|
if (!isDir(homeDir)) {
|
|
321
454
|
return { ok: false, error: `Firstmate home not found: ${homeDir}`, missing: !flagged };
|
|
322
455
|
}
|
|
323
|
-
if (!isDir(
|
|
456
|
+
if (!isDir(path3.join(homeDir, "state"))) {
|
|
324
457
|
return {
|
|
325
458
|
ok: false,
|
|
326
459
|
error: `${homeDir} is not a Firstmate operational home (it has no state/ directory). Pass --home <dir>.`,
|
|
@@ -350,7 +483,7 @@ async function checkScript(firstmateDir, s) {
|
|
|
350
483
|
return { ...base, ok: false, problem: `${s.name} is missing` };
|
|
351
484
|
}
|
|
352
485
|
try {
|
|
353
|
-
await access(file,
|
|
486
|
+
await access(file, constants2.X_OK);
|
|
354
487
|
} catch {
|
|
355
488
|
return { ...base, ok: false, problem: `${s.name} is not executable` };
|
|
356
489
|
}
|
|
@@ -443,13 +576,13 @@ function defaultKeychain() {
|
|
|
443
576
|
}
|
|
444
577
|
|
|
445
578
|
// src/lib/server/plugins/config.ts
|
|
446
|
-
import { mkdir, readFile, rename, stat as stat2, writeFile } from "node:fs/promises";
|
|
579
|
+
import { mkdir as mkdir2, readFile as readFile2, rename as rename2, stat as stat2, writeFile as writeFile2 } from "node:fs/promises";
|
|
447
580
|
import { homedir } from "node:os";
|
|
448
|
-
import
|
|
581
|
+
import path4 from "node:path";
|
|
449
582
|
function defaultConfigDir(env) {
|
|
450
|
-
if (env.WHEELHOUSE_CONFIG_DIR) return
|
|
451
|
-
if (env.XDG_CONFIG_HOME) return
|
|
452
|
-
return
|
|
583
|
+
if (env.WHEELHOUSE_CONFIG_DIR) return path4.resolve(env.WHEELHOUSE_CONFIG_DIR);
|
|
584
|
+
if (env.XDG_CONFIG_HOME) return path4.join(env.XDG_CONFIG_HOME, "wheelhouse");
|
|
585
|
+
return path4.join(homedir(), ".config", "wheelhouse");
|
|
453
586
|
}
|
|
454
587
|
var PLUGINS_FILE = "plugins.json";
|
|
455
588
|
var isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
@@ -499,7 +632,7 @@ function parsePluginConfig(text2) {
|
|
|
499
632
|
async function readRaw(file) {
|
|
500
633
|
let text2;
|
|
501
634
|
try {
|
|
502
|
-
text2 = await
|
|
635
|
+
text2 = await readFile2(file, "utf8");
|
|
503
636
|
} catch (e) {
|
|
504
637
|
if (e.code === "ENOENT") return { ok: true, raw: null };
|
|
505
638
|
return { ok: false, error: `could not read ${file}: ${e.message}` };
|
|
@@ -509,7 +642,7 @@ async function readRaw(file) {
|
|
|
509
642
|
return { ok: true, raw: JSON.parse(text2) };
|
|
510
643
|
}
|
|
511
644
|
async function readPluginSettings(dir, id) {
|
|
512
|
-
const r = await readRaw(
|
|
645
|
+
const r = await readRaw(path4.join(dir, PLUGINS_FILE));
|
|
513
646
|
if (!r.ok) return r;
|
|
514
647
|
const plugins = r.raw?.plugins ?? {};
|
|
515
648
|
return { ok: true, settings: { ...plugins[id]?.settings ?? {} } };
|
|
@@ -517,7 +650,7 @@ async function readPluginSettings(dir, id) {
|
|
|
517
650
|
var editing = Promise.resolve();
|
|
518
651
|
function editPlugin(dir, id, change) {
|
|
519
652
|
const run = editing.then(async () => {
|
|
520
|
-
const file =
|
|
653
|
+
const file = path4.join(dir, PLUGINS_FILE);
|
|
521
654
|
const r = await readRaw(file);
|
|
522
655
|
if (!r.ok) return r;
|
|
523
656
|
const raw = r.raw ?? {};
|
|
@@ -528,11 +661,11 @@ function editPlugin(dir, id, change) {
|
|
|
528
661
|
else delete plugins[id];
|
|
529
662
|
raw.plugins = plugins;
|
|
530
663
|
try {
|
|
531
|
-
await
|
|
664
|
+
await mkdir2(dir, { recursive: true });
|
|
532
665
|
const tmp = `${file}.${process.pid}.tmp`;
|
|
533
|
-
await
|
|
666
|
+
await writeFile2(tmp, `${JSON.stringify(raw, null, " ")}
|
|
534
667
|
`);
|
|
535
|
-
await
|
|
668
|
+
await rename2(tmp, file);
|
|
536
669
|
} catch (e) {
|
|
537
670
|
return { ok: false, error: `could not write ${file}: ${e.message}` };
|
|
538
671
|
}
|
|
@@ -549,23 +682,26 @@ function writePluginSettings(dir, id, settings2) {
|
|
|
549
682
|
}
|
|
550
683
|
|
|
551
684
|
// src/lib/server/cloud/settings.ts
|
|
552
|
-
import { createHash as
|
|
685
|
+
import { createHash as createHash3, randomBytes as randomBytes3 } from "node:crypto";
|
|
553
686
|
import {
|
|
554
687
|
chmod,
|
|
555
688
|
lstat,
|
|
556
|
-
mkdir as
|
|
557
|
-
readFile as
|
|
689
|
+
mkdir as mkdir3,
|
|
690
|
+
readFile as readFile3,
|
|
558
691
|
realpath,
|
|
559
|
-
rename as
|
|
560
|
-
rm,
|
|
692
|
+
rename as rename3,
|
|
693
|
+
rm as rm2,
|
|
561
694
|
stat as stat3,
|
|
562
|
-
writeFile as
|
|
695
|
+
writeFile as writeFile3
|
|
563
696
|
} from "node:fs/promises";
|
|
564
|
-
import
|
|
697
|
+
import path5 from "node:path";
|
|
565
698
|
|
|
566
699
|
// src/lib/cloud.ts
|
|
567
700
|
var DEFAULT_GATEWAY = "https://cloud.chrisjowen.net";
|
|
568
701
|
|
|
702
|
+
// src/lib/server/cloud/passkeys.ts
|
|
703
|
+
import { createHash as createHash2, createPublicKey as createPublicKey2, randomBytes as randomBytes2, verify } from "node:crypto";
|
|
704
|
+
|
|
569
705
|
// src/lib/server/cloud/protocol.ts
|
|
570
706
|
import {
|
|
571
707
|
createHash,
|
|
@@ -574,7 +710,7 @@ import {
|
|
|
574
710
|
generateKeyPairSync,
|
|
575
711
|
sign
|
|
576
712
|
} from "node:crypto";
|
|
577
|
-
var PROTOCOL =
|
|
713
|
+
var PROTOCOL = 2;
|
|
578
714
|
var FRAME_HTTP = 1;
|
|
579
715
|
var FRAME_WS_TEXT = 2;
|
|
580
716
|
var FRAME_WS_BINARY = 3;
|
|
@@ -693,8 +829,8 @@ var HOP_BY_HOP = /* @__PURE__ */ new Set([
|
|
|
693
829
|
"transfer-encoding",
|
|
694
830
|
"upgrade"
|
|
695
831
|
]);
|
|
696
|
-
function isRestartPath(
|
|
697
|
-
let p =
|
|
832
|
+
function isRestartPath(path21) {
|
|
833
|
+
let p = path21.split(/[?#]/, 1)[0];
|
|
698
834
|
for (let i = 0; i < 3; i++) {
|
|
699
835
|
try {
|
|
700
836
|
const d = decodeURIComponent(p);
|
|
@@ -709,11 +845,292 @@ function isRestartPath(path19) {
|
|
|
709
845
|
return [flat, normal].some((s) => s.toLowerCase().startsWith("/api/wheelhouse/restart"));
|
|
710
846
|
}
|
|
711
847
|
|
|
848
|
+
// src/lib/server/cloud/passkeys.ts
|
|
849
|
+
var MAX_PINS = 20;
|
|
850
|
+
var B64U = /^[A-Za-z0-9_-]+$/;
|
|
851
|
+
var isB64u = (v, max) => typeof v === "string" && v.length <= max && B64U.test(v);
|
|
852
|
+
function fits(key, alg) {
|
|
853
|
+
if (alg === -7) {
|
|
854
|
+
return key.asymmetricKeyType === "ec" && key.asymmetricKeyDetails?.namedCurve === "prime256v1";
|
|
855
|
+
}
|
|
856
|
+
if (alg === -8) return key.asymmetricKeyType === "ed25519";
|
|
857
|
+
if (alg === -257) return key.asymmetricKeyType === "rsa";
|
|
858
|
+
return false;
|
|
859
|
+
}
|
|
860
|
+
function publicKeyOf(p) {
|
|
861
|
+
try {
|
|
862
|
+
const key = createPublicKey2({
|
|
863
|
+
key: Buffer.from(p.publicKey, "base64url"),
|
|
864
|
+
format: "der",
|
|
865
|
+
type: "spki"
|
|
866
|
+
});
|
|
867
|
+
return fits(key, p.alg) ? key : null;
|
|
868
|
+
} catch {
|
|
869
|
+
return null;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
function parsePasskeys(v) {
|
|
873
|
+
if (!Array.isArray(v) || v.length < 1 || v.length > MAX_PINS) return null;
|
|
874
|
+
const out = [];
|
|
875
|
+
for (const p of v) {
|
|
876
|
+
if (typeof p !== "object" || p === null) return null;
|
|
877
|
+
const { id, publicKey, alg, name } = p;
|
|
878
|
+
if (!isB64u(id, 1024) || !isB64u(publicKey, 4096) || typeof alg !== "number") return null;
|
|
879
|
+
const pin = { id, publicKey, alg, name: typeof name === "string" ? name.slice(0, 60) : "" };
|
|
880
|
+
if (!publicKeyOf(pin) || out.some((o) => o.id === id)) return null;
|
|
881
|
+
out.push(pin);
|
|
882
|
+
}
|
|
883
|
+
return out;
|
|
884
|
+
}
|
|
885
|
+
var passkeyFingerprint = (p) => fingerprint(p.publicKey);
|
|
886
|
+
var sha256 = (b) => createHash2("sha256").update(b).digest();
|
|
887
|
+
var TAGS = {
|
|
888
|
+
pair: Buffer.from("whc-pair-v2\n", "utf8"),
|
|
889
|
+
session: Buffer.from("whc-session-v2\n", "utf8"),
|
|
890
|
+
pins: Buffer.from("whc-pins-v2\n", "utf8")
|
|
891
|
+
};
|
|
892
|
+
function newChallenge(purpose) {
|
|
893
|
+
return Buffer.concat([TAGS[purpose], randomBytes2(32)]).toString("base64url");
|
|
894
|
+
}
|
|
895
|
+
function assertionProblem(assertion, expected2) {
|
|
896
|
+
if (typeof assertion !== "object" || assertion === null) return "no passkey signature";
|
|
897
|
+
const { id, response: r } = assertion;
|
|
898
|
+
if (typeof id !== "string" || typeof r !== "object" || r === null) {
|
|
899
|
+
return "a malformed passkey signature";
|
|
900
|
+
}
|
|
901
|
+
const passkey = expected2.passkeys.find((p) => p.id === id);
|
|
902
|
+
if (!passkey) return "signed with a passkey this machine does not trust";
|
|
903
|
+
const { clientDataJSON, authenticatorData, signature } = r;
|
|
904
|
+
if (!isB64u(clientDataJSON, 8192) || !isB64u(authenticatorData, 8192) || !isB64u(signature, 2048)) {
|
|
905
|
+
return "a malformed passkey signature";
|
|
906
|
+
}
|
|
907
|
+
const clientData = Buffer.from(clientDataJSON, "base64url");
|
|
908
|
+
let c;
|
|
909
|
+
try {
|
|
910
|
+
const parsed = JSON.parse(clientData.toString("utf8"));
|
|
911
|
+
if (typeof parsed !== "object" || parsed === null) return "malformed client data";
|
|
912
|
+
c = parsed;
|
|
913
|
+
} catch {
|
|
914
|
+
return "malformed client data";
|
|
915
|
+
}
|
|
916
|
+
if (c.type !== "webauthn.get") return "not a passkey sign-in";
|
|
917
|
+
const tag = TAGS[expected2.purpose];
|
|
918
|
+
if (typeof c.challenge !== "string" || !Buffer.from(c.challenge, "base64url").subarray(0, tag.length).equals(tag)) {
|
|
919
|
+
return "signed a challenge for another purpose";
|
|
920
|
+
}
|
|
921
|
+
if (c.challenge !== expected2.challenge) return "signed another challenge";
|
|
922
|
+
if (c.origin !== expected2.origin) return "signed for another site";
|
|
923
|
+
if (c.crossOrigin !== void 0 && c.crossOrigin !== false) return "signed inside another site";
|
|
924
|
+
const authData = Buffer.from(authenticatorData, "base64url");
|
|
925
|
+
if (authData.length < 37) return "malformed authenticator data";
|
|
926
|
+
const rpId = URL.parse(expected2.origin)?.hostname ?? "";
|
|
927
|
+
if (!authData.subarray(0, 32).equals(sha256(rpId))) return "signed for another site";
|
|
928
|
+
const flags = authData[32];
|
|
929
|
+
if (!(flags & 1) || !(flags & 4)) return "the passkey did not verify the captain";
|
|
930
|
+
const key = publicKeyOf(passkey);
|
|
931
|
+
if (!key) return "a pinned passkey is malformed";
|
|
932
|
+
const signed2 = Buffer.concat([authData, sha256(clientData)]);
|
|
933
|
+
try {
|
|
934
|
+
const ok = verify(
|
|
935
|
+
passkey.alg === -8 ? null : "sha256",
|
|
936
|
+
signed2,
|
|
937
|
+
key,
|
|
938
|
+
Buffer.from(signature, "base64url")
|
|
939
|
+
);
|
|
940
|
+
return ok ? null : "a bad passkey signature";
|
|
941
|
+
} catch {
|
|
942
|
+
return "a bad passkey signature";
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
// src/lib/server/cloud/guard.ts
|
|
947
|
+
var CHALLENGE_TTL_MS = 6 * 6e4;
|
|
948
|
+
var VERIFIED_SESSION_MS = 8 * 60 * 6e4;
|
|
949
|
+
var PENDING_PINS_MS = 60 * 6e4;
|
|
950
|
+
var MAX_CHALLENGES = 16;
|
|
951
|
+
var MAX_VERIFIED = 64;
|
|
952
|
+
var idOf = (v) => typeof v === "string" && v.length > 0 && v.length <= 64 ? v : void 0;
|
|
953
|
+
var SessionGuard = class {
|
|
954
|
+
constructor(opts) {
|
|
955
|
+
this.opts = opts;
|
|
956
|
+
this.pinned = opts.pins;
|
|
957
|
+
this.now = opts.now ?? Date.now;
|
|
958
|
+
}
|
|
959
|
+
opts;
|
|
960
|
+
pinned;
|
|
961
|
+
/** Challenges issued and not yet seen signed, by purpose and session id or ref. */
|
|
962
|
+
challenges = /* @__PURE__ */ new Map();
|
|
963
|
+
/** Sessions a trusted passkey signed, and when. */
|
|
964
|
+
verified = /* @__PURE__ */ new Map();
|
|
965
|
+
/** Sessions whose streams were refused, so each is logged once. */
|
|
966
|
+
refused = /* @__PURE__ */ new Set();
|
|
967
|
+
now;
|
|
968
|
+
/** This machine checks every session's passkey signature itself. */
|
|
969
|
+
get checks() {
|
|
970
|
+
return this.pinned !== null;
|
|
971
|
+
}
|
|
972
|
+
/** The credential ids of the passkeys it trusts, as `auth.pins` names them. */
|
|
973
|
+
get credentials() {
|
|
974
|
+
return (this.pinned ?? []).map((p) => p.id);
|
|
975
|
+
}
|
|
976
|
+
/**
|
|
977
|
+
* Why a stream of this relay session is refused (§6.4), or null when it may
|
|
978
|
+
* be served. The first refusal of each session is logged: a stream of a
|
|
979
|
+
* session nobody signed is what a gateway acting on its own would send.
|
|
980
|
+
*/
|
|
981
|
+
refusal(sessionId) {
|
|
982
|
+
if (!this.checks) return null;
|
|
983
|
+
const at = this.verified.get(sessionId);
|
|
984
|
+
const why = at === void 0 ? "No trusted passkey signed this session." : this.now() - at > VERIFIED_SESSION_MS ? "This session was signed more than 8 hours ago; open the machine again." : null;
|
|
985
|
+
if (why && !this.refused.has(sessionId)) {
|
|
986
|
+
this.refused.add(sessionId);
|
|
987
|
+
while (this.refused.size > MAX_VERIFIED) {
|
|
988
|
+
this.refused.delete(this.refused.values().next().value);
|
|
989
|
+
}
|
|
990
|
+
this.log(`refused the streams of session ${sessionId.slice(0, 8)}: ${why}`);
|
|
991
|
+
}
|
|
992
|
+
return why;
|
|
993
|
+
}
|
|
994
|
+
/** Forget the verified sessions past their 8 hours, returning them so their streams can end. */
|
|
995
|
+
sweep() {
|
|
996
|
+
const old = [...this.verified].filter(([, at]) => this.now() - at > VERIFIED_SESSION_MS);
|
|
997
|
+
for (const [id] of old) this.verified.delete(id);
|
|
998
|
+
return old.map(([id]) => id);
|
|
999
|
+
}
|
|
1000
|
+
/**
|
|
1001
|
+
* A `session.*` or `pins.*` control message from the gateway, and the
|
|
1002
|
+
* answer to send back (none for `session.end`, or one that is not for it).
|
|
1003
|
+
*/
|
|
1004
|
+
async handle(msg) {
|
|
1005
|
+
const sessionId = idOf(msg.sessionId);
|
|
1006
|
+
const ref = idOf(msg.ref);
|
|
1007
|
+
switch (msg.t) {
|
|
1008
|
+
case "session.challenge":
|
|
1009
|
+
return sessionId ? { t: "session.challenge", sessionId, ...this.issue("session", sessionId) } : null;
|
|
1010
|
+
case "pins.challenge":
|
|
1011
|
+
return ref ? { t: "pins.challenge", ref, ...this.issue("pins", ref) } : null;
|
|
1012
|
+
case "session.verify": {
|
|
1013
|
+
if (!sessionId) return null;
|
|
1014
|
+
const problem = this.spend("session", sessionId, msg.assertion);
|
|
1015
|
+
if (problem) {
|
|
1016
|
+
this.log(`refused to open session ${sessionId.slice(0, 8)}: ${problem}`);
|
|
1017
|
+
return { t: "session.verified", sessionId, ok: false, reason: problem };
|
|
1018
|
+
}
|
|
1019
|
+
this.verified.delete(sessionId);
|
|
1020
|
+
this.verified.set(sessionId, this.now());
|
|
1021
|
+
while (this.verified.size > MAX_VERIFIED) {
|
|
1022
|
+
this.verified.delete(this.verified.keys().next().value);
|
|
1023
|
+
}
|
|
1024
|
+
this.log(`session ${sessionId.slice(0, 8)} was signed with a trusted passkey.`);
|
|
1025
|
+
return { t: "session.verified", sessionId, ok: true };
|
|
1026
|
+
}
|
|
1027
|
+
case "session.end":
|
|
1028
|
+
if (sessionId) this.verified.delete(sessionId);
|
|
1029
|
+
return null;
|
|
1030
|
+
case "pins.update":
|
|
1031
|
+
return ref ? this.proposed(ref, msg) : null;
|
|
1032
|
+
default:
|
|
1033
|
+
return null;
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
/**
|
|
1037
|
+
* The answer to a `session.*` or `pins.*` request on a connection that may
|
|
1038
|
+
* not have sessions signed (a gateway that negotiated protocol 1): nothing
|
|
1039
|
+
* is issued, checked or kept, and `why` says so.
|
|
1040
|
+
*/
|
|
1041
|
+
refuse(msg, why) {
|
|
1042
|
+
const sessionId = idOf(msg.sessionId);
|
|
1043
|
+
const ref = idOf(msg.ref);
|
|
1044
|
+
switch (msg.t) {
|
|
1045
|
+
case "session.challenge":
|
|
1046
|
+
return sessionId ? { t: "session.challenge", sessionId, challenge: null, error: why } : null;
|
|
1047
|
+
case "session.verify":
|
|
1048
|
+
return sessionId ? { t: "session.verified", sessionId, ok: false, reason: why } : null;
|
|
1049
|
+
case "pins.challenge":
|
|
1050
|
+
return ref ? { t: "pins.challenge", ref, challenge: null, error: why } : null;
|
|
1051
|
+
case "pins.update":
|
|
1052
|
+
return ref ? { t: "pins.updated", ref, ok: false, reason: why } : null;
|
|
1053
|
+
default:
|
|
1054
|
+
return null;
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
/** The captain approved the pending change here: trust its passkeys from now on. */
|
|
1058
|
+
repin(pins) {
|
|
1059
|
+
this.pinned = pins;
|
|
1060
|
+
this.log(`now trusts ${pins.map((p) => p.name || p.id.slice(0, 8)).join(", ")}.`);
|
|
1061
|
+
}
|
|
1062
|
+
/**
|
|
1063
|
+
* `pins.update`: a new list, signed by a passkey trusted now (never one on
|
|
1064
|
+
* the new list alone), is kept as the pending change for the captain to
|
|
1065
|
+
* approve here; it changes nothing until they do.
|
|
1066
|
+
*/
|
|
1067
|
+
async proposed(ref, msg) {
|
|
1068
|
+
const signedBy = this.pinned?.find((p) => p.id === msg.assertion?.id);
|
|
1069
|
+
const problem = this.spend("pins", ref, msg.assertion);
|
|
1070
|
+
const passkeys = parsePasskeys(msg.passkeys);
|
|
1071
|
+
const refused2 = problem ?? (passkeys ? null : "the new list of passkeys is malformed");
|
|
1072
|
+
if (refused2 || !passkeys) {
|
|
1073
|
+
this.log(`kept its trusted passkeys: ${refused2}`);
|
|
1074
|
+
return { t: "pins.updated", ref, ok: false, reason: refused2 };
|
|
1075
|
+
}
|
|
1076
|
+
try {
|
|
1077
|
+
await this.opts.propose({ ref, passkeys, signedBy: signedBy?.name ?? "" });
|
|
1078
|
+
} catch (e) {
|
|
1079
|
+
const reason = `the new passkeys could not be kept: ${e.message}`.slice(0, 200);
|
|
1080
|
+
this.log(`kept its trusted passkeys: ${reason}`);
|
|
1081
|
+
return { t: "pins.updated", ref, ok: false, reason };
|
|
1082
|
+
}
|
|
1083
|
+
this.log(
|
|
1084
|
+
`was asked to trust ${passkeys.map((p) => p.name || p.id.slice(0, 8)).join(", ")} instead; approve or reject that on the Remotes page.`
|
|
1085
|
+
);
|
|
1086
|
+
return { t: "pins.updated", ref, ok: true, pending: true };
|
|
1087
|
+
}
|
|
1088
|
+
log(line) {
|
|
1089
|
+
this.opts.log?.(line);
|
|
1090
|
+
}
|
|
1091
|
+
/** A fresh challenge for one session or pins update, and the passkeys that may sign it. */
|
|
1092
|
+
issue(purpose, id) {
|
|
1093
|
+
if (!this.pinned?.length) {
|
|
1094
|
+
return { challenge: null, error: "this machine has no pinned passkeys" };
|
|
1095
|
+
}
|
|
1096
|
+
const now = this.now();
|
|
1097
|
+
for (const [k, c] of this.challenges) if (c.expires < now) this.challenges.delete(k);
|
|
1098
|
+
const key = `${purpose}:${id}`;
|
|
1099
|
+
const challenge = newChallenge(purpose);
|
|
1100
|
+
this.challenges.delete(key);
|
|
1101
|
+
this.challenges.set(key, { challenge, expires: now + CHALLENGE_TTL_MS });
|
|
1102
|
+
while (this.challenges.size > MAX_CHALLENGES) {
|
|
1103
|
+
this.challenges.delete(this.challenges.keys().next().value);
|
|
1104
|
+
}
|
|
1105
|
+
return { challenge, credentials: this.credentials };
|
|
1106
|
+
}
|
|
1107
|
+
/**
|
|
1108
|
+
* Use up the challenge issued for this purpose and id, pass or fail, and
|
|
1109
|
+
* check the assertion against it.
|
|
1110
|
+
*/
|
|
1111
|
+
spend(purpose, id, assertion) {
|
|
1112
|
+
const key = `${purpose}:${id}`;
|
|
1113
|
+
const issued = this.challenges.get(key);
|
|
1114
|
+
this.challenges.delete(key);
|
|
1115
|
+
if (!this.pinned?.length) return "this machine has no pinned passkeys";
|
|
1116
|
+
if (!issued || issued.expires < this.now()) {
|
|
1117
|
+
return "no live challenge for it: never issued, already used, or expired";
|
|
1118
|
+
}
|
|
1119
|
+
return assertionProblem(assertion, {
|
|
1120
|
+
purpose,
|
|
1121
|
+
challenge: issued.challenge,
|
|
1122
|
+
origin: this.opts.origin,
|
|
1123
|
+
passkeys: this.pinned
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
};
|
|
1127
|
+
|
|
712
1128
|
// src/lib/server/cloud/settings.ts
|
|
713
1129
|
var CLOUD_SETTINGS_SCHEMA = "wheelhouse-cloud-settings.v1";
|
|
714
1130
|
var CLOUD_STATUS_SCHEMA = "wheelhouse-cloud-status.v1";
|
|
715
1131
|
var CLOUD_KEYCHAIN_SERVICE = "wheelhouse-cloud";
|
|
716
|
-
var
|
|
1132
|
+
var lapsed = (p, now = Date.now()) => !(now - Date.parse(p.requestedAt) <= PENDING_PINS_MS);
|
|
1133
|
+
var cloudDir = (configDir) => path5.join(configDir, "cloud");
|
|
717
1134
|
var LOOPBACK = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "[::1]"]);
|
|
718
1135
|
function gatewayOrigin(raw) {
|
|
719
1136
|
const u = URL.parse(raw.trim());
|
|
@@ -746,7 +1163,42 @@ function parseDevice(v) {
|
|
|
746
1163
|
gateway,
|
|
747
1164
|
publicKey,
|
|
748
1165
|
user: str(v.user),
|
|
749
|
-
pairedAt: str(v.pairedAt) ?? (/* @__PURE__ */ new Date(0)).toISOString()
|
|
1166
|
+
pairedAt: str(v.pairedAt) ?? (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
1167
|
+
// Pins that can't be read never mean none: no silent downgrade, every session is refused.
|
|
1168
|
+
pins: v.pins === void 0 || v.pins === null ? null : parsePasskeys(v.pins) ?? [],
|
|
1169
|
+
pinnedAt: str(v.pinnedAt),
|
|
1170
|
+
pending: parsePending(v.pending),
|
|
1171
|
+
undelivered: Array.isArray(v.undelivered) ? v.undelivered.map(parseDecided).filter((d) => d !== null).slice(-MAX_UNDELIVERED) : []
|
|
1172
|
+
};
|
|
1173
|
+
}
|
|
1174
|
+
function parsePending(v) {
|
|
1175
|
+
if (!isObj(v)) return null;
|
|
1176
|
+
const id = str(v.id);
|
|
1177
|
+
const ref = str(v.ref);
|
|
1178
|
+
const passkeys = parsePasskeys(v.passkeys);
|
|
1179
|
+
const requestedAt = str(v.requestedAt);
|
|
1180
|
+
if (!id || !ref || !passkeys || !requestedAt) return null;
|
|
1181
|
+
return { id, ref, passkeys, signedBy: str(v.signedBy) ?? "", requestedAt };
|
|
1182
|
+
}
|
|
1183
|
+
var MAX_UNDELIVERED = 16;
|
|
1184
|
+
function parseDecided(v) {
|
|
1185
|
+
if (!isObj(v) || !str(v.ref) || typeof v.approved !== "boolean") return null;
|
|
1186
|
+
const reason = ["rejected", "expired", "replaced"].includes(v.reason) ? v.reason : null;
|
|
1187
|
+
return { ref: v.ref, approved: v.approved, reason, at: str(v.at) ?? "" };
|
|
1188
|
+
}
|
|
1189
|
+
var shown = (pins) => pins.map((p) => ({ name: p.name, fingerprint: passkeyFingerprint(p) }));
|
|
1190
|
+
function pendingView(device) {
|
|
1191
|
+
const p = device.pending;
|
|
1192
|
+
if (!p || lapsed(p)) return null;
|
|
1193
|
+
const now = new Set((device.pins ?? []).map((k) => k.id));
|
|
1194
|
+
const next = new Set(p.passkeys.map((k) => k.id));
|
|
1195
|
+
return {
|
|
1196
|
+
id: p.id,
|
|
1197
|
+
passkeys: p.passkeys.map((k) => ({ ...shown([k])[0], added: !now.has(k.id) })),
|
|
1198
|
+
removed: shown((device.pins ?? []).filter((k) => !next.has(k.id))),
|
|
1199
|
+
signedBy: p.signedBy,
|
|
1200
|
+
requestedAt: p.requestedAt,
|
|
1201
|
+
expiresAt: new Date(Date.parse(p.requestedAt) + PENDING_PINS_MS).toISOString()
|
|
750
1202
|
};
|
|
751
1203
|
}
|
|
752
1204
|
function parseSessions(v) {
|
|
@@ -766,13 +1218,13 @@ function parseSessions(v) {
|
|
|
766
1218
|
});
|
|
767
1219
|
}
|
|
768
1220
|
async function writeAtomic(file, text2) {
|
|
769
|
-
await
|
|
770
|
-
const tmp = `${file}.tmp-${process.pid}-${
|
|
1221
|
+
await mkdir3(path5.dirname(file), { recursive: true, mode: 448 });
|
|
1222
|
+
const tmp = `${file}.tmp-${process.pid}-${randomBytes3(4).toString("hex")}`;
|
|
771
1223
|
try {
|
|
772
|
-
await
|
|
773
|
-
await
|
|
1224
|
+
await writeFile3(tmp, text2, { mode: 384 });
|
|
1225
|
+
await rename3(tmp, file);
|
|
774
1226
|
} catch (e) {
|
|
775
|
-
await
|
|
1227
|
+
await rm2(tmp, { force: true });
|
|
776
1228
|
throw e;
|
|
777
1229
|
}
|
|
778
1230
|
}
|
|
@@ -793,13 +1245,13 @@ var CloudSettings = class {
|
|
|
793
1245
|
dir;
|
|
794
1246
|
keychain;
|
|
795
1247
|
get file() {
|
|
796
|
-
return
|
|
1248
|
+
return path5.join(this.dir, "settings.json");
|
|
797
1249
|
}
|
|
798
1250
|
get keyFile() {
|
|
799
|
-
return
|
|
1251
|
+
return path5.join(this.dir, "device.key");
|
|
800
1252
|
}
|
|
801
1253
|
get statusFile() {
|
|
802
|
-
return
|
|
1254
|
+
return path5.join(this.dir, "status.json");
|
|
803
1255
|
}
|
|
804
1256
|
/** The settings, with defaults (off, not started, the default gateway, no device) for anything missing or unreadable, with why. */
|
|
805
1257
|
async read() {
|
|
@@ -811,7 +1263,7 @@ var CloudSettings = class {
|
|
|
811
1263
|
};
|
|
812
1264
|
let text2;
|
|
813
1265
|
try {
|
|
814
|
-
text2 = await
|
|
1266
|
+
text2 = await readFile3(this.file, "utf8");
|
|
815
1267
|
} catch (e) {
|
|
816
1268
|
if (e.code === "ENOENT") return { settings: settings2, error: null };
|
|
817
1269
|
return { settings: settings2, error: `${this.file} could not be read: ${e.message}` };
|
|
@@ -850,8 +1302,8 @@ var CloudSettings = class {
|
|
|
850
1302
|
}
|
|
851
1303
|
/** The Keychain account for this directory's device key, so each config directory has its own. */
|
|
852
1304
|
async keychainAccount() {
|
|
853
|
-
const real2 = await realpath(this.dir).catch(() =>
|
|
854
|
-
return `device:${
|
|
1305
|
+
const real2 = await realpath(this.dir).catch(() => path5.resolve(this.dir));
|
|
1306
|
+
return `device:${createHash3("sha256").update(real2).digest("hex").slice(0, 16)}`;
|
|
855
1307
|
}
|
|
856
1308
|
/** The device key and where it is kept: the Keychain first, then the file. */
|
|
857
1309
|
async findKey() {
|
|
@@ -862,7 +1314,7 @@ var CloudSettings = class {
|
|
|
862
1314
|
const s = await lstat(this.keyFile);
|
|
863
1315
|
if (!s.isFile()) return null;
|
|
864
1316
|
if ((s.mode & 63) !== 0) await chmod(this.keyFile, 384);
|
|
865
|
-
const key = importKey(await
|
|
1317
|
+
const key = importKey(await readFile3(this.keyFile, "utf8"));
|
|
866
1318
|
return key ? { key, where: this.keyFile } : null;
|
|
867
1319
|
} catch {
|
|
868
1320
|
return null;
|
|
@@ -870,7 +1322,7 @@ var CloudSettings = class {
|
|
|
870
1322
|
}
|
|
871
1323
|
/** Keep the key in the Keychain, else in its file, replacing any before; returns where it went. */
|
|
872
1324
|
async setKey(key) {
|
|
873
|
-
await
|
|
1325
|
+
await mkdir3(this.dir, { recursive: true, mode: 448 });
|
|
874
1326
|
const stored = exportKey(key);
|
|
875
1327
|
const account = await this.keychainAccount();
|
|
876
1328
|
const kept = this.keychain ? await this.keychain.set(account, stored).then(
|
|
@@ -878,7 +1330,7 @@ var CloudSettings = class {
|
|
|
878
1330
|
() => false
|
|
879
1331
|
) : false;
|
|
880
1332
|
if (kept) {
|
|
881
|
-
await
|
|
1333
|
+
await rm2(this.keyFile, { force: true });
|
|
882
1334
|
return this.keychain.where;
|
|
883
1335
|
}
|
|
884
1336
|
await this.keychain?.remove(account).catch(() => false);
|
|
@@ -891,15 +1343,63 @@ var CloudSettings = class {
|
|
|
891
1343
|
/** Forget this machine's device: its key wherever it is kept, and its record, and stop remote access. */
|
|
892
1344
|
async forget() {
|
|
893
1345
|
await this.keychain?.remove(await this.keychainAccount()).catch(() => false);
|
|
894
|
-
await
|
|
1346
|
+
await rm2(this.keyFile, { force: true });
|
|
895
1347
|
await this.update((s) => {
|
|
896
1348
|
s.device = null;
|
|
897
1349
|
s.started = false;
|
|
898
1350
|
});
|
|
899
1351
|
}
|
|
1352
|
+
/**
|
|
1353
|
+
* The captain approved, here, the pending change `id` (§6.6): its passkeys
|
|
1354
|
+
* become the ones this machine trusts. Only that change, and only within
|
|
1355
|
+
* its hour: one the gateway has replaced since they looked (even under the
|
|
1356
|
+
* same ref), or one that lapsed, is not approved.
|
|
1357
|
+
*/
|
|
1358
|
+
approvePins(id, now = Date.now()) {
|
|
1359
|
+
return this.settle(id, now, (device, pending) => {
|
|
1360
|
+
device.pins = pending.passkeys;
|
|
1361
|
+
device.pinnedAt = new Date(now).toISOString();
|
|
1362
|
+
return { approved: true, reason: null };
|
|
1363
|
+
});
|
|
1364
|
+
}
|
|
1365
|
+
/** The captain rejected the pending change `id`: the passkeys trusted stay as they are. */
|
|
1366
|
+
rejectPins(id, now = Date.now()) {
|
|
1367
|
+
return this.settle(id, now, () => ({ approved: false, reason: "rejected" }));
|
|
1368
|
+
}
|
|
1369
|
+
/** The pending change `id` lapsed with nobody deciding: it counts as rejected. */
|
|
1370
|
+
expirePins(id, now = Date.now()) {
|
|
1371
|
+
return this.settle(id, now, () => ({ approved: false, reason: "expired" }), true);
|
|
1372
|
+
}
|
|
1373
|
+
async settle(id, now, take, lapsing = false) {
|
|
1374
|
+
let error = null;
|
|
1375
|
+
try {
|
|
1376
|
+
await this.update((s) => {
|
|
1377
|
+
const pending = s.device?.pending;
|
|
1378
|
+
if (!s.device || !pending || pending.id !== id) {
|
|
1379
|
+
error = "No such change of passkeys is waiting; look again.";
|
|
1380
|
+
} else if (lapsed(pending, now) !== lapsing) {
|
|
1381
|
+
error = "That change of passkeys expired; ask for it again on the gateway.";
|
|
1382
|
+
}
|
|
1383
|
+
if (error) throw new Error(error);
|
|
1384
|
+
const decision = take(s.device, pending);
|
|
1385
|
+
s.device.pending = null;
|
|
1386
|
+
const list2 = s.device.undelivered;
|
|
1387
|
+
list2.push({ ref: pending.ref, ...decision, at: new Date(now).toISOString() });
|
|
1388
|
+
for (const dropped of list2.splice(0, list2.length - MAX_UNDELIVERED)) {
|
|
1389
|
+
console.warn(
|
|
1390
|
+
`Wheelhouse Cloud: dropped the decision on change ${dropped.ref} before the gateway was told; its next connection names the passkeys trusted.`
|
|
1391
|
+
);
|
|
1392
|
+
}
|
|
1393
|
+
});
|
|
1394
|
+
} catch (e) {
|
|
1395
|
+
if (error) return { ok: false, error };
|
|
1396
|
+
throw e;
|
|
1397
|
+
}
|
|
1398
|
+
return { ok: true };
|
|
1399
|
+
}
|
|
900
1400
|
async readStatus() {
|
|
901
1401
|
try {
|
|
902
|
-
const v = JSON.parse(await
|
|
1402
|
+
const v = JSON.parse(await readFile3(this.statusFile, "utf8"));
|
|
903
1403
|
if (!isObj(v) || v.schema !== CLOUD_STATUS_SCHEMA || typeof v.pid !== "number") return null;
|
|
904
1404
|
const state = v.state === "online" || v.state === "stopped" ? v.state : "connecting";
|
|
905
1405
|
return {
|
|
@@ -945,7 +1445,10 @@ var CloudSettings = class {
|
|
|
945
1445
|
name: settings2.device.name,
|
|
946
1446
|
user: settings2.device.user,
|
|
947
1447
|
fingerprint: fingerprint(settings2.device.publicKey),
|
|
948
|
-
pairedAt: settings2.device.pairedAt
|
|
1448
|
+
pairedAt: settings2.device.pairedAt,
|
|
1449
|
+
passkeys: settings2.device.pins ? shown(settings2.device.pins) : null,
|
|
1450
|
+
pinnedAt: settings2.device.pinnedAt,
|
|
1451
|
+
pending: pendingView(settings2.device)
|
|
949
1452
|
} : null;
|
|
950
1453
|
const live = status && device && status.deviceId === device.id && alive(status.pid) ? status : null;
|
|
951
1454
|
let state;
|
|
@@ -990,6 +1493,9 @@ function cloudKeychain() {
|
|
|
990
1493
|
return process.platform === "darwin" ? macKeychain(CLOUD_KEYCHAIN_SERVICE) : null;
|
|
991
1494
|
}
|
|
992
1495
|
|
|
1496
|
+
// src/lib/server/cloud/service.ts
|
|
1497
|
+
import { randomBytes as randomBytes4 } from "node:crypto";
|
|
1498
|
+
|
|
993
1499
|
// src/lib/server/cloud/connector.ts
|
|
994
1500
|
import WebSocket2 from "ws";
|
|
995
1501
|
|
|
@@ -1128,6 +1634,12 @@ var Relay = class {
|
|
|
1128
1634
|
if (payload.length > maxWsMessage) return this.reset(s.id, "too_large");
|
|
1129
1635
|
s.ws.send(payload, { binary: kind === FRAME_WS_BINARY }, () => this.passed(s, payload.length));
|
|
1130
1636
|
}
|
|
1637
|
+
/** A relay session ended, or is no longer served: every stream of it is reset. */
|
|
1638
|
+
endSession(sessionId, message) {
|
|
1639
|
+
for (const s of [...this.streams.values()]) {
|
|
1640
|
+
if (s.session === sessionId) this.reset(s.id, "refused", message);
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1131
1643
|
/** The device socket is gone: every stream on it ends (§7). */
|
|
1132
1644
|
closeAll() {
|
|
1133
1645
|
this.closed = true;
|
|
@@ -1219,8 +1731,9 @@ var Relay = class {
|
|
|
1219
1731
|
}
|
|
1220
1732
|
/**
|
|
1221
1733
|
* What the request may reach, or the reset that refuses it (§6.4): the
|
|
1222
|
-
* stream id is new, the
|
|
1223
|
-
*
|
|
1734
|
+
* stream id is new, the session is one this machine serves, the target is
|
|
1735
|
+
* Wheelhouse or one of its previews, the path is an absolute path that is
|
|
1736
|
+
* not the restart, and the cloud is on here.
|
|
1224
1737
|
*/
|
|
1225
1738
|
async admit(id, msg) {
|
|
1226
1739
|
if (!Number.isInteger(id) || id <= this.lastId || id > 4294967295) {
|
|
@@ -1230,10 +1743,12 @@ var Relay = class {
|
|
|
1230
1743
|
if (this.streams.size >= this.opts.limits.maxStreams) return { ok: false, code: "limit" };
|
|
1231
1744
|
const relay = parseRelay(msg.relay);
|
|
1232
1745
|
const headers = parseHeaders(msg.headers);
|
|
1233
|
-
const
|
|
1234
|
-
if (!relay || !headers || typeof
|
|
1746
|
+
const path21 = msg.path;
|
|
1747
|
+
if (!relay || !headers || typeof path21 !== "string" || !path21.startsWith("/") || path21.length > 8192 || !headerSafe(path21) || path21.includes(" ")) {
|
|
1235
1748
|
return { ok: false, code: "protocol", message: "The request is malformed." };
|
|
1236
1749
|
}
|
|
1750
|
+
const refusal = this.opts.sessionRefusal?.(relay.sessionId);
|
|
1751
|
+
if (refusal) return { ok: false, code: "refused", message: refusal };
|
|
1237
1752
|
if (!this.opts.targets.enabled()) {
|
|
1238
1753
|
return {
|
|
1239
1754
|
ok: false,
|
|
@@ -1241,7 +1756,7 @@ var Relay = class {
|
|
|
1241
1756
|
message: "Wheelhouse Cloud is turned off on this machine."
|
|
1242
1757
|
};
|
|
1243
1758
|
}
|
|
1244
|
-
if (isRestartPath(
|
|
1759
|
+
if (isRestartPath(path21)) {
|
|
1245
1760
|
return {
|
|
1246
1761
|
ok: false,
|
|
1247
1762
|
code: "refused",
|
|
@@ -1251,7 +1766,7 @@ var Relay = class {
|
|
|
1251
1766
|
const target = isObj2(msg.target) ? msg.target : {};
|
|
1252
1767
|
const app = this.opts.targets.appPort();
|
|
1253
1768
|
if (target.kind === "app") {
|
|
1254
|
-
return { ok: true, port: app, host: "127.0.0.1", path:
|
|
1769
|
+
return { ok: true, port: app, host: "127.0.0.1", path: path21, headers, relay };
|
|
1255
1770
|
}
|
|
1256
1771
|
const port = target.port;
|
|
1257
1772
|
if (target.kind !== "port" || typeof port !== "number" || !Number.isInteger(port) || port < 1 || port > 65535) {
|
|
@@ -1260,7 +1775,9 @@ var Relay = class {
|
|
|
1260
1775
|
if (port === app || !(await this.opts.targets.previewPorts()).has(port)) {
|
|
1261
1776
|
return { ok: false, code: "refused", message: "That port is not a Wheelhouse preview." };
|
|
1262
1777
|
}
|
|
1263
|
-
|
|
1778
|
+
const late = this.opts.sessionRefusal?.(relay.sessionId);
|
|
1779
|
+
if (late) return { ok: false, code: "refused", message: late };
|
|
1780
|
+
return { ok: true, port, host: "localhost", path: path21, headers, relay };
|
|
1264
1781
|
}
|
|
1265
1782
|
/** §6.3: the headers for the local request. */
|
|
1266
1783
|
localHeaders(a, originChecked, ws) {
|
|
@@ -1305,6 +1822,7 @@ var Relay = class {
|
|
|
1305
1822
|
const s = {
|
|
1306
1823
|
kind: "http",
|
|
1307
1824
|
id,
|
|
1825
|
+
session: a.relay.sessionId,
|
|
1308
1826
|
flow: { out: 0, in: 0, passed: 0 },
|
|
1309
1827
|
req,
|
|
1310
1828
|
res: null,
|
|
@@ -1392,6 +1910,7 @@ var Relay = class {
|
|
|
1392
1910
|
const s = {
|
|
1393
1911
|
kind: "ws",
|
|
1394
1912
|
id,
|
|
1913
|
+
session: a.relay.sessionId,
|
|
1395
1914
|
flow: { out: 0, in: 0, passed: 0 },
|
|
1396
1915
|
ws,
|
|
1397
1916
|
accepted: false,
|
|
@@ -1457,6 +1976,8 @@ function relativeLocation(value, host, port) {
|
|
|
1457
1976
|
// src/lib/server/cloud/connector.ts
|
|
1458
1977
|
var HELLO_MS = 15e3;
|
|
1459
1978
|
var STABLE_MS = 6e4;
|
|
1979
|
+
var SWEEP_MS = 6e4;
|
|
1980
|
+
var NOT_SIGNED_HERE = "this gateway cannot have sessions signed, so this machine with pinned passkeys serves nothing through it";
|
|
1460
1981
|
var isObj3 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
1461
1982
|
function connectUrl(gateway) {
|
|
1462
1983
|
const u = new URL("/v1/connect", gateway);
|
|
@@ -1467,6 +1988,13 @@ var Connector = class {
|
|
|
1467
1988
|
constructor(opts) {
|
|
1468
1989
|
this.opts = opts;
|
|
1469
1990
|
this.random = opts.random ?? Math.random;
|
|
1991
|
+
this.guard = new SessionGuard({
|
|
1992
|
+
origin: new URL(opts.gateway).origin,
|
|
1993
|
+
pins: opts.pins,
|
|
1994
|
+
propose: (p) => opts.events.proposed?.(p) ?? Promise.reject(new Error("there is nowhere to keep it")),
|
|
1995
|
+
log: (line) => this.log(`This machine ${line}`),
|
|
1996
|
+
now: opts.now
|
|
1997
|
+
});
|
|
1470
1998
|
}
|
|
1471
1999
|
opts;
|
|
1472
2000
|
state = "connecting";
|
|
@@ -1476,10 +2004,24 @@ var Connector = class {
|
|
|
1476
2004
|
retry = null;
|
|
1477
2005
|
watchdog = null;
|
|
1478
2006
|
stable = null;
|
|
2007
|
+
sweeper = null;
|
|
1479
2008
|
stopped = false;
|
|
1480
2009
|
random;
|
|
2010
|
+
/** The sessions this machine verified: kept across reconnects, as relay sessions are (§7). */
|
|
2011
|
+
guard;
|
|
2012
|
+
/** Sends on the socket while it is ready. */
|
|
2013
|
+
live = null;
|
|
2014
|
+
/** Decisions on a change of pins made while no socket was ready, sent after the next `ready`. */
|
|
2015
|
+
undelivered = [];
|
|
1481
2016
|
start() {
|
|
1482
2017
|
this.stopped = false;
|
|
2018
|
+
if (this.sweeper) clearInterval(this.sweeper);
|
|
2019
|
+
this.sweeper = setInterval(() => {
|
|
2020
|
+
for (const id of this.guard.sweep()) {
|
|
2021
|
+
this.relay?.endSession(id, "This session was signed more than 8 hours ago.");
|
|
2022
|
+
}
|
|
2023
|
+
}, this.opts.sweepMs ?? SWEEP_MS);
|
|
2024
|
+
this.sweeper.unref?.();
|
|
1483
2025
|
this.connect();
|
|
1484
2026
|
}
|
|
1485
2027
|
/** Close the socket and stop reconnecting. */
|
|
@@ -1487,7 +2029,8 @@ var Connector = class {
|
|
|
1487
2029
|
if (this.stopped) return;
|
|
1488
2030
|
this.stopped = true;
|
|
1489
2031
|
if (this.retry) clearTimeout(this.retry);
|
|
1490
|
-
this.
|
|
2032
|
+
if (this.sweeper) clearInterval(this.sweeper);
|
|
2033
|
+
this.retry = this.sweeper = null;
|
|
1491
2034
|
this.teardown();
|
|
1492
2035
|
const ws = this.ws;
|
|
1493
2036
|
this.ws = null;
|
|
@@ -1508,7 +2051,26 @@ var Connector = class {
|
|
|
1508
2051
|
log(line) {
|
|
1509
2052
|
this.opts.events.log?.(line);
|
|
1510
2053
|
}
|
|
2054
|
+
/**
|
|
2055
|
+
* The captain decided, here, on the pending change of pins `ref` (§6.6),
|
|
2056
|
+
* already applied to the guard. The gateway is told with `pins.decided`,
|
|
2057
|
+
* naming the pins after the decision; now, or after the next `ready` when
|
|
2058
|
+
* no socket is ready.
|
|
2059
|
+
*/
|
|
2060
|
+
decide(d) {
|
|
2061
|
+
const msg = {
|
|
2062
|
+
t: "pins.decided",
|
|
2063
|
+
ref: d.ref,
|
|
2064
|
+
approved: d.approved,
|
|
2065
|
+
...d.approved ? {} : { reason: d.reason ?? "rejected" },
|
|
2066
|
+
pins: this.guard.credentials
|
|
2067
|
+
};
|
|
2068
|
+
if (this.live) return this.live(msg);
|
|
2069
|
+
this.undelivered.push(msg);
|
|
2070
|
+
while (this.undelivered.length > 8) this.undelivered.shift();
|
|
2071
|
+
}
|
|
1511
2072
|
teardown() {
|
|
2073
|
+
this.live = null;
|
|
1512
2074
|
if (this.watchdog) clearTimeout(this.watchdog);
|
|
1513
2075
|
if (this.stable) clearTimeout(this.stable);
|
|
1514
2076
|
this.watchdog = this.stable = null;
|
|
@@ -1528,6 +2090,7 @@ var Connector = class {
|
|
|
1528
2090
|
this.ws = ws;
|
|
1529
2091
|
let limits = DEFAULT_LIMITS;
|
|
1530
2092
|
let ready = false;
|
|
2093
|
+
let downgraded = null;
|
|
1531
2094
|
let heartbeatMs = 2e4;
|
|
1532
2095
|
const mine = () => this.ws === ws;
|
|
1533
2096
|
const send = (msg) => {
|
|
@@ -1568,26 +2131,24 @@ var Connector = class {
|
|
|
1568
2131
|
if (!isObj3(msg) || typeof msg.t !== "string") return;
|
|
1569
2132
|
if (!ready) {
|
|
1570
2133
|
if (msg.t === "hello" && typeof msg.nonce === "string") {
|
|
1571
|
-
if (typeof msg.protocol === "number" && msg.protocol < PROTOCOL) {
|
|
1572
|
-
this.log(
|
|
1573
|
-
`The gateway speaks protocol ${msg.protocol}; this Wheelhouse speaks ${PROTOCOL}.`
|
|
1574
|
-
);
|
|
1575
|
-
}
|
|
1576
2134
|
send({
|
|
1577
2135
|
t: "auth",
|
|
1578
2136
|
protocol: PROTOCOL,
|
|
1579
2137
|
deviceId: this.opts.deviceId,
|
|
1580
2138
|
sig: connectSig(this.opts.key, msg.nonce, this.opts.deviceId),
|
|
1581
2139
|
agent: { name: "wheelhouse", version: this.opts.version },
|
|
1582
|
-
features: []
|
|
2140
|
+
features: [],
|
|
2141
|
+
pins: this.guard.credentials
|
|
1583
2142
|
});
|
|
1584
2143
|
} else if (msg.t === "ready") {
|
|
1585
2144
|
ready = true;
|
|
2145
|
+
const agreed = typeof msg.protocol === "number" ? Math.min(msg.protocol, PROTOCOL) : 1;
|
|
1586
2146
|
if (typeof msg.heartbeatMs === "number" && msg.heartbeatMs >= 1e3) {
|
|
1587
2147
|
heartbeatMs = msg.heartbeatMs;
|
|
1588
2148
|
}
|
|
1589
2149
|
limits = readLimits(msg.limits);
|
|
1590
2150
|
alive3(heartbeatMs * 3);
|
|
2151
|
+
downgraded = this.guard.checks && agreed < 2 ? `This gateway speaks protocol ${agreed}, so it cannot have sessions signed with your passkey; this machine refuses every session it relays until the gateway is updated.` : null;
|
|
1591
2152
|
this.relay = new Relay({
|
|
1592
2153
|
limits,
|
|
1593
2154
|
targets: this.opts.targets,
|
|
@@ -1595,16 +2156,35 @@ var Connector = class {
|
|
|
1595
2156
|
sendFrame: (frame) => {
|
|
1596
2157
|
if (mine() && ws.readyState === WebSocket2.OPEN) ws.send(frame, { binary: true });
|
|
1597
2158
|
},
|
|
1598
|
-
onRelayed: (r) => this.opts.events.relayed?.(r)
|
|
2159
|
+
onRelayed: (r) => this.opts.events.relayed?.(r),
|
|
2160
|
+
sessionRefusal: (id) => downgraded ? NOT_SIGNED_HERE : this.guard.refusal(id)
|
|
1599
2161
|
});
|
|
1600
2162
|
this.stable = setTimeout(() => this.attempt = 0, this.opts.stableMs ?? STABLE_MS);
|
|
1601
2163
|
this.stable.unref?.();
|
|
1602
|
-
this.
|
|
2164
|
+
if (downgraded) this.log(downgraded);
|
|
2165
|
+
this.set("online", downgraded);
|
|
2166
|
+
this.live = send;
|
|
2167
|
+
for (const m of this.undelivered.splice(0)) send(m);
|
|
1603
2168
|
}
|
|
1604
2169
|
return;
|
|
1605
2170
|
}
|
|
1606
2171
|
if (msg.t === "ping") return send({ t: "pong", ts: msg.ts });
|
|
1607
2172
|
if (msg.t === "pong") return;
|
|
2173
|
+
if (msg.t.startsWith("session.") || msg.t.startsWith("pins.")) {
|
|
2174
|
+
if (msg.t === "session.end" && typeof msg.sessionId === "string") {
|
|
2175
|
+
this.relay?.endSession(msg.sessionId, "The relay session ended.");
|
|
2176
|
+
}
|
|
2177
|
+
if (downgraded && msg.t !== "session.end") {
|
|
2178
|
+
const reply = this.guard.refuse(msg, NOT_SIGNED_HERE);
|
|
2179
|
+
if (reply) send(reply);
|
|
2180
|
+
return;
|
|
2181
|
+
}
|
|
2182
|
+
void this.guard.handle(msg).then(
|
|
2183
|
+
(reply) => reply && send(reply),
|
|
2184
|
+
(e) => this.log(`Could not answer ${msg.t}: ${e.message}`)
|
|
2185
|
+
);
|
|
2186
|
+
return;
|
|
2187
|
+
}
|
|
1608
2188
|
this.relay?.control(msg);
|
|
1609
2189
|
});
|
|
1610
2190
|
ws.on("error", (e) => {
|
|
@@ -1647,6 +2227,7 @@ var POLL_MS = 3e3;
|
|
|
1647
2227
|
var SEEN_WRITE_MS = 15e3;
|
|
1648
2228
|
var MAX_SESSIONS = 20;
|
|
1649
2229
|
var HOLDER_FRESH_MS = 3 * 6e4;
|
|
2230
|
+
var decidedKey = (d) => `${d.ref}:${d.at}`;
|
|
1650
2231
|
var CloudService = class {
|
|
1651
2232
|
constructor(opts) {
|
|
1652
2233
|
this.opts = opts;
|
|
@@ -1671,6 +2252,8 @@ var CloudService = class {
|
|
|
1671
2252
|
ticking = false;
|
|
1672
2253
|
/** Stopped: a look still in flight must not start a connector. */
|
|
1673
2254
|
closed = false;
|
|
2255
|
+
/** The decisions on changes of pins already handed to a connector by this process. */
|
|
2256
|
+
handed = /* @__PURE__ */ new Set();
|
|
1674
2257
|
/** Start watching the settings; resolves after the first look. */
|
|
1675
2258
|
async start() {
|
|
1676
2259
|
this.closed = false;
|
|
@@ -1736,8 +2319,13 @@ var CloudService = class {
|
|
|
1736
2319
|
}
|
|
1737
2320
|
return;
|
|
1738
2321
|
}
|
|
2322
|
+
const pins = JSON.stringify(device.pins);
|
|
1739
2323
|
const same = this.running && this.running.deviceId === device.id && this.running.gateway === device.gateway;
|
|
1740
|
-
if (same)
|
|
2324
|
+
if (same && this.connector) {
|
|
2325
|
+
await this.settlePins(this.connector, device);
|
|
2326
|
+
if (!this.running || this.running.pins === pins) return;
|
|
2327
|
+
this.opts.log("Wheelhouse Cloud: the passkeys this machine trusts changed; reconnecting.");
|
|
2328
|
+
}
|
|
1741
2329
|
if (this.connector) this.halt();
|
|
1742
2330
|
const holder = await this.heldElsewhere(device.id);
|
|
1743
2331
|
if (holder) {
|
|
@@ -1761,7 +2349,7 @@ var CloudService = class {
|
|
|
1761
2349
|
if (this.closed) return;
|
|
1762
2350
|
const seen = before?.deviceId === device.id ? [...before.sessions].reverse() : [];
|
|
1763
2351
|
this.sessions = new Map(seen.map((s) => [s.id, s]));
|
|
1764
|
-
this.running = { deviceId: device.id, gateway: device.gateway };
|
|
2352
|
+
this.running = { deviceId: device.id, gateway: device.gateway, pins };
|
|
1765
2353
|
const base = {
|
|
1766
2354
|
pid: this.pid,
|
|
1767
2355
|
state: "connecting",
|
|
@@ -1779,6 +2367,8 @@ var CloudService = class {
|
|
|
1779
2367
|
deviceId: device.id,
|
|
1780
2368
|
key: found.key,
|
|
1781
2369
|
version: this.opts.version,
|
|
2370
|
+
pins: device.pins,
|
|
2371
|
+
now: this.now,
|
|
1782
2372
|
targets: {
|
|
1783
2373
|
appPort: this.opts.appPort,
|
|
1784
2374
|
previewPorts: this.opts.previewPorts,
|
|
@@ -1820,6 +2410,23 @@ var CloudService = class {
|
|
|
1820
2410
|
void this.opts.settings.forget().catch(() => {
|
|
1821
2411
|
});
|
|
1822
2412
|
},
|
|
2413
|
+
proposed: async (p) => {
|
|
2414
|
+
let before2 = null;
|
|
2415
|
+
await this.opts.settings.update((x) => {
|
|
2416
|
+
if (x.device?.id !== device.id) throw new Error("this machine is no longer paired");
|
|
2417
|
+
const was = x.device.pending;
|
|
2418
|
+
if (was && was.ref !== p.ref) {
|
|
2419
|
+
before2 = { ref: was.ref, reason: lapsed(was, this.now()) ? "expired" : "replaced" };
|
|
2420
|
+
}
|
|
2421
|
+
x.device.pending = {
|
|
2422
|
+
...p,
|
|
2423
|
+
id: randomBytes4(8).toString("hex"),
|
|
2424
|
+
requestedAt: new Date(this.now()).toISOString()
|
|
2425
|
+
};
|
|
2426
|
+
});
|
|
2427
|
+
const b = before2;
|
|
2428
|
+
if (b) connector.decide({ ref: b.ref, approved: false, reason: b.reason });
|
|
2429
|
+
},
|
|
1823
2430
|
log: (line) => this.opts.log(`Wheelhouse Cloud: ${line}`)
|
|
1824
2431
|
}
|
|
1825
2432
|
});
|
|
@@ -1827,6 +2434,36 @@ var CloudService = class {
|
|
|
1827
2434
|
this.write(base);
|
|
1828
2435
|
connector.start();
|
|
1829
2436
|
}
|
|
2437
|
+
/**
|
|
2438
|
+
* The pending change of pins: one past its hour lapses (as rejected), and a
|
|
2439
|
+
* decision the captain made here, in this process or another, goes to the
|
|
2440
|
+
* connector once, which applies it and tells the gateway.
|
|
2441
|
+
*/
|
|
2442
|
+
async settlePins(connector, device) {
|
|
2443
|
+
if (device.pending && lapsed(device.pending, this.now())) {
|
|
2444
|
+
await this.opts.settings.expirePins(device.pending.id, this.now());
|
|
2445
|
+
return;
|
|
2446
|
+
}
|
|
2447
|
+
const fresh = device.undelivered.filter((d) => !this.handed.has(decidedKey(d)));
|
|
2448
|
+
if (!fresh.length) return;
|
|
2449
|
+
const pins = JSON.stringify(device.pins);
|
|
2450
|
+
if (pins !== this.running.pins && device.pins?.length) {
|
|
2451
|
+
connector.guard.repin(device.pins);
|
|
2452
|
+
this.running.pins = pins;
|
|
2453
|
+
}
|
|
2454
|
+
for (const d of fresh) {
|
|
2455
|
+
this.handed.add(decidedKey(d));
|
|
2456
|
+
connector.decide({ ref: d.ref, approved: d.approved, reason: d.reason });
|
|
2457
|
+
this.opts.log(
|
|
2458
|
+
d.approved ? `Wheelhouse Cloud: the new passkeys were approved here; this machine trusts them now.` : `Wheelhouse Cloud: the change of passkeys was ${d.reason ?? "rejected"}; this machine trusts the same passkeys as before.`
|
|
2459
|
+
);
|
|
2460
|
+
}
|
|
2461
|
+
const sent = new Set(fresh.map(decidedKey));
|
|
2462
|
+
await this.opts.settings.update((x) => {
|
|
2463
|
+
if (x.device?.id !== device.id) return;
|
|
2464
|
+
x.device.undelivered = x.device.undelivered.filter((d) => !sent.has(decidedKey(d)));
|
|
2465
|
+
});
|
|
2466
|
+
}
|
|
1830
2467
|
/** §6.4: a local log of each relay session, without paths, bodies or header values. */
|
|
1831
2468
|
relayed(r) {
|
|
1832
2469
|
const at = new Date(this.now()).toISOString();
|
|
@@ -1848,15 +2485,15 @@ var CloudService = class {
|
|
|
1848
2485
|
};
|
|
1849
2486
|
|
|
1850
2487
|
// src/lib/server/plugins/installed.ts
|
|
1851
|
-
import { mkdir as
|
|
2488
|
+
import { mkdir as mkdir4, readFile as readFile4, rename as rename4, writeFile as writeFile4 } from "node:fs/promises";
|
|
1852
2489
|
import { homedir as homedir2 } from "node:os";
|
|
1853
|
-
import
|
|
2490
|
+
import path6 from "node:path";
|
|
1854
2491
|
var INSTALLED_FILE = "installed.json";
|
|
1855
2492
|
var SCHEMA = "wheelhouse-installed-plugins.v1";
|
|
1856
2493
|
var EMPTY_INSTALLED = () => ({ schema: SCHEMA, plugins: {} });
|
|
1857
2494
|
function defaultPluginsDir(env) {
|
|
1858
|
-
if (env.WHEELHOUSE_PLUGINS_DIR) return
|
|
1859
|
-
return
|
|
2495
|
+
if (env.WHEELHOUSE_PLUGINS_DIR) return path6.resolve(env.WHEELHOUSE_PLUGINS_DIR);
|
|
2496
|
+
return path6.join(homedir2(), ".wheelhouse", "plugins");
|
|
1860
2497
|
}
|
|
1861
2498
|
var isRecord2 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
1862
2499
|
function record(v) {
|
|
@@ -1868,10 +2505,10 @@ function record(v) {
|
|
|
1868
2505
|
return { repository, ref, commit, version: version2, installedAt, enabled };
|
|
1869
2506
|
}
|
|
1870
2507
|
async function readInstalled(dir) {
|
|
1871
|
-
const file =
|
|
2508
|
+
const file = path6.join(dir, INSTALLED_FILE);
|
|
1872
2509
|
let text2;
|
|
1873
2510
|
try {
|
|
1874
|
-
text2 = await
|
|
2511
|
+
text2 = await readFile4(file, "utf8");
|
|
1875
2512
|
} catch (e) {
|
|
1876
2513
|
if (e.code === "ENOENT")
|
|
1877
2514
|
return { ok: true, installed: EMPTY_INSTALLED() };
|
|
@@ -1895,41 +2532,41 @@ async function readInstalled(dir) {
|
|
|
1895
2532
|
return { ok: true, installed };
|
|
1896
2533
|
}
|
|
1897
2534
|
async function writeInstalled(dir, installed) {
|
|
1898
|
-
await
|
|
1899
|
-
const file =
|
|
2535
|
+
await mkdir4(dir, { recursive: true });
|
|
2536
|
+
const file = path6.join(dir, INSTALLED_FILE);
|
|
1900
2537
|
const tmp = `${file}.${process.pid}.tmp`;
|
|
1901
|
-
await
|
|
2538
|
+
await writeFile4(tmp, `${JSON.stringify(installed, null, " ")}
|
|
1902
2539
|
`);
|
|
1903
|
-
await
|
|
2540
|
+
await rename4(tmp, file);
|
|
1904
2541
|
}
|
|
1905
2542
|
|
|
1906
2543
|
// src/lib/server/setup/skill.ts
|
|
1907
|
-
import { createHash as
|
|
2544
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
1908
2545
|
import {
|
|
1909
2546
|
lstat as lstat2,
|
|
1910
|
-
mkdir as
|
|
2547
|
+
mkdir as mkdir5,
|
|
1911
2548
|
mkdtemp,
|
|
1912
|
-
readFile as
|
|
2549
|
+
readFile as readFile5,
|
|
1913
2550
|
readdir,
|
|
1914
2551
|
realpath as realpath2,
|
|
1915
|
-
rename as
|
|
1916
|
-
rm as
|
|
1917
|
-
writeFile as
|
|
2552
|
+
rename as rename5,
|
|
2553
|
+
rm as rm3,
|
|
2554
|
+
writeFile as writeFile5
|
|
1918
2555
|
} from "node:fs/promises";
|
|
1919
2556
|
import { homedir as homedir3 } from "node:os";
|
|
1920
|
-
import
|
|
2557
|
+
import path7 from "node:path";
|
|
1921
2558
|
var NAME = "manage-wheelhouse";
|
|
1922
2559
|
var RECEIPT = ".wheelhouse-managed.json";
|
|
1923
2560
|
var FILES = ["SKILL.md", "references/operations.md"];
|
|
1924
|
-
var hash = (text2) =>
|
|
2561
|
+
var hash = (text2) => createHash4("sha256").update(text2).digest("hex");
|
|
1925
2562
|
async function physical(file) {
|
|
1926
2563
|
try {
|
|
1927
2564
|
return await realpath2(file);
|
|
1928
2565
|
} catch (e) {
|
|
1929
2566
|
if (e.code !== "ENOENT") throw e;
|
|
1930
|
-
const parent =
|
|
2567
|
+
const parent = path7.dirname(file);
|
|
1931
2568
|
if (parent === file) throw e;
|
|
1932
|
-
return
|
|
2569
|
+
return path7.join(await physical(parent), path7.basename(file));
|
|
1933
2570
|
}
|
|
1934
2571
|
}
|
|
1935
2572
|
async function present(file) {
|
|
@@ -1946,8 +2583,8 @@ async function contents(dir, prefix = "") {
|
|
|
1946
2583
|
for (const entry2 of await readdir(dir, { withFileTypes: true })) {
|
|
1947
2584
|
const rel = prefix + entry2.name;
|
|
1948
2585
|
if (entry2.isDirectory())
|
|
1949
|
-
Object.assign(result, await contents(
|
|
1950
|
-
else if (entry2.isFile()) result[rel] = hash(await
|
|
2586
|
+
Object.assign(result, await contents(path7.join(dir, entry2.name), rel + "/"));
|
|
2587
|
+
else if (entry2.isFile()) result[rel] = hash(await readFile5(path7.join(dir, entry2.name), "utf8"));
|
|
1951
2588
|
else throw new Error("The skill contains a symbolic link or special file.");
|
|
1952
2589
|
}
|
|
1953
2590
|
return result;
|
|
@@ -1956,7 +2593,7 @@ async function inspect(target, hashes) {
|
|
|
1956
2593
|
if (!await present(target)) return "absent";
|
|
1957
2594
|
try {
|
|
1958
2595
|
if (!(await lstat2(target)).isDirectory()) return "foreign";
|
|
1959
|
-
const receipt = JSON.parse(await
|
|
2596
|
+
const receipt = JSON.parse(await readFile5(path7.join(target, RECEIPT), "utf8"));
|
|
1960
2597
|
const actual = await contents(target);
|
|
1961
2598
|
delete actual[RECEIPT];
|
|
1962
2599
|
const unchanged = receipt.schema === "wheelhouse-skill.v1" && receipt.files && Object.keys(actual).length === Object.keys(receipt.files).length && Object.entries(actual).every(([file, digest]) => receipt.files[file] === digest);
|
|
@@ -1966,14 +2603,14 @@ async function inspect(target, hashes) {
|
|
|
1966
2603
|
return await present(target) ? "foreign" : "absent";
|
|
1967
2604
|
}
|
|
1968
2605
|
}
|
|
1969
|
-
async function installWheelhouseSkill(install2, env, sourceDir =
|
|
2606
|
+
async function installWheelhouseSkill(install2, env, sourceDir = path7.join(env.WHEELHOUSE_INSTALL_DIR || process.cwd(), "skills", NAME)) {
|
|
1970
2607
|
if (env.WHEELHOUSE_MANAGE_SKILL === "0")
|
|
1971
2608
|
return { state: "disabled", message: "Wheelhouse skill installation is disabled." };
|
|
1972
|
-
const parent =
|
|
1973
|
-
env.CLAUDE_CONFIG_DIR ||
|
|
2609
|
+
const parent = path7.resolve(
|
|
2610
|
+
env.CLAUDE_CONFIG_DIR || path7.join(env.HOME || homedir3(), ".claude"),
|
|
1974
2611
|
"skills"
|
|
1975
2612
|
);
|
|
1976
|
-
const target =
|
|
2613
|
+
const target = path7.join(parent, NAME);
|
|
1977
2614
|
const current = {
|
|
1978
2615
|
state: "current",
|
|
1979
2616
|
message: `Wheelhouse skill is current at ${target}.`
|
|
@@ -1982,20 +2619,20 @@ async function installWheelhouseSkill(install2, env, sourceDir = path5.join(env.
|
|
|
1982
2619
|
try {
|
|
1983
2620
|
const destinations = [await physical(parent), await physical(target)];
|
|
1984
2621
|
for (const dir of [install2.firstmateDir, install2.homeDir]) {
|
|
1985
|
-
const protectedDir = await physical(
|
|
2622
|
+
const protectedDir = await physical(path7.resolve(dir));
|
|
1986
2623
|
if (destinations.some(
|
|
1987
|
-
(destination) => destination === protectedDir || destination.startsWith(protectedDir +
|
|
2624
|
+
(destination) => destination === protectedDir || destination.startsWith(protectedDir + path7.sep)
|
|
1988
2625
|
))
|
|
1989
2626
|
return {
|
|
1990
2627
|
state: "skipped",
|
|
1991
2628
|
message: `Left ${target} unchanged: user skills location is inside Firstmate's checkout or home.`
|
|
1992
2629
|
};
|
|
1993
2630
|
}
|
|
1994
|
-
await
|
|
2631
|
+
await mkdir5(parent, { recursive: true });
|
|
1995
2632
|
const files = Object.fromEntries(
|
|
1996
2633
|
await Promise.all(
|
|
1997
2634
|
FILES.map(
|
|
1998
|
-
async (file) => [file, await
|
|
2635
|
+
async (file) => [file, await readFile5(path7.join(sourceDir, file), "utf8")]
|
|
1999
2636
|
)
|
|
2000
2637
|
)
|
|
2001
2638
|
);
|
|
@@ -2011,13 +2648,13 @@ async function installWheelhouseSkill(install2, env, sourceDir = path5.join(env.
|
|
|
2011
2648
|
};
|
|
2012
2649
|
let now = found;
|
|
2013
2650
|
const exists2 = found === "managed";
|
|
2014
|
-
stage = await mkdtemp(
|
|
2651
|
+
stage = await mkdtemp(path7.join(parent, ".wheelhouse-skill-"));
|
|
2015
2652
|
for (const [file, text2] of Object.entries(files)) {
|
|
2016
|
-
await
|
|
2017
|
-
await
|
|
2653
|
+
await mkdir5(path7.dirname(path7.join(stage, file)), { recursive: true });
|
|
2654
|
+
await writeFile5(path7.join(stage, file), text2);
|
|
2018
2655
|
}
|
|
2019
|
-
await
|
|
2020
|
-
|
|
2656
|
+
await writeFile5(
|
|
2657
|
+
path7.join(stage, RECEIPT),
|
|
2021
2658
|
JSON.stringify({ schema: "wheelhouse-skill.v1", version, files: hashes }) + "\n"
|
|
2022
2659
|
);
|
|
2023
2660
|
const backup = stage + "-previous";
|
|
@@ -2025,15 +2662,15 @@ async function installWheelhouseSkill(install2, env, sourceDir = path5.join(env.
|
|
|
2025
2662
|
let error = new Error("another copy appeared while installing");
|
|
2026
2663
|
if (now !== "foreign")
|
|
2027
2664
|
try {
|
|
2028
|
-
if (now === "managed") await
|
|
2029
|
-
await
|
|
2665
|
+
if (now === "managed") await rename5(target, backup);
|
|
2666
|
+
await rename5(stage, target);
|
|
2030
2667
|
break;
|
|
2031
2668
|
} catch (e) {
|
|
2032
2669
|
error = e;
|
|
2033
|
-
await
|
|
2670
|
+
await rename5(backup, target).catch(() => {
|
|
2034
2671
|
});
|
|
2035
2672
|
} finally {
|
|
2036
|
-
await
|
|
2673
|
+
await rm3(backup, { recursive: true, force: true });
|
|
2037
2674
|
}
|
|
2038
2675
|
now = await inspect(target, hashes);
|
|
2039
2676
|
if (now === "current") return current;
|
|
@@ -2051,15 +2688,15 @@ async function installWheelhouseSkill(install2, env, sourceDir = path5.join(env.
|
|
|
2051
2688
|
message: `Could not install Wheelhouse skill at ${target}: ${e.message}`
|
|
2052
2689
|
};
|
|
2053
2690
|
} finally {
|
|
2054
|
-
if (stage) await
|
|
2691
|
+
if (stage) await rm3(stage, { recursive: true, force: true });
|
|
2055
2692
|
}
|
|
2056
2693
|
}
|
|
2057
2694
|
|
|
2058
2695
|
// src/lib/server/setup/remembered.ts
|
|
2059
2696
|
import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
2060
|
-
import
|
|
2697
|
+
import path8 from "node:path";
|
|
2061
2698
|
var REMEMBERED_FILE = "firstmate.json";
|
|
2062
|
-
var rememberedFile = (configDir) =>
|
|
2699
|
+
var rememberedFile = (configDir) => path8.join(configDir, REMEMBERED_FILE);
|
|
2063
2700
|
function readRemembered(configDir) {
|
|
2064
2701
|
let raw;
|
|
2065
2702
|
try {
|
|
@@ -2069,8 +2706,8 @@ function readRemembered(configDir) {
|
|
|
2069
2706
|
}
|
|
2070
2707
|
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return null;
|
|
2071
2708
|
const { firstmate, home } = raw;
|
|
2072
|
-
if (typeof firstmate !== "string" || !
|
|
2073
|
-
if (home !== void 0 && home !== null && (typeof home !== "string" || !
|
|
2709
|
+
if (typeof firstmate !== "string" || !path8.isAbsolute(firstmate)) return null;
|
|
2710
|
+
if (home !== void 0 && home !== null && (typeof home !== "string" || !path8.isAbsolute(home))) {
|
|
2074
2711
|
return null;
|
|
2075
2712
|
}
|
|
2076
2713
|
return { firstmate, home: typeof home === "string" ? home : null };
|
|
@@ -2078,7 +2715,7 @@ function readRemembered(configDir) {
|
|
|
2078
2715
|
|
|
2079
2716
|
// src/lib/server/store/store.ts
|
|
2080
2717
|
import { realpathSync } from "node:fs";
|
|
2081
|
-
import
|
|
2718
|
+
import path9 from "node:path";
|
|
2082
2719
|
|
|
2083
2720
|
// src/lib/inbox.ts
|
|
2084
2721
|
var SNOOZE_MS = 4 * 3600 * 1e3;
|
|
@@ -2102,22 +2739,22 @@ var SUMMARY_SYSTEM = [
|
|
|
2102
2739
|
|
|
2103
2740
|
// src/lib/server/store/store.ts
|
|
2104
2741
|
function defaultStateDir(env) {
|
|
2105
|
-
if (env.WHEELHOUSE_STATE_DIR) return
|
|
2106
|
-
if (env.XDG_STATE_HOME) return
|
|
2107
|
-
return
|
|
2742
|
+
if (env.WHEELHOUSE_STATE_DIR) return path9.resolve(env.WHEELHOUSE_STATE_DIR);
|
|
2743
|
+
if (env.XDG_STATE_HOME) return path9.join(path9.resolve(env.XDG_STATE_HOME), "wheelhouse");
|
|
2744
|
+
return path9.join(env.HOME ?? "", ".local", "state", "wheelhouse");
|
|
2108
2745
|
}
|
|
2109
2746
|
function real(p) {
|
|
2110
|
-
const abs =
|
|
2747
|
+
const abs = path9.resolve(p);
|
|
2111
2748
|
try {
|
|
2112
2749
|
return realpathSync(abs);
|
|
2113
2750
|
} catch {
|
|
2114
|
-
const parent =
|
|
2115
|
-
return parent === abs ? abs :
|
|
2751
|
+
const parent = path9.dirname(abs);
|
|
2752
|
+
return parent === abs ? abs : path9.join(real(parent), path9.basename(abs));
|
|
2116
2753
|
}
|
|
2117
2754
|
}
|
|
2118
2755
|
function isInside(p, dir) {
|
|
2119
|
-
const rel =
|
|
2120
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
2756
|
+
const rel = path9.relative(real(dir), real(p));
|
|
2757
|
+
return rel === "" || !rel.startsWith("..") && !path9.isAbsolute(rel);
|
|
2121
2758
|
}
|
|
2122
2759
|
|
|
2123
2760
|
// src/lib/server/restart.ts
|
|
@@ -2129,9 +2766,9 @@ function setRestart(fn) {
|
|
|
2129
2766
|
|
|
2130
2767
|
// src/lib/server/upgrade/settings.ts
|
|
2131
2768
|
import { existsSync as existsSync2, readFileSync as readFileSync2, rmSync } from "node:fs";
|
|
2132
|
-
import
|
|
2133
|
-
var updateDir = (configDir) =>
|
|
2134
|
-
var handoffFile = (configDir) =>
|
|
2769
|
+
import path10 from "node:path";
|
|
2770
|
+
var updateDir = (configDir) => path10.join(configDir, "update");
|
|
2771
|
+
var handoffFile = (configDir) => path10.join(updateDir(configDir), "next-install");
|
|
2135
2772
|
function takeHandoff(configDir) {
|
|
2136
2773
|
const file = handoffFile(configDir);
|
|
2137
2774
|
let dir;
|
|
@@ -2141,13 +2778,13 @@ function takeHandoff(configDir) {
|
|
|
2141
2778
|
return null;
|
|
2142
2779
|
}
|
|
2143
2780
|
rmSync(file, { force: true });
|
|
2144
|
-
if (!dir || !
|
|
2145
|
-
const built = existsSync2(
|
|
2781
|
+
if (!dir || !path10.isAbsolute(dir)) return null;
|
|
2782
|
+
const built = existsSync2(path10.join(dir, "dist", "cli.js")) && existsSync2(path10.join(dir, "build", "handler.js"));
|
|
2146
2783
|
return built ? dir : null;
|
|
2147
2784
|
}
|
|
2148
2785
|
|
|
2149
2786
|
// cli/gateway.ts
|
|
2150
|
-
import
|
|
2787
|
+
import path12 from "node:path";
|
|
2151
2788
|
import { Argument, Command, InvalidArgumentError } from "commander";
|
|
2152
2789
|
|
|
2153
2790
|
// src/lib/gateway.ts
|
|
@@ -2279,19 +2916,19 @@ async function checkDiscordToken(token, opts = {}) {
|
|
|
2279
2916
|
var inviteUrl = (appId) => `https://discord.com/oauth2/authorize?client_id=${encodeURIComponent(appId)}&scope=bot&permissions=0`;
|
|
2280
2917
|
|
|
2281
2918
|
// src/lib/server/gateway/settings.ts
|
|
2282
|
-
import { createHash as
|
|
2919
|
+
import { createHash as createHash5, randomBytes as randomBytes5 } from "node:crypto";
|
|
2283
2920
|
import {
|
|
2284
2921
|
chmod as chmod2,
|
|
2285
2922
|
lstat as lstat3,
|
|
2286
|
-
mkdir as
|
|
2287
|
-
readFile as
|
|
2923
|
+
mkdir as mkdir6,
|
|
2924
|
+
readFile as readFile6,
|
|
2288
2925
|
realpath as realpath3,
|
|
2289
|
-
rename as
|
|
2290
|
-
rm as
|
|
2926
|
+
rename as rename6,
|
|
2927
|
+
rm as rm4,
|
|
2291
2928
|
stat as stat4,
|
|
2292
|
-
writeFile as
|
|
2929
|
+
writeFile as writeFile6
|
|
2293
2930
|
} from "node:fs/promises";
|
|
2294
|
-
import
|
|
2931
|
+
import path11 from "node:path";
|
|
2295
2932
|
|
|
2296
2933
|
// src/lib/bell.ts
|
|
2297
2934
|
var ALERT_KINDS = [
|
|
@@ -2310,7 +2947,7 @@ var QUIET_AFTER_MS = 20 * 6e4;
|
|
|
2310
2947
|
// src/lib/server/gateway/settings.ts
|
|
2311
2948
|
var GATEWAY_SETTINGS_SCHEMA = "wheelhouse-gateway-settings.v1";
|
|
2312
2949
|
var SETTINGS_FILE = "settings.json";
|
|
2313
|
-
var gatewayDir = (configDir) =>
|
|
2950
|
+
var gatewayDir = (configDir) => path11.join(configDir, "gateway");
|
|
2314
2951
|
function defaultSettings() {
|
|
2315
2952
|
return Object.fromEntries(
|
|
2316
2953
|
GATEWAY_CHANNELS.map((c) => [
|
|
@@ -2343,13 +2980,13 @@ function parseChannel(v, fallback) {
|
|
|
2343
2980
|
};
|
|
2344
2981
|
}
|
|
2345
2982
|
async function writeAtomic2(file, text2) {
|
|
2346
|
-
await
|
|
2347
|
-
const tmp = `${file}.tmp-${process.pid}-${
|
|
2983
|
+
await mkdir6(path11.dirname(file), { recursive: true, mode: 448 });
|
|
2984
|
+
const tmp = `${file}.tmp-${process.pid}-${randomBytes5(4).toString("hex")}`;
|
|
2348
2985
|
try {
|
|
2349
|
-
await
|
|
2350
|
-
await
|
|
2986
|
+
await writeFile6(tmp, text2, { mode: 384 });
|
|
2987
|
+
await rename6(tmp, file);
|
|
2351
2988
|
} catch (e) {
|
|
2352
|
-
await
|
|
2989
|
+
await rm4(tmp, { force: true });
|
|
2353
2990
|
throw e;
|
|
2354
2991
|
}
|
|
2355
2992
|
}
|
|
@@ -2361,17 +2998,17 @@ var GatewaySettings = class {
|
|
|
2361
2998
|
dir;
|
|
2362
2999
|
keychain;
|
|
2363
3000
|
get file() {
|
|
2364
|
-
return
|
|
3001
|
+
return path11.join(this.dir, SETTINGS_FILE);
|
|
2365
3002
|
}
|
|
2366
3003
|
tokenFile(channel) {
|
|
2367
|
-
return
|
|
3004
|
+
return path11.join(this.dir, `${channel}.token`);
|
|
2368
3005
|
}
|
|
2369
3006
|
/** The settings, with defaults for anything missing; an unreadable file reads as the defaults, with why. */
|
|
2370
3007
|
async read() {
|
|
2371
3008
|
const settings2 = defaultSettings();
|
|
2372
3009
|
let text2;
|
|
2373
3010
|
try {
|
|
2374
|
-
text2 = await
|
|
3011
|
+
text2 = await readFile6(this.file, "utf8");
|
|
2375
3012
|
} catch (e) {
|
|
2376
3013
|
if (e.code === "ENOENT") return { settings: settings2, error: null };
|
|
2377
3014
|
return { settings: settings2, error: `${this.file} could not be read: ${e.message}` };
|
|
@@ -2414,7 +3051,7 @@ var GatewaySettings = class {
|
|
|
2414
3051
|
const s = await lstat3(file);
|
|
2415
3052
|
if (!s.isFile()) return null;
|
|
2416
3053
|
if ((s.mode & 63) !== 0) await chmod2(file, 384);
|
|
2417
|
-
const token = cleanToken(await
|
|
3054
|
+
const token = cleanToken(await readFile6(file, "utf8"));
|
|
2418
3055
|
return token ? { token, where: file } : null;
|
|
2419
3056
|
} catch {
|
|
2420
3057
|
return null;
|
|
@@ -2429,12 +3066,12 @@ var GatewaySettings = class {
|
|
|
2429
3066
|
* directory has its own token.
|
|
2430
3067
|
*/
|
|
2431
3068
|
async keychainAccount(channel) {
|
|
2432
|
-
const real2 = await realpath3(this.dir).catch(() =>
|
|
2433
|
-
return `${channel}:${
|
|
3069
|
+
const real2 = await realpath3(this.dir).catch(() => path11.resolve(this.dir));
|
|
3070
|
+
return `${channel}:${createHash5("sha256").update(real2).digest("hex").slice(0, 16)}`;
|
|
2434
3071
|
}
|
|
2435
3072
|
/** Keep the token in the Keychain, else in its file, replacing the one before; returns where it went. */
|
|
2436
3073
|
async setToken(channel, token) {
|
|
2437
|
-
await
|
|
3074
|
+
await mkdir6(this.dir, { recursive: true, mode: 448 });
|
|
2438
3075
|
const keychain = this.keychain;
|
|
2439
3076
|
const account = await this.keychainAccount(channel);
|
|
2440
3077
|
const kept = keychain ? await keychain.set(account, token).then(
|
|
@@ -2442,7 +3079,7 @@ var GatewaySettings = class {
|
|
|
2442
3079
|
() => false
|
|
2443
3080
|
) : false;
|
|
2444
3081
|
if (kept) {
|
|
2445
|
-
await
|
|
3082
|
+
await rm4(this.tokenFile(channel), { force: true });
|
|
2446
3083
|
} else {
|
|
2447
3084
|
await keychain?.remove(account).catch(() => false);
|
|
2448
3085
|
await writeAtomic2(this.tokenFile(channel), `${token}
|
|
@@ -2548,7 +3185,7 @@ function gatewayCommand(over = {}) {
|
|
|
2548
3185
|
);
|
|
2549
3186
|
const settingsFor = (c) => {
|
|
2550
3187
|
const dir = c.optsWithGlobals().configDir;
|
|
2551
|
-
const configDir = dir ?
|
|
3188
|
+
const configDir = dir ? path12.resolve(dir) : defaultConfigDir(deps.env);
|
|
2552
3189
|
const found = resolveInstall({
|
|
2553
3190
|
cwd: process.cwd(),
|
|
2554
3191
|
env: deps.env,
|
|
@@ -2668,17 +3305,17 @@ function gatewayCommand(over = {}) {
|
|
|
2668
3305
|
}
|
|
2669
3306
|
|
|
2670
3307
|
// cli/plugin.ts
|
|
2671
|
-
import { createInterface } from "node:readline/promises";
|
|
2672
|
-
import
|
|
3308
|
+
import { createInterface as createInterface2 } from "node:readline/promises";
|
|
3309
|
+
import path16 from "node:path";
|
|
2673
3310
|
import { Command as Command2 } from "commander";
|
|
2674
3311
|
|
|
2675
3312
|
// src/lib/server/plugins/install.ts
|
|
2676
3313
|
import { execFile } from "node:child_process";
|
|
2677
|
-
import { mkdir as
|
|
2678
|
-
import
|
|
3314
|
+
import { mkdir as mkdir7, mkdtemp as mkdtemp2, readFile as readFile7, realpath as realpath4, rename as rename7, rm as rm5, stat as stat5 } from "node:fs/promises";
|
|
3315
|
+
import path14 from "node:path";
|
|
2679
3316
|
|
|
2680
3317
|
// src/lib/server/plugins/manifest.ts
|
|
2681
|
-
import
|
|
3318
|
+
import path13 from "node:path";
|
|
2682
3319
|
|
|
2683
3320
|
// src/lib/plugins/addresses.ts
|
|
2684
3321
|
var TEMPLATE = /^[a-z0-9-]*\{port\}[a-z0-9-]*(?:\.[a-z0-9-]+)*\.localhost$/;
|
|
@@ -2709,7 +3346,7 @@ var SUPPORTED_API_VERSIONS = [PLUGIN_API_VERSION, PLUGIN_API_VERSION - 1].filter
|
|
|
2709
3346
|
// src/lib/server/plugins/manifest.ts
|
|
2710
3347
|
var MANIFEST_DIR = ".wheelhouse-plugin";
|
|
2711
3348
|
var MANIFEST_FILE = "plugin.json";
|
|
2712
|
-
var manifestPath = (pluginDir) =>
|
|
3349
|
+
var manifestPath = (pluginDir) => path13.join(pluginDir, MANIFEST_DIR, MANIFEST_FILE);
|
|
2713
3350
|
var MANIFEST_FIELDS = [
|
|
2714
3351
|
"$schema",
|
|
2715
3352
|
"name",
|
|
@@ -2756,7 +3393,7 @@ var SEMVER = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
|
2756
3393
|
var MAX_TEXT = 400;
|
|
2757
3394
|
var isRecord3 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
2758
3395
|
function insidePath(f) {
|
|
2759
|
-
return typeof f === "string" && f.length > 0 && !
|
|
3396
|
+
return typeof f === "string" && f.length > 0 && !path13.isAbsolute(f) && !f.split(/[\\/]/).some((part) => part === ".." || part === "" || part === ".");
|
|
2760
3397
|
}
|
|
2761
3398
|
var ICON_TYPES = {
|
|
2762
3399
|
".svg": "image/svg+xml",
|
|
@@ -2854,7 +3491,7 @@ function wheelhouse(v) {
|
|
|
2854
3491
|
}
|
|
2855
3492
|
if (!insidePath(c.icon))
|
|
2856
3493
|
throw new Invalid(`${where}.icon must be a plain path inside the plugin`);
|
|
2857
|
-
if (!ICON_TYPES[
|
|
3494
|
+
if (!ICON_TYPES[path13.extname(c.icon).toLowerCase()]) {
|
|
2858
3495
|
throw new Invalid(`${where}.icon must be an image: ${Object.keys(ICON_TYPES).join(", ")}`);
|
|
2859
3496
|
}
|
|
2860
3497
|
declared.icon = c.icon;
|
|
@@ -3207,13 +3844,13 @@ async function fetchSource(source, into, deps) {
|
|
|
3207
3844
|
await step(["checkout", "-q", "--detach", "FETCH_HEAD"]);
|
|
3208
3845
|
}
|
|
3209
3846
|
const commit = await step(["rev-parse", "HEAD"]);
|
|
3210
|
-
await
|
|
3847
|
+
await rm5(path14.join(into, ".git"), { recursive: true, force: true });
|
|
3211
3848
|
return commit;
|
|
3212
3849
|
}
|
|
3213
3850
|
async function checkCopy(dir) {
|
|
3214
3851
|
let text2;
|
|
3215
3852
|
try {
|
|
3216
|
-
text2 = await
|
|
3853
|
+
text2 = await readFile7(manifestPath(dir), "utf8");
|
|
3217
3854
|
} catch {
|
|
3218
3855
|
throw new Refused("it has no .wheelhouse-plugin/plugin.json, so it is not a Wheelhouse plugin");
|
|
3219
3856
|
}
|
|
@@ -3228,12 +3865,12 @@ async function checkCopy(dir) {
|
|
|
3228
3865
|
if (!rel) continue;
|
|
3229
3866
|
let file;
|
|
3230
3867
|
try {
|
|
3231
|
-
file = await realpath4(
|
|
3868
|
+
file = await realpath4(path14.join(base, rel));
|
|
3232
3869
|
if (!(await stat5(file)).isFile()) throw new Error();
|
|
3233
3870
|
} catch {
|
|
3234
3871
|
throw new Refused(`its ${what} ${rel} is missing`);
|
|
3235
3872
|
}
|
|
3236
|
-
if (!file.startsWith(base +
|
|
3873
|
+
if (!file.startsWith(base + path14.sep))
|
|
3237
3874
|
throw new Refused(`its ${what} leads outside the plugin`);
|
|
3238
3875
|
}
|
|
3239
3876
|
return m;
|
|
@@ -3275,12 +3912,12 @@ function describeManifest(m, from, commit) {
|
|
|
3275
3912
|
];
|
|
3276
3913
|
}
|
|
3277
3914
|
async function withStaging(dir, work) {
|
|
3278
|
-
await
|
|
3279
|
-
const staging = await mkdtemp2(
|
|
3915
|
+
await mkdir7(dir, { recursive: true });
|
|
3916
|
+
const staging = await mkdtemp2(path14.join(dir, ".staging-"));
|
|
3280
3917
|
try {
|
|
3281
3918
|
return await work(staging);
|
|
3282
3919
|
} finally {
|
|
3283
|
-
await
|
|
3920
|
+
await rm5(staging, { recursive: true, force: true });
|
|
3284
3921
|
}
|
|
3285
3922
|
}
|
|
3286
3923
|
async function guarded(work) {
|
|
@@ -3313,7 +3950,7 @@ async function settle(m, deps, o) {
|
|
|
3313
3950
|
async function keepSettings(id, settings2, deps) {
|
|
3314
3951
|
const w = await writePluginSettings(deps.configDir, id, settings2);
|
|
3315
3952
|
if (!w.ok) throw new Refused(`could not keep ${id}'s settings: ${w.error}`);
|
|
3316
|
-
deps.log(`Kept ${id}'s settings in ${
|
|
3953
|
+
deps.log(`Kept ${id}'s settings in ${path14.join(deps.configDir, PLUGINS_FILE)}.`);
|
|
3317
3954
|
}
|
|
3318
3955
|
async function reload(deps, what, yes) {
|
|
3319
3956
|
const r = await deps.restart(async (url, busy) => {
|
|
@@ -3354,7 +3991,7 @@ function install(spec, deps, o = {}) {
|
|
|
3354
3991
|
const commit = await fetchSource(source, staging, deps);
|
|
3355
3992
|
expected(commit, o.expect, repository);
|
|
3356
3993
|
const m = await checkCopy(staging);
|
|
3357
|
-
const target =
|
|
3994
|
+
const target = path14.join(deps.dir, m.name);
|
|
3358
3995
|
if (installed.plugins[m.name]) {
|
|
3359
3996
|
throw new Refused(
|
|
3360
3997
|
`${m.name} is already installed from ${label(installed.plugins[m.name])}; use \`wheelhouse plugin update ${m.name}\``
|
|
@@ -3374,7 +4011,7 @@ function install(spec, deps, o = {}) {
|
|
|
3374
4011
|
}
|
|
3375
4012
|
const settings2 = await settle(m, deps, { yes: o.yes, given: answers });
|
|
3376
4013
|
if (settings2) await keepSettings(m.name, settings2, deps);
|
|
3377
|
-
await
|
|
4014
|
+
await rename7(staging, target);
|
|
3378
4015
|
installed.plugins[m.name] = {
|
|
3379
4016
|
repository,
|
|
3380
4017
|
ref: source.ref,
|
|
@@ -3429,17 +4066,17 @@ function update(id, deps, o = {}) {
|
|
|
3429
4066
|
if (!o.yes && !await deps.confirm(`Update ${id}?`)) throw new Refused("not updated");
|
|
3430
4067
|
const settings2 = await settle(m, deps, { yes: o.yes, given: answers });
|
|
3431
4068
|
if (settings2) await keepSettings(id, settings2, deps);
|
|
3432
|
-
const target =
|
|
3433
|
-
const old = await mkdtemp2(
|
|
3434
|
-
const parked =
|
|
3435
|
-
if (await exists(target)) await
|
|
4069
|
+
const target = path14.join(deps.dir, id);
|
|
4070
|
+
const old = await mkdtemp2(path14.join(deps.dir, ".old-"));
|
|
4071
|
+
const parked = path14.join(old, id);
|
|
4072
|
+
if (await exists(target)) await rename7(target, parked);
|
|
3436
4073
|
try {
|
|
3437
|
-
await
|
|
4074
|
+
await rename7(staging, target);
|
|
3438
4075
|
} catch (e) {
|
|
3439
|
-
if (await exists(parked)) await
|
|
4076
|
+
if (await exists(parked)) await rename7(parked, target);
|
|
3440
4077
|
throw e;
|
|
3441
4078
|
} finally {
|
|
3442
|
-
await
|
|
4079
|
+
await rm5(old, { recursive: true, force: true });
|
|
3443
4080
|
}
|
|
3444
4081
|
installed.plugins[id] = {
|
|
3445
4082
|
...was,
|
|
@@ -3460,7 +4097,7 @@ function remove(id, deps, o = {}) {
|
|
|
3460
4097
|
if (!ID2.test(id)) throw new Refused(`"${id}" is not a plugin id`);
|
|
3461
4098
|
const installed = await record2(deps);
|
|
3462
4099
|
if (!installed.plugins[id]) throw new Refused(`${id} is not installed`);
|
|
3463
|
-
await
|
|
4100
|
+
await rm5(path14.join(deps.dir, id), { recursive: true, force: true });
|
|
3464
4101
|
delete installed.plugins[id];
|
|
3465
4102
|
await writeInstalled(deps.dir, installed);
|
|
3466
4103
|
deps.log(`Removed ${id}.`);
|
|
@@ -3506,19 +4143,19 @@ async function exists(p) {
|
|
|
3506
4143
|
}
|
|
3507
4144
|
|
|
3508
4145
|
// cli/running.ts
|
|
3509
|
-
import { randomBytes as
|
|
4146
|
+
import { randomBytes as randomBytes6, timingSafeEqual } from "node:crypto";
|
|
3510
4147
|
import { mkdirSync as mkdirSync2, rmSync as rmSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
3511
|
-
import { readdir as readdir2, readFile as
|
|
3512
|
-
import
|
|
4148
|
+
import { readdir as readdir2, readFile as readFile8, rm as rm6 } from "node:fs/promises";
|
|
4149
|
+
import path15 from "node:path";
|
|
3513
4150
|
var RESTART_EXIT = 75;
|
|
3514
4151
|
var RESTART_PATH = "/api/wheelhouse/restart";
|
|
3515
4152
|
var RUNNING_DIR = ".running";
|
|
3516
4153
|
var TIMEOUT_MS = 3e3;
|
|
3517
|
-
var newToken = () =>
|
|
4154
|
+
var newToken = () => randomBytes6(24).toString("hex");
|
|
3518
4155
|
function writeRunning(pluginsDir, r) {
|
|
3519
|
-
const dir =
|
|
4156
|
+
const dir = path15.join(pluginsDir, RUNNING_DIR);
|
|
3520
4157
|
mkdirSync2(dir, { recursive: true, mode: 448 });
|
|
3521
|
-
const file =
|
|
4158
|
+
const file = path15.join(dir, `${r.pid}.json`);
|
|
3522
4159
|
writeFileSync2(file, `${JSON.stringify(r)}
|
|
3523
4160
|
`, { mode: 384 });
|
|
3524
4161
|
return file;
|
|
@@ -3561,7 +4198,7 @@ var alive2 = (pid) => {
|
|
|
3561
4198
|
};
|
|
3562
4199
|
var refused = (e) => e.cause?.code === "ECONNREFUSED";
|
|
3563
4200
|
async function requestRestart(pluginsDir, proceed) {
|
|
3564
|
-
const dir =
|
|
4201
|
+
const dir = path15.join(pluginsDir, RUNNING_DIR);
|
|
3565
4202
|
const out = { restarted: [], failed: [], kept: [] };
|
|
3566
4203
|
let names;
|
|
3567
4204
|
try {
|
|
@@ -3570,17 +4207,17 @@ async function requestRestart(pluginsDir, proceed) {
|
|
|
3570
4207
|
return out;
|
|
3571
4208
|
}
|
|
3572
4209
|
for (const name of names) {
|
|
3573
|
-
const file =
|
|
4210
|
+
const file = path15.join(dir, name);
|
|
3574
4211
|
let r;
|
|
3575
4212
|
try {
|
|
3576
|
-
r = JSON.parse(await
|
|
4213
|
+
r = JSON.parse(await readFile8(file, "utf8"));
|
|
3577
4214
|
if (typeof r.url !== "string" || typeof r.token !== "string") throw new Error();
|
|
3578
4215
|
} catch {
|
|
3579
|
-
await
|
|
4216
|
+
await rm6(file, { force: true });
|
|
3580
4217
|
continue;
|
|
3581
4218
|
}
|
|
3582
4219
|
if (typeof r.pid === "number" && !alive2(r.pid)) {
|
|
3583
|
-
await
|
|
4220
|
+
await rm6(file, { force: true });
|
|
3584
4221
|
continue;
|
|
3585
4222
|
}
|
|
3586
4223
|
const headers = { authorization: `Bearer ${r.token}` };
|
|
@@ -3604,7 +4241,7 @@ async function requestRestart(pluginsDir, proceed) {
|
|
|
3604
4241
|
if (res.status === 202) out.restarted.push(r.url);
|
|
3605
4242
|
else out.failed.push({ url: r.url, reason: `it answered ${res.status}` });
|
|
3606
4243
|
} catch (e) {
|
|
3607
|
-
if (refused(e)) await
|
|
4244
|
+
if (refused(e)) await rm6(file, { force: true });
|
|
3608
4245
|
else out.failed.push({ url: r.url, reason: e.message });
|
|
3609
4246
|
}
|
|
3610
4247
|
}
|
|
@@ -3617,7 +4254,7 @@ async function askTerminal(question2) {
|
|
|
3617
4254
|
console.error("wheelhouse: no terminal to ask on; pass --yes to agree without asking.");
|
|
3618
4255
|
return false;
|
|
3619
4256
|
}
|
|
3620
|
-
const rl =
|
|
4257
|
+
const rl = createInterface2({ input: process.stdin, output: process.stdout });
|
|
3621
4258
|
try {
|
|
3622
4259
|
return /^y(es)?$/i.test((await rl.question(`${question2} [y/N] `)).trim());
|
|
3623
4260
|
} finally {
|
|
@@ -3626,7 +4263,7 @@ async function askTerminal(question2) {
|
|
|
3626
4263
|
}
|
|
3627
4264
|
async function askLine(question2) {
|
|
3628
4265
|
if (!process.stdin.isTTY) return null;
|
|
3629
|
-
const rl =
|
|
4266
|
+
const rl = createInterface2({ input: process.stdin, output: process.stdout });
|
|
3630
4267
|
try {
|
|
3631
4268
|
return await new Promise((resolve) => {
|
|
3632
4269
|
rl.once("close", () => resolve(null));
|
|
@@ -3649,10 +4286,10 @@ function pluginCommand(over = {}) {
|
|
|
3649
4286
|
);
|
|
3650
4287
|
const deps = (c) => {
|
|
3651
4288
|
const g2 = c.optsWithGlobals();
|
|
3652
|
-
const dir = g2.pluginsDir ?
|
|
4289
|
+
const dir = g2.pluginsDir ? path16.resolve(g2.pluginsDir) : defaultPluginsDir(env);
|
|
3653
4290
|
return {
|
|
3654
4291
|
dir,
|
|
3655
|
-
configDir: g2.configDir ?
|
|
4292
|
+
configDir: g2.configDir ? path16.resolve(g2.configDir) : defaultConfigDir(env),
|
|
3656
4293
|
confirm: askTerminal,
|
|
3657
4294
|
ask: askLine,
|
|
3658
4295
|
restart: (proceed) => requestRestart(dir, proceed),
|
|
@@ -3687,7 +4324,7 @@ function pluginCommand(over = {}) {
|
|
|
3687
4324
|
}
|
|
3688
4325
|
|
|
3689
4326
|
// cli/remote.ts
|
|
3690
|
-
import
|
|
4327
|
+
import path17 from "node:path";
|
|
3691
4328
|
import { Command as Command3, InvalidArgumentError as InvalidArgumentError2 } from "commander";
|
|
3692
4329
|
|
|
3693
4330
|
// src/lib/server/cloud/pairing.ts
|
|
@@ -3701,13 +4338,18 @@ async function keepDevice(settings2, gateway, key, name, device, opts = {}) {
|
|
|
3701
4338
|
x.enabled = true;
|
|
3702
4339
|
if (opts.start) x.started = true;
|
|
3703
4340
|
x.gateway = gateway;
|
|
4341
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3704
4342
|
x.device = {
|
|
3705
4343
|
id: device.deviceId,
|
|
3706
4344
|
name: device.name || name,
|
|
3707
4345
|
gateway,
|
|
3708
4346
|
publicKey: key.publicKey,
|
|
3709
4347
|
user: device.user,
|
|
3710
|
-
pairedAt:
|
|
4348
|
+
pairedAt: now,
|
|
4349
|
+
pins: device.pins,
|
|
4350
|
+
pinnedAt: device.pins ? now : null,
|
|
4351
|
+
pending: null,
|
|
4352
|
+
undelivered: []
|
|
3711
4353
|
};
|
|
3712
4354
|
});
|
|
3713
4355
|
return where;
|
|
@@ -3729,10 +4371,12 @@ async function post(f, url, payload) {
|
|
|
3729
4371
|
var unreachable = (gateway, e) => `The gateway at ${gateway} could not be reached: ${e.message}`;
|
|
3730
4372
|
async function startPairing(gateway, key, machine, deps = {}) {
|
|
3731
4373
|
const f = deps.fetch ?? fetch;
|
|
4374
|
+
const pinChallenge = newChallenge("pair");
|
|
3732
4375
|
let r;
|
|
3733
4376
|
try {
|
|
3734
4377
|
r = await post(f, `${gateway}/v1/pair/start`, {
|
|
3735
4378
|
protocol: PROTOCOL,
|
|
4379
|
+
pin: { challenge: pinChallenge },
|
|
3736
4380
|
publicKey: key.publicKey,
|
|
3737
4381
|
name: machine.name.slice(0, 60) || "Wheelhouse",
|
|
3738
4382
|
platform: machine.platform.slice(0, 40),
|
|
@@ -3763,7 +4407,8 @@ async function startPairing(gateway, key, machine, deps = {}) {
|
|
|
3763
4407
|
verificationUri: `${gateway}/pair`,
|
|
3764
4408
|
fingerprint: typeof b.fingerprint === "string" ? b.fingerprint : "",
|
|
3765
4409
|
expiresIn: typeof b.expiresIn === "number" ? b.expiresIn : 600,
|
|
3766
|
-
interval: typeof b.interval === "number" && b.interval > 0 ? b.interval : 3
|
|
4410
|
+
interval: typeof b.interval === "number" && b.interval > 0 ? b.interval : 3,
|
|
4411
|
+
pinChallenge
|
|
3767
4412
|
};
|
|
3768
4413
|
if (!start.pairingId || !/^[23456789BCDFGHJKLMNPQRSTVWXZ]{4}-?[23456789BCDFGHJKLMNPQRSTVWXZ]{4}$/i.test(start.userCode)) {
|
|
3769
4414
|
return {
|
|
@@ -3821,9 +4466,22 @@ async function pollPairing(gateway, key, start, deps = {}) {
|
|
|
3821
4466
|
}
|
|
3822
4467
|
if (b.status === "approved" && typeof b.deviceId === "string" && b.deviceId) {
|
|
3823
4468
|
const user = isObj5(b.user) && typeof b.user.name === "string" ? b.user.name : null;
|
|
4469
|
+
const pinned = approvedPins(b.pins, start.pinChallenge, gateway);
|
|
4470
|
+
if (!pinned.ok) {
|
|
4471
|
+
await unpair(gateway, key, b.deviceId, deps);
|
|
4472
|
+
return {
|
|
4473
|
+
status: "failed",
|
|
4474
|
+
reason: `The approval\u2019s passkey signature did not check out on this machine (${pinned.problem}), so it was not paired. Do not use this gateway until you know why.`
|
|
4475
|
+
};
|
|
4476
|
+
}
|
|
3824
4477
|
return {
|
|
3825
4478
|
status: "approved",
|
|
3826
|
-
device: {
|
|
4479
|
+
device: {
|
|
4480
|
+
deviceId: b.deviceId,
|
|
4481
|
+
name: typeof b.name === "string" ? b.name : "",
|
|
4482
|
+
user,
|
|
4483
|
+
pins: pinned.pins
|
|
4484
|
+
}
|
|
3827
4485
|
};
|
|
3828
4486
|
}
|
|
3829
4487
|
if (b.status === "denied")
|
|
@@ -3833,6 +4491,19 @@ async function pollPairing(gateway, key, start, deps = {}) {
|
|
|
3833
4491
|
}
|
|
3834
4492
|
return { status: "expired", reason: "The code expired before it was approved." };
|
|
3835
4493
|
}
|
|
4494
|
+
function approvedPins(v, challenge, gateway) {
|
|
4495
|
+
if (v === void 0) return { ok: true, pins: null };
|
|
4496
|
+
const pins = isObj5(v) ? parsePasskeys(v.passkeys) : null;
|
|
4497
|
+
if (!pins || !isObj5(v)) return { ok: false, problem: "the passkeys it names are malformed" };
|
|
4498
|
+
const origin = new URL(gateway).origin;
|
|
4499
|
+
const problem = assertionProblem(v.assertion, {
|
|
4500
|
+
purpose: "pair",
|
|
4501
|
+
challenge,
|
|
4502
|
+
origin,
|
|
4503
|
+
passkeys: pins
|
|
4504
|
+
});
|
|
4505
|
+
return problem ? { ok: false, problem } : { ok: true, pins };
|
|
4506
|
+
}
|
|
3836
4507
|
async function unpair(gateway, key, deviceId, deps = {}) {
|
|
3837
4508
|
const f = deps.fetch ?? fetch;
|
|
3838
4509
|
const ts = (deps.now ?? Date.now)();
|
|
@@ -3907,6 +4578,37 @@ function waitForSignal() {
|
|
|
3907
4578
|
process.once("SIGTERM", () => resolve());
|
|
3908
4579
|
});
|
|
3909
4580
|
}
|
|
4581
|
+
function trusted(passkeys) {
|
|
4582
|
+
if (passkeys === null) {
|
|
4583
|
+
return [
|
|
4584
|
+
"not checked here: this machine was paired without passkeys, so it serves any session the gateway opens. Revoke it and pair it again to have it check each one."
|
|
4585
|
+
];
|
|
4586
|
+
}
|
|
4587
|
+
if (!passkeys.length) {
|
|
4588
|
+
return [
|
|
4589
|
+
"could not be read, so this machine refuses every session. Revoke it and pair it again."
|
|
4590
|
+
];
|
|
4591
|
+
}
|
|
4592
|
+
return [
|
|
4593
|
+
"only a session one of these signs is served:",
|
|
4594
|
+
...passkeys.map((p) => ` ${p.fingerprint} ${p.name || "(unnamed)"}`)
|
|
4595
|
+
];
|
|
4596
|
+
}
|
|
4597
|
+
function pendingLines(p) {
|
|
4598
|
+
const when = new Date(p.requestedAt).toLocaleString();
|
|
4599
|
+
return [
|
|
4600
|
+
`the gateway asked, ${when}${p.signedBy ? `, signed with ${p.signedBy}` : ""}, for this machine to trust instead:`,
|
|
4601
|
+
...p.passkeys.map(
|
|
4602
|
+
(k) => ` ${k.fingerprint} ${k.name || "(unnamed)"}${k.added ? " (new)" : ""}`
|
|
4603
|
+
),
|
|
4604
|
+
...p.removed.length ? [
|
|
4605
|
+
"and to stop trusting:",
|
|
4606
|
+
...p.removed.map((k) => ` ${k.fingerprint} ${k.name || "(unnamed)"}`)
|
|
4607
|
+
] : [],
|
|
4608
|
+
"Approve only a change you started yourself, after checking each new fingerprint against the passkey or authenticator itself, or a device you trust: not against the gateway\u2019s Account page, which the gateway serves.",
|
|
4609
|
+
`Nothing changes until you decide, here, by ${new Date(p.expiresAt).toLocaleTimeString()}, naming this change by its id: wheelhouse remote pins approve ${p.id.slice(0, 8)}, or reject ${p.id.slice(0, 8)}.`
|
|
4610
|
+
];
|
|
4611
|
+
}
|
|
3910
4612
|
var ago = (iso) => {
|
|
3911
4613
|
if (!iso) return "never";
|
|
3912
4614
|
const s = Math.max(0, Math.round((Date.now() - Date.parse(iso)) / 1e3));
|
|
@@ -3936,7 +4638,7 @@ function remoteCommand(over = {}) {
|
|
|
3936
4638
|
};
|
|
3937
4639
|
const settingsFor = (c) => {
|
|
3938
4640
|
const dir = c.optsWithGlobals().configDir;
|
|
3939
|
-
const configDir = dir ?
|
|
4641
|
+
const configDir = dir ? path17.resolve(dir) : defaultConfigDir(deps.env);
|
|
3940
4642
|
const found = resolveInstall({ cwd: process.cwd(), env: deps.env });
|
|
3941
4643
|
if (found.ok && isInside(configDir, found.install.homeDir)) {
|
|
3942
4644
|
fail(
|
|
@@ -3967,6 +4669,16 @@ function remoteCommand(over = {}) {
|
|
|
3967
4669
|
`Connected: ${device.name || name}${device.user ? `, approved by ${device.user}` : ""}.`
|
|
3968
4670
|
);
|
|
3969
4671
|
deps.log(`Its key is kept in ${where}, readable by you only; it never leaves this machine.`);
|
|
4672
|
+
if (device.pins) {
|
|
4673
|
+
deps.log(
|
|
4674
|
+
"It checks each session itself: only a session one of these passkeys signs is served (check their fingerprints against your passkeys or authenticators themselves, or a device you trust, not only a page the gateway serves):"
|
|
4675
|
+
);
|
|
4676
|
+
for (const p of device.pins) deps.log(` ${passkeyFingerprint(p)} ${p.name || "(unnamed)"}`);
|
|
4677
|
+
} else {
|
|
4678
|
+
deps.log(
|
|
4679
|
+
"Warning: the gateway pinned none of your passkeys (it speaks only protocol 1), so this machine does not check sessions itself: it serves any session the gateway opens. Pair it again once the gateway is updated."
|
|
4680
|
+
);
|
|
4681
|
+
}
|
|
3970
4682
|
};
|
|
3971
4683
|
cmd.command("connect").description(
|
|
3972
4684
|
"Pair this machine with a gateway: shows a code to type there and a fingerprint to check."
|
|
@@ -4007,7 +4719,9 @@ function remoteCommand(over = {}) {
|
|
|
4007
4719
|
"Start it on the Remotes page in Wheelhouse, which keeps the connection up while `wheelhouse open` runs; or run `wheelhouse remote run`."
|
|
4008
4720
|
);
|
|
4009
4721
|
});
|
|
4010
|
-
cmd.command("status").description(
|
|
4722
|
+
cmd.command("status").description(
|
|
4723
|
+
"Show whether this machine is connected, since when, the passkeys it trusts to sign its sessions, and its relay sessions."
|
|
4724
|
+
).action(async (_o, c) => {
|
|
4011
4725
|
const settings2 = settingsFor(c);
|
|
4012
4726
|
if (!settings2) return;
|
|
4013
4727
|
const v = await settings2.view();
|
|
@@ -4021,6 +4735,16 @@ function remoteCommand(over = {}) {
|
|
|
4021
4735
|
` Machine: ${v.device ? `${v.device.name} (fingerprint ${v.device.fingerprint})${v.device.user ? `, approved by ${v.device.user}` : ""}` : "not paired (wheelhouse remote connect)"}`
|
|
4022
4736
|
);
|
|
4023
4737
|
if (v.keyStore) deps.log(` Key: ${v.keyStore}`);
|
|
4738
|
+
if (v.device) {
|
|
4739
|
+
const [first, ...rest] = trusted(v.device.passkeys);
|
|
4740
|
+
deps.log(` Sessions: ${first}`);
|
|
4741
|
+
for (const line of rest) deps.log(` ${line}`);
|
|
4742
|
+
if (v.device.pending) {
|
|
4743
|
+
const [ask, ...more] = pendingLines(v.device.pending);
|
|
4744
|
+
deps.log(` Pending: ${ask}`);
|
|
4745
|
+
for (const line of more) deps.log(` ${line}`);
|
|
4746
|
+
}
|
|
4747
|
+
}
|
|
4024
4748
|
const states = {
|
|
4025
4749
|
off: "off (not started)",
|
|
4026
4750
|
"not-paired": "not paired",
|
|
@@ -4040,6 +4764,49 @@ function remoteCommand(over = {}) {
|
|
|
4040
4764
|
}
|
|
4041
4765
|
}
|
|
4042
4766
|
});
|
|
4767
|
+
const pins = cmd.command("pins").description(
|
|
4768
|
+
"Show the passkeys this machine trusts to sign its sessions, and any change of them the gateway asked for."
|
|
4769
|
+
).action(async (_o, c) => {
|
|
4770
|
+
const settings2 = settingsFor(c);
|
|
4771
|
+
if (!settings2) return;
|
|
4772
|
+
const v = await settings2.view();
|
|
4773
|
+
if (!v.device) return deps.log("This machine is not paired (wheelhouse remote connect).");
|
|
4774
|
+
for (const line of trusted(v.device.passkeys)) deps.log(line);
|
|
4775
|
+
if (v.device.pending) for (const line of pendingLines(v.device.pending)) deps.log(line);
|
|
4776
|
+
else deps.log("No change of them is waiting.");
|
|
4777
|
+
});
|
|
4778
|
+
for (const [name, approve] of [
|
|
4779
|
+
["approve", true],
|
|
4780
|
+
["reject", false]
|
|
4781
|
+
]) {
|
|
4782
|
+
pins.command(`${name} [id]`).description(
|
|
4783
|
+
approve ? "Approve the change of trusted passkeys the gateway asked for, named by its id (at least 8 characters, as `pins` shows it): this machine trusts them from now on." : "Reject the change of trusted passkeys the gateway asked for, named by its id (at least 8 characters, as `pins` shows it): this machine keeps trusting the passkeys it does."
|
|
4784
|
+
).action(async (id, _o, c) => {
|
|
4785
|
+
const settings2 = settingsFor(c);
|
|
4786
|
+
if (!settings2) return;
|
|
4787
|
+
const pending = (await settings2.view()).device?.pending;
|
|
4788
|
+
if (!pending) return fail("no change of trusted passkeys is waiting.");
|
|
4789
|
+
if (!id) {
|
|
4790
|
+
for (const line of pendingLines(pending)) deps.log(line);
|
|
4791
|
+
return fail(
|
|
4792
|
+
`name the change, by at least the 8 characters of its id: wheelhouse remote pins ${name} ${pending.id.slice(0, 8)}.`
|
|
4793
|
+
);
|
|
4794
|
+
}
|
|
4795
|
+
if (id.length < 8 || !pending.id.startsWith(id)) {
|
|
4796
|
+
return fail(
|
|
4797
|
+
`the change waiting is ${pending.id.slice(0, 8)}, not ${id}. Look again: wheelhouse remote pins.`
|
|
4798
|
+
);
|
|
4799
|
+
}
|
|
4800
|
+
const r = approve ? await settings2.approvePins(pending.id) : await settings2.rejectPins(pending.id);
|
|
4801
|
+
if (!r.ok) return fail(r.error);
|
|
4802
|
+
if (!approve) {
|
|
4803
|
+
return deps.log("Rejected: this machine keeps trusting the passkeys it did.");
|
|
4804
|
+
}
|
|
4805
|
+
deps.log("Approved: this machine now trusts only these passkeys to sign its sessions:");
|
|
4806
|
+
for (const k of pending.passkeys) deps.log(` ${k.fingerprint} ${k.name || "(unnamed)"}`);
|
|
4807
|
+
deps.log("A running connection takes them up within seconds.");
|
|
4808
|
+
});
|
|
4809
|
+
}
|
|
4043
4810
|
cmd.command("disconnect").description("Revoke this machine on its gateway and delete its key here.").action(async (_o, c) => {
|
|
4044
4811
|
const settings2 = settingsFor(c);
|
|
4045
4812
|
if (!settings2) return;
|
|
@@ -4230,14 +4997,14 @@ function supervise(opts) {
|
|
|
4230
4997
|
|
|
4231
4998
|
// cli/upgrade.ts
|
|
4232
4999
|
import { spawn as spawn3 } from "node:child_process";
|
|
4233
|
-
import
|
|
5000
|
+
import path19 from "node:path";
|
|
4234
5001
|
import { fileURLToPath } from "node:url";
|
|
4235
5002
|
import { Command as Command4 } from "commander";
|
|
4236
5003
|
|
|
4237
5004
|
// src/lib/server/upgrade/clone.ts
|
|
4238
5005
|
import { execFile as execFile2 } from "node:child_process";
|
|
4239
|
-
import { mkdir as
|
|
4240
|
-
import
|
|
5006
|
+
import { mkdir as mkdir8, readdir as readdir3, readFile as readFile9, realpath as realpath5 } from "node:fs/promises";
|
|
5007
|
+
import path18 from "node:path";
|
|
4241
5008
|
var COMMITS_SHOWN = 20;
|
|
4242
5009
|
var OUTPUT_KEPT = 6e4;
|
|
4243
5010
|
var runCommand = (cmd, args, cwd) => new Promise((resolve) => {
|
|
@@ -4283,7 +5050,7 @@ async function checkClone(deps) {
|
|
|
4283
5050
|
changes: []
|
|
4284
5051
|
};
|
|
4285
5052
|
out.current.version = packageVersion(
|
|
4286
|
-
await
|
|
5053
|
+
await readFile9(path18.join(deps.dir, "package.json"), "utf8").catch(() => null)
|
|
4287
5054
|
);
|
|
4288
5055
|
const top = await g2("rev-parse", "--show-toplevel");
|
|
4289
5056
|
const here = await realpath5(deps.dir).catch(() => deps.dir);
|
|
@@ -4409,7 +5176,7 @@ var CLONE_SETUP_STEPS = [
|
|
|
4409
5176
|
|
|
4410
5177
|
// cli/upgrade.ts
|
|
4411
5178
|
function installDir() {
|
|
4412
|
-
return
|
|
5179
|
+
return path19.resolve(path19.dirname(fileURLToPath(import.meta.url)), "..");
|
|
4413
5180
|
}
|
|
4414
5181
|
var runInherit = (cmd, args, cwd) => new Promise((resolve) => {
|
|
4415
5182
|
const child = spawn3(cmd, args, { cwd, stdio: "inherit" });
|
|
@@ -4482,7 +5249,7 @@ function upgradeCommand(over = {}) {
|
|
|
4482
5249
|
"--plugins-dir <dir>",
|
|
4483
5250
|
"the plugins directory the running Wheelhouse loads from, to find it (default: $WHEELHOUSE_PLUGINS_DIR, else ~/.wheelhouse/plugins)"
|
|
4484
5251
|
).action(async (o) => {
|
|
4485
|
-
const pluginsDir = o.pluginsDir ?
|
|
5252
|
+
const pluginsDir = o.pluginsDir ? path19.resolve(o.pluginsDir) : defaultPluginsDir(env);
|
|
4486
5253
|
const ok = await upgrade(
|
|
4487
5254
|
{
|
|
4488
5255
|
dir: installDir(),
|
|
@@ -4509,8 +5276,8 @@ function parsePort3(value) {
|
|
|
4509
5276
|
return n;
|
|
4510
5277
|
}
|
|
4511
5278
|
function handlerPath() {
|
|
4512
|
-
const here =
|
|
4513
|
-
return
|
|
5279
|
+
const here = path20.dirname(fileURLToPath2(import.meta.url));
|
|
5280
|
+
return path20.resolve(here, "..", "build", "handler.js");
|
|
4514
5281
|
}
|
|
4515
5282
|
function openBrowser(url) {
|
|
4516
5283
|
const [cmd, args] = process.platform === "darwin" ? ["open", [url]] : process.platform === "win32" ? ["cmd", ["/c", "start", '""', url]] : ["xdg-open", [url]];
|
|
@@ -4523,8 +5290,8 @@ function openBrowser(url) {
|
|
|
4523
5290
|
}
|
|
4524
5291
|
}
|
|
4525
5292
|
async function open2(opts) {
|
|
4526
|
-
const configDir = opts.configDir ?
|
|
4527
|
-
const stateDir = opts.stateDir ?
|
|
5293
|
+
const configDir = opts.configDir ? path20.resolve(opts.configDir) : defaultConfigDir(process.env);
|
|
5294
|
+
const stateDir = opts.stateDir ? path20.resolve(opts.stateDir) : defaultStateDir(process.env);
|
|
4528
5295
|
const resolved = resolveInstall({
|
|
4529
5296
|
firstmate: opts.firstmate,
|
|
4530
5297
|
home: opts.home,
|
|
@@ -4582,6 +5349,11 @@ async function open2(opts) {
|
|
|
4582
5349
|
if (hosted.hosted) {
|
|
4583
5350
|
console.log(`Previews: ${hosted.hosted.pattern} (${hosted.hosted.source})`);
|
|
4584
5351
|
}
|
|
5352
|
+
process.env.WHEELHOUSE_HARNESS = await resolveHarness({
|
|
5353
|
+
explicit: opts.harness,
|
|
5354
|
+
env: process.env,
|
|
5355
|
+
configDir
|
|
5356
|
+
});
|
|
4585
5357
|
const file = handlerPath();
|
|
4586
5358
|
if (!existsSync3(file)) {
|
|
4587
5359
|
console.error(
|
|
@@ -4591,9 +5363,9 @@ async function open2(opts) {
|
|
|
4591
5363
|
}
|
|
4592
5364
|
process.env.WHEELHOUSE_STATE_DIR = stateDir;
|
|
4593
5365
|
process.env.WHEELHOUSE_CONFIG_DIR = configDir;
|
|
4594
|
-
if (opts.pluginsDir) process.env.WHEELHOUSE_PLUGINS_DIR =
|
|
4595
|
-
process.env.WHEELHOUSE_BUNDLED_PLUGINS_DIR =
|
|
4596
|
-
process.env.WHEELHOUSE_INSTALL_DIR =
|
|
5366
|
+
if (opts.pluginsDir) process.env.WHEELHOUSE_PLUGINS_DIR = path20.resolve(opts.pluginsDir);
|
|
5367
|
+
process.env.WHEELHOUSE_BUNDLED_PLUGINS_DIR = path20.resolve(path20.dirname(file), "..", "plugins");
|
|
5368
|
+
process.env.WHEELHOUSE_INSTALL_DIR = path20.resolve(path20.dirname(file), "..");
|
|
4597
5369
|
if (opts.tmuxSocket) process.env.WHEELHOUSE_TMUX_SOCKET = opts.tmuxSocket;
|
|
4598
5370
|
process.env.WHEELHOUSE_SKIP_PERMISSIONS = opts.skipPermissions ? "1" : "0";
|
|
4599
5371
|
let cli = fileURLToPath2(import.meta.url);
|
|
@@ -4610,9 +5382,9 @@ async function open2(opts) {
|
|
|
4610
5382
|
start: (port, restart) => {
|
|
4611
5383
|
const next = takeHandoff(configDir);
|
|
4612
5384
|
if (next && restart) {
|
|
4613
|
-
cli =
|
|
5385
|
+
cli = path20.join(next, "dist", "cli.js");
|
|
4614
5386
|
process.env.WHEELHOUSE_INSTALL_DIR = next;
|
|
4615
|
-
process.env.WHEELHOUSE_BUNDLED_PLUGINS_DIR =
|
|
5387
|
+
process.env.WHEELHOUSE_BUNDLED_PLUGINS_DIR = path20.join(next, "plugins");
|
|
4616
5388
|
console.log(`Wheelhouse now runs from ${next}.`);
|
|
4617
5389
|
}
|
|
4618
5390
|
return fork(cli, ["__server", "--port", String(port)], {
|
|
@@ -4637,7 +5409,7 @@ async function open2(opts) {
|
|
|
4637
5409
|
process.exit(code);
|
|
4638
5410
|
}
|
|
4639
5411
|
async function serve(opts) {
|
|
4640
|
-
process.env.WHEELHOUSE_INSTALL_DIR =
|
|
5412
|
+
process.env.WHEELHOUSE_INSTALL_DIR = path20.resolve(path20.dirname(handlerPath()), "..");
|
|
4641
5413
|
const selected = resolveInstall({
|
|
4642
5414
|
firstmate: process.env.WHEELHOUSE_FIRSTMATE_DIR,
|
|
4643
5415
|
home: process.env.WHEELHOUSE_HOME,
|
|
@@ -4736,6 +5508,16 @@ function program() {
|
|
|
4736
5508
|
"--preview-url <pattern>",
|
|
4737
5509
|
`where a hosted dev environment serves this computer's ports, with {port} once, such as https://{port}.example.dev; previews and links to addresses on this computer open there ("off" turns it off; default: $${PREVIEW_URL_ENV}, else Gitpod's or Codespaces' own, detected)`
|
|
4738
5510
|
).option("--no-browser", "do not open the browser").option(
|
|
5511
|
+
"--harness <name>",
|
|
5512
|
+
"Firstmate tool: claude, codex, opencode, pi (default: environment, saved choice, or interactive picker; noninteractive fallback: claude)",
|
|
5513
|
+
(value) => {
|
|
5514
|
+
try {
|
|
5515
|
+
return parseHarness(value);
|
|
5516
|
+
} catch (e) {
|
|
5517
|
+
throw new InvalidArgumentError3(e instanceof Error ? e.message : String(e));
|
|
5518
|
+
}
|
|
5519
|
+
}
|
|
5520
|
+
).option(
|
|
4739
5521
|
"--no-skip-permissions",
|
|
4740
5522
|
"start Firstmate without --dangerously-skip-permissions, so Claude Code asks before tools run (answer in the terminal drawer)"
|
|
4741
5523
|
).action((opts) => open2(opts));
|