@chrisjowen/wheelhouse 0.25.0 → 0.25.1
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/build/client/_app/immutable/chunks/{DhdrUn_f.js → 28SuhBcT.js} +1 -1
- package/build/client/_app/immutable/chunks/28SuhBcT.js.br +0 -0
- package/build/client/_app/immutable/chunks/28SuhBcT.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{DhZcqaY_.js → 7W-6I0W5.js} +1 -1
- package/build/client/_app/immutable/chunks/7W-6I0W5.js.br +0 -0
- package/build/client/_app/immutable/chunks/7W-6I0W5.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{BUNaAdFX.js → B-PCtbJj.js} +1 -1
- package/build/client/_app/immutable/chunks/B-PCtbJj.js.br +0 -0
- package/build/client/_app/immutable/chunks/B-PCtbJj.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{CtYw9Aiz.js → BTF7kOWj.js} +1 -1
- package/build/client/_app/immutable/chunks/BTF7kOWj.js.br +0 -0
- package/build/client/_app/immutable/chunks/BTF7kOWj.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{BXWkikJt.js → BnGC1hPK.js} +1 -1
- package/build/client/_app/immutable/chunks/BnGC1hPK.js.br +0 -0
- package/build/client/_app/immutable/chunks/BnGC1hPK.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{DO7S-a12.js → BpMceauw.js} +1 -1
- package/build/client/_app/immutable/chunks/BpMceauw.js.br +0 -0
- package/build/client/_app/immutable/chunks/BpMceauw.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{CTCyjBcB.js → BuKI2ZJL.js} +1 -1
- package/build/client/_app/immutable/chunks/BuKI2ZJL.js.br +0 -0
- package/build/client/_app/immutable/chunks/BuKI2ZJL.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{Dum30Kwq.js → CEgeDr98.js} +1 -1
- package/build/client/_app/immutable/chunks/CEgeDr98.js.br +0 -0
- package/build/client/_app/immutable/chunks/CEgeDr98.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{D9kvhYgA.js → CIppRg38.js} +1 -1
- package/build/client/_app/immutable/chunks/CIppRg38.js.br +0 -0
- package/build/client/_app/immutable/chunks/CIppRg38.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{Kz2E8r37.js → CWXMOoE5.js} +1 -1
- package/build/client/_app/immutable/chunks/CWXMOoE5.js.br +2 -0
- package/build/client/_app/immutable/chunks/CWXMOoE5.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{DVltcUYh.js → CcZQvhp1.js} +1 -1
- package/build/client/_app/immutable/chunks/CcZQvhp1.js.br +0 -0
- package/build/client/_app/immutable/chunks/CcZQvhp1.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{B7bbsuTl.js → CdXXnfvS.js} +1 -1
- package/build/client/_app/immutable/chunks/CdXXnfvS.js.br +0 -0
- package/build/client/_app/immutable/chunks/CdXXnfvS.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{CcHD_KH8.js → CfSmEcaH.js} +1 -1
- package/build/client/_app/immutable/chunks/CfSmEcaH.js.br +0 -0
- package/build/client/_app/immutable/chunks/CfSmEcaH.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{C0JshGmD.js → CgJcnAcm.js} +1 -1
- package/build/client/_app/immutable/chunks/CgJcnAcm.js.br +0 -0
- package/build/client/_app/immutable/chunks/CgJcnAcm.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{BqfDFJcB.js → CgvWEeQK.js} +1 -1
- package/build/client/_app/immutable/chunks/CgvWEeQK.js.br +0 -0
- package/build/client/_app/immutable/chunks/CgvWEeQK.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{XLpt2pHa.js → CqwyiX4n.js} +1 -1
- package/build/client/_app/immutable/chunks/CqwyiX4n.js.br +0 -0
- package/build/client/_app/immutable/chunks/CqwyiX4n.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CtfzluSe.js +1 -0
- package/build/client/_app/immutable/chunks/CtfzluSe.js.br +0 -0
- package/build/client/_app/immutable/chunks/CtfzluSe.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{T9AsXuo8.js → DQZynC5d.js} +1 -1
- package/build/client/_app/immutable/chunks/DQZynC5d.js.br +0 -0
- package/build/client/_app/immutable/chunks/DQZynC5d.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{Cv-TUPtV.js → DhFU494N.js} +1 -1
- package/build/client/_app/immutable/chunks/DhFU494N.js.br +0 -0
- package/build/client/_app/immutable/chunks/DhFU494N.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{HjHUkJwY.js → ITHHFCAt.js} +1 -1
- package/build/client/_app/immutable/chunks/ITHHFCAt.js.br +0 -0
- package/build/client/_app/immutable/chunks/ITHHFCAt.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{N8Gha39e.js → KLlJvBx3.js} +1 -1
- package/build/client/_app/immutable/chunks/KLlJvBx3.js.br +0 -0
- package/build/client/_app/immutable/chunks/KLlJvBx3.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{CDKhNJSK.js → Kh20FmpZ.js} +1 -1
- package/build/client/_app/immutable/chunks/Kh20FmpZ.js.br +0 -0
- package/build/client/_app/immutable/chunks/Kh20FmpZ.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{I_-yJuBL.js → _NxO7pzE.js} +1 -1
- package/build/client/_app/immutable/chunks/_NxO7pzE.js.br +0 -0
- package/build/client/_app/immutable/chunks/_NxO7pzE.js.gz +0 -0
- package/build/client/_app/immutable/chunks/uFHn3SsP.js +2 -0
- package/build/client/_app/immutable/chunks/uFHn3SsP.js.br +0 -0
- package/build/client/_app/immutable/chunks/uFHn3SsP.js.gz +0 -0
- package/build/client/_app/immutable/entry/{app.CI9gKeRy.js → app.D6StH31U.js} +2 -2
- package/build/client/_app/immutable/entry/app.D6StH31U.js.br +0 -0
- package/build/client/_app/immutable/entry/app.D6StH31U.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.B2z8DOZI.js +1 -0
- package/build/client/_app/immutable/entry/start.B2z8DOZI.js.br +0 -0
- package/build/client/_app/immutable/entry/start.B2z8DOZI.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{0.SOXcKt4H.js → 0.CKuUS76g.js} +1 -1
- package/build/client/_app/immutable/nodes/0.CKuUS76g.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.CKuUS76g.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{1.a-BZXuZt.js → 1.ClSKcXXD.js} +1 -1
- package/build/client/_app/immutable/nodes/1.ClSKcXXD.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.ClSKcXXD.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{10.DLnyC5NT.js → 10.C1VYgF4o.js} +1 -1
- package/build/client/_app/immutable/nodes/10.C1VYgF4o.js.br +0 -0
- package/build/client/_app/immutable/nodes/10.C1VYgF4o.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{11.4PSwlKy0.js → 11.Cz3SoD3J.js} +1 -1
- package/build/client/_app/immutable/nodes/11.Cz3SoD3J.js.br +0 -0
- package/build/client/_app/immutable/nodes/11.Cz3SoD3J.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{12.DgxAtSPR.js → 12.Ck8hTl9o.js} +1 -1
- package/build/client/_app/immutable/nodes/12.Ck8hTl9o.js.br +0 -0
- package/build/client/_app/immutable/nodes/12.Ck8hTl9o.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{13._Ol8NYtQ.js → 13.uPkonAXk.js} +1 -1
- package/build/client/_app/immutable/nodes/13.uPkonAXk.js.br +0 -0
- package/build/client/_app/immutable/nodes/13.uPkonAXk.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{14.DoXQTncs.js → 14.BhgJgo-p.js} +1 -1
- package/build/client/_app/immutable/nodes/14.BhgJgo-p.js.br +0 -0
- package/build/client/_app/immutable/nodes/14.BhgJgo-p.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{15.5DEbDyax.js → 15.C8fHy07w.js} +1 -1
- package/build/client/_app/immutable/nodes/15.C8fHy07w.js.br +0 -0
- package/build/client/_app/immutable/nodes/15.C8fHy07w.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{16.SQWDXY2I.js → 16.BIiXdOvw.js} +1 -1
- package/build/client/_app/immutable/nodes/16.BIiXdOvw.js.br +0 -0
- package/build/client/_app/immutable/nodes/16.BIiXdOvw.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{17.CasB-8ln.js → 17.UCTOPfQ9.js} +1 -1
- package/build/client/_app/immutable/nodes/17.UCTOPfQ9.js.br +0 -0
- package/build/client/_app/immutable/nodes/17.UCTOPfQ9.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{18.BAczHbDD.js → 18.BIIxWe2_.js} +1 -1
- package/build/client/_app/immutable/nodes/18.BIIxWe2_.js.br +0 -0
- package/build/client/_app/immutable/nodes/18.BIIxWe2_.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{19.DXAMDWal.js → 19.MIMOOdHv.js} +1 -1
- package/build/client/_app/immutable/nodes/19.MIMOOdHv.js.br +0 -0
- package/build/client/_app/immutable/nodes/19.MIMOOdHv.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{2.ynCXvpKT.js → 2.DtoFWLWO.js} +1 -1
- package/build/client/_app/immutable/nodes/2.DtoFWLWO.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.DtoFWLWO.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{20.HXzvTavr.js → 20.6wKzQBq7.js} +1 -1
- package/build/client/_app/immutable/nodes/20.6wKzQBq7.js.br +0 -0
- package/build/client/_app/immutable/nodes/20.6wKzQBq7.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{21.BtJKIHjo.js → 21.5HKRevgQ.js} +1 -1
- package/build/client/_app/immutable/nodes/21.5HKRevgQ.js.br +0 -0
- package/build/client/_app/immutable/nodes/21.5HKRevgQ.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{22.NI4OHi3d.js → 22.D2Go4NAd.js} +1 -1
- package/build/client/_app/immutable/nodes/22.D2Go4NAd.js.br +0 -0
- package/build/client/_app/immutable/nodes/22.D2Go4NAd.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{23.tSDk3C1r.js → 23.CD_BMpjF.js} +1 -1
- package/build/client/_app/immutable/nodes/23.CD_BMpjF.js.br +0 -0
- package/build/client/_app/immutable/nodes/23.CD_BMpjF.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{24.B5Tab48v.js → 24.T-WCg51Y.js} +1 -1
- package/build/client/_app/immutable/nodes/24.T-WCg51Y.js.br +0 -0
- package/build/client/_app/immutable/nodes/24.T-WCg51Y.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{25.DtjHBqgn.js → 25.BeupWX4f.js} +1 -1
- package/build/client/_app/immutable/nodes/25.BeupWX4f.js.br +0 -0
- package/build/client/_app/immutable/nodes/25.BeupWX4f.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{26.FOz7fg2Q.js → 26.Yu_f5rJN.js} +1 -1
- package/build/client/_app/immutable/nodes/26.Yu_f5rJN.js.br +0 -0
- package/build/client/_app/immutable/nodes/26.Yu_f5rJN.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{28.Ddrbfwzj.js → 28.CXVRuiJO.js} +1 -1
- package/build/client/_app/immutable/nodes/28.CXVRuiJO.js.br +0 -0
- package/build/client/_app/immutable/nodes/28.CXVRuiJO.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{3.uurBYeAR.js → 3.CQz7EPod.js} +1 -1
- package/build/client/_app/immutable/nodes/3.CQz7EPod.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.CQz7EPod.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{30.BkVqi32a.js → 30.Cn5WjjU2.js} +1 -1
- package/build/client/_app/immutable/nodes/30.Cn5WjjU2.js.br +0 -0
- package/build/client/_app/immutable/nodes/30.Cn5WjjU2.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{31.BpCe4YZd.js → 31.X3AmUS0p.js} +1 -1
- package/build/client/_app/immutable/nodes/31.X3AmUS0p.js.br +0 -0
- package/build/client/_app/immutable/nodes/31.X3AmUS0p.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{32.B0-J2UfW.js → 32.ByxI0zka.js} +1 -1
- package/build/client/_app/immutable/nodes/32.ByxI0zka.js.br +0 -0
- package/build/client/_app/immutable/nodes/32.ByxI0zka.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{33._Eb7SINu.js → 33.D3i9rpHh.js} +1 -1
- package/build/client/_app/immutable/nodes/33.D3i9rpHh.js.br +0 -0
- package/build/client/_app/immutable/nodes/33.D3i9rpHh.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{34.BFbXwyzz.js → 34.0c6Z2Z6d.js} +1 -1
- package/build/client/_app/immutable/nodes/34.0c6Z2Z6d.js.br +0 -0
- package/build/client/_app/immutable/nodes/34.0c6Z2Z6d.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{35.DWcXHizu.js → 35.BWPVbOEr.js} +1 -1
- package/build/client/_app/immutable/nodes/35.BWPVbOEr.js.br +0 -0
- package/build/client/_app/immutable/nodes/35.BWPVbOEr.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{36.fbI8i5v7.js → 36.CvLYsEYT.js} +1 -1
- package/build/client/_app/immutable/nodes/36.CvLYsEYT.js.br +0 -0
- package/build/client/_app/immutable/nodes/36.CvLYsEYT.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{37.CIYgEXVz.js → 37.BJz6-lS3.js} +1 -1
- package/build/client/_app/immutable/nodes/37.BJz6-lS3.js.br +0 -0
- package/build/client/_app/immutable/nodes/37.BJz6-lS3.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{38.BOJ3vJzU.js → 38.D_9ntghd.js} +1 -1
- package/build/client/_app/immutable/nodes/38.D_9ntghd.js.br +0 -0
- package/build/client/_app/immutable/nodes/38.D_9ntghd.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{39.aAwz5CPN.js → 39.HPPVcNOu.js} +1 -1
- package/build/client/_app/immutable/nodes/39.HPPVcNOu.js.br +0 -0
- package/build/client/_app/immutable/nodes/39.HPPVcNOu.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{4.jGQeqVXr.js → 4.Doi_SYLu.js} +1 -1
- package/build/client/_app/immutable/nodes/4.Doi_SYLu.js.br +0 -0
- package/build/client/_app/immutable/nodes/4.Doi_SYLu.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{40.CvHYslu6.js → 40.CrsYdbJ2.js} +1 -1
- package/build/client/_app/immutable/nodes/40.CrsYdbJ2.js.br +0 -0
- package/build/client/_app/immutable/nodes/40.CrsYdbJ2.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{41.CMPN_2XH.js → 41.gEqeY20t.js} +1 -1
- package/build/client/_app/immutable/nodes/41.gEqeY20t.js.br +0 -0
- package/build/client/_app/immutable/nodes/41.gEqeY20t.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{42.BYpn2R-a.js → 42.B2LWwGrT.js} +1 -1
- package/build/client/_app/immutable/nodes/42.B2LWwGrT.js.br +1 -0
- package/build/client/_app/immutable/nodes/42.B2LWwGrT.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{44.Bj9vohCn.js → 44.CdUnQCqR.js} +1 -1
- package/build/client/_app/immutable/nodes/44.CdUnQCqR.js.br +0 -0
- package/build/client/_app/immutable/nodes/44.CdUnQCqR.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{5.DClLUmjz.js → 5.B4uTy-0f.js} +1 -1
- package/build/client/_app/immutable/nodes/5.B4uTy-0f.js.br +0 -0
- package/build/client/_app/immutable/nodes/5.B4uTy-0f.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{6.DszoCJEl.js → 6.CmIB-igu.js} +1 -1
- package/build/client/_app/immutable/nodes/6.CmIB-igu.js.br +0 -0
- package/build/client/_app/immutable/nodes/6.CmIB-igu.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{9.B_o37ZWA.js → 9.D5kLV1OU.js} +1 -1
- package/build/client/_app/immutable/nodes/9.D5kLV1OU.js.br +0 -0
- package/build/client/_app/immutable/nodes/9.D5kLV1OU.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/{detail.js-B2R6Znek.js → detail.js-DNmr2zHv.js} +2 -2
- package/build/server/chunks/chunks/{feedback.js-DthXPMki.js → feedback.js-CHXRyn5n.js} +2 -2
- package/build/server/chunks/chunks/{internal.js-CEWzBR2Y.js → internal.js-O-vX00u6.js} +3 -3
- package/build/server/chunks/chunks/{marketplace-service.js-DSxw-XPY.js → marketplace-service.js-7cE4n6mo.js} +2 -2
- package/build/server/chunks/chunks/{package.js-B7nnL29I.js → package.js-X-RlQsSA.js} +2 -2
- package/build/server/chunks/chunks/{page.js-DCiJruq9.js → page.js-B6PDBS51.js} +2 -2
- package/build/server/chunks/chunks/{previewhelper2.js-Dokz3Re6.js → previewhelper2.js-CawzBO7t.js} +4 -4
- package/build/server/chunks/chunks/{repo.js-DXPu1jYS.js → repo.js-OOqVL99k.js} +2 -2
- package/build/server/chunks/chunks/{runtime.js-BcdjdUwr.js → runtime.js-D7BWZr4r.js} +1168 -1022
- package/build/server/chunks/chunks/{scribe.js-D30sP1z9.js → scribe.js-CrX8YPGp.js} +4 -4
- package/build/server/chunks/chunks/{service.js--01O07Iu.js → service.js-BNXHwz0z.js} +2 -2
- package/build/server/chunks/chunks/{service2.js-CVR-BsF0.js → service2.js-K1G_0p9s.js} +3 -3
- package/build/server/chunks/chunks/{service3.js-Dx4TYIQa.js → service3.js-DsuUdHqU.js} +2 -2
- package/build/server/chunks/chunks/{sessions.js-BD6cxB3X.js → sessions.js-qcyBTO1C.js} +3 -3
- package/build/server/chunks/chunks/{settings.js-t2yY6DMc.js → settings.js-C5VqzDhW.js} +2 -2
- package/build/server/chunks/chunks/{starter.js-CjOwkL4s.js → starter.js-ClhdKcek.js} +3 -3
- package/build/server/chunks/chunks/{tmux.js-DTQKbm92.js → tmux.js-BnFtiGpm.js} +2 -2
- package/build/server/chunks/chunks/{tools.js-C_Xs95j-.js → tools.js-CSWRR-_m.js} +2 -2
- package/build/server/chunks/chunks/{view.js-D02gwJlT.js → view.js-8odN6g23.js} +2 -2
- package/build/server/chunks/entries/endpoints/api/apps/_op_/{_server.ts.js-DCqY_Bda.js → _server.ts.js-BDWFdikr.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/cloud/{_server.ts.js-Dm04PmD_.js → _server.ts.js-fQe2vCi_.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/cloud/previews/{_server.ts.js--TGJX2z9.js → _server.ts.js-BVRNsIIW.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/crew/{_server.ts.js-B9JGOQSd.js → _server.ts.js-ySb9KZ_-.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/crew/messages/{_server.ts.js-CgPkuD4I.js → _server.ts.js-BdAhPgNT.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/documents/{_server.ts.js-BkQr7zlk.js → _server.ts.js-Deuf72TK.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/documents/briefing/{_server.ts.js-JXf9tr9y.js → _server.ts.js-xQ85tCJ6.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/events/{_server.ts.js-DNlZzPAi.js → _server.ts.js--A6MYR5G.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/files/{_server.ts.js-D51z27Qh.js → _server.ts.js-BX1LxrEa.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/firstmate/chat/{_server.ts.js-UZLIIsLh.js → _server.ts.js-C0J5w0FB.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/firstmate/chat/archive/{_server.ts.js-QBAtq3e4.js → _server.ts.js-BTs5o7Mw.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/firstmate/chat/history/{_server.ts.js-CMW5VeA1.js → _server.ts.js-C8FKFafE.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/firstmate/chat/search/{_server.ts.js-CYEPWDq9.js → _server.ts.js-WkSY6nlu.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/firstmate/commands/{_server.ts.js-Dzw8Aq7W.js → _server.ts.js-BJwI8Gmn.js} +5 -5
- package/build/server/chunks/entries/endpoints/api/firstmate/dismiss/{_server.ts.js-H1O8SpZj.js → _server.ts.js-DVXInXQI.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/firstmate/input/{_server.ts.js-C3UIEKwW.js → _server.ts.js-KRUnXG1_.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/firstmate/interrupt/{_server.ts.js-BF0ddpon.js → _server.ts.js-C3wD-Bsc.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/firstmate/messages/{_server.ts.js-CQDDUPQH.js → _server.ts.js-yknBiY0D.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/firstmate/pick/{_server.ts.js-Bj6fzAhI.js → _server.ts.js-DWcY1uoX.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/firstmate/reactions/{_server.ts.js-KeBdme5-.js → _server.ts.js-BOaD3IeK.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/firstmate/signin/{_server.ts.js-DWyorNkc.js → _server.ts.js-BoSwn8Tv.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/firstmate/start/{_server.ts.js-DmocVrgJ.js → _server.ts.js-BdmoziWD.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/fleet/{_server.ts.js-B95RBsOY.js → _server.ts.js-CUL8Pq_B.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/health/{_server.ts.js-BuCZ0nAz.js → _server.ts.js-CEdzoclv.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/inbox/{_server.ts.js-CmiCqFGa.js → _server.ts.js-BjVzUKNa.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/inbox/following/{_server.ts.js-CfCsmFek.js → _server.ts.js-hDF9NFq_.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/inbox/report/{_server.ts.js-DMj7O_wm.js → _server.ts.js-CQFmK6Jj.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/inbox/talk/{_server.ts.js-CCxzIYPx.js → _server.ts.js-BgL_OBuS.js} +5 -5
- package/build/server/chunks/entries/endpoints/api/insights/{_server.ts.js-D_LWxNH8.js → _server.ts.js-Bj3ArJ8e.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/library/doc/{_server.ts.js-DHCwcT09.js → _server.ts.js-Ytj8LRyz.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/library/promote/{_server.ts.js-Dr83B5jC.js → _server.ts.js-Bsw-coX5.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/live/_id_/end/{_server.ts.js-BFz64-UD.js → _server.ts.js-BAq01f1Q.js} +6 -6
- package/build/server/chunks/entries/endpoints/api/live/_id_/events/{_server.ts.js-AI3xP87_.js → _server.ts.js-DuDvfPGO.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/live/_id_/interrupt/{_server.ts.js-CB9SAMkD.js → _server.ts.js-DOA618e_.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/live/_id_/say/{_server.ts.js-DaB0pK-G.js → _server.ts.js-XXsEGuag.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/live/{_server.ts.js-C-RZ2hfW.js → _server.ts.js-AHdWEtIp.js} +6 -6
- package/build/server/chunks/entries/endpoints/api/live/image/{_server.ts.js-Ct15HbWb.js → _server.ts.js-DzPUeQTi.js} +2 -2
- package/build/server/chunks/entries/endpoints/api/live/scouts/{_server.ts.js-Kp-td74e.js → _server.ts.js-D_OL9OX2.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/live/settings/{_server.ts.js-C4Er7ziD.js → _server.ts.js-CsVJLGBv.js} +5 -5
- package/build/server/chunks/entries/endpoints/api/plugins/_plugin_/config/{_server.ts.js-D2CWeQx9.js → _server.ts.js-B21zqtCS.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/plugins/_plugin_/feedback/{_server.ts.js-Cxxjkcea.js → _server.ts.js-D7dwIUHu.js} +5 -5
- package/build/server/chunks/entries/endpoints/api/plugins/_plugin_/feedback/summary/{_server.ts.js-BpSkuaqs.js → _server.ts.js-DV8iGc2m.js} +6 -6
- package/build/server/chunks/entries/endpoints/api/plugins/_plugin_/icon/_icon_/{_server.ts.js-DhqoeMSp.js → _server.ts.js-HOT8HzRk.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/plugins/_plugin_/load/{_server.ts.js-B978UeYH.js → _server.ts.js-TVTyRXGB.js} +2 -2
- package/build/server/chunks/entries/endpoints/api/plugins/_plugin_/ui/_...path_/{_server.ts.js-BjYkraIy.js → _server.ts.js-Cpz_Nwq9.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/plugins/_plugin_/update/{_server.ts.js-BSm0fyqO.js → _server.ts.js-DWCTugFd.js} +2 -2
- package/build/server/chunks/entries/endpoints/api/plugins/{_server.ts.js-DSZfo5DT.js → _server.ts.js-Dm0eRjNy.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/plugins/inspect/{_server.ts.js-Bhlu3rq6.js → _server.ts.js-BUs16W7B.js} +2 -2
- package/build/server/chunks/entries/endpoints/api/plugins/install/{_server.ts.js-Bc6_vVMA.js → _server.ts.js-COg9oQo8.js} +2 -2
- package/build/server/chunks/entries/endpoints/api/plugins/marketplace/{_server.ts.js-q71bHTAI.js → _server.ts.js-oAXY6lwM.js} +5 -5
- package/build/server/chunks/entries/endpoints/api/plugins/marketplace/icon/_name_/{_server.ts.js-BdhHl9q5.js → _server.ts.js-C4oBldsb.js} +5 -5
- package/build/server/chunks/entries/endpoints/api/plugins/marketplace/registries/{_server.ts.js-BbF_qpRh.js → _server.ts.js-BPPmeb1O.js} +5 -5
- package/build/server/chunks/entries/endpoints/api/plugins/roles/{_server.ts.js-CVHc5ryW.js → _server.ts.js-DcRonc0M.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/plugins/updates/{_server.ts.js-B7KmzEu4.js → _server.ts.js-D650HWSB.js} +2 -2
- package/build/server/chunks/entries/endpoints/api/previews/check/{_server.ts.js-ILPrSxNM.js → _server.ts.js-bYzuM3AX.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/projects/_id_/passage/{_server.ts.js-DRzuvCjv.js → _server.ts.js-DgBbAzui.js} +5 -5
- package/build/server/chunks/entries/endpoints/api/projects/_id_/passage/commands/{_server.ts.js-BYotWMDG.js → _server.ts.js-I7Q9NEeo.js} +5 -5
- package/build/server/chunks/entries/endpoints/api/projects/_id_/passage/consent/{_server.ts.js-CXXw_967.js → _server.ts.js-Cqsk5blC.js} +5 -5
- package/build/server/chunks/entries/endpoints/api/projects/_id_/passage/draft/{_server.ts.js-5H8AVdf3.js → _server.ts.js-DhcvEOaq.js} +5 -5
- package/build/server/chunks/entries/endpoints/api/projects/_id_/passage/file/{_server.ts.js--_mniW0J.js → _server.ts.js-DnepVFAC.js} +5 -5
- package/build/server/chunks/entries/endpoints/api/projects/_id_/passage/test/{_server.ts.js-DV5voQBw.js → _server.ts.js-DW1M5BKY.js} +5 -5
- package/build/server/chunks/entries/endpoints/api/second-mate-setup/{_server.ts.js-6xFnfO31.js → _server.ts.js-Dw6RfG7L.js} +6 -6
- package/build/server/chunks/entries/endpoints/api/second-mates/_id_/link/{_server.ts.js-DELGIKLB.js → _server.ts.js-B8bvA9DM.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/second-mates/_id_/peek/{_server.ts.js-DrkDRFum.js → _server.ts.js-D6eYs2D1.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/services/{_server.ts.js-oOrlu6PL.js → _server.ts.js-q1F7JDi4.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/setup/{_server.ts.js-BmE51iKW.js → _server.ts.js-3dHJdpfk.js} +5 -5
- package/build/server/chunks/entries/endpoints/api/slots/{_server.ts.js-CJJOCfAf.js → _server.ts.js-CuKl_RQf.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/soundings/{_server.ts.js-BE-v4ctp.js → _server.ts.js-CFd99DmZ.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/soundings/beacon/{_server.ts.js-BSAksOTw.js → _server.ts.js-C-2St0o7.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/soundings/settings/{_server.ts.js-9jtQze4M.js → _server.ts.js-vvMmWUno.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/tasks/_id_/{_server.ts.js-BEbfK5Sb.js → _server.ts.js-CLqanxiv.js} +5 -5
- package/build/server/chunks/entries/endpoints/api/tasks/_id_/artifacts/_...name_/{_server.ts.js-CC70KheS.js → _server.ts.js-DVxSMd63.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/tasks/_id_/chat/{_server.ts.js-BPOVTSNr.js → _server.ts.js-2ZTB9AOc.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/tasks/_id_/diff/{_server.ts.js-B0Ce7-kQ.js → _server.ts.js-Bqz9Jxq-.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/tasks/_id_/livereview/{_server.ts.js-mhQYv_sd.js → _server.ts.js-B7cAJcuZ.js} +6 -6
- package/build/server/chunks/entries/endpoints/api/tasks/_id_/output/{_server.ts.js-QMmOjqmI.js → _server.ts.js-qGkkUc0n.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/tasks/_id_/preview/{_server.ts.js-IfH0F77C.js → _server.ts.js-BVyk7T-v.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/tasks/_id_/preview/helper/{_server.ts.js-CLPXGlPH.js → _server.ts.js-BMwxujEw.js} +5 -5
- package/build/server/chunks/entries/endpoints/api/vault/{_server.ts.js-CIc1KsPd.js → _server.ts.js-40rgCCP-.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/voice/{_server.ts.js-G6xuTFYk.js → _server.ts.js-4PZyHkNr.js} +2 -2
- package/build/server/chunks/entries/endpoints/api/voice/hear/{_server.ts.js-ChS6Cl9I.js → _server.ts.js-BjhLHXXA.js} +2 -2
- package/build/server/chunks/entries/endpoints/api/voice/speak/{_server.ts.js-ylJaIr71.js → _server.ts.js-0u91Zt3R.js} +2 -2
- package/build/server/chunks/entries/endpoints/api/wh-events/{_server.ts.js-iQF5ttIM.js → _server.ts.js-deys_OrX.js} +4 -4
- package/build/server/chunks/entries/endpoints/api/wheelhouse/source/{_server.ts.js-BW9O_FlY.js → _server.ts.js-CXK5O72T.js} +2 -2
- package/build/server/chunks/entries/endpoints/api/wheelhouse/update/{_server.ts.js-DTE3VOwI.js → _server.ts.js-VNIH1gz4.js} +2 -2
- package/build/server/chunks/entries/endpoints/api/wheelhouse/upgrade/{_server.ts.js-s26vq0JS.js → _server.ts.js-DWmyyxxj.js} +2 -2
- package/build/server/chunks/entries/endpoints/library/_shelf_/_folder_/_slug_/files/_...path_/{_server.ts.js-B8s3BS7I.js → _server.ts.js-BjRdBCjC.js} +4 -4
- package/build/server/chunks/entries/endpoints/r/_task_/{_server.ts.js-BsiL8VVP.js → _server.ts.js-C1DBUIIo.js} +4 -4
- package/build/server/chunks/entries/endpoints/records/_project_/_task_/files/_...path_/{_server.ts.js-Co28KCNH.js → _server.ts.js-D-qgAHe2.js} +4 -4
- package/build/server/chunks/entries/endpoints/tasks/_id_/live/{_server.ts.js-syWL6Knw.js → _server.ts.js-B_YfmtCr.js} +6 -6
- package/build/server/chunks/entries/endpoints/tasks/_id_/review/{_server.ts.js-BI2EVdsb.js → _server.ts.js-B8wpApaS.js} +4 -4
- package/build/server/chunks/entries/{hooks.server.js-B4zt2gMT.js → hooks.server.js-C2Jq471K.js} +6 -6
- package/build/server/chunks/entries/pages/{_layout.server.ts.js-BBZSb3zI.js → _layout.server.ts.js-Bt-gmVC8.js} +3 -3
- package/build/server/chunks/entries/pages/{_page.server.ts.js-BS44Y_4B.js → _page.server.ts.js-DfN7-68h.js} +2 -2
- package/build/server/chunks/entries/pages/decisions/{_page.server.ts.js-BfjjhUph.js → _page.server.ts.js-Cmkth9fT.js} +2 -2
- package/build/server/chunks/entries/pages/deck/{_page.server.ts.js-Den-42vR.js → _page.server.ts.js-C0ulhk4E.js} +2 -2
- package/build/server/chunks/entries/pages/documents/{_page.server.ts.js-CI8dk87B.js → _page.server.ts.js-lb2y3RrU.js} +2 -2
- package/build/server/chunks/entries/pages/files/{_page.server.ts.js-BgARM8mm.js → _page.server.ts.js-C8K8Bywk.js} +2 -2
- package/build/server/chunks/entries/pages/headroom/{_page.server.ts.js-HtDc07oV.js → _page.server.ts.js-g48T0kd-.js} +2 -2
- package/build/server/chunks/entries/pages/health/{_page.server.ts.js-QHRjb2mW.js → _page.server.ts.js-BtYNItQA.js} +2 -2
- package/build/server/chunks/entries/pages/inbox/{_page.server.ts.js-U6iyhhAi.js → _page.server.ts.js-BgSMH_CR.js} +2 -2
- package/build/server/chunks/entries/pages/library/_shelf_/_folder_/_slug_/{_page.server.ts.js-Ct7X9UNn.js → _page.server.ts.js-BGT47EiL.js} +2 -2
- package/build/server/chunks/entries/pages/plugins/_plugin_/_page_/{_page.server.ts.js-CSy0Mcfk.js → _page.server.ts.js-DBvqb-4n.js} +2 -2
- package/build/server/chunks/entries/pages/projects/_id_/{_page.server.ts.js-OcqAZPqs.js → _page.server.ts.js-C5lDScfS.js} +3 -3
- package/build/server/chunks/entries/pages/projects/_id_/_plugin_/_tab_/{_page.server.ts.js-D1OSHb0S.js → _page.server.ts.js-OHtCg3ps.js} +3 -3
- package/build/server/chunks/entries/pages/projects/_id_/passage/{_page.server.ts.js-DRtkOAgr.js → _page.server.ts.js-C5T5xtcE.js} +4 -4
- package/build/server/chunks/entries/pages/projects/_id_/passage/edit/{_page.server.ts.js-Br-tOc7a.js → _page.server.ts.js-4wFc1XPC.js} +2 -2
- package/build/server/chunks/entries/pages/prototypes/_project_/_task_/_name_/{_page.server.ts.js-C3qIWXBy.js → _page.server.ts.js-BljSK7lM.js} +2 -2
- package/build/server/chunks/entries/pages/records/_project_/_task_/{_page.server.ts.js-Ce5mHdpe.js → _page.server.ts.js-CXnAVg7S.js} +2 -2
- package/build/server/chunks/entries/pages/remotes/{_page.server.ts.js-KkohEbGV.js → _page.server.ts.js-C-gvokYd.js} +2 -2
- package/build/server/chunks/entries/pages/settings/chat/{_page.server.ts.js-B-xlxpbm.js → _page.server.ts.js-B3YDnmmB.js} +2 -2
- package/build/server/chunks/entries/pages/settings/discussion/{_page.server.ts.js-C3rAOzae.js → _page.server.ts.js-sFixjDN7.js} +4 -4
- package/build/server/chunks/entries/pages/settings/events/{_page.server.ts.js-BA-tWOES.js → _page.server.ts.js-ORPe-Udr.js} +2 -2
- package/build/server/chunks/entries/pages/settings/firstmate/{_page.server.ts.js-BaJ2W22V.js → _page.server.ts.js-CuJj3RFV.js} +3 -3
- package/build/server/chunks/entries/pages/settings/gateway/{_page.server.ts.js-DssDgFRV.js → _page.server.ts.js-7_ZbhFWy.js} +2 -2
- package/build/server/chunks/entries/pages/settings/plugins/{_page.server.ts.js-niIXQvkx.js → _page.server.ts.js-BhiagNIi.js} +2 -2
- package/build/server/chunks/entries/pages/settings/plugins/_plugin_/{_page.server.ts.js-CbTQXe63.js → _page.server.ts.js-Dgl8iOBp.js} +2 -2
- package/build/server/chunks/entries/pages/settings/setup/{_page.server.ts.js-BYvOjL40.js → _page.server.ts.js-KsPYJwiB.js} +2 -2
- package/build/server/chunks/entries/pages/settings/update/{_page.server.ts.js-BAzQbxTI.js → _page.server.ts.js-BZZoApKT.js} +2 -2
- package/build/server/chunks/entries/pages/settings/voice/{_page.server.ts.js-C_PZ3K62.js → _page.server.ts.js-GCgZEZdm.js} +3 -3
- package/build/server/chunks/entries/pages/setup/{_page.server.ts.js-Bt5BHnIn.js → _page.server.ts.js-BOorm5Wm.js} +3 -3
- package/build/server/chunks/entries/pages/tasks/_id_/{_page.server.ts.js-CBJ9UCxK.js → _page.server.ts.js-Feuxftuj.js} +3 -3
- package/build/server/chunks/entries/pages/tasks/_id_/doc/{_page.server.ts.js-By1hYgOi.js → _page.server.ts.js-BMEYrcpa.js} +2 -2
- package/build/server/chunks/entries/pages/time/{_page.server.ts.js-DJxWHuwd.js → _page.server.ts.js-CwBRGUi5.js} +2 -2
- package/build/server/chunks/{handler-CXUepvBU.js → handler-HICo2rBa.js} +3 -3
- package/build/server/chunks/{index.js-BsOCKSNc.js → index.js-mXeyfwOL.js} +2 -2
- package/build/server/chunks/{manifest.js-CSOlQwBQ.js → manifest.js-BXvg7MTn.js} +135 -135
- package/build/server/chunks/nodes/{0.js-BA8rdf7S.js → 0.js-B6FWOub_.js} +7 -7
- package/build/server/chunks/nodes/{1.js-CGDtM8Ha.js → 1.js-A3LTU5o8.js} +2 -2
- package/build/server/chunks/nodes/{10.js-dkuZj5-W.js → 10.js-CylXMpAM.js} +6 -6
- package/build/server/chunks/nodes/{11.js-DNaVEa3x.js → 11.js-COltHAQK.js} +6 -6
- package/build/server/chunks/nodes/{12.js-VJOzmisQ.js → 12.js-D4Upu6y1.js} +6 -6
- package/build/server/chunks/nodes/{13.js-B-UNeeYa.js → 13.js-DVK7Dh6e.js} +6 -6
- package/build/server/chunks/nodes/{14.js-DuWS_Hw5.js → 14.js-4qz1fO9Q.js} +2 -2
- package/build/server/chunks/nodes/{15.js-lq3f_J6-.js → 15.js-ChjTgj9K.js} +2 -2
- package/build/server/chunks/nodes/{16.js-Ch2TluQr.js → 16.js-P8F-wWtO.js} +2 -2
- package/build/server/chunks/nodes/{17.js-BcBFGx5D.js → 17.js-DjuCCIpy.js} +6 -6
- package/build/server/chunks/nodes/{18.js-Dx5djvj3.js → 18.js-C993M6oc.js} +7 -7
- package/build/server/chunks/nodes/{19.js-C-Dv2UZU.js → 19.js-D9Embfjr.js} +7 -7
- package/build/server/chunks/nodes/{2.js-Dlx5yqWh.js → 2.js-Wc5kZHvb.js} +6 -6
- package/build/server/chunks/nodes/{20.js-Crt3vcuB.js → 20.js-BPRKQiIS.js} +8 -8
- package/build/server/chunks/nodes/{21.js-DTRw0wlf.js → 21.js-CUAn10i3.js} +7 -7
- package/build/server/chunks/nodes/{22.js-avqPhTYl.js → 22.js-TBH6F4dy.js} +6 -6
- package/build/server/chunks/nodes/{23.js-RRrhs54q.js → 23.js-szYvETrv.js} +6 -6
- package/build/server/chunks/nodes/{24.js-BFk3mjXx.js → 24.js-D3VP7c7Q.js} +7 -7
- package/build/server/chunks/nodes/{25.js-B2Rb1Za9.js → 25.js-CBoW-4He.js} +2 -2
- package/build/server/chunks/nodes/{26.js-BT9wbGJs.js → 26.js-DzXVuGMS.js} +2 -2
- package/build/server/chunks/nodes/{28.js-CjbQNy9F.js → 28.js-Cd8QuiHE.js} +6 -6
- package/build/server/chunks/nodes/{3.js-u47cGgVr.js → 3.js-DZsIWxJx.js} +2 -2
- package/build/server/chunks/nodes/{30.js-DS5CGoON.js → 30.js-DoJvIlX5.js} +7 -7
- package/build/server/chunks/nodes/{31.js-DM2poShY.js → 31.js-D8IGmFgH.js} +6 -6
- package/build/server/chunks/nodes/{32.js-DFy_JaX0.js → 32.js-B20MERXQ.js} +2 -2
- package/build/server/chunks/nodes/{33.js-DJeaepHV.js → 33.js-DOlfd37i.js} +6 -6
- package/build/server/chunks/nodes/{34.js-BZwX56gy.js → 34.js-DWWZCvyG.js} +7 -7
- package/build/server/chunks/nodes/{35.js-DYTAoBE6.js → 35.js-oWOgHh8Z.js} +2 -2
- package/build/server/chunks/nodes/{36.js-BY3unmMW.js → 36.js-DZ-lKaYT.js} +6 -6
- package/build/server/chunks/nodes/{37.js-m6ZzMMTc.js → 37.js-eAJH-k_k.js} +6 -6
- package/build/server/chunks/nodes/{38.js-B3Kp1AAS.js → 38.js-BNDRcNzX.js} +7 -7
- package/build/server/chunks/nodes/{39.js-BvYxNpMG.js → 39.js-o8Oz_jZ9.js} +4 -4
- package/build/server/chunks/nodes/{4.js-BDLWobmB.js → 4.js-XBXJC9EJ.js} +6 -6
- package/build/server/chunks/nodes/{40.js-Dw8-O1g2.js → 40.js-BruOvnJW.js} +7 -7
- package/build/server/chunks/nodes/{41.js-D7Ne71uc.js → 41.js-ygYBXXUn.js} +7 -7
- package/build/server/chunks/nodes/{42.js-Bsljzkwn.js → 42.js-DVVbf2pp.js} +7 -7
- package/build/server/chunks/nodes/{43.js-CKN-FZAM.js → 43.js-4kkcs8x3.js} +6 -6
- package/build/server/chunks/nodes/{44.js-DWOVsqNq.js → 44.js-Dz4_viSC.js} +6 -6
- package/build/server/chunks/nodes/{5.js-NuGLVKKK.js → 5.js-CESSNTmC.js} +6 -6
- package/build/server/chunks/nodes/{6.js-B5PJm0c8.js → 6.js-ReQxzqU3.js} +6 -6
- package/build/server/chunks/nodes/{8.js-B72TpXrD.js → 8.js-Bp5GVhBi.js} +5 -5
- package/build/server/chunks/nodes/{9.js-D2iYl_QK.js → 9.js-hs2_Bguy.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/wh-vault.js +1 -1
- package/firstmate-extension/firstmate-extension.json +1 -1
- package/package.json +1 -1
- package/build/client/_app/immutable/chunks/B7bbsuTl.js.br +0 -0
- package/build/client/_app/immutable/chunks/B7bbsuTl.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BUNaAdFX.js.br +0 -0
- package/build/client/_app/immutable/chunks/BUNaAdFX.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BXWkikJt.js.br +0 -0
- package/build/client/_app/immutable/chunks/BXWkikJt.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BqfDFJcB.js.br +0 -0
- package/build/client/_app/immutable/chunks/BqfDFJcB.js.gz +0 -0
- package/build/client/_app/immutable/chunks/C0JshGmD.js.br +0 -0
- package/build/client/_app/immutable/chunks/C0JshGmD.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CDKhNJSK.js.br +0 -0
- package/build/client/_app/immutable/chunks/CDKhNJSK.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CTCyjBcB.js.br +0 -0
- package/build/client/_app/immutable/chunks/CTCyjBcB.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CcHD_KH8.js.br +0 -0
- package/build/client/_app/immutable/chunks/CcHD_KH8.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CtYw9Aiz.js.br +0 -0
- package/build/client/_app/immutable/chunks/CtYw9Aiz.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Cv-TUPtV.js.br +0 -0
- package/build/client/_app/immutable/chunks/Cv-TUPtV.js.gz +0 -0
- package/build/client/_app/immutable/chunks/D9kvhYgA.js.br +0 -0
- package/build/client/_app/immutable/chunks/D9kvhYgA.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DAJm78bI.js +0 -1
- package/build/client/_app/immutable/chunks/DAJm78bI.js.br +0 -0
- package/build/client/_app/immutable/chunks/DAJm78bI.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DO7S-a12.js.br +0 -0
- package/build/client/_app/immutable/chunks/DO7S-a12.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DUyfEzYn.js +0 -2
- package/build/client/_app/immutable/chunks/DUyfEzYn.js.br +0 -0
- package/build/client/_app/immutable/chunks/DUyfEzYn.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DVltcUYh.js.br +0 -0
- package/build/client/_app/immutable/chunks/DVltcUYh.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DhZcqaY_.js.br +0 -0
- package/build/client/_app/immutable/chunks/DhZcqaY_.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DhdrUn_f.js.br +0 -0
- package/build/client/_app/immutable/chunks/DhdrUn_f.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Dum30Kwq.js.br +0 -0
- package/build/client/_app/immutable/chunks/Dum30Kwq.js.gz +0 -0
- package/build/client/_app/immutable/chunks/HjHUkJwY.js.br +0 -0
- package/build/client/_app/immutable/chunks/HjHUkJwY.js.gz +0 -0
- package/build/client/_app/immutable/chunks/I_-yJuBL.js.br +0 -0
- package/build/client/_app/immutable/chunks/I_-yJuBL.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Kz2E8r37.js.br +0 -1
- package/build/client/_app/immutable/chunks/Kz2E8r37.js.gz +0 -0
- package/build/client/_app/immutable/chunks/N8Gha39e.js.br +0 -0
- package/build/client/_app/immutable/chunks/N8Gha39e.js.gz +0 -0
- package/build/client/_app/immutable/chunks/T9AsXuo8.js.br +0 -0
- package/build/client/_app/immutable/chunks/T9AsXuo8.js.gz +0 -0
- package/build/client/_app/immutable/chunks/XLpt2pHa.js.br +0 -0
- package/build/client/_app/immutable/chunks/XLpt2pHa.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.CI9gKeRy.js.br +0 -0
- package/build/client/_app/immutable/entry/app.CI9gKeRy.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.B0Wt4zHW.js +0 -1
- package/build/client/_app/immutable/entry/start.B0Wt4zHW.js.br +0 -0
- package/build/client/_app/immutable/entry/start.B0Wt4zHW.js.gz +0 -0
- package/build/client/_app/immutable/nodes/0.SOXcKt4H.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.SOXcKt4H.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.a-BZXuZt.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.a-BZXuZt.js.gz +0 -0
- package/build/client/_app/immutable/nodes/10.DLnyC5NT.js.br +0 -0
- package/build/client/_app/immutable/nodes/10.DLnyC5NT.js.gz +0 -0
- package/build/client/_app/immutable/nodes/11.4PSwlKy0.js.br +0 -0
- package/build/client/_app/immutable/nodes/11.4PSwlKy0.js.gz +0 -0
- package/build/client/_app/immutable/nodes/12.DgxAtSPR.js.br +0 -0
- package/build/client/_app/immutable/nodes/12.DgxAtSPR.js.gz +0 -0
- package/build/client/_app/immutable/nodes/13._Ol8NYtQ.js.br +0 -0
- package/build/client/_app/immutable/nodes/13._Ol8NYtQ.js.gz +0 -0
- package/build/client/_app/immutable/nodes/14.DoXQTncs.js.br +0 -0
- package/build/client/_app/immutable/nodes/14.DoXQTncs.js.gz +0 -0
- package/build/client/_app/immutable/nodes/15.5DEbDyax.js.br +0 -0
- package/build/client/_app/immutable/nodes/15.5DEbDyax.js.gz +0 -0
- package/build/client/_app/immutable/nodes/16.SQWDXY2I.js.br +0 -0
- package/build/client/_app/immutable/nodes/16.SQWDXY2I.js.gz +0 -0
- package/build/client/_app/immutable/nodes/17.CasB-8ln.js.br +0 -0
- package/build/client/_app/immutable/nodes/17.CasB-8ln.js.gz +0 -0
- package/build/client/_app/immutable/nodes/18.BAczHbDD.js.br +0 -0
- package/build/client/_app/immutable/nodes/18.BAczHbDD.js.gz +0 -0
- package/build/client/_app/immutable/nodes/19.DXAMDWal.js.br +0 -0
- package/build/client/_app/immutable/nodes/19.DXAMDWal.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.ynCXvpKT.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.ynCXvpKT.js.gz +0 -0
- package/build/client/_app/immutable/nodes/20.HXzvTavr.js.br +0 -0
- package/build/client/_app/immutable/nodes/20.HXzvTavr.js.gz +0 -0
- package/build/client/_app/immutable/nodes/21.BtJKIHjo.js.br +0 -0
- package/build/client/_app/immutable/nodes/21.BtJKIHjo.js.gz +0 -0
- package/build/client/_app/immutable/nodes/22.NI4OHi3d.js.br +0 -0
- package/build/client/_app/immutable/nodes/22.NI4OHi3d.js.gz +0 -0
- package/build/client/_app/immutable/nodes/23.tSDk3C1r.js.br +0 -0
- package/build/client/_app/immutable/nodes/23.tSDk3C1r.js.gz +0 -0
- package/build/client/_app/immutable/nodes/24.B5Tab48v.js.br +0 -0
- package/build/client/_app/immutable/nodes/24.B5Tab48v.js.gz +0 -0
- package/build/client/_app/immutable/nodes/25.DtjHBqgn.js.br +0 -0
- package/build/client/_app/immutable/nodes/25.DtjHBqgn.js.gz +0 -0
- package/build/client/_app/immutable/nodes/26.FOz7fg2Q.js.br +0 -0
- package/build/client/_app/immutable/nodes/26.FOz7fg2Q.js.gz +0 -0
- package/build/client/_app/immutable/nodes/28.Ddrbfwzj.js.br +0 -0
- package/build/client/_app/immutable/nodes/28.Ddrbfwzj.js.gz +0 -0
- package/build/client/_app/immutable/nodes/3.uurBYeAR.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.uurBYeAR.js.gz +0 -0
- package/build/client/_app/immutable/nodes/30.BkVqi32a.js.br +0 -0
- package/build/client/_app/immutable/nodes/30.BkVqi32a.js.gz +0 -0
- package/build/client/_app/immutable/nodes/31.BpCe4YZd.js.br +0 -0
- package/build/client/_app/immutable/nodes/31.BpCe4YZd.js.gz +0 -0
- package/build/client/_app/immutable/nodes/32.B0-J2UfW.js.br +0 -0
- package/build/client/_app/immutable/nodes/32.B0-J2UfW.js.gz +0 -0
- package/build/client/_app/immutable/nodes/33._Eb7SINu.js.br +0 -0
- package/build/client/_app/immutable/nodes/33._Eb7SINu.js.gz +0 -0
- package/build/client/_app/immutable/nodes/34.BFbXwyzz.js.br +0 -0
- package/build/client/_app/immutable/nodes/34.BFbXwyzz.js.gz +0 -0
- package/build/client/_app/immutable/nodes/35.DWcXHizu.js.br +0 -0
- package/build/client/_app/immutable/nodes/35.DWcXHizu.js.gz +0 -0
- package/build/client/_app/immutable/nodes/36.fbI8i5v7.js.br +0 -0
- package/build/client/_app/immutable/nodes/36.fbI8i5v7.js.gz +0 -0
- package/build/client/_app/immutable/nodes/37.CIYgEXVz.js.br +0 -0
- package/build/client/_app/immutable/nodes/37.CIYgEXVz.js.gz +0 -0
- package/build/client/_app/immutable/nodes/38.BOJ3vJzU.js.br +0 -0
- package/build/client/_app/immutable/nodes/38.BOJ3vJzU.js.gz +0 -0
- package/build/client/_app/immutable/nodes/39.aAwz5CPN.js.br +0 -0
- package/build/client/_app/immutable/nodes/39.aAwz5CPN.js.gz +0 -0
- package/build/client/_app/immutable/nodes/4.jGQeqVXr.js.br +0 -0
- package/build/client/_app/immutable/nodes/4.jGQeqVXr.js.gz +0 -0
- package/build/client/_app/immutable/nodes/40.CvHYslu6.js.br +0 -0
- package/build/client/_app/immutable/nodes/40.CvHYslu6.js.gz +0 -0
- package/build/client/_app/immutable/nodes/41.CMPN_2XH.js.br +0 -0
- package/build/client/_app/immutable/nodes/41.CMPN_2XH.js.gz +0 -0
- package/build/client/_app/immutable/nodes/42.BYpn2R-a.js.br +0 -0
- package/build/client/_app/immutable/nodes/42.BYpn2R-a.js.gz +0 -0
- package/build/client/_app/immutable/nodes/44.Bj9vohCn.js.br +0 -0
- package/build/client/_app/immutable/nodes/44.Bj9vohCn.js.gz +0 -0
- package/build/client/_app/immutable/nodes/5.DClLUmjz.js.br +0 -0
- package/build/client/_app/immutable/nodes/5.DClLUmjz.js.gz +0 -0
- package/build/client/_app/immutable/nodes/6.DszoCJEl.js.br +0 -0
- package/build/client/_app/immutable/nodes/6.DszoCJEl.js.gz +0 -0
- package/build/client/_app/immutable/nodes/9.B_o37ZWA.js.br +0 -0
- package/build/client/_app/immutable/nodes/9.B_o37ZWA.js.gz +0 -0
|
@@ -2,12 +2,12 @@ import { createHash, randomUUID, randomBytes, createHmac, timingSafeEqual } from
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { readFile, readdir, stat, open, realpath, mkdir, cp, writeFile, rename, rm, access, constants as constants$1, lstat, unlink, truncate, appendFile, copyFile, mkdtemp } from 'node:fs/promises';
|
|
4
4
|
import { setTimeout as setTimeout$1 } from 'node:timers/promises';
|
|
5
|
-
import { v as version, p as parsePasskeys } from './package.js-
|
|
6
|
-
import { k as killAllRunning, f as firstmateTmux, s as sessionEnv, r as runBounded, w as which, T as TmuxBackend, a as firstmateTmuxName, b as
|
|
5
|
+
import { v as version, p as parsePasskeys } from './package.js-X-RlQsSA.js';
|
|
6
|
+
import { k as killAllRunning, f as firstmateTmux, s as sessionEnv, r as runBounded, w as which, T as TmuxBackend, a as firstmateTmuxName, b as firstmateServers, c as TMUX_SOCKET, d as serverArgs, e as shellLine, g as sameDir, h as cleanCommand$1 } from './tmux.js-BnFtiGpm.js';
|
|
7
7
|
import { spawn, execFile, execFileSync } from 'node:child_process';
|
|
8
|
-
import os, {
|
|
8
|
+
import os, { loadavg, homedir, tmpdir } from 'node:os';
|
|
9
9
|
import { f as featureSettings, c as cloudSignInPending, r as readAnswers, i as isCloudMachine } from './features.js-BhXyRT_1.js';
|
|
10
|
-
import { readFileSync, existsSync, mkdirSync, writeFileSync, renameSync, openSync, closeSync, watch, statSync, fstatSync, readSync,
|
|
10
|
+
import { readFileSync, existsSync, mkdirSync, writeFileSync, renameSync, openSync, closeSync, watch, statSync, fstatSync, readSync, constants as constants$2, realpathSync, lstatSync, rmSync, accessSync } from 'node:fs';
|
|
11
11
|
import { h as hostLabel, u as unreachable, H as HERE, f as fleetyardMachine, l as linkProblem, w as withoutTransport } from './matelink.js-D9ilVdpZ.js';
|
|
12
12
|
import { d as defaultStateDir, i as isInside, s as storeFileFor, M as MessageStore, c as changeRoute, a as isChangeRequest, r as readyTimes, h as homeKey, t as taskRuns, D as DECISIVE, C as CI_READY_NOTE, w as workerWindow } from './store.js-CBYhaqF1.js';
|
|
13
13
|
import { parseDocument, parse as parse$1 } from 'yaml';
|
|
@@ -7656,9 +7656,9 @@ class HerdrBackend {
|
|
|
7656
7656
|
* keeping the terminal herdr reported for the workspace's pane.
|
|
7657
7657
|
*/
|
|
7658
7658
|
async startInWorkspace(sh, spec) {
|
|
7659
|
-
const
|
|
7659
|
+
const launch2 = `${this.recordFile}.${randomBytes(4).toString("hex")}.sh`;
|
|
7660
7660
|
try {
|
|
7661
|
-
await writeFile(
|
|
7661
|
+
await writeFile(launch2, launchScript(sh, spec), { mode: 448 });
|
|
7662
7662
|
} catch (e) {
|
|
7663
7663
|
return { error: `herdr could not start Firstmate: ${e.message}` };
|
|
7664
7664
|
}
|
|
@@ -7673,21 +7673,21 @@ class HerdrBackend {
|
|
|
7673
7673
|
"--no-focus"
|
|
7674
7674
|
]);
|
|
7675
7675
|
if (!w.ok) {
|
|
7676
|
-
await rm(
|
|
7676
|
+
await rm(launch2, { force: true });
|
|
7677
7677
|
return { error: `herdr could not start Firstmate: ${herdrError(w)}` };
|
|
7678
7678
|
}
|
|
7679
7679
|
const pane = obj(obj(json(w.stdout)?.result).root_pane);
|
|
7680
7680
|
const paneId = str$3(pane.pane_id);
|
|
7681
7681
|
const terminalId = str$3(pane.terminal_id);
|
|
7682
7682
|
if (!paneId || !terminalId) {
|
|
7683
|
-
await rm(
|
|
7683
|
+
await rm(launch2, { force: true });
|
|
7684
7684
|
return {
|
|
7685
7685
|
error: `herdr opened a workspace for Firstmate but did not say which pane it is in. Close it in herdr session "${this.session}" before starting again.`
|
|
7686
7686
|
};
|
|
7687
7687
|
}
|
|
7688
|
-
const r = await this.herdr(["pane", "run", paneId, `exec ${shellLine([sh,
|
|
7688
|
+
const r = await this.herdr(["pane", "run", paneId, `exec ${shellLine([sh, launch2])}`]);
|
|
7689
7689
|
if (!r.ok) {
|
|
7690
|
-
await rm(
|
|
7690
|
+
await rm(launch2, { force: true });
|
|
7691
7691
|
return {
|
|
7692
7692
|
error: `herdr could not start Firstmate in pane ${paneId}: ${herdrError(r)}. Close that pane in herdr session "${this.session}" before starting again.`
|
|
7693
7693
|
};
|
|
@@ -16258,12 +16258,12 @@ class ServicePorts {
|
|
|
16258
16258
|
changed = true;
|
|
16259
16259
|
}
|
|
16260
16260
|
}
|
|
16261
|
-
const
|
|
16261
|
+
const blocked2 = new Set(avoid);
|
|
16262
16262
|
const held = entries[key];
|
|
16263
|
-
if (!held ||
|
|
16264
|
-
for (const [k, e] of Object.entries(entries)) if (k !== key)
|
|
16263
|
+
if (!held || blocked2.has(held.port)) {
|
|
16264
|
+
for (const [k, e] of Object.entries(entries)) if (k !== key) blocked2.add(e.port);
|
|
16265
16265
|
let port = preferred;
|
|
16266
|
-
while (port < MAX_PORT && (
|
|
16266
|
+
while (port < MAX_PORT && (blocked2.has(port) || !await free(port))) port++;
|
|
16267
16267
|
entries[key] = { project, port };
|
|
16268
16268
|
changed = true;
|
|
16269
16269
|
}
|
|
@@ -16380,10 +16380,10 @@ class ServiceManager {
|
|
|
16380
16380
|
if (spec.binds !== "loopback") {
|
|
16381
16381
|
return Promise.resolve({ state: "unavailable", url: spec.url, reason: this.bindReason() });
|
|
16382
16382
|
}
|
|
16383
|
-
const
|
|
16384
|
-
|
|
16385
|
-
this.launches.set(key,
|
|
16386
|
-
return
|
|
16383
|
+
const launch2 = { done: Promise.resolve(null), child: null };
|
|
16384
|
+
launch2.done = this.start(key, spec, launch2).finally(() => this.launches.delete(key));
|
|
16385
|
+
this.launches.set(key, launch2);
|
|
16386
|
+
return launch2.done;
|
|
16387
16387
|
}
|
|
16388
16388
|
bindReason() {
|
|
16389
16389
|
return "It listens on every network interface, and Wheelhouse only starts services that listen on this computer alone.";
|
|
@@ -16398,7 +16398,7 @@ class ServiceManager {
|
|
|
16398
16398
|
logFile(key) {
|
|
16399
16399
|
return path.join(this.host.logDir, `${key.replace(/[^A-Za-z0-9._-]+/g, "_")}.log`);
|
|
16400
16400
|
}
|
|
16401
|
-
async start(key, spec,
|
|
16401
|
+
async start(key, spec, launch2) {
|
|
16402
16402
|
const first = await this.answers(spec);
|
|
16403
16403
|
if (first === "other") return this.other(spec);
|
|
16404
16404
|
if (first === "up") return { state: "running", url: spec.url, reason: null };
|
|
@@ -16413,7 +16413,7 @@ class ServiceManager {
|
|
|
16413
16413
|
env,
|
|
16414
16414
|
log,
|
|
16415
16415
|
Math.min(step.timeoutMs, MAX_SETUP_MS),
|
|
16416
|
-
|
|
16416
|
+
launch2
|
|
16417
16417
|
);
|
|
16418
16418
|
if (code !== 0) {
|
|
16419
16419
|
return this.failed(
|
|
@@ -16432,7 +16432,7 @@ class ServiceManager {
|
|
|
16432
16432
|
detached: true,
|
|
16433
16433
|
stdio: ["ignore", fd, fd]
|
|
16434
16434
|
});
|
|
16435
|
-
|
|
16435
|
+
launch2.child = child;
|
|
16436
16436
|
child.on("exit", (code) => exited = code);
|
|
16437
16437
|
child.on("error", () => exited = exited ?? -1);
|
|
16438
16438
|
child.unref();
|
|
@@ -16455,7 +16455,7 @@ class ServiceManager {
|
|
|
16455
16455
|
env(spec) {
|
|
16456
16456
|
return serviceEnv(this.host.env ?? process.env, spec);
|
|
16457
16457
|
}
|
|
16458
|
-
runToLog(argv, cwd, env, log, timeoutMs,
|
|
16458
|
+
runToLog(argv, cwd, env, log, timeoutMs, launch2) {
|
|
16459
16459
|
return new Promise((resolve) => {
|
|
16460
16460
|
const fd = openSync(log, "a");
|
|
16461
16461
|
let child;
|
|
@@ -16467,7 +16467,7 @@ class ServiceManager {
|
|
|
16467
16467
|
return;
|
|
16468
16468
|
}
|
|
16469
16469
|
closeSync(fd);
|
|
16470
|
-
|
|
16470
|
+
launch2.child = child;
|
|
16471
16471
|
const timer = setTimeout(() => {
|
|
16472
16472
|
child.kill("SIGTERM");
|
|
16473
16473
|
resolve(null);
|
|
@@ -18998,10 +18998,10 @@ function readSignIn(screen) {
|
|
|
18998
18998
|
let paste = false;
|
|
18999
18999
|
let typed = "";
|
|
19000
19000
|
let end = -1;
|
|
19001
|
-
const
|
|
19002
|
-
if (
|
|
19001
|
+
const claude2 = CLAUDE_PASTE.exec(lines[last]);
|
|
19002
|
+
if (claude2) {
|
|
19003
19003
|
paste = true;
|
|
19004
|
-
typed =
|
|
19004
|
+
typed = claude2[1].trim();
|
|
19005
19005
|
end = last;
|
|
19006
19006
|
} else if ((end = piAsk(lines, last)) >= 0) {
|
|
19007
19007
|
paste = true;
|
|
@@ -19160,357 +19160,81 @@ function registerTrust(store, dir) {
|
|
|
19160
19160
|
}
|
|
19161
19161
|
return `${file} did not keep the trust entry for ${target}`;
|
|
19162
19162
|
}
|
|
19163
|
-
const
|
|
19164
|
-
const
|
|
19165
|
-
|
|
19166
|
-
|
|
19167
|
-
|
|
19168
|
-
|
|
19169
|
-
|
|
19170
|
-
|
|
19171
|
-
|
|
19172
|
-
|
|
19173
|
-
|
|
19174
|
-
while (end < lines.length && OPTION.test(lines[end])) end++;
|
|
19175
|
-
const options = [];
|
|
19176
|
-
for (const line of lines.slice(start, end)) {
|
|
19177
|
-
const m = OPTION.exec(line);
|
|
19178
|
-
if (!m) return { kind: "blocked", title: "Use the terminal to answer Codex." };
|
|
19179
|
-
options.push({
|
|
19180
|
-
n: Number(m[2]),
|
|
19181
|
-
label: m[3],
|
|
19182
|
-
description: "",
|
|
19183
|
-
checked: null,
|
|
19184
|
-
freeText: false
|
|
19185
|
-
});
|
|
19186
|
-
}
|
|
19187
|
-
if (options.some((option, index) => option.n !== index + 1) || !CONFIRM.test(lines.slice(end).join("\n"))) {
|
|
19188
|
-
return { kind: "blocked", title: "Use the terminal to answer Codex." };
|
|
19189
|
-
}
|
|
19190
|
-
return {
|
|
19191
|
-
kind: "picker",
|
|
19192
|
-
picker: {
|
|
19193
|
-
title: lines.slice(0, start).join("\n").trim(),
|
|
19194
|
-
tabs: [],
|
|
19195
|
-
options,
|
|
19196
|
-
multiSelect: false,
|
|
19197
|
-
submitMoves: null,
|
|
19198
|
-
navigation: { selected: cursor - start + 1 },
|
|
19199
|
-
// Include the command and every visible option, not only the repeated Yes/No labels.
|
|
19200
|
-
signature: createHash("sha256").update(text2).digest("hex").slice(0, 16)
|
|
19201
|
-
}
|
|
19202
|
-
};
|
|
19203
|
-
}
|
|
19204
|
-
const input = lines[cursor].replace(/^\s*›\s*/, "").trim();
|
|
19205
|
-
if (input && !/^(?:Ask Codex to do anything|Ask for changes|Use \/skills to list available skills|Find and fix a bug in @filename|Explain this codebase|Summarize recent commits|Write tests for @filename|Improve documentation in @filename|Implement \{feature\})$/.test(
|
|
19206
|
-
input
|
|
19207
|
-
)) {
|
|
19208
|
-
return {
|
|
19209
|
-
kind: "blocked",
|
|
19210
|
-
title: "Codex has unsent input. Send or clear it in the terminal first."
|
|
19211
|
-
};
|
|
19212
|
-
}
|
|
19213
|
-
if (cursor < lines.length - 7 || CONFIRM.test(lines.slice(cursor + 1).join("\n"))) {
|
|
19214
|
-
return { kind: "blocked", title: "Codex needs attention in its terminal." };
|
|
19215
|
-
}
|
|
19216
|
-
return { kind: "prompt", busy: /\besc to interrupt\b/i.test(text2) };
|
|
19217
|
-
}
|
|
19218
|
-
const RECEIPT_BYTES$1 = 64 * 1024;
|
|
19219
|
-
const SESSION_BYTES = 32 * 1024 * 1024;
|
|
19220
|
-
const MAX_RECORDS$1 = 6e3;
|
|
19221
|
-
function piExtensionSource() {
|
|
19222
|
-
return `import { mkdirSync, writeFileSync, renameSync } from 'node:fs';
|
|
19223
|
-
import path from 'node:path';
|
|
19224
|
-
export default function(pi) {
|
|
19225
|
-
const file = process.env.WH_SESSION_RECORD;
|
|
19226
|
-
const nonce = process.env.WH_SESSION_NONCE;
|
|
19227
|
-
if (!file || !nonce) return;
|
|
19228
|
-
let context = null, timer = null, previous = '';
|
|
19229
|
-
const save = () => {
|
|
19230
|
-
if (!context) return;
|
|
19231
|
-
try {
|
|
19232
|
-
const manager = context.sessionManager;
|
|
19233
|
-
const value = JSON.stringify({ wheelhouse_nonce: nonce, session_id: manager.getSessionId(), transcript_path: manager.getSessionFile() ?? null, cwd: context.cwd, leaf_id: manager.getLeafId(), busy: !context.isIdle() });
|
|
19234
|
-
if (value === previous || Buffer.byteLength(value) > 65536) return;
|
|
19235
|
-
mkdirSync(path.dirname(file), { recursive: true });
|
|
19236
|
-
const temp = file + '.tmp.' + process.pid;
|
|
19237
|
-
writeFileSync(temp, value, { mode: 0o600 });
|
|
19238
|
-
renameSync(temp, file);
|
|
19239
|
-
previous = value;
|
|
19240
|
-
} catch { /* Observation must not interrupt Pi's session. */ }
|
|
19241
|
-
};
|
|
19242
|
-
pi.on('session_start', (_event, ctx) => {
|
|
19243
|
-
context = ctx;
|
|
19244
|
-
save();
|
|
19245
|
-
if (timer) clearInterval(timer);
|
|
19246
|
-
// message_end fires before persistence; observe the manager after it has appended the entry.
|
|
19247
|
-
timer = setInterval(save, 250);
|
|
19248
|
-
timer.unref?.();
|
|
19249
|
-
});
|
|
19250
|
-
for (const event of ['session_tree', 'session_compact', 'agent_end']) {
|
|
19251
|
-
pi.on(event, (_event, ctx) => { context = ctx; save(); });
|
|
19252
|
-
}
|
|
19253
|
-
pi.on('session_shutdown', () => { context = null; if (timer) clearInterval(timer); timer = null; });
|
|
19254
|
-
}
|
|
19255
|
-
`;
|
|
19256
|
-
}
|
|
19163
|
+
const UUID$2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
19164
|
+
const REGISTRY_BYTES = 1024 * 1024;
|
|
19165
|
+
const SUMMARY_BYTES = 1024 * 1024;
|
|
19166
|
+
const GROK_SESSION_VARIABLE = "WH_GROK_SESSION";
|
|
19167
|
+
const isGrokSessionId = (value) => typeof value === "string" && UUID$2.test(value);
|
|
19168
|
+
const grokArgv = (binary, sessionId) => [
|
|
19169
|
+
binary,
|
|
19170
|
+
"--trust",
|
|
19171
|
+
"--session-id",
|
|
19172
|
+
sessionId
|
|
19173
|
+
];
|
|
19257
19174
|
function object$3(value) {
|
|
19258
19175
|
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
19259
19176
|
}
|
|
19260
|
-
async function
|
|
19177
|
+
async function readJson$1(file, limit) {
|
|
19261
19178
|
const handle = await open(file, "r");
|
|
19262
19179
|
try {
|
|
19263
19180
|
const size = (await handle.stat()).size;
|
|
19264
19181
|
if (size > limit) return null;
|
|
19265
19182
|
const buffer = Buffer.alloc(size);
|
|
19266
|
-
|
|
19267
|
-
|
|
19268
|
-
const { bytesRead } = await handle.read(buffer, offset, size - offset, offset);
|
|
19269
|
-
if (!bytesRead) break;
|
|
19270
|
-
offset += bytesRead;
|
|
19271
|
-
}
|
|
19272
|
-
return buffer.subarray(0, offset).toString("utf8");
|
|
19183
|
+
const { bytesRead } = await handle.read(buffer, 0, size, 0);
|
|
19184
|
+
return JSON.parse(buffer.subarray(0, bytesRead).toString("utf8"));
|
|
19273
19185
|
} finally {
|
|
19274
19186
|
await handle.close();
|
|
19275
19187
|
}
|
|
19276
19188
|
}
|
|
19277
|
-
function
|
|
19278
|
-
|
|
19279
|
-
|
|
19280
|
-
|
|
19281
|
-
|
|
19282
|
-
|
|
19283
|
-
return
|
|
19284
|
-
}).join("\n");
|
|
19285
|
-
}
|
|
19286
|
-
function normalize(entry, sessionId) {
|
|
19287
|
-
if (entry.type !== "message" || typeof entry.id !== "string" || typeof entry.timestamp !== "string")
|
|
19288
|
-
return [];
|
|
19289
|
-
const message2 = object$3(entry.message);
|
|
19290
|
-
if (!message2 || !Number.isFinite(Date.parse(entry.timestamp))) return [];
|
|
19291
|
-
const uuid = `pi:${sessionId}:${entry.id}`;
|
|
19292
|
-
const timestamp2 = entry.timestamp;
|
|
19293
|
-
if (message2.role === "user") {
|
|
19294
|
-
const content2 = contentText(message2.content);
|
|
19295
|
-
return content2.trim() ? [{ type: "user", uuid, timestamp: timestamp2, message: { role: "user", content: content2 } }] : [];
|
|
19189
|
+
async function processSessions(grokHome, launchId) {
|
|
19190
|
+
const launch2 = [{ id: launchId, openedAt: 0 }];
|
|
19191
|
+
let listed;
|
|
19192
|
+
try {
|
|
19193
|
+
listed = await readJson$1(path.join(grokHome, "active_sessions.json"), REGISTRY_BYTES);
|
|
19194
|
+
} catch {
|
|
19195
|
+
return launch2;
|
|
19296
19196
|
}
|
|
19297
|
-
if (
|
|
19298
|
-
|
|
19299
|
-
|
|
19300
|
-
|
|
19301
|
-
|
|
19302
|
-
|
|
19303
|
-
|
|
19304
|
-
|
|
19305
|
-
|
|
19306
|
-
|
|
19307
|
-
|
|
19308
|
-
|
|
19309
|
-
|
|
19310
|
-
|
|
19311
|
-
|
|
19312
|
-
|
|
19313
|
-
|
|
19197
|
+
if (!Array.isArray(listed)) return launch2;
|
|
19198
|
+
const rows = listed.flatMap((value) => {
|
|
19199
|
+
const row = object$3(value);
|
|
19200
|
+
return row && isGrokSessionId(row.session_id) && typeof row.pid === "number" && typeof row.pid_start === "number" ? [row] : [];
|
|
19201
|
+
});
|
|
19202
|
+
const own = rows.find((row) => row.session_id === launchId);
|
|
19203
|
+
if (!own) return launch2;
|
|
19204
|
+
return rows.filter((row) => row.pid === own.pid && row.pid_start === own.pid_start).map((row) => ({
|
|
19205
|
+
id: row.session_id,
|
|
19206
|
+
openedAt: typeof row.opened_at === "string" && Date.parse(row.opened_at) || 0
|
|
19207
|
+
}));
|
|
19208
|
+
}
|
|
19209
|
+
const folders = /* @__PURE__ */ new Map();
|
|
19210
|
+
async function sessionFolder(grokHome, id, cwd) {
|
|
19211
|
+
const root = path.join(grokHome, "sessions");
|
|
19212
|
+
const key = `${root}\0${id}`;
|
|
19213
|
+
let folder2 = folders.get(key) ?? null;
|
|
19214
|
+
if (!folder2) {
|
|
19215
|
+
for (const group of await readdir(root)) {
|
|
19216
|
+
const candidate = path.join(root, group, id);
|
|
19217
|
+
const found = await stat(path.join(candidate, "summary.json")).then(
|
|
19218
|
+
(s) => s.isFile(),
|
|
19219
|
+
() => false
|
|
19220
|
+
);
|
|
19221
|
+
if (found) {
|
|
19222
|
+
folder2 = candidate;
|
|
19223
|
+
break;
|
|
19314
19224
|
}
|
|
19315
|
-
|
|
19225
|
+
}
|
|
19316
19226
|
}
|
|
19317
|
-
if (
|
|
19318
|
-
const
|
|
19319
|
-
|
|
19320
|
-
|
|
19321
|
-
|
|
19322
|
-
|
|
19323
|
-
|
|
19324
|
-
find: "Glob",
|
|
19325
|
-
ls: "Glob"
|
|
19326
|
-
};
|
|
19327
|
-
const content = message2.content.flatMap((part) => {
|
|
19328
|
-
const block = object$3(part);
|
|
19329
|
-
if (!block) return [];
|
|
19330
|
-
if (block.type === "text" && typeof block.text === "string")
|
|
19331
|
-
return [{ type: "text", text: block.text }];
|
|
19332
|
-
if (block.type === "thinking") return [{ type: "thinking", thinking: "", signature: "" }];
|
|
19333
|
-
if (block.type !== "toolCall" || typeof block.id !== "string" || typeof block.name !== "string")
|
|
19334
|
-
return [];
|
|
19335
|
-
const input = object$3(block.arguments);
|
|
19336
|
-
if (!input) return [];
|
|
19337
|
-
return [
|
|
19338
|
-
{
|
|
19339
|
-
type: "tool_use",
|
|
19340
|
-
id: `pi:${sessionId}:${block.id}`,
|
|
19341
|
-
name: names[block.name] ?? block.name,
|
|
19342
|
-
input: { ...input, ...typeof input.path === "string" ? { file_path: input.path } : {} }
|
|
19343
|
-
}
|
|
19344
|
-
];
|
|
19345
|
-
});
|
|
19346
|
-
if (message2.stopReason === "error" && typeof message2.errorMessage === "string")
|
|
19347
|
-
content.push({ type: "text", text: message2.errorMessage });
|
|
19348
|
-
const records2 = content.length ? [{ type: "assistant", uuid, timestamp: timestamp2, message: { id: uuid, role: "assistant", content } }] : [];
|
|
19349
|
-
if (message2.stopReason === "aborted")
|
|
19350
|
-
records2.push({
|
|
19351
|
-
type: "user",
|
|
19352
|
-
uuid: `${uuid}:interrupted`,
|
|
19353
|
-
timestamp: timestamp2,
|
|
19354
|
-
message: { role: "user", content: "[Request interrupted by user]" }
|
|
19355
|
-
});
|
|
19356
|
-
if (["stop", "length", "error", "aborted"].includes(String(message2.stopReason)))
|
|
19357
|
-
records2.push({
|
|
19358
|
-
type: "system",
|
|
19359
|
-
subtype: "turn_duration",
|
|
19360
|
-
uuid: `${uuid}:done`,
|
|
19361
|
-
timestamp: timestamp2,
|
|
19362
|
-
durationMs: null
|
|
19363
|
-
});
|
|
19364
|
-
return records2;
|
|
19227
|
+
if (!folder2) return null;
|
|
19228
|
+
const summary2 = object$3(await readJson$1(path.join(folder2, "summary.json"), SUMMARY_BYTES));
|
|
19229
|
+
const info = object$3(summary2?.info);
|
|
19230
|
+
if (info?.id !== id || typeof info.cwd !== "string" || !path.isAbsolute(info.cwd) || await realpath(info.cwd) !== cwd)
|
|
19231
|
+
return null;
|
|
19232
|
+
folders.set(key, folder2);
|
|
19233
|
+
return folder2;
|
|
19365
19234
|
}
|
|
19366
|
-
async function
|
|
19367
|
-
|
|
19368
|
-
|
|
19369
|
-
const receiptText2 = await readBounded(opts.hookFile, RECEIPT_BYTES$1);
|
|
19370
|
-
const receipt = receiptText2 === null ? null : object$3(JSON.parse(receiptText2));
|
|
19371
|
-
if (!receipt || receipt.wheelhouse_nonce !== opts.sessionNonce || typeof receipt.session_id !== "string" || !receipt.session_id || typeof receipt.transcript_path !== "string" || !path.isAbsolute(receipt.transcript_path) || typeof receipt.cwd !== "string" || !path.isAbsolute(receipt.cwd) || !(receipt.leaf_id === null || typeof receipt.leaf_id === "string"))
|
|
19372
|
-
return null;
|
|
19373
|
-
const sessionId = receipt.session_id;
|
|
19374
|
-
const [cwd, receiptCwd, root, file] = await Promise.all([
|
|
19375
|
-
realpath(opts.firstmateDir),
|
|
19376
|
-
realpath(receipt.cwd),
|
|
19377
|
-
realpath(path.join(opts.agentDir, "sessions")),
|
|
19378
|
-
realpath(receipt.transcript_path)
|
|
19379
|
-
]);
|
|
19380
|
-
const relative = path.relative(root, file);
|
|
19381
|
-
if (cwd !== receiptCwd || !relative || relative.startsWith("..") || path.isAbsolute(relative))
|
|
19382
|
-
return null;
|
|
19383
|
-
const text2 = await readBounded(file, SESSION_BYTES);
|
|
19384
|
-
if (text2 === null) return null;
|
|
19385
|
-
const lines = text2.split("\n");
|
|
19386
|
-
lines.pop();
|
|
19387
|
-
const header = object$3(JSON.parse(lines.shift() ?? "null"));
|
|
19388
|
-
if (!header || header.type !== "session" || header.version !== 3 || header.id !== receipt.session_id || typeof header.cwd !== "string" || await realpath(header.cwd) !== cwd)
|
|
19389
|
-
return null;
|
|
19390
|
-
const entries = /* @__PURE__ */ new Map();
|
|
19391
|
-
for (const line of lines) {
|
|
19392
|
-
if (!line.trim()) continue;
|
|
19393
|
-
const entry = object$3(JSON.parse(line));
|
|
19394
|
-
if (!entry || typeof entry.id !== "string" || !(entry.parentId === null || typeof entry.parentId === "string") || entries.has(entry.id))
|
|
19395
|
-
return null;
|
|
19396
|
-
entries.set(entry.id, entry);
|
|
19397
|
-
}
|
|
19398
|
-
const branch = [];
|
|
19399
|
-
const seen = /* @__PURE__ */ new Set();
|
|
19400
|
-
let leaf = receipt.leaf_id;
|
|
19401
|
-
while (leaf !== null) {
|
|
19402
|
-
if (seen.has(leaf)) return null;
|
|
19403
|
-
seen.add(leaf);
|
|
19404
|
-
const entry = entries.get(leaf);
|
|
19405
|
-
if (!entry) return null;
|
|
19406
|
-
branch.push(entry);
|
|
19407
|
-
leaf = typeof entry.parentId === "string" ? entry.parentId : null;
|
|
19408
|
-
}
|
|
19409
|
-
const records2 = branch.reverse().flatMap((entry) => normalize(entry, sessionId));
|
|
19410
|
-
return {
|
|
19411
|
-
source: { how: "hook", file, truncated: records2.length > MAX_RECORDS$1 },
|
|
19412
|
-
records: records2.slice(-MAX_RECORDS$1)
|
|
19413
|
-
};
|
|
19414
|
-
} catch {
|
|
19415
|
-
return null;
|
|
19416
|
-
}
|
|
19417
|
-
}
|
|
19418
|
-
function piScreen(text2) {
|
|
19419
|
-
const blocked = { kind: "blocked", title: "Pi needs attention in its terminal." };
|
|
19420
|
-
if (text2 === null) return blocked;
|
|
19421
|
-
const lines = text2.replace(/\r/g, "").trimEnd().split("\n");
|
|
19422
|
-
const rule = /^\s*─{12,}\s*$/;
|
|
19423
|
-
const bottom = lines.findLastIndex((line) => rule.test(line));
|
|
19424
|
-
if (bottom < 2 || bottom < lines.length - 5 || bottom >= lines.length - 1) return blocked;
|
|
19425
|
-
const footer = lines.slice(bottom + 1);
|
|
19426
|
-
if (!/^\s*(?:\/|~(?:\/|$))/.test(footer[0]) || footer.some((line) => /\b(?:select|confirm|cancel)\b/i.test(line)))
|
|
19427
|
-
return blocked;
|
|
19428
|
-
let top = bottom - 1;
|
|
19429
|
-
while (top >= Math.max(0, bottom - 12) && !rule.test(lines[top]) && !/^── .*\bWorking\b.*─{8,}\s*$/.test(lines[top]))
|
|
19430
|
-
top--;
|
|
19431
|
-
if (top < 0 || top < bottom - 12) return blocked;
|
|
19432
|
-
if (lines.slice(top + 1, bottom).some((line) => line.trim()))
|
|
19433
|
-
return {
|
|
19434
|
-
kind: "blocked",
|
|
19435
|
-
title: "Pi has unsent input or a dialog. Send or clear it in the terminal first."
|
|
19436
|
-
};
|
|
19437
|
-
return { kind: "prompt", busy: /\bWorking\b/.test(lines[top]) };
|
|
19438
|
-
}
|
|
19439
|
-
const UUID$2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
19440
|
-
const REGISTRY_BYTES = 1024 * 1024;
|
|
19441
|
-
const SUMMARY_BYTES = 1024 * 1024;
|
|
19442
|
-
const GROK_SESSION_VARIABLE = "WH_GROK_SESSION";
|
|
19443
|
-
const isGrokSessionId = (value) => typeof value === "string" && UUID$2.test(value);
|
|
19444
|
-
const grokArgv = (binary, sessionId) => [
|
|
19445
|
-
binary,
|
|
19446
|
-
"--trust",
|
|
19447
|
-
"--session-id",
|
|
19448
|
-
sessionId
|
|
19449
|
-
];
|
|
19450
|
-
function object$2(value) {
|
|
19451
|
-
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
19452
|
-
}
|
|
19453
|
-
async function readJson$1(file, limit) {
|
|
19454
|
-
const handle = await open(file, "r");
|
|
19455
|
-
try {
|
|
19456
|
-
const size = (await handle.stat()).size;
|
|
19457
|
-
if (size > limit) return null;
|
|
19458
|
-
const buffer = Buffer.alloc(size);
|
|
19459
|
-
const { bytesRead } = await handle.read(buffer, 0, size, 0);
|
|
19460
|
-
return JSON.parse(buffer.subarray(0, bytesRead).toString("utf8"));
|
|
19461
|
-
} finally {
|
|
19462
|
-
await handle.close();
|
|
19463
|
-
}
|
|
19464
|
-
}
|
|
19465
|
-
async function processSessions(grokHome, launchId) {
|
|
19466
|
-
const launch = [{ id: launchId, openedAt: 0 }];
|
|
19467
|
-
let listed;
|
|
19468
|
-
try {
|
|
19469
|
-
listed = await readJson$1(path.join(grokHome, "active_sessions.json"), REGISTRY_BYTES);
|
|
19470
|
-
} catch {
|
|
19471
|
-
return launch;
|
|
19472
|
-
}
|
|
19473
|
-
if (!Array.isArray(listed)) return launch;
|
|
19474
|
-
const rows = listed.flatMap((value) => {
|
|
19475
|
-
const row = object$2(value);
|
|
19476
|
-
return row && isGrokSessionId(row.session_id) && typeof row.pid === "number" && typeof row.pid_start === "number" ? [row] : [];
|
|
19477
|
-
});
|
|
19478
|
-
const own = rows.find((row) => row.session_id === launchId);
|
|
19479
|
-
if (!own) return launch;
|
|
19480
|
-
return rows.filter((row) => row.pid === own.pid && row.pid_start === own.pid_start).map((row) => ({
|
|
19481
|
-
id: row.session_id,
|
|
19482
|
-
openedAt: typeof row.opened_at === "string" && Date.parse(row.opened_at) || 0
|
|
19483
|
-
}));
|
|
19484
|
-
}
|
|
19485
|
-
const folders = /* @__PURE__ */ new Map();
|
|
19486
|
-
async function sessionFolder(grokHome, id, cwd) {
|
|
19487
|
-
const root = path.join(grokHome, "sessions");
|
|
19488
|
-
const key = `${root}\0${id}`;
|
|
19489
|
-
let folder2 = folders.get(key) ?? null;
|
|
19490
|
-
if (!folder2) {
|
|
19491
|
-
for (const group of await readdir(root)) {
|
|
19492
|
-
const candidate = path.join(root, group, id);
|
|
19493
|
-
const found = await stat(path.join(candidate, "summary.json")).then(
|
|
19494
|
-
(s) => s.isFile(),
|
|
19495
|
-
() => false
|
|
19496
|
-
);
|
|
19497
|
-
if (found) {
|
|
19498
|
-
folder2 = candidate;
|
|
19499
|
-
break;
|
|
19500
|
-
}
|
|
19501
|
-
}
|
|
19502
|
-
}
|
|
19503
|
-
if (!folder2) return null;
|
|
19504
|
-
const summary2 = object$2(await readJson$1(path.join(folder2, "summary.json"), SUMMARY_BYTES));
|
|
19505
|
-
const info = object$2(summary2?.info);
|
|
19506
|
-
if (info?.id !== id || typeof info.cwd !== "string" || !path.isAbsolute(info.cwd) || await realpath(info.cwd) !== cwd)
|
|
19507
|
-
return null;
|
|
19508
|
-
folders.set(key, folder2);
|
|
19509
|
-
return folder2;
|
|
19510
|
-
}
|
|
19511
|
-
async function locateGrokTranscript(opts, state2) {
|
|
19512
|
-
const launchId = opts.sessionId;
|
|
19513
|
-
if (state2 !== "ours" || !isGrokSessionId(launchId)) return null;
|
|
19235
|
+
async function locateGrokTranscript(opts, state2) {
|
|
19236
|
+
const launchId = opts.sessionId;
|
|
19237
|
+
if (state2 !== "ours" || !isGrokSessionId(launchId)) return null;
|
|
19514
19238
|
try {
|
|
19515
19239
|
const cwd = await realpath(opts.firstmateDir);
|
|
19516
19240
|
let best = null;
|
|
@@ -19543,15 +19267,15 @@ const TOOL_NAMES = {
|
|
|
19543
19267
|
todo_write: "TodoWrite"
|
|
19544
19268
|
};
|
|
19545
19269
|
function toolUse(update) {
|
|
19546
|
-
const raw = object$
|
|
19547
|
-
const tool = object$
|
|
19270
|
+
const raw = object$3(update.rawInput) ?? {};
|
|
19271
|
+
const tool = object$3(object$3(update._meta)?.["x.ai/tool"]);
|
|
19548
19272
|
const native = typeof tool?.name === "string" ? tool.name : String(update.title ?? "");
|
|
19549
19273
|
if (native === "use_tool" && typeof raw.tool_name === "string") {
|
|
19550
19274
|
const at = raw.tool_name.indexOf("__");
|
|
19551
19275
|
if (at > 0)
|
|
19552
19276
|
return {
|
|
19553
19277
|
name: `mcp__${raw.tool_name.slice(0, at)}__${raw.tool_name.slice(at + 2)}`,
|
|
19554
|
-
input: object$
|
|
19278
|
+
input: object$3(raw.tool_input) ?? {}
|
|
19555
19279
|
};
|
|
19556
19280
|
}
|
|
19557
19281
|
if (raw.variant === "WebSearch") return { name: "WebSearch", input: raw };
|
|
@@ -19563,7 +19287,7 @@ function toolUse(update) {
|
|
|
19563
19287
|
const OUTPUT_TEXT = ["tool_output_for_prompt", "output_for_prompt", "message", "text", "Error"];
|
|
19564
19288
|
function outputText(value, depth = 0) {
|
|
19565
19289
|
if (typeof value === "string") return value;
|
|
19566
|
-
const output = object$
|
|
19290
|
+
const output = object$3(value);
|
|
19567
19291
|
if (!output || depth > 2) return "";
|
|
19568
19292
|
for (const key of OUTPUT_TEXT) if (typeof output[key] === "string") return output[key];
|
|
19569
19293
|
const nested = outputText(output.output, depth + 1);
|
|
@@ -19573,24 +19297,24 @@ function outputText(value, depth = 0) {
|
|
|
19573
19297
|
}
|
|
19574
19298
|
function resultText(update) {
|
|
19575
19299
|
const shown = (Array.isArray(update.content) ? update.content : []).flatMap((part) => {
|
|
19576
|
-
const content = object$
|
|
19300
|
+
const content = object$3(object$3(part)?.content);
|
|
19577
19301
|
if (content?.type === "text" && typeof content.text === "string") return [content.text];
|
|
19578
19302
|
return content?.type === "image" ? ["[image]"] : [];
|
|
19579
19303
|
});
|
|
19580
19304
|
return shown.length ? shown.join("\n") : outputText(update.rawOutput);
|
|
19581
19305
|
}
|
|
19582
19306
|
function grokRecords(raw) {
|
|
19583
|
-
const line = object$
|
|
19584
|
-
const params2 = object$
|
|
19585
|
-
const update = object$
|
|
19586
|
-
const meta = object$
|
|
19307
|
+
const line = object$3(raw);
|
|
19308
|
+
const params2 = object$3(line?.params);
|
|
19309
|
+
const update = object$3(params2?.update);
|
|
19310
|
+
const meta = object$3(params2?._meta);
|
|
19587
19311
|
if (!line || !update || typeof meta?.eventId !== "string" || !meta.eventId) return [];
|
|
19588
19312
|
const ms = typeof meta.agentTimestampMs === "number" ? meta.agentTimestampMs : typeof line.timestamp === "number" ? line.timestamp * 1e3 : NaN;
|
|
19589
19313
|
if (!Number.isFinite(ms) || Math.abs(ms) > 864e13) return [];
|
|
19590
19314
|
const timestamp2 = new Date(ms).toISOString();
|
|
19591
19315
|
const uuid = `grok:${meta.eventId}`;
|
|
19592
19316
|
const text2 = () => {
|
|
19593
|
-
const content = object$
|
|
19317
|
+
const content = object$3(update.content);
|
|
19594
19318
|
return content?.type === "text" && typeof content.text === "string" ? content.text : "";
|
|
19595
19319
|
};
|
|
19596
19320
|
const assistant = (content) => ({
|
|
@@ -19601,7 +19325,7 @@ function grokRecords(raw) {
|
|
|
19601
19325
|
});
|
|
19602
19326
|
switch (update.sessionUpdate) {
|
|
19603
19327
|
case "user_message_chunk": {
|
|
19604
|
-
const hidden = object$
|
|
19328
|
+
const hidden = object$3(update._meta);
|
|
19605
19329
|
if (hidden?.hideFromScrollback === true || hidden?.syntheticPrompt === true) return [];
|
|
19606
19330
|
const content = text2();
|
|
19607
19331
|
return content.trim() ? [{ type: "user", uuid, timestamp: timestamp2, message: { role: "user", content } }] : [];
|
|
@@ -19621,7 +19345,7 @@ function grokRecords(raw) {
|
|
|
19621
19345
|
case "tool_call_update": {
|
|
19622
19346
|
if (typeof update.toolCallId !== "string" || update.status !== "completed" && update.status !== "failed")
|
|
19623
19347
|
return [];
|
|
19624
|
-
const output = object$
|
|
19348
|
+
const output = object$3(update.rawOutput);
|
|
19625
19349
|
return [
|
|
19626
19350
|
{
|
|
19627
19351
|
type: "user",
|
|
@@ -19671,29 +19395,29 @@ const ROW$1 = /^\s*│\s(.*)│\s*$/;
|
|
|
19671
19395
|
const PLACEHOLDER = /^Type a message\.\.\.$/;
|
|
19672
19396
|
const COMPOSER_ROWS = 12;
|
|
19673
19397
|
function grokScreen(text2) {
|
|
19674
|
-
const
|
|
19675
|
-
if (text2 === null) return
|
|
19398
|
+
const blocked2 = { kind: "blocked", title: "Grok needs attention in its terminal." };
|
|
19399
|
+
if (text2 === null) return blocked2;
|
|
19676
19400
|
const lines = text2.replace(/\r/g, "").trimEnd().split("\n");
|
|
19677
19401
|
const bottom = lines.findLastIndex((line) => BOTTOM.test(line));
|
|
19678
|
-
if (bottom < 2 || bottom < lines.length - 4 || bottom >= lines.length - 1) return
|
|
19402
|
+
if (bottom < 2 || bottom < lines.length - 4 || bottom >= lines.length - 1) return blocked2;
|
|
19679
19403
|
const hints = lines.slice(bottom + 1).join("\n").split(/[│\n]/).map((hint) => hint.trim()).filter(Boolean);
|
|
19680
|
-
if (!hints.includes("Shift+Tab:mode") || !hints.includes("Ctrl+x:shortcuts")) return
|
|
19404
|
+
if (!hints.includes("Shift+Tab:mode") || !hints.includes("Ctrl+x:shortcuts")) return blocked2;
|
|
19681
19405
|
let top = bottom - 1;
|
|
19682
19406
|
while (top >= Math.max(0, bottom - COMPOSER_ROWS) && ROW$1.test(lines[top])) top--;
|
|
19683
19407
|
const rows = lines.slice(top + 1, bottom).map((line) => ROW$1.exec(line)[1].trim());
|
|
19684
|
-
if (top < 0 || !TOP.test(lines[top]) || !rows.length || !rows[0].startsWith("❯")) return
|
|
19408
|
+
if (top < 0 || !TOP.test(lines[top]) || !rows.length || !rows[0].startsWith("❯")) return blocked2;
|
|
19685
19409
|
const typed = [rows[0].slice(1).trim(), ...rows.slice(1)].join("\n").trim();
|
|
19686
19410
|
if (typed && !PLACEHOLDER.test(typed))
|
|
19687
19411
|
return {
|
|
19688
19412
|
kind: "blocked",
|
|
19689
19413
|
title: "Grok has unsent input. Send or clear it in the terminal first."
|
|
19690
19414
|
};
|
|
19691
|
-
if (hints.some((hint) => /^(?:Enter|Tab|Esc):/i.test(hint))) return
|
|
19415
|
+
if (hints.some((hint) => /^(?:Enter|Tab|Esc):/i.test(hint))) return blocked2;
|
|
19692
19416
|
return { kind: "prompt", busy: hints.includes("Ctrl+c:cancel") };
|
|
19693
19417
|
}
|
|
19694
19418
|
const UUID$1 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
19695
19419
|
const INITIAL_BYTES = 8 * 1024 * 1024;
|
|
19696
|
-
const MAX_RECORDS = 6e3;
|
|
19420
|
+
const MAX_RECORDS$1 = 6e3;
|
|
19697
19421
|
const MAX_RESULT_CHARS = 16e3;
|
|
19698
19422
|
const PEEK_BYTES = 64 * 1024;
|
|
19699
19423
|
const MAX_TOOL_CALLS = 1e3;
|
|
@@ -20002,10 +19726,16 @@ class ChatFeed {
|
|
|
20002
19726
|
}
|
|
20003
19727
|
async step() {
|
|
20004
19728
|
const session = await this.opts.status();
|
|
20005
|
-
|
|
19729
|
+
let whole;
|
|
19730
|
+
try {
|
|
19731
|
+
whole = this.opts.snapshot?.(session);
|
|
19732
|
+
} catch (error) {
|
|
19733
|
+
whole = Promise.reject(error);
|
|
19734
|
+
}
|
|
19735
|
+
if (whole) {
|
|
20006
19736
|
let snapshot;
|
|
20007
19737
|
try {
|
|
20008
|
-
snapshot = await
|
|
19738
|
+
snapshot = await whole;
|
|
20009
19739
|
} catch (error) {
|
|
20010
19740
|
this.publishSession({
|
|
20011
19741
|
...session,
|
|
@@ -20033,8 +19763,8 @@ class ChatFeed {
|
|
|
20033
19763
|
const compact = slim(record2);
|
|
20034
19764
|
if (compact) records2.push(compact);
|
|
20035
19765
|
}
|
|
20036
|
-
if (records2.length > MAX_RECORDS) {
|
|
20037
|
-
records2.splice(0, records2.length - MAX_RECORDS);
|
|
19766
|
+
if (records2.length > MAX_RECORDS$1) {
|
|
19767
|
+
records2.splice(0, records2.length - MAX_RECORDS$1);
|
|
20038
19768
|
if (source) source.truncated = true;
|
|
20039
19769
|
}
|
|
20040
19770
|
if (changed || JSON.stringify(records2) !== JSON.stringify(this.records)) {
|
|
@@ -20137,8 +19867,8 @@ class ChatFeed {
|
|
|
20137
19867
|
}
|
|
20138
19868
|
if (!fresh.length) return;
|
|
20139
19869
|
this.records.push(...fresh);
|
|
20140
|
-
if (this.records.length > MAX_RECORDS)
|
|
20141
|
-
this.records.splice(0, this.records.length - MAX_RECORDS);
|
|
19870
|
+
if (this.records.length > MAX_RECORDS$1)
|
|
19871
|
+
this.records.splice(0, this.records.length - MAX_RECORDS$1);
|
|
20142
19872
|
this.emit({ type: "records", data: fresh });
|
|
20143
19873
|
} catch {
|
|
20144
19874
|
} finally {
|
|
@@ -20188,6 +19918,484 @@ class ChatFeed {
|
|
|
20188
19918
|
this.watcher = null;
|
|
20189
19919
|
}
|
|
20190
19920
|
}
|
|
19921
|
+
const DISMISS_MAX = 5;
|
|
19922
|
+
const MENU_SETTLE_MS = 400;
|
|
19923
|
+
const MENU_REDRAW_WAITS = 5;
|
|
19924
|
+
const menuPart = (text2) => text2?.slice(Math.max(0, text2.lastIndexOf("▔"))) ?? null;
|
|
19925
|
+
function sessionSettings(hookFile, skipPermissions) {
|
|
19926
|
+
const tmp = `${hookFile}.tmp`;
|
|
19927
|
+
const command = `cat > ${shellLine([tmp])} && mv -f ${shellLine([tmp])} ${shellLine([hookFile])}`;
|
|
19928
|
+
const settings = {
|
|
19929
|
+
hooks: { SessionStart: [{ hooks: [{ type: "command", command, timeout: 10 }] }] }
|
|
19930
|
+
};
|
|
19931
|
+
if (skipPermissions) settings.skipDangerousModePermissionPrompt = true;
|
|
19932
|
+
return JSON.stringify(settings);
|
|
19933
|
+
}
|
|
19934
|
+
function claudeArgv(claude2, hookFile, skipPermissions) {
|
|
19935
|
+
const argv = [claude2];
|
|
19936
|
+
if (skipPermissions) argv.push("--dangerously-skip-permissions");
|
|
19937
|
+
argv.push("--settings", sessionSettings(hookFile, skipPermissions));
|
|
19938
|
+
return argv;
|
|
19939
|
+
}
|
|
19940
|
+
const launch$4 = {
|
|
19941
|
+
chatReady: true,
|
|
19942
|
+
async screen(io, settled2) {
|
|
19943
|
+
const text2 = await io.screen().catch(() => null);
|
|
19944
|
+
if (text2 === null) return { picker: null, menu: null, busy: false };
|
|
19945
|
+
const signIn = readSignIn(text2)?.signIn ?? null;
|
|
19946
|
+
if (signIn) {
|
|
19947
|
+
io.read();
|
|
19948
|
+
return { picker: null, menu: null, busy: false, signIn, terminal: null };
|
|
19949
|
+
}
|
|
19950
|
+
const shown = {
|
|
19951
|
+
picker: parsePicker(text2),
|
|
19952
|
+
menu: parseMenu(text2),
|
|
19953
|
+
busy: /\besc to interrupt\b/i.test(text2),
|
|
19954
|
+
signIn: null,
|
|
19955
|
+
terminal: null
|
|
19956
|
+
};
|
|
19957
|
+
if (shown.picker || shown.menu || !text2.trim() || atClaudePrompt(text2)) io.read();
|
|
19958
|
+
else if (io.unread() || settled2) shown.terminal = { excerpt: terminalExcerpt(text2) };
|
|
19959
|
+
return shown;
|
|
19960
|
+
},
|
|
19961
|
+
async picker(io) {
|
|
19962
|
+
const text2 = await io.screen();
|
|
19963
|
+
return text2 === null ? null : parsePicker(text2);
|
|
19964
|
+
},
|
|
19965
|
+
/**
|
|
19966
|
+
* Close the menu one of Claude Code's commands opened (such as /mcp):
|
|
19967
|
+
* Escape, as often as it takes to back out of its nested screens. After each
|
|
19968
|
+
* press the screen is read until the menu has redrawn, and only another menu
|
|
19969
|
+
* gets another press, so Escape never reaches the prompt, where it would stop
|
|
19970
|
+
* Firstmate's work or (pressed twice) open the rewind menu.
|
|
19971
|
+
* Firstmate's own question or permission prompt, which has no heading of
|
|
19972
|
+
* Claude Code's, is the captain's to answer and is never closed.
|
|
19973
|
+
*/
|
|
19974
|
+
async dismiss(io) {
|
|
19975
|
+
let text2 = await io.screen().catch(() => null);
|
|
19976
|
+
for (let i = 0; i < DISMISS_MAX; i++) {
|
|
19977
|
+
const menu = text2 === null ? null : parseMenu(text2);
|
|
19978
|
+
if (!menu) return { ok: true };
|
|
19979
|
+
if (!menu.title && parsePicker(text2)) {
|
|
19980
|
+
if (i > 0) return { ok: true };
|
|
19981
|
+
return {
|
|
19982
|
+
ok: false,
|
|
19983
|
+
status: 409,
|
|
19984
|
+
error: "Firstmate is asking you something now; answer it in the chat."
|
|
19985
|
+
};
|
|
19986
|
+
}
|
|
19987
|
+
const r = await io.keys(["Escape"]);
|
|
19988
|
+
if (!r.ok) return r;
|
|
19989
|
+
const before = menuPart(text2);
|
|
19990
|
+
for (let w = 0; w < MENU_REDRAW_WAITS && menuPart(text2) === before; w++) {
|
|
19991
|
+
await io.sleep(MENU_SETTLE_MS);
|
|
19992
|
+
text2 = await io.screen().catch(() => null);
|
|
19993
|
+
}
|
|
19994
|
+
if (menuPart(text2) === before) break;
|
|
19995
|
+
}
|
|
19996
|
+
return {
|
|
19997
|
+
ok: false,
|
|
19998
|
+
status: 409,
|
|
19999
|
+
error: "The menu is still open after pressing Escape; close it in Firstmate’s terminal."
|
|
20000
|
+
};
|
|
20001
|
+
}
|
|
20002
|
+
};
|
|
20003
|
+
const claude = {
|
|
20004
|
+
id: "claude",
|
|
20005
|
+
skipPermissionsSetting: true,
|
|
20006
|
+
slashCommands: true,
|
|
20007
|
+
menuOpen: "A Claude Code menu is open in Firstmate’s session, so nothing was typed. Answer or close it, then send again.",
|
|
20008
|
+
restartToChat: "Restart the claude session from Wheelhouse to enable its chat.",
|
|
20009
|
+
async start(ctx, binary) {
|
|
20010
|
+
if (ctx.trustStore) registerTrust(ctx.trustStore, ctx.firstmateDir);
|
|
20011
|
+
return { argv: claudeArgv(binary, ctx.hookFile, ctx.skipPermissions), env: {}, launch: launch$4 };
|
|
20012
|
+
},
|
|
20013
|
+
async recover() {
|
|
20014
|
+
return launch$4;
|
|
20015
|
+
},
|
|
20016
|
+
chat: {
|
|
20017
|
+
kind: "stream",
|
|
20018
|
+
locate: (ctx, _launch, state2) => locateTranscript(
|
|
20019
|
+
{
|
|
20020
|
+
firstmateDir: ctx.firstmateDir,
|
|
20021
|
+
homeDir: ctx.homeDir,
|
|
20022
|
+
hookFile: ctx.hookFile,
|
|
20023
|
+
projectsDir: projectsDir(ctx.env)
|
|
20024
|
+
},
|
|
20025
|
+
state2
|
|
20026
|
+
),
|
|
20027
|
+
decode: (raw) => raw !== null && typeof raw === "object" && !Array.isArray(raw) ? [raw] : []
|
|
20028
|
+
}
|
|
20029
|
+
};
|
|
20030
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
20031
|
+
const RECEIPT_BYTES$1 = 64 * 1024;
|
|
20032
|
+
const META_BYTES = 1024 * 1024;
|
|
20033
|
+
function object$2(value) {
|
|
20034
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
20035
|
+
}
|
|
20036
|
+
async function readJson(file, limit, firstLine2 = false) {
|
|
20037
|
+
const handle = await open(file, "r");
|
|
20038
|
+
try {
|
|
20039
|
+
const size = (await handle.stat()).size;
|
|
20040
|
+
if (!firstLine2 && size > limit) return null;
|
|
20041
|
+
const buffer = Buffer.alloc(Math.min(size, limit));
|
|
20042
|
+
const { bytesRead } = await handle.read(buffer, 0, buffer.length, 0);
|
|
20043
|
+
const text2 = buffer.subarray(0, bytesRead).toString("utf8");
|
|
20044
|
+
const newline = text2.indexOf("\n");
|
|
20045
|
+
if (firstLine2 && newline < 0) return null;
|
|
20046
|
+
return JSON.parse(firstLine2 ? text2.slice(0, newline) : text2);
|
|
20047
|
+
} finally {
|
|
20048
|
+
await handle.close();
|
|
20049
|
+
}
|
|
20050
|
+
}
|
|
20051
|
+
async function locateCodexTranscript(opts, state2) {
|
|
20052
|
+
if (state2 !== "ours" || !opts.sessionNonce?.trim()) return null;
|
|
20053
|
+
try {
|
|
20054
|
+
const receipt = object$2(await readJson(opts.hookFile, RECEIPT_BYTES$1));
|
|
20055
|
+
if (!receipt || receipt.wheelhouse_nonce !== opts.sessionNonce || typeof receipt.session_id !== "string" || !UUID.test(receipt.session_id) || typeof receipt.transcript_path !== "string" || !path.isAbsolute(receipt.transcript_path) || typeof receipt.cwd !== "string" || !path.isAbsolute(receipt.cwd))
|
|
20056
|
+
return null;
|
|
20057
|
+
const [cwd, receiptCwd, root, file] = await Promise.all([
|
|
20058
|
+
realpath(opts.firstmateDir),
|
|
20059
|
+
realpath(receipt.cwd),
|
|
20060
|
+
realpath(path.join(opts.codexHome, "sessions")),
|
|
20061
|
+
realpath(receipt.transcript_path)
|
|
20062
|
+
]);
|
|
20063
|
+
const relative = path.relative(root, file);
|
|
20064
|
+
if (cwd !== receiptCwd || !relative || relative.startsWith("..") || path.isAbsolute(relative))
|
|
20065
|
+
return null;
|
|
20066
|
+
const record2 = object$2(await readJson(file, META_BYTES, true));
|
|
20067
|
+
const meta = object$2(record2?.payload);
|
|
20068
|
+
if (record2?.type !== "session_meta" || !meta || meta.id !== receipt.session_id || meta.originator !== "codex-tui" || meta.source !== "cli" && meta.source !== "vscode" || typeof meta.cwd !== "string" || !path.isAbsolute(meta.cwd) || await realpath(meta.cwd) !== cwd)
|
|
20069
|
+
return null;
|
|
20070
|
+
return { how: "hook", file };
|
|
20071
|
+
} catch {
|
|
20072
|
+
return null;
|
|
20073
|
+
}
|
|
20074
|
+
}
|
|
20075
|
+
function textContent(value) {
|
|
20076
|
+
if (!Array.isArray(value)) return "";
|
|
20077
|
+
return value.flatMap((part) => {
|
|
20078
|
+
const block = object$2(part);
|
|
20079
|
+
if (!block) return [];
|
|
20080
|
+
if ((block.type === "text" || block.type === "Text") && typeof block.text === "string")
|
|
20081
|
+
return [block.text];
|
|
20082
|
+
if (block.type === "image" || block.type === "localImage") return ["[image]"];
|
|
20083
|
+
return [];
|
|
20084
|
+
}).join("\n");
|
|
20085
|
+
}
|
|
20086
|
+
function mcpResult(value) {
|
|
20087
|
+
if (typeof value === "string") return value;
|
|
20088
|
+
const result2 = object$2(value);
|
|
20089
|
+
if (!result2) return "";
|
|
20090
|
+
if (Array.isArray(result2.content)) {
|
|
20091
|
+
return result2.content.flatMap((part) => {
|
|
20092
|
+
const block = object$2(part);
|
|
20093
|
+
return block?.type === "text" && typeof block.text === "string" ? [{ type: "text", text: block.text }] : [];
|
|
20094
|
+
});
|
|
20095
|
+
}
|
|
20096
|
+
return typeof result2.message === "string" ? result2.message : "";
|
|
20097
|
+
}
|
|
20098
|
+
function codexRecords(raw) {
|
|
20099
|
+
const record2 = object$2(raw);
|
|
20100
|
+
const payload = object$2(record2?.payload);
|
|
20101
|
+
if (record2?.type !== "event_msg" || !payload || typeof record2.timestamp !== "string" || !Number.isFinite(Date.parse(record2.timestamp)))
|
|
20102
|
+
return [];
|
|
20103
|
+
const timestamp2 = record2.timestamp;
|
|
20104
|
+
const turnId = typeof payload.turn_id === "string" ? payload.turn_id : null;
|
|
20105
|
+
if (payload.type === "task_complete" && turnId) {
|
|
20106
|
+
return [
|
|
20107
|
+
{
|
|
20108
|
+
type: "system",
|
|
20109
|
+
uuid: `codex:${turnId}:completed`,
|
|
20110
|
+
timestamp: timestamp2,
|
|
20111
|
+
subtype: "turn_duration",
|
|
20112
|
+
durationMs: typeof payload.duration_ms === "number" && Number.isFinite(payload.duration_ms) ? Math.max(0, payload.duration_ms) : null
|
|
20113
|
+
}
|
|
20114
|
+
];
|
|
20115
|
+
}
|
|
20116
|
+
if (payload.type === "turn_aborted" && turnId) {
|
|
20117
|
+
return [
|
|
20118
|
+
{
|
|
20119
|
+
type: "user",
|
|
20120
|
+
uuid: `codex:${turnId}:interrupted`,
|
|
20121
|
+
timestamp: timestamp2,
|
|
20122
|
+
message: { role: "user", content: "[Request interrupted by user]" }
|
|
20123
|
+
}
|
|
20124
|
+
];
|
|
20125
|
+
}
|
|
20126
|
+
if (payload.type !== "item_started" && payload.type !== "item_completed") return [];
|
|
20127
|
+
const completed = payload.type === "item_completed";
|
|
20128
|
+
const item = object$2(payload.item);
|
|
20129
|
+
if (!item || typeof item.id !== "string" || !item.id || typeof item.type !== "string") return [];
|
|
20130
|
+
const id = `codex:${item.id}`;
|
|
20131
|
+
const assistant = (suffix, content) => ({
|
|
20132
|
+
type: "assistant",
|
|
20133
|
+
uuid: `${id}:${suffix}`,
|
|
20134
|
+
timestamp: timestamp2,
|
|
20135
|
+
message: { id, role: "assistant", content }
|
|
20136
|
+
});
|
|
20137
|
+
if (item.type === "UserMessage" || item.type === "AgentMessage") {
|
|
20138
|
+
if (!completed) return [];
|
|
20139
|
+
const text2 = textContent(item.content);
|
|
20140
|
+
if (!text2.trim()) return [];
|
|
20141
|
+
return item.type === "UserMessage" ? [{ type: "user", uuid: `${id}:user`, timestamp: timestamp2, message: { role: "user", content: text2 } }] : [assistant("text", [{ type: "text", text: text2 }])];
|
|
20142
|
+
}
|
|
20143
|
+
if (item.type === "Reasoning") {
|
|
20144
|
+
return completed ? [assistant("thinking", [{ type: "thinking", thinking: "", signature: "" }])] : [];
|
|
20145
|
+
}
|
|
20146
|
+
let name2;
|
|
20147
|
+
let input;
|
|
20148
|
+
let result2 = "";
|
|
20149
|
+
let isError = item.status === "failed" || item.status === "declined";
|
|
20150
|
+
switch (item.type) {
|
|
20151
|
+
case "CommandExecution":
|
|
20152
|
+
if (typeof item.command !== "string" && !(Array.isArray(item.command) && item.command.every((part) => typeof part === "string")))
|
|
20153
|
+
return [];
|
|
20154
|
+
name2 = "Bash";
|
|
20155
|
+
input = {
|
|
20156
|
+
command: typeof item.command === "string" ? item.command : shellLine(item.command)
|
|
20157
|
+
};
|
|
20158
|
+
result2 = typeof item.aggregated_output === "string" ? item.aggregated_output : "";
|
|
20159
|
+
isError ||= typeof item.exit_code === "number" && item.exit_code !== 0;
|
|
20160
|
+
break;
|
|
20161
|
+
case "McpToolCall": {
|
|
20162
|
+
if (typeof item.server !== "string" || typeof item.tool !== "string") return [];
|
|
20163
|
+
name2 = `mcp__${item.server}__${item.tool}`;
|
|
20164
|
+
input = object$2(item.arguments) ?? {};
|
|
20165
|
+
result2 = mcpResult(item.result ?? item.error);
|
|
20166
|
+
isError ||= object$2(item.result)?.isError === true || item.error != null;
|
|
20167
|
+
break;
|
|
20168
|
+
}
|
|
20169
|
+
case "FileChange": {
|
|
20170
|
+
const changes = object$2(item.changes);
|
|
20171
|
+
if (!changes || !Object.keys(changes).length) return [];
|
|
20172
|
+
name2 = "Edit";
|
|
20173
|
+
input = { file_path: Object.keys(changes).join(", ") };
|
|
20174
|
+
result2 = [item.stdout, item.stderr].filter((value) => typeof value === "string").join("\n");
|
|
20175
|
+
break;
|
|
20176
|
+
}
|
|
20177
|
+
default:
|
|
20178
|
+
return [];
|
|
20179
|
+
}
|
|
20180
|
+
const start = assistant("call", [{ type: "tool_use", id, name: name2, input }]);
|
|
20181
|
+
return completed ? [
|
|
20182
|
+
start,
|
|
20183
|
+
{
|
|
20184
|
+
type: "user",
|
|
20185
|
+
uuid: `${id}:result`,
|
|
20186
|
+
timestamp: timestamp2,
|
|
20187
|
+
message: {
|
|
20188
|
+
role: "user",
|
|
20189
|
+
content: [{ type: "tool_result", tool_use_id: id, content: result2, is_error: isError }]
|
|
20190
|
+
}
|
|
20191
|
+
}
|
|
20192
|
+
] : [start];
|
|
20193
|
+
}
|
|
20194
|
+
const OPTION = /^\s*(›\s*)?(\d+)\.\s+(.+)$/;
|
|
20195
|
+
const CONFIRM = /\benter\b.*\b(?:confirm|select|submit|continue)\b/i;
|
|
20196
|
+
function codexScreen(text2) {
|
|
20197
|
+
if (text2 === null) return { kind: "blocked", title: "Codex’s screen could not be read." };
|
|
20198
|
+
const lines = text2.replace(/\r/g, "").trimEnd().split("\n");
|
|
20199
|
+
const cursor = lines.findLastIndex((line) => /^\s*›(?:\s|$)/.test(line));
|
|
20200
|
+
if (cursor < 0) return { kind: "blocked", title: "Codex needs attention in its terminal." };
|
|
20201
|
+
if (OPTION.test(lines[cursor])) {
|
|
20202
|
+
let start = cursor;
|
|
20203
|
+
while (start > 0 && OPTION.test(lines[start - 1])) start--;
|
|
20204
|
+
let end = cursor + 1;
|
|
20205
|
+
while (end < lines.length && OPTION.test(lines[end])) end++;
|
|
20206
|
+
const options = [];
|
|
20207
|
+
for (const line of lines.slice(start, end)) {
|
|
20208
|
+
const m = OPTION.exec(line);
|
|
20209
|
+
if (!m) return { kind: "blocked", title: "Use the terminal to answer Codex." };
|
|
20210
|
+
options.push({
|
|
20211
|
+
n: Number(m[2]),
|
|
20212
|
+
label: m[3],
|
|
20213
|
+
description: "",
|
|
20214
|
+
checked: null,
|
|
20215
|
+
freeText: false
|
|
20216
|
+
});
|
|
20217
|
+
}
|
|
20218
|
+
if (options.some((option, index) => option.n !== index + 1) || !CONFIRM.test(lines.slice(end).join("\n"))) {
|
|
20219
|
+
return { kind: "blocked", title: "Use the terminal to answer Codex." };
|
|
20220
|
+
}
|
|
20221
|
+
return {
|
|
20222
|
+
kind: "picker",
|
|
20223
|
+
picker: {
|
|
20224
|
+
title: lines.slice(0, start).join("\n").trim(),
|
|
20225
|
+
tabs: [],
|
|
20226
|
+
options,
|
|
20227
|
+
multiSelect: false,
|
|
20228
|
+
submitMoves: null,
|
|
20229
|
+
navigation: { selected: cursor - start + 1 },
|
|
20230
|
+
// Include the command and every visible option, not only the repeated Yes/No labels.
|
|
20231
|
+
signature: createHash("sha256").update(text2).digest("hex").slice(0, 16)
|
|
20232
|
+
}
|
|
20233
|
+
};
|
|
20234
|
+
}
|
|
20235
|
+
const input = lines[cursor].replace(/^\s*›\s*/, "").trim();
|
|
20236
|
+
if (input && !/^(?:Ask Codex to do anything|Ask for changes|Use \/skills to list available skills|Find and fix a bug in @filename|Explain this codebase|Summarize recent commits|Write tests for @filename|Improve documentation in @filename|Implement \{feature\})$/.test(
|
|
20237
|
+
input
|
|
20238
|
+
)) {
|
|
20239
|
+
return {
|
|
20240
|
+
kind: "blocked",
|
|
20241
|
+
title: "Codex has unsent input. Send or clear it in the terminal first."
|
|
20242
|
+
};
|
|
20243
|
+
}
|
|
20244
|
+
if (cursor < lines.length - 7 || CONFIRM.test(lines.slice(cursor + 1).join("\n"))) {
|
|
20245
|
+
return { kind: "blocked", title: "Codex needs attention in its terminal." };
|
|
20246
|
+
}
|
|
20247
|
+
return { kind: "prompt", busy: /\besc to interrupt\b/i.test(text2) };
|
|
20248
|
+
}
|
|
20249
|
+
const receiptEnv = (ctx, nonce) => ({
|
|
20250
|
+
WH_SESSION_RECORD: ctx.hookFile,
|
|
20251
|
+
WH_SESSION_NONCE: nonce
|
|
20252
|
+
});
|
|
20253
|
+
async function recoverReceipt(ctx, io) {
|
|
20254
|
+
const recorder = await io.variable("WH_SESSION_RECORD") === ctx.hookFile;
|
|
20255
|
+
const value = await io.variable("WH_SESSION_NONCE") ?? "";
|
|
20256
|
+
const nonce = /^[0-9a-f-]{36}$/.test(value) ? value : null;
|
|
20257
|
+
return { nonce, chatReady: recorder && nonce !== null };
|
|
20258
|
+
}
|
|
20259
|
+
function blocked(io, title) {
|
|
20260
|
+
return {
|
|
20261
|
+
picker: null,
|
|
20262
|
+
menu: { title, canDismiss: false },
|
|
20263
|
+
busy: false,
|
|
20264
|
+
terminal: io.unread() ? { excerpt: title } : null
|
|
20265
|
+
};
|
|
20266
|
+
}
|
|
20267
|
+
async function nativeScreen(io, read) {
|
|
20268
|
+
const text2 = await io.screen().catch(() => null);
|
|
20269
|
+
const signIn = readSignIn(text2)?.signIn ?? null;
|
|
20270
|
+
if (signIn) {
|
|
20271
|
+
io.read();
|
|
20272
|
+
return { picker: null, menu: null, busy: false, signIn };
|
|
20273
|
+
}
|
|
20274
|
+
const shown = read(text2);
|
|
20275
|
+
if (shown.kind === "blocked" && text2?.trim()) return blocked(io, shown.title);
|
|
20276
|
+
io.read();
|
|
20277
|
+
return {
|
|
20278
|
+
picker: shown.kind === "picker" ? shown.picker : null,
|
|
20279
|
+
menu: shown.kind === "blocked" ? { title: shown.title, canDismiss: false } : null,
|
|
20280
|
+
busy: shown.kind === "prompt" && shown.busy
|
|
20281
|
+
};
|
|
20282
|
+
}
|
|
20283
|
+
function codexArgv(binary) {
|
|
20284
|
+
const script = `const fs = require('node:fs');
|
|
20285
|
+
let input = '';
|
|
20286
|
+
process.stdin.setEncoding('utf8');
|
|
20287
|
+
process.stdin.on('data', chunk => { input += chunk; if (Buffer.byteLength(input) > 65536) process.exit(1); });
|
|
20288
|
+
process.stdin.on('end', () => {
|
|
20289
|
+
const record = JSON.parse(input);
|
|
20290
|
+
const file = process.env.WH_SESSION_RECORD;
|
|
20291
|
+
if (!file || !process.env.WH_SESSION_NONCE) process.exit(1);
|
|
20292
|
+
fs.writeFileSync(file + '.tmp', JSON.stringify({...record, wheelhouse_nonce: process.env.WH_SESSION_NONCE}), {mode: 0o600});
|
|
20293
|
+
fs.renameSync(file + '.tmp', file);
|
|
20294
|
+
});`;
|
|
20295
|
+
const command = shellLine([process.execPath, "-e", script]);
|
|
20296
|
+
return [
|
|
20297
|
+
binary,
|
|
20298
|
+
"--dangerously-bypass-approvals-and-sandbox",
|
|
20299
|
+
"--dangerously-bypass-hook-trust",
|
|
20300
|
+
"-c",
|
|
20301
|
+
`hooks.SessionStart=[{hooks=[{type="command",command=${JSON.stringify(command)},timeout=10}]}]`
|
|
20302
|
+
];
|
|
20303
|
+
}
|
|
20304
|
+
function launch$3(nonce, chatReady) {
|
|
20305
|
+
return {
|
|
20306
|
+
nonce,
|
|
20307
|
+
chatReady,
|
|
20308
|
+
screen: (io) => nativeScreen(io, codexScreen),
|
|
20309
|
+
async picker(io) {
|
|
20310
|
+
const shown = codexScreen(await io.screen());
|
|
20311
|
+
return shown.kind === "picker" ? shown.picker : null;
|
|
20312
|
+
}
|
|
20313
|
+
};
|
|
20314
|
+
}
|
|
20315
|
+
const codex = {
|
|
20316
|
+
id: "codex",
|
|
20317
|
+
skipPermissionsSetting: false,
|
|
20318
|
+
slashCommands: false,
|
|
20319
|
+
menuOpen: "codex is waiting for attention. Answer the choice or open its terminal before sending.",
|
|
20320
|
+
restartToChat: "Restart the codex session from Wheelhouse to enable its chat recorder.",
|
|
20321
|
+
async start(ctx, binary, nonce) {
|
|
20322
|
+
return { argv: codexArgv(binary), env: receiptEnv(ctx, nonce), launch: launch$3(nonce, true) };
|
|
20323
|
+
},
|
|
20324
|
+
async recover(ctx, io) {
|
|
20325
|
+
const { nonce, chatReady } = await recoverReceipt(ctx, io);
|
|
20326
|
+
return launch$3(nonce, chatReady);
|
|
20327
|
+
},
|
|
20328
|
+
chat: {
|
|
20329
|
+
kind: "stream",
|
|
20330
|
+
locate: (ctx, running, state2) => locateCodexTranscript(
|
|
20331
|
+
{
|
|
20332
|
+
firstmateDir: ctx.firstmateDir,
|
|
20333
|
+
hookFile: ctx.hookFile,
|
|
20334
|
+
sessionNonce: running?.nonce ?? null,
|
|
20335
|
+
codexHome: ctx.env.CODEX_HOME || path.join(ctx.env.HOME || homedir(), ".codex")
|
|
20336
|
+
},
|
|
20337
|
+
state2
|
|
20338
|
+
),
|
|
20339
|
+
decode: codexRecords
|
|
20340
|
+
}
|
|
20341
|
+
};
|
|
20342
|
+
const GROK_STOP_HOLD_MS = 1200;
|
|
20343
|
+
function launch$2(sessionId) {
|
|
20344
|
+
let stopHold = Promise.resolve();
|
|
20345
|
+
return {
|
|
20346
|
+
sessionId,
|
|
20347
|
+
chatReady: sessionId !== null,
|
|
20348
|
+
screen: (io) => nativeScreen(io, grokScreen),
|
|
20349
|
+
picker: async () => null,
|
|
20350
|
+
/**
|
|
20351
|
+
* Grok cancels a turn with Ctrl+C (to Escape it only answers "Press Ctrl+c to
|
|
20352
|
+
* cancel the turn"), pressed only while its screen shows a turn it can cancel,
|
|
20353
|
+
* so the key reaches nothing else, and never within GROK_STOP_HOLD_MS of the
|
|
20354
|
+
* last press: a second Ctrl+C that soon quits Grok.
|
|
20355
|
+
*/
|
|
20356
|
+
async interrupt(io) {
|
|
20357
|
+
await stopHold;
|
|
20358
|
+
const shown = grokScreen(await io.screen().catch(() => null));
|
|
20359
|
+
if (shown.kind !== "prompt")
|
|
20360
|
+
return { ok: false, status: 409, error: "Use Grok’s terminal to stop it." };
|
|
20361
|
+
if (!shown.busy) return { ok: true };
|
|
20362
|
+
const pressed = await io.keys(["C-c"]);
|
|
20363
|
+
stopHold = io.sleep(GROK_STOP_HOLD_MS);
|
|
20364
|
+
return pressed;
|
|
20365
|
+
}
|
|
20366
|
+
};
|
|
20367
|
+
}
|
|
20368
|
+
const grok = {
|
|
20369
|
+
id: "grok",
|
|
20370
|
+
skipPermissionsSetting: false,
|
|
20371
|
+
slashCommands: false,
|
|
20372
|
+
menuOpen: "grok is waiting for attention. Answer the choice or open its terminal before sending.",
|
|
20373
|
+
restartToChat: "Restart the grok session from Wheelhouse to enable its chat.",
|
|
20374
|
+
async start(_ctx, binary, nonce) {
|
|
20375
|
+
return {
|
|
20376
|
+
argv: grokArgv(binary, nonce),
|
|
20377
|
+
env: { [GROK_SESSION_VARIABLE]: nonce },
|
|
20378
|
+
launch: launch$2(nonce)
|
|
20379
|
+
};
|
|
20380
|
+
},
|
|
20381
|
+
async recover(_ctx, io, current) {
|
|
20382
|
+
const value = await io.variable(GROK_SESSION_VARIABLE);
|
|
20383
|
+
const sessionId = isGrokSessionId(value) ? value : null;
|
|
20384
|
+
return current && current.sessionId === sessionId ? current : launch$2(sessionId);
|
|
20385
|
+
},
|
|
20386
|
+
chat: {
|
|
20387
|
+
kind: "stream",
|
|
20388
|
+
locate: (ctx, running, state2) => locateGrokTranscript(
|
|
20389
|
+
{
|
|
20390
|
+
firstmateDir: ctx.firstmateDir,
|
|
20391
|
+
grokHome: ctx.env.GROK_HOME || path.join(ctx.env.HOME || homedir(), ".grok"),
|
|
20392
|
+
sessionId: running?.sessionId ?? null
|
|
20393
|
+
},
|
|
20394
|
+
state2
|
|
20395
|
+
),
|
|
20396
|
+
decode: grokRecords
|
|
20397
|
+
}
|
|
20398
|
+
};
|
|
20191
20399
|
class OpenCodeError extends Error {
|
|
20192
20400
|
constructor(message2, status2 = 503) {
|
|
20193
20401
|
super(message2);
|
|
@@ -20484,7 +20692,7 @@ async function admissions(conn, signal) {
|
|
|
20484
20692
|
text: text(prompt.text),
|
|
20485
20693
|
time: { created: data.timestamp }
|
|
20486
20694
|
});
|
|
20487
|
-
if (history.admissions.size > MAX_RECORDS)
|
|
20695
|
+
if (history.admissions.size > MAX_RECORDS$1)
|
|
20488
20696
|
history.admissions.delete(history.admissions.keys().next().value ?? "");
|
|
20489
20697
|
}
|
|
20490
20698
|
}
|
|
@@ -20516,7 +20724,7 @@ async function openCodeSnapshot(connection) {
|
|
|
20516
20724
|
more = cursor !== null;
|
|
20517
20725
|
if (cursor && seen.has(cursor)) throw new OpenCodeError("OpenCode repeated a message cursor.");
|
|
20518
20726
|
if (cursor) seen.add(cursor);
|
|
20519
|
-
} while (more && messages.length < MAX_RECORDS);
|
|
20727
|
+
} while (more && messages.length < MAX_RECORDS$1);
|
|
20520
20728
|
messages.reverse();
|
|
20521
20729
|
const projected = new Set(messages.map((raw) => text(object$1(raw).id)));
|
|
20522
20730
|
const queued = (await admissions(conn, signal)).filter((entry) => !projected.has(entry.id));
|
|
@@ -20530,9 +20738,9 @@ async function openCodeSnapshot(connection) {
|
|
|
20530
20738
|
source: {
|
|
20531
20739
|
how: "api",
|
|
20532
20740
|
file: `opencode:${conn.url}/${conn.sessionId}`,
|
|
20533
|
-
truncated: more || records2.length > MAX_RECORDS
|
|
20741
|
+
truncated: more || records2.length > MAX_RECORDS$1
|
|
20534
20742
|
},
|
|
20535
|
-
records: records2.slice(-MAX_RECORDS)
|
|
20743
|
+
records: records2.slice(-MAX_RECORDS$1)
|
|
20536
20744
|
};
|
|
20537
20745
|
}
|
|
20538
20746
|
async function pending(conn) {
|
|
@@ -20630,165 +20838,475 @@ async function openCodeStatus(conn) {
|
|
|
20630
20838
|
busy: running !== void 0
|
|
20631
20839
|
};
|
|
20632
20840
|
}
|
|
20633
|
-
async function pendingOpenCodePicker(conn) {
|
|
20634
|
-
const interaction = await pending(conn);
|
|
20635
|
-
return interaction && "picker" in interaction ? interaction.picker : null;
|
|
20841
|
+
async function pendingOpenCodePicker(conn) {
|
|
20842
|
+
const interaction = await pending(conn);
|
|
20843
|
+
return interaction && "picker" in interaction ? interaction.picker : null;
|
|
20844
|
+
}
|
|
20845
|
+
async function answerOpenCodePicker(conn, signature, action) {
|
|
20846
|
+
const current = await pending(conn);
|
|
20847
|
+
if (!current || !("picker" in current) || current.picker.signature !== signature)
|
|
20848
|
+
throw new OpenCodeError("That OpenCode choice is no longer waiting for an answer.", 409);
|
|
20849
|
+
if (!("press" in action) || !Number.isInteger(action.press))
|
|
20850
|
+
throw new OpenCodeError("Choose one of the available answers.", 400);
|
|
20851
|
+
const option = current.picker.options.find((entry) => entry.n === action.press);
|
|
20852
|
+
if (!option || option.freeText)
|
|
20853
|
+
throw new OpenCodeError("Choose an available answer, or type in the terminal.", 400);
|
|
20854
|
+
const route = `${sessionRoute(conn)}/${current.kind}/${encodeURIComponent(current.id)}/reply`;
|
|
20855
|
+
await request(
|
|
20856
|
+
conn,
|
|
20857
|
+
route,
|
|
20858
|
+
current.kind === "permission" ? { reply: action.press === 1 ? "once" : "reject" } : { answers: [[option.label]] }
|
|
20859
|
+
);
|
|
20860
|
+
}
|
|
20861
|
+
async function sendOpenCode(conn, text2) {
|
|
20862
|
+
const message2 = text2.replace(/\r\n?/g, "\n").trim();
|
|
20863
|
+
if (!message2 || message2.includes("\0") || Buffer.byteLength(message2) > 64 * 1024)
|
|
20864
|
+
throw new OpenCodeError("The message must be valid text of at most 64 KiB.", 400);
|
|
20865
|
+
if (await pending(conn))
|
|
20866
|
+
throw new OpenCodeError(
|
|
20867
|
+
"Answer OpenCode’s pending request before sending another message.",
|
|
20868
|
+
409
|
|
20869
|
+
);
|
|
20870
|
+
await request(conn, `${sessionRoute(conn)}/prompt`, {
|
|
20871
|
+
id: `msg_${randomUUID().replace(/-/g, "")}`,
|
|
20872
|
+
prompt: { text: message2 },
|
|
20873
|
+
delivery: "steer"
|
|
20874
|
+
});
|
|
20875
|
+
}
|
|
20876
|
+
async function interruptOpenCode(conn) {
|
|
20877
|
+
await boundSession(conn);
|
|
20878
|
+
await request(conn, `${sessionRoute(conn)}/interrupt`, {});
|
|
20879
|
+
}
|
|
20880
|
+
const CONNECTION = "WH_OPENCODE_CONNECTION";
|
|
20881
|
+
const RESTART = "Restart the OpenCode primary from Wheelhouse to enable chat.";
|
|
20882
|
+
function openCodeArgv(binary, connectionFile) {
|
|
20883
|
+
return [
|
|
20884
|
+
process.execPath,
|
|
20885
|
+
"-e",
|
|
20886
|
+
`const fs = require('node:fs');
|
|
20887
|
+
const {spawn} = require('node:child_process');
|
|
20888
|
+
const connection = JSON.parse(fs.readFileSync(process.argv[1], 'utf8'));
|
|
20889
|
+
const child = spawn(process.argv[2], ['--auto', '--hostname', '127.0.0.1', '--port', new URL(connection.url).port], {
|
|
20890
|
+
stdio: 'inherit', env: {...process.env, OPENCODE_SERVER_USERNAME: connection.username, OPENCODE_SERVER_PASSWORD: connection.password}
|
|
20891
|
+
});
|
|
20892
|
+
child.on('error', () => { console.error('OpenCode could not start.'); process.exitCode = 1; });
|
|
20893
|
+
child.on('exit', code => { process.exitCode = code ?? 1; })`,
|
|
20894
|
+
connectionFile,
|
|
20895
|
+
binary
|
|
20896
|
+
];
|
|
20897
|
+
}
|
|
20898
|
+
function launch$1(connection) {
|
|
20899
|
+
const call = async (action) => {
|
|
20900
|
+
if (!connection) return { ok: false, status: 409, error: RESTART };
|
|
20901
|
+
try {
|
|
20902
|
+
await action(connection);
|
|
20903
|
+
return { ok: true };
|
|
20904
|
+
} catch (error) {
|
|
20905
|
+
return {
|
|
20906
|
+
ok: false,
|
|
20907
|
+
status: error instanceof OpenCodeError ? error.status : 503,
|
|
20908
|
+
error: error instanceof Error ? error.message : "OpenCode is unavailable."
|
|
20909
|
+
};
|
|
20910
|
+
}
|
|
20911
|
+
};
|
|
20912
|
+
return {
|
|
20913
|
+
connection,
|
|
20914
|
+
chatReady: connection !== null,
|
|
20915
|
+
/** Bind the native TUI to the launch's session once it is ready, within 20 seconds. */
|
|
20916
|
+
async ready(io) {
|
|
20917
|
+
if (!connection) return null;
|
|
20918
|
+
const until = Date.now() + 2e4;
|
|
20919
|
+
let failure2 = "The native TUI is not ready.";
|
|
20920
|
+
while (Date.now() < until) {
|
|
20921
|
+
try {
|
|
20922
|
+
if (!(await io.screen())?.includes("┃")) throw new Error("The native TUI is not ready.");
|
|
20923
|
+
await createOpenCodeSession(connection);
|
|
20924
|
+
await selectOpenCodeSession(connection);
|
|
20925
|
+
return null;
|
|
20926
|
+
} catch (error) {
|
|
20927
|
+
failure2 = error instanceof Error ? error.message : String(error);
|
|
20928
|
+
}
|
|
20929
|
+
await io.sleep(250);
|
|
20930
|
+
}
|
|
20931
|
+
return `OpenCode started but its chat could not be connected: ${failure2} Open its terminal, finish setup, then restart the primary.`;
|
|
20932
|
+
},
|
|
20933
|
+
async screen(io) {
|
|
20934
|
+
try {
|
|
20935
|
+
if (connection) {
|
|
20936
|
+
const status2 = await openCodeStatus(connection);
|
|
20937
|
+
io.read();
|
|
20938
|
+
return status2;
|
|
20939
|
+
}
|
|
20940
|
+
} catch {
|
|
20941
|
+
}
|
|
20942
|
+
return blocked(
|
|
20943
|
+
io,
|
|
20944
|
+
"OpenCode’s session API is not ready. Retry shortly or open its terminal."
|
|
20945
|
+
);
|
|
20946
|
+
},
|
|
20947
|
+
picker: async () => connection ? pendingOpenCodePicker(connection) : null,
|
|
20948
|
+
send: (_io, body) => call((connection2) => sendOpenCode(connection2, body)),
|
|
20949
|
+
interrupt: () => call(interruptOpenCode),
|
|
20950
|
+
pick: (_io, signature, action) => call((connection2) => answerOpenCodePicker(connection2, signature, action)),
|
|
20951
|
+
signIn: async () => ({ ok: false, status: 409, error: "Sign in to OpenCode in its terminal." }),
|
|
20952
|
+
ports: () => connection ? [Number(new URL(connection.url).port)] : []
|
|
20953
|
+
};
|
|
20954
|
+
}
|
|
20955
|
+
const openCode = {
|
|
20956
|
+
id: "opencode",
|
|
20957
|
+
skipPermissionsSetting: false,
|
|
20958
|
+
slashCommands: false,
|
|
20959
|
+
menuOpen: "opencode is waiting for attention. Answer the choice or open its terminal before sending.",
|
|
20960
|
+
restartToChat: RESTART,
|
|
20961
|
+
async start(ctx, binary, nonce) {
|
|
20962
|
+
const port = await new ServicePorts(path.join(ctx.stateDir, "primary-ports.json")).port(
|
|
20963
|
+
"opencode",
|
|
20964
|
+
null,
|
|
20965
|
+
4096,
|
|
20966
|
+
[],
|
|
20967
|
+
[]
|
|
20968
|
+
);
|
|
20969
|
+
const connection = parseOpenCodeConnection({
|
|
20970
|
+
url: `http://127.0.0.1:${port}`,
|
|
20971
|
+
directory: ctx.firstmateDir,
|
|
20972
|
+
sessionId: `ses_${nonce.replace(/-/g, "")}`,
|
|
20973
|
+
username: "wheelhouse",
|
|
20974
|
+
password: randomBytes(32).toString("hex")
|
|
20975
|
+
});
|
|
20976
|
+
const connectionFile = path.join(path.dirname(ctx.hookFile), `opencode-${nonce}.json`);
|
|
20977
|
+
await writeFile(connectionFile, JSON.stringify(connection), { mode: 384, flag: "wx" });
|
|
20978
|
+
return {
|
|
20979
|
+
argv: openCodeArgv(binary, connectionFile),
|
|
20980
|
+
env: { [CONNECTION]: connectionFile },
|
|
20981
|
+
launch: launch$1(connection)
|
|
20982
|
+
};
|
|
20983
|
+
},
|
|
20984
|
+
async recover(ctx, io) {
|
|
20985
|
+
const file = await io.variable(CONNECTION) ?? "";
|
|
20986
|
+
try {
|
|
20987
|
+
if (!/^opencode-[0-9a-f-]{36}\.json$/.test(path.basename(file)) || await realpath(path.dirname(file)) !== await realpath(path.dirname(ctx.hookFile)))
|
|
20988
|
+
throw new Error("Wrong state directory");
|
|
20989
|
+
const connection = parseOpenCodeConnection(JSON.parse(await readFile(file, "utf8")));
|
|
20990
|
+
if (await realpath(connection.directory) !== await realpath(ctx.firstmateDir))
|
|
20991
|
+
throw new Error("Wrong Firstmate checkout");
|
|
20992
|
+
return launch$1(connection);
|
|
20993
|
+
} catch {
|
|
20994
|
+
return launch$1(null);
|
|
20995
|
+
}
|
|
20996
|
+
},
|
|
20997
|
+
chat: {
|
|
20998
|
+
kind: "snapshot",
|
|
20999
|
+
async read(_ctx, running) {
|
|
21000
|
+
if (!running?.connection) throw new OpenCodeError(RESTART);
|
|
21001
|
+
return openCodeSnapshot(running.connection);
|
|
21002
|
+
}
|
|
21003
|
+
}
|
|
21004
|
+
};
|
|
21005
|
+
const RECEIPT_BYTES = 64 * 1024;
|
|
21006
|
+
const SESSION_BYTES = 32 * 1024 * 1024;
|
|
21007
|
+
const MAX_RECORDS = 6e3;
|
|
21008
|
+
function piExtensionSource() {
|
|
21009
|
+
return `import { mkdirSync, writeFileSync, renameSync } from 'node:fs';
|
|
21010
|
+
import path from 'node:path';
|
|
21011
|
+
export default function(pi) {
|
|
21012
|
+
const file = process.env.WH_SESSION_RECORD;
|
|
21013
|
+
const nonce = process.env.WH_SESSION_NONCE;
|
|
21014
|
+
if (!file || !nonce) return;
|
|
21015
|
+
let context = null, timer = null, previous = '';
|
|
21016
|
+
const save = () => {
|
|
21017
|
+
if (!context) return;
|
|
21018
|
+
try {
|
|
21019
|
+
const manager = context.sessionManager;
|
|
21020
|
+
const value = JSON.stringify({ wheelhouse_nonce: nonce, session_id: manager.getSessionId(), transcript_path: manager.getSessionFile() ?? null, cwd: context.cwd, leaf_id: manager.getLeafId(), busy: !context.isIdle() });
|
|
21021
|
+
if (value === previous || Buffer.byteLength(value) > 65536) return;
|
|
21022
|
+
mkdirSync(path.dirname(file), { recursive: true });
|
|
21023
|
+
const temp = file + '.tmp.' + process.pid;
|
|
21024
|
+
writeFileSync(temp, value, { mode: 0o600 });
|
|
21025
|
+
renameSync(temp, file);
|
|
21026
|
+
previous = value;
|
|
21027
|
+
} catch { /* Observation must not interrupt Pi's session. */ }
|
|
21028
|
+
};
|
|
21029
|
+
pi.on('session_start', (_event, ctx) => {
|
|
21030
|
+
context = ctx;
|
|
21031
|
+
save();
|
|
21032
|
+
if (timer) clearInterval(timer);
|
|
21033
|
+
// message_end fires before persistence; observe the manager after it has appended the entry.
|
|
21034
|
+
timer = setInterval(save, 250);
|
|
21035
|
+
timer.unref?.();
|
|
21036
|
+
});
|
|
21037
|
+
for (const event of ['session_tree', 'session_compact', 'agent_end']) {
|
|
21038
|
+
pi.on(event, (_event, ctx) => { context = ctx; save(); });
|
|
21039
|
+
}
|
|
21040
|
+
pi.on('session_shutdown', () => { context = null; if (timer) clearInterval(timer); timer = null; });
|
|
21041
|
+
}
|
|
21042
|
+
`;
|
|
21043
|
+
}
|
|
21044
|
+
function object(value) {
|
|
21045
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
21046
|
+
}
|
|
21047
|
+
async function readBounded(file, limit) {
|
|
21048
|
+
const handle = await open(file, "r");
|
|
21049
|
+
try {
|
|
21050
|
+
const size = (await handle.stat()).size;
|
|
21051
|
+
if (size > limit) return null;
|
|
21052
|
+
const buffer = Buffer.alloc(size);
|
|
21053
|
+
let offset = 0;
|
|
21054
|
+
while (offset < size) {
|
|
21055
|
+
const { bytesRead } = await handle.read(buffer, offset, size - offset, offset);
|
|
21056
|
+
if (!bytesRead) break;
|
|
21057
|
+
offset += bytesRead;
|
|
21058
|
+
}
|
|
21059
|
+
return buffer.subarray(0, offset).toString("utf8");
|
|
21060
|
+
} finally {
|
|
21061
|
+
await handle.close();
|
|
21062
|
+
}
|
|
21063
|
+
}
|
|
21064
|
+
function contentText(content) {
|
|
21065
|
+
if (typeof content === "string") return content;
|
|
21066
|
+
if (!Array.isArray(content)) return "";
|
|
21067
|
+
return content.flatMap((part) => {
|
|
21068
|
+
const block = object(part);
|
|
21069
|
+
if (block?.type === "text" && typeof block.text === "string") return [block.text];
|
|
21070
|
+
return block?.type === "image" ? ["[image]"] : [];
|
|
21071
|
+
}).join("\n");
|
|
21072
|
+
}
|
|
21073
|
+
function normalize(entry, sessionId) {
|
|
21074
|
+
if (entry.type !== "message" || typeof entry.id !== "string" || typeof entry.timestamp !== "string")
|
|
21075
|
+
return [];
|
|
21076
|
+
const message2 = object(entry.message);
|
|
21077
|
+
if (!message2 || !Number.isFinite(Date.parse(entry.timestamp))) return [];
|
|
21078
|
+
const uuid = `pi:${sessionId}:${entry.id}`;
|
|
21079
|
+
const timestamp2 = entry.timestamp;
|
|
21080
|
+
if (message2.role === "user") {
|
|
21081
|
+
const content2 = contentText(message2.content);
|
|
21082
|
+
return content2.trim() ? [{ type: "user", uuid, timestamp: timestamp2, message: { role: "user", content: content2 } }] : [];
|
|
21083
|
+
}
|
|
21084
|
+
if (message2.role === "toolResult" && typeof message2.toolCallId === "string") {
|
|
21085
|
+
return [
|
|
21086
|
+
{
|
|
21087
|
+
type: "user",
|
|
21088
|
+
uuid,
|
|
21089
|
+
timestamp: timestamp2,
|
|
21090
|
+
message: {
|
|
21091
|
+
role: "user",
|
|
21092
|
+
content: [
|
|
21093
|
+
{
|
|
21094
|
+
type: "tool_result",
|
|
21095
|
+
tool_use_id: `pi:${sessionId}:${message2.toolCallId}`,
|
|
21096
|
+
content: contentText(message2.content),
|
|
21097
|
+
is_error: message2.isError === true
|
|
21098
|
+
}
|
|
21099
|
+
]
|
|
21100
|
+
}
|
|
21101
|
+
}
|
|
21102
|
+
];
|
|
21103
|
+
}
|
|
21104
|
+
if (message2.role !== "assistant" || !Array.isArray(message2.content)) return [];
|
|
21105
|
+
const names = {
|
|
21106
|
+
bash: "Bash",
|
|
21107
|
+
read: "Read",
|
|
21108
|
+
edit: "Edit",
|
|
21109
|
+
write: "Write",
|
|
21110
|
+
grep: "Grep",
|
|
21111
|
+
find: "Glob",
|
|
21112
|
+
ls: "Glob"
|
|
21113
|
+
};
|
|
21114
|
+
const content = message2.content.flatMap((part) => {
|
|
21115
|
+
const block = object(part);
|
|
21116
|
+
if (!block) return [];
|
|
21117
|
+
if (block.type === "text" && typeof block.text === "string")
|
|
21118
|
+
return [{ type: "text", text: block.text }];
|
|
21119
|
+
if (block.type === "thinking") return [{ type: "thinking", thinking: "", signature: "" }];
|
|
21120
|
+
if (block.type !== "toolCall" || typeof block.id !== "string" || typeof block.name !== "string")
|
|
21121
|
+
return [];
|
|
21122
|
+
const input = object(block.arguments);
|
|
21123
|
+
if (!input) return [];
|
|
21124
|
+
return [
|
|
21125
|
+
{
|
|
21126
|
+
type: "tool_use",
|
|
21127
|
+
id: `pi:${sessionId}:${block.id}`,
|
|
21128
|
+
name: names[block.name] ?? block.name,
|
|
21129
|
+
input: { ...input, ...typeof input.path === "string" ? { file_path: input.path } : {} }
|
|
21130
|
+
}
|
|
21131
|
+
];
|
|
21132
|
+
});
|
|
21133
|
+
if (message2.stopReason === "error" && typeof message2.errorMessage === "string")
|
|
21134
|
+
content.push({ type: "text", text: message2.errorMessage });
|
|
21135
|
+
const records2 = content.length ? [{ type: "assistant", uuid, timestamp: timestamp2, message: { id: uuid, role: "assistant", content } }] : [];
|
|
21136
|
+
if (message2.stopReason === "aborted")
|
|
21137
|
+
records2.push({
|
|
21138
|
+
type: "user",
|
|
21139
|
+
uuid: `${uuid}:interrupted`,
|
|
21140
|
+
timestamp: timestamp2,
|
|
21141
|
+
message: { role: "user", content: "[Request interrupted by user]" }
|
|
21142
|
+
});
|
|
21143
|
+
if (["stop", "length", "error", "aborted"].includes(String(message2.stopReason)))
|
|
21144
|
+
records2.push({
|
|
21145
|
+
type: "system",
|
|
21146
|
+
subtype: "turn_duration",
|
|
21147
|
+
uuid: `${uuid}:done`,
|
|
21148
|
+
timestamp: timestamp2,
|
|
21149
|
+
durationMs: null
|
|
21150
|
+
});
|
|
21151
|
+
return records2;
|
|
21152
|
+
}
|
|
21153
|
+
async function piSnapshot(opts) {
|
|
21154
|
+
if (!opts.sessionNonce?.trim()) return null;
|
|
21155
|
+
try {
|
|
21156
|
+
const receiptText2 = await readBounded(opts.hookFile, RECEIPT_BYTES);
|
|
21157
|
+
const receipt = receiptText2 === null ? null : object(JSON.parse(receiptText2));
|
|
21158
|
+
if (!receipt || receipt.wheelhouse_nonce !== opts.sessionNonce || typeof receipt.session_id !== "string" || !receipt.session_id || typeof receipt.transcript_path !== "string" || !path.isAbsolute(receipt.transcript_path) || typeof receipt.cwd !== "string" || !path.isAbsolute(receipt.cwd) || !(receipt.leaf_id === null || typeof receipt.leaf_id === "string"))
|
|
21159
|
+
return null;
|
|
21160
|
+
const sessionId = receipt.session_id;
|
|
21161
|
+
const [cwd, receiptCwd, root, file] = await Promise.all([
|
|
21162
|
+
realpath(opts.firstmateDir),
|
|
21163
|
+
realpath(receipt.cwd),
|
|
21164
|
+
realpath(path.join(opts.agentDir, "sessions")),
|
|
21165
|
+
realpath(receipt.transcript_path)
|
|
21166
|
+
]);
|
|
21167
|
+
const relative = path.relative(root, file);
|
|
21168
|
+
if (cwd !== receiptCwd || !relative || relative.startsWith("..") || path.isAbsolute(relative))
|
|
21169
|
+
return null;
|
|
21170
|
+
const text2 = await readBounded(file, SESSION_BYTES);
|
|
21171
|
+
if (text2 === null) return null;
|
|
21172
|
+
const lines = text2.split("\n");
|
|
21173
|
+
lines.pop();
|
|
21174
|
+
const header = object(JSON.parse(lines.shift() ?? "null"));
|
|
21175
|
+
if (!header || header.type !== "session" || header.version !== 3 || header.id !== receipt.session_id || typeof header.cwd !== "string" || await realpath(header.cwd) !== cwd)
|
|
21176
|
+
return null;
|
|
21177
|
+
const entries = /* @__PURE__ */ new Map();
|
|
21178
|
+
for (const line of lines) {
|
|
21179
|
+
if (!line.trim()) continue;
|
|
21180
|
+
const entry = object(JSON.parse(line));
|
|
21181
|
+
if (!entry || typeof entry.id !== "string" || !(entry.parentId === null || typeof entry.parentId === "string") || entries.has(entry.id))
|
|
21182
|
+
return null;
|
|
21183
|
+
entries.set(entry.id, entry);
|
|
21184
|
+
}
|
|
21185
|
+
const branch = [];
|
|
21186
|
+
const seen = /* @__PURE__ */ new Set();
|
|
21187
|
+
let leaf = receipt.leaf_id;
|
|
21188
|
+
while (leaf !== null) {
|
|
21189
|
+
if (seen.has(leaf)) return null;
|
|
21190
|
+
seen.add(leaf);
|
|
21191
|
+
const entry = entries.get(leaf);
|
|
21192
|
+
if (!entry) return null;
|
|
21193
|
+
branch.push(entry);
|
|
21194
|
+
leaf = typeof entry.parentId === "string" ? entry.parentId : null;
|
|
21195
|
+
}
|
|
21196
|
+
const records2 = branch.reverse().flatMap((entry) => normalize(entry, sessionId));
|
|
21197
|
+
return {
|
|
21198
|
+
source: { how: "hook", file, truncated: records2.length > MAX_RECORDS },
|
|
21199
|
+
records: records2.slice(-MAX_RECORDS)
|
|
21200
|
+
};
|
|
21201
|
+
} catch {
|
|
21202
|
+
return null;
|
|
21203
|
+
}
|
|
20636
21204
|
}
|
|
20637
|
-
|
|
20638
|
-
const
|
|
20639
|
-
if (
|
|
20640
|
-
|
|
20641
|
-
|
|
20642
|
-
|
|
20643
|
-
|
|
20644
|
-
|
|
20645
|
-
|
|
20646
|
-
|
|
20647
|
-
|
|
20648
|
-
|
|
20649
|
-
|
|
20650
|
-
|
|
20651
|
-
)
|
|
21205
|
+
function piScreen(text2) {
|
|
21206
|
+
const blocked2 = { kind: "blocked", title: "Pi needs attention in its terminal." };
|
|
21207
|
+
if (text2 === null) return blocked2;
|
|
21208
|
+
const lines = text2.replace(/\r/g, "").trimEnd().split("\n");
|
|
21209
|
+
const rule = /^\s*─{12,}\s*$/;
|
|
21210
|
+
const bottom = lines.findLastIndex((line) => rule.test(line));
|
|
21211
|
+
if (bottom < 2 || bottom < lines.length - 5 || bottom >= lines.length - 1) return blocked2;
|
|
21212
|
+
const footer = lines.slice(bottom + 1);
|
|
21213
|
+
if (!/^\s*(?:\/|~(?:\/|$))/.test(footer[0]) || footer.some((line) => /\b(?:select|confirm|cancel)\b/i.test(line)))
|
|
21214
|
+
return blocked2;
|
|
21215
|
+
let top = bottom - 1;
|
|
21216
|
+
while (top >= Math.max(0, bottom - 12) && !rule.test(lines[top]) && !/^── .*\bWorking\b.*─{8,}\s*$/.test(lines[top]))
|
|
21217
|
+
top--;
|
|
21218
|
+
if (top < 0 || top < bottom - 12) return blocked2;
|
|
21219
|
+
if (lines.slice(top + 1, bottom).some((line) => line.trim()))
|
|
21220
|
+
return {
|
|
21221
|
+
kind: "blocked",
|
|
21222
|
+
title: "Pi has unsent input or a dialog. Send or clear it in the terminal first."
|
|
21223
|
+
};
|
|
21224
|
+
return { kind: "prompt", busy: /\bWorking\b/.test(lines[top]) };
|
|
20652
21225
|
}
|
|
20653
|
-
|
|
20654
|
-
|
|
20655
|
-
|
|
20656
|
-
|
|
20657
|
-
|
|
20658
|
-
|
|
20659
|
-
|
|
20660
|
-
|
|
20661
|
-
);
|
|
20662
|
-
await request(conn, `${sessionRoute(conn)}/prompt`, {
|
|
20663
|
-
id: `msg_${randomUUID().replace(/-/g, "")}`,
|
|
20664
|
-
prompt: { text: message2 },
|
|
20665
|
-
delivery: "steer"
|
|
20666
|
-
});
|
|
21226
|
+
function piArgv(binary, extensionFile, provider) {
|
|
21227
|
+
return [
|
|
21228
|
+
binary,
|
|
21229
|
+
"--approve",
|
|
21230
|
+
"--extension",
|
|
21231
|
+
extensionFile,
|
|
21232
|
+
...provider ? ["--provider", provider] : []
|
|
21233
|
+
];
|
|
20667
21234
|
}
|
|
20668
|
-
|
|
20669
|
-
|
|
20670
|
-
|
|
21235
|
+
function launch(nonce, chatReady) {
|
|
21236
|
+
return {
|
|
21237
|
+
nonce,
|
|
21238
|
+
chatReady,
|
|
21239
|
+
screen: (io) => nativeScreen(io, piScreen),
|
|
21240
|
+
picker: async () => null
|
|
21241
|
+
};
|
|
20671
21242
|
}
|
|
21243
|
+
const pi = {
|
|
21244
|
+
id: "pi",
|
|
21245
|
+
skipPermissionsSetting: false,
|
|
21246
|
+
slashCommands: false,
|
|
21247
|
+
menuOpen: "pi is waiting for attention. Answer the choice or open its terminal before sending.",
|
|
21248
|
+
restartToChat: "Restart the pi session from Wheelhouse to enable its chat recorder.",
|
|
21249
|
+
async start(ctx, binary, nonce) {
|
|
21250
|
+
const extensionFile = path.join(path.dirname(ctx.hookFile), "pi-extension.mjs");
|
|
21251
|
+
await writeFile(`${extensionFile}.${nonce}.tmp`, piExtensionSource(), { mode: 384 });
|
|
21252
|
+
await rename(`${extensionFile}.${nonce}.tmp`, extensionFile);
|
|
21253
|
+
return {
|
|
21254
|
+
argv: piArgv(binary, extensionFile, ctx.piProvider()),
|
|
21255
|
+
env: receiptEnv(ctx, nonce),
|
|
21256
|
+
launch: launch(nonce, true)
|
|
21257
|
+
};
|
|
21258
|
+
},
|
|
21259
|
+
async recover(ctx, io) {
|
|
21260
|
+
const { nonce, chatReady } = await recoverReceipt(ctx, io);
|
|
21261
|
+
return launch(nonce, chatReady);
|
|
21262
|
+
},
|
|
21263
|
+
chat: {
|
|
21264
|
+
kind: "snapshot",
|
|
21265
|
+
read: (ctx, running) => piSnapshot({
|
|
21266
|
+
firstmateDir: ctx.firstmateDir,
|
|
21267
|
+
hookFile: ctx.hookFile,
|
|
21268
|
+
sessionNonce: running?.nonce ?? null,
|
|
21269
|
+
agentDir: ctx.env.PI_CODING_AGENT_DIR || path.join(ctx.env.HOME || homedir(), ".pi", "agent")
|
|
21270
|
+
})
|
|
21271
|
+
}
|
|
21272
|
+
};
|
|
21273
|
+
const AGENTS = {
|
|
21274
|
+
claude,
|
|
21275
|
+
codex,
|
|
21276
|
+
opencode: openCode,
|
|
21277
|
+
pi,
|
|
21278
|
+
grok
|
|
21279
|
+
};
|
|
20672
21280
|
const INPUT_MAX_BYTES = 64 * 1024;
|
|
20673
21281
|
const HOOK_RECORD = path.join("firstmate", "session-start.json");
|
|
20674
21282
|
const HERDR_RECORD = path.join("firstmate", "herdr-session.json");
|
|
20675
21283
|
const sessionScope = (stateDir, homeDir) => path.join(stateDir, "homes", homeKey(homeDir));
|
|
20676
21284
|
const PASTE_SETTLE_MS = 400;
|
|
20677
21285
|
const KEY_GAP_MS = 120;
|
|
20678
|
-
const GROK_STOP_HOLD_MS = 1200;
|
|
20679
|
-
const DISMISS_MAX = 5;
|
|
20680
|
-
const MENU_SETTLE_MS = 400;
|
|
20681
|
-
const MENU_REDRAW_WAITS = 5;
|
|
20682
|
-
const menuPart = (text2) => text2?.slice(Math.max(0, text2.lastIndexOf("▔"))) ?? null;
|
|
20683
|
-
const MENU_OPEN = "A Claude Code menu is open in Firstmate’s session, so nothing was typed. Answer or close it, then send again.";
|
|
20684
21286
|
const IN_TERMINAL = "Firstmate is waiting for you in its terminal, so nothing was typed. Open the terminal and answer it there, then send again.";
|
|
20685
21287
|
const TERMINAL_SETTLE_MS = 1500;
|
|
20686
21288
|
const SIGN_IN_MAX_BYTES = 4096;
|
|
20687
|
-
function
|
|
20688
|
-
|
|
20689
|
-
|
|
20690
|
-
|
|
20691
|
-
|
|
21289
|
+
function startSpec(harness, firstmateDir, argv, marks, fmHome) {
|
|
21290
|
+
return {
|
|
21291
|
+
cwd: firstmateDir,
|
|
21292
|
+
argv,
|
|
21293
|
+
env: { WHEELHOUSE_HARNESS: harness, ...marks, ...fmHome ? { FM_HOME: fmHome } : {} }
|
|
20692
21294
|
};
|
|
20693
|
-
if (skipPermissions) settings.skipDangerousModePermissionPrompt = true;
|
|
20694
|
-
return JSON.stringify(settings);
|
|
20695
|
-
}
|
|
20696
|
-
function claudeArgv(claude, hookFile, skipPermissions) {
|
|
20697
|
-
const argv = [claude];
|
|
20698
|
-
if (skipPermissions) argv.push("--dangerously-skip-permissions");
|
|
20699
|
-
argv.push("--settings", sessionSettings(hookFile, skipPermissions));
|
|
20700
|
-
return argv;
|
|
20701
|
-
}
|
|
20702
|
-
function codexArgv(binary) {
|
|
20703
|
-
const script = `const fs = require('node:fs');
|
|
20704
|
-
let input = '';
|
|
20705
|
-
process.stdin.setEncoding('utf8');
|
|
20706
|
-
process.stdin.on('data', chunk => { input += chunk; if (Buffer.byteLength(input) > 65536) process.exit(1); });
|
|
20707
|
-
process.stdin.on('end', () => {
|
|
20708
|
-
const record = JSON.parse(input);
|
|
20709
|
-
const file = process.env.WH_SESSION_RECORD;
|
|
20710
|
-
if (!file || !process.env.WH_SESSION_NONCE) process.exit(1);
|
|
20711
|
-
fs.writeFileSync(file + '.tmp', JSON.stringify({...record, wheelhouse_nonce: process.env.WH_SESSION_NONCE}), {mode: 0o600});
|
|
20712
|
-
fs.renameSync(file + '.tmp', file);
|
|
20713
|
-
});`;
|
|
20714
|
-
const command = shellLine([process.execPath, "-e", script]);
|
|
20715
|
-
return [
|
|
20716
|
-
binary,
|
|
20717
|
-
"--dangerously-bypass-approvals-and-sandbox",
|
|
20718
|
-
"--dangerously-bypass-hook-trust",
|
|
20719
|
-
"-c",
|
|
20720
|
-
`hooks.SessionStart=[{hooks=[{type="command",command=${JSON.stringify(command)},timeout=10}]}]`
|
|
20721
|
-
];
|
|
20722
|
-
}
|
|
20723
|
-
function launchSpec(options) {
|
|
20724
|
-
const { binary, firstmateDir, hookFile, fmHome } = options;
|
|
20725
|
-
let command;
|
|
20726
|
-
const environment = [`WHEELHOUSE_HARNESS=${options.harness}`];
|
|
20727
|
-
switch (options.harness) {
|
|
20728
|
-
case "claude":
|
|
20729
|
-
command = claudeArgv(binary, hookFile, options.skipPermissions);
|
|
20730
|
-
break;
|
|
20731
|
-
case "codex":
|
|
20732
|
-
environment.push(`WH_SESSION_RECORD=${hookFile}`, `WH_SESSION_NONCE=${options.sessionNonce}`);
|
|
20733
|
-
command = codexArgv(binary);
|
|
20734
|
-
break;
|
|
20735
|
-
case "pi":
|
|
20736
|
-
environment.push(`WH_SESSION_RECORD=${hookFile}`, `WH_SESSION_NONCE=${options.sessionNonce}`);
|
|
20737
|
-
command = [
|
|
20738
|
-
binary,
|
|
20739
|
-
"--approve",
|
|
20740
|
-
"--extension",
|
|
20741
|
-
options.extensionFile,
|
|
20742
|
-
...options.provider ? ["--provider", options.provider] : []
|
|
20743
|
-
];
|
|
20744
|
-
break;
|
|
20745
|
-
case "opencode":
|
|
20746
|
-
environment.push(`WH_OPENCODE_CONNECTION=${options.connectionFile}`);
|
|
20747
|
-
command = [
|
|
20748
|
-
process.execPath,
|
|
20749
|
-
"-e",
|
|
20750
|
-
`const fs = require('node:fs');
|
|
20751
|
-
const {spawn} = require('node:child_process');
|
|
20752
|
-
const connection = JSON.parse(fs.readFileSync(process.argv[1], 'utf8'));
|
|
20753
|
-
const child = spawn(process.argv[2], ['--auto', '--hostname', '127.0.0.1', '--port', new URL(connection.url).port], {
|
|
20754
|
-
stdio: 'inherit', env: {...process.env, OPENCODE_SERVER_USERNAME: connection.username, OPENCODE_SERVER_PASSWORD: connection.password}
|
|
20755
|
-
});
|
|
20756
|
-
child.on('error', () => { console.error('OpenCode could not start.'); process.exitCode = 1; });
|
|
20757
|
-
child.on('exit', code => { process.exitCode = code ?? 1; })`,
|
|
20758
|
-
options.connectionFile,
|
|
20759
|
-
binary
|
|
20760
|
-
];
|
|
20761
|
-
break;
|
|
20762
|
-
case "grok":
|
|
20763
|
-
environment.push(`${GROK_SESSION_VARIABLE}=${options.sessionId}`);
|
|
20764
|
-
command = grokArgv(binary, options.sessionId);
|
|
20765
|
-
break;
|
|
20766
|
-
}
|
|
20767
|
-
if (fmHome) environment.push(`FM_HOME=${fmHome}`);
|
|
20768
|
-
const env = {};
|
|
20769
|
-
for (const value of environment) {
|
|
20770
|
-
const at = value.indexOf("=");
|
|
20771
|
-
env[value.slice(0, at)] = value.slice(at + 1);
|
|
20772
|
-
}
|
|
20773
|
-
return { cwd: firstmateDir, argv: command, env };
|
|
20774
21295
|
}
|
|
20775
21296
|
class FirstmateSession {
|
|
20776
21297
|
harness;
|
|
20777
21298
|
activeHarness;
|
|
20778
|
-
|
|
20779
|
-
nativeNonce = null;
|
|
20780
|
-
openCode = null;
|
|
21299
|
+
/** The private connection of a running OpenCode launch, or null. */
|
|
20781
21300
|
get openCodeConnection() {
|
|
20782
|
-
return this.
|
|
21301
|
+
return this.active?.launch?.connection ?? null;
|
|
20783
21302
|
}
|
|
21303
|
+
/** The nonce a running Codex or Pi launch stamps on its hook receipt, or null. */
|
|
20784
21304
|
get sessionNonce() {
|
|
20785
|
-
return this.
|
|
21305
|
+
return this.active?.launch?.nonce ?? null;
|
|
20786
21306
|
}
|
|
20787
|
-
grokSession = null;
|
|
20788
|
-
grokStopHold = Promise.resolve();
|
|
20789
21307
|
/** The conversation id a running Grok session was started with, or null. */
|
|
20790
21308
|
get grokSessionId() {
|
|
20791
|
-
return this.
|
|
21309
|
+
return this.active?.launch?.sessionId ?? null;
|
|
20792
21310
|
}
|
|
20793
21311
|
firstmateDir;
|
|
20794
21312
|
homeDir;
|
|
@@ -20813,6 +21331,23 @@ class FirstmateSession {
|
|
|
20813
21331
|
starting = null;
|
|
20814
21332
|
/** One input at a time, in order, so two messages never interleave in the paste buffer. */
|
|
20815
21333
|
queue = Promise.resolve();
|
|
21334
|
+
/** The launch Wheelhouse started or recovered last, with the agent it belongs to. */
|
|
21335
|
+
active = null;
|
|
21336
|
+
/** The session's terminal as an agent may use it. */
|
|
21337
|
+
io = {
|
|
21338
|
+
screen: () => this.screen(),
|
|
21339
|
+
keys: (keys) => this.keys(keys),
|
|
21340
|
+
variable: (name2) => this.backend.variable(name2),
|
|
21341
|
+
sleep: (ms) => this.sleep(ms),
|
|
21342
|
+
read: () => {
|
|
21343
|
+
this.unreadSince = null;
|
|
21344
|
+
},
|
|
21345
|
+
unread: () => {
|
|
21346
|
+
const now = this.now();
|
|
21347
|
+
this.unreadSince ??= now;
|
|
21348
|
+
return now - this.unreadSince >= TERMINAL_SETTLE_MS;
|
|
21349
|
+
}
|
|
21350
|
+
};
|
|
20816
21351
|
constructor(opts) {
|
|
20817
21352
|
this.harness = opts.harness ?? parseHarness((opts.env ?? process.env).WHEELHOUSE_HARNESS);
|
|
20818
21353
|
this.activeHarness = this.harness;
|
|
@@ -20823,7 +21358,7 @@ class FirstmateSession {
|
|
|
20823
21358
|
this.scopedHookFile = path.join(scope, HOOK_RECORD);
|
|
20824
21359
|
this.legacyHookFile = path.join(this.stateDir, HOOK_RECORD);
|
|
20825
21360
|
this.lock = opts.lock;
|
|
20826
|
-
this.skipPermissions = this.harness
|
|
21361
|
+
this.skipPermissions = AGENTS[this.harness].skipPermissionsSetting && (opts.skipPermissions ?? true);
|
|
20827
21362
|
this.env = sessionEnv(opts.env ?? process.env);
|
|
20828
21363
|
this.find = opts.find ?? ((name2) => which(name2, this.env.PATH));
|
|
20829
21364
|
this.backend = opts.backend ?? (opts.sessionBackend === "herdr" ? new HerdrBackend({
|
|
@@ -20856,6 +21391,23 @@ class FirstmateSession {
|
|
|
20856
21391
|
get hookFile() {
|
|
20857
21392
|
return this.backend.legacy ? this.legacyHookFile : this.scopedHookFile;
|
|
20858
21393
|
}
|
|
21394
|
+
/** What an agent starting or recovering a launch is told about it. */
|
|
21395
|
+
context() {
|
|
21396
|
+
return {
|
|
21397
|
+
firstmateDir: this.firstmateDir,
|
|
21398
|
+
homeDir: this.homeDir,
|
|
21399
|
+
stateDir: this.stateDir,
|
|
21400
|
+
hookFile: this.hookFile,
|
|
21401
|
+
trustStore: this.trustStore,
|
|
21402
|
+
skipPermissions: this.skipPermissions,
|
|
21403
|
+
piProvider: this.piProvider,
|
|
21404
|
+
env: this.env
|
|
21405
|
+
};
|
|
21406
|
+
}
|
|
21407
|
+
/** The running harness's launch, once running() or start() has found or made it. */
|
|
21408
|
+
current() {
|
|
21409
|
+
return this.active?.agent.id === this.activeHarness ? this.active : null;
|
|
21410
|
+
}
|
|
20859
21411
|
/** Why Wheelhouse cannot start or talk to a session here, or null. */
|
|
20860
21412
|
unavailable(requireHarness = true) {
|
|
20861
21413
|
if (this.backendProblem) return this.backendProblem;
|
|
@@ -20889,33 +21441,13 @@ class FirstmateSession {
|
|
|
20889
21441
|
} catch {
|
|
20890
21442
|
return null;
|
|
20891
21443
|
}
|
|
20892
|
-
|
|
20893
|
-
|
|
20894
|
-
|
|
20895
|
-
this.nativeNonce = /^[0-9a-f-]{36}$/.test(value) ? value : null;
|
|
20896
|
-
this.nativeRecorder &&= this.nativeNonce !== null;
|
|
20897
|
-
}
|
|
20898
|
-
if (this.activeHarness === "grok") {
|
|
20899
|
-
const value = await this.backend.variable(GROK_SESSION_VARIABLE);
|
|
20900
|
-
this.grokSession = isGrokSessionId(value) ? value : null;
|
|
20901
|
-
}
|
|
20902
|
-
if (this.activeHarness === "opencode") {
|
|
20903
|
-
this.openCode = null;
|
|
20904
|
-
const file = await this.backend.variable("WH_OPENCODE_CONNECTION") ?? "";
|
|
20905
|
-
try {
|
|
20906
|
-
if (!/^opencode-[0-9a-f-]{36}\.json$/.test(path.basename(file)) || await realpath(path.dirname(file)) !== await realpath(path.dirname(this.hookFile)))
|
|
20907
|
-
throw new Error("Wrong state directory");
|
|
20908
|
-
const connection = parseOpenCodeConnection(JSON.parse(await readFile(file, "utf8")));
|
|
20909
|
-
if (await realpath(connection.directory) !== await realpath(this.firstmateDir))
|
|
20910
|
-
throw new Error("Wrong Firstmate checkout");
|
|
20911
|
-
this.openCode = connection;
|
|
20912
|
-
} catch {
|
|
20913
|
-
}
|
|
20914
|
-
}
|
|
21444
|
+
const agent = AGENTS[this.activeHarness];
|
|
21445
|
+
const launch2 = await agent.recover(this.context(), this.io, this.launchOf(agent));
|
|
21446
|
+
this.active = { agent, launch: launch2 };
|
|
20915
21447
|
return true;
|
|
20916
21448
|
}
|
|
20917
21449
|
view(state2, reason, screen = { picker: null, menu: null, busy: false }) {
|
|
20918
|
-
const needsRestart = state2 === "ours" &&
|
|
21450
|
+
const needsRestart = state2 === "ours" && this.current()?.launch.chatReady === false;
|
|
20919
21451
|
return {
|
|
20920
21452
|
schema: "wheelhouse-firstmate-session.v1",
|
|
20921
21453
|
harness: this.activeHarness,
|
|
@@ -20923,101 +21455,27 @@ class FirstmateSession {
|
|
|
20923
21455
|
reason: needsRestart ? `This ${this.activeHarness} session predates chat integration or belongs to another Wheelhouse state directory. Exit it in the terminal, then start Firstmate here again.` : reason,
|
|
20924
21456
|
canSend: state2 === "ours" && !needsRestart,
|
|
20925
21457
|
attach: state2 === "ours" ? this.backend.attachHint() : null,
|
|
20926
|
-
skipPermissions: this.activeHarness
|
|
20927
|
-
...screen
|
|
20928
|
-
};
|
|
20929
|
-
}
|
|
20930
|
-
/** Wheelhouse's session's screen as text, or null. */
|
|
20931
|
-
screen() {
|
|
20932
|
-
return this.backend.screen();
|
|
20933
|
-
}
|
|
20934
|
-
/** The
|
|
20935
|
-
async picker() {
|
|
20936
|
-
|
|
20937
|
-
return this.openCode ? pendingOpenCodePicker(this.openCode) : null;
|
|
20938
|
-
const text2 = await this.screen();
|
|
20939
|
-
if (this.activeHarness === "codex") {
|
|
20940
|
-
const shown = codexScreen(text2);
|
|
20941
|
-
return shown.kind === "picker" ? shown.picker : null;
|
|
20942
|
-
}
|
|
20943
|
-
if (this.activeHarness !== "claude") return null;
|
|
20944
|
-
return text2 === null ? null : parsePicker(text2);
|
|
20945
|
-
}
|
|
20946
|
-
/**
|
|
20947
|
-
* What the screen says: a menu Claude Code waits on (as choices when it has
|
|
20948
|
-
* numbered ones), and whether it is busy (it shows "esc to interrupt" while
|
|
20949
|
-
* working, before anything reaches the transcript). A screen it cannot read
|
|
20950
|
-
* counts as waiting in the terminal once it has stayed, or at once when
|
|
20951
|
-
* `settled` (before typing, where a screen caught halfway must not be typed into).
|
|
20952
|
-
*/
|
|
20953
|
-
async onScreen(settled2 = false) {
|
|
20954
|
-
if (this.activeHarness === "opencode") {
|
|
20955
|
-
try {
|
|
20956
|
-
if (this.openCode) {
|
|
20957
|
-
const status2 = await openCodeStatus(this.openCode);
|
|
20958
|
-
this.unreadSince = null;
|
|
20959
|
-
return status2;
|
|
20960
|
-
}
|
|
20961
|
-
} catch {
|
|
20962
|
-
}
|
|
20963
|
-
return this.blocked(
|
|
20964
|
-
"OpenCode’s session API is not ready. Retry shortly or open its terminal."
|
|
20965
|
-
);
|
|
20966
|
-
}
|
|
20967
|
-
if (this.activeHarness === "codex" || this.activeHarness === "pi" || this.activeHarness === "grok") {
|
|
20968
|
-
const text22 = await this.screen().catch(() => null);
|
|
20969
|
-
const signIn2 = readSignIn(text22)?.signIn ?? null;
|
|
20970
|
-
if (signIn2) {
|
|
20971
|
-
this.unreadSince = null;
|
|
20972
|
-
return { picker: null, menu: null, busy: false, signIn: signIn2 };
|
|
20973
|
-
}
|
|
20974
|
-
const shown2 = this.activeHarness === "codex" ? codexScreen(text22) : this.activeHarness === "pi" ? piScreen(text22) : grokScreen(text22);
|
|
20975
|
-
if (shown2.kind === "blocked" && text22?.trim()) return this.blocked(shown2.title);
|
|
20976
|
-
this.unreadSince = null;
|
|
20977
|
-
return {
|
|
20978
|
-
picker: shown2.kind === "picker" ? shown2.picker : null,
|
|
20979
|
-
menu: shown2.kind === "blocked" ? { title: shown2.title, canDismiss: false } : null,
|
|
20980
|
-
busy: shown2.kind === "prompt" && shown2.busy
|
|
20981
|
-
};
|
|
20982
|
-
}
|
|
20983
|
-
if (this.activeHarness !== "claude") return { picker: null, menu: null, busy: false };
|
|
20984
|
-
const text2 = await this.screen().catch(() => null);
|
|
20985
|
-
if (text2 === null) return { picker: null, menu: null, busy: false };
|
|
20986
|
-
const signIn = readSignIn(text2)?.signIn ?? null;
|
|
20987
|
-
if (signIn) {
|
|
20988
|
-
this.unreadSince = null;
|
|
20989
|
-
return { picker: null, menu: null, busy: false, signIn, terminal: null };
|
|
20990
|
-
}
|
|
20991
|
-
const shown = {
|
|
20992
|
-
picker: parsePicker(text2),
|
|
20993
|
-
menu: parseMenu(text2),
|
|
20994
|
-
busy: /\besc to interrupt\b/i.test(text2),
|
|
20995
|
-
signIn: null,
|
|
20996
|
-
terminal: null
|
|
20997
|
-
};
|
|
20998
|
-
if (shown.picker || shown.menu || !text2.trim() || atClaudePrompt(text2)) {
|
|
20999
|
-
this.unreadSince = null;
|
|
21000
|
-
} else {
|
|
21001
|
-
const now = this.now();
|
|
21002
|
-
this.unreadSince ??= now;
|
|
21003
|
-
if (now - this.unreadSince >= TERMINAL_SETTLE_MS || settled2)
|
|
21004
|
-
shown.terminal = { excerpt: terminalExcerpt(text2) };
|
|
21005
|
-
}
|
|
21006
|
-
return shown;
|
|
21458
|
+
skipPermissions: AGENTS[this.activeHarness].skipPermissionsSetting && this.skipPermissions,
|
|
21459
|
+
...screen
|
|
21460
|
+
};
|
|
21461
|
+
}
|
|
21462
|
+
/** Wheelhouse's session's screen as text, or null. */
|
|
21463
|
+
screen() {
|
|
21464
|
+
return this.backend.screen();
|
|
21465
|
+
}
|
|
21466
|
+
/** The choice the agent is waiting on in Wheelhouse's session, or null. */
|
|
21467
|
+
async picker() {
|
|
21468
|
+
return await this.current()?.launch.picker(this.io) ?? null;
|
|
21007
21469
|
}
|
|
21008
21470
|
/**
|
|
21009
|
-
*
|
|
21010
|
-
*
|
|
21471
|
+
* What the screen says: a menu the agent waits on (as choices when it has
|
|
21472
|
+
* numbered ones), and whether it is busy. A screen it cannot read counts as
|
|
21473
|
+
* waiting in the terminal once it has stayed, or at once when `settled`
|
|
21474
|
+
* (before typing, where a screen caught halfway must not be typed into).
|
|
21011
21475
|
*/
|
|
21012
|
-
|
|
21013
|
-
const
|
|
21014
|
-
this.
|
|
21015
|
-
return {
|
|
21016
|
-
picker: null,
|
|
21017
|
-
menu: { title, canDismiss: false },
|
|
21018
|
-
busy: false,
|
|
21019
|
-
terminal: now - this.unreadSince >= TERMINAL_SETTLE_MS ? { excerpt: title } : null
|
|
21020
|
-
};
|
|
21476
|
+
async onScreen(settled2 = false) {
|
|
21477
|
+
const current = this.current();
|
|
21478
|
+
return current ? current.launch.screen(this.io, settled2) : { picker: null, menu: null, busy: false };
|
|
21021
21479
|
}
|
|
21022
21480
|
/** Where the Firstmate session stands, as the page shows it. */
|
|
21023
21481
|
async status() {
|
|
@@ -21071,92 +21529,58 @@ class FirstmateSession {
|
|
|
21071
21529
|
`Wheelhouse could not create ${path.dirname(this.hookFile)}: ${e.message}`
|
|
21072
21530
|
);
|
|
21073
21531
|
}
|
|
21074
|
-
if (this.harness === "claude" && this.trustStore)
|
|
21075
|
-
registerTrust(this.trustStore, this.firstmateDir);
|
|
21076
21532
|
const fmHome = this.homeDir !== this.firstmateDir ? this.homeDir : null;
|
|
21077
21533
|
const nonce = randomUUID();
|
|
21078
|
-
const
|
|
21079
|
-
let
|
|
21534
|
+
const agent = AGENTS[this.harness];
|
|
21535
|
+
let spec;
|
|
21536
|
+
let launch2;
|
|
21080
21537
|
try {
|
|
21081
|
-
|
|
21082
|
-
|
|
21083
|
-
|
|
21084
|
-
break;
|
|
21085
|
-
case "codex":
|
|
21086
|
-
launch = { ...common, harness: "codex", sessionNonce: nonce };
|
|
21087
|
-
break;
|
|
21088
|
-
case "pi": {
|
|
21089
|
-
const extensionFile = path.join(path.dirname(this.hookFile), "pi-extension.mjs");
|
|
21090
|
-
await writeFile(`${extensionFile}.${nonce}.tmp`, piExtensionSource(), { mode: 384 });
|
|
21091
|
-
await rename(`${extensionFile}.${nonce}.tmp`, extensionFile);
|
|
21092
|
-
launch = {
|
|
21093
|
-
...common,
|
|
21094
|
-
harness: "pi",
|
|
21095
|
-
sessionNonce: nonce,
|
|
21096
|
-
extensionFile,
|
|
21097
|
-
provider: this.piProvider()
|
|
21098
|
-
};
|
|
21099
|
-
break;
|
|
21100
|
-
}
|
|
21101
|
-
case "opencode": {
|
|
21102
|
-
const port = await new ServicePorts(path.join(this.stateDir, "primary-ports.json")).port(
|
|
21103
|
-
"opencode",
|
|
21104
|
-
null,
|
|
21105
|
-
4096,
|
|
21106
|
-
[],
|
|
21107
|
-
[]
|
|
21108
|
-
);
|
|
21109
|
-
const connection = parseOpenCodeConnection({
|
|
21110
|
-
url: `http://127.0.0.1:${port}`,
|
|
21111
|
-
directory: this.firstmateDir,
|
|
21112
|
-
sessionId: `ses_${nonce.replace(/-/g, "")}`,
|
|
21113
|
-
username: "wheelhouse",
|
|
21114
|
-
password: randomBytes(32).toString("hex")
|
|
21115
|
-
});
|
|
21116
|
-
const connectionFile = path.join(path.dirname(this.hookFile), `opencode-${nonce}.json`);
|
|
21117
|
-
await writeFile(connectionFile, JSON.stringify(connection), { mode: 384, flag: "wx" });
|
|
21118
|
-
this.openCode = connection;
|
|
21119
|
-
launch = { ...common, harness: "opencode", connectionFile };
|
|
21120
|
-
break;
|
|
21121
|
-
}
|
|
21122
|
-
case "grok":
|
|
21123
|
-
launch = { ...common, harness: "grok", sessionId: nonce };
|
|
21124
|
-
break;
|
|
21125
|
-
}
|
|
21538
|
+
const begun = await agent.start(this.context(), binary, nonce);
|
|
21539
|
+
launch2 = begun.launch;
|
|
21540
|
+
spec = startSpec(this.harness, this.firstmateDir, begun.argv, begun.env, fmHome);
|
|
21126
21541
|
} catch (error) {
|
|
21127
21542
|
return this.view(
|
|
21128
21543
|
"unavailable",
|
|
21129
21544
|
`Could not prepare ${this.harness}: ${error instanceof Error ? error.message : String(error)}`
|
|
21130
21545
|
);
|
|
21131
21546
|
}
|
|
21132
|
-
const r = await this.backend.start(
|
|
21547
|
+
const r = await this.backend.start(spec);
|
|
21133
21548
|
if (!r.ok) return this.view("unavailable", r.error);
|
|
21134
21549
|
this.unreadSince = null;
|
|
21135
21550
|
this.activeHarness = this.harness;
|
|
21136
|
-
this.
|
|
21137
|
-
this.
|
|
21138
|
-
|
|
21139
|
-
|
|
21140
|
-
|
|
21141
|
-
|
|
21142
|
-
|
|
21143
|
-
|
|
21144
|
-
|
|
21145
|
-
|
|
21146
|
-
|
|
21147
|
-
|
|
21148
|
-
|
|
21149
|
-
|
|
21150
|
-
|
|
21151
|
-
|
|
21152
|
-
|
|
21153
|
-
|
|
21154
|
-
|
|
21155
|
-
|
|
21156
|
-
|
|
21157
|
-
|
|
21158
|
-
|
|
21159
|
-
|
|
21551
|
+
this.active = { agent, launch: launch2 };
|
|
21552
|
+
return this.view("ours", await launch2.ready?.(this.io) ?? null);
|
|
21553
|
+
}
|
|
21554
|
+
/**
|
|
21555
|
+
* The transcript the chat follows for a session in `state` running
|
|
21556
|
+
* `harness`, as its agent finds it; null for an agent whose chat is read whole.
|
|
21557
|
+
*/
|
|
21558
|
+
locate(state2, harness) {
|
|
21559
|
+
const agent = AGENTS[harness];
|
|
21560
|
+
return agent.chat.kind === "stream" ? agent.chat.locate(this.context(), this.launchOf(agent), state2) : Promise.resolve(null);
|
|
21561
|
+
}
|
|
21562
|
+
/** One line of `harness`'s transcript as the chat's records. */
|
|
21563
|
+
decode(raw, harness) {
|
|
21564
|
+
const chat = AGENTS[harness].chat;
|
|
21565
|
+
return chat.kind === "stream" ? chat.decode(raw) : [];
|
|
21566
|
+
}
|
|
21567
|
+
/**
|
|
21568
|
+
* The conversation of a session in `state` running `harness`, for an agent
|
|
21569
|
+
* whose chat is read whole: only Wheelhouse's own session has one. Undefined
|
|
21570
|
+
* for an agent whose chat follows a transcript instead (locate).
|
|
21571
|
+
*/
|
|
21572
|
+
snapshot(state2, harness) {
|
|
21573
|
+
const agent = AGENTS[harness];
|
|
21574
|
+
if (agent.chat.kind !== "snapshot") return void 0;
|
|
21575
|
+
return state2 === "ours" ? agent.chat.read(this.context(), this.launchOf(agent)) : Promise.resolve(null);
|
|
21576
|
+
}
|
|
21577
|
+
/** Loopback ports the running launch holds, which Wheelhouse keeps other services off. */
|
|
21578
|
+
ports() {
|
|
21579
|
+
return this.active?.launch.ports?.() ?? [];
|
|
21580
|
+
}
|
|
21581
|
+
/** The launch of `agent`'s that Wheelhouse started or recovered last, or null. */
|
|
21582
|
+
launchOf(agent) {
|
|
21583
|
+
return this.active?.agent === agent ? this.active.launch : null;
|
|
21160
21584
|
}
|
|
21161
21585
|
serial(work) {
|
|
21162
21586
|
const next = this.queue.then(work, work);
|
|
@@ -21202,26 +21626,16 @@ class FirstmateSession {
|
|
|
21202
21626
|
}
|
|
21203
21627
|
const refused = await this.ours();
|
|
21204
21628
|
if (refused) return refused;
|
|
21205
|
-
|
|
21206
|
-
|
|
21207
|
-
|
|
21208
|
-
|
|
21209
|
-
error: `Restart the ${this.activeHarness} session from Wheelhouse to enable its chat recorder.`
|
|
21210
|
-
};
|
|
21211
|
-
if (this.activeHarness === "grok" && !this.grokSession)
|
|
21212
|
-
return {
|
|
21213
|
-
ok: false,
|
|
21214
|
-
status: 409,
|
|
21215
|
-
error: "Restart the grok session from Wheelhouse to enable its chat."
|
|
21216
|
-
};
|
|
21217
|
-
if (this.activeHarness === "opencode")
|
|
21218
|
-
return this.openCodeAction((connection) => sendOpenCode(connection, body));
|
|
21629
|
+
const current = this.current();
|
|
21630
|
+
if (current && !current.launch.chatReady)
|
|
21631
|
+
return { ok: false, status: 409, error: current.agent.restartToChat };
|
|
21632
|
+
if (current?.launch.send) return current.launch.send(this.io, body);
|
|
21219
21633
|
const shown = await this.onScreen(true);
|
|
21220
21634
|
if (shown.picker || shown.menu)
|
|
21221
21635
|
return {
|
|
21222
21636
|
ok: false,
|
|
21223
21637
|
status: 409,
|
|
21224
|
-
error: this.activeHarness
|
|
21638
|
+
error: AGENTS[this.activeHarness].menuOpen
|
|
21225
21639
|
};
|
|
21226
21640
|
if (shown.signIn)
|
|
21227
21641
|
return {
|
|
@@ -21236,49 +21650,17 @@ class FirstmateSession {
|
|
|
21236
21650
|
return this.keys(["Enter"]);
|
|
21237
21651
|
});
|
|
21238
21652
|
}
|
|
21239
|
-
/**
|
|
21240
|
-
* Press Escape: Claude Code stops what it is doing. Grok cancels a turn with
|
|
21241
|
-
* Ctrl+C (to Escape it only answers "Press Ctrl+c to cancel the turn"), pressed
|
|
21242
|
-
* only while its screen shows a turn it can cancel, so the key reaches nothing else,
|
|
21243
|
-
* and never within GROK_STOP_HOLD_MS of the last press: a second Ctrl+C that soon quits Grok.
|
|
21244
|
-
*/
|
|
21653
|
+
/** Stop what the agent is doing: Escape, unless its launch stops another way. */
|
|
21245
21654
|
interrupt() {
|
|
21246
21655
|
return this.serial(async () => {
|
|
21247
21656
|
const refused = await this.ours();
|
|
21248
21657
|
if (refused) return refused;
|
|
21249
|
-
|
|
21250
|
-
|
|
21251
|
-
const shown = grokScreen(await this.screen().catch(() => null));
|
|
21252
|
-
if (shown.kind !== "prompt")
|
|
21253
|
-
return { ok: false, status: 409, error: "Use Grok’s terminal to stop it." };
|
|
21254
|
-
if (!shown.busy) return { ok: true };
|
|
21255
|
-
const pressed = await this.keys(["C-c"]);
|
|
21256
|
-
this.grokStopHold = this.sleep(GROK_STOP_HOLD_MS);
|
|
21257
|
-
return pressed;
|
|
21258
|
-
}
|
|
21259
|
-
return this.activeHarness === "opencode" ? this.openCodeAction(interruptOpenCode) : this.keys(["Escape"]);
|
|
21658
|
+
const launch2 = this.current()?.launch;
|
|
21659
|
+
return launch2?.interrupt ? launch2.interrupt(this.io) : this.keys(["Escape"]);
|
|
21260
21660
|
});
|
|
21261
21661
|
}
|
|
21262
|
-
async openCodeAction(action) {
|
|
21263
|
-
if (!this.openCode)
|
|
21264
|
-
return {
|
|
21265
|
-
ok: false,
|
|
21266
|
-
status: 409,
|
|
21267
|
-
error: "Restart the OpenCode primary from Wheelhouse to enable chat."
|
|
21268
|
-
};
|
|
21269
|
-
try {
|
|
21270
|
-
await action(this.openCode);
|
|
21271
|
-
return { ok: true };
|
|
21272
|
-
} catch (error) {
|
|
21273
|
-
return {
|
|
21274
|
-
ok: false,
|
|
21275
|
-
status: error instanceof OpenCodeError ? error.status : 503,
|
|
21276
|
-
error: error instanceof Error ? error.message : "OpenCode is unavailable."
|
|
21277
|
-
};
|
|
21278
|
-
}
|
|
21279
|
-
}
|
|
21280
21662
|
/**
|
|
21281
|
-
* Choose in the menu
|
|
21663
|
+
* Choose in the menu the agent is waiting on. `signature` names the menu
|
|
21282
21664
|
* the page showed; if the screen now shows another (or none), nothing is
|
|
21283
21665
|
* pressed. The keys come from the menu on screen, never from the page.
|
|
21284
21666
|
*/
|
|
@@ -21286,10 +21668,8 @@ class FirstmateSession {
|
|
|
21286
21668
|
return this.serial(async () => {
|
|
21287
21669
|
const refused = await this.ours();
|
|
21288
21670
|
if (refused) return refused;
|
|
21289
|
-
|
|
21290
|
-
|
|
21291
|
-
(connection) => answerOpenCodePicker(connection, signature, action)
|
|
21292
|
-
);
|
|
21671
|
+
const launch2 = this.current()?.launch;
|
|
21672
|
+
if (launch2?.pick) return launch2.pick(this.io, signature, action);
|
|
21293
21673
|
const now = await this.picker().catch(() => null);
|
|
21294
21674
|
if (!now || now.signature !== signature) {
|
|
21295
21675
|
return {
|
|
@@ -21316,8 +21696,8 @@ class FirstmateSession {
|
|
|
21316
21696
|
return { ok: false, status: 400, error: "Paste the code the sign-in page gave you." };
|
|
21317
21697
|
const refused = await this.ours();
|
|
21318
21698
|
if (refused) return refused;
|
|
21319
|
-
|
|
21320
|
-
|
|
21699
|
+
const launch2 = this.current()?.launch;
|
|
21700
|
+
if (launch2?.signIn) return launch2.signIn(this.io, signature, body);
|
|
21321
21701
|
const now = readSignIn(await this.screen().catch(() => null));
|
|
21322
21702
|
if (!now || now.signIn.signature !== signature || !now.signIn.paste)
|
|
21323
21703
|
return {
|
|
@@ -21337,51 +21717,19 @@ class FirstmateSession {
|
|
|
21337
21717
|
return this.keys(["Enter"]);
|
|
21338
21718
|
});
|
|
21339
21719
|
}
|
|
21340
|
-
/**
|
|
21341
|
-
* Close the menu one of Claude Code's commands opened (such as /mcp):
|
|
21342
|
-
* Escape, as often as it takes to back out of its nested screens. After each
|
|
21343
|
-
* press the screen is read until the menu has redrawn, and only another menu
|
|
21344
|
-
* gets another press, so Escape never reaches the prompt, where it would stop
|
|
21345
|
-
* Firstmate's work or (pressed twice) open the rewind menu.
|
|
21346
|
-
* Firstmate's own question or permission prompt, which has no heading of
|
|
21347
|
-
* Claude Code's, is the captain's to answer and is never closed.
|
|
21348
|
-
*/
|
|
21720
|
+
/** Close a menu the agent opened, where it can say how; otherwise the terminal must. */
|
|
21349
21721
|
dismiss() {
|
|
21350
21722
|
return this.serial(async () => {
|
|
21351
21723
|
const refused = await this.ours();
|
|
21352
21724
|
if (refused) return refused;
|
|
21353
|
-
|
|
21725
|
+
const launch2 = this.current()?.launch;
|
|
21726
|
+
if (!launch2?.dismiss)
|
|
21354
21727
|
return {
|
|
21355
21728
|
ok: false,
|
|
21356
21729
|
status: 409,
|
|
21357
21730
|
error: "Use the browser terminal to close this harness’s menus."
|
|
21358
21731
|
};
|
|
21359
|
-
|
|
21360
|
-
for (let i = 0; i < DISMISS_MAX; i++) {
|
|
21361
|
-
const menu = text2 === null ? null : parseMenu(text2);
|
|
21362
|
-
if (!menu) return { ok: true };
|
|
21363
|
-
if (!menu.title && parsePicker(text2)) {
|
|
21364
|
-
if (i > 0) return { ok: true };
|
|
21365
|
-
return {
|
|
21366
|
-
ok: false,
|
|
21367
|
-
status: 409,
|
|
21368
|
-
error: "Firstmate is asking you something now; answer it in the chat."
|
|
21369
|
-
};
|
|
21370
|
-
}
|
|
21371
|
-
const r = await this.keys(["Escape"]);
|
|
21372
|
-
if (!r.ok) return r;
|
|
21373
|
-
const before = menuPart(text2);
|
|
21374
|
-
for (let w = 0; w < MENU_REDRAW_WAITS && menuPart(text2) === before; w++) {
|
|
21375
|
-
await this.sleep(MENU_SETTLE_MS);
|
|
21376
|
-
text2 = await this.screen().catch(() => null);
|
|
21377
|
-
}
|
|
21378
|
-
if (menuPart(text2) === before) break;
|
|
21379
|
-
}
|
|
21380
|
-
return {
|
|
21381
|
-
ok: false,
|
|
21382
|
-
status: 409,
|
|
21383
|
-
error: "The menu is still open after pressing Escape; close it in Firstmate’s terminal."
|
|
21384
|
-
};
|
|
21732
|
+
return launch2.dismiss(this.io);
|
|
21385
21733
|
});
|
|
21386
21734
|
}
|
|
21387
21735
|
/** What the terminal drawer may attach to: only Wheelhouse's own running session, through its backend. */
|
|
@@ -21488,170 +21836,6 @@ function resolveSessionBackend(opts) {
|
|
|
21488
21836
|
if (firstmate !== null) return choice(firstmate === "herdr" ? "herdr" : "tmux", "firstmate");
|
|
21489
21837
|
return choice("tmux", "default");
|
|
21490
21838
|
}
|
|
21491
|
-
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
21492
|
-
const RECEIPT_BYTES = 64 * 1024;
|
|
21493
|
-
const META_BYTES = 1024 * 1024;
|
|
21494
|
-
function object(value) {
|
|
21495
|
-
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
21496
|
-
}
|
|
21497
|
-
async function readJson(file, limit, firstLine2 = false) {
|
|
21498
|
-
const handle = await open(file, "r");
|
|
21499
|
-
try {
|
|
21500
|
-
const size = (await handle.stat()).size;
|
|
21501
|
-
if (!firstLine2 && size > limit) return null;
|
|
21502
|
-
const buffer = Buffer.alloc(Math.min(size, limit));
|
|
21503
|
-
const { bytesRead } = await handle.read(buffer, 0, buffer.length, 0);
|
|
21504
|
-
const text2 = buffer.subarray(0, bytesRead).toString("utf8");
|
|
21505
|
-
const newline = text2.indexOf("\n");
|
|
21506
|
-
if (firstLine2 && newline < 0) return null;
|
|
21507
|
-
return JSON.parse(firstLine2 ? text2.slice(0, newline) : text2);
|
|
21508
|
-
} finally {
|
|
21509
|
-
await handle.close();
|
|
21510
|
-
}
|
|
21511
|
-
}
|
|
21512
|
-
async function locateCodexTranscript(opts, state2) {
|
|
21513
|
-
if (state2 !== "ours" || !opts.sessionNonce?.trim()) return null;
|
|
21514
|
-
try {
|
|
21515
|
-
const receipt = object(await readJson(opts.hookFile, RECEIPT_BYTES));
|
|
21516
|
-
if (!receipt || receipt.wheelhouse_nonce !== opts.sessionNonce || typeof receipt.session_id !== "string" || !UUID.test(receipt.session_id) || typeof receipt.transcript_path !== "string" || !path.isAbsolute(receipt.transcript_path) || typeof receipt.cwd !== "string" || !path.isAbsolute(receipt.cwd))
|
|
21517
|
-
return null;
|
|
21518
|
-
const [cwd, receiptCwd, root, file] = await Promise.all([
|
|
21519
|
-
realpath(opts.firstmateDir),
|
|
21520
|
-
realpath(receipt.cwd),
|
|
21521
|
-
realpath(path.join(opts.codexHome, "sessions")),
|
|
21522
|
-
realpath(receipt.transcript_path)
|
|
21523
|
-
]);
|
|
21524
|
-
const relative = path.relative(root, file);
|
|
21525
|
-
if (cwd !== receiptCwd || !relative || relative.startsWith("..") || path.isAbsolute(relative))
|
|
21526
|
-
return null;
|
|
21527
|
-
const record2 = object(await readJson(file, META_BYTES, true));
|
|
21528
|
-
const meta = object(record2?.payload);
|
|
21529
|
-
if (record2?.type !== "session_meta" || !meta || meta.id !== receipt.session_id || meta.originator !== "codex-tui" || meta.source !== "cli" && meta.source !== "vscode" || typeof meta.cwd !== "string" || !path.isAbsolute(meta.cwd) || await realpath(meta.cwd) !== cwd)
|
|
21530
|
-
return null;
|
|
21531
|
-
return { how: "hook", file };
|
|
21532
|
-
} catch {
|
|
21533
|
-
return null;
|
|
21534
|
-
}
|
|
21535
|
-
}
|
|
21536
|
-
function textContent(value) {
|
|
21537
|
-
if (!Array.isArray(value)) return "";
|
|
21538
|
-
return value.flatMap((part) => {
|
|
21539
|
-
const block = object(part);
|
|
21540
|
-
if (!block) return [];
|
|
21541
|
-
if ((block.type === "text" || block.type === "Text") && typeof block.text === "string")
|
|
21542
|
-
return [block.text];
|
|
21543
|
-
if (block.type === "image" || block.type === "localImage") return ["[image]"];
|
|
21544
|
-
return [];
|
|
21545
|
-
}).join("\n");
|
|
21546
|
-
}
|
|
21547
|
-
function mcpResult(value) {
|
|
21548
|
-
if (typeof value === "string") return value;
|
|
21549
|
-
const result2 = object(value);
|
|
21550
|
-
if (!result2) return "";
|
|
21551
|
-
if (Array.isArray(result2.content)) {
|
|
21552
|
-
return result2.content.flatMap((part) => {
|
|
21553
|
-
const block = object(part);
|
|
21554
|
-
return block?.type === "text" && typeof block.text === "string" ? [{ type: "text", text: block.text }] : [];
|
|
21555
|
-
});
|
|
21556
|
-
}
|
|
21557
|
-
return typeof result2.message === "string" ? result2.message : "";
|
|
21558
|
-
}
|
|
21559
|
-
function codexRecords(raw) {
|
|
21560
|
-
const record2 = object(raw);
|
|
21561
|
-
const payload = object(record2?.payload);
|
|
21562
|
-
if (record2?.type !== "event_msg" || !payload || typeof record2.timestamp !== "string" || !Number.isFinite(Date.parse(record2.timestamp)))
|
|
21563
|
-
return [];
|
|
21564
|
-
const timestamp2 = record2.timestamp;
|
|
21565
|
-
const turnId = typeof payload.turn_id === "string" ? payload.turn_id : null;
|
|
21566
|
-
if (payload.type === "task_complete" && turnId) {
|
|
21567
|
-
return [
|
|
21568
|
-
{
|
|
21569
|
-
type: "system",
|
|
21570
|
-
uuid: `codex:${turnId}:completed`,
|
|
21571
|
-
timestamp: timestamp2,
|
|
21572
|
-
subtype: "turn_duration",
|
|
21573
|
-
durationMs: typeof payload.duration_ms === "number" && Number.isFinite(payload.duration_ms) ? Math.max(0, payload.duration_ms) : null
|
|
21574
|
-
}
|
|
21575
|
-
];
|
|
21576
|
-
}
|
|
21577
|
-
if (payload.type === "turn_aborted" && turnId) {
|
|
21578
|
-
return [
|
|
21579
|
-
{
|
|
21580
|
-
type: "user",
|
|
21581
|
-
uuid: `codex:${turnId}:interrupted`,
|
|
21582
|
-
timestamp: timestamp2,
|
|
21583
|
-
message: { role: "user", content: "[Request interrupted by user]" }
|
|
21584
|
-
}
|
|
21585
|
-
];
|
|
21586
|
-
}
|
|
21587
|
-
if (payload.type !== "item_started" && payload.type !== "item_completed") return [];
|
|
21588
|
-
const completed = payload.type === "item_completed";
|
|
21589
|
-
const item = object(payload.item);
|
|
21590
|
-
if (!item || typeof item.id !== "string" || !item.id || typeof item.type !== "string") return [];
|
|
21591
|
-
const id = `codex:${item.id}`;
|
|
21592
|
-
const assistant = (suffix, content) => ({
|
|
21593
|
-
type: "assistant",
|
|
21594
|
-
uuid: `${id}:${suffix}`,
|
|
21595
|
-
timestamp: timestamp2,
|
|
21596
|
-
message: { id, role: "assistant", content }
|
|
21597
|
-
});
|
|
21598
|
-
if (item.type === "UserMessage" || item.type === "AgentMessage") {
|
|
21599
|
-
if (!completed) return [];
|
|
21600
|
-
const text2 = textContent(item.content);
|
|
21601
|
-
if (!text2.trim()) return [];
|
|
21602
|
-
return item.type === "UserMessage" ? [{ type: "user", uuid: `${id}:user`, timestamp: timestamp2, message: { role: "user", content: text2 } }] : [assistant("text", [{ type: "text", text: text2 }])];
|
|
21603
|
-
}
|
|
21604
|
-
if (item.type === "Reasoning") {
|
|
21605
|
-
return completed ? [assistant("thinking", [{ type: "thinking", thinking: "", signature: "" }])] : [];
|
|
21606
|
-
}
|
|
21607
|
-
let name2;
|
|
21608
|
-
let input;
|
|
21609
|
-
let result2 = "";
|
|
21610
|
-
let isError = item.status === "failed" || item.status === "declined";
|
|
21611
|
-
switch (item.type) {
|
|
21612
|
-
case "CommandExecution":
|
|
21613
|
-
if (typeof item.command !== "string" && !(Array.isArray(item.command) && item.command.every((part) => typeof part === "string")))
|
|
21614
|
-
return [];
|
|
21615
|
-
name2 = "Bash";
|
|
21616
|
-
input = {
|
|
21617
|
-
command: typeof item.command === "string" ? item.command : shellLine(item.command)
|
|
21618
|
-
};
|
|
21619
|
-
result2 = typeof item.aggregated_output === "string" ? item.aggregated_output : "";
|
|
21620
|
-
isError ||= typeof item.exit_code === "number" && item.exit_code !== 0;
|
|
21621
|
-
break;
|
|
21622
|
-
case "McpToolCall": {
|
|
21623
|
-
if (typeof item.server !== "string" || typeof item.tool !== "string") return [];
|
|
21624
|
-
name2 = `mcp__${item.server}__${item.tool}`;
|
|
21625
|
-
input = object(item.arguments) ?? {};
|
|
21626
|
-
result2 = mcpResult(item.result ?? item.error);
|
|
21627
|
-
isError ||= object(item.result)?.isError === true || item.error != null;
|
|
21628
|
-
break;
|
|
21629
|
-
}
|
|
21630
|
-
case "FileChange": {
|
|
21631
|
-
const changes = object(item.changes);
|
|
21632
|
-
if (!changes || !Object.keys(changes).length) return [];
|
|
21633
|
-
name2 = "Edit";
|
|
21634
|
-
input = { file_path: Object.keys(changes).join(", ") };
|
|
21635
|
-
result2 = [item.stdout, item.stderr].filter((value) => typeof value === "string").join("\n");
|
|
21636
|
-
break;
|
|
21637
|
-
}
|
|
21638
|
-
default:
|
|
21639
|
-
return [];
|
|
21640
|
-
}
|
|
21641
|
-
const start = assistant("call", [{ type: "tool_use", id, name: name2, input }]);
|
|
21642
|
-
return completed ? [
|
|
21643
|
-
start,
|
|
21644
|
-
{
|
|
21645
|
-
type: "user",
|
|
21646
|
-
uuid: `${id}:result`,
|
|
21647
|
-
timestamp: timestamp2,
|
|
21648
|
-
message: {
|
|
21649
|
-
role: "user",
|
|
21650
|
-
content: [{ type: "tool_result", tool_use_id: id, content: result2, is_error: isError }]
|
|
21651
|
-
}
|
|
21652
|
-
}
|
|
21653
|
-
] : [start];
|
|
21654
|
-
}
|
|
21655
21839
|
const HEAD_BYTES$1 = 1024;
|
|
21656
21840
|
const MSG_NAME = /^[\w.-]+\.msg$/;
|
|
21657
21841
|
const CREW_REQUEST_ID = /^(?!\.)[A-Za-z0-9._:-]{1,100}$/;
|
|
@@ -25694,47 +25878,9 @@ async function create(env, opts = {}) {
|
|
|
25694
25878
|
const chat = new ChatFeed({
|
|
25695
25879
|
archive: archiveSync?.hook,
|
|
25696
25880
|
status: () => firstmate.status(),
|
|
25697
|
-
locate: (state2, harness
|
|
25698
|
-
|
|
25699
|
-
|
|
25700
|
-
hookFile: firstmate.hookFile,
|
|
25701
|
-
sessionNonce: firstmate.sessionNonce,
|
|
25702
|
-
codexHome: env.CODEX_HOME || path.join(env.HOME || homedir(), ".codex")
|
|
25703
|
-
},
|
|
25704
|
-
state2
|
|
25705
|
-
) : harness === "grok" ? locateGrokTranscript(
|
|
25706
|
-
{
|
|
25707
|
-
firstmateDir: install.firstmateDir,
|
|
25708
|
-
grokHome: env.GROK_HOME || path.join(env.HOME || homedir(), ".grok"),
|
|
25709
|
-
sessionId: firstmate.grokSessionId
|
|
25710
|
-
},
|
|
25711
|
-
state2
|
|
25712
|
-
) : harness === "claude" ? locateTranscript(
|
|
25713
|
-
{
|
|
25714
|
-
firstmateDir: install.firstmateDir,
|
|
25715
|
-
homeDir: install.homeDir,
|
|
25716
|
-
hookFile: firstmate.hookFile,
|
|
25717
|
-
projectsDir: projectsDir(env)
|
|
25718
|
-
},
|
|
25719
|
-
state2
|
|
25720
|
-
) : Promise.resolve(null),
|
|
25721
|
-
decode: (raw, harness) => harness === "codex" ? codexRecords(raw) : harness === "grok" ? grokRecords(raw) : harness === "claude" && raw !== null && typeof raw === "object" && !Array.isArray(raw) ? [raw] : [],
|
|
25722
|
-
snapshot: async (session2) => {
|
|
25723
|
-
if (session2.state !== "ours") return null;
|
|
25724
|
-
if (session2.harness === "pi")
|
|
25725
|
-
return piSnapshot({
|
|
25726
|
-
firstmateDir: install.firstmateDir,
|
|
25727
|
-
hookFile: firstmate.hookFile,
|
|
25728
|
-
sessionNonce: firstmate.sessionNonce,
|
|
25729
|
-
agentDir: env.PI_CODING_AGENT_DIR || path.join(env.HOME || homedir(), ".pi", "agent")
|
|
25730
|
-
});
|
|
25731
|
-
if (session2.harness === "opencode") {
|
|
25732
|
-
if (!firstmate.openCodeConnection)
|
|
25733
|
-
throw new OpenCodeError("Restart the OpenCode primary from Wheelhouse to enable chat.");
|
|
25734
|
-
return openCodeSnapshot(firstmate.openCodeConnection);
|
|
25735
|
-
}
|
|
25736
|
-
return null;
|
|
25737
|
-
}
|
|
25881
|
+
locate: (state2, harness = "claude") => firstmate.locate(state2, harness),
|
|
25882
|
+
decode: (raw, harness) => firstmate.decode(raw, harness),
|
|
25883
|
+
snapshot: (session2) => firstmate.snapshot(session2.state, session2.harness ?? "claude")
|
|
25738
25884
|
});
|
|
25739
25885
|
const crew = new CrewService({
|
|
25740
25886
|
store: serviceStateOk ? await DiscussionStore.open(
|
|
@@ -25797,7 +25943,7 @@ async function create(env, opts = {}) {
|
|
|
25797
25943
|
const reservedPorts = () => [
|
|
25798
25944
|
...ownPort ? [ownPort] : [],
|
|
25799
25945
|
...sandbox.ports(),
|
|
25800
|
-
...firstmate.
|
|
25946
|
+
...firstmate.ports()
|
|
25801
25947
|
];
|
|
25802
25948
|
const forwards = new PreviewForwards({ env });
|
|
25803
25949
|
const mateTasks = new MateTasks({
|
|
@@ -25902,7 +26048,7 @@ function createSoundings(env, bell) {
|
|
|
25902
26048
|
probeFile: builtProbe(path.resolve(bundledPluginsDir(env), "..", "dist")),
|
|
25903
26049
|
scanHere: (opts) => probe(systemDeps({ nice: true }), opts),
|
|
25904
26050
|
// Loaded when a report is written: the preview helper reads the runtime itself.
|
|
25905
|
-
runHelper: async (...args) => (await import('./previewhelper2.js-
|
|
26051
|
+
runHelper: async (...args) => (await import('./previewhelper2.js-CawzBO7t.js')).runHelper(...args),
|
|
25906
26052
|
helperDeps: { env, run: runBounded, fetch, find: (name2) => which(name2, env.PATH) },
|
|
25907
26053
|
env
|
|
25908
26054
|
});
|
|
@@ -26293,12 +26439,12 @@ async function pluginIconFile(pluginId, contributionId) {
|
|
|
26293
26439
|
const r = await getRuntime();
|
|
26294
26440
|
return r.configured ? r.plugins.iconFile(pluginId, contributionId) : null;
|
|
26295
26441
|
}
|
|
26296
|
-
async function pluginService(q,
|
|
26442
|
+
async function pluginService(q, launch2 = false) {
|
|
26297
26443
|
const r = await getRuntime();
|
|
26298
26444
|
if (!r.configured) return null;
|
|
26299
|
-
return serviceView(r.plugins, r.services, q,
|
|
26445
|
+
return serviceView(r.plugins, r.services, q, launch2);
|
|
26300
26446
|
}
|
|
26301
|
-
async function serviceView(plugins, services, q,
|
|
26447
|
+
async function serviceView(plugins, services, q, launch2 = false) {
|
|
26302
26448
|
const found = await plugins.service(q.plugin, q.service, q.project);
|
|
26303
26449
|
if (!found) return null;
|
|
26304
26450
|
const base = { schema: "wheelhouse-service.v1", ...q, title: found.title };
|
|
@@ -26325,7 +26471,7 @@ async function serviceView(plugins, services, q, launch = false) {
|
|
|
26325
26471
|
};
|
|
26326
26472
|
}
|
|
26327
26473
|
const key = `${q.plugin}-${q.service}${q.project ? `-${q.project}` : ""}`;
|
|
26328
|
-
const status2 =
|
|
26474
|
+
const status2 = launch2 ? await services.launch(key, res.spec) : await services.status(key, res.spec);
|
|
26329
26475
|
const reason = res.spec.binds !== "loopback" && res.note ? res.note : status2.reason;
|
|
26330
26476
|
return { ...base, ...status2, reason, launchable: launchable(res.spec, status2), hint };
|
|
26331
26477
|
}
|
|
@@ -26526,5 +26672,5 @@ const runtime = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
26526
26672
|
withoutRemoteSecondMates
|
|
26527
26673
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
26528
26674
|
|
|
26529
|
-
export {
|
|
26530
|
-
//# sourceMappingURL=runtime.js-
|
|
26675
|
+
export { checkHerdr as $, AGENTS as A, BUILTIN_COMMANDS as B, currentPlugins as C, currentPluginPage as D, watchSettingsError as E, changePluginConfig as F, pluginIconFile as G, pluginUiFile as H, INPUT_MAX_BYTES as I, chooseRoleProvider as J, previewProber as K, MAX_FILE_BYTES$1 as L, MAX_CHAT_CALLS as M, PEEK_DEFAULT_LINES as N, pluginService as O, PROJECT_ID as P, setupRefuses as Q, RETENTION_DAYS as R, findFirstmateDir as S, looksLikeFirstmate as T, SETUP_SUGGESTIONS as U, detectPlatform as V, WATCH_PLUGIN as W, npmWritable as X, remedy as Y, resolveSessionBackend as Z, readSavedBackend as _, currentPullRequestTabs as a, HERDR_MIN_VERSION as a0, DEFAULT_HERDR_SESSION as a1, writeSavedBackend as a2, syncForServer as a3, writeRemembered as a4, reconnectRuntime as a5, checkTools as a6, stepsFor as a7, setupWorkDir as a8, currentChoice as a9, fixedHarness as aa, writeSavedChoice as ab, setupTerminals as ac, claudeStatus as ad, agentStatus as ae, installCommand as af, oneClickSteps as ag, testClaude as ah, testAgent as ai, VaultService as aj, bundledPluginsDir as ak, signInWithKey as al, checkCompatibility as am, currentSlots as an, GAPS as ao, TASK_ID$2 as ap, WORKTREE_GONE as aq, PEEK_MAX_LINES as ar, parseChange as as, MAX_VALUE_BYTES as at, currentDecisions as au, readDoc as av, parseProjectsRegistry as aw, currentTime as ax, runtime as ay, currentHostedPreviews as b, currentReviewSurface as c, currentAddressRewrites as d, currentCrew as e, currentInbox as f, getRuntime as g, currentHeadroom as h, currentHealth as i, currentFleet as j, currentRailInsights as k, loadSlots as l, currentPreviewPorts as m, currentMessages as n, unconfiguredHealth as o, currentFileRoots as p, unavailableFirstmate as q, readAsset as r, slashCommands as s, parseMateTaskId as t, unconfiguredFleet as u, validateSend as v, withoutRemoteSecondMates as w, REQUEST_ID$1 as x, isReactionId as y, titlesFor as z };
|
|
26676
|
+
//# sourceMappingURL=runtime.js-D7BWZr4r.js.map
|