@namzu/cli 35.0.0 → 36.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +764 -0
- package/README.md +160 -394
- package/assets/pal-blender-mcp.py +123 -0
- package/assets/pal-godot-mcp-pin.json +135 -0
- package/assets/pal-godot-mcp.cjs +418 -0
- package/dist/bin-main.d.ts +3 -0
- package/dist/bin-main.d.ts.map +1 -0
- package/dist/bin.d.ts +2 -1
- package/dist/bin.d.ts.map +1 -1
- package/dist/bin.js +85 -23
- package/dist/bin.js.map +6 -1
- package/dist/boot-narrative.d.ts +16 -0
- package/dist/boot-narrative.d.ts.map +1 -0
- package/dist/checkpoints/manifest.d.ts +107 -0
- package/dist/checkpoints/manifest.d.ts.map +1 -0
- package/dist/checkpoints/store.d.ts +280 -40
- package/dist/checkpoints/store.d.ts.map +1 -1
- package/dist/checkpoints/undo-plan.d.ts +83 -0
- package/dist/checkpoints/undo-plan.d.ts.map +1 -0
- package/dist/checkpoints/wrap.d.ts +4 -0
- package/dist/checkpoints/wrap.d.ts.map +1 -1
- package/dist/chunks/acp-5CWS2GLJ.js +13448 -0
- package/dist/chunks/acp-5CWS2GLJ.js.map +6 -0
- package/dist/chunks/activity-command-HK7YJTXV.js +262 -0
- package/dist/chunks/activity-command-HK7YJTXV.js.map +6 -0
- package/dist/chunks/add-ULH5DUNX.js +712 -0
- package/dist/chunks/add-ULH5DUNX.js.map +6 -0
- package/dist/chunks/agent-UEK2U3RE.js +87 -0
- package/dist/chunks/agent-UEK2U3RE.js.map +6 -0
- package/dist/chunks/agent-session-V7JRTODS.js +46 -0
- package/dist/chunks/agent-session-V7JRTODS.js.map +6 -0
- package/dist/chunks/archive-C4A3HPLF.js +84 -0
- package/dist/chunks/archive-C4A3HPLF.js.map +6 -0
- package/dist/chunks/bin-main-EEJHRDIC.js +126 -0
- package/dist/chunks/bin-main-EEJHRDIC.js.map +6 -0
- package/dist/chunks/browser-CRX4HM4C.js +31 -0
- package/dist/chunks/browser-CRX4HM4C.js.map +6 -0
- package/dist/chunks/chat-FVBATC4E.js +101 -0
- package/dist/chunks/chat-FVBATC4E.js.map +6 -0
- package/dist/chunks/chunk-2A37JQKY.js +1355 -0
- package/dist/chunks/chunk-2A37JQKY.js.map +6 -0
- package/dist/chunks/chunk-2NJ2XUXJ.js +283 -0
- package/dist/chunks/chunk-2NJ2XUXJ.js.map +6 -0
- package/dist/chunks/chunk-4HAE7PYX.js +74 -0
- package/dist/chunks/chunk-4HAE7PYX.js.map +6 -0
- package/dist/chunks/chunk-5GRV6P5C.js +69 -0
- package/dist/chunks/chunk-5GRV6P5C.js.map +6 -0
- package/dist/chunks/chunk-5PQVJBIO.js +168 -0
- package/dist/chunks/chunk-5PQVJBIO.js.map +6 -0
- package/dist/chunks/chunk-62I7HLAP.js +1142 -0
- package/dist/chunks/chunk-62I7HLAP.js.map +6 -0
- package/dist/chunks/chunk-63CGV3XY.js +161 -0
- package/dist/chunks/chunk-63CGV3XY.js.map +6 -0
- package/dist/chunks/chunk-6LLJQ3KY.js +225 -0
- package/dist/chunks/chunk-6LLJQ3KY.js.map +6 -0
- package/dist/chunks/chunk-6YG7D7U4.js +159 -0
- package/dist/chunks/chunk-6YG7D7U4.js.map +6 -0
- package/dist/chunks/chunk-76FLAFCG.js +51 -0
- package/dist/chunks/chunk-76FLAFCG.js.map +6 -0
- package/dist/chunks/chunk-7WJOQ6EA.js +106 -0
- package/dist/chunks/chunk-7WJOQ6EA.js.map +6 -0
- package/dist/chunks/chunk-A22MBIYU.js +42 -0
- package/dist/chunks/chunk-A22MBIYU.js.map +6 -0
- package/dist/chunks/chunk-A5DWGNGR.js +73 -0
- package/dist/chunks/chunk-A5DWGNGR.js.map +6 -0
- package/dist/chunks/chunk-A5UXODFL.js +76 -0
- package/dist/chunks/chunk-A5UXODFL.js.map +6 -0
- package/dist/chunks/chunk-AHIDYIRB.js +329 -0
- package/dist/chunks/chunk-AHIDYIRB.js.map +6 -0
- package/dist/chunks/chunk-AIY4PCDR.js +164 -0
- package/dist/chunks/chunk-AIY4PCDR.js.map +6 -0
- package/dist/chunks/chunk-AK2U3N2A.js +31 -0
- package/dist/chunks/chunk-AK2U3N2A.js.map +6 -0
- package/dist/chunks/chunk-AN7FO7NS.js +247 -0
- package/dist/chunks/chunk-AN7FO7NS.js.map +6 -0
- package/dist/chunks/chunk-AXIGFKJF.js +34 -0
- package/dist/chunks/chunk-AXIGFKJF.js.map +6 -0
- package/dist/chunks/chunk-C5WBEO3X.js +46 -0
- package/dist/chunks/chunk-C5WBEO3X.js.map +6 -0
- package/dist/chunks/chunk-C5XYHYMX.js +675 -0
- package/dist/chunks/chunk-C5XYHYMX.js.map +6 -0
- package/dist/chunks/chunk-CG65NUSJ.js +115 -0
- package/dist/chunks/chunk-CG65NUSJ.js.map +6 -0
- package/dist/chunks/chunk-CHIEVVQ2.js +32 -0
- package/dist/chunks/chunk-CHIEVVQ2.js.map +6 -0
- package/dist/chunks/chunk-E5VLANCO.js +101 -0
- package/dist/chunks/chunk-E5VLANCO.js.map +6 -0
- package/dist/chunks/chunk-EBOHVFOB.js +648 -0
- package/dist/chunks/chunk-EBOHVFOB.js.map +6 -0
- package/dist/chunks/chunk-EEDZOGV4.js +47 -0
- package/dist/chunks/chunk-EEDZOGV4.js.map +6 -0
- package/dist/chunks/chunk-EIYM6TY7.js +1479 -0
- package/dist/chunks/chunk-EIYM6TY7.js.map +6 -0
- package/dist/chunks/chunk-EWKJGHRO.js +82559 -0
- package/dist/chunks/chunk-EWKJGHRO.js.map +6 -0
- package/dist/chunks/chunk-EY7UNVER.js +311 -0
- package/dist/chunks/chunk-EY7UNVER.js.map +6 -0
- package/dist/chunks/chunk-FTMTO72X.js +95 -0
- package/dist/chunks/chunk-FTMTO72X.js.map +6 -0
- package/dist/chunks/chunk-FXS3AG6B.js +25326 -0
- package/dist/chunks/chunk-FXS3AG6B.js.map +6 -0
- package/dist/chunks/chunk-GIXSS6KW.js +2228 -0
- package/dist/chunks/chunk-GIXSS6KW.js.map +6 -0
- package/dist/chunks/chunk-GMCOZ3CU.js +245 -0
- package/dist/chunks/chunk-GMCOZ3CU.js.map +6 -0
- package/dist/chunks/chunk-GNBMKISG.js +19 -0
- package/dist/chunks/chunk-GNBMKISG.js.map +6 -0
- package/dist/chunks/chunk-GWQEMJFS.js +28 -0
- package/dist/chunks/chunk-GWQEMJFS.js.map +6 -0
- package/dist/chunks/chunk-H6B6AROX.js +151 -0
- package/dist/chunks/chunk-H6B6AROX.js.map +6 -0
- package/dist/chunks/chunk-HBBB2CAC.js +75 -0
- package/dist/chunks/chunk-HBBB2CAC.js.map +6 -0
- package/dist/chunks/chunk-HE7WUOX2.js +26 -0
- package/dist/chunks/chunk-HE7WUOX2.js.map +6 -0
- package/dist/chunks/chunk-HFJHHCTY.js +303 -0
- package/dist/chunks/chunk-HFJHHCTY.js.map +6 -0
- package/dist/chunks/chunk-HPMWYIBY.js +773 -0
- package/dist/chunks/chunk-HPMWYIBY.js.map +6 -0
- package/dist/chunks/chunk-HQM2WSQT.js +106 -0
- package/dist/chunks/chunk-HQM2WSQT.js.map +6 -0
- package/dist/chunks/chunk-ITZK4B66.js +787 -0
- package/dist/chunks/chunk-ITZK4B66.js.map +6 -0
- package/dist/chunks/chunk-J72CRUNX.js +154 -0
- package/dist/chunks/chunk-J72CRUNX.js.map +6 -0
- package/dist/chunks/chunk-JORONMD3.js +18 -0
- package/dist/chunks/chunk-JORONMD3.js.map +6 -0
- package/dist/chunks/chunk-JPPC4LJF.js +271 -0
- package/dist/chunks/chunk-JPPC4LJF.js.map +6 -0
- package/dist/chunks/chunk-JV3LONAU.js +76 -0
- package/dist/chunks/chunk-JV3LONAU.js.map +6 -0
- package/dist/chunks/chunk-K76WV7TN.js +71 -0
- package/dist/chunks/chunk-K76WV7TN.js.map +6 -0
- package/dist/chunks/chunk-KCWUQRZV.js +828 -0
- package/dist/chunks/chunk-KCWUQRZV.js.map +6 -0
- package/dist/chunks/chunk-KONYGNG6.js +7661 -0
- package/dist/chunks/chunk-KONYGNG6.js.map +6 -0
- package/dist/chunks/chunk-KU3W6IHV.js +109 -0
- package/dist/chunks/chunk-KU3W6IHV.js.map +6 -0
- package/dist/chunks/chunk-LQMHASKR.js +171 -0
- package/dist/chunks/chunk-LQMHASKR.js.map +6 -0
- package/dist/chunks/chunk-LXB3S4IC.js +19 -0
- package/dist/chunks/chunk-LXB3S4IC.js.map +6 -0
- package/dist/chunks/chunk-MZP6SH3M.js +3497 -0
- package/dist/chunks/chunk-MZP6SH3M.js.map +6 -0
- package/dist/chunks/chunk-N5IF64K3.js +1858 -0
- package/dist/chunks/chunk-N5IF64K3.js.map +6 -0
- package/dist/chunks/chunk-NADQQMMG.js +46 -0
- package/dist/chunks/chunk-NADQQMMG.js.map +6 -0
- package/dist/chunks/chunk-NQY5P2EB.js +20 -0
- package/dist/chunks/chunk-NQY5P2EB.js.map +6 -0
- package/dist/chunks/chunk-NUGPLXVK.js +228 -0
- package/dist/chunks/chunk-NUGPLXVK.js.map +6 -0
- package/dist/chunks/chunk-O7DBCVNY.js +110 -0
- package/dist/chunks/chunk-O7DBCVNY.js.map +6 -0
- package/dist/chunks/chunk-OEW7CJKK.js +140 -0
- package/dist/chunks/chunk-OEW7CJKK.js.map +6 -0
- package/dist/chunks/chunk-OH6TB27S.js +111 -0
- package/dist/chunks/chunk-OH6TB27S.js.map +6 -0
- package/dist/chunks/chunk-OLPOM3DR.js +127 -0
- package/dist/chunks/chunk-OLPOM3DR.js.map +6 -0
- package/dist/chunks/chunk-PYG7DZ2D.js +380 -0
- package/dist/chunks/chunk-PYG7DZ2D.js.map +6 -0
- package/dist/chunks/chunk-Q24K7536.js +661 -0
- package/dist/chunks/chunk-Q24K7536.js.map +6 -0
- package/dist/chunks/chunk-Q5YM2GCX.js +283 -0
- package/dist/chunks/chunk-Q5YM2GCX.js.map +6 -0
- package/dist/chunks/chunk-R7DCDBRN.js +106 -0
- package/dist/chunks/chunk-R7DCDBRN.js.map +6 -0
- package/dist/chunks/chunk-RC6X3ZY6.js +1439 -0
- package/dist/chunks/chunk-RC6X3ZY6.js.map +6 -0
- package/dist/chunks/chunk-SGS435PR.js +11111 -0
- package/dist/chunks/chunk-SGS435PR.js.map +6 -0
- package/dist/chunks/chunk-SKKWMMFP.js +474 -0
- package/dist/chunks/chunk-SKKWMMFP.js.map +6 -0
- package/dist/chunks/chunk-SRU3MDHZ.js +75 -0
- package/dist/chunks/chunk-SRU3MDHZ.js.map +6 -0
- package/dist/chunks/chunk-TBIX6JRE.js +24 -0
- package/dist/chunks/chunk-TBIX6JRE.js.map +6 -0
- package/dist/chunks/chunk-THNCQJ33.js +11265 -0
- package/dist/chunks/chunk-THNCQJ33.js.map +6 -0
- package/dist/chunks/chunk-THZXXVHM.js +2953 -0
- package/dist/chunks/chunk-THZXXVHM.js.map +6 -0
- package/dist/chunks/chunk-TIGWWAJI.js +765 -0
- package/dist/chunks/chunk-TIGWWAJI.js.map +6 -0
- package/dist/chunks/chunk-UDBEU2FR.js +97 -0
- package/dist/chunks/chunk-UDBEU2FR.js.map +6 -0
- package/dist/chunks/chunk-UOOQPODR.js +257 -0
- package/dist/chunks/chunk-UOOQPODR.js.map +6 -0
- package/dist/chunks/chunk-US5ZFPAU.js +400 -0
- package/dist/chunks/chunk-US5ZFPAU.js.map +6 -0
- package/dist/chunks/chunk-UWWGSDZ5.js +134 -0
- package/dist/chunks/chunk-UWWGSDZ5.js.map +6 -0
- package/dist/chunks/chunk-UXVYJWN5.js +1373 -0
- package/dist/chunks/chunk-UXVYJWN5.js.map +6 -0
- package/dist/chunks/chunk-V7TQR6AR.js +818 -0
- package/dist/chunks/chunk-V7TQR6AR.js.map +6 -0
- package/dist/chunks/chunk-VRL2WNQN.js +7534 -0
- package/dist/chunks/chunk-VRL2WNQN.js.map +6 -0
- package/dist/chunks/chunk-WATMFOHB.js +319 -0
- package/dist/chunks/chunk-WATMFOHB.js.map +6 -0
- package/dist/chunks/chunk-WHODOMXA.js +132 -0
- package/dist/chunks/chunk-WHODOMXA.js.map +6 -0
- package/dist/chunks/chunk-WM2JEUGV.js +207 -0
- package/dist/chunks/chunk-WM2JEUGV.js.map +6 -0
- package/dist/chunks/chunk-XEUQN4JC.js +54 -0
- package/dist/chunks/chunk-XEUQN4JC.js.map +6 -0
- package/dist/chunks/chunk-XHOD3RDN.js +517 -0
- package/dist/chunks/chunk-XHOD3RDN.js.map +6 -0
- package/dist/chunks/chunk-Y7B67G22.js +26 -0
- package/dist/chunks/chunk-Y7B67G22.js.map +6 -0
- package/dist/chunks/chunk-ZKEWE6K4.js +399 -0
- package/dist/chunks/chunk-ZKEWE6K4.js.map +6 -0
- package/dist/chunks/chunk-ZPR4IMRT.js +36 -0
- package/dist/chunks/chunk-ZPR4IMRT.js.map +6 -0
- package/dist/chunks/chunk-ZWA2JRJV.js +45 -0
- package/dist/chunks/chunk-ZWA2JRJV.js.map +6 -0
- package/dist/chunks/cli-runtime-7YAOEJGS.js +129 -0
- package/dist/chunks/cli-runtime-7YAOEJGS.js.map +6 -0
- package/dist/chunks/commands-QPVRB3RK.js +21 -0
- package/dist/chunks/commands-QPVRB3RK.js.map +6 -0
- package/dist/chunks/computer-GXDY4H35.js +493 -0
- package/dist/chunks/computer-GXDY4H35.js.map +6 -0
- package/dist/chunks/crash-report-S3BTEPYR.js +21 -0
- package/dist/chunks/crash-report-S3BTEPYR.js.map +6 -0
- package/dist/chunks/devtools-LBE4PAQN.js +3851 -0
- package/dist/chunks/devtools-LBE4PAQN.js.map +6 -0
- package/dist/chunks/dist-3GJFRS2X.js +520 -0
- package/dist/chunks/dist-3GJFRS2X.js.map +6 -0
- package/dist/chunks/dist-BFC7XUCT.js +555 -0
- package/dist/chunks/dist-BFC7XUCT.js.map +6 -0
- package/dist/chunks/dist-ERN5DRKK.js +1415 -0
- package/dist/chunks/dist-ERN5DRKK.js.map +6 -0
- package/dist/chunks/dist-EY3OJBQH.js +1339 -0
- package/dist/chunks/dist-EY3OJBQH.js.map +6 -0
- package/dist/chunks/dist-G42HPNIE.js +514 -0
- package/dist/chunks/dist-G42HPNIE.js.map +6 -0
- package/dist/chunks/dist-SKRHHPUR.js +1018 -0
- package/dist/chunks/dist-SKRHHPUR.js.map +6 -0
- package/dist/chunks/dist-Z47L7ZAJ.js +40654 -0
- package/dist/chunks/dist-Z47L7ZAJ.js.map +6 -0
- package/dist/chunks/doctor-IE3PLXZK.js +28 -0
- package/dist/chunks/doctor-IE3PLXZK.js.map +6 -0
- package/dist/chunks/drain-ESXUKOE6.js +471 -0
- package/dist/chunks/drain-ESXUKOE6.js.map +6 -0
- package/dist/chunks/endpoint-M2DDENPP.js +15 -0
- package/dist/chunks/endpoint-M2DDENPP.js.map +6 -0
- package/dist/chunks/eval-53UONRWR.js +187 -0
- package/dist/chunks/eval-53UONRWR.js.map +6 -0
- package/dist/chunks/exec-COV235L5.js +1284 -0
- package/dist/chunks/exec-COV235L5.js.map +6 -0
- package/dist/chunks/home-QS7RBP34.js +16 -0
- package/dist/chunks/home-QS7RBP34.js.map +6 -0
- package/dist/chunks/host-queries-LDEBHKBX.js +152 -0
- package/dist/chunks/host-queries-LDEBHKBX.js.map +6 -0
- package/dist/chunks/lib-KXZZJJG2.js +2657 -0
- package/dist/chunks/lib-KXZZJJG2.js.map +6 -0
- package/dist/chunks/lifecycle-6NF6NJNV.js +63 -0
- package/dist/chunks/lifecycle-6NF6NJNV.js.map +6 -0
- package/dist/chunks/list-DQZU7NEF.js +293 -0
- package/dist/chunks/list-DQZU7NEF.js.map +6 -0
- package/dist/chunks/login-IQGNP5XY.js +29 -0
- package/dist/chunks/login-IQGNP5XY.js.map +6 -0
- package/dist/chunks/logs-KSG7SFAB.js +116 -0
- package/dist/chunks/logs-KSG7SFAB.js.map +6 -0
- package/dist/chunks/mcp-WFXKXGNM.js +763 -0
- package/dist/chunks/mcp-WFXKXGNM.js.map +6 -0
- package/dist/chunks/message-command-O7ZH4I4C.js +170 -0
- package/dist/chunks/message-command-O7ZH4I4C.js.map +6 -0
- package/dist/chunks/node-QB2FA2ZB.js +916 -0
- package/dist/chunks/node-QB2FA2ZB.js.map +6 -0
- package/dist/chunks/operator-tools-LTPV3CH5.js +115 -0
- package/dist/chunks/operator-tools-LTPV3CH5.js.map +6 -0
- package/dist/chunks/output-schema-UM3P5AOR.js +11 -0
- package/dist/chunks/output-schema-UM3P5AOR.js.map +6 -0
- package/dist/chunks/pal-GBYJHBP3.js +200 -0
- package/dist/chunks/pal-GBYJHBP3.js.map +6 -0
- package/dist/chunks/paths-DXYFKIJU.js +10 -0
- package/dist/chunks/paths-DXYFKIJU.js.map +6 -0
- package/dist/chunks/pica-WNHDDIFX.js +1736 -0
- package/dist/chunks/pica-WNHDDIFX.js.map +6 -0
- package/dist/chunks/providers-J42J2PDA.js +160 -0
- package/dist/chunks/providers-J42J2PDA.js.map +6 -0
- package/dist/chunks/resident-7D6IM5LP.js +1314 -0
- package/dist/chunks/resident-7D6IM5LP.js.map +6 -0
- package/dist/chunks/resume-command-XZWGUXRK.js +22 -0
- package/dist/chunks/resume-command-XZWGUXRK.js.map +6 -0
- package/dist/chunks/schedule-JLIOF3MS.js +143 -0
- package/dist/chunks/schedule-JLIOF3MS.js.map +6 -0
- package/dist/chunks/serve-S7UWNIR3.js +21 -0
- package/dist/chunks/serve-S7UWNIR3.js.map +6 -0
- package/dist/chunks/service-YBU5VTKQ.js +1633 -0
- package/dist/chunks/service-YBU5VTKQ.js.map +6 -0
- package/dist/chunks/session-step-2HJSIJNN.js +26 -0
- package/dist/chunks/session-step-2HJSIJNN.js.map +6 -0
- package/dist/chunks/skills-HV2MOBEW.js +282 -0
- package/dist/chunks/skills-HV2MOBEW.js.map +6 -0
- package/dist/chunks/state-6HV3D3O4.js +717 -0
- package/dist/chunks/state-6HV3D3O4.js.map +6 -0
- package/dist/chunks/store-6J2MUGON.js +82 -0
- package/dist/chunks/store-6J2MUGON.js.map +6 -0
- package/dist/chunks/store-GDP2EW27.js +34 -0
- package/dist/chunks/store-GDP2EW27.js.map +6 -0
- package/dist/chunks/store-VXNKMMNW.js +42 -0
- package/dist/chunks/store-VXNKMMNW.js.map +6 -0
- package/dist/chunks/tui-DDWX2WYH.js +56903 -0
- package/dist/chunks/tui-DDWX2WYH.js.map +6 -0
- package/dist/chunks/upgrade-MC5JB7DK.js +315 -0
- package/dist/chunks/upgrade-MC5JB7DK.js.map +6 -0
- package/dist/chunks/webapi-6HUHZUAH.js +2715 -0
- package/dist/chunks/webapi-6HUHZUAH.js.map +6 -0
- package/dist/chunks/worktree-6YPRX6SU.js +116 -0
- package/dist/chunks/worktree-6YPRX6SU.js.map +6 -0
- package/dist/cli-runtime.d.ts +19 -0
- package/dist/cli-runtime.d.ts.map +1 -0
- package/dist/cli.d.ts +0 -15
- package/dist/cli.d.ts.map +1 -1
- package/dist/commands/acp-harness.d.ts +64 -0
- package/dist/commands/acp-harness.d.ts.map +1 -0
- package/dist/commands/acp-provider-retry.d.ts +27 -0
- package/dist/commands/acp-provider-retry.d.ts.map +1 -0
- package/dist/commands/acp.d.ts +134 -3
- package/dist/commands/acp.d.ts.map +1 -1
- package/dist/commands/computer.d.ts +3 -0
- package/dist/commands/computer.d.ts.map +1 -0
- package/dist/commands/desktop-host-changes.d.ts +65 -0
- package/dist/commands/desktop-host-changes.d.ts.map +1 -0
- package/dist/commands/desktop-host-header.d.ts +30 -0
- package/dist/commands/desktop-host-header.d.ts.map +1 -0
- package/dist/commands/desktop-host.d.ts +354 -0
- package/dist/commands/desktop-host.d.ts.map +1 -0
- package/dist/commands/desktop-model-catalogue.d.ts +25 -0
- package/dist/commands/desktop-model-catalogue.d.ts.map +1 -0
- package/dist/commands/effort-levels.d.ts +3 -0
- package/dist/commands/effort-levels.d.ts.map +1 -0
- package/dist/commands/exec-flags.d.ts +4 -0
- package/dist/commands/exec-flags.d.ts.map +1 -1
- package/dist/commands/exec.d.ts.map +1 -1
- package/dist/commands/lazy.d.ts +20 -0
- package/dist/commands/lazy.d.ts.map +1 -0
- package/dist/commands/manifest.d.ts +33 -0
- package/dist/commands/manifest.d.ts.map +1 -0
- package/dist/commands/pal.d.ts +5 -0
- package/dist/commands/pal.d.ts.map +1 -0
- package/dist/commands/permission-preview.d.ts +38 -0
- package/dist/commands/permission-preview.d.ts.map +1 -0
- package/dist/commands/registry.d.ts +10 -0
- package/dist/commands/registry.d.ts.map +1 -1
- package/dist/commands/serve.d.ts +1 -12
- package/dist/commands/serve.d.ts.map +1 -1
- package/dist/commands/stdin.d.ts.map +1 -1
- package/dist/commands/upgrade.d.ts +14 -0
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/compile-cache-enable.d.ts +2 -0
- package/dist/compile-cache-enable.d.ts.map +1 -0
- package/dist/compile-cache.d.ts +53 -0
- package/dist/compile-cache.d.ts.map +1 -0
- package/dist/computer/bundle.d.ts +18 -0
- package/dist/computer/bundle.d.ts.map +1 -0
- package/dist/computer/run.d.ts +26 -0
- package/dist/computer/run.d.ts.map +1 -0
- package/dist/computer/sentences.d.ts +30 -0
- package/dist/computer/sentences.d.ts.map +1 -0
- package/dist/config/load.d.ts +10 -1
- package/dist/config/load.d.ts.map +1 -1
- package/dist/context/capabilities.d.ts +25 -2
- package/dist/context/capabilities.d.ts.map +1 -1
- package/dist/context/runtime-message.d.ts.map +1 -1
- package/dist/crash-report.d.ts +22 -0
- package/dist/crash-report.d.ts.map +1 -0
- package/dist/debug-requested.d.ts +7 -0
- package/dist/debug-requested.d.ts.map +1 -0
- package/dist/doctor/checks/credentials.d.ts.map +1 -1
- package/dist/exit-codes.d.ts +9 -1
- package/dist/exit-codes.d.ts.map +1 -1
- package/dist/index.js +105 -17
- package/dist/index.js.map +6 -1
- package/dist/integrations/harness/claude-adapter.d.ts +20 -0
- package/dist/integrations/harness/claude-adapter.d.ts.map +1 -0
- package/dist/integrations/harness/claude-protocol.d.ts +67 -0
- package/dist/integrations/harness/claude-protocol.d.ts.map +1 -0
- package/dist/integrations/harness/codex-adapter.d.ts +80 -0
- package/dist/integrations/harness/codex-adapter.d.ts.map +1 -0
- package/dist/integrations/harness/codex-protocol.d.ts +22 -0
- package/dist/integrations/harness/codex-protocol.d.ts.map +1 -0
- package/dist/integrations/harness/model-cache.d.ts +16 -0
- package/dist/integrations/harness/model-cache.d.ts.map +1 -0
- package/dist/integrations/harness/native-executable.d.ts +8 -0
- package/dist/integrations/harness/native-executable.d.ts.map +1 -0
- package/dist/integrations/harness/process.d.ts +25 -0
- package/dist/integrations/harness/process.d.ts.map +1 -0
- package/dist/integrations/peers/runtime.d.ts +64 -0
- package/dist/integrations/peers/runtime.d.ts.map +1 -0
- package/dist/integrations/plugins/inventory.d.ts +27 -0
- package/dist/integrations/plugins/inventory.d.ts.map +1 -0
- package/dist/integrations/providers/composer-settings.d.ts +33 -0
- package/dist/integrations/providers/composer-settings.d.ts.map +1 -0
- package/dist/integrations/providers/connections.d.ts +37 -0
- package/dist/integrations/providers/connections.d.ts.map +1 -0
- package/dist/integrations/providers/credential-store.d.ts +35 -0
- package/dist/integrations/providers/credential-store.d.ts.map +1 -1
- package/dist/integrations/providers/discover.d.ts +27 -1
- package/dist/integrations/providers/discover.d.ts.map +1 -1
- package/dist/integrations/providers/index.d.ts +2 -2
- package/dist/integrations/providers/index.d.ts.map +1 -1
- package/dist/integrations/providers/picker-operation.d.ts +6 -0
- package/dist/integrations/providers/picker-operation.d.ts.map +1 -0
- package/dist/integrations/providers/setup.d.ts +16 -1
- package/dist/integrations/providers/setup.d.ts.map +1 -1
- package/dist/integrations/resident/runner-worker.js +190 -161
- package/dist/integrations/resident/runner-worker.js.map +6 -1
- package/dist/integrations/sessions/display-title.d.ts +8 -0
- package/dist/integrations/sessions/display-title.d.ts.map +1 -1
- package/dist/integrations/sessions/store.d.ts +23 -9
- package/dist/integrations/sessions/store.d.ts.map +1 -1
- package/dist/integrations/sessions/task-context.d.ts +1 -1
- package/dist/integrations/sessions/task-context.d.ts.map +1 -1
- package/dist/integrations/sessions/transcript-export.d.ts.map +1 -1
- package/dist/integrations/subagents/activity.d.ts +9 -6
- package/dist/integrations/subagents/activity.d.ts.map +1 -1
- package/dist/integrations/subagents/operator-journal.d.ts +20 -0
- package/dist/integrations/subagents/operator-journal.d.ts.map +1 -0
- package/dist/integrations/subagents/runtime.d.ts +11 -0
- package/dist/integrations/subagents/runtime.d.ts.map +1 -1
- package/dist/integrations/trust/store.d.ts +14 -0
- package/dist/integrations/trust/store.d.ts.map +1 -1
- package/dist/integrations/web/search.d.ts +1 -1
- package/dist/pals/actions.d.ts +57 -0
- package/dist/pals/actions.d.ts.map +1 -0
- package/dist/pals/activity-command.d.ts +3 -0
- package/dist/pals/activity-command.d.ts.map +1 -0
- package/dist/pals/activity.d.ts +18 -0
- package/dist/pals/activity.d.ts.map +1 -0
- package/dist/pals/agent-session.d.ts +19 -0
- package/dist/pals/agent-session.d.ts.map +1 -0
- package/dist/pals/channel-actions.d.ts +5 -0
- package/dist/pals/channel-actions.d.ts.map +1 -0
- package/dist/pals/channel-local.d.ts +7 -0
- package/dist/pals/channel-local.d.ts.map +1 -0
- package/dist/pals/channel.d.ts +20 -0
- package/dist/pals/channel.d.ts.map +1 -0
- package/dist/pals/chat.d.ts +6 -0
- package/dist/pals/chat.d.ts.map +1 -0
- package/dist/pals/communication.d.ts +47 -0
- package/dist/pals/communication.d.ts.map +1 -0
- package/dist/pals/conversations.d.ts +26 -0
- package/dist/pals/conversations.d.ts.map +1 -0
- package/dist/pals/desktop-communication.d.ts +111 -0
- package/dist/pals/desktop-communication.d.ts.map +1 -0
- package/dist/pals/dispatch.d.ts +13 -0
- package/dist/pals/dispatch.d.ts.map +1 -0
- package/dist/pals/environment.d.ts +103 -0
- package/dist/pals/environment.d.ts.map +1 -0
- package/dist/pals/guest-mcp-transport.d.ts +28 -0
- package/dist/pals/guest-mcp-transport.d.ts.map +1 -0
- package/dist/pals/guest-mcp.d.ts +22 -0
- package/dist/pals/guest-mcp.d.ts.map +1 -0
- package/dist/pals/inbox-start.d.ts +35 -0
- package/dist/pals/inbox-start.d.ts.map +1 -0
- package/dist/pals/message-command.d.ts +3 -0
- package/dist/pals/message-command.d.ts.map +1 -0
- package/dist/pals/operator-tools.d.ts +23 -0
- package/dist/pals/operator-tools.d.ts.map +1 -0
- package/dist/pals/public-transcript.d.ts +4 -0
- package/dist/pals/public-transcript.d.ts.map +1 -0
- package/dist/pals/review.d.ts +16 -0
- package/dist/pals/review.d.ts.map +1 -0
- package/dist/pals/store.d.ts +16 -0
- package/dist/pals/store.d.ts.map +1 -0
- package/dist/pals/tui-session.d.ts +11 -0
- package/dist/pals/tui-session.d.ts.map +1 -0
- package/dist/permissions/mode-names.d.ts +2 -0
- package/dist/permissions/mode-names.d.ts.map +1 -0
- package/dist/resume-invocation.d.ts +1 -1
- package/dist/resume-invocation.d.ts.map +1 -1
- package/dist/resume-shell.d.ts +8 -0
- package/dist/resume-shell.d.ts.map +1 -0
- package/dist/schedule/build.d.ts +12 -3
- package/dist/schedule/build.d.ts.map +1 -1
- package/dist/schedule/commands/add.d.ts +1 -1
- package/dist/schedule/commands/add.d.ts.map +1 -1
- package/dist/schedule/commands/lifecycle.d.ts.map +1 -1
- package/dist/schedule/commands/list.d.ts +3 -1
- package/dist/schedule/commands/list.d.ts.map +1 -1
- package/dist/schedule/daemon/daemon.d.ts +2 -0
- package/dist/schedule/daemon/daemon.d.ts.map +1 -1
- package/dist/schedule/delivery.d.ts +66 -0
- package/dist/schedule/delivery.d.ts.map +1 -0
- package/dist/schedule/fire/fire.d.ts +1 -1
- package/dist/schedule/fire/fire.d.ts.map +1 -1
- package/dist/schedule/fire/run-script.d.ts +2 -2
- package/dist/schedule/fire/run-script.d.ts.map +1 -1
- package/dist/schedule/fire/script-report.d.ts +31 -0
- package/dist/schedule/fire/script-report.d.ts.map +1 -0
- package/dist/schedule/floor.d.ts +1 -1
- package/dist/schedule/floor.d.ts.map +1 -1
- package/dist/schedule/folder.d.ts +6 -0
- package/dist/schedule/folder.d.ts.map +1 -1
- package/dist/schedule/resume-command.d.ts +3 -3
- package/dist/schedule/resume-command.d.ts.map +1 -1
- package/dist/schedule/store/history.d.ts.map +1 -1
- package/dist/schedule/store/jobs.d.ts +6 -6
- package/dist/schedule/store/jobs.d.ts.map +1 -1
- package/dist/schedule/store/script-state.d.ts +31 -0
- package/dist/schedule/store/script-state.d.ts.map +1 -0
- package/dist/schedule/store/state.d.ts +4 -2
- package/dist/schedule/store/state.d.ts.map +1 -1
- package/dist/schedule/types.d.ts +61 -16
- package/dist/schedule/types.d.ts.map +1 -1
- package/dist/skills/store.d.ts.map +1 -1
- package/dist/terminal/host.d.ts +22 -0
- package/dist/terminal/host.d.ts.map +1 -0
- package/dist/terminal/manager.d.ts +124 -0
- package/dist/terminal/manager.d.ts.map +1 -0
- package/dist/terminal/protocol.d.ts +162 -0
- package/dist/terminal/protocol.d.ts.map +1 -0
- package/dist/terminal/pty.d.ts +85 -0
- package/dist/terminal/pty.d.ts.map +1 -0
- package/dist/terminal/ring.d.ts +23 -0
- package/dist/terminal/ring.d.ts.map +1 -0
- package/dist/terminal/screen.d.ts +31 -0
- package/dist/terminal/screen.d.ts.map +1 -0
- package/dist/termination-state.d.ts +19 -0
- package/dist/termination-state.d.ts.map +1 -0
- package/dist/termination.d.ts +2 -9
- package/dist/termination.d.ts.map +1 -1
- package/dist/tui/AgentExplorer.d.ts +4 -1
- package/dist/tui/AgentExplorer.d.ts.map +1 -1
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/BackgroundJobsPanel.d.ts.map +1 -1
- package/dist/tui/BrandHeader.d.ts.map +1 -1
- package/dist/tui/ChildComposer.d.ts +22 -0
- package/dist/tui/ChildComposer.d.ts.map +1 -0
- package/dist/tui/ChoicePicker.d.ts.map +1 -1
- package/dist/tui/Composer.d.ts +21 -3
- package/dist/tui/Composer.d.ts.map +1 -1
- package/dist/tui/ComposerFrame.d.ts.map +1 -1
- package/dist/tui/CopyPicker.d.ts.map +1 -1
- package/dist/tui/EditPromptPicker.d.ts.map +1 -1
- package/dist/tui/EffortSlider.d.ts.map +1 -1
- package/dist/tui/LiveActivity.d.ts +7 -1
- package/dist/tui/LiveActivity.d.ts.map +1 -1
- package/dist/tui/Markdown.d.ts.map +1 -1
- package/dist/tui/PendingInputPanel.d.ts.map +1 -1
- package/dist/tui/PermissionOverlay.d.ts.map +1 -1
- package/dist/tui/Picker.d.ts.map +1 -1
- package/dist/tui/ProviderSetup.d.ts.map +1 -1
- package/dist/tui/ResumePicker.d.ts.map +1 -1
- package/dist/tui/SaveSkillOverlay.d.ts.map +1 -1
- package/dist/tui/ScheduleReviewOverlay.d.ts +1 -1
- package/dist/tui/ScheduleReviewOverlay.d.ts.map +1 -1
- package/dist/tui/StatusBar.d.ts +7 -1
- package/dist/tui/StatusBar.d.ts.map +1 -1
- package/dist/tui/StatusPanel.d.ts.map +1 -1
- package/dist/tui/TextPrompt.d.ts.map +1 -1
- package/dist/tui/ToolOutputViewer.d.ts.map +1 -1
- package/dist/tui/Transcript.d.ts +3 -0
- package/dist/tui/Transcript.d.ts.map +1 -1
- package/dist/tui/TranscriptScrollView.d.ts +23 -0
- package/dist/tui/TranscriptScrollView.d.ts.map +1 -0
- package/dist/tui/TrustPrompt.d.ts +8 -0
- package/dist/tui/TrustPrompt.d.ts.map +1 -1
- package/dist/tui/agent.d.ts +125 -3
- package/dist/tui/agent.d.ts.map +1 -1
- package/dist/tui/browser-notices.d.ts.map +1 -1
- package/dist/tui/capability-notice.d.ts +38 -0
- package/dist/tui/capability-notice.d.ts.map +1 -0
- package/dist/tui/console-input.d.ts +31 -0
- package/dist/tui/console-input.d.ts.map +1 -0
- package/dist/tui/conversation-evidence-view.d.ts.map +1 -1
- package/dist/tui/credential-entry.d.ts.map +1 -1
- package/dist/tui/exit-summary.d.ts +9 -1
- package/dist/tui/exit-summary.d.ts.map +1 -1
- package/dist/tui/external-editor.d.ts.map +1 -1
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/key-hints.d.ts +51 -0
- package/dist/tui/key-hints.d.ts.map +1 -0
- package/dist/tui/launch-settings.d.ts +34 -0
- package/dist/tui/launch-settings.d.ts.map +1 -0
- package/dist/tui/log-pane.d.ts.map +1 -1
- package/dist/tui/model-choices.d.ts +39 -1
- package/dist/tui/model-choices.d.ts.map +1 -1
- package/dist/tui/model-search.d.ts +4 -1
- package/dist/tui/model-search.d.ts.map +1 -1
- package/dist/tui/output-size-watch.d.ts +32 -0
- package/dist/tui/output-size-watch.d.ts.map +1 -0
- package/dist/tui/permission-review.d.ts.map +1 -1
- package/dist/tui/person-terms.d.ts +58 -0
- package/dist/tui/person-terms.d.ts.map +1 -0
- package/dist/tui/plain-failure.d.ts +27 -0
- package/dist/tui/plain-failure.d.ts.map +1 -0
- package/dist/tui/plain-interruption.d.ts +46 -0
- package/dist/tui/plain-interruption.d.ts.map +1 -0
- package/dist/tui/provider-list.d.ts.map +1 -1
- package/dist/tui/render-mode.d.ts +19 -0
- package/dist/tui/render-mode.d.ts.map +1 -0
- package/dist/tui/schedule/host-commands.d.ts +2 -9
- package/dist/tui/schedule/host-commands.d.ts.map +1 -1
- package/dist/tui/schedule/integration.d.ts +8 -0
- package/dist/tui/schedule/integration.d.ts.map +1 -1
- package/dist/tui/schedule/source-deliveries.d.ts +37 -0
- package/dist/tui/schedule/source-deliveries.d.ts.map +1 -0
- package/dist/tui/schedule/startup.d.ts.map +1 -1
- package/dist/tui/schedule/tool-host.d.ts +3 -1
- package/dist/tui/schedule/tool-host.d.ts.map +1 -1
- package/dist/tui/setup-text.d.ts +14 -0
- package/dist/tui/setup-text.d.ts.map +1 -0
- package/dist/tui/shell-escape.d.ts.map +1 -1
- package/dist/tui/skills/suggest-setting.d.ts.map +1 -1
- package/dist/tui/slashCommands.d.ts +4 -1
- package/dist/tui/slashCommands.d.ts.map +1 -1
- package/dist/tui/terminal-choice-text.d.ts +7 -0
- package/dist/tui/terminal-choice-text.d.ts.map +1 -1
- package/dist/tui/tidy-tool-output.d.ts +83 -0
- package/dist/tui/tidy-tool-output.d.ts.map +1 -0
- package/dist/tui/tool-presentation.d.ts +6 -0
- package/dist/tui/tool-presentation.d.ts.map +1 -0
- package/dist/tui/transcript-scroll.d.ts +73 -0
- package/dist/tui/transcript-scroll.d.ts.map +1 -0
- package/dist/tui/triggers/copy.d.ts.map +1 -1
- package/dist/tui/triggers/setting.d.ts.map +1 -1
- package/dist/tui/turn-interruption.d.ts +1 -1
- package/dist/tui/turn-interruption.d.ts.map +1 -1
- package/dist/tui/turn-limits-settings.d.ts +4 -4
- package/dist/tui/turn-limits-settings.d.ts.map +1 -1
- package/dist/tui/types.d.ts +10 -0
- package/dist/tui/types.d.ts.map +1 -1
- package/dist/tui/web-activity.d.ts +3 -2
- package/dist/tui/web-activity.d.ts.map +1 -1
- package/dist/tui/zen-free-refusal.d.ts +17 -0
- package/dist/tui/zen-free-refusal.d.ts.map +1 -0
- package/dist/usage-error.d.ts +15 -0
- package/dist/usage-error.d.ts.map +1 -0
- package/dist/warning-filter.d.ts +30 -0
- package/dist/warning-filter.d.ts.map +1 -0
- package/package.json +21 -10
- package/skills/schedule-task/SKILL.md +74 -20
- package/dist/browser/commands.js +0 -365
- package/dist/browser/commands.js.map +0 -1
- package/dist/browser/control.js +0 -140
- package/dist/browser/control.js.map +0 -1
- package/dist/browser/describe.js +0 -27
- package/dist/browser/describe.js.map +0 -1
- package/dist/checkpoints/store.js +0 -192
- package/dist/checkpoints/store.js.map +0 -1
- package/dist/checkpoints/wrap.js +0 -37
- package/dist/checkpoints/wrap.js.map +0 -1
- package/dist/cli.js +0 -602
- package/dist/cli.js.map +0 -1
- package/dist/commands/acp.js +0 -388
- package/dist/commands/acp.js.map +0 -1
- package/dist/commands/archive.js +0 -65
- package/dist/commands/archive.js.map +0 -1
- package/dist/commands/browser.js +0 -16
- package/dist/commands/browser.js.map +0 -1
- package/dist/commands/doctor.js +0 -267
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/drain.js +0 -498
- package/dist/commands/drain.js.map +0 -1
- package/dist/commands/eval.js +0 -237
- package/dist/commands/eval.js.map +0 -1
- package/dist/commands/exec-flags.js +0 -334
- package/dist/commands/exec-flags.js.map +0 -1
- package/dist/commands/exec-json.js +0 -497
- package/dist/commands/exec-json.js.map +0 -1
- package/dist/commands/exec.js +0 -688
- package/dist/commands/exec.js.map +0 -1
- package/dist/commands/host-queries.js +0 -156
- package/dist/commands/host-queries.js.map +0 -1
- package/dist/commands/login.js +0 -315
- package/dist/commands/login.js.map +0 -1
- package/dist/commands/mcp-oauth-login.js +0 -213
- package/dist/commands/mcp-oauth-login.js.map +0 -1
- package/dist/commands/mcp.js +0 -461
- package/dist/commands/mcp.js.map +0 -1
- package/dist/commands/prior-messages.js +0 -329
- package/dist/commands/prior-messages.js.map +0 -1
- package/dist/commands/provider-wait.js +0 -65
- package/dist/commands/provider-wait.js.map +0 -1
- package/dist/commands/registry.js +0 -40
- package/dist/commands/registry.js.map +0 -1
- package/dist/commands/resident-flags.js +0 -193
- package/dist/commands/resident-flags.js.map +0 -1
- package/dist/commands/resident-learning.js +0 -293
- package/dist/commands/resident-learning.js.map +0 -1
- package/dist/commands/resident.js +0 -419
- package/dist/commands/resident.js.map +0 -1
- package/dist/commands/resume.js +0 -109
- package/dist/commands/resume.js.map +0 -1
- package/dist/commands/schedule.js +0 -131
- package/dist/commands/schedule.js.map +0 -1
- package/dist/commands/serve.js +0 -21
- package/dist/commands/serve.js.map +0 -1
- package/dist/commands/skills.js +0 -178
- package/dist/commands/skills.js.map +0 -1
- package/dist/commands/state.js +0 -110
- package/dist/commands/state.js.map +0 -1
- package/dist/commands/stdin.js +0 -69
- package/dist/commands/stdin.js.map +0 -1
- package/dist/commands/types.js +0 -2
- package/dist/commands/types.js.map +0 -1
- package/dist/commands/upgrade-progress.js +0 -54
- package/dist/commands/upgrade-progress.js.map +0 -1
- package/dist/commands/upgrade.js +0 -232
- package/dist/commands/upgrade.js.map +0 -1
- package/dist/commands/worktree.js +0 -86
- package/dist/commands/worktree.js.map +0 -1
- package/dist/config/composer-triggers.js +0 -80
- package/dist/config/composer-triggers.js.map +0 -1
- package/dist/config/debug.js +0 -126
- package/dist/config/debug.js.map +0 -1
- package/dist/config/load.js +0 -1208
- package/dist/config/load.js.map +0 -1
- package/dist/config/schema.js +0 -13
- package/dist/config/schema.js.map +0 -1
- package/dist/config/tool-result-screens.js +0 -104
- package/dist/config/tool-result-screens.js.map +0 -1
- package/dist/config/trusted-project-context.js +0 -28
- package/dist/config/trusted-project-context.js.map +0 -1
- package/dist/config/turn-guards.js +0 -46
- package/dist/config/turn-guards.js.map +0 -1
- package/dist/config/user-config.js +0 -118
- package/dist/config/user-config.js.map +0 -1
- package/dist/context/capabilities.js +0 -164
- package/dist/context/capabilities.js.map +0 -1
- package/dist/context/directories.js +0 -69
- package/dist/context/directories.js.map +0 -1
- package/dist/context/doctrine.js +0 -24
- package/dist/context/doctrine.js.map +0 -1
- package/dist/context/environment.js +0 -255
- package/dist/context/environment.js.map +0 -1
- package/dist/context/project-path.js +0 -16
- package/dist/context/project-path.js.map +0 -1
- package/dist/context/project-tracker.js +0 -217
- package/dist/context/project-tracker.js.map +0 -1
- package/dist/context/project.js +0 -256
- package/dist/context/project.js.map +0 -1
- package/dist/context/runtime-message.js +0 -30
- package/dist/context/runtime-message.js.map +0 -1
- package/dist/context/sandbox.js +0 -114
- package/dist/context/sandbox.js.map +0 -1
- package/dist/context/turn-snapshot.js +0 -122
- package/dist/context/turn-snapshot.js.map +0 -1
- package/dist/doctor/checks/browser.js +0 -63
- package/dist/doctor/checks/browser.js.map +0 -1
- package/dist/doctor/checks/chain.js +0 -211
- package/dist/doctor/checks/chain.js.map +0 -1
- package/dist/doctor/checks/credentials.js +0 -98
- package/dist/doctor/checks/credentials.js.map +0 -1
- package/dist/doctor/checks/index.js +0 -72
- package/dist/doctor/checks/index.js.map +0 -1
- package/dist/doctor/checks/invariants.js +0 -79
- package/dist/doctor/checks/invariants.js.map +0 -1
- package/dist/doctor/checks/logging.js +0 -69
- package/dist/doctor/checks/logging.js.map +0 -1
- package/dist/doctor/checks/providers.js +0 -30
- package/dist/doctor/checks/providers.js.map +0 -1
- package/dist/doctor/checks/runtime.js +0 -40
- package/dist/doctor/checks/runtime.js.map +0 -1
- package/dist/doctor/checks/sandbox.js +0 -76
- package/dist/doctor/checks/sandbox.js.map +0 -1
- package/dist/doctor/checks/scheduler.js +0 -74
- package/dist/doctor/checks/scheduler.js.map +0 -1
- package/dist/doctor/checks/session-export.js +0 -62
- package/dist/doctor/checks/session-export.js.map +0 -1
- package/dist/doctor/checks/telemetry.js +0 -58
- package/dist/doctor/checks/telemetry.js.map +0 -1
- package/dist/doctor/checks/vault.js +0 -67
- package/dist/doctor/checks/vault.js.map +0 -1
- package/dist/doctor/index.js +0 -3
- package/dist/doctor/index.js.map +0 -1
- package/dist/doctor/registry.js +0 -230
- package/dist/doctor/registry.js.map +0 -1
- package/dist/exit-codes.js +0 -62
- package/dist/exit-codes.js.map +0 -1
- package/dist/installation.js +0 -48
- package/dist/installation.js.map +0 -1
- package/dist/integrations/clipboard/image.js +0 -119
- package/dist/integrations/clipboard/image.js.map +0 -1
- package/dist/integrations/clipboard/text.js +0 -43
- package/dist/integrations/clipboard/text.js.map +0 -1
- package/dist/integrations/files/attachment-store.js +0 -86
- package/dist/integrations/files/attachment-store.js.map +0 -1
- package/dist/integrations/mcp/oauth-store.js +0 -549
- package/dist/integrations/mcp/oauth-store.js.map +0 -1
- package/dist/integrations/mcp/servers.js +0 -611
- package/dist/integrations/mcp/servers.js.map +0 -1
- package/dist/integrations/mcp/user-config.js +0 -92
- package/dist/integrations/mcp/user-config.js.map +0 -1
- package/dist/integrations/notifications/desktop/freedesktop.js +0 -33
- package/dist/integrations/notifications/desktop/freedesktop.js.map +0 -1
- package/dist/integrations/notifications/desktop/macos.js +0 -17
- package/dist/integrations/notifications/desktop/macos.js.map +0 -1
- package/dist/integrations/notifications/desktop/sanitize.js +0 -49
- package/dist/integrations/notifications/desktop/sanitize.js.map +0 -1
- package/dist/integrations/notifications/desktop/throttle.js +0 -39
- package/dist/integrations/notifications/desktop/throttle.js.map +0 -1
- package/dist/integrations/notifications/desktop/windows-toast.js +0 -56
- package/dist/integrations/notifications/desktop/windows-toast.js.map +0 -1
- package/dist/integrations/notifications/desktop.js +0 -199
- package/dist/integrations/notifications/desktop.js.map +0 -1
- package/dist/integrations/notifications/terminal.js +0 -46
- package/dist/integrations/notifications/terminal.js.map +0 -1
- package/dist/integrations/npm-invocation.js +0 -23
- package/dist/integrations/npm-invocation.js.map +0 -1
- package/dist/integrations/plugins/runtime.js +0 -189
- package/dist/integrations/plugins/runtime.js.map +0 -1
- package/dist/integrations/plugins/settings.js +0 -106
- package/dist/integrations/plugins/settings.js.map +0 -1
- package/dist/integrations/providers/access.js +0 -23
- package/dist/integrations/providers/access.js.map +0 -1
- package/dist/integrations/providers/chain-capabilities.js +0 -211
- package/dist/integrations/providers/chain-capabilities.js.map +0 -1
- package/dist/integrations/providers/codex-device-login.js +0 -195
- package/dist/integrations/providers/codex-device-login.js.map +0 -1
- package/dist/integrations/providers/codex-oauth.js +0 -95
- package/dist/integrations/providers/codex-oauth.js.map +0 -1
- package/dist/integrations/providers/credential-provider.js +0 -74
- package/dist/integrations/providers/credential-provider.js.map +0 -1
- package/dist/integrations/providers/credential-store.js +0 -657
- package/dist/integrations/providers/credential-store.js.map +0 -1
- package/dist/integrations/providers/current-credential.js +0 -45
- package/dist/integrations/providers/current-credential.js.map +0 -1
- package/dist/integrations/providers/discover.js +0 -313
- package/dist/integrations/providers/discover.js.map +0 -1
- package/dist/integrations/providers/gemini-credentials.js +0 -148
- package/dist/integrations/providers/gemini-credentials.js.map +0 -1
- package/dist/integrations/providers/harness-credentials.js +0 -344
- package/dist/integrations/providers/harness-credentials.js.map +0 -1
- package/dist/integrations/providers/identity.js +0 -64
- package/dist/integrations/providers/identity.js.map +0 -1
- package/dist/integrations/providers/index.js +0 -14
- package/dist/integrations/providers/index.js.map +0 -1
- package/dist/integrations/providers/keychain.js +0 -78
- package/dist/integrations/providers/keychain.js.map +0 -1
- package/dist/integrations/providers/model-reasoning.js +0 -51
- package/dist/integrations/providers/model-reasoning.js.map +0 -1
- package/dist/integrations/providers/oauth.js +0 -302
- package/dist/integrations/providers/oauth.js.map +0 -1
- package/dist/integrations/providers/preferences.js +0 -287
- package/dist/integrations/providers/preferences.js.map +0 -1
- package/dist/integrations/providers/register.js +0 -154
- package/dist/integrations/providers/register.js.map +0 -1
- package/dist/integrations/providers/registry.js +0 -289
- package/dist/integrations/providers/registry.js.map +0 -1
- package/dist/integrations/providers/setup.js +0 -158
- package/dist/integrations/providers/setup.js.map +0 -1
- package/dist/integrations/providers/subscription-login.js +0 -328
- package/dist/integrations/providers/subscription-login.js.map +0 -1
- package/dist/integrations/providers/zen-catalogue.js +0 -196
- package/dist/integrations/providers/zen-catalogue.js.map +0 -1
- package/dist/integrations/resident/foreground.js +0 -95
- package/dist/integrations/resident/foreground.js.map +0 -1
- package/dist/integrations/resident/inspection.js +0 -282
- package/dist/integrations/resident/inspection.js.map +0 -1
- package/dist/integrations/resident/learning-sources.js +0 -79
- package/dist/integrations/resident/learning-sources.js.map +0 -1
- package/dist/integrations/resident/learning-storage.js +0 -55
- package/dist/integrations/resident/learning-storage.js.map +0 -1
- package/dist/integrations/resident/lifecycle-errors.js +0 -15
- package/dist/integrations/resident/lifecycle-errors.js.map +0 -1
- package/dist/integrations/resident/owned-runner.js +0 -91
- package/dist/integrations/resident/owned-runner.js.map +0 -1
- package/dist/integrations/resident/runner-control.js +0 -238
- package/dist/integrations/resident/runner-control.js.map +0 -1
- package/dist/integrations/resident/runner-launch.js +0 -142
- package/dist/integrations/resident/runner-launch.js.map +0 -1
- package/dist/integrations/resident/runner-store.js +0 -284
- package/dist/integrations/resident/runner-store.js.map +0 -1
- package/dist/integrations/resident/session-log-reads.js +0 -125
- package/dist/integrations/resident/session-log-reads.js.map +0 -1
- package/dist/integrations/resident/session-step.js +0 -476
- package/dist/integrations/resident/session-step.js.map +0 -1
- package/dist/integrations/resident/storage.js +0 -183
- package/dist/integrations/resident/storage.js.map +0 -1
- package/dist/integrations/resident/tool-evidence.js +0 -123
- package/dist/integrations/resident/tool-evidence.js.map +0 -1
- package/dist/integrations/resident/verification.js +0 -109
- package/dist/integrations/resident/verification.js.map +0 -1
- package/dist/integrations/sessions/checkpoint-view.js +0 -48
- package/dist/integrations/sessions/checkpoint-view.js.map +0 -1
- package/dist/integrations/sessions/context-inventory.js +0 -44
- package/dist/integrations/sessions/context-inventory.js.map +0 -1
- package/dist/integrations/sessions/conversation-search.js +0 -572
- package/dist/integrations/sessions/conversation-search.js.map +0 -1
- package/dist/integrations/sessions/display-title.js +0 -5
- package/dist/integrations/sessions/display-title.js.map +0 -1
- package/dist/integrations/sessions/evidence-page-validation.js +0 -74
- package/dist/integrations/sessions/evidence-page-validation.js.map +0 -1
- package/dist/integrations/sessions/evidence-recall.js +0 -117
- package/dist/integrations/sessions/evidence-recall.js.map +0 -1
- package/dist/integrations/sessions/store.js +0 -780
- package/dist/integrations/sessions/store.js.map +0 -1
- package/dist/integrations/sessions/task-context.js +0 -96
- package/dist/integrations/sessions/task-context.js.map +0 -1
- package/dist/integrations/sessions/transcript-export.js +0 -342
- package/dist/integrations/sessions/transcript-export.js.map +0 -1
- package/dist/integrations/state/home.js +0 -17
- package/dist/integrations/state/home.js.map +0 -1
- package/dist/integrations/state/identity.js +0 -49
- package/dist/integrations/state/identity.js.map +0 -1
- package/dist/integrations/state/immutable-json.js +0 -38
- package/dist/integrations/state/immutable-json.js.map +0 -1
- package/dist/integrations/state/private-directory.js +0 -43
- package/dist/integrations/state/private-directory.js.map +0 -1
- package/dist/integrations/state/project.js +0 -13
- package/dist/integrations/state/project.js.map +0 -1
- package/dist/integrations/state/report.js +0 -626
- package/dist/integrations/state/report.js.map +0 -1
- package/dist/integrations/state/retention.js +0 -18
- package/dist/integrations/state/retention.js.map +0 -1
- package/dist/integrations/subagents/NamzuCliAgent.js +0 -9
- package/dist/integrations/subagents/NamzuCliAgent.js.map +0 -1
- package/dist/integrations/subagents/activity.js +0 -759
- package/dist/integrations/subagents/activity.js.map +0 -1
- package/dist/integrations/subagents/batches.js +0 -172
- package/dist/integrations/subagents/batches.js.map +0 -1
- package/dist/integrations/subagents/definitions.js +0 -26
- package/dist/integrations/subagents/definitions.js.map +0 -1
- package/dist/integrations/subagents/model-effort.js +0 -12
- package/dist/integrations/subagents/model-effort.js.map +0 -1
- package/dist/integrations/subagents/parent.js +0 -47
- package/dist/integrations/subagents/parent.js.map +0 -1
- package/dist/integrations/subagents/policy.js +0 -3
- package/dist/integrations/subagents/policy.js.map +0 -1
- package/dist/integrations/subagents/replay.js +0 -295
- package/dist/integrations/subagents/replay.js.map +0 -1
- package/dist/integrations/subagents/runtime.js +0 -1317
- package/dist/integrations/subagents/runtime.js.map +0 -1
- package/dist/integrations/subagents/saved-agents.js +0 -102
- package/dist/integrations/subagents/saved-agents.js.map +0 -1
- package/dist/integrations/subagents/slash.js +0 -45
- package/dist/integrations/subagents/slash.js.map +0 -1
- package/dist/integrations/subagents/worktree-driver.js +0 -72
- package/dist/integrations/subagents/worktree-driver.js.map +0 -1
- package/dist/integrations/telemetry/session-export.js +0 -119
- package/dist/integrations/telemetry/session-export.js.map +0 -1
- package/dist/integrations/trust/store.js +0 -73
- package/dist/integrations/trust/store.js.map +0 -1
- package/dist/integrations/updates.js +0 -115
- package/dist/integrations/updates.js.map +0 -1
- package/dist/integrations/web/exa-search.js +0 -154
- package/dist/integrations/web/exa-search.js.map +0 -1
- package/dist/integrations/web/open-url.js +0 -73
- package/dist/integrations/web/open-url.js.map +0 -1
- package/dist/integrations/web/search.js +0 -68
- package/dist/integrations/web/search.js.map +0 -1
- package/dist/integrations/worktrees/managed.js +0 -231
- package/dist/integrations/worktrees/managed.js.map +0 -1
- package/dist/logging.js +0 -115
- package/dist/logging.js.map +0 -1
- package/dist/memory/io.js +0 -177
- package/dist/memory/io.js.map +0 -1
- package/dist/memory/presentation.js +0 -76
- package/dist/memory/presentation.js.map +0 -1
- package/dist/memory/store.js +0 -180
- package/dist/memory/store.js.map +0 -1
- package/dist/memory/typed.js +0 -336
- package/dist/memory/typed.js.map +0 -1
- package/dist/output/formatter.js +0 -16
- package/dist/output/formatter.js.map +0 -1
- package/dist/output/index.js +0 -22
- package/dist/output/index.js.map +0 -1
- package/dist/output/json.js +0 -51
- package/dist/output/json.js.map +0 -1
- package/dist/output/text.js +0 -50
- package/dist/output/text.js.map +0 -1
- package/dist/output/yaml.js +0 -26
- package/dist/output/yaml.js.map +0 -1
- package/dist/output-schema.js +0 -18
- package/dist/output-schema.js.map +0 -1
- package/dist/permissions/browser-sites.js +0 -270
- package/dist/permissions/browser-sites.js.map +0 -1
- package/dist/permissions/canonical-project.js +0 -13
- package/dist/permissions/canonical-project.js.map +0 -1
- package/dist/permissions/checks.js +0 -128
- package/dist/permissions/checks.js.map +0 -1
- package/dist/permissions/headless-trust.js +0 -86
- package/dist/permissions/headless-trust.js.map +0 -1
- package/dist/permissions/live-mode.js +0 -62
- package/dist/permissions/live-mode.js.map +0 -1
- package/dist/permissions/mode.js +0 -65
- package/dist/permissions/mode.js.map +0 -1
- package/dist/permissions/rules.js +0 -358
- package/dist/permissions/rules.js.map +0 -1
- package/dist/release-notes.js +0 -64
- package/dist/release-notes.js.map +0 -1
- package/dist/resume-invocation.js +0 -24
- package/dist/resume-invocation.js.map +0 -1
- package/dist/schedule/build.js +0 -374
- package/dist/schedule/build.js.map +0 -1
- package/dist/schedule/changes.js +0 -78
- package/dist/schedule/changes.js.map +0 -1
- package/dist/schedule/commands/add.js +0 -603
- package/dist/schedule/commands/add.js.map +0 -1
- package/dist/schedule/commands/args.js +0 -80
- package/dist/schedule/commands/args.js.map +0 -1
- package/dist/schedule/commands/confirm-prompt.js +0 -21
- package/dist/schedule/commands/confirm-prompt.js.map +0 -1
- package/dist/schedule/commands/lifecycle.js +0 -586
- package/dist/schedule/commands/lifecycle.js.map +0 -1
- package/dist/schedule/commands/list.js +0 -260
- package/dist/schedule/commands/list.js.map +0 -1
- package/dist/schedule/commands/logs.js +0 -106
- package/dist/schedule/commands/logs.js.map +0 -1
- package/dist/schedule/commands/service.js +0 -458
- package/dist/schedule/commands/service.js.map +0 -1
- package/dist/schedule/daemon/daemon.js +0 -1265
- package/dist/schedule/daemon/daemon.js.map +0 -1
- package/dist/schedule/daemon/endpoint.js +0 -158
- package/dist/schedule/daemon/endpoint.js.map +0 -1
- package/dist/schedule/daemon/exit.js +0 -8
- package/dist/schedule/daemon/exit.js.map +0 -1
- package/dist/schedule/daemon/log.js +0 -53
- package/dist/schedule/daemon/log.js.map +0 -1
- package/dist/schedule/daemon/notify.js +0 -158
- package/dist/schedule/daemon/notify.js.map +0 -1
- package/dist/schedule/daemon/retention.js +0 -46
- package/dist/schedule/daemon/retention.js.map +0 -1
- package/dist/schedule/daemon/sessions.js +0 -52
- package/dist/schedule/daemon/sessions.js.map +0 -1
- package/dist/schedule/env.js +0 -106
- package/dist/schedule/env.js.map +0 -1
- package/dist/schedule/fire/browser-preflight.js +0 -73
- package/dist/schedule/fire/browser-preflight.js.map +0 -1
- package/dist/schedule/fire/calls.js +0 -114
- package/dist/schedule/fire/calls.js.map +0 -1
- package/dist/schedule/fire/fire.js +0 -681
- package/dist/schedule/fire/fire.js.map +0 -1
- package/dist/schedule/fire/result.js +0 -19
- package/dist/schedule/fire/result.js.map +0 -1
- package/dist/schedule/fire/run-script.js +0 -81
- package/dist/schedule/fire/run-script.js.map +0 -1
- package/dist/schedule/fire/unattended-note.js +0 -51
- package/dist/schedule/fire/unattended-note.js.map +0 -1
- package/dist/schedule/fire/wake-gate.js +0 -90
- package/dist/schedule/fire/wake-gate.js.map +0 -1
- package/dist/schedule/floor.js +0 -1561
- package/dist/schedule/floor.js.map +0 -1
- package/dist/schedule/folder.js +0 -84
- package/dist/schedule/folder.js.map +0 -1
- package/dist/schedule/paths.js +0 -53
- package/dist/schedule/paths.js.map +0 -1
- package/dist/schedule/policy.js +0 -414
- package/dist/schedule/policy.js.map +0 -1
- package/dist/schedule/resume-command.js +0 -72
- package/dist/schedule/resume-command.js.map +0 -1
- package/dist/schedule/script-check.js +0 -146
- package/dist/schedule/script-check.js.map +0 -1
- package/dist/schedule/script-shell.js +0 -5
- package/dist/schedule/script-shell.js.map +0 -1
- package/dist/schedule/service/detect.js +0 -29
- package/dist/schedule/service/detect.js.map +0 -1
- package/dist/schedule/service/index.js +0 -361
- package/dist/schedule/service/index.js.map +0 -1
- package/dist/schedule/service/launchd.js +0 -84
- package/dist/schedule/service/launchd.js.map +0 -1
- package/dist/schedule/service/manifest.js +0 -16
- package/dist/schedule/service/manifest.js.map +0 -1
- package/dist/schedule/service/names.js +0 -22
- package/dist/schedule/service/names.js.map +0 -1
- package/dist/schedule/service/quote.js +0 -64
- package/dist/schedule/service/quote.js.map +0 -1
- package/dist/schedule/service/runner.js +0 -31
- package/dist/schedule/service/runner.js.map +0 -1
- package/dist/schedule/service/systemd.js +0 -96
- package/dist/schedule/service/systemd.js.map +0 -1
- package/dist/schedule/service/windows-task.js +0 -199
- package/dist/schedule/service/windows-task.js.map +0 -1
- package/dist/schedule/service/wsl.js +0 -121
- package/dist/schedule/service/wsl.js.map +0 -1
- package/dist/schedule/store/atomic.js +0 -138
- package/dist/schedule/store/atomic.js.map +0 -1
- package/dist/schedule/store/claims.js +0 -57
- package/dist/schedule/store/claims.js.map +0 -1
- package/dist/schedule/store/digest.js +0 -139
- package/dist/schedule/store/digest.js.map +0 -1
- package/dist/schedule/store/history.js +0 -117
- package/dist/schedule/store/history.js.map +0 -1
- package/dist/schedule/store/jobs.js +0 -277
- package/dist/schedule/store/jobs.js.map +0 -1
- package/dist/schedule/store/state.js +0 -38
- package/dist/schedule/store/state.js.map +0 -1
- package/dist/schedule/types.js +0 -33
- package/dist/schedule/types.js.map +0 -1
- package/dist/schedule/visible-source.js +0 -59
- package/dist/schedule/visible-source.js.map +0 -1
- package/dist/skills/audit.js +0 -75
- package/dist/skills/audit.js.map +0 -1
- package/dist/skills/catalog.js +0 -226
- package/dist/skills/catalog.js.map +0 -1
- package/dist/skills/directory.js +0 -51
- package/dist/skills/directory.js.map +0 -1
- package/dist/skills/save.js +0 -344
- package/dist/skills/save.js.map +0 -1
- package/dist/skills/store.js +0 -351
- package/dist/skills/store.js.map +0 -1
- package/dist/termination.js +0 -143
- package/dist/termination.js.map +0 -1
- package/dist/test-support/toolset.js +0 -27
- package/dist/test-support/toolset.js.map +0 -1
- package/dist/tui/AgentExplorer.js +0 -789
- package/dist/tui/AgentExplorer.js.map +0 -1
- package/dist/tui/App.js +0 -8499
- package/dist/tui/App.js.map +0 -1
- package/dist/tui/BackgroundJobsPanel.js +0 -129
- package/dist/tui/BackgroundJobsPanel.js.map +0 -1
- package/dist/tui/BrandHeader.js +0 -14
- package/dist/tui/BrandHeader.js.map +0 -1
- package/dist/tui/Checklist.js +0 -90
- package/dist/tui/Checklist.js.map +0 -1
- package/dist/tui/ChoicePicker.js +0 -64
- package/dist/tui/ChoicePicker.js.map +0 -1
- package/dist/tui/Composer.js +0 -939
- package/dist/tui/Composer.js.map +0 -1
- package/dist/tui/ComposerFrame.js +0 -79
- package/dist/tui/ComposerFrame.js.map +0 -1
- package/dist/tui/CopyPicker.js +0 -19
- package/dist/tui/CopyPicker.js.map +0 -1
- package/dist/tui/EditPromptPicker.js +0 -17
- package/dist/tui/EditPromptPicker.js.map +0 -1
- package/dist/tui/EffortSlider.js +0 -134
- package/dist/tui/EffortSlider.js.map +0 -1
- package/dist/tui/LiveActivity.js +0 -89
- package/dist/tui/LiveActivity.js.map +0 -1
- package/dist/tui/Markdown.js +0 -137
- package/dist/tui/Markdown.js.map +0 -1
- package/dist/tui/PendingInputPanel.js +0 -108
- package/dist/tui/PendingInputPanel.js.map +0 -1
- package/dist/tui/PermissionOverlay.js +0 -278
- package/dist/tui/PermissionOverlay.js.map +0 -1
- package/dist/tui/Picker.js +0 -1310
- package/dist/tui/Picker.js.map +0 -1
- package/dist/tui/ProviderSetup.js +0 -125
- package/dist/tui/ProviderSetup.js.map +0 -1
- package/dist/tui/ResumePicker.js +0 -34
- package/dist/tui/ResumePicker.js.map +0 -1
- package/dist/tui/SaveSkillOverlay.js +0 -118
- package/dist/tui/SaveSkillOverlay.js.map +0 -1
- package/dist/tui/ScheduleReviewOverlay.js +0 -166
- package/dist/tui/ScheduleReviewOverlay.js.map +0 -1
- package/dist/tui/StatusBar.js +0 -182
- package/dist/tui/StatusBar.js.map +0 -1
- package/dist/tui/StatusPanel.js +0 -11
- package/dist/tui/StatusPanel.js.map +0 -1
- package/dist/tui/TaskList.js +0 -43
- package/dist/tui/TaskList.js.map +0 -1
- package/dist/tui/TextPrompt.js +0 -185
- package/dist/tui/TextPrompt.js.map +0 -1
- package/dist/tui/ToolOutputViewer.js +0 -39
- package/dist/tui/ToolOutputViewer.js.map +0 -1
- package/dist/tui/Transcript.js +0 -235
- package/dist/tui/Transcript.js.map +0 -1
- package/dist/tui/TrustPrompt.js +0 -13
- package/dist/tui/TrustPrompt.js.map +0 -1
- package/dist/tui/ViewportBound.js +0 -55
- package/dist/tui/ViewportBound.js.map +0 -1
- package/dist/tui/agent-transcript-rows.js +0 -115
- package/dist/tui/agent-transcript-rows.js.map +0 -1
- package/dist/tui/agent.js +0 -4301
- package/dist/tui/agent.js.map +0 -1
- package/dist/tui/browser-notices.js +0 -107
- package/dist/tui/browser-notices.js.map +0 -1
- package/dist/tui/choice-selection.js +0 -38
- package/dist/tui/choice-selection.js.map +0 -1
- package/dist/tui/compact-transcript.js +0 -46
- package/dist/tui/compact-transcript.js.map +0 -1
- package/dist/tui/consent-timing.js +0 -48
- package/dist/tui/consent-timing.js.map +0 -1
- package/dist/tui/conversation-evidence-view.js +0 -96
- package/dist/tui/conversation-evidence-view.js.map +0 -1
- package/dist/tui/conversation-history.js +0 -33
- package/dist/tui/conversation-history.js.map +0 -1
- package/dist/tui/copy-targets.js +0 -189
- package/dist/tui/copy-targets.js.map +0 -1
- package/dist/tui/credential-entry.js +0 -134
- package/dist/tui/credential-entry.js.map +0 -1
- package/dist/tui/edit-prompts.js +0 -35
- package/dist/tui/edit-prompts.js.map +0 -1
- package/dist/tui/exit-summary.js +0 -30
- package/dist/tui/exit-summary.js.map +0 -1
- package/dist/tui/external-editor.js +0 -169
- package/dist/tui/external-editor.js.map +0 -1
- package/dist/tui/hypermode.js +0 -58
- package/dist/tui/hypermode.js.map +0 -1
- package/dist/tui/index.js +0 -81
- package/dist/tui/index.js.map +0 -1
- package/dist/tui/live-window.js +0 -281
- package/dist/tui/live-window.js.map +0 -1
- package/dist/tui/log-pane.js +0 -100
- package/dist/tui/log-pane.js.map +0 -1
- package/dist/tui/login-prompt.js +0 -105
- package/dist/tui/login-prompt.js.map +0 -1
- package/dist/tui/logo.js +0 -9
- package/dist/tui/logo.js.map +0 -1
- package/dist/tui/markdown-block-cache.js +0 -76
- package/dist/tui/markdown-block-cache.js.map +0 -1
- package/dist/tui/markdown-table.js +0 -175
- package/dist/tui/markdown-table.js.map +0 -1
- package/dist/tui/markdown-wrap.js +0 -189
- package/dist/tui/markdown-wrap.js.map +0 -1
- package/dist/tui/markdownParser.js +0 -237
- package/dist/tui/markdownParser.js.map +0 -1
- package/dist/tui/mentions.js +0 -150
- package/dist/tui/mentions.js.map +0 -1
- package/dist/tui/model-catalogue-view.js +0 -75
- package/dist/tui/model-catalogue-view.js.map +0 -1
- package/dist/tui/model-choices.js +0 -157
- package/dist/tui/model-choices.js.map +0 -1
- package/dist/tui/model-search.js +0 -28
- package/dist/tui/model-search.js.map +0 -1
- package/dist/tui/model-selection-intent.js +0 -96
- package/dist/tui/model-selection-intent.js.map +0 -1
- package/dist/tui/model-switch-tool.js +0 -74
- package/dist/tui/model-switch-tool.js.map +0 -1
- package/dist/tui/model-switch.js +0 -106
- package/dist/tui/model-switch.js.map +0 -1
- package/dist/tui/notices.js +0 -27
- package/dist/tui/notices.js.map +0 -1
- package/dist/tui/open-browser.js +0 -147
- package/dist/tui/open-browser.js.map +0 -1
- package/dist/tui/permission-review.js +0 -858
- package/dist/tui/permission-review.js.map +0 -1
- package/dist/tui/plugin-view.js +0 -59
- package/dist/tui/plugin-view.js.map +0 -1
- package/dist/tui/provider-list.js +0 -327
- package/dist/tui/provider-list.js.map +0 -1
- package/dist/tui/provider-selection.js +0 -16
- package/dist/tui/provider-selection.js.map +0 -1
- package/dist/tui/schedule/host-commands.js +0 -428
- package/dist/tui/schedule/host-commands.js.map +0 -1
- package/dist/tui/schedule/integration.js +0 -150
- package/dist/tui/schedule/integration.js.map +0 -1
- package/dist/tui/schedule/loop-host.js +0 -153
- package/dist/tui/schedule/loop-host.js.map +0 -1
- package/dist/tui/schedule/resume.js +0 -333
- package/dist/tui/schedule/resume.js.map +0 -1
- package/dist/tui/schedule/startup.js +0 -121
- package/dist/tui/schedule/startup.js.map +0 -1
- package/dist/tui/schedule/tool-host.js +0 -619
- package/dist/tui/schedule/tool-host.js.map +0 -1
- package/dist/tui/selection-window.js +0 -37
- package/dist/tui/selection-window.js.map +0 -1
- package/dist/tui/shell-escape.js +0 -110
- package/dist/tui/shell-escape.js.map +0 -1
- package/dist/tui/skills/learning.js +0 -131
- package/dist/tui/skills/learning.js.map +0 -1
- package/dist/tui/skills/suggest-setting.js +0 -55
- package/dist/tui/skills/suggest-setting.js.map +0 -1
- package/dist/tui/skills/suggestion-ledger.js +0 -52
- package/dist/tui/skills/suggestion-ledger.js.map +0 -1
- package/dist/tui/slashCommands.js +0 -1588
- package/dist/tui/slashCommands.js.map +0 -1
- package/dist/tui/status-card.js +0 -30
- package/dist/tui/status-card.js.map +0 -1
- package/dist/tui/status-panel-layout.js +0 -42
- package/dist/tui/status-panel-layout.js.map +0 -1
- package/dist/tui/stream-blocks.js +0 -187
- package/dist/tui/stream-blocks.js.map +0 -1
- package/dist/tui/task-activity.js +0 -157
- package/dist/tui/task-activity.js.map +0 -1
- package/dist/tui/terminal-choice-text.js +0 -118
- package/dist/tui/terminal-choice-text.js.map +0 -1
- package/dist/tui/terminal-display.js +0 -65
- package/dist/tui/terminal-display.js.map +0 -1
- package/dist/tui/terminal-hyperlinks.js +0 -70
- package/dist/tui/terminal-hyperlinks.js.map +0 -1
- package/dist/tui/theme.js +0 -34
- package/dist/tui/theme.js.map +0 -1
- package/dist/tui/triggers/analyze.js +0 -221
- package/dist/tui/triggers/analyze.js.map +0 -1
- package/dist/tui/triggers/context-text.js +0 -44
- package/dist/tui/triggers/context-text.js.map +0 -1
- package/dist/tui/triggers/copy.js +0 -163
- package/dist/tui/triggers/copy.js.map +0 -1
- package/dist/tui/triggers/detect.js +0 -295
- package/dist/tui/triggers/detect.js.map +0 -1
- package/dist/tui/triggers/fold.js +0 -44
- package/dist/tui/triggers/fold.js.map +0 -1
- package/dist/tui/triggers/pattern.js +0 -243
- package/dist/tui/triggers/pattern.js.map +0 -1
- package/dist/tui/triggers/provenance.js +0 -98
- package/dist/tui/triggers/provenance.js.map +0 -1
- package/dist/tui/triggers/registry.js +0 -164
- package/dist/tui/triggers/registry.js.map +0 -1
- package/dist/tui/triggers/setting.js +0 -61
- package/dist/tui/triggers/setting.js.map +0 -1
- package/dist/tui/triggers/verbs.js +0 -140
- package/dist/tui/triggers/verbs.js.map +0 -1
- package/dist/tui/turn-interruption.js +0 -160
- package/dist/tui/turn-interruption.js.map +0 -1
- package/dist/tui/turn-limits-settings.js +0 -88
- package/dist/tui/turn-limits-settings.js.map +0 -1
- package/dist/tui/types.js +0 -7
- package/dist/tui/types.js.map +0 -1
- package/dist/tui/units.js +0 -20
- package/dist/tui/units.js.map +0 -1
- package/dist/tui/use-selection-index.js +0 -13
- package/dist/tui/use-selection-index.js.map +0 -1
- package/dist/tui/web-activity.js +0 -105
- package/dist/tui/web-activity.js.map +0 -1
- package/dist/tui/workspace-diff.js +0 -101
- package/dist/tui/workspace-diff.js.map +0 -1
- package/dist/tui/workspace-review.js +0 -67
- package/dist/tui/workspace-review.js.map +0 -1
- package/dist/user-commands/store.js +0 -235
- package/dist/user-commands/store.js.map +0 -1
- package/dist/version.js +0 -23
- package/dist/version.js.map +0 -1
|
@@ -0,0 +1,1633 @@
|
|
|
1
|
+
import { createRequire as __namzuCreateRequire } from 'node:module';
|
|
2
|
+
const require = __namzuCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
EXIT_STOP_REQUESTED,
|
|
5
|
+
ScheduleDaemon,
|
|
6
|
+
daemonLogPath,
|
|
7
|
+
daemonLogSink,
|
|
8
|
+
installedFingerprint,
|
|
9
|
+
isFinal,
|
|
10
|
+
parseFireArgs,
|
|
11
|
+
readRunResult,
|
|
12
|
+
requestStop,
|
|
13
|
+
runFire,
|
|
14
|
+
spawnFireProcess,
|
|
15
|
+
stopRequestPath,
|
|
16
|
+
writeRunResult
|
|
17
|
+
} from "./chunk-THZXXVHM.js";
|
|
18
|
+
import "./chunk-KCWUQRZV.js";
|
|
19
|
+
import "./chunk-E5VLANCO.js";
|
|
20
|
+
import "./chunk-EIYM6TY7.js";
|
|
21
|
+
import {
|
|
22
|
+
parkedRunWords,
|
|
23
|
+
resumeCommand
|
|
24
|
+
} from "./chunk-HQM2WSQT.js";
|
|
25
|
+
import {
|
|
26
|
+
readState
|
|
27
|
+
} from "./chunk-J72CRUNX.js";
|
|
28
|
+
import {
|
|
29
|
+
flag,
|
|
30
|
+
has,
|
|
31
|
+
parseArgs,
|
|
32
|
+
parseMs,
|
|
33
|
+
pathsFor
|
|
34
|
+
} from "./chunk-UDBEU2FR.js";
|
|
35
|
+
import {
|
|
36
|
+
callEndpoint,
|
|
37
|
+
readEndpoint
|
|
38
|
+
} from "./chunk-6YG7D7U4.js";
|
|
39
|
+
import "./chunk-WHODOMXA.js";
|
|
40
|
+
import "./chunk-HPMWYIBY.js";
|
|
41
|
+
import {
|
|
42
|
+
readManifest,
|
|
43
|
+
removeManifest,
|
|
44
|
+
writeManifest
|
|
45
|
+
} from "./chunk-AK2U3N2A.js";
|
|
46
|
+
import {
|
|
47
|
+
listJobs,
|
|
48
|
+
sanitizeLine
|
|
49
|
+
} from "./chunk-SKKWMMFP.js";
|
|
50
|
+
import "./chunk-OEW7CJKK.js";
|
|
51
|
+
import "./chunk-A22MBIYU.js";
|
|
52
|
+
import {
|
|
53
|
+
loadBootstrapConfigWithProvenance
|
|
54
|
+
} from "./chunk-RC6X3ZY6.js";
|
|
55
|
+
import "./chunk-KONYGNG6.js";
|
|
56
|
+
import "./chunk-KU3W6IHV.js";
|
|
57
|
+
import {
|
|
58
|
+
CLI_VERSION
|
|
59
|
+
} from "./chunk-HE7WUOX2.js";
|
|
60
|
+
import "./chunk-CHIEVVQ2.js";
|
|
61
|
+
import "./chunk-K76WV7TN.js";
|
|
62
|
+
import "./chunk-US5ZFPAU.js";
|
|
63
|
+
import {
|
|
64
|
+
detectWsl,
|
|
65
|
+
readWslMountRoot,
|
|
66
|
+
wslSystem32
|
|
67
|
+
} from "./chunk-2A37JQKY.js";
|
|
68
|
+
import "./chunk-6LLJQ3KY.js";
|
|
69
|
+
import {
|
|
70
|
+
EXIT_NO_CONFIG,
|
|
71
|
+
EXIT_OK,
|
|
72
|
+
EXIT_UNAVAILABLE,
|
|
73
|
+
EXIT_USAGE
|
|
74
|
+
} from "./chunk-Y7B67G22.js";
|
|
75
|
+
import "./chunk-XEUQN4JC.js";
|
|
76
|
+
import "./chunk-Q5YM2GCX.js";
|
|
77
|
+
import "./chunk-WM2JEUGV.js";
|
|
78
|
+
import {
|
|
79
|
+
cliLogger,
|
|
80
|
+
installCliLogging
|
|
81
|
+
} from "./chunk-HBBB2CAC.js";
|
|
82
|
+
import "./chunk-EEDZOGV4.js";
|
|
83
|
+
import "./chunk-AHIDYIRB.js";
|
|
84
|
+
import "./chunk-GIXSS6KW.js";
|
|
85
|
+
import "./chunk-TIGWWAJI.js";
|
|
86
|
+
import "./chunk-H6B6AROX.js";
|
|
87
|
+
import "./chunk-A5UXODFL.js";
|
|
88
|
+
import "./chunk-OLPOM3DR.js";
|
|
89
|
+
import "./chunk-CG65NUSJ.js";
|
|
90
|
+
import "./chunk-JORONMD3.js";
|
|
91
|
+
import "./chunk-Q24K7536.js";
|
|
92
|
+
import "./chunk-NQY5P2EB.js";
|
|
93
|
+
import "./chunk-EWKJGHRO.js";
|
|
94
|
+
import {
|
|
95
|
+
__name
|
|
96
|
+
} from "./chunk-76FLAFCG.js";
|
|
97
|
+
|
|
98
|
+
// src/schedule/commands/service.ts
|
|
99
|
+
import { randomUUID } from "node:crypto";
|
|
100
|
+
import { existsSync as existsSync5, readFileSync as readFileSync2, realpathSync, rmSync as rmSync4 } from "node:fs";
|
|
101
|
+
import { dirname as dirname3, join as join6 } from "node:path";
|
|
102
|
+
import { fileURLToPath } from "node:url";
|
|
103
|
+
|
|
104
|
+
// src/integrations/notifications/desktop.ts
|
|
105
|
+
import { execFile } from "node:child_process";
|
|
106
|
+
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
107
|
+
import { join } from "node:path";
|
|
108
|
+
|
|
109
|
+
// src/integrations/notifications/desktop/freedesktop.ts
|
|
110
|
+
function gvariantString(text) {
|
|
111
|
+
return `'${text.replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'`;
|
|
112
|
+
}
|
|
113
|
+
__name(gvariantString, "gvariantString");
|
|
114
|
+
function notifySendArguments(title, body) {
|
|
115
|
+
return ["--app-name=namzu", "--", title, body];
|
|
116
|
+
}
|
|
117
|
+
__name(notifySendArguments, "notifySendArguments");
|
|
118
|
+
function gdbusArguments(title, body) {
|
|
119
|
+
return [
|
|
120
|
+
"call",
|
|
121
|
+
"--session",
|
|
122
|
+
"--dest",
|
|
123
|
+
"org.freedesktop.Notifications",
|
|
124
|
+
"--object-path",
|
|
125
|
+
"/org/freedesktop/Notifications",
|
|
126
|
+
"--method",
|
|
127
|
+
"org.freedesktop.Notifications.Notify",
|
|
128
|
+
gvariantString("namzu"),
|
|
129
|
+
"0",
|
|
130
|
+
gvariantString(""),
|
|
131
|
+
gvariantString(title),
|
|
132
|
+
gvariantString(body),
|
|
133
|
+
"[]",
|
|
134
|
+
"{}",
|
|
135
|
+
"10000"
|
|
136
|
+
];
|
|
137
|
+
}
|
|
138
|
+
__name(gdbusArguments, "gdbusArguments");
|
|
139
|
+
|
|
140
|
+
// src/integrations/notifications/desktop/macos.ts
|
|
141
|
+
function osascriptArguments(title, body) {
|
|
142
|
+
return [
|
|
143
|
+
"-e",
|
|
144
|
+
"on run argv",
|
|
145
|
+
"-e",
|
|
146
|
+
"display notification (item 2 of argv) with title (item 1 of argv)",
|
|
147
|
+
"-e",
|
|
148
|
+
"end run",
|
|
149
|
+
title,
|
|
150
|
+
body
|
|
151
|
+
];
|
|
152
|
+
}
|
|
153
|
+
__name(osascriptArguments, "osascriptArguments");
|
|
154
|
+
|
|
155
|
+
// src/integrations/notifications/desktop/windows-toast.ts
|
|
156
|
+
var TOAST_SCRIPT = [
|
|
157
|
+
"$ErrorActionPreference = 'Stop'",
|
|
158
|
+
"[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null",
|
|
159
|
+
"[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null",
|
|
160
|
+
"$title = [Security.SecurityElement]::Escape([string]$env:NAMZU_NOTIFY_TITLE)",
|
|
161
|
+
"$body = [Security.SecurityElement]::Escape([string]$env:NAMZU_NOTIFY_BODY)",
|
|
162
|
+
"$xml = New-Object Windows.Data.Xml.Dom.XmlDocument",
|
|
163
|
+
`$xml.LoadXml('<toast><visual><binding template="ToastGeneric"><text>' + $title + '</text><text>' + $body + '</text></binding></visual></toast>')`,
|
|
164
|
+
"$app = '{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\\WindowsPowerShell\\v1.0\\powershell.exe'",
|
|
165
|
+
"[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($app).Show([Windows.UI.Notifications.ToastNotification]::new($xml))"
|
|
166
|
+
].join("\n");
|
|
167
|
+
function encodedToastScript() {
|
|
168
|
+
return Buffer.from(TOAST_SCRIPT, "utf16le").toString("base64");
|
|
169
|
+
}
|
|
170
|
+
__name(encodedToastScript, "encodedToastScript");
|
|
171
|
+
function toastArguments() {
|
|
172
|
+
return [
|
|
173
|
+
"-NoProfile",
|
|
174
|
+
"-NonInteractive",
|
|
175
|
+
"-ExecutionPolicy",
|
|
176
|
+
"Bypass",
|
|
177
|
+
"-EncodedCommand",
|
|
178
|
+
encodedToastScript()
|
|
179
|
+
];
|
|
180
|
+
}
|
|
181
|
+
__name(toastArguments, "toastArguments");
|
|
182
|
+
function toastEnvironment(base, title, body, wsl) {
|
|
183
|
+
const env = { ...base, NAMZU_NOTIFY_TITLE: title, NAMZU_NOTIFY_BODY: body };
|
|
184
|
+
if (wsl) {
|
|
185
|
+
const existing = (base.WSLENV ?? "").split(":").filter((v) => v && !v.startsWith("NAMZU_NOTIFY_"));
|
|
186
|
+
env.WSLENV = [...existing, "NAMZU_NOTIFY_TITLE", "NAMZU_NOTIFY_BODY"].join(":");
|
|
187
|
+
}
|
|
188
|
+
return env;
|
|
189
|
+
}
|
|
190
|
+
__name(toastEnvironment, "toastEnvironment");
|
|
191
|
+
|
|
192
|
+
// src/integrations/notifications/desktop.ts
|
|
193
|
+
function readOsRelease() {
|
|
194
|
+
try {
|
|
195
|
+
return readFileSync("/proc/sys/kernel/osrelease", "utf8");
|
|
196
|
+
} catch {
|
|
197
|
+
return void 0;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
__name(readOsRelease, "readOsRelease");
|
|
201
|
+
function whichOnPath(env, exists) {
|
|
202
|
+
return (name) => {
|
|
203
|
+
for (const dir of (env.PATH ?? "").split(":")) {
|
|
204
|
+
if (!dir || dir.startsWith("/mnt/")) continue;
|
|
205
|
+
const candidate = join(dir, name);
|
|
206
|
+
if (exists(candidate)) return candidate;
|
|
207
|
+
}
|
|
208
|
+
return void 0;
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
__name(whichOnPath, "whichOnPath");
|
|
212
|
+
var WSL_RUN_DIR = "/run/WSL";
|
|
213
|
+
function listInteropSockets() {
|
|
214
|
+
const sockets = [];
|
|
215
|
+
let names;
|
|
216
|
+
try {
|
|
217
|
+
names = readdirSync(WSL_RUN_DIR);
|
|
218
|
+
} catch {
|
|
219
|
+
return sockets;
|
|
220
|
+
}
|
|
221
|
+
for (const name of names) {
|
|
222
|
+
if (!/^\d+_interop$/.test(name)) continue;
|
|
223
|
+
const path = join(WSL_RUN_DIR, name);
|
|
224
|
+
try {
|
|
225
|
+
const stat = statSync(path);
|
|
226
|
+
if (stat.isSocket()) sockets.push({ path, mtimeMs: stat.mtimeMs });
|
|
227
|
+
} catch {
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return sockets;
|
|
231
|
+
}
|
|
232
|
+
__name(listInteropSockets, "listInteropSockets");
|
|
233
|
+
function findInteropSocket(sockets) {
|
|
234
|
+
const stable = sockets.find((socket) => socket.path === join(WSL_RUN_DIR, "1_interop"));
|
|
235
|
+
if (stable) return stable.path;
|
|
236
|
+
return [...sockets].sort((a, b) => b.mtimeMs - a.mtimeMs)[0]?.path;
|
|
237
|
+
}
|
|
238
|
+
__name(findInteropSocket, "findInteropSocket");
|
|
239
|
+
function selectDesktopBackend(probe = {}) {
|
|
240
|
+
const platform = probe.platform ?? process.platform;
|
|
241
|
+
const env = probe.env ?? process.env;
|
|
242
|
+
const exists = probe.exists ?? existsSync;
|
|
243
|
+
const which = probe.which ?? whichOnPath(env, exists);
|
|
244
|
+
if (platform === "darwin") {
|
|
245
|
+
return {
|
|
246
|
+
kind: "macos",
|
|
247
|
+
detail: "osascript",
|
|
248
|
+
command: "/usr/bin/osascript",
|
|
249
|
+
args: osascriptArguments
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
if (platform === "win32") {
|
|
253
|
+
return {
|
|
254
|
+
kind: "windows-toast",
|
|
255
|
+
detail: "powershell.exe",
|
|
256
|
+
command: "powershell.exe",
|
|
257
|
+
args: /* @__PURE__ */ __name(() => toastArguments(), "args"),
|
|
258
|
+
env: /* @__PURE__ */ __name((base, title, body) => toastEnvironment(base, title, body, false), "env")
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
const mountRoot = probe.mountRoot ?? readWslMountRoot();
|
|
262
|
+
const wsl = detectWsl(env, { exists, list: /* @__PURE__ */ __name(() => [], "list"), mountRoot });
|
|
263
|
+
const wslKernel = !wsl && /microsoft/i.test((probe.osRelease ?? readOsRelease)() ?? "");
|
|
264
|
+
if (wsl || wslKernel) {
|
|
265
|
+
const enabled = wsl?.interop ?? exists("/proc/sys/fs/binfmt_misc/WSLInterop");
|
|
266
|
+
const socket = enabled ? env.WSL_INTEROP || findInteropSocket((probe.interopSockets ?? listInteropSockets)()) : void 0;
|
|
267
|
+
if (!socket) {
|
|
268
|
+
return {
|
|
269
|
+
kind: "none",
|
|
270
|
+
detail: enabled ? "WSL interop is not available to this process (no WSL_INTEROP and no interop socket under /run/WSL), so Windows notifications cannot be shown" : "WSL interop is disabled ([interop] enabled=false in /etc/wsl.conf), so Windows notifications cannot be shown"
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
const powershell = probe.powershell ?? `${wslSystem32(mountRoot)}/WindowsPowerShell/v1.0/powershell.exe`;
|
|
274
|
+
if (!exists(powershell)) return { kind: "none", detail: `${powershell} was not found` };
|
|
275
|
+
const found = env.WSL_INTEROP ? void 0 : socket;
|
|
276
|
+
return {
|
|
277
|
+
kind: "wsl-toast",
|
|
278
|
+
detail: found ? `${powershell} (interop through ${found})` : powershell,
|
|
279
|
+
command: powershell,
|
|
280
|
+
args: /* @__PURE__ */ __name(() => toastArguments(), "args"),
|
|
281
|
+
env: /* @__PURE__ */ __name((base, title, body) => ({
|
|
282
|
+
...toastEnvironment(base, title, body, true),
|
|
283
|
+
...found ? { WSL_INTEROP: found } : {}
|
|
284
|
+
}), "env"),
|
|
285
|
+
cwd: `${mountRoot}c`
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
const bus = env.DBUS_SESSION_BUS_ADDRESS || (env.XDG_RUNTIME_DIR && exists(join(env.XDG_RUNTIME_DIR, "bus")) ? "runtime-bus" : "");
|
|
289
|
+
if (!bus)
|
|
290
|
+
return { kind: "none", detail: "no desktop session bus (DBUS_SESSION_BUS_ADDRESS is unset)" };
|
|
291
|
+
const notifySend = which("notify-send");
|
|
292
|
+
if (notifySend)
|
|
293
|
+
return {
|
|
294
|
+
kind: "freedesktop",
|
|
295
|
+
detail: notifySend,
|
|
296
|
+
command: notifySend,
|
|
297
|
+
args: notifySendArguments
|
|
298
|
+
};
|
|
299
|
+
const gdbus = which("gdbus");
|
|
300
|
+
if (gdbus) return { kind: "freedesktop", detail: gdbus, command: gdbus, args: gdbusArguments };
|
|
301
|
+
return { kind: "none", detail: "neither notify-send nor gdbus is installed" };
|
|
302
|
+
}
|
|
303
|
+
__name(selectDesktopBackend, "selectDesktopBackend");
|
|
304
|
+
var defaultSpawn = /* @__PURE__ */ __name((command, args, options) => new Promise((resolve2) => {
|
|
305
|
+
execFile(
|
|
306
|
+
command,
|
|
307
|
+
[...args],
|
|
308
|
+
{
|
|
309
|
+
env: options.env,
|
|
310
|
+
...options.cwd ? { cwd: options.cwd } : {},
|
|
311
|
+
timeout: options.timeoutMs,
|
|
312
|
+
windowsHide: true
|
|
313
|
+
},
|
|
314
|
+
(error, _stdout, stderr) => {
|
|
315
|
+
const code = error ? typeof error.code === "number" ? error.code : 1 : 0;
|
|
316
|
+
resolve2({ code, stderr: String(stderr ?? "").slice(0, 500) });
|
|
317
|
+
}
|
|
318
|
+
);
|
|
319
|
+
}), "defaultSpawn");
|
|
320
|
+
async function sendDesktopNotification(backend, notification, options = {}) {
|
|
321
|
+
if (backend.kind === "none" || !backend.command || !backend.args) {
|
|
322
|
+
return { kind: "unavailable", detail: backend.detail };
|
|
323
|
+
}
|
|
324
|
+
const title = sanitizeLine(notification.title, 64);
|
|
325
|
+
const body = sanitizeLine(notification.body, 200);
|
|
326
|
+
const base = options.env ?? process.env;
|
|
327
|
+
const env = backend.env ? backend.env(base, title, body) : base;
|
|
328
|
+
try {
|
|
329
|
+
const result = await (options.spawn ?? defaultSpawn)(
|
|
330
|
+
backend.command,
|
|
331
|
+
backend.args(title, body),
|
|
332
|
+
{
|
|
333
|
+
env,
|
|
334
|
+
...backend.cwd ? { cwd: backend.cwd } : {},
|
|
335
|
+
timeoutMs: 15e3
|
|
336
|
+
}
|
|
337
|
+
);
|
|
338
|
+
return result.code === 0 ? { kind: "sent" } : { kind: "failed", detail: result.stderr || `exit ${String(result.code)}` };
|
|
339
|
+
} catch (error) {
|
|
340
|
+
return { kind: "failed", detail: error instanceof Error ? error.message : String(error) };
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
__name(sendDesktopNotification, "sendDesktopNotification");
|
|
344
|
+
|
|
345
|
+
// src/schedule/service/detect.ts
|
|
346
|
+
function detectPlatform(options = {}) {
|
|
347
|
+
const platform = options.platform ?? process.platform;
|
|
348
|
+
if (platform === "darwin") return { platform: "launchd" };
|
|
349
|
+
if (platform === "win32") return { platform: "windows-task" };
|
|
350
|
+
if (platform === "linux") {
|
|
351
|
+
if (detectWsl(options.env ?? process.env)) return { platform: "wsl-windows-task" };
|
|
352
|
+
if (options.systemdUser) return { platform: "systemd-user" };
|
|
353
|
+
return {
|
|
354
|
+
platform: null,
|
|
355
|
+
reason: "no systemd user manager answers here; run `namzu schedule daemon` under a supervisor of your own"
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
return { platform: null, reason: `${platform} has no supported supervisor` };
|
|
359
|
+
}
|
|
360
|
+
__name(detectPlatform, "detectPlatform");
|
|
361
|
+
|
|
362
|
+
// src/schedule/service/index.ts
|
|
363
|
+
import { mkdirSync as mkdirSync3, rmSync as rmSync3, rmdirSync, writeFileSync as writeFileSync3 } from "node:fs";
|
|
364
|
+
import { userInfo } from "node:os";
|
|
365
|
+
import { isAbsolute, join as join4 } from "node:path";
|
|
366
|
+
|
|
367
|
+
// src/schedule/service/launchd.ts
|
|
368
|
+
import { existsSync as existsSync2, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
369
|
+
import { homedir } from "node:os";
|
|
370
|
+
import { dirname, join as join2 } from "node:path";
|
|
371
|
+
|
|
372
|
+
// src/schedule/service/quote.ts
|
|
373
|
+
function systemdWord(text) {
|
|
374
|
+
const escaped = text.replaceAll("\\", "\\\\").replaceAll('"', '\\"').replaceAll("%", "%%").replaceAll("$", "$$$$");
|
|
375
|
+
return `"${escaped}"`;
|
|
376
|
+
}
|
|
377
|
+
__name(systemdWord, "systemdWord");
|
|
378
|
+
function systemdAssignment(key, value) {
|
|
379
|
+
return systemdWord(`${key}=${value}`);
|
|
380
|
+
}
|
|
381
|
+
__name(systemdAssignment, "systemdAssignment");
|
|
382
|
+
function xmlText(text) {
|
|
383
|
+
return text.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
384
|
+
}
|
|
385
|
+
__name(xmlText, "xmlText");
|
|
386
|
+
function windowsArgument(text) {
|
|
387
|
+
if (text !== "" && !/[\s"]/.test(text)) return text;
|
|
388
|
+
let out = '"';
|
|
389
|
+
let slashes = 0;
|
|
390
|
+
for (const ch of text) {
|
|
391
|
+
if (ch === "\\") {
|
|
392
|
+
slashes++;
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
395
|
+
if (ch === '"') {
|
|
396
|
+
out += `${"\\".repeat(slashes * 2 + 1)}"`;
|
|
397
|
+
} else {
|
|
398
|
+
out += "\\".repeat(slashes) + ch;
|
|
399
|
+
}
|
|
400
|
+
slashes = 0;
|
|
401
|
+
}
|
|
402
|
+
return `${out}${"\\".repeat(slashes * 2)}"`;
|
|
403
|
+
}
|
|
404
|
+
__name(windowsArgument, "windowsArgument");
|
|
405
|
+
var WSL_SAFE_PATH = /^[A-Za-z0-9._/@+-]+$/;
|
|
406
|
+
function checkWslPath(label, path) {
|
|
407
|
+
if (!WSL_SAFE_PATH.test(path)) {
|
|
408
|
+
throw new Error(
|
|
409
|
+
`${label} ${path} contains characters wsl.exe would re-read (only letters, digits and . _ / @ + - are passed through safely); install node and namzu under a plain path, or use --platform systemd-user`
|
|
410
|
+
);
|
|
411
|
+
}
|
|
412
|
+
return path;
|
|
413
|
+
}
|
|
414
|
+
__name(checkWslPath, "checkWslPath");
|
|
415
|
+
|
|
416
|
+
// src/schedule/service/launchd.ts
|
|
417
|
+
function launchdLabel(name) {
|
|
418
|
+
return name === "namzu-scheduler" ? "com.namzu.scheduler" : `com.namzu.${name.replace(/^namzu-/, "")}`;
|
|
419
|
+
}
|
|
420
|
+
__name(launchdLabel, "launchdLabel");
|
|
421
|
+
function launchdPlistPath(label, home = homedir()) {
|
|
422
|
+
return join2(home, "Library", "LaunchAgents", `${label}.plist`);
|
|
423
|
+
}
|
|
424
|
+
__name(launchdPlistPath, "launchdPlistPath");
|
|
425
|
+
function launchdPlist(label, program2) {
|
|
426
|
+
const args = [program2.node, program2.bin, "schedule", "daemon", "--home", program2.namzuHome];
|
|
427
|
+
const log = join2(program2.namzuHome, "schedule", "daemon");
|
|
428
|
+
return [
|
|
429
|
+
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
430
|
+
'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">',
|
|
431
|
+
'<plist version="1.0">',
|
|
432
|
+
"<dict>",
|
|
433
|
+
" <key>Label</key>",
|
|
434
|
+
` <string>${xmlText(label)}</string>`,
|
|
435
|
+
" <key>ProgramArguments</key>",
|
|
436
|
+
" <array>",
|
|
437
|
+
...args.map((a) => ` <string>${xmlText(a)}</string>`),
|
|
438
|
+
" </array>",
|
|
439
|
+
" <key>EnvironmentVariables</key>",
|
|
440
|
+
" <dict>",
|
|
441
|
+
" <key>NAMZU_HOME</key>",
|
|
442
|
+
` <string>${xmlText(program2.namzuHome)}</string>`,
|
|
443
|
+
" </dict>",
|
|
444
|
+
" <key>RunAtLoad</key>",
|
|
445
|
+
" <true/>",
|
|
446
|
+
" <key>KeepAlive</key>",
|
|
447
|
+
" <true/>",
|
|
448
|
+
" <key>ThrottleInterval</key>",
|
|
449
|
+
" <integer>10</integer>",
|
|
450
|
+
" <key>ProcessType</key>",
|
|
451
|
+
" <string>Background</string>",
|
|
452
|
+
" <key>AbandonProcessGroup</key>",
|
|
453
|
+
" <true/>",
|
|
454
|
+
" <key>LimitLoadToSessionType</key>",
|
|
455
|
+
" <string>Aqua</string>",
|
|
456
|
+
" <key>StandardOutPath</key>",
|
|
457
|
+
` <string>${xmlText(join2(log, "launchd.out.log"))}</string>`,
|
|
458
|
+
" <key>StandardErrorPath</key>",
|
|
459
|
+
` <string>${xmlText(join2(log, "launchd.err.log"))}</string>`,
|
|
460
|
+
"</dict>",
|
|
461
|
+
"</plist>",
|
|
462
|
+
""
|
|
463
|
+
].join("\n");
|
|
464
|
+
}
|
|
465
|
+
__name(launchdPlist, "launchdPlist");
|
|
466
|
+
async function installLaunchd(label, program2, steps, plistPath = launchdPlistPath(label)) {
|
|
467
|
+
mkdirSync(dirname(plistPath), { recursive: true });
|
|
468
|
+
writeFileSync(plistPath, launchdPlist(label, program2), { mode: 420 });
|
|
469
|
+
for (const domain of [`gui/${steps.uid}`, `user/${steps.uid}`]) {
|
|
470
|
+
await steps.run("launchctl", ["bootout", `${domain}/${label}`]);
|
|
471
|
+
const result = await steps.run("launchctl", ["bootstrap", domain, plistPath]);
|
|
472
|
+
if (result.code === 0) return { domain, problems: [] };
|
|
473
|
+
}
|
|
474
|
+
return { domain: `gui/${steps.uid}`, problems: [`launchctl bootstrap failed for ${plistPath}`] };
|
|
475
|
+
}
|
|
476
|
+
__name(installLaunchd, "installLaunchd");
|
|
477
|
+
async function uninstallLaunchd(label, domain, steps, plistPath = launchdPlistPath(label)) {
|
|
478
|
+
await steps.run("launchctl", ["bootout", `${domain}/${label}`]);
|
|
479
|
+
rmSync(plistPath, { force: true });
|
|
480
|
+
const problems = [];
|
|
481
|
+
if (existsSync2(plistPath)) problems.push(`${plistPath} is still there`);
|
|
482
|
+
const printed = await steps.run("launchctl", ["print", `${domain}/${label}`]);
|
|
483
|
+
if (printed.code === 0) problems.push(`${label} is still loaded in ${domain}`);
|
|
484
|
+
return problems;
|
|
485
|
+
}
|
|
486
|
+
__name(uninstallLaunchd, "uninstallLaunchd");
|
|
487
|
+
|
|
488
|
+
// src/schedule/service/systemd.ts
|
|
489
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync2, rmSync as rmSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
490
|
+
import { homedir as homedir2 } from "node:os";
|
|
491
|
+
import { dirname as dirname2, join as join3 } from "node:path";
|
|
492
|
+
function systemdUnitPath(name, env = process.env, home = homedir2()) {
|
|
493
|
+
const config = env.XDG_CONFIG_HOME || join3(home, ".config");
|
|
494
|
+
return join3(config, "systemd", "user", `${name}.service`);
|
|
495
|
+
}
|
|
496
|
+
__name(systemdUnitPath, "systemdUnitPath");
|
|
497
|
+
function systemdUnit(program2) {
|
|
498
|
+
return [
|
|
499
|
+
"[Unit]",
|
|
500
|
+
`Description=namzu scheduler (NAMZU_HOME=${program2.namzuHome.replaceAll("%", "%%")})`,
|
|
501
|
+
"Documentation=https://github.com/cogitave/namzu/blob/main/docs/cli/scheduler-service.md",
|
|
502
|
+
"StartLimitIntervalSec=0",
|
|
503
|
+
"",
|
|
504
|
+
"[Service]",
|
|
505
|
+
"Type=simple",
|
|
506
|
+
`ExecStart=${[program2.node, program2.bin, "schedule", "daemon", "--home", program2.namzuHome].map(systemdWord).join(" ")}`,
|
|
507
|
+
`Environment=${systemdAssignment("NAMZU_HOME", program2.namzuHome)}`,
|
|
508
|
+
"Restart=always",
|
|
509
|
+
"RestartSec=10",
|
|
510
|
+
`SuccessExitStatus=${EXIT_STOP_REQUESTED}`,
|
|
511
|
+
`RestartPreventExitStatus=${EXIT_STOP_REQUESTED}`,
|
|
512
|
+
"KillMode=process",
|
|
513
|
+
"TimeoutStopSec=20",
|
|
514
|
+
"",
|
|
515
|
+
"[Install]",
|
|
516
|
+
"WantedBy=default.target",
|
|
517
|
+
""
|
|
518
|
+
].join("\n");
|
|
519
|
+
}
|
|
520
|
+
__name(systemdUnit, "systemdUnit");
|
|
521
|
+
async function systemctl(steps, ...args) {
|
|
522
|
+
return steps.run(steps.systemctl ?? "systemctl", ["--user", ...args]);
|
|
523
|
+
}
|
|
524
|
+
__name(systemctl, "systemctl");
|
|
525
|
+
async function installSystemd(name, program2, steps, unitPath = systemdUnitPath(name)) {
|
|
526
|
+
mkdirSync2(dirname2(unitPath), { recursive: true });
|
|
527
|
+
writeFileSync2(unitPath, systemdUnit(program2), { mode: 420 });
|
|
528
|
+
const problems = [];
|
|
529
|
+
for (const args of [["daemon-reload"], ["enable", "--now", `${name}.service`]]) {
|
|
530
|
+
const result = await systemctl(steps, ...args);
|
|
531
|
+
if (result.code !== 0)
|
|
532
|
+
problems.push(
|
|
533
|
+
`systemctl --user ${args.join(" ")}: ${result.stderr.trim() || `exit ${result.code}`}`
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
return problems;
|
|
537
|
+
}
|
|
538
|
+
__name(installSystemd, "installSystemd");
|
|
539
|
+
async function uninstallSystemd(name, steps, unitPath = systemdUnitPath(name)) {
|
|
540
|
+
const problems = [];
|
|
541
|
+
await systemctl(steps, "disable", "--now", `${name}.service`);
|
|
542
|
+
rmSync2(unitPath, { force: true });
|
|
543
|
+
await systemctl(steps, "daemon-reload");
|
|
544
|
+
await systemctl(steps, "reset-failed", `${name}.service`);
|
|
545
|
+
if (existsSync3(unitPath)) problems.push(`${unitPath} is still there`);
|
|
546
|
+
const shown = await systemctl(steps, "show", `${name}.service`, "--property=LoadState");
|
|
547
|
+
if (shown.code === 0 && /LoadState=loaded/.test(shown.stdout))
|
|
548
|
+
problems.push(`${name}.service is still loaded`);
|
|
549
|
+
return problems;
|
|
550
|
+
}
|
|
551
|
+
__name(uninstallSystemd, "uninstallSystemd");
|
|
552
|
+
async function systemdState(name, steps) {
|
|
553
|
+
const result = await systemctl(steps, "is-active", `${name}.service`);
|
|
554
|
+
return result.stdout.trim() || result.stderr.trim() || "unknown";
|
|
555
|
+
}
|
|
556
|
+
__name(systemdState, "systemdState");
|
|
557
|
+
async function startSystemd(name, steps) {
|
|
558
|
+
const result = await systemctl(steps, "enable", "--now", `${name}.service`);
|
|
559
|
+
return result.code === 0 ? [] : [result.stderr.trim() || `exit ${result.code}`];
|
|
560
|
+
}
|
|
561
|
+
__name(startSystemd, "startSystemd");
|
|
562
|
+
async function stopSystemd(name, steps) {
|
|
563
|
+
const result = await systemctl(steps, "disable", "--now", `${name}.service`);
|
|
564
|
+
return result.code === 0 ? [] : [result.stderr.trim() || `exit ${result.code}`];
|
|
565
|
+
}
|
|
566
|
+
__name(stopSystemd, "stopSystemd");
|
|
567
|
+
async function systemdUserAvailable(steps) {
|
|
568
|
+
if (!existsSync3("/run/systemd/system")) return false;
|
|
569
|
+
const result = await systemctl(steps, "show-environment");
|
|
570
|
+
return result.code === 0;
|
|
571
|
+
}
|
|
572
|
+
__name(systemdUserAvailable, "systemdUserAvailable");
|
|
573
|
+
|
|
574
|
+
// src/schedule/service/windows-task.ts
|
|
575
|
+
function taskXml(task) {
|
|
576
|
+
const start = task.startBoundary ?? "2026-01-01T00:00:00";
|
|
577
|
+
return [
|
|
578
|
+
'<?xml version="1.0" encoding="UTF-16"?>',
|
|
579
|
+
'<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">',
|
|
580
|
+
" <RegistrationInfo>",
|
|
581
|
+
` <Description>${xmlText(task.description)}</Description>`,
|
|
582
|
+
` <Author>${xmlText(task.userId)}</Author>`,
|
|
583
|
+
" </RegistrationInfo>",
|
|
584
|
+
" <Triggers>",
|
|
585
|
+
" <LogonTrigger>",
|
|
586
|
+
" <Enabled>true</Enabled>",
|
|
587
|
+
` <UserId>${xmlText(task.userId)}</UserId>`,
|
|
588
|
+
" </LogonTrigger>",
|
|
589
|
+
" <TimeTrigger>",
|
|
590
|
+
" <Repetition>",
|
|
591
|
+
" <Interval>PT5M</Interval>",
|
|
592
|
+
" <StopAtDurationEnd>false</StopAtDurationEnd>",
|
|
593
|
+
" </Repetition>",
|
|
594
|
+
` <StartBoundary>${xmlText(start)}</StartBoundary>`,
|
|
595
|
+
" <Enabled>true</Enabled>",
|
|
596
|
+
" </TimeTrigger>",
|
|
597
|
+
" </Triggers>",
|
|
598
|
+
" <Principals>",
|
|
599
|
+
' <Principal id="Author">',
|
|
600
|
+
` <UserId>${xmlText(task.userId)}</UserId>`,
|
|
601
|
+
" <LogonType>InteractiveToken</LogonType>",
|
|
602
|
+
" <RunLevel>LeastPrivilege</RunLevel>",
|
|
603
|
+
" </Principal>",
|
|
604
|
+
" </Principals>",
|
|
605
|
+
" <Settings>",
|
|
606
|
+
" <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>",
|
|
607
|
+
" <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>",
|
|
608
|
+
" <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>",
|
|
609
|
+
" <AllowHardTerminate>true</AllowHardTerminate>",
|
|
610
|
+
" <StartWhenAvailable>true</StartWhenAvailable>",
|
|
611
|
+
" <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>",
|
|
612
|
+
" <IdleSettings>",
|
|
613
|
+
" <StopOnIdleEnd>false</StopOnIdleEnd>",
|
|
614
|
+
" <RestartOnIdle>false</RestartOnIdle>",
|
|
615
|
+
" </IdleSettings>",
|
|
616
|
+
" <AllowStartOnDemand>true</AllowStartOnDemand>",
|
|
617
|
+
" <Enabled>true</Enabled>",
|
|
618
|
+
" <Hidden>false</Hidden>",
|
|
619
|
+
" <RunOnlyIfIdle>false</RunOnlyIfIdle>",
|
|
620
|
+
" <WakeToRun>false</WakeToRun>",
|
|
621
|
+
" <ExecutionTimeLimit>PT0S</ExecutionTimeLimit>",
|
|
622
|
+
" <Priority>7</Priority>",
|
|
623
|
+
" </Settings>",
|
|
624
|
+
' <Actions Context="Author">',
|
|
625
|
+
" <Exec>",
|
|
626
|
+
` <Command>${xmlText(task.command)}</Command>`,
|
|
627
|
+
` <Arguments>${xmlText(task.args.map(windowsArgument).join(" "))}</Arguments>`,
|
|
628
|
+
" </Exec>",
|
|
629
|
+
" </Actions>",
|
|
630
|
+
"</Task>",
|
|
631
|
+
""
|
|
632
|
+
].join("\r\n");
|
|
633
|
+
}
|
|
634
|
+
__name(taskXml, "taskXml");
|
|
635
|
+
function taskXmlBytes(xml) {
|
|
636
|
+
return Buffer.concat([Buffer.from([255, 254]), Buffer.from(xml, "utf16le")]);
|
|
637
|
+
}
|
|
638
|
+
__name(taskXmlBytes, "taskXmlBytes");
|
|
639
|
+
function taskPath(name) {
|
|
640
|
+
return `\\namzu\\${name}`;
|
|
641
|
+
}
|
|
642
|
+
__name(taskPath, "taskPath");
|
|
643
|
+
var REMOVE_EMPTY_TASK_FOLDER_SCRIPT = [
|
|
644
|
+
"$ErrorActionPreference = 'Stop'",
|
|
645
|
+
"$s = New-Object -ComObject Schedule.Service",
|
|
646
|
+
"$s.Connect()",
|
|
647
|
+
"try { $f = $s.GetFolder('\\namzu') } catch { exit 0 }",
|
|
648
|
+
"if ($f.GetTasks(1).Count -gt 0 -or $f.GetFolders(0).Count -gt 0) { exit 0 }",
|
|
649
|
+
"try { $s.GetFolder('\\').DeleteFolder('namzu', 0) } catch { exit 1 }",
|
|
650
|
+
"exit 0"
|
|
651
|
+
].join("; ");
|
|
652
|
+
function removeEmptyTaskFolderArguments() {
|
|
653
|
+
return [
|
|
654
|
+
"-NoProfile",
|
|
655
|
+
"-NonInteractive",
|
|
656
|
+
"-ExecutionPolicy",
|
|
657
|
+
"Bypass",
|
|
658
|
+
"-EncodedCommand",
|
|
659
|
+
Buffer.from(REMOVE_EMPTY_TASK_FOLDER_SCRIPT, "utf16le").toString("base64")
|
|
660
|
+
];
|
|
661
|
+
}
|
|
662
|
+
__name(removeEmptyTaskFolderArguments, "removeEmptyTaskFolderArguments");
|
|
663
|
+
var TASK_RESULTS = /* @__PURE__ */ new Map([
|
|
664
|
+
[0, "succeeded"],
|
|
665
|
+
[267008, "ready to run"],
|
|
666
|
+
[267009, "running"],
|
|
667
|
+
[267010, "disabled"],
|
|
668
|
+
[267011, "not run yet"],
|
|
669
|
+
[267012, "no more runs scheduled"],
|
|
670
|
+
[267014, "ended by a person or a stop"],
|
|
671
|
+
[267015, "no trigger is enabled"],
|
|
672
|
+
[2147750687, "an instance was already running, so a new one was not started"],
|
|
673
|
+
// IgnoreNew answers the five-minute re-check this way while the
|
|
674
|
+
// scheduler runs: the expected result, not a failure.
|
|
675
|
+
[
|
|
676
|
+
2147946720,
|
|
677
|
+
"an instance was already running, so a new one was not started; expected, since the task checks every five minutes"
|
|
678
|
+
],
|
|
679
|
+
[2147750694, "the task is disabled"],
|
|
680
|
+
[2147942402, "the program was not found"],
|
|
681
|
+
[2147942405, "access was denied"],
|
|
682
|
+
[2147942667, "the start folder is not valid"],
|
|
683
|
+
[2147943645, "the user was not logged on"],
|
|
684
|
+
[3221225786, "ended when its console closed"],
|
|
685
|
+
[1073807364, "ended by a sign-out or shutdown"]
|
|
686
|
+
]);
|
|
687
|
+
var DAEMON_EXITS = /* @__PURE__ */ new Map([
|
|
688
|
+
[1, "the program exited with an error; see namzu schedule logs"],
|
|
689
|
+
[75, "the scheduler exited: another one owns this NAMZU_HOME"],
|
|
690
|
+
[EXIT_STOP_REQUESTED, "the scheduler exited: namzu schedule stop asked it to"]
|
|
691
|
+
]);
|
|
692
|
+
function describeTaskResult(raw) {
|
|
693
|
+
const text = raw.trim();
|
|
694
|
+
let value;
|
|
695
|
+
if (/^0x[0-9a-f]{1,8}$/i.test(text)) value = Number.parseInt(text.slice(2), 16);
|
|
696
|
+
else if (/^-?\d{1,10}$/.test(text)) value = Number(text);
|
|
697
|
+
else return text;
|
|
698
|
+
const code = value >>> 0;
|
|
699
|
+
const hex = `0x${code.toString(16).toUpperCase()}`;
|
|
700
|
+
const number = code < 256 || /^0x/i.test(text) ? text : `${text}, ${hex}`;
|
|
701
|
+
const words = TASK_RESULTS.get(code) ?? DAEMON_EXITS.get(code) ?? (code < 256 ? "the program exited" : void 0);
|
|
702
|
+
if (words !== void 0) return `${words} (${number})`;
|
|
703
|
+
return number === text ? text : `${text} (${hex})`;
|
|
704
|
+
}
|
|
705
|
+
__name(describeTaskResult, "describeTaskResult");
|
|
706
|
+
function parseTaskQuery(output) {
|
|
707
|
+
const field = /* @__PURE__ */ __name((label) => {
|
|
708
|
+
for (const line of output.split(/\r?\n/)) {
|
|
709
|
+
const match = /^([^:]+):\s*(.*)$/.exec(line);
|
|
710
|
+
if (match && label.test((match[1] ?? "").trim())) return (match[2] ?? "").trim();
|
|
711
|
+
}
|
|
712
|
+
return void 0;
|
|
713
|
+
}, "field");
|
|
714
|
+
const status = field(/^Status$/i);
|
|
715
|
+
const state = field(/^Scheduled Task State$/i);
|
|
716
|
+
const lastResult = field(/^Last Result$/i);
|
|
717
|
+
return {
|
|
718
|
+
...status !== void 0 ? { status } : {},
|
|
719
|
+
...state !== void 0 ? { state } : {},
|
|
720
|
+
...lastResult !== void 0 ? { lastResult } : {}
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
__name(parseTaskQuery, "parseTaskQuery");
|
|
724
|
+
|
|
725
|
+
// src/schedule/service/wsl.ts
|
|
726
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
727
|
+
var DEFAULT_SYSTEM32 = wslSystem32();
|
|
728
|
+
function windowsTools(system32 = wslSystem32(readWslMountRoot())) {
|
|
729
|
+
const systemRoot = system32.replace(/\/System32$/i, "");
|
|
730
|
+
const drive = systemRoot.replace(/\/Windows$/i, "");
|
|
731
|
+
return {
|
|
732
|
+
mountRoot: drive.replace(/[^/]+$/, ""),
|
|
733
|
+
drive,
|
|
734
|
+
systemRoot,
|
|
735
|
+
cmd: `${system32}/cmd.exe`,
|
|
736
|
+
schtasks: `${system32}/schtasks.exe`,
|
|
737
|
+
powershell: `${system32}/WindowsPowerShell/v1.0/powershell.exe`,
|
|
738
|
+
whoami: `${system32}/whoami.exe`,
|
|
739
|
+
conhost: `${system32}/conhost.exe`,
|
|
740
|
+
wsl: `${system32}/wsl.exe`
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
__name(windowsTools, "windowsTools");
|
|
744
|
+
async function probeInterop(run, tools, env = process.env) {
|
|
745
|
+
if (!existsSync4(tools.cmd))
|
|
746
|
+
return { ok: false, reason: `${tools.cmd} was not found (is C: mounted at ${tools.drive}?)` };
|
|
747
|
+
if (!env.WSL_INTEROP && !existsSync4("/proc/sys/fs/binfmt_misc/WSLInterop")) {
|
|
748
|
+
return {
|
|
749
|
+
ok: false,
|
|
750
|
+
reason: "WSL interop is disabled ([interop] enabled=false in /etc/wsl.conf)"
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
const result = await run(tools.cmd, ["/d", "/c", "ver"], { timeoutMs: 2e4, cwd: tools.drive });
|
|
754
|
+
return result.code === 0 ? { ok: true } : {
|
|
755
|
+
ok: false,
|
|
756
|
+
reason: `a Windows program did not start through interop (${result.stderr.trim() || `exit ${result.code}`})`
|
|
757
|
+
};
|
|
758
|
+
}
|
|
759
|
+
__name(probeInterop, "probeInterop");
|
|
760
|
+
async function windowsUser(run, tools) {
|
|
761
|
+
const result = await run(tools.whoami, [], { timeoutMs: 2e4, cwd: tools.drive });
|
|
762
|
+
const user = result.stdout.trim();
|
|
763
|
+
if (result.code !== 0 || !/^[^\\\s]+\\[^\\\s]+$/.test(user)) {
|
|
764
|
+
throw new Error(
|
|
765
|
+
`could not read the Windows user from whoami.exe (${result.stderr.trim() || user || `exit ${result.code}`})`
|
|
766
|
+
);
|
|
767
|
+
}
|
|
768
|
+
return user;
|
|
769
|
+
}
|
|
770
|
+
__name(windowsUser, "windowsUser");
|
|
771
|
+
async function toWindowsPath(run, path) {
|
|
772
|
+
const result = await run("wslpath", ["-w", path], { timeoutMs: 1e4 });
|
|
773
|
+
if (result.code !== 0 || !result.stdout.trim()) throw new Error(`wslpath -w ${path} failed`);
|
|
774
|
+
return result.stdout.trim();
|
|
775
|
+
}
|
|
776
|
+
__name(toWindowsPath, "toWindowsPath");
|
|
777
|
+
function isEphemeralBin(bin) {
|
|
778
|
+
return /[\\/]_npx[\\/]/.test(bin) || /[\\/]\.npm[\\/]_cacache[\\/]/.test(bin);
|
|
779
|
+
}
|
|
780
|
+
__name(isEphemeralBin, "isEphemeralBin");
|
|
781
|
+
function wslTaskName(name, distro) {
|
|
782
|
+
return `${name}-wsl-${distro.replace(/[^A-Za-z0-9._-]/g, "_")}`;
|
|
783
|
+
}
|
|
784
|
+
__name(wslTaskName, "wslTaskName");
|
|
785
|
+
function wslTaskDefinition(options) {
|
|
786
|
+
checkWslPath("node", options.node);
|
|
787
|
+
checkWslPath("the namzu CLI", options.bin);
|
|
788
|
+
checkWslPath("NAMZU_HOME", options.namzuHome);
|
|
789
|
+
if (!/^[A-Za-z0-9._-]+$/.test(options.distro))
|
|
790
|
+
throw new Error(`unusual WSL distro name: ${options.distro}`);
|
|
791
|
+
if (!/^[a-z_][a-z0-9_-]*\$?$/i.test(options.linuxUser))
|
|
792
|
+
throw new Error(`unusual Linux user name: ${options.linuxUser}`);
|
|
793
|
+
const root = options.systemRoot ?? "C:\\Windows";
|
|
794
|
+
return {
|
|
795
|
+
userId: options.userId,
|
|
796
|
+
description: `namzu scheduler for NAMZU_HOME=${options.namzuHome} in WSL ${options.distro}`,
|
|
797
|
+
command: `${root}\\System32\\conhost.exe`,
|
|
798
|
+
args: [
|
|
799
|
+
"--headless",
|
|
800
|
+
`${root}\\System32\\wsl.exe`,
|
|
801
|
+
"-d",
|
|
802
|
+
options.distro,
|
|
803
|
+
"-u",
|
|
804
|
+
options.linuxUser,
|
|
805
|
+
"--cd",
|
|
806
|
+
"/",
|
|
807
|
+
"--exec",
|
|
808
|
+
"/usr/bin/env",
|
|
809
|
+
`NAMZU_HOME=${options.namzuHome}`,
|
|
810
|
+
options.node,
|
|
811
|
+
options.bin,
|
|
812
|
+
"schedule",
|
|
813
|
+
"daemon",
|
|
814
|
+
"--home",
|
|
815
|
+
options.namzuHome
|
|
816
|
+
]
|
|
817
|
+
};
|
|
818
|
+
}
|
|
819
|
+
__name(wslTaskDefinition, "wslTaskDefinition");
|
|
820
|
+
|
|
821
|
+
// src/schedule/service/index.ts
|
|
822
|
+
function windowsCwd(ctx, manifest) {
|
|
823
|
+
return manifest.platform === "wsl-windows-task" ? { cwd: (ctx.tools ?? windowsTools()).drive } : {};
|
|
824
|
+
}
|
|
825
|
+
__name(windowsCwd, "windowsCwd");
|
|
826
|
+
var ServiceRefusal = class extends Error {
|
|
827
|
+
static {
|
|
828
|
+
__name(this, "ServiceRefusal");
|
|
829
|
+
}
|
|
830
|
+
name = "ServiceRefusal";
|
|
831
|
+
};
|
|
832
|
+
function refuseUnsafeProgram(program2) {
|
|
833
|
+
if (!isAbsolute(program2.node) && !/^[A-Za-z]:\\/.test(program2.node)) {
|
|
834
|
+
throw new ServiceRefusal(`node must be an absolute path, got ${program2.node}`);
|
|
835
|
+
}
|
|
836
|
+
if (isEphemeralBin(program2.bin)) {
|
|
837
|
+
throw new ServiceRefusal(
|
|
838
|
+
`namzu is running from the npx cache (${program2.bin}), which is not kept; install it (npm i -g @namzu/cli) and run schedule install from that`
|
|
839
|
+
);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
__name(refuseUnsafeProgram, "refuseUnsafeProgram");
|
|
843
|
+
async function lingerEnabled(run, user) {
|
|
844
|
+
const result = await run("loginctl", ["show-user", user, "-p", "Linger"]);
|
|
845
|
+
return /Linger=yes/.test(result.stdout);
|
|
846
|
+
}
|
|
847
|
+
__name(lingerEnabled, "lingerEnabled");
|
|
848
|
+
async function installService(ctx, request) {
|
|
849
|
+
refuseUnsafeProgram(request.program);
|
|
850
|
+
const { paths, run } = ctx;
|
|
851
|
+
const notes = [];
|
|
852
|
+
const base = {
|
|
853
|
+
v: 1,
|
|
854
|
+
kind: "schedule-service",
|
|
855
|
+
platform: request.platform,
|
|
856
|
+
name: request.name,
|
|
857
|
+
installedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
858
|
+
cliVersion: ctx.version,
|
|
859
|
+
nodePath: request.program.node,
|
|
860
|
+
binPath: request.program.bin,
|
|
861
|
+
namzuHome: request.program.namzuHome
|
|
862
|
+
};
|
|
863
|
+
switch (request.platform) {
|
|
864
|
+
case "systemd-user": {
|
|
865
|
+
const unit = systemdUnitPath(request.name, ctx.env);
|
|
866
|
+
const problems = await installSystemd(request.name, request.program, { run }, unit);
|
|
867
|
+
let enabledLinger = false;
|
|
868
|
+
if (request.atBoot) {
|
|
869
|
+
const user = userInfo().username;
|
|
870
|
+
if (!await lingerEnabled(run, user)) {
|
|
871
|
+
const result = await run("loginctl", ["enable-linger", user]);
|
|
872
|
+
if (result.code === 0) enabledLinger = true;
|
|
873
|
+
else
|
|
874
|
+
problems.push(
|
|
875
|
+
`loginctl enable-linger ${user}: ${result.stderr.trim() || `exit ${result.code}`}`
|
|
876
|
+
);
|
|
877
|
+
}
|
|
878
|
+
} else {
|
|
879
|
+
notes.push(
|
|
880
|
+
"The daemon starts when you log in; --at-boot keeps it running without a login (linger)."
|
|
881
|
+
);
|
|
882
|
+
}
|
|
883
|
+
const manifest = {
|
|
884
|
+
...base,
|
|
885
|
+
enabledLinger,
|
|
886
|
+
artifacts: [
|
|
887
|
+
{ type: "file", path: unit },
|
|
888
|
+
{ type: "systemd-unit", name: `${request.name}.service` }
|
|
889
|
+
]
|
|
890
|
+
};
|
|
891
|
+
writeManifest(paths, manifest);
|
|
892
|
+
return { manifest, problems, notes };
|
|
893
|
+
}
|
|
894
|
+
case "launchd": {
|
|
895
|
+
const label = launchdLabel(request.name);
|
|
896
|
+
const plist = launchdPlistPath(label);
|
|
897
|
+
const { domain, problems } = await installLaunchd(
|
|
898
|
+
label,
|
|
899
|
+
request.program,
|
|
900
|
+
{
|
|
901
|
+
run,
|
|
902
|
+
uid: process.getuid?.() ?? 501
|
|
903
|
+
},
|
|
904
|
+
plist
|
|
905
|
+
);
|
|
906
|
+
const manifest = {
|
|
907
|
+
...base,
|
|
908
|
+
artifacts: [
|
|
909
|
+
{ type: "file", path: plist },
|
|
910
|
+
{ type: "launchd-agent", label, domain }
|
|
911
|
+
]
|
|
912
|
+
};
|
|
913
|
+
writeManifest(paths, manifest);
|
|
914
|
+
notes.push("A LaunchAgent starts at login, not at boot.");
|
|
915
|
+
return { manifest, problems, notes };
|
|
916
|
+
}
|
|
917
|
+
case "windows-task": {
|
|
918
|
+
const root = ctx.env.SystemRoot ?? "C:\\Windows";
|
|
919
|
+
const schtasks = `${root}\\System32\\schtasks.exe`;
|
|
920
|
+
const who = await run(`${root}\\System32\\whoami.exe`, []);
|
|
921
|
+
const userId = who.stdout.trim();
|
|
922
|
+
if (who.code !== 0 || !userId.includes("\\"))
|
|
923
|
+
throw new ServiceRefusal("could not read the Windows user from whoami.exe");
|
|
924
|
+
const path = taskPath(request.name);
|
|
925
|
+
const xml = taskXml({
|
|
926
|
+
userId,
|
|
927
|
+
description: `namzu scheduler for NAMZU_HOME=${request.program.namzuHome}`,
|
|
928
|
+
command: `${root}\\System32\\conhost.exe`,
|
|
929
|
+
args: [
|
|
930
|
+
"--headless",
|
|
931
|
+
request.program.node,
|
|
932
|
+
request.program.bin,
|
|
933
|
+
"schedule",
|
|
934
|
+
"daemon",
|
|
935
|
+
"--home",
|
|
936
|
+
request.program.namzuHome
|
|
937
|
+
]
|
|
938
|
+
});
|
|
939
|
+
const file = join4(paths.daemon, `${request.name}.task.xml`);
|
|
940
|
+
mkdirSync3(paths.daemon, { recursive: true });
|
|
941
|
+
writeFileSync3(file, taskXmlBytes(xml));
|
|
942
|
+
const problems = [];
|
|
943
|
+
try {
|
|
944
|
+
const created = await run(schtasks, ["/Create", "/TN", path, "/XML", file, "/F"]);
|
|
945
|
+
if (created.code !== 0)
|
|
946
|
+
problems.push(`schtasks /Create: ${created.stderr.trim() || created.stdout.trim()}`);
|
|
947
|
+
else await run(schtasks, ["/Run", "/TN", path]);
|
|
948
|
+
} finally {
|
|
949
|
+
rmSync3(file, { force: true });
|
|
950
|
+
}
|
|
951
|
+
const manifest = {
|
|
952
|
+
...base,
|
|
953
|
+
artifacts: [{ type: "windows-task", taskPath: path }],
|
|
954
|
+
windows: { taskPath: path, schtasks }
|
|
955
|
+
};
|
|
956
|
+
writeManifest(paths, manifest);
|
|
957
|
+
notes.push("The task starts at logon; jobs run while you are logged on.");
|
|
958
|
+
return { manifest, problems, notes };
|
|
959
|
+
}
|
|
960
|
+
case "wsl-windows-task": {
|
|
961
|
+
const tools = ctx.tools ?? windowsTools();
|
|
962
|
+
const interop = await probeInterop(run, tools, ctx.env);
|
|
963
|
+
if (!interop.ok)
|
|
964
|
+
throw new ServiceRefusal(
|
|
965
|
+
`WSL interop is not usable: ${interop.reason}. Use --platform systemd-user instead.`
|
|
966
|
+
);
|
|
967
|
+
const distro = ctx.env.WSL_DISTRO_NAME;
|
|
968
|
+
if (!distro)
|
|
969
|
+
throw new ServiceRefusal("WSL_DISTRO_NAME is not set; cannot name the distro for wsl.exe");
|
|
970
|
+
const userId = await windowsUser(run, tools);
|
|
971
|
+
const definition = wslTaskDefinition({
|
|
972
|
+
userId,
|
|
973
|
+
distro,
|
|
974
|
+
linuxUser: userInfo().username,
|
|
975
|
+
node: request.program.node,
|
|
976
|
+
bin: request.program.bin,
|
|
977
|
+
namzuHome: request.program.namzuHome
|
|
978
|
+
});
|
|
979
|
+
const name = wslTaskName(request.name, distro);
|
|
980
|
+
const path = taskPath(name);
|
|
981
|
+
const localAppData = (await run(tools.cmd, ["/d", "/c", "echo", "%LOCALAPPDATA%"], { cwd: tools.drive })).stdout.trim();
|
|
982
|
+
if (!/^[A-Za-z]:\\/.test(localAppData))
|
|
983
|
+
throw new ServiceRefusal("could not resolve %LOCALAPPDATA% through interop");
|
|
984
|
+
const linuxDir = (await run("wslpath", ["-u", `${localAppData}\\namzu`])).stdout.trim();
|
|
985
|
+
if (!linuxDir.startsWith(tools.mountRoot))
|
|
986
|
+
throw new ServiceRefusal(`could not map ${localAppData} into WSL`);
|
|
987
|
+
mkdirSync3(linuxDir, { recursive: true });
|
|
988
|
+
const linuxFile = join4(linuxDir, `${name}.xml`);
|
|
989
|
+
writeFileSync3(linuxFile, taskXmlBytes(taskXml(definition)));
|
|
990
|
+
const problems = [];
|
|
991
|
+
try {
|
|
992
|
+
const windowsFile = await toWindowsPath(run, linuxFile);
|
|
993
|
+
const created = await run(
|
|
994
|
+
tools.schtasks,
|
|
995
|
+
["/Create", "/TN", path, "/XML", windowsFile, "/F"],
|
|
996
|
+
{ cwd: tools.drive }
|
|
997
|
+
);
|
|
998
|
+
if (created.code !== 0)
|
|
999
|
+
problems.push(`schtasks.exe /Create: ${created.stderr.trim() || created.stdout.trim()}`);
|
|
1000
|
+
else {
|
|
1001
|
+
const started = await run(tools.schtasks, ["/Run", "/TN", path], { cwd: tools.drive });
|
|
1002
|
+
if (started.code !== 0)
|
|
1003
|
+
problems.push(`schtasks.exe /Run: ${started.stderr.trim() || started.stdout.trim()}`);
|
|
1004
|
+
}
|
|
1005
|
+
} finally {
|
|
1006
|
+
rmSync3(linuxFile, { force: true });
|
|
1007
|
+
try {
|
|
1008
|
+
rmdirSync(linuxDir);
|
|
1009
|
+
} catch {
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
const manifest = {
|
|
1013
|
+
...base,
|
|
1014
|
+
name,
|
|
1015
|
+
artifacts: [{ type: "windows-task", taskPath: path }],
|
|
1016
|
+
windows: {
|
|
1017
|
+
taskPath: path,
|
|
1018
|
+
schtasks: tools.schtasks,
|
|
1019
|
+
powershell: tools.powershell,
|
|
1020
|
+
distro,
|
|
1021
|
+
user: userId
|
|
1022
|
+
}
|
|
1023
|
+
};
|
|
1024
|
+
writeManifest(paths, manifest);
|
|
1025
|
+
notes.push(
|
|
1026
|
+
"Windows Task Scheduler starts the daemon in this distro at logon and re-checks it every 5 minutes; jobs run while you are logged on to Windows."
|
|
1027
|
+
);
|
|
1028
|
+
return { manifest, problems, notes };
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
__name(installService, "installService");
|
|
1033
|
+
async function removeArtifact(ctx, manifest, artifact) {
|
|
1034
|
+
switch (artifact.type) {
|
|
1035
|
+
case "file":
|
|
1036
|
+
rmSync3(artifact.path, { force: true });
|
|
1037
|
+
return [];
|
|
1038
|
+
case "systemd-unit": {
|
|
1039
|
+
const unitFile = manifest.artifacts.find((a) => a.type === "file");
|
|
1040
|
+
return uninstallSystemd(
|
|
1041
|
+
artifact.name.replace(/\.service$/, ""),
|
|
1042
|
+
{ run: ctx.run },
|
|
1043
|
+
unitFile?.type === "file" ? unitFile.path : systemdUnitPath(manifest.name, ctx.env)
|
|
1044
|
+
);
|
|
1045
|
+
}
|
|
1046
|
+
case "launchd-agent":
|
|
1047
|
+
return uninstallLaunchd(artifact.label, artifact.domain, {
|
|
1048
|
+
run: ctx.run,
|
|
1049
|
+
uid: process.getuid?.() ?? 501
|
|
1050
|
+
});
|
|
1051
|
+
case "windows-task": {
|
|
1052
|
+
const schtasks = manifest.windows?.schtasks ?? "schtasks.exe";
|
|
1053
|
+
const cwd = windowsCwd(ctx, manifest);
|
|
1054
|
+
await ctx.run(schtasks, ["/End", "/TN", artifact.taskPath], cwd);
|
|
1055
|
+
await ctx.run(schtasks, ["/Delete", "/TN", artifact.taskPath, "/F"], cwd);
|
|
1056
|
+
const queried = await ctx.run(schtasks, ["/Query", "/TN", artifact.taskPath], cwd);
|
|
1057
|
+
if (queried.code === 0) return [`task ${artifact.taskPath} is still registered`];
|
|
1058
|
+
const powershell = manifest.windows?.powershell ?? (manifest.platform === "wsl-windows-task" ? (ctx.tools ?? windowsTools()).powershell : `${ctx.env.SystemRoot ?? "C:\\Windows"}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`);
|
|
1059
|
+
const folder = await ctx.run(powershell, removeEmptyTaskFolderArguments(), cwd);
|
|
1060
|
+
return folder.code === 0 ? [] : ["the empty Task Scheduler folder \\namzu is still there; delete it in Task Scheduler"];
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
__name(removeArtifact, "removeArtifact");
|
|
1065
|
+
async function uninstallService(ctx) {
|
|
1066
|
+
const manifest = readManifest(ctx.paths);
|
|
1067
|
+
if (!manifest) return { problems: [] };
|
|
1068
|
+
const problems = [];
|
|
1069
|
+
const ordered = [...manifest.artifacts].sort(
|
|
1070
|
+
(a, b) => (a.type === "file" ? 1 : 0) - (b.type === "file" ? 1 : 0)
|
|
1071
|
+
);
|
|
1072
|
+
for (const artifact of ordered) problems.push(...await removeArtifact(ctx, manifest, artifact));
|
|
1073
|
+
if (manifest.enabledLinger) {
|
|
1074
|
+
const result = await ctx.run("loginctl", ["disable-linger", userInfo().username]);
|
|
1075
|
+
if (result.code !== 0) problems.push("loginctl disable-linger failed (install had enabled it)");
|
|
1076
|
+
}
|
|
1077
|
+
if (problems.length === 0) removeManifest(ctx.paths);
|
|
1078
|
+
return { problems, manifest };
|
|
1079
|
+
}
|
|
1080
|
+
__name(uninstallService, "uninstallService");
|
|
1081
|
+
async function serviceState(ctx, manifest) {
|
|
1082
|
+
switch (manifest.platform) {
|
|
1083
|
+
case "systemd-user":
|
|
1084
|
+
return `systemd: ${await systemdState(manifest.name, { run: ctx.run })}`;
|
|
1085
|
+
case "launchd": {
|
|
1086
|
+
const agent = manifest.artifacts.find((a) => a.type === "launchd-agent");
|
|
1087
|
+
if (agent?.type !== "launchd-agent") return "launchd: unknown";
|
|
1088
|
+
const printed = await ctx.run("launchctl", ["print", `${agent.domain}/${agent.label}`]);
|
|
1089
|
+
return printed.code === 0 ? `launchd: loaded (${/state = (\w+)/.exec(printed.stdout)?.[1] ?? "unknown"})` : "launchd: not loaded";
|
|
1090
|
+
}
|
|
1091
|
+
case "windows-task":
|
|
1092
|
+
case "wsl-windows-task": {
|
|
1093
|
+
const schtasks = manifest.windows?.schtasks ?? "schtasks.exe";
|
|
1094
|
+
const cwd = windowsCwd(ctx, manifest);
|
|
1095
|
+
const queried = await ctx.run(
|
|
1096
|
+
schtasks,
|
|
1097
|
+
["/Query", "/TN", manifest.windows?.taskPath ?? "", "/FO", "LIST", "/V"],
|
|
1098
|
+
cwd
|
|
1099
|
+
);
|
|
1100
|
+
if (queried.code !== 0) return "Task Scheduler: task not found";
|
|
1101
|
+
const fields = parseTaskQuery(queried.stdout);
|
|
1102
|
+
return `Task Scheduler: ${fields.status ?? "unknown"}${fields.state ? `, ${fields.state.toLowerCase()}` : ""}${fields.lastResult ? `, last result: ${describeTaskResult(fields.lastResult)}` : ""}`;
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
__name(serviceState, "serviceState");
|
|
1107
|
+
async function startService(ctx, manifest) {
|
|
1108
|
+
switch (manifest.platform) {
|
|
1109
|
+
case "systemd-user":
|
|
1110
|
+
return startSystemd(manifest.name, { run: ctx.run });
|
|
1111
|
+
case "launchd": {
|
|
1112
|
+
const agent = manifest.artifacts.find((a) => a.type === "launchd-agent");
|
|
1113
|
+
if (agent?.type !== "launchd-agent") return ["no launchd agent in the manifest"];
|
|
1114
|
+
const plist = manifest.artifacts.find((a) => a.type === "file");
|
|
1115
|
+
await ctx.run("launchctl", ["enable", `${agent.domain}/${agent.label}`]);
|
|
1116
|
+
const booted = await ctx.run("launchctl", [
|
|
1117
|
+
"bootstrap",
|
|
1118
|
+
agent.domain,
|
|
1119
|
+
plist?.type === "file" ? plist.path : ""
|
|
1120
|
+
]);
|
|
1121
|
+
if (booted.code === 0) return [];
|
|
1122
|
+
const kicked = await ctx.run("launchctl", ["kickstart", `${agent.domain}/${agent.label}`]);
|
|
1123
|
+
return kicked.code === 0 ? [] : [kicked.stderr.trim() || "launchctl kickstart failed"];
|
|
1124
|
+
}
|
|
1125
|
+
case "windows-task":
|
|
1126
|
+
case "wsl-windows-task": {
|
|
1127
|
+
const schtasks = manifest.windows?.schtasks ?? "schtasks.exe";
|
|
1128
|
+
const cwd = windowsCwd(ctx, manifest);
|
|
1129
|
+
const task = manifest.windows?.taskPath ?? "";
|
|
1130
|
+
const enabled = await ctx.run(schtasks, ["/Change", "/TN", task, "/ENABLE"], cwd);
|
|
1131
|
+
if (enabled.code !== 0) return [enabled.stderr.trim() || "schtasks /Change /ENABLE failed"];
|
|
1132
|
+
const ran = await ctx.run(schtasks, ["/Run", "/TN", task], cwd);
|
|
1133
|
+
return ran.code === 0 ? [] : [ran.stderr.trim() || "schtasks /Run failed"];
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
__name(startService, "startService");
|
|
1138
|
+
async function stopService(ctx, manifest) {
|
|
1139
|
+
switch (manifest.platform) {
|
|
1140
|
+
case "systemd-user":
|
|
1141
|
+
return stopSystemd(manifest.name, { run: ctx.run });
|
|
1142
|
+
case "launchd": {
|
|
1143
|
+
const agent = manifest.artifacts.find((a) => a.type === "launchd-agent");
|
|
1144
|
+
if (agent?.type !== "launchd-agent") return ["no launchd agent in the manifest"];
|
|
1145
|
+
const disabled = await ctx.run("launchctl", ["disable", `${agent.domain}/${agent.label}`]);
|
|
1146
|
+
const out = await ctx.run("launchctl", ["bootout", `${agent.domain}/${agent.label}`]);
|
|
1147
|
+
if (disabled.code !== 0) return [disabled.stderr.trim() || "launchctl disable failed"];
|
|
1148
|
+
return out.code === 0 ? [] : [out.stderr.trim() || "launchctl bootout failed"];
|
|
1149
|
+
}
|
|
1150
|
+
case "windows-task":
|
|
1151
|
+
case "wsl-windows-task": {
|
|
1152
|
+
const schtasks = manifest.windows?.schtasks ?? "schtasks.exe";
|
|
1153
|
+
const cwd = windowsCwd(ctx, manifest);
|
|
1154
|
+
const task = manifest.windows?.taskPath ?? "";
|
|
1155
|
+
const disabled = await ctx.run(schtasks, ["/Change", "/TN", task, "/DISABLE"], cwd);
|
|
1156
|
+
await ctx.run(schtasks, ["/End", "/TN", task], cwd);
|
|
1157
|
+
return disabled.code === 0 ? [] : [disabled.stderr.trim() || "schtasks /Change /DISABLE failed"];
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
__name(stopService, "stopService");
|
|
1162
|
+
|
|
1163
|
+
// src/schedule/service/names.ts
|
|
1164
|
+
import { createHash } from "node:crypto";
|
|
1165
|
+
import { homedir as homedir3 } from "node:os";
|
|
1166
|
+
import { join as join5, resolve } from "node:path";
|
|
1167
|
+
var SERVICE_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]{0,62}$/;
|
|
1168
|
+
function defaultServiceName(namzuHome, osHome = homedir3()) {
|
|
1169
|
+
if (resolve(namzuHome) === resolve(join5(osHome, ".namzu"))) return "namzu-scheduler";
|
|
1170
|
+
const h8 = createHash("sha256").update(resolve(namzuHome)).digest("hex").slice(0, 8);
|
|
1171
|
+
return `namzu-scheduler-${h8}`;
|
|
1172
|
+
}
|
|
1173
|
+
__name(defaultServiceName, "defaultServiceName");
|
|
1174
|
+
function checkServiceName(name) {
|
|
1175
|
+
if (!SERVICE_NAME.test(name)) {
|
|
1176
|
+
throw new Error(
|
|
1177
|
+
`"${name}" is not a service name: letters, digits, dot, dash and underscore only`
|
|
1178
|
+
);
|
|
1179
|
+
}
|
|
1180
|
+
return name;
|
|
1181
|
+
}
|
|
1182
|
+
__name(checkServiceName, "checkServiceName");
|
|
1183
|
+
|
|
1184
|
+
// src/schedule/service/runner.ts
|
|
1185
|
+
import { execFile as execFile2 } from "node:child_process";
|
|
1186
|
+
var runCommand = /* @__PURE__ */ __name((command, args, options = {}) => new Promise((resolve2) => {
|
|
1187
|
+
execFile2(
|
|
1188
|
+
command,
|
|
1189
|
+
[...args],
|
|
1190
|
+
{
|
|
1191
|
+
timeout: options.timeoutMs ?? 3e4,
|
|
1192
|
+
windowsHide: true,
|
|
1193
|
+
maxBuffer: 4 * 1024 * 1024,
|
|
1194
|
+
...options.cwd ? { cwd: options.cwd } : {},
|
|
1195
|
+
...options.env ? { env: options.env } : {},
|
|
1196
|
+
encoding: "buffer"
|
|
1197
|
+
},
|
|
1198
|
+
(error, stdout, stderr) => {
|
|
1199
|
+
const code = error ? typeof error.code === "number" ? error.code : 127 : 0;
|
|
1200
|
+
resolve2({ code, stdout: decode(stdout), stderr: decode(stderr) });
|
|
1201
|
+
}
|
|
1202
|
+
);
|
|
1203
|
+
}), "runCommand");
|
|
1204
|
+
function decode(buffer) {
|
|
1205
|
+
if (typeof buffer === "string") return buffer;
|
|
1206
|
+
if (buffer.length >= 2 && buffer[0] === 255 && buffer[1] === 254)
|
|
1207
|
+
return buffer.subarray(2).toString("utf16le");
|
|
1208
|
+
if (buffer.length >= 4 && buffer[1] === 0 && buffer[3] === 0) return buffer.toString("utf16le");
|
|
1209
|
+
return buffer.toString("utf8");
|
|
1210
|
+
}
|
|
1211
|
+
__name(decode, "decode");
|
|
1212
|
+
|
|
1213
|
+
// src/schedule/commands/service.ts
|
|
1214
|
+
var PLATFORMS = [
|
|
1215
|
+
"auto",
|
|
1216
|
+
"systemd-user",
|
|
1217
|
+
"launchd",
|
|
1218
|
+
"windows-task",
|
|
1219
|
+
"wsl-windows-task"
|
|
1220
|
+
];
|
|
1221
|
+
function installedBin() {
|
|
1222
|
+
const here = dirname3(fileURLToPath(new URL("../", import.meta.url).href + "schedule/commands/service.js"));
|
|
1223
|
+
const candidate = join6(here, "..", "..", "bin.js");
|
|
1224
|
+
try {
|
|
1225
|
+
return realpathSync(candidate);
|
|
1226
|
+
} catch {
|
|
1227
|
+
return realpathSync(process.argv[1] ?? candidate);
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
__name(installedBin, "installedBin");
|
|
1231
|
+
function program(paths) {
|
|
1232
|
+
return { node: realpathSync(process.execPath), bin: installedBin(), namzuHome: paths.home };
|
|
1233
|
+
}
|
|
1234
|
+
__name(program, "program");
|
|
1235
|
+
async function installCommand(ctx, argv) {
|
|
1236
|
+
const args = parseArgs(argv, ["home", "platform", "name", "at-boot!", "dry-run!"]);
|
|
1237
|
+
const platformFlag = flag(args, "platform") ?? "auto";
|
|
1238
|
+
if (args.unknown.length > 0 || !PLATFORMS.includes(platformFlag)) {
|
|
1239
|
+
ctx.formatter.error({
|
|
1240
|
+
message: `usage: namzu schedule install [--platform ${PLATFORMS.join("|")}] [--name <n>] [--at-boot] [--dry-run]`
|
|
1241
|
+
});
|
|
1242
|
+
return EXIT_USAGE;
|
|
1243
|
+
}
|
|
1244
|
+
const paths = pathsFor(args);
|
|
1245
|
+
let platform;
|
|
1246
|
+
if (platformFlag === "auto") {
|
|
1247
|
+
const detected = detectPlatform({
|
|
1248
|
+
systemdUser: await systemdUserAvailable({ run: runCommand })
|
|
1249
|
+
});
|
|
1250
|
+
if (!detected.platform) {
|
|
1251
|
+
ctx.formatter.error({ message: detected.reason });
|
|
1252
|
+
return EXIT_UNAVAILABLE;
|
|
1253
|
+
}
|
|
1254
|
+
platform = detected.platform;
|
|
1255
|
+
} else platform = platformFlag;
|
|
1256
|
+
const name = checkServiceName(flag(args, "name") ?? defaultServiceName(paths.home));
|
|
1257
|
+
const prog = program(paths);
|
|
1258
|
+
if (has(args, "dry-run")) {
|
|
1259
|
+
let text;
|
|
1260
|
+
switch (platform) {
|
|
1261
|
+
case "systemd-user":
|
|
1262
|
+
text = systemdUnit(prog);
|
|
1263
|
+
break;
|
|
1264
|
+
case "launchd":
|
|
1265
|
+
text = launchdPlist(launchdLabel(name), prog);
|
|
1266
|
+
break;
|
|
1267
|
+
case "windows-task":
|
|
1268
|
+
text = taskXml({
|
|
1269
|
+
userId: "DOMAIN\\user",
|
|
1270
|
+
description: "namzu scheduler",
|
|
1271
|
+
command: "C:\\Windows\\System32\\conhost.exe",
|
|
1272
|
+
args: ["--headless", prog.node, prog.bin, "schedule", "daemon", "--home", prog.namzuHome]
|
|
1273
|
+
});
|
|
1274
|
+
break;
|
|
1275
|
+
case "wsl-windows-task":
|
|
1276
|
+
text = taskXml(
|
|
1277
|
+
wslTaskDefinition({
|
|
1278
|
+
userId: "DOMAIN\\user",
|
|
1279
|
+
distro: process.env.WSL_DISTRO_NAME ?? "distro",
|
|
1280
|
+
linuxUser: process.env.USER ?? "user",
|
|
1281
|
+
...prog
|
|
1282
|
+
})
|
|
1283
|
+
);
|
|
1284
|
+
break;
|
|
1285
|
+
}
|
|
1286
|
+
ctx.formatter.print({ text, platform, name });
|
|
1287
|
+
return EXIT_OK;
|
|
1288
|
+
}
|
|
1289
|
+
const existing = readManifest(paths);
|
|
1290
|
+
if (existing && existing.name !== name && existing.platform !== platform) {
|
|
1291
|
+
ctx.formatter.error({
|
|
1292
|
+
message: `a scheduler service (${existing.name}, ${existing.platform}) is already installed for this home; uninstall it first`
|
|
1293
|
+
});
|
|
1294
|
+
return 1;
|
|
1295
|
+
}
|
|
1296
|
+
try {
|
|
1297
|
+
requestStop(paths, false);
|
|
1298
|
+
const { manifest, problems, notes } = await installService(
|
|
1299
|
+
{ paths, run: runCommand, env: process.env, version: CLI_VERSION },
|
|
1300
|
+
{ platform, name, program: prog, atBoot: has(args, "at-boot") }
|
|
1301
|
+
);
|
|
1302
|
+
for (const note of notes) ctx.formatter.info(note);
|
|
1303
|
+
if (problems.length > 0) {
|
|
1304
|
+
ctx.formatter.error({ message: `installed with problems:
|
|
1305
|
+
${problems.join("\n")}` });
|
|
1306
|
+
return 1;
|
|
1307
|
+
}
|
|
1308
|
+
ctx.formatter.print({
|
|
1309
|
+
text: `Installed ${manifest.name} (${manifest.platform}). Check it with \`namzu schedule status\`.`,
|
|
1310
|
+
platform: manifest.platform,
|
|
1311
|
+
name: manifest.name
|
|
1312
|
+
});
|
|
1313
|
+
return EXIT_OK;
|
|
1314
|
+
} catch (error) {
|
|
1315
|
+
ctx.formatter.error({ message: error instanceof Error ? error.message : String(error) });
|
|
1316
|
+
return error instanceof ServiceRefusal ? EXIT_UNAVAILABLE : 1;
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
__name(installCommand, "installCommand");
|
|
1320
|
+
function runsInFlight(paths) {
|
|
1321
|
+
let n = 0;
|
|
1322
|
+
for (const job of listJobs(paths).jobs) {
|
|
1323
|
+
const run = readState(paths, job.id).activeRun;
|
|
1324
|
+
if (run?.status === "running" && !isFinal(readRunResult(paths, job.id, run.runId))) n++;
|
|
1325
|
+
}
|
|
1326
|
+
return n;
|
|
1327
|
+
}
|
|
1328
|
+
__name(runsInFlight, "runsInFlight");
|
|
1329
|
+
async function uninstallCommand(ctx, argv) {
|
|
1330
|
+
const args = parseArgs(argv, ["home", "keep-data!", "purge-data!", "wait", "interrupt-runs!"]);
|
|
1331
|
+
if (args.unknown.length > 0 || has(args, "keep-data") && has(args, "purge-data")) {
|
|
1332
|
+
ctx.formatter.error({
|
|
1333
|
+
message: "usage: namzu schedule uninstall [--keep-data | --purge-data] [--wait 10m | --interrupt-runs]"
|
|
1334
|
+
});
|
|
1335
|
+
return EXIT_USAGE;
|
|
1336
|
+
}
|
|
1337
|
+
const paths = pathsFor(args);
|
|
1338
|
+
const manifest = readManifest(paths);
|
|
1339
|
+
const endpoint = readEndpoint(paths.endpoint);
|
|
1340
|
+
requestStop(paths, true);
|
|
1341
|
+
if (endpoint) await callEndpoint(endpoint, "stop");
|
|
1342
|
+
if (manifest)
|
|
1343
|
+
await stopService({ paths, run: runCommand, env: process.env, version: CLI_VERSION }, manifest);
|
|
1344
|
+
if (!has(args, "interrupt-runs")) {
|
|
1345
|
+
const waitMs = parseMs("--wait", flag(args, "wait")) ?? 10 * 6e4;
|
|
1346
|
+
const deadline = Date.now() + waitMs;
|
|
1347
|
+
while (runsInFlight(paths) > 0 && Date.now() < deadline) {
|
|
1348
|
+
ctx.formatter.info(`waiting for ${runsInFlight(paths)} run(s) in progress to finish\u2026`);
|
|
1349
|
+
await new Promise((r) => setTimeout(r, 5e3));
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
const inFlight = runsInFlight(paths);
|
|
1353
|
+
if (inFlight > 0)
|
|
1354
|
+
ctx.formatter.info(`${inFlight} run(s) are still in progress; they finish on their own.`);
|
|
1355
|
+
const { problems } = await uninstallService({
|
|
1356
|
+
paths,
|
|
1357
|
+
run: runCommand,
|
|
1358
|
+
env: process.env,
|
|
1359
|
+
version: CLI_VERSION
|
|
1360
|
+
});
|
|
1361
|
+
if (problems.length > 0) {
|
|
1362
|
+
ctx.formatter.error({ message: `could not remove everything:
|
|
1363
|
+
${problems.join("\n")}` });
|
|
1364
|
+
return 1;
|
|
1365
|
+
}
|
|
1366
|
+
if (has(args, "purge-data")) rmSync4(paths.root, { recursive: true, force: true });
|
|
1367
|
+
ctx.formatter.print({
|
|
1368
|
+
text: manifest ? `Removed ${manifest.name}.${has(args, "purge-data") ? " Scheduler data deleted." : " Jobs and history are kept."}` : `No scheduler service was installed for ${paths.home}.${has(args, "purge-data") ? " Scheduler data deleted." : ""}`
|
|
1369
|
+
});
|
|
1370
|
+
return EXIT_OK;
|
|
1371
|
+
}
|
|
1372
|
+
__name(uninstallCommand, "uninstallCommand");
|
|
1373
|
+
function readHeartbeat(paths) {
|
|
1374
|
+
try {
|
|
1375
|
+
return JSON.parse(readFileSync2(paths.heartbeat, "utf8"));
|
|
1376
|
+
} catch {
|
|
1377
|
+
return void 0;
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
__name(readHeartbeat, "readHeartbeat");
|
|
1381
|
+
function daemonNotifications(heartbeat, live) {
|
|
1382
|
+
const reported = typeof live?.notifications === "string" ? live.notifications : heartbeat?.notifications;
|
|
1383
|
+
if (!reported || reported === "unknown") return void 0;
|
|
1384
|
+
const at = reported.indexOf(": ");
|
|
1385
|
+
return at < 0 ? { kind: reported, detail: "" } : { kind: reported.slice(0, at), detail: reported.slice(at + 2) };
|
|
1386
|
+
}
|
|
1387
|
+
__name(daemonNotifications, "daemonNotifications");
|
|
1388
|
+
async function statusCommand(ctx, argv) {
|
|
1389
|
+
const args = parseArgs(argv, ["home", "json!"]);
|
|
1390
|
+
if (args.unknown.length > 0) {
|
|
1391
|
+
ctx.formatter.error({ message: `unknown option: ${args.unknown.join(", ")}` });
|
|
1392
|
+
return EXIT_USAGE;
|
|
1393
|
+
}
|
|
1394
|
+
const paths = pathsFor(args);
|
|
1395
|
+
const manifest = readManifest(paths);
|
|
1396
|
+
const heartbeat = readHeartbeat(paths);
|
|
1397
|
+
const endpoint = readEndpoint(paths.endpoint);
|
|
1398
|
+
const live = endpoint ? await callEndpoint(endpoint, "status") : void 0;
|
|
1399
|
+
const age = heartbeat ? Date.now() - Date.parse(heartbeat.at) : void 0;
|
|
1400
|
+
const supervisor = manifest ? await serviceState(
|
|
1401
|
+
{ paths, run: runCommand, env: process.env, version: CLI_VERSION },
|
|
1402
|
+
manifest
|
|
1403
|
+
) : "not installed";
|
|
1404
|
+
const jobs = listJobs(paths).jobs;
|
|
1405
|
+
const backend = daemonNotifications(heartbeat, live) ?? {
|
|
1406
|
+
...selectDesktopBackend(
|
|
1407
|
+
manifest?.windows?.powershell ? { powershell: manifest.windows.powershell } : {}
|
|
1408
|
+
),
|
|
1409
|
+
guessed: true
|
|
1410
|
+
};
|
|
1411
|
+
const pathProblems = [];
|
|
1412
|
+
if (manifest) {
|
|
1413
|
+
for (const [label, path] of [
|
|
1414
|
+
["node", manifest.nodePath],
|
|
1415
|
+
["namzu", manifest.binPath]
|
|
1416
|
+
]) {
|
|
1417
|
+
try {
|
|
1418
|
+
realpathSync(path);
|
|
1419
|
+
} catch {
|
|
1420
|
+
pathProblems.push(`${label} ${path} no longer exists; run namzu schedule install again`);
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
if (manifest.cliVersion !== CLI_VERSION)
|
|
1424
|
+
pathProblems.push(
|
|
1425
|
+
`installed by namzu ${manifest.cliVersion}, this is ${CLI_VERSION}; the daemon restarts on the new code by itself`
|
|
1426
|
+
);
|
|
1427
|
+
}
|
|
1428
|
+
const healthy = Boolean(live) || age !== void 0 && age < 9e4;
|
|
1429
|
+
const awaitingApproval = jobs.flatMap((job) => {
|
|
1430
|
+
const run = readState(paths, job.id).activeRun;
|
|
1431
|
+
return run?.status === "awaiting-approval" && run.sessionId ? [
|
|
1432
|
+
{
|
|
1433
|
+
job: job.name,
|
|
1434
|
+
sessionId: run.sessionId,
|
|
1435
|
+
resumeCommand: resumeCommand(job, run.sessionId),
|
|
1436
|
+
...run.handoff ? { handoff: { reason: run.handoff.reason } } : {},
|
|
1437
|
+
waitingFor: parkedRunWords(run)
|
|
1438
|
+
}
|
|
1439
|
+
] : [];
|
|
1440
|
+
});
|
|
1441
|
+
const payload = {
|
|
1442
|
+
v: 1,
|
|
1443
|
+
installed: Boolean(manifest),
|
|
1444
|
+
platform: manifest?.platform ?? null,
|
|
1445
|
+
name: manifest?.name ?? null,
|
|
1446
|
+
supervisor,
|
|
1447
|
+
daemon: live ? { responding: true, ...live } : heartbeat ? {
|
|
1448
|
+
responding: false,
|
|
1449
|
+
lastSeen: heartbeat.at,
|
|
1450
|
+
standby: heartbeat.standby,
|
|
1451
|
+
pid: heartbeat.pid,
|
|
1452
|
+
version: heartbeat.version
|
|
1453
|
+
} : null,
|
|
1454
|
+
notifications: `${backend.kind} (${backend.detail})${"guessed" in backend ? " \u2014 the daemon has not reported, so this is what this shell would pick" : ""}`,
|
|
1455
|
+
jobs: { total: jobs.length, active: jobs.filter((j) => j.state === "active").length },
|
|
1456
|
+
runsInFlight: runsInFlight(paths),
|
|
1457
|
+
awaitingApproval,
|
|
1458
|
+
problems: pathProblems,
|
|
1459
|
+
log: daemonLogPath(paths.daemonLog)
|
|
1460
|
+
};
|
|
1461
|
+
if (has(args, "json") || ctx.formatter.name !== "text") {
|
|
1462
|
+
ctx.formatter.print(ctx.formatter.name === "text" ? JSON.stringify(payload, null, 2) : payload);
|
|
1463
|
+
} else {
|
|
1464
|
+
ctx.formatter.print(
|
|
1465
|
+
[
|
|
1466
|
+
`Service ${manifest ? `${manifest.name} (${manifest.platform})` : "not installed \u2014 namzu schedule install"}`,
|
|
1467
|
+
`Supervisor ${supervisor}`,
|
|
1468
|
+
`Daemon ${live ? `running, pid ${String(live.pid)}, version ${String(live.version)}${live.standby ? ", on standby" : ""}${live.draining ? ", draining for a restart" : ""}` : heartbeat ? `not answering; last seen ${Math.round((age ?? 0) / 1e3)} s ago${heartbeat.standby ? " (on standby)" : ""}` : "never started"}`,
|
|
1469
|
+
`Notifications ${backend.kind}${backend.kind === "none" ? ` \u2014 ${backend.detail}` : ""}${"guessed" in backend ? " (not reported by the daemon yet; this shell would pick it)" : ""}`,
|
|
1470
|
+
`Jobs ${payload.jobs.active} active of ${payload.jobs.total}; ${payload.runsInFlight} run(s) in progress`,
|
|
1471
|
+
...awaitingApproval.map(
|
|
1472
|
+
(w) => w.handoff ? `Waiting ${w.job} ${w.waitingFor}; when that is done: ${w.resumeCommand}` : `Waiting ${w.job} needs your approval: ${w.resumeCommand}`
|
|
1473
|
+
),
|
|
1474
|
+
`Log ${payload.log}`,
|
|
1475
|
+
...pathProblems.map((p) => `Warning ${p}`)
|
|
1476
|
+
].join("\n")
|
|
1477
|
+
);
|
|
1478
|
+
}
|
|
1479
|
+
if (!manifest && !live) return EXIT_NO_CONFIG;
|
|
1480
|
+
return healthy ? EXIT_OK : EXIT_UNAVAILABLE;
|
|
1481
|
+
}
|
|
1482
|
+
__name(statusCommand, "statusCommand");
|
|
1483
|
+
async function startStopCommand(ctx, argv, verb) {
|
|
1484
|
+
const args = parseArgs(argv, ["home"]);
|
|
1485
|
+
const paths = pathsFor(args);
|
|
1486
|
+
const manifest = readManifest(paths);
|
|
1487
|
+
if (!manifest) {
|
|
1488
|
+
ctx.formatter.error({
|
|
1489
|
+
message: "no scheduler service is installed for this home; namzu schedule install"
|
|
1490
|
+
});
|
|
1491
|
+
return EXIT_NO_CONFIG;
|
|
1492
|
+
}
|
|
1493
|
+
const context = { paths, run: runCommand, env: process.env, version: CLI_VERSION };
|
|
1494
|
+
requestStop(paths, verb === "stop");
|
|
1495
|
+
const problems = verb === "start" ? await startService(context, manifest) : await stopService(context, manifest);
|
|
1496
|
+
if (verb === "stop") {
|
|
1497
|
+
const endpoint = readEndpoint(paths.endpoint);
|
|
1498
|
+
if (endpoint) await callEndpoint(endpoint, "stop");
|
|
1499
|
+
}
|
|
1500
|
+
if (problems.length > 0) {
|
|
1501
|
+
ctx.formatter.error({ message: problems.join("\n") });
|
|
1502
|
+
return 1;
|
|
1503
|
+
}
|
|
1504
|
+
ctx.formatter.print({
|
|
1505
|
+
text: verb === "start" ? `Started ${manifest.name}.` : `Stopped ${manifest.name}; it stays stopped until namzu schedule start.`
|
|
1506
|
+
});
|
|
1507
|
+
return EXIT_OK;
|
|
1508
|
+
}
|
|
1509
|
+
__name(startStopCommand, "startStopCommand");
|
|
1510
|
+
async function daemonCommand(ctx, argv) {
|
|
1511
|
+
const args = parseArgs(argv, ["home", "foreground!", "once-or-exit!"]);
|
|
1512
|
+
if (args.unknown.length > 0) {
|
|
1513
|
+
ctx.formatter.error({ message: `unknown option: ${args.unknown.join(", ")}` });
|
|
1514
|
+
return EXIT_USAGE;
|
|
1515
|
+
}
|
|
1516
|
+
const paths = pathsFor(args);
|
|
1517
|
+
process.env.NAMZU_HOME = paths.home;
|
|
1518
|
+
const config = (() => {
|
|
1519
|
+
try {
|
|
1520
|
+
return loadBootstrapConfigWithProvenance({ env: process.env }).config;
|
|
1521
|
+
} catch {
|
|
1522
|
+
return ctx.config;
|
|
1523
|
+
}
|
|
1524
|
+
})();
|
|
1525
|
+
installCliLogging(daemonLogSink(paths.daemonLog), "info");
|
|
1526
|
+
const log = cliLogger();
|
|
1527
|
+
const manifest = (() => {
|
|
1528
|
+
try {
|
|
1529
|
+
return readManifest(paths);
|
|
1530
|
+
} catch {
|
|
1531
|
+
return void 0;
|
|
1532
|
+
}
|
|
1533
|
+
})();
|
|
1534
|
+
const backend = selectDesktopBackend(
|
|
1535
|
+
manifest?.windows?.powershell ? { powershell: manifest.windows.powershell } : {}
|
|
1536
|
+
);
|
|
1537
|
+
const bin = installedBin();
|
|
1538
|
+
if (existsSync5(stopRequestPath(paths))) {
|
|
1539
|
+
ctx.formatter.error({
|
|
1540
|
+
message: `the scheduler for ${paths.home} was stopped with \`namzu schedule stop\`; \`namzu schedule start\` lets it run again`
|
|
1541
|
+
});
|
|
1542
|
+
return EXIT_STOP_REQUESTED;
|
|
1543
|
+
}
|
|
1544
|
+
const daemon = new ScheduleDaemon({
|
|
1545
|
+
paths,
|
|
1546
|
+
log,
|
|
1547
|
+
version: CLI_VERSION,
|
|
1548
|
+
epoch: randomUUID(),
|
|
1549
|
+
maxConcurrentRuns: config.schedule?.maxConcurrentRuns ?? 2,
|
|
1550
|
+
notifications: config.schedule?.notifications ?? true,
|
|
1551
|
+
notificationBackend: `${backend.kind}: ${backend.detail}`,
|
|
1552
|
+
spawnFire: spawnFireProcess({ node: process.execPath, bin, paths, env: process.env }),
|
|
1553
|
+
notify: /* @__PURE__ */ __name(async (notice) => {
|
|
1554
|
+
const result = await sendDesktopNotification(backend, notice);
|
|
1555
|
+
if (result.kind !== "sent") {
|
|
1556
|
+
log.warn("scheduled run notification not shown", {
|
|
1557
|
+
"namzu.schedule.job_id": notice.jobId,
|
|
1558
|
+
"namzu.schedule.notify_result": result.kind
|
|
1559
|
+
});
|
|
1560
|
+
}
|
|
1561
|
+
}, "notify"),
|
|
1562
|
+
fingerprint: installedFingerprint(bin),
|
|
1563
|
+
onceOrExit: has(args, "once-or-exit")
|
|
1564
|
+
});
|
|
1565
|
+
const stop = /* @__PURE__ */ __name(() => daemon.stop(), "stop");
|
|
1566
|
+
process.on("SIGTERM", stop);
|
|
1567
|
+
process.on("SIGINT", stop);
|
|
1568
|
+
process.on("SIGHUP", stop);
|
|
1569
|
+
log.info("scheduler starting", {
|
|
1570
|
+
"namzu.schedule.home": paths.home,
|
|
1571
|
+
"namzu.schedule.version": CLI_VERSION
|
|
1572
|
+
});
|
|
1573
|
+
try {
|
|
1574
|
+
const code = await daemon.run();
|
|
1575
|
+
if (code === 75) {
|
|
1576
|
+
const endpoint = readEndpoint(paths.endpoint);
|
|
1577
|
+
ctx.formatter.error({
|
|
1578
|
+
message: `another scheduler owns ${paths.home}${endpoint ? ` (pid ${endpoint.pid})` : ""}`
|
|
1579
|
+
});
|
|
1580
|
+
}
|
|
1581
|
+
return code;
|
|
1582
|
+
} finally {
|
|
1583
|
+
process.removeListener("SIGTERM", stop);
|
|
1584
|
+
process.removeListener("SIGINT", stop);
|
|
1585
|
+
process.removeListener("SIGHUP", stop);
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
__name(daemonCommand, "daemonCommand");
|
|
1589
|
+
async function fireCommand(ctx, argv, termination) {
|
|
1590
|
+
const args = parseArgs(argv, [
|
|
1591
|
+
"home",
|
|
1592
|
+
"job",
|
|
1593
|
+
"run",
|
|
1594
|
+
"key",
|
|
1595
|
+
"revision",
|
|
1596
|
+
"trigger",
|
|
1597
|
+
"scheduled-for",
|
|
1598
|
+
"epoch"
|
|
1599
|
+
]);
|
|
1600
|
+
const parsed = parseFireArgs(argv);
|
|
1601
|
+
if ("error" in parsed || args.unknown.length > 0) {
|
|
1602
|
+
ctx.formatter.error({
|
|
1603
|
+
message: "error" in parsed ? parsed.error : `unknown option: ${args.unknown.join(", ")}`
|
|
1604
|
+
});
|
|
1605
|
+
return EXIT_USAGE;
|
|
1606
|
+
}
|
|
1607
|
+
const paths = pathsFor(args);
|
|
1608
|
+
const fire = parsed;
|
|
1609
|
+
termination?.onTerminate(async (signal) => {
|
|
1610
|
+
const current = readRunResult(paths, fire.jobId, fire.runId);
|
|
1611
|
+
if (current && current.status === "running") {
|
|
1612
|
+
writeRunResult(paths, {
|
|
1613
|
+
...current,
|
|
1614
|
+
status: "interrupted",
|
|
1615
|
+
exitCode: 1,
|
|
1616
|
+
reason: `stopped by ${signal}`,
|
|
1617
|
+
endedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1618
|
+
});
|
|
1619
|
+
}
|
|
1620
|
+
});
|
|
1621
|
+
return runFire(ctx, paths, fire);
|
|
1622
|
+
}
|
|
1623
|
+
__name(fireCommand, "fireCommand");
|
|
1624
|
+
export {
|
|
1625
|
+
daemonCommand,
|
|
1626
|
+
fireCommand,
|
|
1627
|
+
installCommand,
|
|
1628
|
+
installedBin,
|
|
1629
|
+
startStopCommand,
|
|
1630
|
+
statusCommand,
|
|
1631
|
+
uninstallCommand
|
|
1632
|
+
};
|
|
1633
|
+
//# sourceMappingURL=service-YBU5VTKQ.js.map
|