@namzu/cli 53.0.1 → 53.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 +60 -0
- package/dist/bin.js +1 -1
- package/dist/chunks/{acp-IOWTKF2X.js → acp-UVCLNIXU.js} +83 -77
- package/dist/chunks/acp-UVCLNIXU.js.map +6 -0
- package/dist/chunks/{activity-command-U2AOTIVF.js → activity-command-2QIWTUUB.js} +15 -15
- package/dist/chunks/{add-YYQLPCP2.js → add-2YDEALUT.js} +26 -26
- package/dist/chunks/{agent-WL6NX4W6.js → agent-IKQ67NMW.js} +45 -42
- package/dist/chunks/agent-session-H3OE6ZJT.js +76 -0
- package/dist/chunks/{apply-at-exit-BRXYTQVG.js → apply-at-exit-F4G7PCZL.js} +8 -8
- package/dist/chunks/{archive-UE756BME.js → archive-FOTYHQPL.js} +14 -14
- package/dist/chunks/{bin-main-XR2DJOI6.js → bin-main-DWOCG2WK.js} +14 -14
- package/dist/chunks/{binding-HCIPLFUO.js → binding-2GEVBR5H.js} +3 -3
- package/dist/chunks/{browser-7SFVCKSO.js → browser-WYPSIPEZ.js} +6 -6
- package/dist/chunks/{chat-K6GQGRUA.js → chat-LWVIDEXR.js} +22 -22
- package/dist/chunks/{chunk-CQKYKQEF.js → chunk-2CYBRCPH.js} +4 -4
- package/dist/chunks/{chunk-7AWFHVMT.js → chunk-2Q2TPLYP.js} +3 -3
- package/dist/chunks/{chunk-TYTE2GIF.js → chunk-2QMXCXZ2.js} +5 -5
- package/dist/chunks/{chunk-Z5NMQ2YN.js → chunk-33WFG4C3.js} +2 -2
- package/dist/chunks/{chunk-Z5FDI74K.js → chunk-3EEKLQXD.js} +6 -6
- package/dist/chunks/chunk-3HJXXP6L.js +226 -0
- package/dist/chunks/chunk-3HJXXP6L.js.map +6 -0
- package/dist/chunks/{chunk-NZMKMXGG.js → chunk-3T5AX2PC.js} +2 -2
- package/dist/chunks/{chunk-OBMHA7OP.js → chunk-4ASCYXSH.js} +3 -3
- package/dist/chunks/{chunk-MHXJYXOF.js → chunk-4EBZUUE4.js} +5 -5
- package/dist/chunks/{chunk-WSMX3IQE.js → chunk-53UWPLAF.js} +503 -402
- package/dist/chunks/chunk-53UWPLAF.js.map +6 -0
- package/dist/chunks/{chunk-3NAVAACC.js → chunk-5F4SSZKS.js} +2 -2
- package/dist/chunks/{chunk-RDW6L3PV.js → chunk-5JQIGBBR.js} +3 -3
- package/dist/chunks/{chunk-HOB6FTE2.js → chunk-5S7U5MFW.js} +5 -4
- package/dist/chunks/{chunk-HOB6FTE2.js.map → chunk-5S7U5MFW.js.map} +1 -1
- package/dist/chunks/{chunk-U4XNJBDB.js → chunk-5WORROIE.js} +8 -1
- package/dist/chunks/{chunk-U4XNJBDB.js.map → chunk-5WORROIE.js.map} +1 -1
- package/dist/chunks/{chunk-V7VNFYA4.js → chunk-6APCO6YC.js} +18 -14
- package/dist/chunks/chunk-6APCO6YC.js.map +6 -0
- package/dist/chunks/{chunk-HJILJSZO.js → chunk-6CXEEZLK.js} +2 -2
- package/dist/chunks/{chunk-2U357RJS.js → chunk-6JKNPDZD.js} +10 -10
- package/dist/chunks/{chunk-AGFGC7SI.js → chunk-6KIXUAOC.js} +3 -3
- package/dist/chunks/{chunk-2WDF5N2A.js → chunk-6NUQEVHG.js} +9 -9
- package/dist/chunks/{chunk-4RTQTX5R.js → chunk-6RTDZGPO.js} +2 -2
- package/dist/chunks/{chunk-5I45HTKW.js → chunk-7PDUMQ4M.js} +175 -33
- package/dist/chunks/chunk-7PDUMQ4M.js.map +6 -0
- package/dist/chunks/{chunk-7JT7DNR7.js → chunk-7T6TX47O.js} +3 -3
- package/dist/chunks/{chunk-UJOWXA23.js → chunk-ABOV5CRT.js} +302 -131
- package/dist/chunks/chunk-ABOV5CRT.js.map +6 -0
- package/dist/chunks/{chunk-SVMGV4AS.js → chunk-AZHBCP6G.js} +46 -46
- package/dist/chunks/{chunk-POOJ2MUS.js → chunk-BLGPF6UL.js} +3 -3
- package/dist/chunks/{chunk-YELRULQ7.js → chunk-C74LVDRC.js} +3948 -2225
- package/dist/chunks/chunk-C74LVDRC.js.map +6 -0
- package/dist/chunks/{chunk-F3SQRGKZ.js → chunk-CMHOQ62S.js} +2 -2
- package/dist/chunks/{chunk-24N42TGE.js → chunk-D5RO75LO.js} +6 -6
- package/dist/chunks/{chunk-M3AUPUII.js → chunk-D7JY7KNY.js} +6 -6
- package/dist/chunks/chunk-DCMZYSON.js +247 -0
- package/dist/chunks/chunk-DCMZYSON.js.map +6 -0
- package/dist/chunks/{chunk-5NDRDTNX.js → chunk-DHWD5YYD.js} +6 -6
- package/dist/chunks/chunk-DHWD5YYD.js.map +6 -0
- package/dist/chunks/{chunk-RAPO3KLG.js → chunk-DTORDCJR.js} +4 -4
- package/dist/chunks/{chunk-NICPMJJQ.js → chunk-E7GZ5OXM.js} +6 -5
- package/dist/chunks/{chunk-NICPMJJQ.js.map → chunk-E7GZ5OXM.js.map} +1 -1
- package/dist/chunks/{chunk-O326HKCW.js → chunk-EADNTGVW.js} +3 -3
- package/dist/chunks/{chunk-YSKCWH72.js → chunk-EYAWI7KU.js} +196 -27
- package/dist/chunks/chunk-EYAWI7KU.js.map +6 -0
- package/dist/chunks/{chunk-KNQ7R54U.js → chunk-F3GGSHY2.js} +715 -622
- package/dist/chunks/chunk-F3GGSHY2.js.map +6 -0
- package/dist/chunks/{chunk-HGZYNEQE.js → chunk-FBRYV5YN.js} +14 -7
- package/dist/chunks/chunk-FBRYV5YN.js.map +6 -0
- package/dist/chunks/{chunk-2VSICYQP.js → chunk-FWTWILCD.js} +2 -2
- package/dist/chunks/{chunk-HUONDMU4.js → chunk-G4R65ULE.js} +2 -2
- package/dist/chunks/{chunk-C5XQHEYB.js → chunk-G7LMPHZE.js} +2 -2
- package/dist/chunks/{chunk-XHLFI6F6.js → chunk-GD7VSTWZ.js} +2 -2
- package/dist/chunks/{chunk-4FV2VZS6.js → chunk-GZNTRTD5.js} +3 -3
- package/dist/chunks/{chunk-UMHKTV2L.js → chunk-H7UZKOVC.js} +132 -4
- package/dist/chunks/chunk-H7UZKOVC.js.map +6 -0
- package/dist/chunks/{chunk-FEIIR46G.js → chunk-HFZLLEJS.js} +5 -5
- package/dist/chunks/chunk-IOWYDR6H.js +414 -0
- package/dist/chunks/chunk-IOWYDR6H.js.map +6 -0
- package/dist/chunks/{chunk-WOSL3OZD.js → chunk-IW3XMMEN.js} +4 -4
- package/dist/chunks/{chunk-DSKNFDTL.js → chunk-KXUKJLA2.js} +2 -2
- package/dist/chunks/{chunk-EA73SWCT.js → chunk-L2AKMCV3.js} +4 -4
- package/dist/chunks/{chunk-Z6J7SVOB.js → chunk-LC7SV2KM.js} +2 -2
- package/dist/chunks/{chunk-J7SA5BCI.js → chunk-LOUV4VZ6.js} +4 -4
- package/dist/chunks/{chunk-DI4L3GH5.js → chunk-LQJLTW2D.js} +2 -2
- package/dist/chunks/{chunk-HTHNDZ3L.js → chunk-LRFRTQW7.js} +2 -2
- package/dist/chunks/{chunk-EKMHZKVP.js → chunk-MDY2IMVQ.js} +2 -2
- package/dist/chunks/{chunk-NTV2XD2J.js → chunk-MNMKHEMI.js} +2 -2
- package/dist/chunks/{chunk-ZDZ35MMZ.js → chunk-MTY4XYDO.js} +2 -2
- package/dist/chunks/{chunk-OAHCS42A.js → chunk-MZURZ6P4.js} +2 -2
- package/dist/chunks/{chunk-6CFPN6I4.js → chunk-NFKSV6UI.js} +2 -2
- package/dist/chunks/{chunk-TI6FFONP.js → chunk-NIRQFXO6.js} +2 -2
- package/dist/chunks/{chunk-QPR3UA4L.js → chunk-NJWQUZF2.js} +2 -2
- package/dist/chunks/{chunk-EKQ6J5KA.js → chunk-NRGGICBE.js} +2 -2
- package/dist/chunks/{chunk-ZMKEYARZ.js → chunk-NW6VBCCU.js} +6 -6
- package/dist/chunks/{chunk-UWN4WNQZ.js → chunk-ORCR5VST.js} +2 -2
- package/dist/chunks/{chunk-TUXH7IXQ.js → chunk-P6OOW3RL.js} +2 -2
- package/dist/chunks/{chunk-46VSU4QF.js → chunk-PXA27JGJ.js} +2 -2
- package/dist/chunks/{chunk-SPSWX3QZ.js → chunk-PXJ2KPOI.js} +2 -2
- package/dist/chunks/chunk-QBCGPM4E.js +41 -0
- package/dist/chunks/chunk-QBCGPM4E.js.map +6 -0
- package/dist/chunks/{chunk-VVWI4EB7.js → chunk-QE5PQM5T.js} +3 -3
- package/dist/chunks/{chunk-SHUA4YUK.js → chunk-QIDU76IF.js} +2 -2
- package/dist/chunks/{chunk-SB3A7KUJ.js → chunk-QP435RW7.js} +4 -4
- package/dist/chunks/{chunk-FX7BSCB4.js → chunk-QPAWT3EG.js} +4 -4
- package/dist/chunks/{chunk-BHOZPFJM.js → chunk-QTPZCVPP.js} +5 -5
- package/dist/chunks/{chunk-CCYAWSZL.js → chunk-RFGMOXA6.js} +5 -5
- package/dist/chunks/{chunk-N56NUKMT.js → chunk-RPXTYB22.js} +2 -2
- package/dist/chunks/chunk-RVXJ5MYA.js +686 -0
- package/dist/chunks/chunk-RVXJ5MYA.js.map +6 -0
- package/dist/chunks/{chunk-X6SREM2V.js → chunk-RXUWYGFX.js} +7 -7
- package/dist/chunks/{chunk-DIWEKTYK.js → chunk-S5R2E5TZ.js} +5 -5
- package/dist/chunks/{chunk-DOFQWVBL.js → chunk-T3NIOUQJ.js} +3 -3
- package/dist/chunks/{chunk-LMLJ7NS5.js → chunk-TMOEYXPR.js} +5 -5
- package/dist/chunks/{chunk-PV65WQHD.js → chunk-UNO2ZRXA.js} +12 -12
- package/dist/chunks/{chunk-ZZNHDQAD.js → chunk-UNZNPAW7.js} +2 -2
- package/dist/chunks/{chunk-PYSZ7JTU.js → chunk-URIGGSIK.js} +2 -2
- package/dist/chunks/{chunk-RJWPNAYL.js → chunk-UWYDZYCZ.js} +6 -6
- package/dist/chunks/chunk-UYAI6F3R.js +44 -0
- package/dist/chunks/chunk-UYAI6F3R.js.map +6 -0
- package/dist/chunks/{chunk-P5E6ITP5.js → chunk-VG6RBHI4.js} +5 -5
- package/dist/chunks/{chunk-A47ZNTW7.js → chunk-VV2EHZOG.js} +3 -3
- package/dist/chunks/{chunk-VYLCV6W3.js → chunk-WY6KOPIY.js} +9 -9
- package/dist/chunks/{chunk-HOKSVFIC.js → chunk-XFVVJAI3.js} +6 -6
- package/dist/chunks/{chunk-MYVF3JRV.js → chunk-XKIV3H62.js} +6 -6
- package/dist/chunks/{chunk-J3PHMXN4.js → chunk-XLDFNUCV.js} +4 -4
- package/dist/chunks/{chunk-KAPCNFMC.js → chunk-XODDL7OV.js} +3 -3
- package/dist/chunks/{chunk-DHS5CQNC.js → chunk-XTVF376M.js} +12 -12
- package/dist/chunks/{chunk-PSLNHLZI.js → chunk-YLCMBXE3.js} +3 -3
- package/dist/chunks/{chunk-P7FHJL3V.js → chunk-YNY6XL5T.js} +2 -2
- package/dist/chunks/{chunk-KO2N6EIF.js → chunk-YVJVXTUS.js} +10 -10
- package/dist/chunks/{chunk-LOWGGJOB.js → chunk-ZYSTDBP7.js} +7 -112
- package/dist/chunks/chunk-ZYSTDBP7.js.map +6 -0
- package/dist/chunks/{cli-runtime-SVXU6U4V.js → cli-runtime-33Z22SZM.js} +24 -24
- package/dist/chunks/{commands-A2E3OV7F.js → commands-DLREWCNK.js} +5 -5
- package/dist/chunks/{cost-NA7APCZD.js → cost-MJOM52FI.js} +8 -8
- package/dist/chunks/{crash-report-C6QXQJAK.js → crash-report-62LMID3V.js} +9 -9
- package/dist/chunks/{dist-5SZ7VOLE.js → dist-HA6ABMIV.js} +2 -2
- package/dist/chunks/{dist-GVGW7AZ2.js → dist-HWU5U4SQ.js} +2 -2
- package/dist/chunks/{dist-HASAHQL3.js → dist-IL4H4QGY.js} +2 -2
- package/dist/chunks/{dist-G4BSVJKY.js → dist-MTYIYUQU.js} +2 -2
- package/dist/chunks/{dist-LBTLFSNF.js → dist-NUPNUHXB.js} +66 -2
- package/dist/chunks/{dist-3PE5MOU6.js → dist-TCKNCSZO.js} +2 -2
- package/dist/chunks/{dist-HYKH6P7F.js → dist-U7A47UOF.js} +2 -2
- package/dist/chunks/{dist-6CHQ5OPZ.js → dist-XFBNYCQ7.js} +2 -2
- package/dist/chunks/{doctor-Y5PQ2R7D.js → doctor-V5C6R5EN.js} +43 -40
- package/dist/chunks/{drain-RG275P5J.js → drain-CS7XQ5B7.js} +14 -14
- package/dist/chunks/{entry-BJY7UE6P.js → entry-HXLBVNDK.js} +6 -6
- package/dist/chunks/{eval-GG2BH7CQ.js → eval-NRBZ4IWO.js} +11 -11
- package/dist/chunks/{exec-63SUPKUV.js → exec-GCNNTGHM.js} +82 -54
- package/dist/chunks/exec-GCNNTGHM.js.map +6 -0
- package/dist/chunks/{github-MGIA7MTZ.js → github-Z3JQNLXA.js} +5 -5
- package/dist/chunks/{home-KMZDOTX5.js → home-GP3Y7F5H.js} +3 -3
- package/dist/chunks/{host-OB5CL3GG.js → host-C5GIO57R.js} +10 -10
- package/dist/chunks/{host-queries-2GQM7BTI.js → host-queries-F5Y3L7E4.js} +15 -15
- package/dist/chunks/{learn-LUEHNOMA.js → learn-5FEP65D6.js} +12 -12
- package/dist/chunks/{learn-builtin-R2Z27LDI.js → learn-builtin-HV3ASHAJ.js} +17 -17
- package/dist/chunks/{lifecycle-DCLLAROM.js → lifecycle-TMZEWFWF.js} +36 -36
- package/dist/chunks/{list-5UW5SFIX.js → list-MD6ZN2PW.js} +18 -18
- package/dist/chunks/{live-YUE4AKRQ.js → live-OVTHCQB3.js} +41 -38
- package/dist/chunks/load-ADBRLXAL.js +73 -0
- package/dist/chunks/{login-ELIGI6HT.js → login-RV3AHE4C.js} +13 -13
- package/dist/chunks/{logs-PXASK6XI.js → logs-6SBW5BWD.js} +5 -5
- package/dist/chunks/{mcp-YVV35X7H.js → mcp-3QDMZ7PD.js} +33 -33
- package/dist/chunks/{message-command-QVGOKB4W.js → message-command-TW57Q7AB.js} +57 -54
- package/dist/chunks/message-command-TW57Q7AB.js.map +6 -0
- package/dist/chunks/{open-MDT2NTF4.js → open-K4R6E6QJ.js} +8 -8
- package/dist/chunks/{operator-tools-LYY2FXSO.js → operator-tools-YX4575HD.js} +14 -14
- package/dist/chunks/{output-schema-VR43KZNJ.js → output-schema-QBKJSX77.js} +3 -3
- package/dist/chunks/{pal-YXOWNULV.js → pal-KLH2IC3W.js} +19 -19
- package/dist/chunks/{peers-CJOTRI4W.js → peers-5BMGZLHY.js} +18 -18
- package/dist/chunks/{peers-6M4UPHDF.js → peers-6F4JS4VL.js} +6 -6
- package/dist/chunks/{plugin-IVIHCAEO.js → plugin-T6ULGX5N.js} +101 -20
- package/dist/chunks/plugin-T6ULGX5N.js.map +6 -0
- package/dist/chunks/{providers-7WDY37V3.js → providers-YJVPCIRI.js} +11 -11
- package/dist/chunks/{pty-CLDDZT5T.js → pty-UMMMCRJW.js} +3 -3
- package/dist/chunks/resume-RKZ52FZP.js +23 -0
- package/dist/chunks/{resume-command-TXPTYQFF.js → resume-command-H4IJJDLH.js} +4 -4
- package/dist/chunks/{running-KBISZDIQ.js → running-UTOYIBXM.js} +5 -5
- package/dist/chunks/{schedule-ECZVNZLH.js → schedule-KWX4SXS5.js} +8 -8
- package/dist/chunks/{send-VUJ33MJM.js → send-UEL2L3VA.js} +16 -16
- package/dist/chunks/{send-person-WXM7Y5PZ.js → send-person-X3SWXKWV.js} +13 -13
- package/dist/chunks/{service-DORQ3PNE.js → service-4VS6XQ7O.js} +41 -41
- package/dist/chunks/{skills-W7KY3WX4.js → skills-LK7WSDDG.js} +45 -16
- package/dist/chunks/skills-LK7WSDDG.js.map +6 -0
- package/dist/chunks/{start-check-KECY75IO.js → start-check-HTPENJ36.js} +2 -2
- package/dist/chunks/{startup-failure-MS7TPUMI.js → startup-failure-LKAHWAYZ.js} +2 -2
- package/dist/chunks/{state-YK5JWP5I.js → state-UQPKWIYT.js} +6 -6
- package/dist/chunks/{store-TM7VDQ5G.js → store-74PEEN6L.js} +4 -4
- package/dist/chunks/{store-XIPDR26B.js → store-BY6HMUUN.js} +6 -6
- package/dist/chunks/{store-7SFKBFX6.js → store-MILGWYSA.js} +10 -10
- package/dist/chunks/{store-H4IVAEZK.js → store-UHIHEGKS.js} +3 -3
- package/dist/chunks/store-UHIHEGKS.js.map +6 -0
- package/dist/chunks/{tui-XKAQI3DD.js → tui-FOVSBYCD.js} +86 -81
- package/dist/chunks/tui-FOVSBYCD.js.map +6 -0
- package/dist/chunks/{upgrade-GLEEEZWO.js → upgrade-V5ST42EQ.js} +10 -10
- package/dist/chunks/{watch-XZKKDKAF.js → watch-Q7MSKZIA.js} +96 -91
- package/dist/chunks/watch-Q7MSKZIA.js.map +6 -0
- package/dist/chunks/{workspaces-GS6D72XT.js → workspaces-2AL72WFH.js} +19 -19
- package/dist/chunks/worktree-QPKIZBSK.js +204 -0
- package/dist/chunks/worktree-QPKIZBSK.js.map +6 -0
- package/dist/commands/acp.d.ts.map +1 -1
- package/dist/commands/desktop-host.d.ts.map +1 -1
- package/dist/commands/exec-json.d.ts.map +1 -1
- package/dist/commands/exec.d.ts.map +1 -1
- package/dist/commands/worktree.d.ts.map +1 -1
- package/dist/config/hook-common-shape.d.ts +2 -0
- package/dist/config/hook-common-shape.d.ts.map +1 -1
- package/dist/config/hook-layers.d.ts.map +1 -1
- package/dist/config/load.d.ts +25 -1
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/skill-hooks-reader.d.ts +46 -0
- package/dist/config/skill-hooks-reader.d.ts.map +1 -0
- package/dist/doctor/checks/hooks.d.ts +7 -2
- package/dist/doctor/checks/hooks.d.ts.map +1 -1
- package/dist/index.js +44 -41
- package/dist/integrations/plugins/hook-activity.d.ts +62 -0
- package/dist/integrations/plugins/hook-activity.d.ts.map +1 -0
- package/dist/integrations/plugins/hook-entries.d.ts +92 -0
- package/dist/integrations/plugins/hook-entries.d.ts.map +1 -0
- package/dist/integrations/plugins/runtime.d.ts +52 -2
- package/dist/integrations/plugins/runtime.d.ts.map +1 -1
- package/dist/integrations/plugins/validate.d.ts.map +1 -1
- package/dist/integrations/subagents/NamzuCliAgent.d.ts +9 -1
- package/dist/integrations/subagents/NamzuCliAgent.d.ts.map +1 -1
- package/dist/integrations/subagents/agent-hooks.d.ts +116 -0
- package/dist/integrations/subagents/agent-hooks.d.ts.map +1 -0
- package/dist/integrations/subagents/definitions.d.ts +18 -0
- package/dist/integrations/subagents/definitions.d.ts.map +1 -1
- package/dist/integrations/subagents/runtime.d.ts +23 -0
- package/dist/integrations/subagents/runtime.d.ts.map +1 -1
- package/dist/integrations/subagents/worktree-driver.d.ts +20 -5
- package/dist/integrations/subagents/worktree-driver.d.ts.map +1 -1
- package/dist/integrations/trust/folder-grants.d.ts.map +1 -1
- package/dist/integrations/worktrees/hook-host.d.ts +23 -0
- package/dist/integrations/worktrees/hook-host.d.ts.map +1 -0
- package/dist/integrations/worktrees/managed.d.ts +20 -2
- package/dist/integrations/worktrees/managed.d.ts.map +1 -1
- package/dist/integrations/worktrees/untrusted-hook.d.ts +16 -0
- package/dist/integrations/worktrees/untrusted-hook.d.ts.map +1 -0
- package/dist/schedule/fire/fire.d.ts.map +1 -1
- package/dist/skills/audit.d.ts +11 -0
- package/dist/skills/audit.d.ts.map +1 -1
- package/dist/skills/catalog.d.ts +3 -0
- package/dist/skills/catalog.d.ts.map +1 -1
- package/dist/skills/skill-hooks.d.ts +52 -0
- package/dist/skills/skill-hooks.d.ts.map +1 -0
- package/dist/skills/store.d.ts +3 -0
- package/dist/skills/store.d.ts.map +1 -1
- package/dist/skills/use-hooks.d.ts +25 -0
- package/dist/skills/use-hooks.d.ts.map +1 -0
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/agent.d.ts +73 -1
- package/dist/tui/agent.d.ts.map +1 -1
- package/dist/tui/plugin-view.d.ts.map +1 -1
- package/dist/tui/slashCommands.d.ts +44 -1
- package/dist/tui/slashCommands.d.ts.map +1 -1
- package/dist/user-commands/store.d.ts +2 -0
- package/dist/user-commands/store.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/chunks/acp-IOWTKF2X.js.map +0 -6
- package/dist/chunks/agent-session-L6J5GZVX.js +0 -73
- package/dist/chunks/chunk-5I45HTKW.js.map +0 -6
- package/dist/chunks/chunk-5NDRDTNX.js.map +0 -6
- package/dist/chunks/chunk-AME342DQ.js +0 -245
- package/dist/chunks/chunk-AME342DQ.js.map +0 -6
- package/dist/chunks/chunk-HGZYNEQE.js.map +0 -6
- package/dist/chunks/chunk-KNQ7R54U.js.map +0 -6
- package/dist/chunks/chunk-LOWGGJOB.js.map +0 -6
- package/dist/chunks/chunk-UJOWXA23.js.map +0 -6
- package/dist/chunks/chunk-UMHKTV2L.js.map +0 -6
- package/dist/chunks/chunk-V7VNFYA4.js.map +0 -6
- package/dist/chunks/chunk-WSMX3IQE.js.map +0 -6
- package/dist/chunks/chunk-YELRULQ7.js.map +0 -6
- package/dist/chunks/chunk-YSKCWH72.js.map +0 -6
- package/dist/chunks/exec-63SUPKUV.js.map +0 -6
- package/dist/chunks/message-command-QVGOKB4W.js.map +0 -6
- package/dist/chunks/plugin-IVIHCAEO.js.map +0 -6
- package/dist/chunks/resume-ZRVTAGB6.js +0 -23
- package/dist/chunks/skills-W7KY3WX4.js.map +0 -6
- package/dist/chunks/tui-XKAQI3DD.js.map +0 -6
- package/dist/chunks/watch-XZKKDKAF.js.map +0 -6
- package/dist/chunks/worktree-Z456JZKA.js +0 -119
- package/dist/chunks/worktree-Z456JZKA.js.map +0 -6
- /package/dist/chunks/{activity-command-U2AOTIVF.js.map → activity-command-2QIWTUUB.js.map} +0 -0
- /package/dist/chunks/{add-YYQLPCP2.js.map → add-2YDEALUT.js.map} +0 -0
- /package/dist/chunks/{agent-WL6NX4W6.js.map → agent-IKQ67NMW.js.map} +0 -0
- /package/dist/chunks/{agent-session-L6J5GZVX.js.map → agent-session-H3OE6ZJT.js.map} +0 -0
- /package/dist/chunks/{apply-at-exit-BRXYTQVG.js.map → apply-at-exit-F4G7PCZL.js.map} +0 -0
- /package/dist/chunks/{archive-UE756BME.js.map → archive-FOTYHQPL.js.map} +0 -0
- /package/dist/chunks/{bin-main-XR2DJOI6.js.map → bin-main-DWOCG2WK.js.map} +0 -0
- /package/dist/chunks/{binding-HCIPLFUO.js.map → binding-2GEVBR5H.js.map} +0 -0
- /package/dist/chunks/{browser-7SFVCKSO.js.map → browser-WYPSIPEZ.js.map} +0 -0
- /package/dist/chunks/{chat-K6GQGRUA.js.map → chat-LWVIDEXR.js.map} +0 -0
- /package/dist/chunks/{chunk-CQKYKQEF.js.map → chunk-2CYBRCPH.js.map} +0 -0
- /package/dist/chunks/{chunk-7AWFHVMT.js.map → chunk-2Q2TPLYP.js.map} +0 -0
- /package/dist/chunks/{chunk-TYTE2GIF.js.map → chunk-2QMXCXZ2.js.map} +0 -0
- /package/dist/chunks/{chunk-Z5NMQ2YN.js.map → chunk-33WFG4C3.js.map} +0 -0
- /package/dist/chunks/{chunk-Z5FDI74K.js.map → chunk-3EEKLQXD.js.map} +0 -0
- /package/dist/chunks/{chunk-NZMKMXGG.js.map → chunk-3T5AX2PC.js.map} +0 -0
- /package/dist/chunks/{chunk-OBMHA7OP.js.map → chunk-4ASCYXSH.js.map} +0 -0
- /package/dist/chunks/{chunk-MHXJYXOF.js.map → chunk-4EBZUUE4.js.map} +0 -0
- /package/dist/chunks/{chunk-3NAVAACC.js.map → chunk-5F4SSZKS.js.map} +0 -0
- /package/dist/chunks/{chunk-RDW6L3PV.js.map → chunk-5JQIGBBR.js.map} +0 -0
- /package/dist/chunks/{chunk-HJILJSZO.js.map → chunk-6CXEEZLK.js.map} +0 -0
- /package/dist/chunks/{chunk-2U357RJS.js.map → chunk-6JKNPDZD.js.map} +0 -0
- /package/dist/chunks/{chunk-AGFGC7SI.js.map → chunk-6KIXUAOC.js.map} +0 -0
- /package/dist/chunks/{chunk-2WDF5N2A.js.map → chunk-6NUQEVHG.js.map} +0 -0
- /package/dist/chunks/{chunk-4RTQTX5R.js.map → chunk-6RTDZGPO.js.map} +0 -0
- /package/dist/chunks/{chunk-7JT7DNR7.js.map → chunk-7T6TX47O.js.map} +0 -0
- /package/dist/chunks/{chunk-SVMGV4AS.js.map → chunk-AZHBCP6G.js.map} +0 -0
- /package/dist/chunks/{chunk-POOJ2MUS.js.map → chunk-BLGPF6UL.js.map} +0 -0
- /package/dist/chunks/{chunk-F3SQRGKZ.js.map → chunk-CMHOQ62S.js.map} +0 -0
- /package/dist/chunks/{chunk-24N42TGE.js.map → chunk-D5RO75LO.js.map} +0 -0
- /package/dist/chunks/{chunk-M3AUPUII.js.map → chunk-D7JY7KNY.js.map} +0 -0
- /package/dist/chunks/{chunk-RAPO3KLG.js.map → chunk-DTORDCJR.js.map} +0 -0
- /package/dist/chunks/{chunk-O326HKCW.js.map → chunk-EADNTGVW.js.map} +0 -0
- /package/dist/chunks/{chunk-2VSICYQP.js.map → chunk-FWTWILCD.js.map} +0 -0
- /package/dist/chunks/{chunk-HUONDMU4.js.map → chunk-G4R65ULE.js.map} +0 -0
- /package/dist/chunks/{chunk-C5XQHEYB.js.map → chunk-G7LMPHZE.js.map} +0 -0
- /package/dist/chunks/{chunk-XHLFI6F6.js.map → chunk-GD7VSTWZ.js.map} +0 -0
- /package/dist/chunks/{chunk-4FV2VZS6.js.map → chunk-GZNTRTD5.js.map} +0 -0
- /package/dist/chunks/{chunk-FEIIR46G.js.map → chunk-HFZLLEJS.js.map} +0 -0
- /package/dist/chunks/{chunk-WOSL3OZD.js.map → chunk-IW3XMMEN.js.map} +0 -0
- /package/dist/chunks/{chunk-DSKNFDTL.js.map → chunk-KXUKJLA2.js.map} +0 -0
- /package/dist/chunks/{chunk-EA73SWCT.js.map → chunk-L2AKMCV3.js.map} +0 -0
- /package/dist/chunks/{chunk-Z6J7SVOB.js.map → chunk-LC7SV2KM.js.map} +0 -0
- /package/dist/chunks/{chunk-J7SA5BCI.js.map → chunk-LOUV4VZ6.js.map} +0 -0
- /package/dist/chunks/{chunk-DI4L3GH5.js.map → chunk-LQJLTW2D.js.map} +0 -0
- /package/dist/chunks/{chunk-HTHNDZ3L.js.map → chunk-LRFRTQW7.js.map} +0 -0
- /package/dist/chunks/{chunk-EKMHZKVP.js.map → chunk-MDY2IMVQ.js.map} +0 -0
- /package/dist/chunks/{chunk-NTV2XD2J.js.map → chunk-MNMKHEMI.js.map} +0 -0
- /package/dist/chunks/{chunk-ZDZ35MMZ.js.map → chunk-MTY4XYDO.js.map} +0 -0
- /package/dist/chunks/{chunk-OAHCS42A.js.map → chunk-MZURZ6P4.js.map} +0 -0
- /package/dist/chunks/{chunk-6CFPN6I4.js.map → chunk-NFKSV6UI.js.map} +0 -0
- /package/dist/chunks/{chunk-TI6FFONP.js.map → chunk-NIRQFXO6.js.map} +0 -0
- /package/dist/chunks/{chunk-QPR3UA4L.js.map → chunk-NJWQUZF2.js.map} +0 -0
- /package/dist/chunks/{chunk-EKQ6J5KA.js.map → chunk-NRGGICBE.js.map} +0 -0
- /package/dist/chunks/{chunk-ZMKEYARZ.js.map → chunk-NW6VBCCU.js.map} +0 -0
- /package/dist/chunks/{chunk-UWN4WNQZ.js.map → chunk-ORCR5VST.js.map} +0 -0
- /package/dist/chunks/{chunk-TUXH7IXQ.js.map → chunk-P6OOW3RL.js.map} +0 -0
- /package/dist/chunks/{chunk-46VSU4QF.js.map → chunk-PXA27JGJ.js.map} +0 -0
- /package/dist/chunks/{chunk-SPSWX3QZ.js.map → chunk-PXJ2KPOI.js.map} +0 -0
- /package/dist/chunks/{chunk-VVWI4EB7.js.map → chunk-QE5PQM5T.js.map} +0 -0
- /package/dist/chunks/{chunk-SHUA4YUK.js.map → chunk-QIDU76IF.js.map} +0 -0
- /package/dist/chunks/{chunk-SB3A7KUJ.js.map → chunk-QP435RW7.js.map} +0 -0
- /package/dist/chunks/{chunk-FX7BSCB4.js.map → chunk-QPAWT3EG.js.map} +0 -0
- /package/dist/chunks/{chunk-BHOZPFJM.js.map → chunk-QTPZCVPP.js.map} +0 -0
- /package/dist/chunks/{chunk-CCYAWSZL.js.map → chunk-RFGMOXA6.js.map} +0 -0
- /package/dist/chunks/{chunk-N56NUKMT.js.map → chunk-RPXTYB22.js.map} +0 -0
- /package/dist/chunks/{chunk-X6SREM2V.js.map → chunk-RXUWYGFX.js.map} +0 -0
- /package/dist/chunks/{chunk-DIWEKTYK.js.map → chunk-S5R2E5TZ.js.map} +0 -0
- /package/dist/chunks/{chunk-DOFQWVBL.js.map → chunk-T3NIOUQJ.js.map} +0 -0
- /package/dist/chunks/{chunk-LMLJ7NS5.js.map → chunk-TMOEYXPR.js.map} +0 -0
- /package/dist/chunks/{chunk-PV65WQHD.js.map → chunk-UNO2ZRXA.js.map} +0 -0
- /package/dist/chunks/{chunk-ZZNHDQAD.js.map → chunk-UNZNPAW7.js.map} +0 -0
- /package/dist/chunks/{chunk-PYSZ7JTU.js.map → chunk-URIGGSIK.js.map} +0 -0
- /package/dist/chunks/{chunk-RJWPNAYL.js.map → chunk-UWYDZYCZ.js.map} +0 -0
- /package/dist/chunks/{chunk-P5E6ITP5.js.map → chunk-VG6RBHI4.js.map} +0 -0
- /package/dist/chunks/{chunk-A47ZNTW7.js.map → chunk-VV2EHZOG.js.map} +0 -0
- /package/dist/chunks/{chunk-VYLCV6W3.js.map → chunk-WY6KOPIY.js.map} +0 -0
- /package/dist/chunks/{chunk-HOKSVFIC.js.map → chunk-XFVVJAI3.js.map} +0 -0
- /package/dist/chunks/{chunk-MYVF3JRV.js.map → chunk-XKIV3H62.js.map} +0 -0
- /package/dist/chunks/{chunk-J3PHMXN4.js.map → chunk-XLDFNUCV.js.map} +0 -0
- /package/dist/chunks/{chunk-KAPCNFMC.js.map → chunk-XODDL7OV.js.map} +0 -0
- /package/dist/chunks/{chunk-DHS5CQNC.js.map → chunk-XTVF376M.js.map} +0 -0
- /package/dist/chunks/{chunk-PSLNHLZI.js.map → chunk-YLCMBXE3.js.map} +0 -0
- /package/dist/chunks/{chunk-P7FHJL3V.js.map → chunk-YNY6XL5T.js.map} +0 -0
- /package/dist/chunks/{chunk-KO2N6EIF.js.map → chunk-YVJVXTUS.js.map} +0 -0
- /package/dist/chunks/{cli-runtime-SVXU6U4V.js.map → cli-runtime-33Z22SZM.js.map} +0 -0
- /package/dist/chunks/{commands-A2E3OV7F.js.map → commands-DLREWCNK.js.map} +0 -0
- /package/dist/chunks/{cost-NA7APCZD.js.map → cost-MJOM52FI.js.map} +0 -0
- /package/dist/chunks/{crash-report-C6QXQJAK.js.map → crash-report-62LMID3V.js.map} +0 -0
- /package/dist/chunks/{dist-5SZ7VOLE.js.map → dist-HA6ABMIV.js.map} +0 -0
- /package/dist/chunks/{dist-GVGW7AZ2.js.map → dist-HWU5U4SQ.js.map} +0 -0
- /package/dist/chunks/{dist-HASAHQL3.js.map → dist-IL4H4QGY.js.map} +0 -0
- /package/dist/chunks/{dist-G4BSVJKY.js.map → dist-MTYIYUQU.js.map} +0 -0
- /package/dist/chunks/{dist-LBTLFSNF.js.map → dist-NUPNUHXB.js.map} +0 -0
- /package/dist/chunks/{dist-3PE5MOU6.js.map → dist-TCKNCSZO.js.map} +0 -0
- /package/dist/chunks/{dist-HYKH6P7F.js.map → dist-U7A47UOF.js.map} +0 -0
- /package/dist/chunks/{dist-6CHQ5OPZ.js.map → dist-XFBNYCQ7.js.map} +0 -0
- /package/dist/chunks/{doctor-Y5PQ2R7D.js.map → doctor-V5C6R5EN.js.map} +0 -0
- /package/dist/chunks/{drain-RG275P5J.js.map → drain-CS7XQ5B7.js.map} +0 -0
- /package/dist/chunks/{entry-BJY7UE6P.js.map → entry-HXLBVNDK.js.map} +0 -0
- /package/dist/chunks/{eval-GG2BH7CQ.js.map → eval-NRBZ4IWO.js.map} +0 -0
- /package/dist/chunks/{github-MGIA7MTZ.js.map → github-Z3JQNLXA.js.map} +0 -0
- /package/dist/chunks/{home-KMZDOTX5.js.map → home-GP3Y7F5H.js.map} +0 -0
- /package/dist/chunks/{host-OB5CL3GG.js.map → host-C5GIO57R.js.map} +0 -0
- /package/dist/chunks/{host-queries-2GQM7BTI.js.map → host-queries-F5Y3L7E4.js.map} +0 -0
- /package/dist/chunks/{learn-LUEHNOMA.js.map → learn-5FEP65D6.js.map} +0 -0
- /package/dist/chunks/{learn-builtin-R2Z27LDI.js.map → learn-builtin-HV3ASHAJ.js.map} +0 -0
- /package/dist/chunks/{lifecycle-DCLLAROM.js.map → lifecycle-TMZEWFWF.js.map} +0 -0
- /package/dist/chunks/{list-5UW5SFIX.js.map → list-MD6ZN2PW.js.map} +0 -0
- /package/dist/chunks/{live-YUE4AKRQ.js.map → live-OVTHCQB3.js.map} +0 -0
- /package/dist/chunks/{login-ELIGI6HT.js.map → load-ADBRLXAL.js.map} +0 -0
- /package/dist/chunks/{open-MDT2NTF4.js.map → login-RV3AHE4C.js.map} +0 -0
- /package/dist/chunks/{logs-PXASK6XI.js.map → logs-6SBW5BWD.js.map} +0 -0
- /package/dist/chunks/{mcp-YVV35X7H.js.map → mcp-3QDMZ7PD.js.map} +0 -0
- /package/dist/chunks/{output-schema-VR43KZNJ.js.map → open-K4R6E6QJ.js.map} +0 -0
- /package/dist/chunks/{operator-tools-LYY2FXSO.js.map → operator-tools-YX4575HD.js.map} +0 -0
- /package/dist/chunks/{peers-6M4UPHDF.js.map → output-schema-QBKJSX77.js.map} +0 -0
- /package/dist/chunks/{pal-YXOWNULV.js.map → pal-KLH2IC3W.js.map} +0 -0
- /package/dist/chunks/{peers-CJOTRI4W.js.map → peers-5BMGZLHY.js.map} +0 -0
- /package/dist/chunks/{providers-7WDY37V3.js.map → peers-6F4JS4VL.js.map} +0 -0
- /package/dist/chunks/{pty-CLDDZT5T.js.map → providers-YJVPCIRI.js.map} +0 -0
- /package/dist/chunks/{resume-ZRVTAGB6.js.map → pty-UMMMCRJW.js.map} +0 -0
- /package/dist/chunks/{resume-command-TXPTYQFF.js.map → resume-RKZ52FZP.js.map} +0 -0
- /package/dist/chunks/{running-KBISZDIQ.js.map → resume-command-H4IJJDLH.js.map} +0 -0
- /package/dist/chunks/{send-VUJ33MJM.js.map → running-UTOYIBXM.js.map} +0 -0
- /package/dist/chunks/{schedule-ECZVNZLH.js.map → schedule-KWX4SXS5.js.map} +0 -0
- /package/dist/chunks/{send-person-WXM7Y5PZ.js.map → send-UEL2L3VA.js.map} +0 -0
- /package/dist/chunks/{start-check-KECY75IO.js.map → send-person-X3SWXKWV.js.map} +0 -0
- /package/dist/chunks/{service-DORQ3PNE.js.map → service-4VS6XQ7O.js.map} +0 -0
- /package/dist/chunks/{store-7SFKBFX6.js.map → start-check-HTPENJ36.js.map} +0 -0
- /package/dist/chunks/{startup-failure-MS7TPUMI.js.map → startup-failure-LKAHWAYZ.js.map} +0 -0
- /package/dist/chunks/{state-YK5JWP5I.js.map → state-UQPKWIYT.js.map} +0 -0
- /package/dist/chunks/{store-H4IVAEZK.js.map → store-74PEEN6L.js.map} +0 -0
- /package/dist/chunks/{store-TM7VDQ5G.js.map → store-BY6HMUUN.js.map} +0 -0
- /package/dist/chunks/{store-XIPDR26B.js.map → store-MILGWYSA.js.map} +0 -0
- /package/dist/chunks/{upgrade-GLEEEZWO.js.map → upgrade-V5ST42EQ.js.map} +0 -0
- /package/dist/chunks/{workspaces-GS6D72XT.js.map → workspaces-2AL72WFH.js.map} +0 -0
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
import { createRequire as __namzuCreateRequire } from 'node:module';
|
|
2
2
|
const require = __namzuCreateRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
|
+
createCliPluginRuntime,
|
|
4
5
|
openManagedWorktrees
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RVXJ5MYA.js";
|
|
7
|
+
import {
|
|
8
|
+
runGeneratorCycle
|
|
9
|
+
} from "./chunk-XODDL7OV.js";
|
|
10
|
+
import {
|
|
11
|
+
createSessionLearningFeed,
|
|
12
|
+
openLearningTarget,
|
|
13
|
+
readProjectGuidance,
|
|
14
|
+
withSessionLearningFeed
|
|
15
|
+
} from "./chunk-QP435RW7.js";
|
|
6
16
|
import {
|
|
7
17
|
connectMcpServers,
|
|
8
18
|
startMcpServers
|
|
9
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-L2AKMCV3.js";
|
|
10
20
|
import {
|
|
11
21
|
openInBrowser
|
|
12
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-G7LMPHZE.js";
|
|
13
23
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
readPluginFileSources,
|
|
17
|
-
resolvePluginFileDirs
|
|
18
|
-
} from "./chunk-LOWGGJOB.js";
|
|
24
|
+
readPluginFileSources
|
|
25
|
+
} from "./chunk-ZYSTDBP7.js";
|
|
19
26
|
import {
|
|
20
27
|
createSessionSkillCatalog
|
|
21
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-5S7U5MFW.js";
|
|
22
29
|
import {
|
|
23
30
|
KEY_MISMATCH_MESSAGE,
|
|
24
31
|
MAX_SCRIPT_BYTES,
|
|
@@ -42,16 +49,7 @@ import {
|
|
|
42
49
|
viewFromJournal,
|
|
43
50
|
workflowJournalKey,
|
|
44
51
|
writeEditableCopy
|
|
45
|
-
} from "./chunk-
|
|
46
|
-
import {
|
|
47
|
-
runGeneratorCycle
|
|
48
|
-
} from "./chunk-KAPCNFMC.js";
|
|
49
|
-
import {
|
|
50
|
-
createSessionLearningFeed,
|
|
51
|
-
openLearningTarget,
|
|
52
|
-
readProjectGuidance,
|
|
53
|
-
withSessionLearningFeed
|
|
54
|
-
} from "./chunk-SB3A7KUJ.js";
|
|
52
|
+
} from "./chunk-MNMKHEMI.js";
|
|
55
53
|
import {
|
|
56
54
|
createBrowserControl
|
|
57
55
|
} from "./chunk-WHODOMXA.js";
|
|
@@ -60,10 +58,10 @@ import {
|
|
|
60
58
|
} from "./chunk-YOWYTBJS.js";
|
|
61
59
|
import {
|
|
62
60
|
migrateAccountKeys
|
|
63
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-TMOEYXPR.js";
|
|
64
62
|
import {
|
|
65
63
|
openCliAccounts
|
|
66
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-RFGMOXA6.js";
|
|
67
65
|
import {
|
|
68
66
|
CredentialRefreshRejectedError,
|
|
69
67
|
CredentialWithdrawnError as CredentialWithdrawnError2,
|
|
@@ -71,16 +69,16 @@ import {
|
|
|
71
69
|
ensureFreshStoredCodexCredential,
|
|
72
70
|
readSubscriptionCredential,
|
|
73
71
|
sameOAuthCredential
|
|
74
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-2CYBRCPH.js";
|
|
75
73
|
import {
|
|
76
74
|
conversationLogPath,
|
|
77
75
|
ensureSessionStarted,
|
|
78
76
|
openConversationLog,
|
|
79
77
|
recordAccountBound
|
|
80
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-XFVVJAI3.js";
|
|
81
79
|
import {
|
|
82
80
|
readIdentity
|
|
83
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-2Q2TPLYP.js";
|
|
84
82
|
import {
|
|
85
83
|
INSTRUCTIONS_FILENAME,
|
|
86
84
|
MAX_CHARS_PER_FILE,
|
|
@@ -91,12 +89,21 @@ import {
|
|
|
91
89
|
} from "./chunk-JQIBPPOL.js";
|
|
92
90
|
import {
|
|
93
91
|
isDefaultAccountId
|
|
94
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-MZURZ6P4.js";
|
|
95
93
|
import {
|
|
96
94
|
createLazyCodeAnalysis,
|
|
95
|
+
discoverAgentDefinitions,
|
|
97
96
|
promptCacheTtl,
|
|
98
97
|
setPromptCacheTtl
|
|
99
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-H7UZKOVC.js";
|
|
99
|
+
import {
|
|
100
|
+
createAgentHooksHost
|
|
101
|
+
} from "./chunk-DCMZYSON.js";
|
|
102
|
+
import {
|
|
103
|
+
readSkillHooks,
|
|
104
|
+
withoutConversationEvents,
|
|
105
|
+
withoutSessionStart
|
|
106
|
+
} from "./chunk-3HJXXP6L.js";
|
|
100
107
|
import {
|
|
101
108
|
DEFAULT_MAX_HOOK_REFUSALS,
|
|
102
109
|
SAVE_SKILL_TOOL_NAME,
|
|
@@ -106,14 +113,14 @@ import {
|
|
|
106
113
|
turnConfigFields,
|
|
107
114
|
withSandboxShell,
|
|
108
115
|
workingDirectoryProblem
|
|
109
|
-
} from "./chunk-
|
|
116
|
+
} from "./chunk-3EEKLQXD.js";
|
|
110
117
|
import {
|
|
111
118
|
CHECK_HINT
|
|
112
119
|
} from "./chunk-BBTPD3DU.js";
|
|
113
120
|
import {
|
|
114
121
|
conversationInUseSentence,
|
|
115
122
|
minutesUntilFree
|
|
116
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-D7JY7KNY.js";
|
|
117
124
|
import {
|
|
118
125
|
debugRequested
|
|
119
126
|
} from "./chunk-GNBMKISG.js";
|
|
@@ -122,7 +129,39 @@ import {
|
|
|
122
129
|
logIgnoreOutcome,
|
|
123
130
|
probeCapabilities,
|
|
124
131
|
writeLocalAllows
|
|
125
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-IW3XMMEN.js";
|
|
133
|
+
import {
|
|
134
|
+
isPermissionMode,
|
|
135
|
+
permissionModeLabel
|
|
136
|
+
} from "./chunk-NJWQUZF2.js";
|
|
137
|
+
import {
|
|
138
|
+
diffColors,
|
|
139
|
+
theme
|
|
140
|
+
} from "./chunk-WD2F6EO3.js";
|
|
141
|
+
import {
|
|
142
|
+
chainCapabilityDisagreements,
|
|
143
|
+
chainPositionName,
|
|
144
|
+
describeAcceptedMismatch,
|
|
145
|
+
describeCapabilityRefusal,
|
|
146
|
+
ensureRegistered,
|
|
147
|
+
isRegistered,
|
|
148
|
+
primaryProvider,
|
|
149
|
+
readPreferences,
|
|
150
|
+
resolveChainCapabilities,
|
|
151
|
+
unresolvedMembers
|
|
152
|
+
} from "./chunk-UNO2ZRXA.js";
|
|
153
|
+
import {
|
|
154
|
+
canSelectModel,
|
|
155
|
+
createGeminiAccessTokenResolver,
|
|
156
|
+
discoverProviders,
|
|
157
|
+
findDetected,
|
|
158
|
+
hasApiCredential,
|
|
159
|
+
requiresCredentialForModel
|
|
160
|
+
} from "./chunk-RXUWYGFX.js";
|
|
161
|
+
import {
|
|
162
|
+
activeZenCatalogue,
|
|
163
|
+
isOfferableModel
|
|
164
|
+
} from "./chunk-4QIWRKJO.js";
|
|
126
165
|
import {
|
|
127
166
|
LOCAL_CONFIG_FILE,
|
|
128
167
|
configuredPassthroughTools,
|
|
@@ -133,19 +172,16 @@ import {
|
|
|
133
172
|
takeConfigWarnings,
|
|
134
173
|
unmatchedPassthroughTools,
|
|
135
174
|
workflowTokenCeiling
|
|
136
|
-
} from "./chunk-
|
|
137
|
-
import {
|
|
138
|
-
compilePermissions,
|
|
139
|
-
isPathRuleTool,
|
|
140
|
-
pathRule,
|
|
141
|
-
pathRuleTools
|
|
142
|
-
} from "./chunk-5NDRDTNX.js";
|
|
175
|
+
} from "./chunk-53UWPLAF.js";
|
|
143
176
|
import {
|
|
144
177
|
resolveGeneratorSettings
|
|
145
178
|
} from "./chunk-LCGXWCVU.js";
|
|
179
|
+
import {
|
|
180
|
+
compilePermissions
|
|
181
|
+
} from "./chunk-DHWD5YYD.js";
|
|
146
182
|
import {
|
|
147
183
|
cliLogger
|
|
148
|
-
} from "./chunk-
|
|
184
|
+
} from "./chunk-G4R65ULE.js";
|
|
149
185
|
import {
|
|
150
186
|
readModelLaunchEnvironment
|
|
151
187
|
} from "./chunk-LVVD32KJ.js";
|
|
@@ -158,48 +194,9 @@ import {
|
|
|
158
194
|
import {
|
|
159
195
|
require_dist
|
|
160
196
|
} from "./chunk-KONYGNG6.js";
|
|
161
|
-
import {
|
|
162
|
-
isPermissionMode,
|
|
163
|
-
permissionModeLabel
|
|
164
|
-
} from "./chunk-QPR3UA4L.js";
|
|
165
|
-
import {
|
|
166
|
-
PERMISSION_MODE_NAMES
|
|
167
|
-
} from "./chunk-WMEZTDLT.js";
|
|
168
|
-
import {
|
|
169
|
-
diffColors,
|
|
170
|
-
theme
|
|
171
|
-
} from "./chunk-WD2F6EO3.js";
|
|
172
197
|
import {
|
|
173
198
|
stringWidth
|
|
174
199
|
} from "./chunk-U5UV2YRE.js";
|
|
175
|
-
import {
|
|
176
|
-
discoverSkills,
|
|
177
|
-
loadSkillBody
|
|
178
|
-
} from "./chunk-HGZYNEQE.js";
|
|
179
|
-
import {
|
|
180
|
-
chainCapabilityDisagreements,
|
|
181
|
-
chainPositionName,
|
|
182
|
-
describeAcceptedMismatch,
|
|
183
|
-
describeCapabilityRefusal,
|
|
184
|
-
ensureRegistered,
|
|
185
|
-
isRegistered,
|
|
186
|
-
primaryProvider,
|
|
187
|
-
readPreferences,
|
|
188
|
-
resolveChainCapabilities,
|
|
189
|
-
unresolvedMembers
|
|
190
|
-
} from "./chunk-PV65WQHD.js";
|
|
191
|
-
import {
|
|
192
|
-
canSelectModel,
|
|
193
|
-
createGeminiAccessTokenResolver,
|
|
194
|
-
discoverProviders,
|
|
195
|
-
findDetected,
|
|
196
|
-
hasApiCredential,
|
|
197
|
-
requiresCredentialForModel
|
|
198
|
-
} from "./chunk-X6SREM2V.js";
|
|
199
|
-
import {
|
|
200
|
-
activeZenCatalogue,
|
|
201
|
-
isOfferableModel
|
|
202
|
-
} from "./chunk-4QIWRKJO.js";
|
|
203
200
|
import {
|
|
204
201
|
PROVIDER_REGISTRY,
|
|
205
202
|
missingCredentialMessage,
|
|
@@ -208,20 +205,23 @@ import {
|
|
|
208
205
|
import {
|
|
209
206
|
isAnthropicOAuthToken,
|
|
210
207
|
readCodexCredentialFile
|
|
211
|
-
} from "./chunk-
|
|
208
|
+
} from "./chunk-ORCR5VST.js";
|
|
212
209
|
import {
|
|
213
210
|
composeEnvironmentPrompt,
|
|
214
211
|
detectWsl,
|
|
215
212
|
environmentFactLines,
|
|
216
213
|
permissionSentence,
|
|
217
214
|
readEnvironmentFacts
|
|
218
|
-
} from "./chunk-
|
|
215
|
+
} from "./chunk-MDY2IMVQ.js";
|
|
219
216
|
import {
|
|
220
217
|
ensurePrivateStateDirectory
|
|
221
|
-
} from "./chunk-
|
|
218
|
+
} from "./chunk-NRGGICBE.js";
|
|
219
|
+
import {
|
|
220
|
+
isTrusted
|
|
221
|
+
} from "./chunk-CMHOQ62S.js";
|
|
222
222
|
import {
|
|
223
223
|
namzuHomePath
|
|
224
|
-
} from "./chunk-
|
|
224
|
+
} from "./chunk-5F4SSZKS.js";
|
|
225
225
|
import {
|
|
226
226
|
AgentManager,
|
|
227
227
|
AgentRegistry,
|
|
@@ -248,7 +248,6 @@ import {
|
|
|
248
248
|
EXPLORE_AGENT_ID,
|
|
249
249
|
EXPLORE_AGENT_PROMPT,
|
|
250
250
|
FileWorkflowJournal,
|
|
251
|
-
GitWorktreeDriver,
|
|
252
251
|
GoalConfirmation,
|
|
253
252
|
GuardedFetchProvider,
|
|
254
253
|
InMemorySessionLog,
|
|
@@ -270,8 +269,6 @@ import {
|
|
|
270
269
|
PLAN_AGENT_ID,
|
|
271
270
|
PLAN_AGENT_PROMPT,
|
|
272
271
|
PLAN_MODE_DOCTRINE,
|
|
273
|
-
PluginLifecycleManager,
|
|
274
|
-
PluginRegistry,
|
|
275
272
|
PromptContributionRegistry,
|
|
276
273
|
ProviderRegistry,
|
|
277
274
|
QueryAgent,
|
|
@@ -282,11 +279,11 @@ import {
|
|
|
282
279
|
SESSION_GOAL_TOOL_NAMES,
|
|
283
280
|
SESSION_MEMORY_TAG,
|
|
284
281
|
SHELL_HOOKS_PLUGIN_ID,
|
|
282
|
+
SHELL_HOOK_EVENTS,
|
|
285
283
|
SearchToolsTool,
|
|
286
284
|
SessionEvidenceOffsetError,
|
|
287
285
|
SessionPaths,
|
|
288
286
|
SessionSummaryMaterializer,
|
|
289
|
-
SkillRegistry,
|
|
290
287
|
ToolManager,
|
|
291
288
|
TopicArchivedError,
|
|
292
289
|
TopicManager,
|
|
@@ -299,7 +296,6 @@ import {
|
|
|
299
296
|
asSessionId,
|
|
300
297
|
asTaskId,
|
|
301
298
|
asTurnId,
|
|
302
|
-
attachShellHooks,
|
|
303
299
|
backgroundTasksDisabled,
|
|
304
300
|
batchNeedsReview,
|
|
305
301
|
bindOwner,
|
|
@@ -326,6 +322,7 @@ import {
|
|
|
326
322
|
createProjectInstructionMessage,
|
|
327
323
|
createReviewHandler,
|
|
328
324
|
createSessionTextEvidenceSource,
|
|
325
|
+
createShellHook,
|
|
329
326
|
createSkillTool,
|
|
330
327
|
createSystemMessage,
|
|
331
328
|
createToolMessage,
|
|
@@ -337,8 +334,6 @@ import {
|
|
|
337
334
|
describeToolCatalogTokens,
|
|
338
335
|
diffLines,
|
|
339
336
|
diffWords,
|
|
340
|
-
discoverAgentDefinitions,
|
|
341
|
-
discoverAllPluginDirs,
|
|
342
337
|
ensureProject,
|
|
343
338
|
external_exports,
|
|
344
339
|
filtered,
|
|
@@ -414,8 +409,9 @@ import {
|
|
|
414
409
|
windowsShellNotice,
|
|
415
410
|
withModelWindowSuffixStripped,
|
|
416
411
|
withProviderFallback,
|
|
412
|
+
worktreeHookHost,
|
|
417
413
|
wrapUntrusted
|
|
418
|
-
} from "./chunk-
|
|
414
|
+
} from "./chunk-C74LVDRC.js";
|
|
419
415
|
import {
|
|
420
416
|
__name,
|
|
421
417
|
__toESM
|
|
@@ -839,11 +835,11 @@ async function searchExa(query2, limit, context) {
|
|
|
839
835
|
).filter(Boolean);
|
|
840
836
|
for (const payload of payloads) {
|
|
841
837
|
if (payload.trim() === "[DONE]") continue;
|
|
842
|
-
const
|
|
843
|
-
if (!
|
|
844
|
-
if (
|
|
838
|
+
const message = JSON.parse(payload);
|
|
839
|
+
if (!message || typeof message !== "object" || message.id !== id) continue;
|
|
840
|
+
if (message.error)
|
|
845
841
|
throw new Error("Exa rejected the search RPC request; no results were retrieved.");
|
|
846
|
-
const result =
|
|
842
|
+
const result = message.result;
|
|
847
843
|
if (!result || !Array.isArray(result.content))
|
|
848
844
|
throw new Error("Exa returned an invalid search response.");
|
|
849
845
|
const content = result.content.filter(
|
|
@@ -1024,10 +1020,10 @@ var COMPACT_RESULT_TEXT = "Compacted";
|
|
|
1024
1020
|
var COMPACT_RESULT_HINT = "(ctrl+o to see full summary)";
|
|
1025
1021
|
function estimateHistoryTokens(messages) {
|
|
1026
1022
|
let chars = 0;
|
|
1027
|
-
for (const
|
|
1028
|
-
if (typeof
|
|
1029
|
-
else if (
|
|
1030
|
-
for (const block of
|
|
1023
|
+
for (const message of messages) {
|
|
1024
|
+
if (typeof message.content === "string") chars += message.content.length;
|
|
1025
|
+
else if (message.content) {
|
|
1026
|
+
for (const block of message.content) if (block.type === "text") chars += block.text.length;
|
|
1031
1027
|
}
|
|
1032
1028
|
}
|
|
1033
1029
|
return Math.ceil(chars / 4);
|
|
@@ -1207,8 +1203,8 @@ function cutLine(code) {
|
|
|
1207
1203
|
return { code: code.slice(0, end), cut: code.length - end };
|
|
1208
1204
|
}
|
|
1209
1205
|
__name(cutLine, "cutLine");
|
|
1210
|
-
function truncationNote(
|
|
1211
|
-
return ` \u2026 [+${
|
|
1206
|
+
function truncationNote(cut2) {
|
|
1207
|
+
return ` \u2026 [+${cut2.toLocaleString("en-US")} chars]`;
|
|
1212
1208
|
}
|
|
1213
1209
|
__name(truncationNote, "truncationNote");
|
|
1214
1210
|
function wrapRuns(runs, width) {
|
|
@@ -1241,8 +1237,8 @@ function entriesOf(hunk) {
|
|
|
1241
1237
|
for (const row of hunk.lines) {
|
|
1242
1238
|
if (row.startsWith("\\")) continue;
|
|
1243
1239
|
const kind = row.startsWith("+") ? "add" : row.startsWith("-") ? "remove" : "same";
|
|
1244
|
-
const { code, cut } = cutLine(expandTabs(row.slice(1)));
|
|
1245
|
-
entries.push({ kind, code, cut, number: 0 });
|
|
1240
|
+
const { code, cut: cut2 } = cutLine(expandTabs(row.slice(1)));
|
|
1241
|
+
entries.push({ kind, code, cut: cut2, number: 0 });
|
|
1246
1242
|
}
|
|
1247
1243
|
for (let i = 0; i < entries.length; ) {
|
|
1248
1244
|
if (entries[i]?.kind !== "remove") {
|
|
@@ -1394,8 +1390,8 @@ function fileViewRows(hunks, options) {
|
|
|
1394
1390
|
for (const hunk of hunks) {
|
|
1395
1391
|
for (const line of hunk.lines) {
|
|
1396
1392
|
if (line.startsWith("\\")) continue;
|
|
1397
|
-
const { code, cut } = cutLine(expandTabs(line.slice(1)));
|
|
1398
|
-
const note =
|
|
1393
|
+
const { code, cut: cut2 } = cutLine(expandTabs(line.slice(1)));
|
|
1394
|
+
const note = cut2 > 0 ? truncationNote(cut2) : "";
|
|
1399
1395
|
const pieces = wrapRuns([{ text: code, mark: false }], width);
|
|
1400
1396
|
const last = pieces.at(-1) ?? [];
|
|
1401
1397
|
const used = last.reduce((sum, run2) => sum + stringWidth(run2.text), 0);
|
|
@@ -1763,9 +1759,9 @@ function shortCommand(command) {
|
|
|
1763
1759
|
const line = command?.split("\n")[0]?.replace(/\s+/g, " ").trim();
|
|
1764
1760
|
if (!line) return void 0;
|
|
1765
1761
|
if (line.length <= 60) return line;
|
|
1766
|
-
const
|
|
1767
|
-
const space =
|
|
1768
|
-
return `${(space > 20 ?
|
|
1762
|
+
const cut2 = line.slice(0, 59);
|
|
1763
|
+
const space = cut2.lastIndexOf(" ");
|
|
1764
|
+
return `${(space > 20 ? cut2.slice(0, space) : cut2).trimEnd()}\u2026`;
|
|
1769
1765
|
}
|
|
1770
1766
|
__name(shortCommand, "shortCommand");
|
|
1771
1767
|
function endedHow(facts) {
|
|
@@ -2040,7 +2036,7 @@ __name(screenApprover, "screenApprover");
|
|
|
2040
2036
|
|
|
2041
2037
|
// src/tui/agent.ts
|
|
2042
2038
|
import { realpath as realpath5, stat as stat7 } from "node:fs/promises";
|
|
2043
|
-
import { join as
|
|
2039
|
+
import { join as join18, parse as parse2, resolve as resolve14, sep as sep8 } from "node:path";
|
|
2044
2040
|
|
|
2045
2041
|
// src/checkpoints/store.ts
|
|
2046
2042
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
@@ -2318,8 +2314,8 @@ var PlanError = class extends Error {
|
|
|
2318
2314
|
static {
|
|
2319
2315
|
__name(this, "PlanError");
|
|
2320
2316
|
}
|
|
2321
|
-
constructor(
|
|
2322
|
-
super(
|
|
2317
|
+
constructor(message) {
|
|
2318
|
+
super(message);
|
|
2323
2319
|
this.name = "PlanError";
|
|
2324
2320
|
}
|
|
2325
2321
|
};
|
|
@@ -3921,14 +3917,14 @@ function composeLivePrompt(root, files) {
|
|
|
3921
3917
|
const scope2 = relativeInstructionPath(root, file.scopeDir ?? root);
|
|
3922
3918
|
const applies = kind === "user" ? "every project" : scope2.length === 0 ? "the whole project" : `only paths under \`${visibleProjectInstructionPath(scope2)}/\``;
|
|
3923
3919
|
const note = kind === "local" ? " This file is private to this checkout." : kind === "import" && file.importedBy ? ` Included from \`${visibleProjectInstructionPath(displayPath2(root, file.importedBy))}\`.` : "";
|
|
3924
|
-
const
|
|
3920
|
+
const cut2 = file.omittedChars > 0 ? `
|
|
3925
3921
|
|
|
3926
3922
|
(This file was cut at ${MAX_CHARS_PER_FILE} characters; ${file.omittedChars} more were not included. Read it with a tool if needed.)` : "";
|
|
3927
3923
|
return `### ${visibleProjectInstructionPath(displayPath2(root, file.path))}
|
|
3928
3924
|
|
|
3929
3925
|
Applies to ${applies}.${note}
|
|
3930
3926
|
|
|
3931
|
-
${file.text}${
|
|
3927
|
+
${file.text}${cut2}`;
|
|
3932
3928
|
});
|
|
3933
3929
|
return [
|
|
3934
3930
|
"## Project instructions",
|
|
@@ -3964,10 +3960,10 @@ var ProjectInstructionTracker = class {
|
|
|
3964
3960
|
}
|
|
3965
3961
|
/** Re-read only paths named by validated provenance; persisted text is ignored. */
|
|
3966
3962
|
rehydrate(messages) {
|
|
3967
|
-
for (const
|
|
3968
|
-
if (
|
|
3969
|
-
if (!isProjectInstructionMessageSource(
|
|
3970
|
-
for (const file of
|
|
3963
|
+
for (const message of messages) {
|
|
3964
|
+
if (message.role !== "user" || message.source?.type !== "project-instructions") continue;
|
|
3965
|
+
if (!isProjectInstructionMessageSource(message.source)) continue;
|
|
3966
|
+
for (const file of message.source.files) {
|
|
3971
3967
|
const absolute = resolve6(this.root, file);
|
|
3972
3968
|
if (!contained(this.root, absolute)) continue;
|
|
3973
3969
|
this.registerPath(dirname3(absolute));
|
|
@@ -4109,9 +4105,9 @@ var ProjectInstructionTracker = class {
|
|
|
4109
4105
|
}
|
|
4110
4106
|
snapshotKeyFromMessages(messages) {
|
|
4111
4107
|
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
4112
|
-
const
|
|
4113
|
-
if (
|
|
4114
|
-
return this.snapshotKey(
|
|
4108
|
+
const message = messages[index];
|
|
4109
|
+
if (message?.role === "user" && message.source?.type === "project-instructions" && isProjectInstructionMessageSource(message.source)) {
|
|
4110
|
+
return this.snapshotKey(message);
|
|
4115
4111
|
}
|
|
4116
4112
|
}
|
|
4117
4113
|
return "null";
|
|
@@ -4287,8 +4283,8 @@ function encodeCursor(cursor) {
|
|
|
4287
4283
|
}
|
|
4288
4284
|
__name(encodeCursor, "encodeCursor");
|
|
4289
4285
|
var EvidenceCursorError = class extends Error {
|
|
4290
|
-
constructor(code,
|
|
4291
|
-
super(
|
|
4286
|
+
constructor(code, message) {
|
|
4287
|
+
super(message);
|
|
4292
4288
|
this.code = code;
|
|
4293
4289
|
}
|
|
4294
4290
|
code;
|
|
@@ -5547,8 +5543,8 @@ var DecisionError = class extends Error {
|
|
|
5547
5543
|
}
|
|
5548
5544
|
status;
|
|
5549
5545
|
code;
|
|
5550
|
-
constructor(
|
|
5551
|
-
super(
|
|
5546
|
+
constructor(message, status, code) {
|
|
5547
|
+
super(message);
|
|
5552
5548
|
this.status = status;
|
|
5553
5549
|
this.code = code;
|
|
5554
5550
|
this.name = "DecisionError";
|
|
@@ -7411,226 +7407,6 @@ function hookSessionMode(live, configured) {
|
|
|
7411
7407
|
}
|
|
7412
7408
|
__name(hookSessionMode, "hookSessionMode");
|
|
7413
7409
|
|
|
7414
|
-
// src/integrations/plugins/hook-path-filter.ts
|
|
7415
|
-
function createHookPathFilter(cwd) {
|
|
7416
|
-
return (tool, pattern, callTool, toolInput) => {
|
|
7417
|
-
if (!isPathRuleTool(tool)) return void 0;
|
|
7418
|
-
if (!pathRuleTools(tool).includes(callTool)) return false;
|
|
7419
|
-
const input = toolInput !== null && typeof toolInput === "object" ? toolInput : void 0;
|
|
7420
|
-
const written = input?.path;
|
|
7421
|
-
const searchTool = callTool === "grep" || callTool === "glob" || callTool === "ls";
|
|
7422
|
-
if (!(typeof written === "string" && written !== "") && !searchTool) return void 0;
|
|
7423
|
-
const rule = pathRule(tool, pattern, "ask", { cwd });
|
|
7424
|
-
if (rule.type !== "predicate") return void 0;
|
|
7425
|
-
try {
|
|
7426
|
-
return rule.decide({
|
|
7427
|
-
toolName: callTool,
|
|
7428
|
-
toolInput,
|
|
7429
|
-
toolDef: void 0,
|
|
7430
|
-
commandDialect: "sh"
|
|
7431
|
-
}) !== null;
|
|
7432
|
-
} catch {
|
|
7433
|
-
return void 0;
|
|
7434
|
-
}
|
|
7435
|
-
};
|
|
7436
|
-
}
|
|
7437
|
-
__name(createHookPathFilter, "createHookPathFilter");
|
|
7438
|
-
|
|
7439
|
-
// src/integrations/plugins/runtime.ts
|
|
7440
|
-
var SESSION_END_HOOK_TIMEOUT_MS = 5e3;
|
|
7441
|
-
var MAX_HOOK_TIMEOUT_MS = 10 * 6e4;
|
|
7442
|
-
function sessionEndHookBudgetMs(hooks) {
|
|
7443
|
-
let longest = 0;
|
|
7444
|
-
for (const entry of hooks?.session_end ?? []) {
|
|
7445
|
-
if ("async" in entry && entry.async === true) continue;
|
|
7446
|
-
const own = entry.timeoutMs ?? SESSION_END_HOOK_TIMEOUT_MS;
|
|
7447
|
-
longest = Math.max(longest, Math.min(MAX_HOOK_TIMEOUT_MS, Math.max(1, own)));
|
|
7448
|
-
}
|
|
7449
|
-
return longest;
|
|
7450
|
-
}
|
|
7451
|
-
__name(sessionEndHookBudgetMs, "sessionEndHookBudgetMs");
|
|
7452
|
-
function hookTimeoutLine(info) {
|
|
7453
|
-
const seconds = info.timeoutMs / 1e3;
|
|
7454
|
-
return `The ${info.event} hook \`${info.hook}\` did not finish within ${seconds} second${seconds === 1 ? "" : "s"} and was ended.`;
|
|
7455
|
-
}
|
|
7456
|
-
__name(hookTimeoutLine, "hookTimeoutLine");
|
|
7457
|
-
function message(error) {
|
|
7458
|
-
return error instanceof Error ? error.message : String(error);
|
|
7459
|
-
}
|
|
7460
|
-
__name(message, "message");
|
|
7461
|
-
async function createCliPluginRuntime(config, cwd, hooks, hookHost) {
|
|
7462
|
-
const pluginsEnabled = config?.enabled === true;
|
|
7463
|
-
const launchDirs = config?.launchDirs ?? [];
|
|
7464
|
-
const hookCount = hooks ? Object.values(hooks).reduce((n, list) => n + (list?.length ?? 0), 0) : 0;
|
|
7465
|
-
if (!pluginsEnabled && hookCount === 0 && launchDirs.length === 0) return void 0;
|
|
7466
|
-
const log = cliLogger();
|
|
7467
|
-
const userRoot = resolveNamzuHome();
|
|
7468
|
-
const settings = new PluginSettingsStore(userRoot);
|
|
7469
|
-
const plugins = new PluginRegistry();
|
|
7470
|
-
const skills = new SkillRegistry(log);
|
|
7471
|
-
const manager = new PluginLifecycleManager({
|
|
7472
|
-
pluginRegistry: plugins,
|
|
7473
|
-
skillRegistry: skills,
|
|
7474
|
-
scopeRoots: { project: cwd, user: userRoot },
|
|
7475
|
-
log,
|
|
7476
|
-
...config?.hookTimeoutMs !== void 0 ? { hookTimeoutMs: config.hookTimeoutMs } : {}
|
|
7477
|
-
});
|
|
7478
|
-
if (hooks && hookCount > 0) {
|
|
7479
|
-
attachShellHooks(manager, hooks, {
|
|
7480
|
-
cwd,
|
|
7481
|
-
// The folder the session was started for, for a hook script to find its own files.
|
|
7482
|
-
projectDir: cwd,
|
|
7483
|
-
pathFilter: createHookPathFilter(cwd),
|
|
7484
|
-
log,
|
|
7485
|
-
defaultTimeoutMs: { session_end: SESSION_END_HOOK_TIMEOUT_MS },
|
|
7486
|
-
// Only the close of a session says so out loud: it is the one place
|
|
7487
|
-
// a person is left waiting with nothing on screen to explain it.
|
|
7488
|
-
onTimeout: /* @__PURE__ */ __name((info) => {
|
|
7489
|
-
if (info.event === "session_end") process.stderr.write(`${hookTimeoutLine(info)}
|
|
7490
|
-
`);
|
|
7491
|
-
}, "onTimeout"),
|
|
7492
|
-
...hookHost
|
|
7493
|
-
});
|
|
7494
|
-
}
|
|
7495
|
-
const allowedScopes = config?.allowedScopes ?? ["project", "user"];
|
|
7496
|
-
const discovered = pluginsEnabled ? await discoverAllPluginDirs(cwd, {
|
|
7497
|
-
enabled: true,
|
|
7498
|
-
autoDiscovery: config?.autoDiscovery ?? true,
|
|
7499
|
-
allowedScopes,
|
|
7500
|
-
userRoot,
|
|
7501
|
-
log
|
|
7502
|
-
}) : { project: [], user: [] };
|
|
7503
|
-
const installed = [];
|
|
7504
|
-
try {
|
|
7505
|
-
for (const scope2 of allowedScopes) {
|
|
7506
|
-
const dirs = [...discovered[scope2]].sort((a, b) => a.localeCompare(b));
|
|
7507
|
-
for (const dir of dirs) {
|
|
7508
|
-
const plugin = await manager.install(dir, scope2);
|
|
7509
|
-
installed.push(plugin);
|
|
7510
|
-
const enabled = settings.read({ rootDir: plugin.rootDir, name: plugin.manifest.name });
|
|
7511
|
-
if (enabled) await manager.enable(plugin.id);
|
|
7512
|
-
}
|
|
7513
|
-
}
|
|
7514
|
-
for (const dir of launchDirs) {
|
|
7515
|
-
const plugin = await manager.install(dir, "user", { authorityRoot: dir });
|
|
7516
|
-
installed.push(plugin);
|
|
7517
|
-
const enabled = settings.read({ rootDir: plugin.rootDir, name: plugin.manifest.name });
|
|
7518
|
-
if (enabled) await manager.enable(plugin.id);
|
|
7519
|
-
}
|
|
7520
|
-
} catch (error) {
|
|
7521
|
-
const cleanupErrors = [];
|
|
7522
|
-
for (const plugin of [...installed].reverse()) {
|
|
7523
|
-
try {
|
|
7524
|
-
await manager.uninstall(plugin.id);
|
|
7525
|
-
} catch (cleanupError) {
|
|
7526
|
-
cleanupErrors.push(cleanupError);
|
|
7527
|
-
}
|
|
7528
|
-
}
|
|
7529
|
-
const cleanupSuffix = cleanupErrors.length === 0 ? "" : ` Cleanup also failed: ${cleanupErrors.map(message).join("; ")}`;
|
|
7530
|
-
throw new Error(`Plugin runtime could not start: ${message(error)}.${cleanupSuffix}`, {
|
|
7531
|
-
cause: error
|
|
7532
|
-
});
|
|
7533
|
-
}
|
|
7534
|
-
let closePromise;
|
|
7535
|
-
let closed = false;
|
|
7536
|
-
let mutation;
|
|
7537
|
-
const contributedToolNames = /* @__PURE__ */ __name((prefix) => manager.toolsets.flatMap((ts) => ts.tools()).map((tool) => tool.name).filter((name) => name.startsWith(prefix)).sort(), "contributedToolNames");
|
|
7538
|
-
return {
|
|
7539
|
-
manager,
|
|
7540
|
-
skills,
|
|
7541
|
-
pluginCount: installed.length,
|
|
7542
|
-
sessionEndBudgetMs: sessionEndHookBudgetMs(hooks),
|
|
7543
|
-
pluginHooks: /* @__PURE__ */ __name(() => manager.listHooks().filter((hook) => hook.pluginId !== SHELL_HOOKS_PLUGIN_ID).map((hook) => ({
|
|
7544
|
-
plugin: plugins.get(hook.pluginId)?.manifest.name ?? String(hook.pluginId),
|
|
7545
|
-
event: hook.event
|
|
7546
|
-
})), "pluginHooks"),
|
|
7547
|
-
list: /* @__PURE__ */ __name(() => plugins.getAll().map((plugin) => {
|
|
7548
|
-
const prefix = `${plugin.manifest.name}__`;
|
|
7549
|
-
let startupEnabled;
|
|
7550
|
-
let startupError;
|
|
7551
|
-
try {
|
|
7552
|
-
startupEnabled = settings.read({ rootDir: plugin.rootDir, name: plugin.manifest.name });
|
|
7553
|
-
} catch (error) {
|
|
7554
|
-
startupError = message(error);
|
|
7555
|
-
}
|
|
7556
|
-
return {
|
|
7557
|
-
name: plugin.manifest.name,
|
|
7558
|
-
version: plugin.manifest.version,
|
|
7559
|
-
description: plugin.manifest.description,
|
|
7560
|
-
scope: plugin.scope,
|
|
7561
|
-
rootDir: plugin.rootDir,
|
|
7562
|
-
status: plugin.status === "installed" ? "disabled" : plugin.status,
|
|
7563
|
-
...startupEnabled !== void 0 ? { startupEnabled } : {},
|
|
7564
|
-
...startupError ? { startupError } : {},
|
|
7565
|
-
tools: contributedToolNames(prefix),
|
|
7566
|
-
skills: skills.list().map((skill) => skill.metadata.name).filter((name) => name.startsWith(prefix)).sort(),
|
|
7567
|
-
hookModules: [...plugin.manifest.hooks ?? []],
|
|
7568
|
-
mcpServers: (plugin.manifest.mcpServers ?? []).map((server) => server.name),
|
|
7569
|
-
commands: resolvePluginFileDirs(
|
|
7570
|
-
plugin.manifest.name,
|
|
7571
|
-
plugin.rootDir,
|
|
7572
|
-
plugin.manifest.commands
|
|
7573
|
-
).dirs.flatMap(
|
|
7574
|
-
(source) => listMarkdownNames(source.dir).map((file) => `${prefix}${file}`)
|
|
7575
|
-
),
|
|
7576
|
-
agents: resolvePluginFileDirs(
|
|
7577
|
-
plugin.manifest.name,
|
|
7578
|
-
plugin.rootDir,
|
|
7579
|
-
plugin.manifest.agents
|
|
7580
|
-
).dirs.flatMap(
|
|
7581
|
-
(source) => listMarkdownNames(source.dir).map((file) => `${prefix}${file}`)
|
|
7582
|
-
)
|
|
7583
|
-
};
|
|
7584
|
-
}).sort((a, b) => a.name.localeCompare(b.name)), "list"),
|
|
7585
|
-
async setEnabled(name, enabled) {
|
|
7586
|
-
if (closed) throw new Error("Plugin runtime is closed.");
|
|
7587
|
-
if (mutation) throw new Error("Another plugin change is in progress.");
|
|
7588
|
-
const plugin = plugins.findByName(name);
|
|
7589
|
-
if (!plugin) throw new Error(`Plugin "${name}" is not loaded in this session.`);
|
|
7590
|
-
if (enabled && plugin.status === "enabled" || !enabled && (plugin.status === "disabled" || plugin.status === "installed"))
|
|
7591
|
-
return;
|
|
7592
|
-
mutation = enabled ? manager.enable(plugin.id) : manager.disable(plugin.id);
|
|
7593
|
-
try {
|
|
7594
|
-
await mutation;
|
|
7595
|
-
} finally {
|
|
7596
|
-
mutation = void 0;
|
|
7597
|
-
}
|
|
7598
|
-
},
|
|
7599
|
-
async rememberState(name) {
|
|
7600
|
-
if (closed) throw new Error("Plugin runtime is closed.");
|
|
7601
|
-
if (mutation) throw new Error("Another plugin change is in progress.");
|
|
7602
|
-
const plugin = plugins.findByName(name);
|
|
7603
|
-
if (!plugin) throw new Error(`Plugin "${name}" is not loaded in this session.`);
|
|
7604
|
-
if (!["enabled", "disabled", "installed"].includes(plugin.status)) {
|
|
7605
|
-
throw new Error("Resolve the plugin error before remembering its state.");
|
|
7606
|
-
}
|
|
7607
|
-
const enabled = plugin.status === "enabled";
|
|
7608
|
-
settings.write({ rootDir: plugin.rootDir, name }, enabled);
|
|
7609
|
-
},
|
|
7610
|
-
close() {
|
|
7611
|
-
if (closePromise) return closePromise;
|
|
7612
|
-
closed = true;
|
|
7613
|
-
closePromise = (async () => {
|
|
7614
|
-
if (mutation) await mutation.catch(() => {
|
|
7615
|
-
});
|
|
7616
|
-
const errors = [];
|
|
7617
|
-
for (const plugin of [...installed].reverse()) {
|
|
7618
|
-
try {
|
|
7619
|
-
await manager.uninstall(plugin.id);
|
|
7620
|
-
} catch (error) {
|
|
7621
|
-
errors.push(error);
|
|
7622
|
-
}
|
|
7623
|
-
}
|
|
7624
|
-
if (errors.length > 0) {
|
|
7625
|
-
throw new AggregateError(errors, "One or more plugins could not be uninstalled.");
|
|
7626
|
-
}
|
|
7627
|
-
})();
|
|
7628
|
-
return closePromise;
|
|
7629
|
-
}
|
|
7630
|
-
};
|
|
7631
|
-
}
|
|
7632
|
-
__name(createCliPluginRuntime, "createCliPluginRuntime");
|
|
7633
|
-
|
|
7634
7410
|
// src/integrations/providers/anthropic-endpoint.ts
|
|
7635
7411
|
var VENDOR_HOST = "api.anthropic.com";
|
|
7636
7412
|
function readAnthropicEndpoint(env = process.env) {
|
|
@@ -7899,19 +7675,19 @@ function createContextInventoryStep() {
|
|
|
7899
7675
|
const blocks = [];
|
|
7900
7676
|
let totalChars = 0;
|
|
7901
7677
|
let imageCount = 0;
|
|
7902
|
-
for (const [position,
|
|
7903
|
-
if (
|
|
7678
|
+
for (const [position, message] of messages.entries()) {
|
|
7679
|
+
if (message.role !== "tool") continue;
|
|
7904
7680
|
let chars = 0;
|
|
7905
7681
|
let images = 0;
|
|
7906
|
-
if (typeof
|
|
7907
|
-
else if (Array.isArray(
|
|
7908
|
-
for (const block of
|
|
7682
|
+
if (typeof message.content === "string") chars = message.content.length;
|
|
7683
|
+
else if (Array.isArray(message.content))
|
|
7684
|
+
for (const block of message.content) {
|
|
7909
7685
|
if (block.type === "text") chars += block.text.length;
|
|
7910
7686
|
else images++;
|
|
7911
7687
|
}
|
|
7912
7688
|
totalChars += chars;
|
|
7913
7689
|
imageCount += images;
|
|
7914
|
-
blocks.push({ position, chars, images, pinned:
|
|
7690
|
+
blocks.push({ position, chars, images, pinned: message.retain === true });
|
|
7915
7691
|
}
|
|
7916
7692
|
const pressure = contextBudget && contextBudget.remainingTokens < contextBudget.windowTokens / 4;
|
|
7917
7693
|
if (totalChars < 16e3 && !pressure) return void 0;
|
|
@@ -8291,98 +8067,6 @@ __name(createSideModel, "createSideModel");
|
|
|
8291
8067
|
// src/integrations/state/retention.ts
|
|
8292
8068
|
var CLI_CHECKPOINT_RETENTION = 10;
|
|
8293
8069
|
|
|
8294
|
-
// src/integrations/subagents/definitions.ts
|
|
8295
|
-
import { join as join7 } from "node:path";
|
|
8296
|
-
function userAgentsDir(home) {
|
|
8297
|
-
return join7(namzuHomePath(home), "agents");
|
|
8298
|
-
}
|
|
8299
|
-
__name(userAgentsDir, "userAgentsDir");
|
|
8300
|
-
function projectAgentsDir(cwd) {
|
|
8301
|
-
return join7(cwd, ".namzu", "agents");
|
|
8302
|
-
}
|
|
8303
|
-
__name(projectAgentsDir, "projectAgentsDir");
|
|
8304
|
-
var AGENT_FILE_PERMISSION_MODES = /* @__PURE__ */ new Set([
|
|
8305
|
-
...PERMISSION_MODE_NAMES,
|
|
8306
|
-
"inherit"
|
|
8307
|
-
]);
|
|
8308
|
-
async function discoverAgentDefinitions2(opts) {
|
|
8309
|
-
const fromPlugins = await Promise.all(
|
|
8310
|
-
(opts.pluginAgentDirs ?? []).map(async ({ plugin, dir }) => {
|
|
8311
|
-
const found2 = await discoverAgentDefinitions([{ dir, source: "plugin" }], {
|
|
8312
|
-
permissionModes: AGENT_FILE_PERMISSION_MODES
|
|
8313
|
-
});
|
|
8314
|
-
return {
|
|
8315
|
-
definitions: found2.definitions.map((definition) => ({
|
|
8316
|
-
...definition,
|
|
8317
|
-
name: `${plugin}__${definition.name}`
|
|
8318
|
-
})),
|
|
8319
|
-
skipped: found2.skipped
|
|
8320
|
-
};
|
|
8321
|
-
})
|
|
8322
|
-
);
|
|
8323
|
-
const own = await discoverAgentDefinitions(
|
|
8324
|
-
[
|
|
8325
|
-
{ dir: userAgentsDir(opts.home), source: "user" },
|
|
8326
|
-
{ dir: projectAgentsDir(opts.cwd), source: "project" }
|
|
8327
|
-
],
|
|
8328
|
-
{ permissionModes: AGENT_FILE_PERMISSION_MODES }
|
|
8329
|
-
);
|
|
8330
|
-
const byName = /* @__PURE__ */ new Map();
|
|
8331
|
-
for (const set of fromPlugins)
|
|
8332
|
-
for (const definition of set.definitions) byName.set(definition.name, definition);
|
|
8333
|
-
for (const definition of own.definitions) byName.set(definition.name, definition);
|
|
8334
|
-
const found = {
|
|
8335
|
-
definitions: [...byName.values()],
|
|
8336
|
-
skipped: [...fromPlugins.flatMap((set) => set.skipped), ...own.skipped]
|
|
8337
|
-
};
|
|
8338
|
-
if (!found.definitions.some((definition) => definition.skills !== void 0)) {
|
|
8339
|
-
return { ...found, missingSkills: [] };
|
|
8340
|
-
}
|
|
8341
|
-
const roster = new Map(
|
|
8342
|
-
discoverSkills({
|
|
8343
|
-
cwd: opts.cwd,
|
|
8344
|
-
...opts.home !== void 0 ? { home: opts.home } : {},
|
|
8345
|
-
...opts.skills ? { config: opts.skills } : {}
|
|
8346
|
-
}).map((skill) => [skill.name, skill])
|
|
8347
|
-
);
|
|
8348
|
-
const missingSkills = [];
|
|
8349
|
-
const definitions = found.definitions.map((definition) => {
|
|
8350
|
-
if (definition.skills === void 0) return definition;
|
|
8351
|
-
const blocks = [];
|
|
8352
|
-
for (const name of definition.skills) {
|
|
8353
|
-
const skill = roster.get(name);
|
|
8354
|
-
if (!skill || skill.problem !== void 0) {
|
|
8355
|
-
missingSkills.push({
|
|
8356
|
-
path: definition.path,
|
|
8357
|
-
reason: `skill ${name} ${skill?.problem ? `cannot be used: ${skill.problem}` : "was not found"}`
|
|
8358
|
-
});
|
|
8359
|
-
continue;
|
|
8360
|
-
}
|
|
8361
|
-
try {
|
|
8362
|
-
blocks.push(`### Skill: ${name}
|
|
8363
|
-
|
|
8364
|
-
${loadSkillBody(skill)}`);
|
|
8365
|
-
} catch (error) {
|
|
8366
|
-
missingSkills.push({
|
|
8367
|
-
path: definition.path,
|
|
8368
|
-
reason: `skill ${name} could not be read: ${error instanceof Error ? error.message : String(error)}`
|
|
8369
|
-
});
|
|
8370
|
-
}
|
|
8371
|
-
}
|
|
8372
|
-
if (blocks.length === 0) return definition;
|
|
8373
|
-
return {
|
|
8374
|
-
...definition,
|
|
8375
|
-
prompt: `${definition.prompt}
|
|
8376
|
-
|
|
8377
|
-
These skills are loaded for you. Apply their guidance when it fits the task.
|
|
8378
|
-
|
|
8379
|
-
${blocks.join("\n\n")}`
|
|
8380
|
-
};
|
|
8381
|
-
});
|
|
8382
|
-
return { definitions, skipped: found.skipped, missingSkills };
|
|
8383
|
-
}
|
|
8384
|
-
__name(discoverAgentDefinitions2, "discoverAgentDefinitions");
|
|
8385
|
-
|
|
8386
8070
|
// src/integrations/subagents/model-effort.ts
|
|
8387
8071
|
async function prepareDelegatedEffort(provider, model, signal) {
|
|
8388
8072
|
if ((provider.reasoningEffortLevelsFor?.(model) ?? provider.effortLevelsFor?.(model)) !== void 0)
|
|
@@ -8397,7 +8081,7 @@ __name(prepareDelegatedEffort, "prepareDelegatedEffort");
|
|
|
8397
8081
|
|
|
8398
8082
|
// src/integrations/subagents/operator-journal.ts
|
|
8399
8083
|
import { appendFile, open as open2 } from "node:fs/promises";
|
|
8400
|
-
import { join as
|
|
8084
|
+
import { join as join7 } from "node:path";
|
|
8401
8085
|
var MAX_READ_BYTES = 256 * 1024;
|
|
8402
8086
|
var MAX_CONTEXT_CHARACTERS = 32e3;
|
|
8403
8087
|
function formatChildOperatorAdmission(input) {
|
|
@@ -8407,7 +8091,7 @@ function formatChildOperatorAdmission(input) {
|
|
|
8407
8091
|
}
|
|
8408
8092
|
__name(formatChildOperatorAdmission, "formatChildOperatorAdmission");
|
|
8409
8093
|
async function readChildOperatorNotices(paths, sessionId) {
|
|
8410
|
-
const path =
|
|
8094
|
+
const path = join7(paths.sessionDir({ sessionId }), "child-operator-messages.jsonl");
|
|
8411
8095
|
let file;
|
|
8412
8096
|
try {
|
|
8413
8097
|
file = await open2(path, "r");
|
|
@@ -8478,7 +8162,7 @@ async function acknowledgeChildOperatorNotices(paths, sessionId, notices) {
|
|
|
8478
8162
|
})
|
|
8479
8163
|
).join("\n");
|
|
8480
8164
|
await appendFile(
|
|
8481
|
-
|
|
8165
|
+
join7(paths.sessionDir({ sessionId }), "child-operator-messages.jsonl"),
|
|
8482
8166
|
`${lines}
|
|
8483
8167
|
`,
|
|
8484
8168
|
{ mode: 384 }
|
|
@@ -8487,7 +8171,7 @@ async function acknowledgeChildOperatorNotices(paths, sessionId, notices) {
|
|
|
8487
8171
|
__name(acknowledgeChildOperatorNotices, "acknowledgeChildOperatorNotices");
|
|
8488
8172
|
async function recordChildOperatorReport(paths, sessionId, notice2) {
|
|
8489
8173
|
await appendFile(
|
|
8490
|
-
|
|
8174
|
+
join7(paths.sessionDir({ sessionId }), "child-operator-messages.jsonl"),
|
|
8491
8175
|
`${JSON.stringify({ ...notice2, status: "child-report", source: "host", at: (/* @__PURE__ */ new Date()).toISOString() })}
|
|
8492
8176
|
`,
|
|
8493
8177
|
{ mode: 384 }
|
|
@@ -9514,7 +9198,7 @@ __name(errorMessage2, "errorMessage");
|
|
|
9514
9198
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
9515
9199
|
import { existsSync as existsSync2 } from "node:fs";
|
|
9516
9200
|
import { appendFile as appendFile2, mkdir as mkdir4 } from "node:fs/promises";
|
|
9517
|
-
import { join as
|
|
9201
|
+
import { join as join11 } from "node:path";
|
|
9518
9202
|
|
|
9519
9203
|
// src/integrations/subagents/fork.ts
|
|
9520
9204
|
var FORK_SUBAGENT = "fork";
|
|
@@ -9545,16 +9229,16 @@ function forkDirective(prompt, options) {
|
|
|
9545
9229
|
__name(forkDirective, "forkDirective");
|
|
9546
9230
|
function isForkConversation(messages) {
|
|
9547
9231
|
const marker = `<${DIRECTIVE_TAG}>`;
|
|
9548
|
-
return messages.some((
|
|
9232
|
+
return messages.some((message) => message.role === "user" && message.content.includes(marker));
|
|
9549
9233
|
}
|
|
9550
9234
|
__name(isForkConversation, "isForkConversation");
|
|
9551
9235
|
function forkSeed(history, toolUseId) {
|
|
9552
|
-
const messages = history.filter((
|
|
9236
|
+
const messages = history.filter((message) => message.role !== "system" || message.source).map(withoutRecordId);
|
|
9553
9237
|
let issuing = -1;
|
|
9554
9238
|
if (toolUseId !== void 0) {
|
|
9555
9239
|
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
9556
|
-
const
|
|
9557
|
-
if (
|
|
9240
|
+
const message = messages[index];
|
|
9241
|
+
if (message?.role === "assistant" && message.toolCalls?.some((call) => call.id === toolUseId)) {
|
|
9558
9242
|
issuing = index;
|
|
9559
9243
|
break;
|
|
9560
9244
|
}
|
|
@@ -9572,20 +9256,20 @@ function forkSeed(history, toolUseId) {
|
|
|
9572
9256
|
return completeExchanges(messages);
|
|
9573
9257
|
}
|
|
9574
9258
|
__name(forkSeed, "forkSeed");
|
|
9575
|
-
function withoutRecordId(
|
|
9576
|
-
const { id: _id, ...rest } =
|
|
9259
|
+
function withoutRecordId(message) {
|
|
9260
|
+
const { id: _id, ...rest } = message;
|
|
9577
9261
|
return rest;
|
|
9578
9262
|
}
|
|
9579
9263
|
__name(withoutRecordId, "withoutRecordId");
|
|
9580
9264
|
function completeExchanges(messages) {
|
|
9581
9265
|
const answered = /* @__PURE__ */ new Set();
|
|
9582
|
-
for (const
|
|
9583
|
-
if (
|
|
9266
|
+
for (const message of messages) {
|
|
9267
|
+
if (message.role === "tool") answered.add(message.toolCallId);
|
|
9584
9268
|
}
|
|
9585
9269
|
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
9586
|
-
const
|
|
9587
|
-
if (
|
|
9588
|
-
if ((
|
|
9270
|
+
const message = messages[index];
|
|
9271
|
+
if (message?.role !== "assistant") continue;
|
|
9272
|
+
if ((message.toolCalls ?? []).every((call) => answered.has(call.id))) break;
|
|
9589
9273
|
return messages.slice(0, index);
|
|
9590
9274
|
}
|
|
9591
9275
|
return [...messages];
|
|
@@ -9628,7 +9312,7 @@ __name(describeQuietTask, "describeQuietTask");
|
|
|
9628
9312
|
// src/memory/typed.ts
|
|
9629
9313
|
import { createHash as createHash3 } from "node:crypto";
|
|
9630
9314
|
import { access, readFile as readFile4, rename as rename3, writeFile as writeFile2 } from "node:fs/promises";
|
|
9631
|
-
import { join as
|
|
9315
|
+
import { join as join10 } from "node:path";
|
|
9632
9316
|
|
|
9633
9317
|
// src/memory/io.ts
|
|
9634
9318
|
import {
|
|
@@ -9642,7 +9326,7 @@ import {
|
|
|
9642
9326
|
realpathSync as realpathSync3,
|
|
9643
9327
|
writeSync
|
|
9644
9328
|
} from "node:fs";
|
|
9645
|
-
import { isAbsolute as isAbsolute7, join as
|
|
9329
|
+
import { isAbsolute as isAbsolute7, join as join8, relative as relative6, resolve as resolve9, sep as sep4 } from "node:path";
|
|
9646
9330
|
var MEMORY_FILE_MAX_BYTES = 1024 * 1024;
|
|
9647
9331
|
function missing(error) {
|
|
9648
9332
|
return error.code === "ENOENT";
|
|
@@ -9675,7 +9359,7 @@ function resolveMemoryPath(location, createParents = false) {
|
|
|
9675
9359
|
for (let i = 0; i < parts.length; i += 1) {
|
|
9676
9360
|
const part = parts[i];
|
|
9677
9361
|
if (part === void 0) throw new Error("Memory path has an invalid segment.");
|
|
9678
|
-
candidate =
|
|
9362
|
+
candidate = join8(candidate, part);
|
|
9679
9363
|
const leaf = i === parts.length - 1;
|
|
9680
9364
|
let stat8;
|
|
9681
9365
|
try {
|
|
@@ -9800,18 +9484,18 @@ __name(appendMemoryFile, "appendMemoryFile");
|
|
|
9800
9484
|
|
|
9801
9485
|
// src/memory/store.ts
|
|
9802
9486
|
import { realpathSync as realpathSync4 } from "node:fs";
|
|
9803
|
-
import { join as
|
|
9487
|
+
import { join as join9, resolve as resolve10 } from "node:path";
|
|
9804
9488
|
var MEMORY_SECTION_MAX_CHARS = 8e3;
|
|
9805
9489
|
function memoryDir(home) {
|
|
9806
9490
|
return namzuHomePath(home);
|
|
9807
9491
|
}
|
|
9808
9492
|
__name(memoryDir, "memoryDir");
|
|
9809
9493
|
function userFilePath(home) {
|
|
9810
|
-
return
|
|
9494
|
+
return join9(memoryDir(home), "USER.md");
|
|
9811
9495
|
}
|
|
9812
9496
|
__name(userFilePath, "userFilePath");
|
|
9813
9497
|
function memoryFilePath(home) {
|
|
9814
|
-
return
|
|
9498
|
+
return join9(memoryDir(home), "MEMORY.md");
|
|
9815
9499
|
}
|
|
9816
9500
|
__name(memoryFilePath, "memoryFilePath");
|
|
9817
9501
|
function projectMemoryFilePath(cwd) {
|
|
@@ -9822,9 +9506,9 @@ function projectMemoryFilePath(cwd) {
|
|
|
9822
9506
|
if (error.code !== "ENOENT") throw error;
|
|
9823
9507
|
}
|
|
9824
9508
|
const root = cliProjectRoot(directory);
|
|
9825
|
-
const local =
|
|
9509
|
+
const local = join9(directory, ".namzu", "MEMORY.md");
|
|
9826
9510
|
if (resolveMemoryPath({ path: local, root }) !== null) return local;
|
|
9827
|
-
return
|
|
9511
|
+
return join9(root, ".namzu", "MEMORY.md");
|
|
9828
9512
|
}
|
|
9829
9513
|
__name(projectMemoryFilePath, "projectMemoryFilePath");
|
|
9830
9514
|
function projectMemoryLocation(cwd) {
|
|
@@ -9854,15 +9538,15 @@ function readMemory(home, cwd) {
|
|
|
9854
9538
|
}
|
|
9855
9539
|
}, "read");
|
|
9856
9540
|
const userRoot = memoryDir(home);
|
|
9857
|
-
const user = read2(
|
|
9541
|
+
const user = read2(join9(userRoot, "USER.md"), () => ({
|
|
9858
9542
|
root: userRoot,
|
|
9859
|
-
path:
|
|
9543
|
+
path: join9(userRoot, "USER.md")
|
|
9860
9544
|
}));
|
|
9861
|
-
const memory = read2(
|
|
9545
|
+
const memory = read2(join9(userRoot, "MEMORY.md"), () => ({
|
|
9862
9546
|
root: userRoot,
|
|
9863
|
-
path:
|
|
9547
|
+
path: join9(userRoot, "MEMORY.md")
|
|
9864
9548
|
}));
|
|
9865
|
-
const project = cwd && !isUserMemoryFile(
|
|
9549
|
+
const project = cwd && !isUserMemoryFile(join9(resolve10(cwd), ".namzu", "MEMORY.md"), userRoot) ? read2(join9(resolve10(cwd), ".namzu", "MEMORY.md"), () => projectLocation(cwd)) : null;
|
|
9866
9550
|
return { user, memory, project, ...diagnostics.length > 0 ? { diagnostics } : {} };
|
|
9867
9551
|
}
|
|
9868
9552
|
__name(readMemory, "readMemory");
|
|
@@ -9874,7 +9558,7 @@ function isUserMemoryFile(projectPath, userRoot) {
|
|
|
9874
9558
|
return resolve10(path);
|
|
9875
9559
|
}
|
|
9876
9560
|
}, "canonical");
|
|
9877
|
-
return canonical(projectPath) === canonical(
|
|
9561
|
+
return canonical(projectPath) === canonical(join9(userRoot, "MEMORY.md"));
|
|
9878
9562
|
}
|
|
9879
9563
|
__name(isUserMemoryFile, "isUserMemoryFile");
|
|
9880
9564
|
function capped(text2, file) {
|
|
@@ -9883,8 +9567,8 @@ function capped(text2, file) {
|
|
|
9883
9567
|
const last = text2.charCodeAt(end - 1);
|
|
9884
9568
|
if (last >= 55296 && last <= 56319) end -= 1;
|
|
9885
9569
|
const head = text2.slice(0, end);
|
|
9886
|
-
const
|
|
9887
|
-
const kept =
|
|
9570
|
+
const cut2 = head.lastIndexOf("\n");
|
|
9571
|
+
const kept = cut2 > MEMORY_SECTION_MAX_CHARS / 2 ? head.slice(0, cut2) : head;
|
|
9888
9572
|
return `${kept}
|
|
9889
9573
|
|
|
9890
9574
|
(\u2026 ${text2.length - kept.length} more characters in ${file} were not included; the file wants curating.)`;
|
|
@@ -9966,7 +9650,7 @@ async function saveTypedNote(store, text2, type = "project") {
|
|
|
9966
9650
|
saved: false,
|
|
9967
9651
|
duplicate: true,
|
|
9968
9652
|
type: record.entry.type ?? type,
|
|
9969
|
-
...record.entry.name ? { name: record.entry.name, path:
|
|
9653
|
+
...record.entry.name ? { name: record.entry.name, path: join10(store.path, `${record.entry.name}.md`) } : {}
|
|
9970
9654
|
};
|
|
9971
9655
|
}
|
|
9972
9656
|
}
|
|
@@ -9981,7 +9665,7 @@ async function saveTypedNote(store, text2, type = "project") {
|
|
|
9981
9665
|
return {
|
|
9982
9666
|
saved: true,
|
|
9983
9667
|
type,
|
|
9984
|
-
...entry.name ? { name: entry.name, path:
|
|
9668
|
+
...entry.name ? { name: entry.name, path: join10(store.path, `${entry.name}.md`) } : {}
|
|
9985
9669
|
};
|
|
9986
9670
|
}
|
|
9987
9671
|
__name(saveTypedNote, "saveTypedNote");
|
|
@@ -10024,7 +9708,7 @@ __name(composeMemoryGuidance, "composeMemoryGuidance");
|
|
|
10024
9708
|
var MARKER2 = "migration.json";
|
|
10025
9709
|
async function readMarker(directory) {
|
|
10026
9710
|
try {
|
|
10027
|
-
const parsed = JSON.parse(await readFile4(
|
|
9711
|
+
const parsed = JSON.parse(await readFile4(join10(directory, MARKER2), "utf8"));
|
|
10028
9712
|
return parsed !== null && typeof parsed === "object" ? parsed : {};
|
|
10029
9713
|
} catch (error) {
|
|
10030
9714
|
if (error.code === "ENOENT") return {};
|
|
@@ -10037,7 +9721,7 @@ async function markCuratedFile(directory, path, state) {
|
|
|
10037
9721
|
const files = { ...marker.curatedFiles ?? {} };
|
|
10038
9722
|
files[path] = { ...files[path] ?? {}, ...state };
|
|
10039
9723
|
await writeFile2(
|
|
10040
|
-
|
|
9724
|
+
join10(directory, MARKER2),
|
|
10041
9725
|
`${JSON.stringify({ ...marker, curatedFiles: files }, null, 2)}
|
|
10042
9726
|
`,
|
|
10043
9727
|
{ mode: 384 }
|
|
@@ -10104,7 +9788,7 @@ async function migrateMemoryOnce(options) {
|
|
|
10104
9788
|
const skippedRecords = [];
|
|
10105
9789
|
let importedRecords = 0;
|
|
10106
9790
|
let notesOffer;
|
|
10107
|
-
const indexPath =
|
|
9791
|
+
const indexPath = join10(directory, "index.json");
|
|
10108
9792
|
if (await exists(indexPath)) {
|
|
10109
9793
|
try {
|
|
10110
9794
|
const disk = new DiskMemoryStore({ baseDir: directory, directory });
|
|
@@ -10127,11 +9811,11 @@ async function migrateMemoryOnce(options) {
|
|
|
10127
9811
|
}
|
|
10128
9812
|
}
|
|
10129
9813
|
await retire(indexPath);
|
|
10130
|
-
const content =
|
|
9814
|
+
const content = join10(directory, "content");
|
|
10131
9815
|
const retiredContent = await exists(content) ? await retire(content) : content;
|
|
10132
9816
|
for (const record of refused) {
|
|
10133
9817
|
skippedRecords.push(
|
|
10134
|
-
`"${record.title}" (${record.id}) was not moved: ${record.reason} It is kept in ${
|
|
9818
|
+
`"${record.title}" (${record.id}) was not moved: ${record.reason} It is kept in ${join10(retiredContent, `${record.id}.json`)}.`
|
|
10135
9819
|
);
|
|
10136
9820
|
}
|
|
10137
9821
|
} catch (error) {
|
|
@@ -10227,12 +9911,25 @@ __name(describeCuratedNotesImport, "describeCuratedNotesImport");
|
|
|
10227
9911
|
|
|
10228
9912
|
// src/integrations/subagents/NamzuCliAgent.ts
|
|
10229
9913
|
var NamzuCliAgent = class extends QueryAgent {
|
|
9914
|
+
constructor(metadata, log, scope2) {
|
|
9915
|
+
super({ ...metadata, type: "namzu-cli" }, log);
|
|
9916
|
+
this.scope = scope2;
|
|
9917
|
+
}
|
|
9918
|
+
scope;
|
|
10230
9919
|
static {
|
|
10231
9920
|
__name(this, "NamzuCliAgent");
|
|
10232
9921
|
}
|
|
10233
9922
|
type = "namzu-cli";
|
|
10234
|
-
|
|
10235
|
-
|
|
9923
|
+
async run(...args) {
|
|
9924
|
+
const [input, config] = args;
|
|
9925
|
+
const sessionId = input.managedScope?.sessionId ?? config.sessionId;
|
|
9926
|
+
if (!this.scope || sessionId === void 0) return super.run(...args);
|
|
9927
|
+
const end = this.scope(String(sessionId));
|
|
9928
|
+
try {
|
|
9929
|
+
return await super.run(...args);
|
|
9930
|
+
} finally {
|
|
9931
|
+
end();
|
|
9932
|
+
}
|
|
10236
9933
|
}
|
|
10237
9934
|
};
|
|
10238
9935
|
|
|
@@ -10613,12 +10310,14 @@ import { isAbsolute as isAbsolute8, relative as relative7, resolve as resolve11,
|
|
|
10613
10310
|
import { promisify as promisify2 } from "node:util";
|
|
10614
10311
|
var runFile = promisify2(execFile3);
|
|
10615
10312
|
var DelegatedWorktreeDriver = class {
|
|
10616
|
-
constructor(cwd, stateRoot) {
|
|
10313
|
+
constructor(cwd, stateRoot, hooks) {
|
|
10617
10314
|
this.cwd = cwd;
|
|
10618
10315
|
this.stateRoot = stateRoot;
|
|
10316
|
+
this.hooks = hooks;
|
|
10619
10317
|
}
|
|
10620
10318
|
cwd;
|
|
10621
10319
|
stateRoot;
|
|
10320
|
+
hooks;
|
|
10622
10321
|
static {
|
|
10623
10322
|
__name(this, "DelegatedWorktreeDriver");
|
|
10624
10323
|
}
|
|
@@ -10626,10 +10325,11 @@ var DelegatedWorktreeDriver = class {
|
|
|
10626
10325
|
ready;
|
|
10627
10326
|
async open() {
|
|
10628
10327
|
this.ready ??= openManagedWorktrees(this.cwd, {
|
|
10629
|
-
stateRoot: this.stateRoot
|
|
10328
|
+
stateRoot: this.stateRoot,
|
|
10329
|
+
...this.hooks ? { hooks: this.hooks.host, onNotice: this.hooks.onNotice } : {}
|
|
10630
10330
|
}).then(async (managed) => {
|
|
10631
10331
|
const selectedDirectory = await realpath3(resolve11(this.cwd));
|
|
10632
|
-
const subdirectory = relative7(managed.sourceRoot, selectedDirectory);
|
|
10332
|
+
const subdirectory = managed.isGit ? relative7(managed.sourceRoot, selectedDirectory) : "";
|
|
10633
10333
|
if (isAbsolute8(subdirectory) || subdirectory === ".." || subdirectory.startsWith(`..${sep5}`)) {
|
|
10634
10334
|
throw new Error("Selected directory is outside its Git checkout");
|
|
10635
10335
|
}
|
|
@@ -10637,11 +10337,9 @@ var DelegatedWorktreeDriver = class {
|
|
|
10637
10337
|
sourceRoot: managed.sourceRoot,
|
|
10638
10338
|
subdirectory,
|
|
10639
10339
|
worktreesDir: managed.worktreesDir,
|
|
10640
|
-
|
|
10641
|
-
|
|
10642
|
-
|
|
10643
|
-
logger: cliLogger()
|
|
10644
|
-
})
|
|
10340
|
+
// Hooks first, the kernel's Git logic otherwise: one driver for both.
|
|
10341
|
+
driver: managed.workspaceDriver,
|
|
10342
|
+
isGit: managed.isGit
|
|
10645
10343
|
};
|
|
10646
10344
|
}).catch((error) => {
|
|
10647
10345
|
this.ready = void 0;
|
|
@@ -10649,15 +10347,27 @@ var DelegatedWorktreeDriver = class {
|
|
|
10649
10347
|
});
|
|
10650
10348
|
return this.ready;
|
|
10651
10349
|
}
|
|
10350
|
+
/** A failure a hook caused is a line for the person, in the hook's own words. */
|
|
10351
|
+
say(cause) {
|
|
10352
|
+
if (this.hooks && cause instanceof Error && cause.name === "WorktreeHookError") {
|
|
10353
|
+
this.hooks.onNotice(cause.message);
|
|
10354
|
+
}
|
|
10355
|
+
}
|
|
10652
10356
|
/** Preserve the selected cwd beneath its checkout root for child execution. */
|
|
10653
10357
|
async selectedSubdirectory() {
|
|
10654
10358
|
return (await this.open()).subdirectory || void 0;
|
|
10655
10359
|
}
|
|
10656
10360
|
async create(params) {
|
|
10657
|
-
const { sourceRoot, worktreesDir, driver } = await this.open();
|
|
10658
|
-
const head = (await runFile("git", ["-C", sourceRoot, "rev-parse", "HEAD"])).stdout.trim();
|
|
10361
|
+
const { sourceRoot, worktreesDir, driver, isGit } = await this.open();
|
|
10362
|
+
const head = isGit ? (await runFile("git", ["-C", sourceRoot, "rev-parse", "HEAD"])).stdout.trim() : void 0;
|
|
10659
10363
|
await mkdir3(worktreesDir, { recursive: true, mode: 448 });
|
|
10660
|
-
|
|
10364
|
+
const baseRef = params.baseRef ?? head;
|
|
10365
|
+
try {
|
|
10366
|
+
return await driver.create({ ...params, ...baseRef !== void 0 ? { baseRef } : {} });
|
|
10367
|
+
} catch (cause) {
|
|
10368
|
+
this.say(cause);
|
|
10369
|
+
throw cause;
|
|
10370
|
+
}
|
|
10661
10371
|
}
|
|
10662
10372
|
async branch(source, params) {
|
|
10663
10373
|
return (await this.open()).driver.branch(source, params);
|
|
@@ -10666,7 +10376,12 @@ var DelegatedWorktreeDriver = class {
|
|
|
10666
10376
|
return (await this.open()).driver.inspect(ref);
|
|
10667
10377
|
}
|
|
10668
10378
|
async dispose(ref) {
|
|
10669
|
-
|
|
10379
|
+
try {
|
|
10380
|
+
return await (await this.open()).driver.dispose(ref);
|
|
10381
|
+
} catch (cause) {
|
|
10382
|
+
this.say(cause);
|
|
10383
|
+
throw cause;
|
|
10384
|
+
}
|
|
10670
10385
|
}
|
|
10671
10386
|
};
|
|
10672
10387
|
|
|
@@ -10756,10 +10471,10 @@ var ParentTaskScheduler = class extends LocalTaskScheduler {
|
|
|
10756
10471
|
if (isTerminalAgentTaskState(task.state)) return task;
|
|
10757
10472
|
return super.waitForTask(taskId);
|
|
10758
10473
|
}
|
|
10759
|
-
async continueTask(taskId,
|
|
10474
|
+
async continueTask(taskId, message) {
|
|
10760
10475
|
if (!this.owns(taskId)) throw new Error(`No task with ID ${taskId} in this conversation.`);
|
|
10761
10476
|
await this.validateContinuation();
|
|
10762
|
-
await super.continueTask(taskId,
|
|
10477
|
+
await super.continueTask(taskId, message);
|
|
10763
10478
|
}
|
|
10764
10479
|
};
|
|
10765
10480
|
var refuseUnownedChildReview = /* @__PURE__ */ __name(async () => ({
|
|
@@ -10804,6 +10519,9 @@ async function createSubagentRuntime(input) {
|
|
|
10804
10519
|
)
|
|
10805
10520
|
);
|
|
10806
10521
|
const fileAgents = /* @__PURE__ */ new Map();
|
|
10522
|
+
const refusedAgents = new Map(
|
|
10523
|
+
(opts.refusedDefinitions ?? []).map((refused) => [refused.name, refused])
|
|
10524
|
+
);
|
|
10807
10525
|
for (const definition of opts.definitions ?? []) {
|
|
10808
10526
|
fileAgents.set(definition.name, definition);
|
|
10809
10527
|
registry.replace(
|
|
@@ -10821,6 +10539,7 @@ async function createSubagentRuntime(input) {
|
|
|
10821
10539
|
)
|
|
10822
10540
|
);
|
|
10823
10541
|
}
|
|
10542
|
+
const refusedTypeIds = [...refusedAgents.keys()].filter((name) => !fileAgents.has(name));
|
|
10824
10543
|
const agentTypeIds = [
|
|
10825
10544
|
.../* @__PURE__ */ new Set([
|
|
10826
10545
|
GENERAL_PURPOSE_SUBAGENT,
|
|
@@ -10859,7 +10578,11 @@ async function createSubagentRuntime(input) {
|
|
|
10859
10578
|
const parents = /* @__PURE__ */ new Map();
|
|
10860
10579
|
const readyParents = /* @__PURE__ */ new WeakMap();
|
|
10861
10580
|
const sessions = /* @__PURE__ */ new Map();
|
|
10862
|
-
const worktreeDriver = new DelegatedWorktreeDriver(
|
|
10581
|
+
const worktreeDriver = new DelegatedWorktreeDriver(
|
|
10582
|
+
opts.cwd,
|
|
10583
|
+
opts.worktreeStateRoot,
|
|
10584
|
+
opts.worktreeHooks
|
|
10585
|
+
);
|
|
10863
10586
|
const tokenBudgetStore = opts.tokenBudgetStore ?? (opts.paths ? new DiskSessionTokenBudgetStore({ paths: opts.paths }) : new InMemorySessionTokenBudgetStore());
|
|
10864
10587
|
let closed = false;
|
|
10865
10588
|
const sessionKey = /* @__PURE__ */ __name(({ project, sessionId }) => JSON.stringify([project.tenantId, project.id, sessionId]), "sessionKey");
|
|
@@ -11341,6 +11064,8 @@ async function createSubagentRuntime(input) {
|
|
|
11341
11064
|
} = input2;
|
|
11342
11065
|
if (!requestedModel && (requestedProvider || requestedEffort))
|
|
11343
11066
|
throw new Error("Supply model when selecting a child provider or effort.");
|
|
11067
|
+
const refusedFile = subagent_type !== void 0 && !fileAgents.has(subagent_type) ? refusedAgents.get(subagent_type) : void 0;
|
|
11068
|
+
if (refusedFile) throw new Error(refusedFile.line);
|
|
11344
11069
|
const agentName = typeof input2.name === "string" ? input2.name.trim() : "";
|
|
11345
11070
|
if (agentName.length > 0) {
|
|
11346
11071
|
const problem = agentNameProblem(agentName);
|
|
@@ -11412,7 +11137,8 @@ async function createSubagentRuntime(input) {
|
|
|
11412
11137
|
})
|
|
11413
11138
|
}),
|
|
11414
11139
|
...selection ? { model: selection.model, effort: selection.effort } : {},
|
|
11415
|
-
|
|
11140
|
+
// The same object, not a copy: a variable a hook sets later reaches a child that is still working.
|
|
11141
|
+
...context.env !== void 0 ? { env: context.env } : {},
|
|
11416
11142
|
// The parent turn's tool-result screens, so a sub-agent judges a
|
|
11417
11143
|
// connected answer the way the turn that asked for the work
|
|
11418
11144
|
// does. Without it the child's executor installs the shipped
|
|
@@ -11613,8 +11339,8 @@ ${persona}` : persona || (readOnlyType !== void 0 ? READ_ONLY_PROMPTS.get(readOn
|
|
|
11613
11339
|
},
|
|
11614
11340
|
subagent_type: {
|
|
11615
11341
|
type: "string",
|
|
11616
|
-
enum: agentTypeIds,
|
|
11617
|
-
description: `"explore" for read-only lookups (find, search, explain); "plan" for a read-only step plan before a change; "general-purpose" (default) when the task changes files or runs commands; "fork" to continue this conversation in a side task.${fileAgentSummary.length > 0 ? ` This project also defines: ${fileAgentSummary}. Prefer a project-defined type when its description fits the task.` : ""}`
|
|
11342
|
+
enum: [...agentTypeIds, ...refusedTypeIds],
|
|
11343
|
+
description: `"explore" for read-only lookups (find, search, explain); "plan" for a read-only step plan before a change; "general-purpose" (default) when the task changes files or runs commands; "fork" to continue this conversation in a side task.${fileAgentSummary.length > 0 ? ` This project also defines: ${fileAgentSummary}. Prefer a project-defined type when its description fits the task.` : ""}${refusedTypeIds.length > 0 ? ` Not available (their files cannot be loaded; starting one is refused): ${refusedTypeIds.join(", ")}.` : ""}`
|
|
11618
11344
|
},
|
|
11619
11345
|
model: {
|
|
11620
11346
|
type: "string",
|
|
@@ -11696,6 +11422,8 @@ ${persona}` : persona || (readOnlyType !== void 0 ? READ_ONLY_PROMPTS.get(readOn
|
|
|
11696
11422
|
}
|
|
11697
11423
|
});
|
|
11698
11424
|
const launchWorkflowAgent = /* @__PURE__ */ __name(async (launch) => {
|
|
11425
|
+
const refusedLaunch = launch.agentType !== void 0 && !fileAgents.has(launch.agentType) ? refusedAgents.get(launch.agentType) : void 0;
|
|
11426
|
+
if (refusedLaunch) throw new Error(refusedLaunch.line);
|
|
11699
11427
|
if (launch.agentType !== void 0 && !agentTypeIds.includes(launch.agentType)) {
|
|
11700
11428
|
throw new Error(
|
|
11701
11429
|
`Unknown agent type "${launch.agentType}". Available: ${agentTypeIds.join(", ")}.`
|
|
@@ -12178,7 +11906,8 @@ ${step}`;
|
|
|
12178
11906
|
model: savedModel,
|
|
12179
11907
|
...kept.profile.effort ? { effort: kept.profile.effort } : {}
|
|
12180
11908
|
} : {},
|
|
12181
|
-
|
|
11909
|
+
// The same object, not a copy: a variable a hook sets later reaches a child that is still working.
|
|
11910
|
+
...context.env !== void 0 ? { env: context.env } : {},
|
|
12182
11911
|
...context.toolResultGuardrails ? { toolResultGuardrails: context.toolResultGuardrails } : {}
|
|
12183
11912
|
},
|
|
12184
11913
|
...fileAgents.get(kept.profile.agent ?? kept.agentId)?.permissionMode ? { declaredMode: fileAgents.get(kept.profile.agent ?? kept.agentId)?.permissionMode } : {},
|
|
@@ -12223,8 +11952,8 @@ ${step}`;
|
|
|
12223
11952
|
concurrencySafe: false,
|
|
12224
11953
|
async execute(input2, context) {
|
|
12225
11954
|
context.abortSignal.throwIfAborted();
|
|
12226
|
-
const { task_id, message
|
|
12227
|
-
if (!
|
|
11955
|
+
const { task_id, message } = input2;
|
|
11956
|
+
if (!message.trim())
|
|
12228
11957
|
return {
|
|
12229
11958
|
success: false,
|
|
12230
11959
|
output: "",
|
|
@@ -12255,7 +11984,7 @@ ${step}`;
|
|
|
12255
11984
|
if (found.kind === "settled") {
|
|
12256
11985
|
const label = found.owned.seed.agentId;
|
|
12257
11986
|
try {
|
|
12258
|
-
await messageChild(found.viewId,
|
|
11987
|
+
await messageChild(found.viewId, message, context.turnId, context.abortSignal, "parent");
|
|
12259
11988
|
} catch (error) {
|
|
12260
11989
|
return {
|
|
12261
11990
|
success: false,
|
|
@@ -12280,7 +12009,7 @@ ${step}`;
|
|
|
12280
12009
|
error: `Task ${taskId} has finished and cannot be resumed from here.`
|
|
12281
12010
|
};
|
|
12282
12011
|
try {
|
|
12283
|
-
await messageChild(shown.viewId,
|
|
12012
|
+
await messageChild(shown.viewId, message, context.turnId, context.abortSignal, "parent");
|
|
12284
12013
|
} catch (error) {
|
|
12285
12014
|
return {
|
|
12286
12015
|
success: false,
|
|
@@ -12295,8 +12024,8 @@ ${step}`;
|
|
|
12295
12024
|
};
|
|
12296
12025
|
}
|
|
12297
12026
|
context.abortSignal.throwIfAborted();
|
|
12298
|
-
await gateway.continueTask(taskId,
|
|
12299
|
-
activity.recordMessage(String(taskId),
|
|
12027
|
+
await gateway.continueTask(taskId, message);
|
|
12028
|
+
activity.recordMessage(String(taskId), message, "to-child");
|
|
12300
12029
|
return {
|
|
12301
12030
|
success: true,
|
|
12302
12031
|
output: `Message queued for delivery to task ${taskId} at its next tool round. If it finishes first, it is resumed with the message and notifies again, so wait for that notification before resending.`,
|
|
@@ -12387,14 +12116,14 @@ ${step}`;
|
|
|
12387
12116
|
concurrencySafe: true,
|
|
12388
12117
|
async execute(input2, context) {
|
|
12389
12118
|
context.abortSignal.throwIfAborted();
|
|
12390
|
-
const { to, message
|
|
12119
|
+
const { to, message } = input2;
|
|
12391
12120
|
if (to !== "main")
|
|
12392
12121
|
return {
|
|
12393
12122
|
success: false,
|
|
12394
12123
|
output: "",
|
|
12395
12124
|
error: `No agent named '${to}' is currently addressable. Only "main" can be messaged from here.`
|
|
12396
12125
|
};
|
|
12397
|
-
if (!
|
|
12126
|
+
if (!message.trim())
|
|
12398
12127
|
return { success: false, output: "", error: "Message must not be blank." };
|
|
12399
12128
|
const shown = activity.getSnapshot().find((entry) => entry.sessionId === String(context.sessionId));
|
|
12400
12129
|
const owned = shown ? conversations.get(shown.viewId) : void 0;
|
|
@@ -12413,7 +12142,7 @@ ${step}`;
|
|
|
12413
12142
|
agentId: shown.agentId,
|
|
12414
12143
|
description: shown.description,
|
|
12415
12144
|
...shown.taskId ? { taskId: shown.taskId } : {},
|
|
12416
|
-
text:
|
|
12145
|
+
text: message
|
|
12417
12146
|
});
|
|
12418
12147
|
} catch {
|
|
12419
12148
|
}
|
|
@@ -12502,9 +12231,9 @@ ${step}`;
|
|
|
12502
12231
|
};
|
|
12503
12232
|
}
|
|
12504
12233
|
});
|
|
12505
|
-
const messageChild = /* @__PURE__ */ __name(async (viewId,
|
|
12234
|
+
const messageChild = /* @__PURE__ */ __name(async (viewId, message, turnId, signal, source = "operator") => {
|
|
12506
12235
|
if (closed) throw new Error("Sub-agent runtime is closed.");
|
|
12507
|
-
if (!
|
|
12236
|
+
if (!message.trim() || message.length > 16e3)
|
|
12508
12237
|
throw new Error("A child message must contain 1\u201316000 characters.");
|
|
12509
12238
|
const owned = conversations.get(viewId);
|
|
12510
12239
|
const shown = activity.getSnapshot().find((value) => value.viewId === viewId);
|
|
@@ -12540,7 +12269,7 @@ ${step}`;
|
|
|
12540
12269
|
parentTurnId: turnId,
|
|
12541
12270
|
taskId: owned.publicTaskId,
|
|
12542
12271
|
viewId,
|
|
12543
|
-
message
|
|
12272
|
+
message,
|
|
12544
12273
|
at: (/* @__PURE__ */ new Date()).toISOString()
|
|
12545
12274
|
})}
|
|
12546
12275
|
`,
|
|
@@ -12557,14 +12286,14 @@ ${step}`;
|
|
|
12557
12286
|
sessionId: parent.sessionId
|
|
12558
12287
|
});
|
|
12559
12288
|
await mkdir4(directory, { recursive: true, mode: 448 });
|
|
12560
|
-
journal =
|
|
12289
|
+
journal = join11(directory, "child-operator-messages.jsonl");
|
|
12561
12290
|
}
|
|
12562
12291
|
await audit("submitted");
|
|
12563
12292
|
signal.throwIfAborted();
|
|
12564
12293
|
const current = owned.gateway.getTask(owned.task.taskId) ?? owned.task;
|
|
12565
12294
|
let task;
|
|
12566
12295
|
if (!isTerminalAgentTaskState(current.state)) {
|
|
12567
|
-
await owned.gateway.continueTask(current.taskId,
|
|
12296
|
+
await owned.gateway.continueTask(current.taskId, message);
|
|
12568
12297
|
task = current;
|
|
12569
12298
|
} else {
|
|
12570
12299
|
if (owned.workspace !== "shared")
|
|
@@ -12585,7 +12314,7 @@ ${step}`;
|
|
|
12585
12314
|
task = await gateway.createTask({
|
|
12586
12315
|
agentId: owned.agentId,
|
|
12587
12316
|
resumeSessionId: sessionId,
|
|
12588
|
-
prompt:
|
|
12317
|
+
prompt: message,
|
|
12589
12318
|
workingDirectory: opts.cwd,
|
|
12590
12319
|
workspace: { mode: "shared" },
|
|
12591
12320
|
configOverrides: {
|
|
@@ -12627,7 +12356,7 @@ ${step}`;
|
|
|
12627
12356
|
admitted = true;
|
|
12628
12357
|
activity.recordMessage(
|
|
12629
12358
|
String(task.taskId),
|
|
12630
|
-
|
|
12359
|
+
message,
|
|
12631
12360
|
source === "operator" ? "operator-to-child" : "to-child",
|
|
12632
12361
|
kind === "started" ? "started" : "queued"
|
|
12633
12362
|
);
|
|
@@ -12647,7 +12376,7 @@ ${step}`;
|
|
|
12647
12376
|
id,
|
|
12648
12377
|
viewId,
|
|
12649
12378
|
taskId: owned.publicTaskId,
|
|
12650
|
-
message
|
|
12379
|
+
message,
|
|
12651
12380
|
kind
|
|
12652
12381
|
}),
|
|
12653
12382
|
...auditWarning ? { auditWarning } : {}
|
|
@@ -12891,7 +12620,7 @@ function completedAgentResult(completed, shownTaskId = completed.taskId) {
|
|
|
12891
12620
|
let resultText = typeof value === "string" ? value : value === void 0 ? "" : JSON.stringify(value);
|
|
12892
12621
|
if (!resultText && turn?.stopReason && turn.stopReason !== "end_turn") {
|
|
12893
12622
|
const partial = [...turn.messages].reverse().find(
|
|
12894
|
-
(
|
|
12623
|
+
(message) => message.role === "assistant" && typeof message.content === "string" && message.content.trim().length > 0
|
|
12895
12624
|
)?.content;
|
|
12896
12625
|
if (typeof partial === "string") resultText = partial;
|
|
12897
12626
|
}
|
|
@@ -12945,13 +12674,28 @@ function cappedTurns(limit, fileCap) {
|
|
|
12945
12674
|
}
|
|
12946
12675
|
__name(cappedTurns, "cappedTurns");
|
|
12947
12676
|
function buildDefinition(id, description, systemPrompt, opts, tools = opts.buildTools, model = opts.model, selection, inheritedPrompt, file) {
|
|
12948
|
-
const
|
|
12677
|
+
const metadata = {
|
|
12949
12678
|
id,
|
|
12950
12679
|
name: id,
|
|
12951
12680
|
version: "1.0.0",
|
|
12952
12681
|
category: "general",
|
|
12953
12682
|
description
|
|
12954
|
-
}
|
|
12683
|
+
};
|
|
12684
|
+
const carried = file?.hooksSource !== void 0 ? {
|
|
12685
|
+
name: file.name ?? id,
|
|
12686
|
+
path: file.path ?? id,
|
|
12687
|
+
source: file.source ?? "project",
|
|
12688
|
+
hooksSource: file.hooksSource
|
|
12689
|
+
} : void 0;
|
|
12690
|
+
const runScope = carried ? (sessionId) => {
|
|
12691
|
+
if (!opts.agentHooks) {
|
|
12692
|
+
throw new Error(
|
|
12693
|
+
`Agent "${carried.name}" is not started: ${carried.path} carries hooks and this host does not attach them, so it would run without the guard its file wrote.`
|
|
12694
|
+
);
|
|
12695
|
+
}
|
|
12696
|
+
return opts.agentHooks.attachRun(carried, sessionId);
|
|
12697
|
+
} : void 0;
|
|
12698
|
+
const agent2 = new NamzuCliAgent(metadata, void 0, runScope);
|
|
12955
12699
|
const base = inheritedPrompt !== void 0 || systemPrompt === SUBAGENT_PROMPT ? systemPrompt : `${systemPrompt}
|
|
12956
12700
|
|
|
12957
12701
|
${SUBAGENT_PROMPT}`;
|
|
@@ -12968,6 +12712,10 @@ ${SUBAGENT_PROMPT}`;
|
|
|
12968
12712
|
// NamzuCliAgent is Agent<NamzuCliAgentConfig,…>; the registry stores the
|
|
12969
12713
|
// erased Agent<BaseAgentConfig,…>. configBuilder supplies the richer config.
|
|
12970
12714
|
typedAgent: agent2,
|
|
12715
|
+
// One shell per run, each with the same scope: `forTurn` would rebuild it without.
|
|
12716
|
+
...runScope ? {
|
|
12717
|
+
createAgent: /* @__PURE__ */ __name(() => new NamzuCliAgent(metadata, void 0, runScope), "createAgent")
|
|
12718
|
+
} : {},
|
|
12971
12719
|
configBuilder: /* @__PURE__ */ __name(async (options) => {
|
|
12972
12720
|
const limits = resolveTurnGuards(
|
|
12973
12721
|
opts,
|
|
@@ -13030,7 +12778,7 @@ __name(buildDefinition, "buildDefinition");
|
|
|
13030
12778
|
|
|
13031
12779
|
// src/integrations/workflows/history.ts
|
|
13032
12780
|
import { readFile as readFile5, readdir as readdir2 } from "node:fs/promises";
|
|
13033
|
-
import { join as
|
|
12781
|
+
import { join as join12 } from "node:path";
|
|
13034
12782
|
var RUN_ID = /^w[0-9a-z]{8}$/;
|
|
13035
12783
|
async function readWorkflowJournal(file) {
|
|
13036
12784
|
let text2;
|
|
@@ -13056,7 +12804,7 @@ async function readWorkflowJournal(file) {
|
|
|
13056
12804
|
__name(readWorkflowJournal, "readWorkflowJournal");
|
|
13057
12805
|
async function readWorkflowRun(runsDirectory, runId) {
|
|
13058
12806
|
if (!RUN_ID.test(runId)) return void 0;
|
|
13059
|
-
const records = await readWorkflowJournal(
|
|
12807
|
+
const records = await readWorkflowJournal(join12(runsDirectory, runId, "workflow", "journal.jsonl"));
|
|
13060
12808
|
return viewFromJournal(records);
|
|
13061
12809
|
}
|
|
13062
12810
|
__name(readWorkflowRun, "readWorkflowRun");
|
|
@@ -13079,7 +12827,7 @@ __name(listWorkflowRuns, "listWorkflowRuns");
|
|
|
13079
12827
|
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
13080
12828
|
import { existsSync as existsSync3 } from "node:fs";
|
|
13081
12829
|
import { readFile as readFile6 } from "node:fs/promises";
|
|
13082
|
-
import { join as
|
|
12830
|
+
import { join as join13 } from "node:path";
|
|
13083
12831
|
|
|
13084
12832
|
// src/integrations/workflows/offering.ts
|
|
13085
12833
|
var WORKFLOW_TOOL_NAME = "workflow";
|
|
@@ -13530,7 +13278,7 @@ function createWorkflowHost(options) {
|
|
|
13530
13278
|
}
|
|
13531
13279
|
let checked;
|
|
13532
13280
|
try {
|
|
13533
|
-
checked = await new FileWorkflowJournal(
|
|
13281
|
+
checked = await new FileWorkflowJournal(join13(runs, runId, "workflow"), {
|
|
13534
13282
|
runId,
|
|
13535
13283
|
...key !== void 0 ? { key } : {}
|
|
13536
13284
|
}).read();
|
|
@@ -13550,7 +13298,7 @@ function createWorkflowHost(options) {
|
|
|
13550
13298
|
}
|
|
13551
13299
|
resumeState = loadWorkflowResume(checked);
|
|
13552
13300
|
if (!resumeState.resumable) {
|
|
13553
|
-
const mismatch = key !== void 0 && await readFile6(
|
|
13301
|
+
const mismatch = key !== void 0 && await readFile6(join13(runs, runId, "workflow", "journal.jsonl"), "utf8").then(
|
|
13554
13302
|
(text2) => journalKeyMismatch(text2, runId, key),
|
|
13555
13303
|
() => false
|
|
13556
13304
|
);
|
|
@@ -13570,12 +13318,12 @@ function createWorkflowHost(options) {
|
|
|
13570
13318
|
if (state === "ended") registry.discard(runId);
|
|
13571
13319
|
} else {
|
|
13572
13320
|
runId = createWorkflowRunId(
|
|
13573
|
-
(id) => registry.get(id) !== void 0 || runs !== void 0 && existsSync3(
|
|
13321
|
+
(id) => registry.get(id) !== void 0 || runs !== void 0 && existsSync3(join13(runs, id))
|
|
13574
13322
|
);
|
|
13575
13323
|
}
|
|
13576
13324
|
const turn = options.openRunTurn(context.turnId, runId);
|
|
13577
13325
|
const limits = options.limitsFor?.(context.turnId);
|
|
13578
|
-
const journalDirectory = runs === void 0 ? void 0 :
|
|
13326
|
+
const journalDirectory = runs === void 0 ? void 0 : join13(runs, runId, "workflow");
|
|
13579
13327
|
const journal = journalDirectory === void 0 ? void 0 : new FileWorkflowJournal(journalDirectory, {
|
|
13580
13328
|
runId,
|
|
13581
13329
|
...key !== void 0 ? { key } : {}
|
|
@@ -13616,7 +13364,7 @@ function createWorkflowHost(options) {
|
|
|
13616
13364
|
...journal ? { journal } : {},
|
|
13617
13365
|
...resumeState ? { resume: resumeState } : {},
|
|
13618
13366
|
...editable !== void 0 ? { scriptPath: editable } : {},
|
|
13619
|
-
...journalDirectory !== void 0 ? { journalPath:
|
|
13367
|
+
...journalDirectory !== void 0 ? { journalPath: join13(journalDirectory, "journal.jsonl") } : {},
|
|
13620
13368
|
spawn: /* @__PURE__ */ __name(async (request, signal, viewed) => {
|
|
13621
13369
|
const detail = phaseDetail(request.phaseTitle);
|
|
13622
13370
|
const outcome2 = await options.subagents.launchWorkflowAgent({
|
|
@@ -13701,7 +13449,7 @@ __name(createWorkflowHost, "createWorkflowHost");
|
|
|
13701
13449
|
// src/integrations/workflows/orphans.ts
|
|
13702
13450
|
import { existsSync as existsSync4 } from "node:fs";
|
|
13703
13451
|
import { readFile as readFile7, readdir as readdir3, writeFile as writeFile3 } from "node:fs/promises";
|
|
13704
|
-
import { join as
|
|
13452
|
+
import { join as join14 } from "node:path";
|
|
13705
13453
|
var NOTICE_FILE = "orphan-notice.json";
|
|
13706
13454
|
var MAX_ORPHAN_NOTICES = 20;
|
|
13707
13455
|
var NO_USAGE = {
|
|
@@ -13720,7 +13468,7 @@ function quotedName(name) {
|
|
|
13720
13468
|
}
|
|
13721
13469
|
__name(quotedName, "quotedName");
|
|
13722
13470
|
function noticePath(runsDirectory, runId) {
|
|
13723
|
-
return
|
|
13471
|
+
return join14(runsDirectory, runId, "workflow", NOTICE_FILE);
|
|
13724
13472
|
}
|
|
13725
13473
|
__name(noticePath, "noticePath");
|
|
13726
13474
|
async function readStored(runsDirectory, runId) {
|
|
@@ -13752,7 +13500,7 @@ async function recoverUnfinishedWorkflows(options) {
|
|
|
13752
13500
|
for (const runId of entries.filter((name) => RUN_ID_PATTERN.test(name)).sort()) {
|
|
13753
13501
|
if (options.liveRunIds.has(runId)) continue;
|
|
13754
13502
|
const stored = await readStored(options.runsDirectory, runId);
|
|
13755
|
-
const dir =
|
|
13503
|
+
const dir = join14(options.runsDirectory, runId, "workflow");
|
|
13756
13504
|
const journal = new FileWorkflowJournal(dir, {
|
|
13757
13505
|
runId,
|
|
13758
13506
|
...options.key !== void 0 ? { key: options.key } : {}
|
|
@@ -13861,7 +13609,7 @@ __name(recoverUnfinishedWorkflows, "recoverUnfinishedWorkflows");
|
|
|
13861
13609
|
async function keyMismatchOf(dir, runId, key) {
|
|
13862
13610
|
if (key === void 0) return false;
|
|
13863
13611
|
try {
|
|
13864
|
-
return journalKeyMismatch(await readFile7(
|
|
13612
|
+
return journalKeyMismatch(await readFile7(join14(dir, "journal.jsonl"), "utf8"), runId, key);
|
|
13865
13613
|
} catch {
|
|
13866
13614
|
return false;
|
|
13867
13615
|
}
|
|
@@ -14075,7 +13823,7 @@ import { dirname as dirname4 } from "node:path";
|
|
|
14075
13823
|
import { createHash as createHash5 } from "node:crypto";
|
|
14076
13824
|
|
|
14077
13825
|
// src/memory/manage.ts
|
|
14078
|
-
import { join as
|
|
13826
|
+
import { join as join15 } from "node:path";
|
|
14079
13827
|
|
|
14080
13828
|
// src/memory/presentation.ts
|
|
14081
13829
|
var MEMORY_PREVIEW_MAX_CHARS = 2e3;
|
|
@@ -14340,7 +14088,7 @@ async function loadManagedMemories(store, directory, lookups = {}) {
|
|
|
14340
14088
|
createdAt: record.entry.createdAt,
|
|
14341
14089
|
updatedAt: record.entry.updatedAt,
|
|
14342
14090
|
revision: record.revision,
|
|
14343
|
-
path: record.entry.name ?
|
|
14091
|
+
path: record.entry.name ? join15(directory, `${record.entry.name}.md`) : directory,
|
|
14344
14092
|
...replaced ? { replaces: replaced } : {},
|
|
14345
14093
|
...state !== "active" ? { state } : {},
|
|
14346
14094
|
...retiredReason !== void 0 ? { retiredReason } : {},
|
|
@@ -15506,7 +15254,7 @@ import {
|
|
|
15506
15254
|
unlink as unlink3,
|
|
15507
15255
|
writeFile as writeFile4
|
|
15508
15256
|
} from "node:fs/promises";
|
|
15509
|
-
import { basename as basename4, dirname as dirname5, join as
|
|
15257
|
+
import { basename as basename4, dirname as dirname5, join as join16 } from "node:path";
|
|
15510
15258
|
var INBOX_BATCH_SIZE = 8;
|
|
15511
15259
|
var INBOX_MAX_BATCHES = 3;
|
|
15512
15260
|
var INBOX_CLAIM_STALE_MS = 12e4;
|
|
@@ -15601,7 +15349,7 @@ var MemoryInbox = class {
|
|
|
15601
15349
|
return dedupe(texts.flatMap((text2) => text2 === void 0 ? [] : parseLines(text2)));
|
|
15602
15350
|
}
|
|
15603
15351
|
#newClaimPath(now) {
|
|
15604
|
-
return
|
|
15352
|
+
return join16(
|
|
15605
15353
|
dirname5(this.#file),
|
|
15606
15354
|
`${basename4(this.#file, ".jsonl")}.claim-${now}-${this.#newId()}.jsonl`
|
|
15607
15355
|
);
|
|
@@ -15620,7 +15368,7 @@ var MemoryInbox = class {
|
|
|
15620
15368
|
if (!name.startsWith(prefix)) continue;
|
|
15621
15369
|
const match = CLAIM_PATTERN.exec(name);
|
|
15622
15370
|
if (!match) continue;
|
|
15623
|
-
out.push({ path:
|
|
15371
|
+
out.push({ path: join16(dirname5(this.#file), name), at: Number(match[1]) });
|
|
15624
15372
|
}
|
|
15625
15373
|
return out.sort((a, b) => a.at - b.at);
|
|
15626
15374
|
}
|
|
@@ -15902,7 +15650,7 @@ var MemoryLifecycle = class {
|
|
|
15902
15650
|
|
|
15903
15651
|
// src/memory/screen-archive.ts
|
|
15904
15652
|
import { access as access2, writeFile as writeFile5 } from "node:fs/promises";
|
|
15905
|
-
import { join as
|
|
15653
|
+
import { join as join17 } from "node:path";
|
|
15906
15654
|
var SCREEN_MARKER_FILE = ".derived-screen-v1";
|
|
15907
15655
|
var HEADINGS = {
|
|
15908
15656
|
"What the user requires": "userRequirements",
|
|
@@ -15961,7 +15709,7 @@ ${body2}`) !== void 0) return true;
|
|
|
15961
15709
|
__name(wouldNotBeWritten, "wouldNotBeWritten");
|
|
15962
15710
|
async function archiveUnscreenedRecords(options) {
|
|
15963
15711
|
const { store, directory, log } = options;
|
|
15964
|
-
const marker =
|
|
15712
|
+
const marker = join17(directory, SCREEN_MARKER_FILE);
|
|
15965
15713
|
try {
|
|
15966
15714
|
if (await access2(marker).then(
|
|
15967
15715
|
() => true,
|
|
@@ -16648,8 +16396,8 @@ function lower(text2) {
|
|
|
16648
16396
|
}
|
|
16649
16397
|
__name(lower, "lower");
|
|
16650
16398
|
function commandName(value) {
|
|
16651
|
-
const
|
|
16652
|
-
return lower(
|
|
16399
|
+
const cut2 = Math.max(value.lastIndexOf("/"), value.lastIndexOf("\\"));
|
|
16400
|
+
return lower(cut2 < 0 ? value : value.slice(cut2 + 1)).replace(CLI_EXTENSIONS, "");
|
|
16653
16401
|
}
|
|
16654
16402
|
__name(commandName, "commandName");
|
|
16655
16403
|
function namesCli(value) {
|
|
@@ -17309,15 +17057,15 @@ ${text2.trim()}
|
|
|
17309
17057
|
</system-reminder>`;
|
|
17310
17058
|
}
|
|
17311
17059
|
__name(frameReminder, "frameReminder");
|
|
17312
|
-
function reminderKindOf(
|
|
17313
|
-
if (!isReminderMessage(
|
|
17314
|
-
const kind = TAG.exec(
|
|
17060
|
+
function reminderKindOf(message) {
|
|
17061
|
+
if (!isReminderMessage(message) || typeof message.content !== "string") return void 0;
|
|
17062
|
+
const kind = TAG.exec(message.content)?.[1];
|
|
17315
17063
|
return kind !== void 0 && KINDS.has(kind) ? kind : void 0;
|
|
17316
17064
|
}
|
|
17317
17065
|
__name(reminderKindOf, "reminderKindOf");
|
|
17318
|
-
function isOperatorTurn(
|
|
17319
|
-
if (
|
|
17320
|
-
const source =
|
|
17066
|
+
function isOperatorTurn(message) {
|
|
17067
|
+
if (message.role !== "user") return false;
|
|
17068
|
+
const source = message.source;
|
|
17321
17069
|
return source === void 0 || source.type === "goal-round" || source.type === "runtime-context" && source.kind === "steering";
|
|
17322
17070
|
}
|
|
17323
17071
|
__name(isOperatorTurn, "isOperatorTurn");
|
|
@@ -17375,8 +17123,8 @@ function changedSnippet(before, after, maxChars = CHANGED_FILE_MAX_CHARS) {
|
|
|
17375
17123
|
const marker = "\n... [more lines not shown; read the file for the rest] ...";
|
|
17376
17124
|
if (marker.length >= limit) return "";
|
|
17377
17125
|
const room = limit - marker.length;
|
|
17378
|
-
const
|
|
17379
|
-
const kept = text2.slice(0,
|
|
17126
|
+
const cut2 = text2.lastIndexOf("\n", room);
|
|
17127
|
+
const kept = text2.slice(0, cut2 > 0 ? cut2 : room);
|
|
17380
17128
|
return `${kept}${marker}`;
|
|
17381
17129
|
}
|
|
17382
17130
|
__name(changedSnippet, "changedSnippet");
|
|
@@ -17435,9 +17183,9 @@ var FIRST = "These are facts about right now. Prefer them over any date or branc
|
|
|
17435
17183
|
var CHANGED = "The date or the working environment changed since you were last told. This needs no announcement to the user; use it where it matters.";
|
|
17436
17184
|
function lastTold(messages) {
|
|
17437
17185
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
17438
|
-
const
|
|
17439
|
-
if (reminderKindOf(
|
|
17440
|
-
return
|
|
17186
|
+
const message = messages[i];
|
|
17187
|
+
if (reminderKindOf(message) === "environment" && typeof message.content === "string") {
|
|
17188
|
+
return message.content;
|
|
17441
17189
|
}
|
|
17442
17190
|
}
|
|
17443
17191
|
return void 0;
|
|
@@ -17464,10 +17212,10 @@ var EXIT = "Hypermode is off: the `workflow` tool's standard opt-in rule applies
|
|
|
17464
17212
|
function scan(messages) {
|
|
17465
17213
|
let turns = 0;
|
|
17466
17214
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
17467
|
-
const
|
|
17468
|
-
const kind = reminderKindOf(
|
|
17215
|
+
const message = messages[i];
|
|
17216
|
+
const kind = reminderKindOf(message);
|
|
17469
17217
|
if (kind === "hypermode-on" || kind === "hypermode-exit") return { last: kind, turns };
|
|
17470
|
-
if (isOperatorTurn(
|
|
17218
|
+
if (isOperatorTurn(message)) turns++;
|
|
17471
17219
|
}
|
|
17472
17220
|
return { last: void 0, turns };
|
|
17473
17221
|
}
|
|
@@ -17509,11 +17257,11 @@ function instructionsDigest(text2) {
|
|
|
17509
17257
|
__name(instructionsDigest, "instructionsDigest");
|
|
17510
17258
|
function announced(messages) {
|
|
17511
17259
|
const told = /* @__PURE__ */ new Map();
|
|
17512
|
-
for (const
|
|
17513
|
-
if (reminderKindOf(
|
|
17260
|
+
for (const message of messages) {
|
|
17261
|
+
if (reminderKindOf(message) !== "mcp-instructions" || typeof message.content !== "string") {
|
|
17514
17262
|
continue;
|
|
17515
17263
|
}
|
|
17516
|
-
for (const line of
|
|
17264
|
+
for (const line of message.content.split("\n")) {
|
|
17517
17265
|
const open5 = OPEN.exec(line);
|
|
17518
17266
|
if (open5) told.set(JSON.parse(open5[1]), open5[2]);
|
|
17519
17267
|
const gone = GONE.exec(line);
|
|
@@ -17558,9 +17306,9 @@ function digestOf2(text2) {
|
|
|
17558
17306
|
__name(digestOf2, "digestOf");
|
|
17559
17307
|
function announced2(messages) {
|
|
17560
17308
|
const told = /* @__PURE__ */ new Map();
|
|
17561
|
-
for (const
|
|
17562
|
-
if (reminderKindOf(
|
|
17563
|
-
for (const line of
|
|
17309
|
+
for (const message of messages) {
|
|
17310
|
+
if (reminderKindOf(message) !== "memory-index" || typeof message.content !== "string") continue;
|
|
17311
|
+
for (const line of message.content.split("\n")) {
|
|
17564
17312
|
const match = SECTION.exec(line);
|
|
17565
17313
|
if (match?.[1] !== void 0 && match[2] !== void 0) told.set(match[1], match[2]);
|
|
17566
17314
|
}
|
|
@@ -17681,8 +17429,8 @@ This identifies the selected route for this turn, not a change to your Namzu ide
|
|
|
17681
17429
|
The available model metadata does not establish a knowledge cutoff. Do not invent one or infer one from the model name.`
|
|
17682
17430
|
);
|
|
17683
17431
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
17684
|
-
const
|
|
17685
|
-
if (reminderKindOf(
|
|
17432
|
+
const message = messages[i];
|
|
17433
|
+
if (reminderKindOf(message) === "model") return message.content === text2 ? [] : [text2];
|
|
17686
17434
|
}
|
|
17687
17435
|
return [text2];
|
|
17688
17436
|
}
|
|
@@ -17698,8 +17446,8 @@ function scan2(messages) {
|
|
|
17698
17446
|
let hasExited = false;
|
|
17699
17447
|
let inStretch = true;
|
|
17700
17448
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
17701
|
-
const
|
|
17702
|
-
const kind = reminderKindOf(
|
|
17449
|
+
const message = messages[i];
|
|
17450
|
+
const kind = reminderKindOf(message);
|
|
17703
17451
|
if (kind === "plan-exit") {
|
|
17704
17452
|
hasExited = true;
|
|
17705
17453
|
if (!hasReminder) inStretch = false;
|
|
@@ -17710,7 +17458,7 @@ function scan2(messages) {
|
|
|
17710
17458
|
if (kind === "plan-mode") sent++;
|
|
17711
17459
|
continue;
|
|
17712
17460
|
}
|
|
17713
|
-
if (!hasReminder && isOperatorTurn(
|
|
17461
|
+
if (!hasReminder && isOperatorTurn(message)) turns++;
|
|
17714
17462
|
}
|
|
17715
17463
|
return { turnsSinceReminder: turns, hasReminder, sent, hasExited };
|
|
17716
17464
|
}
|
|
@@ -17782,9 +17530,9 @@ function skillListingLine(skill) {
|
|
|
17782
17530
|
__name(skillListingLine, "skillListingLine");
|
|
17783
17531
|
function announced4(messages) {
|
|
17784
17532
|
const told = /* @__PURE__ */ new Map();
|
|
17785
|
-
for (const
|
|
17786
|
-
if (reminderKindOf(
|
|
17787
|
-
for (const line of
|
|
17533
|
+
for (const message of messages) {
|
|
17534
|
+
if (reminderKindOf(message) !== "skill-listing" || typeof message.content !== "string") continue;
|
|
17535
|
+
for (const line of message.content.split("\n")) {
|
|
17788
17536
|
const withdrawn = WITHDRAWAL.exec(line)?.[1];
|
|
17789
17537
|
if (withdrawn !== void 0) {
|
|
17790
17538
|
told.delete(withdrawn);
|
|
@@ -17834,14 +17582,14 @@ function taskNudgeCounts(messages) {
|
|
|
17834
17582
|
let sawTool = false;
|
|
17835
17583
|
let sawNudge = false;
|
|
17836
17584
|
for (let i = messages.length - 1; i >= 0 && !(sawTool && sawNudge); i--) {
|
|
17837
|
-
const
|
|
17838
|
-
if (
|
|
17839
|
-
if (!sawTool &&
|
|
17585
|
+
const message = messages[i];
|
|
17586
|
+
if (message.role === "assistant") {
|
|
17587
|
+
if (!sawTool && message.toolCalls?.some((call) => TASK_TOOLS.has(call.function.name))) {
|
|
17840
17588
|
sawTool = true;
|
|
17841
17589
|
}
|
|
17842
17590
|
if (!sawTool) sinceTaskTool++;
|
|
17843
17591
|
if (!sawNudge) sinceNudge++;
|
|
17844
|
-
} else if (!sawNudge && reminderKindOf(
|
|
17592
|
+
} else if (!sawNudge && reminderKindOf(message) === "task-nudge") {
|
|
17845
17593
|
sawNudge = true;
|
|
17846
17594
|
}
|
|
17847
17595
|
}
|
|
@@ -17851,9 +17599,9 @@ __name(taskNudgeCounts, "taskNudgeCounts");
|
|
|
17851
17599
|
function stepsThisRequest(messages) {
|
|
17852
17600
|
let steps = 0;
|
|
17853
17601
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
17854
|
-
const
|
|
17855
|
-
if (isOperatorTurn(
|
|
17856
|
-
if (
|
|
17602
|
+
const message = messages[i];
|
|
17603
|
+
if (isOperatorTurn(message)) break;
|
|
17604
|
+
if (message.role === "assistant" && (message.toolCalls?.length ?? 0) > 0) steps++;
|
|
17857
17605
|
}
|
|
17858
17606
|
return steps;
|
|
17859
17607
|
}
|
|
@@ -17942,10 +17690,277 @@ function createSkillDirectoryResolver(options) {
|
|
|
17942
17690
|
}
|
|
17943
17691
|
__name(createSkillDirectoryResolver, "createSkillDirectoryResolver");
|
|
17944
17692
|
|
|
17693
|
+
// src/skills/skill-hooks.ts
|
|
17694
|
+
import { createHash as createHash8 } from "node:crypto";
|
|
17695
|
+
function skillHookEnv(skillRoot) {
|
|
17696
|
+
return { NAMZU_SKILL_ROOT: skillRoot };
|
|
17697
|
+
}
|
|
17698
|
+
__name(skillHookEnv, "skillHookEnv");
|
|
17699
|
+
function withSkillRoot(entry, skillRoot) {
|
|
17700
|
+
if (entry.type === "http" || entry.type === "prompt") return entry;
|
|
17701
|
+
const put = /* @__PURE__ */ __name((text2) => text2.split("${NAMZU_SKILL_ROOT}").join(skillRoot), "put");
|
|
17702
|
+
return {
|
|
17703
|
+
...entry,
|
|
17704
|
+
command: put(entry.command),
|
|
17705
|
+
...entry.args !== void 0 ? { args: entry.args.map(put) } : {}
|
|
17706
|
+
};
|
|
17707
|
+
}
|
|
17708
|
+
__name(withSkillRoot, "withSkillRoot");
|
|
17709
|
+
var MAX_NOTICE_CHARS = 600;
|
|
17710
|
+
function describeRuns(entry) {
|
|
17711
|
+
if (entry.type === "http") return `POST ${entry.url}`;
|
|
17712
|
+
if (entry.type === "prompt") return `ask: ${entry.prompt.replace(/\s+/g, " ").slice(0, 60)}`;
|
|
17713
|
+
return [entry.command, ...entry.args ?? []].join(" ");
|
|
17714
|
+
}
|
|
17715
|
+
__name(describeRuns, "describeRuns");
|
|
17716
|
+
function digestOf3(text2) {
|
|
17717
|
+
return createHash8("sha256").update(text2).digest("hex").slice(0, 16);
|
|
17718
|
+
}
|
|
17719
|
+
__name(digestOf3, "digestOf");
|
|
17720
|
+
function cut(text2) {
|
|
17721
|
+
return text2.length > MAX_NOTICE_CHARS ? `${text2.slice(0, MAX_NOTICE_CHARS)}...` : text2;
|
|
17722
|
+
}
|
|
17723
|
+
__name(cut, "cut");
|
|
17724
|
+
function firstSentence(problems, severity) {
|
|
17725
|
+
const found = problems.filter((problem) => problem.severity === severity);
|
|
17726
|
+
return found.map((problem) => `${problem.event} ${problem.message}`).join(" ");
|
|
17727
|
+
}
|
|
17728
|
+
__name(firstSentence, "firstSentence");
|
|
17729
|
+
function createSkillHooksHost(options) {
|
|
17730
|
+
const live = /* @__PURE__ */ new Set();
|
|
17731
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
17732
|
+
const told = /* @__PURE__ */ new Set();
|
|
17733
|
+
const tell = /* @__PURE__ */ __name((line) => {
|
|
17734
|
+
if (told.has(line)) return;
|
|
17735
|
+
told.add(line);
|
|
17736
|
+
for (const listener of listeners) listener(line);
|
|
17737
|
+
}, "tell");
|
|
17738
|
+
const inert2 = { remove: /* @__PURE__ */ __name(() => void 0, "remove") };
|
|
17739
|
+
const prepareHooks = /* @__PURE__ */ __name((skill, how) => {
|
|
17740
|
+
const name = skill.name;
|
|
17741
|
+
if (options.hooksSwitch() !== void 0) {
|
|
17742
|
+
return { withholdGrants: false, attach: /* @__PURE__ */ __name(() => inert2, "attach") };
|
|
17743
|
+
}
|
|
17744
|
+
const refuse = /* @__PURE__ */ __name((why) => {
|
|
17745
|
+
const line = `Skill ${name}: ${why} None of its hooks are attached and its allowed-tools are not pre-approved.`;
|
|
17746
|
+
tell(cut(line));
|
|
17747
|
+
return { notice: cut(line), withholdGrants: true, attach: /* @__PURE__ */ __name(() => inert2, "attach") };
|
|
17748
|
+
}, "refuse");
|
|
17749
|
+
if (options.isProjectSkill(name) && !options.projectTrusted()) {
|
|
17750
|
+
return refuse("it is in a folder that is not trusted.");
|
|
17751
|
+
}
|
|
17752
|
+
const readAll = withoutSessionStart(readSkillHooks(skill.hooksSource, `skill ${name}`));
|
|
17753
|
+
const read2 = how.forked ? withoutConversationEvents(readAll) : readAll;
|
|
17754
|
+
if (read2.guardLost && read2.count === 0) {
|
|
17755
|
+
return refuse(firstSentence(read2.problems, "problem"));
|
|
17756
|
+
}
|
|
17757
|
+
if (read2.count === 0 && read2.problems.length === 0) {
|
|
17758
|
+
return { withholdGrants: false, attach: /* @__PURE__ */ __name(() => inert2, "attach") };
|
|
17759
|
+
}
|
|
17760
|
+
const manager = options.manager();
|
|
17761
|
+
const base = options.hookOptions();
|
|
17762
|
+
if (!manager || !base) {
|
|
17763
|
+
return refuse("this session has no hook runtime.");
|
|
17764
|
+
}
|
|
17765
|
+
const root = skill.dirPath ?? "";
|
|
17766
|
+
const digest3 = digestOf3(skill.hooksSource);
|
|
17767
|
+
const events = SHELL_HOOK_EVENTS.filter((event) => (read2.hooks[event]?.length ?? 0) > 0);
|
|
17768
|
+
const setAside = firstSentence(read2.problems, "note");
|
|
17769
|
+
const unreadable = read2.guardLost ? firstSentence(read2.problems, "problem") : "";
|
|
17770
|
+
if (setAside) tell(cut(`Skill ${name}: ${setAside}`));
|
|
17771
|
+
const partial = unreadable ? ` Not loaded: ${unreadable} Its allowed-tools are not pre-approved.` : "";
|
|
17772
|
+
if (unreadable) tell(cut(`Skill ${name}:${partial}`));
|
|
17773
|
+
const sameMessage = !how.forked && (events.includes("pre_tool_use") || events.includes("permission_request")) ? " Calls written in the same message as this skill were checked before these hooks attached; make the calls they should guard in a later message." : "";
|
|
17774
|
+
const notice2 = cut(
|
|
17775
|
+
read2.count === 0 ? `Skill ${name}: no hook of its could be loaded. ${setAside}` : how.forked ? `Skill ${name}: its hooks (${events.join(", ")}) apply to the delegated agent's run only.${setAside ? ` Set aside: ${setAside}` : ""}${partial}` : `Skill ${name}: its hooks (${events.join(", ")}) are attached for the rest of this conversation, until it is cleared or resumed.${setAside ? ` Set aside: ${setAside}` : ""}${partial}`
|
|
17776
|
+
) + (read2.count === 0 ? "" : sameMessage);
|
|
17777
|
+
return {
|
|
17778
|
+
notice: notice2,
|
|
17779
|
+
withholdGrants: read2.guardLost,
|
|
17780
|
+
attach: /* @__PURE__ */ __name(() => {
|
|
17781
|
+
if (read2.count === 0) return inert2;
|
|
17782
|
+
if (!how.forked) {
|
|
17783
|
+
for (const found of live) {
|
|
17784
|
+
if (found.skill !== name || found.scope !== "conversation") continue;
|
|
17785
|
+
if (found.digest === digest3) return inert2;
|
|
17786
|
+
found.attachment.remove();
|
|
17787
|
+
live.delete(found);
|
|
17788
|
+
}
|
|
17789
|
+
}
|
|
17790
|
+
const scoped = how.forked ? childScope(how.sessionId, how.prompt) : void 0;
|
|
17791
|
+
const rows = [];
|
|
17792
|
+
const defs = [];
|
|
17793
|
+
const own = {};
|
|
17794
|
+
for (const event of SHELL_HOOK_EVENTS) {
|
|
17795
|
+
for (const configured of read2.hooks[event] ?? []) {
|
|
17796
|
+
const cooked = {
|
|
17797
|
+
...withSkillRoot(configured, root),
|
|
17798
|
+
source: `skill ${name}`
|
|
17799
|
+
};
|
|
17800
|
+
const once = cooked.once === true;
|
|
17801
|
+
const { once: _once, ...withoutOnce } = cooked;
|
|
17802
|
+
let runs = 0;
|
|
17803
|
+
const created = createShellHook(event, withoutOnce, {
|
|
17804
|
+
...base,
|
|
17805
|
+
extraEnv: { ...base.extraEnv, ...skillHookEnv(root) },
|
|
17806
|
+
skillRoot: root,
|
|
17807
|
+
onRun: /* @__PURE__ */ __name((info) => {
|
|
17808
|
+
runs += 1;
|
|
17809
|
+
base.onRun?.(info);
|
|
17810
|
+
}, "onRun")
|
|
17811
|
+
});
|
|
17812
|
+
const index = defs.length;
|
|
17813
|
+
rows.push({
|
|
17814
|
+
skill: name,
|
|
17815
|
+
event,
|
|
17816
|
+
runs: describeRuns(cooked),
|
|
17817
|
+
...cooked.matcher !== void 0 ? { matcher: cooked.matcher } : {},
|
|
17818
|
+
once,
|
|
17819
|
+
scope: how.forked ? "agent" : "conversation",
|
|
17820
|
+
gone: false
|
|
17821
|
+
});
|
|
17822
|
+
defs.push({
|
|
17823
|
+
...created,
|
|
17824
|
+
handler: /* @__PURE__ */ __name(async (context) => {
|
|
17825
|
+
if (scoped && !scoped.covers(context)) return { action: "continue" };
|
|
17826
|
+
const before = runs;
|
|
17827
|
+
const result = await created.handler(context);
|
|
17828
|
+
if (once && runs > before && result.action !== "error") {
|
|
17829
|
+
const row = rows[index];
|
|
17830
|
+
if (row) row.gone = true;
|
|
17831
|
+
own.entry?.attachment.removeAt(index);
|
|
17832
|
+
}
|
|
17833
|
+
return result;
|
|
17834
|
+
}, "handler")
|
|
17835
|
+
});
|
|
17836
|
+
}
|
|
17837
|
+
}
|
|
17838
|
+
const binders = scoped ? scoped.definitions(() => own.entry?.attachment.remove()) : [];
|
|
17839
|
+
const attachment = manager.attachHooks(SHELL_HOOKS_PLUGIN_ID, [...binders, ...defs]);
|
|
17840
|
+
const offset = binders.length;
|
|
17841
|
+
const entry = {
|
|
17842
|
+
skill: name,
|
|
17843
|
+
scope: how.forked ? "agent" : "conversation",
|
|
17844
|
+
digest: digest3,
|
|
17845
|
+
attachment: {
|
|
17846
|
+
size: attachment.size - offset,
|
|
17847
|
+
remove: /* @__PURE__ */ __name(() => {
|
|
17848
|
+
live.delete(entry);
|
|
17849
|
+
return attachment.remove();
|
|
17850
|
+
}, "remove"),
|
|
17851
|
+
removeAt: /* @__PURE__ */ __name((index) => attachment.removeAt(index + offset), "removeAt")
|
|
17852
|
+
},
|
|
17853
|
+
rows
|
|
17854
|
+
};
|
|
17855
|
+
own.entry = entry;
|
|
17856
|
+
live.add(entry);
|
|
17857
|
+
return {
|
|
17858
|
+
remove: /* @__PURE__ */ __name(() => {
|
|
17859
|
+
entry.attachment.remove();
|
|
17860
|
+
}, "remove")
|
|
17861
|
+
};
|
|
17862
|
+
}, "attach")
|
|
17863
|
+
};
|
|
17864
|
+
}, "prepareHooks");
|
|
17865
|
+
return {
|
|
17866
|
+
prepareHooks,
|
|
17867
|
+
use: /* @__PURE__ */ __name((skill) => {
|
|
17868
|
+
prepareHooks(skill, { forked: false }).attach();
|
|
17869
|
+
}, "use"),
|
|
17870
|
+
attached: /* @__PURE__ */ __name(() => [...live].flatMap(
|
|
17871
|
+
(found) => found.rows.filter((row) => !row.gone).map(({ gone: _gone, ...row }) => row)
|
|
17872
|
+
), "attached"),
|
|
17873
|
+
endConversation: /* @__PURE__ */ __name(() => {
|
|
17874
|
+
for (const found of [...live]) found.attachment.remove();
|
|
17875
|
+
live.clear();
|
|
17876
|
+
told.clear();
|
|
17877
|
+
}, "endConversation"),
|
|
17878
|
+
subscribe: /* @__PURE__ */ __name((listener) => {
|
|
17879
|
+
listeners.add(listener);
|
|
17880
|
+
return () => {
|
|
17881
|
+
listeners.delete(listener);
|
|
17882
|
+
};
|
|
17883
|
+
}, "subscribe")
|
|
17884
|
+
};
|
|
17885
|
+
}
|
|
17886
|
+
__name(createSkillHooksHost, "createSkillHooksHost");
|
|
17887
|
+
function childScope(parent, prompt) {
|
|
17888
|
+
const bound = /* @__PURE__ */ new Set();
|
|
17889
|
+
const candidates = /* @__PURE__ */ new Set();
|
|
17890
|
+
let primary;
|
|
17891
|
+
const wanted = prompt?.trim();
|
|
17892
|
+
const isTheSkillsPrompt = /* @__PURE__ */ __name((given) => {
|
|
17893
|
+
const text2 = (given ?? "").trim();
|
|
17894
|
+
if (wanted === void 0 || wanted === "") return true;
|
|
17895
|
+
return text2 !== "" && (text2.includes(wanted) || wanted.includes(text2));
|
|
17896
|
+
}, "isTheSkillsPrompt");
|
|
17897
|
+
const definitions = /* @__PURE__ */ __name((end) => {
|
|
17898
|
+
const out = [
|
|
17899
|
+
{
|
|
17900
|
+
event: "subagent_start",
|
|
17901
|
+
// First, so the agent is covered for its own start events.
|
|
17902
|
+
priority: 0,
|
|
17903
|
+
handler: /* @__PURE__ */ __name(async (context) => {
|
|
17904
|
+
const self = String(context.sessionId);
|
|
17905
|
+
const above = context.parentSessionId !== void 0 ? String(context.parentSessionId) : void 0;
|
|
17906
|
+
if (primary === void 0 && (parent === void 0 || above === parent)) {
|
|
17907
|
+
if (wanted === void 0) {
|
|
17908
|
+
primary = self;
|
|
17909
|
+
} else {
|
|
17910
|
+
candidates.add(self);
|
|
17911
|
+
}
|
|
17912
|
+
bound.add(self);
|
|
17913
|
+
} else if (above !== void 0 && bound.has(above)) {
|
|
17914
|
+
bound.add(self);
|
|
17915
|
+
}
|
|
17916
|
+
return { action: "continue" };
|
|
17917
|
+
}, "handler")
|
|
17918
|
+
},
|
|
17919
|
+
{
|
|
17920
|
+
event: "subagent_stop",
|
|
17921
|
+
handler: /* @__PURE__ */ __name(async (context) => {
|
|
17922
|
+
const self = String(context.sessionId);
|
|
17923
|
+
if (primary !== void 0 && self === primary) {
|
|
17924
|
+
queueMicrotask(end);
|
|
17925
|
+
} else if (candidates.delete(self)) {
|
|
17926
|
+
queueMicrotask(() => bound.delete(self));
|
|
17927
|
+
}
|
|
17928
|
+
return { action: "continue" };
|
|
17929
|
+
}, "handler")
|
|
17930
|
+
}
|
|
17931
|
+
];
|
|
17932
|
+
if (wanted !== void 0) {
|
|
17933
|
+
out.push({
|
|
17934
|
+
event: "user_prompt_submit",
|
|
17935
|
+
priority: 0,
|
|
17936
|
+
handler: /* @__PURE__ */ __name(async (context) => {
|
|
17937
|
+
const self = String(context.sessionId);
|
|
17938
|
+
if (!candidates.has(self)) return { action: "continue" };
|
|
17939
|
+
candidates.delete(self);
|
|
17940
|
+
if (primary === void 0 && isTheSkillsPrompt(context.prompt)) {
|
|
17941
|
+
primary = self;
|
|
17942
|
+
for (const other of candidates) bound.delete(other);
|
|
17943
|
+
candidates.clear();
|
|
17944
|
+
} else {
|
|
17945
|
+
bound.delete(self);
|
|
17946
|
+
}
|
|
17947
|
+
return { action: "continue" };
|
|
17948
|
+
}, "handler")
|
|
17949
|
+
});
|
|
17950
|
+
}
|
|
17951
|
+
return out;
|
|
17952
|
+
}, "definitions");
|
|
17953
|
+
return {
|
|
17954
|
+
covers: /* @__PURE__ */ __name((context) => bound.has(String(context.sessionId)), "covers"),
|
|
17955
|
+
definitions
|
|
17956
|
+
};
|
|
17957
|
+
}
|
|
17958
|
+
__name(childScope, "childScope");
|
|
17959
|
+
|
|
17945
17960
|
// src/tui/conversation-history.ts
|
|
17946
|
-
function assistantTranscriptTexts(
|
|
17947
|
-
const content = typeof
|
|
17948
|
-
const parts =
|
|
17961
|
+
function assistantTranscriptTexts(message) {
|
|
17962
|
+
const content = typeof message.content === "string" ? message.content : "";
|
|
17963
|
+
const parts = message.textParts;
|
|
17949
17964
|
const valid = Array.isArray(parts) && parts.every(
|
|
17950
17965
|
(part) => part !== null && typeof part === "object" && typeof part.id === "string" && typeof part.text === "string" && (part.phase === void 0 || part.phase === "commentary" || part.phase === "final_answer")
|
|
17951
17966
|
);
|
|
@@ -17955,7 +17970,7 @@ function assistantTranscriptTexts(message2) {
|
|
|
17955
17970
|
__name(assistantTranscriptTexts, "assistantTranscriptTexts");
|
|
17956
17971
|
function projectTurnConversation(messages) {
|
|
17957
17972
|
return messages.filter(
|
|
17958
|
-
(
|
|
17973
|
+
(message) => message.role !== "system" || isCompactionMessage(message.content)
|
|
17959
17974
|
);
|
|
17960
17975
|
}
|
|
17961
17976
|
__name(projectTurnConversation, "projectTurnConversation");
|
|
@@ -18876,7 +18891,7 @@ var GH_PR_HARMLESS = /* @__PURE__ */ new Set(["view", "list", "status", "checks"
|
|
|
18876
18891
|
function vcsActions(command) {
|
|
18877
18892
|
const split = splitShell(command);
|
|
18878
18893
|
if (!split || split.segments.length === 0) return { actions: [], absorbed: false };
|
|
18879
|
-
if (split.joins.some((
|
|
18894
|
+
if (split.joins.some((join19, index) => index > 0 && join19 !== "&&"))
|
|
18880
18895
|
return { actions: [], absorbed: false };
|
|
18881
18896
|
const actions = [];
|
|
18882
18897
|
let explained = true;
|
|
@@ -19303,11 +19318,11 @@ __name(clipRequestContext, "clipRequestContext");
|
|
|
19303
19318
|
async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
19304
19319
|
const modelEnvironment = readModelLaunchEnvironment();
|
|
19305
19320
|
if (options.palEnvironment) {
|
|
19306
|
-
const { createPalAgentSession } = await import("./agent-session-
|
|
19321
|
+
const { createPalAgentSession } = await import("./agent-session-H3OE6ZJT.js");
|
|
19307
19322
|
return createPalAgentSession(prefs, detectedProviders, options);
|
|
19308
19323
|
}
|
|
19309
19324
|
let detected = detectedProviders;
|
|
19310
|
-
const { palAtWorkspace } = await import("./store-
|
|
19325
|
+
const { palAtWorkspace } = await import("./store-BY6HMUUN.js");
|
|
19311
19326
|
if (palAtWorkspace(options.cwd ?? process.cwd()))
|
|
19312
19327
|
throw new Error("This Pal requires its owned virtual computer. Open it with namzu pal chat.");
|
|
19313
19328
|
const commandArguments = builtinCommandArguments();
|
|
@@ -20113,12 +20128,26 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
20113
20128
|
for (const problem of pluginFiles.problems) cliLogger().warn(problem);
|
|
20114
20129
|
let subagentRuntime;
|
|
20115
20130
|
let allowedAgentIds = [];
|
|
20131
|
+
const agentHooks = createAgentHooksHost({
|
|
20132
|
+
manager: /* @__PURE__ */ __name(() => pluginRuntime?.manager, "manager"),
|
|
20133
|
+
hookOptions: /* @__PURE__ */ __name(() => pluginRuntime?.hookOptions, "hookOptions"),
|
|
20134
|
+
hooksSwitch: /* @__PURE__ */ __name(() => options.hooksSwitch, "hooksSwitch"),
|
|
20135
|
+
projectTrusted: /* @__PURE__ */ __name(() => options.folderTrusted === true || isTrusted(cwd), "projectTrusted")
|
|
20136
|
+
});
|
|
20137
|
+
let agentHookCarriers = [];
|
|
20138
|
+
let refusedAgents = [];
|
|
20116
20139
|
try {
|
|
20117
|
-
const discovered = await
|
|
20140
|
+
const discovered = await discoverAgentDefinitions({
|
|
20118
20141
|
cwd,
|
|
20119
20142
|
pluginAgentDirs: pluginFiles.agents,
|
|
20120
|
-
...options.skills ? { skills: options.skills } : {}
|
|
20143
|
+
...options.skills ? { skills: options.skills } : {},
|
|
20144
|
+
hooks: {
|
|
20145
|
+
hooksSwitch: options.hooksSwitch,
|
|
20146
|
+
projectTrusted: options.folderTrusted === true || isTrusted(cwd)
|
|
20147
|
+
}
|
|
20121
20148
|
});
|
|
20149
|
+
agentHookCarriers = discovered.definitions.filter((definition) => definition.hooksSource !== void 0).map((definition) => definition.name);
|
|
20150
|
+
refusedAgents = discovered.refused;
|
|
20122
20151
|
for (const missing2 of discovered.missingSkills) {
|
|
20123
20152
|
cliLogger().warn("agent definition skill missing", {
|
|
20124
20153
|
"namzu.agent.definition.path": missing2.path,
|
|
@@ -20136,6 +20165,12 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
20136
20165
|
cwd,
|
|
20137
20166
|
// Plugins are initialized later; resolve the shared manager when a child starts.
|
|
20138
20167
|
resolvePluginManager: /* @__PURE__ */ __name(() => pluginRuntime?.manager, "resolvePluginManager"),
|
|
20168
|
+
// A hook on worktree_create or worktree_remove takes over making and
|
|
20169
|
+
// removing the worktree of a delegated child.
|
|
20170
|
+
worktreeHooks: {
|
|
20171
|
+
host: /* @__PURE__ */ __name(() => pluginRuntime ? worktreeHookHost(pluginRuntime.manager, () => String(scope2.sessionId)) : void 0, "host"),
|
|
20172
|
+
onNotice: /* @__PURE__ */ __name((line) => pluginRuntime?.hookActivity.notify(line), "onNotice")
|
|
20173
|
+
},
|
|
20139
20174
|
...options.ephemeral ? { ephemeral: true } : {},
|
|
20140
20175
|
// An operator is watching: agents run in the background by default and
|
|
20141
20176
|
// the turn ends without waiting for them.
|
|
@@ -20161,6 +20196,8 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
20161
20196
|
resolveTurnModel: /* @__PURE__ */ __name((turnId) => delegationModels.get(turnId), "resolveTurnModel"),
|
|
20162
20197
|
timeoutMs: options.limits?.timeoutMs,
|
|
20163
20198
|
definitions: discovered.definitions,
|
|
20199
|
+
agentHooks,
|
|
20200
|
+
refusedDefinitions: discovered.refused,
|
|
20164
20201
|
// Children log under the parent's `<session-id>/subagents/`; an
|
|
20165
20202
|
// ephemeral session keeps them in memory with its own log.
|
|
20166
20203
|
...options.ephemeral ? {} : { paths },
|
|
@@ -20311,7 +20348,7 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
20311
20348
|
return found != null && canSelectModel(found.entry, found.apiKey, listed.id) && isOfferableModel(providerId, listed.id);
|
|
20312
20349
|
}, "offerable"),
|
|
20313
20350
|
ledger: sub.sideLedger,
|
|
20314
|
-
debug: /* @__PURE__ */ __name((
|
|
20351
|
+
debug: /* @__PURE__ */ __name((message, error) => cliLogger().debug(message, exceptionAttributes(error)), "debug")
|
|
20315
20352
|
});
|
|
20316
20353
|
const learningLedger = createLearningLedger();
|
|
20317
20354
|
learning = createSideLearningModel({
|
|
@@ -20328,7 +20365,7 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
20328
20365
|
return found != null && canSelectModel(found.entry, found.apiKey, listed.id) && isOfferableModel(providerId, listed.id);
|
|
20329
20366
|
}, "offerable"),
|
|
20330
20367
|
ledger: learningLedger,
|
|
20331
|
-
debug: /* @__PURE__ */ __name((
|
|
20368
|
+
debug: /* @__PURE__ */ __name((message, error) => cliLogger().debug(message, exceptionAttributes(error)), "debug")
|
|
20332
20369
|
}),
|
|
20333
20370
|
ledger: learningLedger,
|
|
20334
20371
|
sessionId: scope2.sessionId
|
|
@@ -20353,7 +20390,7 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
20353
20390
|
runsDirectory: /* @__PURE__ */ __name((turnId) => {
|
|
20354
20391
|
if (options.ephemeral) return void 0;
|
|
20355
20392
|
const owner = delegationScopes.get(turnId) ?? scope2;
|
|
20356
|
-
return
|
|
20393
|
+
return join18(paths.sessionDir({ sessionId: owner.sessionId }), "runs");
|
|
20357
20394
|
}, "runsDirectory"),
|
|
20358
20395
|
refusal: /* @__PURE__ */ __name((turnId) => {
|
|
20359
20396
|
const auth = delegatedWorkflowAuth.get(turnId);
|
|
@@ -20591,7 +20628,7 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
20591
20628
|
);
|
|
20592
20629
|
toolsets.push(options.toolLoading === "eager" ? monitorToolset : deferred(monitorToolset));
|
|
20593
20630
|
}
|
|
20594
|
-
const operatorPals = await import("./operator-tools-
|
|
20631
|
+
const operatorPals = await import("./operator-tools-YX4575HD.js");
|
|
20595
20632
|
toolsets.push(
|
|
20596
20633
|
readyWhen(
|
|
20597
20634
|
toolset(
|
|
@@ -20646,7 +20683,7 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
20646
20683
|
);
|
|
20647
20684
|
const curationListeners = /* @__PURE__ */ new Set();
|
|
20648
20685
|
const memoryInbox = new MemoryInbox({
|
|
20649
|
-
file:
|
|
20686
|
+
file: join18(paths.home, "memory-inbox", `${paths.slug}.jsonl`),
|
|
20650
20687
|
now: Date.now
|
|
20651
20688
|
});
|
|
20652
20689
|
const curation = options.memory?.curation === "off" || options.compaction?.consolidate ? void 0 : new CurationRuntime({
|
|
@@ -20656,7 +20693,7 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
20656
20693
|
sideModel: /* @__PURE__ */ __name(() => sideModel, "sideModel"),
|
|
20657
20694
|
fallback: screenedPromoter,
|
|
20658
20695
|
anchorRoot: cliProjectRoot(cwd),
|
|
20659
|
-
log: createCurationLog(
|
|
20696
|
+
log: createCurationLog(join18(paths.home, "memory", "curation.jsonl"))
|
|
20660
20697
|
}),
|
|
20661
20698
|
setTimer: /* @__PURE__ */ __name((run2, ms) => {
|
|
20662
20699
|
const handle = setTimeout(run2, ms);
|
|
@@ -20675,9 +20712,9 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
20675
20712
|
}), "report")
|
|
20676
20713
|
});
|
|
20677
20714
|
const memoryUsage = new MemoryUsage({
|
|
20678
|
-
file:
|
|
20715
|
+
file: join18(paths.home, "memory-usage", `${paths.slug}.json`),
|
|
20679
20716
|
now: Date.now,
|
|
20680
|
-
log: /* @__PURE__ */ __name((
|
|
20717
|
+
log: /* @__PURE__ */ __name((message, fields) => cliLogger().debug(message, fields), "log")
|
|
20681
20718
|
});
|
|
20682
20719
|
const memoryCaution = createAnchorCaution({ root: cliProjectRoot(cwd), usage: memoryUsage });
|
|
20683
20720
|
const memoryLifecycle = new MemoryLifecycle({
|
|
@@ -20693,7 +20730,7 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
20693
20730
|
return handle;
|
|
20694
20731
|
}, "setTimer"),
|
|
20695
20732
|
clearTimer: /* @__PURE__ */ __name((handle) => clearTimeout(handle), "clearTimer"),
|
|
20696
|
-
log: /* @__PURE__ */ __name((
|
|
20733
|
+
log: /* @__PURE__ */ __name((message, fields) => cliLogger().info(message, fields), "log"),
|
|
20697
20734
|
onSwept: /* @__PURE__ */ __name((report) => {
|
|
20698
20735
|
const lines = [
|
|
20699
20736
|
`Retired ${report.archived.length} ${report.archived.length === 1 ? "memory" : "memories"} that were not used. /memory restores ${report.archived.length === 1 ? "it" : "them"}.`
|
|
@@ -20724,21 +20761,34 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
20724
20761
|
let readHookMode;
|
|
20725
20762
|
let pluginRuntime;
|
|
20726
20763
|
try {
|
|
20727
|
-
pluginRuntime = await createCliPluginRuntime(
|
|
20728
|
-
|
|
20729
|
-
|
|
20730
|
-
|
|
20731
|
-
|
|
20732
|
-
|
|
20733
|
-
sessionId:
|
|
20734
|
-
|
|
20735
|
-
|
|
20736
|
-
|
|
20737
|
-
|
|
20738
|
-
|
|
20739
|
-
|
|
20740
|
-
|
|
20741
|
-
|
|
20764
|
+
pluginRuntime = await createCliPluginRuntime(
|
|
20765
|
+
options.plugins,
|
|
20766
|
+
cwd,
|
|
20767
|
+
options.hooks,
|
|
20768
|
+
{
|
|
20769
|
+
// Read at each event: a conversation cleared in place changes the id.
|
|
20770
|
+
sessionId: /* @__PURE__ */ __name(() => String(scope2.sessionId), "sessionId"),
|
|
20771
|
+
permissionMode: /* @__PURE__ */ __name(() => hookSessionMode(readHookMode?.(), options.permissionMode), "permissionMode"),
|
|
20772
|
+
transcriptPath: /* @__PURE__ */ __name((sessionId) => options.ephemeral ? void 0 : paths.sessionLog({ sessionId }), "transcriptPath"),
|
|
20773
|
+
// A `prompt` hook asks the small model, and its tokens count against the
|
|
20774
|
+
// turn it fired in. Outside a turn there is no ledger, so it is not asked.
|
|
20775
|
+
judge: /* @__PURE__ */ __name(async (request) => sideModel === void 0 || request.turnId === void 0 ? void 0 : sideModel.ask({
|
|
20776
|
+
sessionId: request.sessionId,
|
|
20777
|
+
turnId: request.turnId,
|
|
20778
|
+
instruction: request.instruction,
|
|
20779
|
+
body: request.body,
|
|
20780
|
+
maxTokens: 300,
|
|
20781
|
+
signal: request.signal,
|
|
20782
|
+
timing: "beside-turn"
|
|
20783
|
+
}), "judge")
|
|
20784
|
+
},
|
|
20785
|
+
{
|
|
20786
|
+
// The same switch plugin entries obey; none of the hooks attach under it.
|
|
20787
|
+
...options.hooksSwitch ? { hooksSwitch: options.hooksSwitch } : {},
|
|
20788
|
+
// A skill that carries hooks attaches them to this manager when it is used.
|
|
20789
|
+
keepForSkills: options.hooksSwitch === void 0 && (agentHookCarriers.length > 0 || skillCatalog.fileSkills.some((skill) => skill.hooksSource !== void 0))
|
|
20790
|
+
}
|
|
20791
|
+
);
|
|
20742
20792
|
} catch (error) {
|
|
20743
20793
|
await Promise.allSettled([mcp.close(), computerUseHost?.dispose(), browserControl?.dispose()]);
|
|
20744
20794
|
return emptySession(
|
|
@@ -20755,6 +20805,13 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
20755
20805
|
const withheldTools = new Set(options.withheldTools ?? []);
|
|
20756
20806
|
const webToolsWithheld = withheldTools.has("web_fetch") && withheldTools.has("web_search");
|
|
20757
20807
|
const sessionPlugins = pluginRuntime;
|
|
20808
|
+
const skillHooks = createSkillHooksHost({
|
|
20809
|
+
manager: /* @__PURE__ */ __name(() => sessionPlugins?.manager, "manager"),
|
|
20810
|
+
hookOptions: /* @__PURE__ */ __name(() => sessionPlugins?.hookOptions, "hookOptions"),
|
|
20811
|
+
hooksSwitch: /* @__PURE__ */ __name(() => options.hooksSwitch, "hooksSwitch"),
|
|
20812
|
+
projectTrusted: /* @__PURE__ */ __name(() => options.folderTrusted === true || isTrusted(cwd), "projectTrusted"),
|
|
20813
|
+
isProjectSkill: /* @__PURE__ */ __name((name) => skillCatalog.fileSkills.some((skill) => skill.name === name && skill.source === "project"), "isProjectSkill")
|
|
20814
|
+
});
|
|
20758
20815
|
const sessionToolsets = toolsets.flatMap((ts) => {
|
|
20759
20816
|
const wrapped = withheldTools.size > 0 ? filtered(ts, (tool) => !withheldTools.has(tool.name)) : ts;
|
|
20760
20817
|
return options.toolLoading === "deferred" ? deferExceptToolset(wrapped, EAGER_TOOLS_WHEN_DEFERRED) : [wrapped];
|
|
@@ -20801,7 +20858,8 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
20801
20858
|
const turnSkillsFor = /* @__PURE__ */ __name((turnModel) => skillCatalog.forTurn({
|
|
20802
20859
|
toolNames: liveManager().listNames(),
|
|
20803
20860
|
contextWindowTokens: resolveContextWindow(options.compaction?.contextWindowTokens, turnModel).tokens,
|
|
20804
|
-
...sessionPlugins ? { pluginSkills: sessionPlugins.skills } : {}
|
|
20861
|
+
...sessionPlugins ? { pluginSkills: sessionPlugins.skills } : {},
|
|
20862
|
+
skillHooks
|
|
20805
20863
|
}), "turnSkillsFor");
|
|
20806
20864
|
let lastSystemPromptText;
|
|
20807
20865
|
let sessionStarted = false;
|
|
@@ -20821,10 +20879,12 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
20821
20879
|
});
|
|
20822
20880
|
if (generation !== conversationGeneration) return;
|
|
20823
20881
|
sessionHookContext = sessionStartHookContext(results);
|
|
20882
|
+
sessionPlugins.hookActivity.absorbSessionStart(results);
|
|
20824
20883
|
}, "announceSessionStart");
|
|
20825
20884
|
const changeConversation = /* @__PURE__ */ __name((change) => {
|
|
20826
20885
|
if (!sessionPlugins) return Promise.resolve();
|
|
20827
20886
|
conversationGeneration += 1;
|
|
20887
|
+
skillHooks.endConversation();
|
|
20828
20888
|
sessionStarted = false;
|
|
20829
20889
|
sessionHookContext = void 0;
|
|
20830
20890
|
nextSessionSource = change.starting;
|
|
@@ -21490,9 +21550,9 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
21490
21550
|
})
|
|
21491
21551
|
);
|
|
21492
21552
|
}
|
|
21493
|
-
const at = /* @__PURE__ */ __name((
|
|
21494
|
-
if (!
|
|
21495
|
-
const found = messages.indexOf(
|
|
21553
|
+
const at = /* @__PURE__ */ __name((message, fallback) => {
|
|
21554
|
+
if (!message) return fallback;
|
|
21555
|
+
const found = messages.indexOf(message);
|
|
21496
21556
|
if (found < 0) {
|
|
21497
21557
|
throw new Error(
|
|
21498
21558
|
"That message is no longer in the active context. Choose a more recent message."
|
|
@@ -21559,7 +21619,31 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
21559
21619
|
stopJob: /* @__PURE__ */ __name((id) => ownedJobs.kill(id), "stopJob")
|
|
21560
21620
|
} : {},
|
|
21561
21621
|
...options.hooks ? { hooks: options.hooks } : {},
|
|
21622
|
+
skillHooks: {
|
|
21623
|
+
attached: /* @__PURE__ */ __name(() => skillHooks.attached(), "attached"),
|
|
21624
|
+
use: /* @__PURE__ */ __name((skill) => skillHooks.use(skill), "use"),
|
|
21625
|
+
subscribe: /* @__PURE__ */ __name((listener) => skillHooks.subscribe(listener), "subscribe"),
|
|
21626
|
+
carriers: /* @__PURE__ */ __name(() => skillCatalog.fileSkills.filter((skill) => skill.hooksSource !== void 0).map((skill) => skill.name), "carriers")
|
|
21627
|
+
},
|
|
21628
|
+
agentHooks: {
|
|
21629
|
+
attached: /* @__PURE__ */ __name(() => agentHooks.attached(), "attached"),
|
|
21630
|
+
subscribe: /* @__PURE__ */ __name((listener) => agentHooks.subscribe(listener), "subscribe"),
|
|
21631
|
+
carriers: /* @__PURE__ */ __name(() => agentHookCarriers, "carriers"),
|
|
21632
|
+
refused: /* @__PURE__ */ __name(() => refusedAgents.map((refused) => ({ name: refused.name, line: refused.line })), "refused")
|
|
21633
|
+
},
|
|
21562
21634
|
...pluginRuntime ? { pluginHooks: /* @__PURE__ */ __name(() => pluginRuntime?.pluginHooks() ?? [], "pluginHooks") } : {},
|
|
21635
|
+
...pluginRuntime ? {
|
|
21636
|
+
pluginHookEntries: /* @__PURE__ */ __name(() => pluginRuntime?.pluginHookEntries() ?? [], "pluginHookEntries"),
|
|
21637
|
+
pluginHookProblems: /* @__PURE__ */ __name(() => pluginRuntime?.pluginHookProblems() ?? [], "pluginHookProblems"),
|
|
21638
|
+
hookActivity: /* @__PURE__ */ __name(() => pluginRuntime.hookActivity.describe(), "hookActivity"),
|
|
21639
|
+
hookNotices: {
|
|
21640
|
+
subscribe: /* @__PURE__ */ __name((listener) => pluginRuntime.hookActivity.onNotice(listener), "subscribe")
|
|
21641
|
+
},
|
|
21642
|
+
worktreeHooks: {
|
|
21643
|
+
host: /* @__PURE__ */ __name(() => worktreeHookHost(pluginRuntime.manager, () => String(scope2.sessionId)), "host"),
|
|
21644
|
+
onNotice: /* @__PURE__ */ __name((line) => pluginRuntime.hookActivity.notify(line), "onNotice")
|
|
21645
|
+
}
|
|
21646
|
+
} : {},
|
|
21563
21647
|
checkpoints,
|
|
21564
21648
|
markFilesChanged: /* @__PURE__ */ __name(async (changed) => {
|
|
21565
21649
|
const seeded = fileObservations.get(scope2.sessionId);
|
|
@@ -21599,7 +21683,7 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
21599
21683
|
const live = host.registry.list();
|
|
21600
21684
|
const known = new Set(live.map((view) => view.runId));
|
|
21601
21685
|
const saved = options.ephemeral ? [] : await listWorkflowRuns(
|
|
21602
|
-
|
|
21686
|
+
join18(paths.sessionDir({ sessionId: scope2.sessionId }), "runs")
|
|
21603
21687
|
).catch(() => []);
|
|
21604
21688
|
return [
|
|
21605
21689
|
...[...live].sort((a, b) => b.startedAt - a.startedAt),
|
|
@@ -21609,14 +21693,14 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
21609
21693
|
readScript: /* @__PURE__ */ __name((path) => {
|
|
21610
21694
|
const saved = readSavedScript(
|
|
21611
21695
|
path,
|
|
21612
|
-
scriptsDirectory(
|
|
21696
|
+
scriptsDirectory(join18(paths.sessionDir({ sessionId: scope2.sessionId }), "runs"))
|
|
21613
21697
|
);
|
|
21614
21698
|
if (!saved.ok) return void 0;
|
|
21615
21699
|
reviewedScripts.record(saved.path, saved.text);
|
|
21616
21700
|
return saved.text;
|
|
21617
21701
|
}, "readScript"),
|
|
21618
21702
|
describeResume: /* @__PURE__ */ __name((runId, script) => describeResume(
|
|
21619
|
-
|
|
21703
|
+
join18(paths.sessionDir({ sessionId: scope2.sessionId }), "runs"),
|
|
21620
21704
|
runId,
|
|
21621
21705
|
script,
|
|
21622
21706
|
options.ephemeral ? void 0 : workflowJournalKey(paths.home)
|
|
@@ -21624,13 +21708,13 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
21624
21708
|
recoverUnfinished: /* @__PURE__ */ __name(async () => {
|
|
21625
21709
|
if (options.ephemeral) return [];
|
|
21626
21710
|
return recoverUnfinishedWorkflows({
|
|
21627
|
-
runsDirectory:
|
|
21711
|
+
runsDirectory: join18(paths.sessionDir({ sessionId: scope2.sessionId }), "runs"),
|
|
21628
21712
|
liveRunIds: new Set(host.registry.list().map((view) => view.runId)),
|
|
21629
21713
|
...workflowJournalKey(paths.home) !== void 0 ? { key: workflowJournalKey(paths.home) } : {}
|
|
21630
21714
|
});
|
|
21631
21715
|
}, "recoverUnfinished"),
|
|
21632
21716
|
noticesDelivered: /* @__PURE__ */ __name((runIds) => markOrphanNoticesDelivered(
|
|
21633
|
-
|
|
21717
|
+
join18(paths.sessionDir({ sessionId: scope2.sessionId }), "runs"),
|
|
21634
21718
|
runIds
|
|
21635
21719
|
), "noticesDelivered"),
|
|
21636
21720
|
onEnd: /* @__PURE__ */ __name((listener) => {
|
|
@@ -21667,7 +21751,7 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
21667
21751
|
onSubagentCompletion: /* @__PURE__ */ __name((listener) => subagentRuntime?.onBackgroundCompletion(listener) ?? (() => {
|
|
21668
21752
|
}), "onSubagentCompletion"),
|
|
21669
21753
|
stopSubagent: /* @__PURE__ */ __name((viewId) => subagentRuntime?.stopChild(viewId) ?? false, "stopSubagent"),
|
|
21670
|
-
messageSubagent: /* @__PURE__ */ __name((viewId,
|
|
21754
|
+
messageSubagent: /* @__PURE__ */ __name((viewId, message, opts) => operations.promise(opts?.signal, async (signal) => {
|
|
21671
21755
|
const runtime = subagentRuntime;
|
|
21672
21756
|
if (!runtime) throw new Error("Delegation is unavailable.");
|
|
21673
21757
|
const turnScope = { ...scope2 };
|
|
@@ -21722,7 +21806,7 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
21722
21806
|
signal.throwIfAborted();
|
|
21723
21807
|
if (scope2.sessionId !== turnScope.sessionId)
|
|
21724
21808
|
throw new Error("The parent conversation changed before admission.");
|
|
21725
|
-
const receipt = await runtime.messageChild(viewId,
|
|
21809
|
+
const receipt = await runtime.messageChild(viewId, message, turnId, signal);
|
|
21726
21810
|
if (receipt.kind === "started") {
|
|
21727
21811
|
const gateway = await runtime.gatewayForTurn(turnId);
|
|
21728
21812
|
const cancel = /* @__PURE__ */ __name(() => gateway.cancelTask(asTaskId(receipt.taskId), "user"), "cancel");
|
|
@@ -21866,6 +21950,7 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
21866
21950
|
),
|
|
21867
21951
|
...fallbackPlan.notices,
|
|
21868
21952
|
...takeConfigWarnings(),
|
|
21953
|
+
...pluginRuntime?.takePluginHookWarnings() ?? [],
|
|
21869
21954
|
...compatibleEndpointNotices(),
|
|
21870
21955
|
...memoryMigrationNotices,
|
|
21871
21956
|
...computerUseNotices
|
|
@@ -22155,7 +22240,7 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
22155
22240
|
);
|
|
22156
22241
|
lastSystemPromptText = systemPrompt;
|
|
22157
22242
|
await announceSessionStart(
|
|
22158
|
-
messages.filter((
|
|
22243
|
+
messages.filter((message) => message.role === "user").length > 1 ? "resume" : "startup"
|
|
22159
22244
|
);
|
|
22160
22245
|
if (sessionHookContext !== void 0) {
|
|
22161
22246
|
const hookContext = frameOperatorHookContext([sessionHookContext]);
|
|
@@ -22330,6 +22415,7 @@ async function createAgentSession(prefs, detectedProviders, options = {}) {
|
|
|
22330
22415
|
toolsets: runToolsets,
|
|
22331
22416
|
...screensConfig !== void 0 ? { toolResultGuardrails: screensConfig } : {},
|
|
22332
22417
|
pluginManager: pluginRuntime?.manager,
|
|
22418
|
+
hookActivity: pluginRuntime?.hookActivity,
|
|
22333
22419
|
skillRegistry: turnSkills.registry,
|
|
22334
22420
|
// The skill list is announced through the reminders, so a skill added
|
|
22335
22421
|
// mid-session leaves the cached prefix alone.
|
|
@@ -22968,6 +23054,7 @@ async function* runTurn({
|
|
|
22968
23054
|
toolsets,
|
|
22969
23055
|
toolResultGuardrails,
|
|
22970
23056
|
pluginManager,
|
|
23057
|
+
hookActivity,
|
|
22971
23058
|
skillRegistry,
|
|
22972
23059
|
skills,
|
|
22973
23060
|
scope: scope2,
|
|
@@ -23047,6 +23134,10 @@ async function* runTurn({
|
|
|
23047
23134
|
toolsets,
|
|
23048
23135
|
...toolResultGuardrails !== void 0 ? { toolResultGuardrails } : {},
|
|
23049
23136
|
...pluginManager ? { pluginManager } : {},
|
|
23137
|
+
...hookActivity ? {
|
|
23138
|
+
// Told once per real change of the shell's folder, before the next command.
|
|
23139
|
+
onWorkingDirectoryChange: /* @__PURE__ */ __name((change) => hookActivity.changeDirectory(change), "onWorkingDirectoryChange")
|
|
23140
|
+
} : {},
|
|
23050
23141
|
...skillRegistry ? { skillRegistry } : {},
|
|
23051
23142
|
...skills ? { skills } : {},
|
|
23052
23143
|
// Withheld at both provider and executor boundaries on every ordinary
|
|
@@ -23083,6 +23174,9 @@ async function* runTurn({
|
|
|
23083
23174
|
...opts?.effort !== void 0 ? { effort: opts.effort } : {},
|
|
23084
23175
|
...opts?.speed === "fast" ? { speed: opts.speed } : {},
|
|
23085
23176
|
...webSearch ? { webSearch } : {},
|
|
23177
|
+
// The variables hooks set for this session's commands: one live object,
|
|
23178
|
+
// read at each command, so a hook that sets one mid-session is heard.
|
|
23179
|
+
...hookActivity ? { env: hookActivity.variables } : {},
|
|
23086
23180
|
...turnConfigFields(resolveTurnGuards(limits), {
|
|
23087
23181
|
completionAudit: true,
|
|
23088
23182
|
detectChanges: changeDetectorFor(workingDirectory, {
|
|
@@ -24038,7 +24132,6 @@ export {
|
|
|
24038
24132
|
describePendingWorkflowNotices,
|
|
24039
24133
|
thirdPartyHost,
|
|
24040
24134
|
sessionLogCheckpointView,
|
|
24041
|
-
discoverAgentDefinitions2 as discoverAgentDefinitions,
|
|
24042
24135
|
DEFAULT_AGENT_WORKFLOW,
|
|
24043
24136
|
DEFAULT_AGENT_PHASE,
|
|
24044
24137
|
readMemory,
|
|
@@ -24116,4 +24209,4 @@ export {
|
|
|
24116
24209
|
RESULT_SUMMARY_WHOLE_MAX,
|
|
24117
24210
|
resultSummaryLine
|
|
24118
24211
|
};
|
|
24119
|
-
//# sourceMappingURL=chunk-
|
|
24212
|
+
//# sourceMappingURL=chunk-F3GGSHY2.js.map
|