@namzu/cli 41.2.1 → 42.0.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 +99 -0
- package/dist/bin-main.d.ts.map +1 -1
- package/dist/bin.js +1 -1
- package/dist/chunks/{acp-MCDCWJ45.js → acp-ADQ2PRAY.js} +48 -48
- package/dist/chunks/{activity-command-AYLW5EEX.js → activity-command-JROQLBPA.js} +14 -15
- package/dist/chunks/activity-command-JROQLBPA.js.map +6 -0
- package/dist/chunks/{add-VNM5QPTX.js → add-ILLLF6YP.js} +25 -25
- package/dist/chunks/{agent-4IMOBJR5.js → agent-YQI5KOPV.js} +34 -35
- package/dist/chunks/agent-session-3MUZCWQ4.js +58 -0
- package/dist/chunks/{archive-VXJWPZBA.js → archive-55KJKGJB.js} +11 -11
- package/dist/chunks/{bin-main-BMCDNDGC.js → bin-main-332F5KRZ.js} +13 -6
- package/dist/chunks/{bin-main-BMCDNDGC.js.map → bin-main-332F5KRZ.js.map} +1 -1
- package/dist/chunks/{browser-7MVCQL2G.js → browser-C6AOJ3CH.js} +6 -6
- package/dist/chunks/{chat-M2WFCRYV.js → chat-45H5F3KI.js} +16 -16
- package/dist/chunks/{chunk-X4BCXODL.js → chunk-23NRJ2RC.js} +5 -5
- package/dist/chunks/chunk-27R3OTVS.js +14 -0
- package/dist/chunks/chunk-27R3OTVS.js.map +6 -0
- package/dist/chunks/{chunk-LFI6O7WL.js → chunk-2OVZNENW.js} +43 -2
- package/dist/chunks/chunk-2OVZNENW.js.map +6 -0
- package/dist/chunks/{chunk-WYUJ4USW.js → chunk-35VTE7V5.js} +2 -2
- package/dist/chunks/chunk-3F3V2PB7.js +56 -0
- package/dist/chunks/chunk-3F3V2PB7.js.map +6 -0
- package/dist/chunks/{chunk-HV7PRPHJ.js → chunk-3LNTQLQ4.js} +14 -14
- package/dist/chunks/{chunk-VD4D37MT.js → chunk-4IIEEOCA.js} +66 -6
- package/dist/chunks/chunk-4IIEEOCA.js.map +6 -0
- package/dist/chunks/{chunk-F2UUHEPY.js → chunk-4NO5XFK2.js} +2 -2
- package/dist/chunks/chunk-4TS6ZPOZ.js +363 -0
- package/dist/chunks/chunk-4TS6ZPOZ.js.map +6 -0
- package/dist/chunks/{chunk-TZDYMWYP.js → chunk-5XWMKWQQ.js} +65 -5
- package/dist/chunks/chunk-5XWMKWQQ.js.map +6 -0
- package/dist/chunks/{chunk-DAJBZ4B7.js → chunk-6GBZAUYW.js} +2 -2
- package/dist/chunks/{chunk-KTF5NW2V.js → chunk-6LVWHXT6.js} +10 -15
- package/dist/chunks/chunk-6LVWHXT6.js.map +6 -0
- package/dist/chunks/{chunk-5LGZUFDJ.js → chunk-6PNBIMWH.js} +3 -3
- package/dist/chunks/{chunk-XSAS6TS2.js → chunk-6S4R2USK.js} +3 -3
- package/dist/chunks/{chunk-6FSVNUBA.js → chunk-7E3V7NNN.js} +2943 -1961
- package/dist/chunks/chunk-7E3V7NNN.js.map +6 -0
- package/dist/chunks/{chunk-EYBTANG5.js → chunk-A3AF5WXZ.js} +6 -6
- package/dist/chunks/{chunk-AGRFKHS2.js → chunk-A4CKLHKM.js} +4 -4
- package/dist/chunks/{chunk-MCUV6EI7.js → chunk-AZPS37AQ.js} +2 -2
- package/dist/chunks/{chunk-TSKCIC5T.js → chunk-BDLDDNNO.js} +37 -6
- package/dist/chunks/chunk-BDLDDNNO.js.map +6 -0
- package/dist/chunks/{chunk-2LLNCAZS.js → chunk-BRKD6FMO.js} +2 -2
- package/dist/chunks/{chunk-PXEHKMLO.js → chunk-CW2N2QS2.js} +4 -4
- package/dist/chunks/{chunk-2Q6PBTPY.js → chunk-DLL2FPUY.js} +2 -2
- package/dist/chunks/{chunk-5XWYY63Z.js → chunk-ESZ7X37S.js} +4 -4
- package/dist/chunks/{chunk-VHXXNM6W.js → chunk-EWSIGY2A.js} +4 -4
- package/dist/chunks/{chunk-DTNJTMWP.js → chunk-F6WVRMVY.js} +1032 -328
- package/dist/chunks/chunk-F6WVRMVY.js.map +6 -0
- package/dist/chunks/{chunk-L2MEW4AZ.js → chunk-FMEGRBJP.js} +2 -2
- package/dist/chunks/{chunk-IBUFD2HH.js → chunk-FSKJ3EZC.js} +2 -2
- package/dist/chunks/chunk-G5RAECIB.js +144 -0
- package/dist/chunks/chunk-G5RAECIB.js.map +6 -0
- package/dist/chunks/{chunk-HWAPKOAW.js → chunk-GOGBOZKO.js} +666 -27
- package/dist/chunks/chunk-GOGBOZKO.js.map +6 -0
- package/dist/chunks/chunk-HO2ZUI5Y.js +1189 -0
- package/dist/chunks/chunk-HO2ZUI5Y.js.map +6 -0
- package/dist/chunks/{chunk-YBOKKRHB.js → chunk-HOIDWHGC.js} +6 -6
- package/dist/chunks/{chunk-IBCA2WDM.js → chunk-HOY7BUGW.js} +3 -3
- package/dist/chunks/{chunk-5L7ZQ37R.js → chunk-HQZ3GBQI.js} +7 -7
- package/dist/chunks/{chunk-G7JH3PMC.js → chunk-HXAWIWOZ.js} +2 -2
- package/dist/chunks/{chunk-Z2WGX7UM.js → chunk-IQQ6TY4W.js} +3 -3
- package/dist/chunks/{chunk-UHDKUVR5.js → chunk-J4IES4SO.js} +5 -5
- package/dist/chunks/{chunk-UHDKUVR5.js.map → chunk-J4IES4SO.js.map} +1 -1
- package/dist/chunks/{chunk-N457UJQL.js → chunk-JD2HLKFO.js} +2 -2
- package/dist/chunks/chunk-JHDNGNQT.js +95 -0
- package/dist/chunks/chunk-JHDNGNQT.js.map +6 -0
- package/dist/chunks/{chunk-H6B6AROX.js → chunk-JQIBPPOL.js} +69 -46
- package/dist/chunks/chunk-JQIBPPOL.js.map +6 -0
- package/dist/chunks/{chunk-TIFSH2BH.js → chunk-JXT47VT6.js} +113 -35
- package/dist/chunks/chunk-JXT47VT6.js.map +6 -0
- package/dist/chunks/{chunk-7A5TVBGS.js → chunk-K6LLMOB2.js} +2 -2
- package/dist/chunks/{chunk-EUBCYTOK.js → chunk-KONYGNG6.js} +152 -3
- package/dist/chunks/chunk-KONYGNG6.js.map +6 -0
- package/dist/chunks/{chunk-C4CVM56Z.js → chunk-L3QW53QL.js} +223 -247
- package/dist/chunks/chunk-L3QW53QL.js.map +6 -0
- package/dist/chunks/{chunk-KEKFOEEP.js → chunk-M46GKTOI.js} +2 -2
- package/dist/chunks/{chunk-O3CIRAYD.js → chunk-N3C5X6BW.js} +6 -6
- package/dist/chunks/chunk-N4OY22M2.js +256 -0
- package/dist/chunks/chunk-N4OY22M2.js.map +6 -0
- package/dist/chunks/{chunk-DAUWDTZI.js → chunk-N56FVHCU.js} +26 -2
- package/dist/chunks/chunk-N56FVHCU.js.map +6 -0
- package/dist/chunks/chunk-PCUMISO3.js +92 -0
- package/dist/chunks/chunk-PCUMISO3.js.map +6 -0
- package/dist/chunks/{chunk-RPKRLR3O.js → chunk-QRGO6R2O.js} +12 -6
- package/dist/chunks/chunk-QRGO6R2O.js.map +6 -0
- package/dist/chunks/{chunk-IMFIQJM6.js → chunk-QT6KYBCC.js} +3 -3
- package/dist/chunks/{chunk-QYA34YM5.js → chunk-QUELENQP.js} +4 -4
- package/dist/chunks/{chunk-ZPNX25RU.js → chunk-QWBR6FBY.js} +89 -20
- package/dist/chunks/chunk-QWBR6FBY.js.map +6 -0
- package/dist/chunks/{chunk-RI57PEYF.js → chunk-R2LYGFCI.js} +4 -4
- package/dist/chunks/{chunk-AYCKJIVD.js → chunk-RGVJHSMU.js} +5 -5
- package/dist/chunks/{chunk-MSKJK6NZ.js → chunk-RVSVVL6O.js} +3 -3
- package/dist/chunks/{chunk-PWGJB2WA.js → chunk-S4KDR6G5.js} +53 -6
- package/dist/chunks/chunk-S4KDR6G5.js.map +6 -0
- package/dist/chunks/chunk-SIG7WHBU.js +78 -0
- package/dist/chunks/chunk-SIG7WHBU.js.map +6 -0
- package/dist/chunks/{chunk-H3ALHXFV.js → chunk-SIWZZF4M.js} +15 -15
- package/dist/chunks/{chunk-GD6LOX4A.js → chunk-SNC5D5UG.js} +18 -18
- package/dist/chunks/{chunk-KDZ6GM2A.js → chunk-SRYIMLOK.js} +2 -2
- package/dist/chunks/{chunk-IQBKDY6G.js → chunk-TW5BCDA5.js} +3 -3
- package/dist/chunks/{chunk-DVRRRNSA.js → chunk-URJ7TITR.js} +8 -8
- package/dist/chunks/{chunk-Y37JJJVY.js → chunk-W2PJ6ZHY.js} +12 -44
- package/dist/chunks/chunk-W2PJ6ZHY.js.map +6 -0
- package/dist/chunks/{chunk-O7VKAFEU.js → chunk-WHOSI6UQ.js} +2 -2
- package/dist/chunks/{chunk-AVSE45ED.js → chunk-XCMCPWMB.js} +4 -4
- package/dist/chunks/{chunk-KGKRKFB7.js → chunk-XGVCAMNT.js} +2 -2
- package/dist/chunks/{chunk-YZW6H2LD.js → chunk-XMOKHCPV.js} +116 -40
- package/dist/chunks/chunk-XMOKHCPV.js.map +6 -0
- package/dist/chunks/{chunk-LETTT4ZZ.js → chunk-XXUL6HHM.js} +2 -2
- package/dist/chunks/{chunk-7RBZS3TN.js → chunk-Y2DZ27P6.js} +4 -4
- package/dist/chunks/{chunk-QWFD2LFU.js → chunk-Y3I7AAD6.js} +4 -4
- package/dist/chunks/{chunk-3ZMECJLN.js → chunk-Y74CPWYC.js} +13 -13
- package/dist/chunks/chunk-YM4DUQ3P.js +59 -0
- package/dist/chunks/chunk-YM4DUQ3P.js.map +6 -0
- package/dist/chunks/{chunk-LRDLJTYP.js → chunk-YP7AINGL.js} +9 -9
- package/dist/chunks/{chunk-YAOKLAUU.js → chunk-YPHXWFKQ.js} +2 -2
- package/dist/chunks/{chunk-4I5FGMVR.js → chunk-YVIM3MXU.js} +2 -2
- package/dist/chunks/{cli-runtime-Q6BW37I2.js → cli-runtime-HW6GQKC6.js} +23 -20
- package/dist/chunks/cli-runtime-HW6GQKC6.js.map +6 -0
- package/dist/chunks/{commands-C5I7PC7W.js → commands-JZT6JJY5.js} +5 -5
- package/dist/chunks/{crash-report-DRT5OCHO.js → crash-report-TWMWHNKY.js} +9 -7
- package/dist/chunks/{dist-PRTI23W3.js → dist-4EGZFRWY.js} +12 -2
- package/dist/chunks/dist-4EGZFRWY.js.map +6 -0
- package/dist/chunks/{dist-VJC5RCYZ.js → dist-6ORFQIRV.js} +7 -2
- package/dist/chunks/{dist-VJC5RCYZ.js.map → dist-6ORFQIRV.js.map} +1 -1
- package/dist/chunks/{dist-5JM4UMVC.js → dist-AZ5T257L.js} +22 -2
- package/dist/chunks/dist-AZ5T257L.js.map +6 -0
- package/dist/chunks/{dist-D7WSQBE7.js → dist-CLKFY67B.js} +8 -4
- package/dist/chunks/{dist-D7WSQBE7.js.map → dist-CLKFY67B.js.map} +1 -1
- package/dist/chunks/{dist-WO56PFGZ.js → dist-K5JIOWIQ.js} +8 -3
- package/dist/chunks/dist-K5JIOWIQ.js.map +6 -0
- package/dist/chunks/{dist-T2N57REG.js → dist-MVLQAON2.js} +12 -2
- package/dist/chunks/{dist-T2N57REG.js.map → dist-MVLQAON2.js.map} +1 -1
- package/dist/chunks/{dist-2NWJAAJM.js → dist-POSMI3PI.js} +18 -4
- package/dist/chunks/{dist-2NWJAAJM.js.map → dist-POSMI3PI.js.map} +1 -1
- package/dist/chunks/{doctor-HXKU6QKJ.js → doctor-UVZBNUNF.js} +15 -9
- package/dist/chunks/{drain-MLRRMEGK.js → drain-27E6XUNK.js} +11 -10
- package/dist/chunks/drain-27E6XUNK.js.map +6 -0
- package/dist/chunks/{eval-ECOECG74.js → eval-NRRIWDET.js} +2 -2
- package/dist/chunks/{exec-JLB6F5ZR.js → exec-KX46LZ36.js} +159 -62
- package/dist/chunks/exec-KX46LZ36.js.map +6 -0
- package/dist/chunks/{home-G65CC45B.js → home-RT2I6VTQ.js} +3 -3
- package/dist/chunks/{host-queries-7LKGEBO5.js → host-queries-ZXGOA6ZL.js} +23 -17
- package/dist/chunks/host-queries-ZXGOA6ZL.js.map +6 -0
- package/dist/chunks/install-LVQAT4QP.js +15 -0
- package/dist/chunks/{learn-NRY6X2K6.js → learn-5KKZ4ZFX.js} +15 -14
- package/dist/chunks/learn-5KKZ4ZFX.js.map +6 -0
- package/dist/chunks/{learn-builtin-QOM4KLT2.js → learn-builtin-MSUF4MEJ.js} +18 -17
- package/dist/chunks/learn-builtin-MSUF4MEJ.js.map +6 -0
- package/dist/chunks/{lifecycle-BI2PMV4Q.js → lifecycle-TZU6D46R.js} +29 -30
- package/dist/chunks/{list-QTWALT6F.js → list-QCWNMQED.js} +23 -23
- package/dist/chunks/live-V7HRF5KR.js +34 -0
- package/dist/chunks/{login-7LJG7D3F.js → login-QFP3PIXG.js} +8 -8
- package/dist/chunks/{logs-UGMCEFAZ.js → logs-XTXMS4JF.js} +4 -4
- package/dist/chunks/{mcp-KOZOXU6J.js → mcp-WQFJJ4NO.js} +81 -23
- package/dist/chunks/mcp-WQFJJ4NO.js.map +6 -0
- package/dist/chunks/{message-command-7B5OFSGL.js → message-command-QVNUJN47.js} +40 -41
- package/dist/chunks/message-command-QVNUJN47.js.map +6 -0
- package/dist/chunks/{operator-tools-PWBZHKXO.js → operator-tools-2OYRNPCH.js} +14 -14
- package/dist/chunks/{output-schema-QPHXNRKI.js → output-schema-ETVPLUXE.js} +3 -3
- package/dist/chunks/{pal-XSD45IR6.js → pal-BYFZCLE2.js} +12 -13
- package/dist/chunks/pal-BYFZCLE2.js.map +6 -0
- package/dist/chunks/plain-report-73WHPLHX.js +146 -0
- package/dist/chunks/plain-report-73WHPLHX.js.map +6 -0
- package/dist/chunks/{providers-ULPGYRWC.js → providers-KP5JHTTK.js} +6 -6
- package/dist/chunks/{resident-NY7XSEK7.js → resident-BROBTK35.js} +35 -32
- package/dist/chunks/resident-BROBTK35.js.map +6 -0
- package/dist/chunks/resume-7V44GSEU.js +23 -0
- package/dist/chunks/{resume-command-DLOW7MYW.js → resume-command-OKJ2MJPB.js} +4 -4
- package/dist/chunks/{schedule-QR7JOA4F.js → schedule-TVR3FE32.js} +8 -8
- package/dist/chunks/{service-CLLR5VUD.js → service-6A3TOQKV.js} +35 -36
- package/dist/chunks/service-6A3TOQKV.js.map +6 -0
- package/dist/chunks/session-step-N4GHA2YE.js +33 -0
- package/dist/chunks/{skills-OZZLTH6P.js → skills-WXYSPDKL.js} +9 -8
- package/dist/chunks/skills-WXYSPDKL.js.map +6 -0
- package/dist/chunks/start-check-BUCN5MCU.js +12 -0
- package/dist/chunks/{state-EROTPJRH.js → state-PVAVIXHK.js} +3 -3
- package/dist/chunks/{store-C24DXKO4.js → store-D3XUEEAF.js} +6 -6
- package/dist/chunks/store-D3XUEEAF.js.map +6 -0
- package/dist/chunks/{store-VDQRT2KF.js → store-NB3KR4XA.js} +15 -11
- package/dist/chunks/store-NB3KR4XA.js.map +6 -0
- package/dist/chunks/{store-ROEYUKBM.js → store-O3KC2PPZ.js} +4 -4
- package/dist/chunks/store-O3KC2PPZ.js.map +6 -0
- package/dist/chunks/{tui-XBQCRSIJ.js → tui-2XOSCALL.js} +788 -217
- package/dist/chunks/tui-2XOSCALL.js.map +6 -0
- package/dist/chunks/undici-LWANNIOV.js +26906 -0
- package/dist/chunks/undici-LWANNIOV.js.map +6 -0
- package/dist/chunks/upgrade-FY5ULZQF.js +456 -0
- package/dist/chunks/upgrade-FY5ULZQF.js.map +6 -0
- package/dist/chunks/{worktree-XMJ355ND.js → worktree-MVW62U5G.js} +13 -13
- package/dist/cli-runtime.d.ts +1 -0
- package/dist/cli-runtime.d.ts.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/commands/append-system.d.ts +19 -0
- package/dist/commands/append-system.d.ts.map +1 -0
- package/dist/commands/desktop-host.d.ts +6 -0
- package/dist/commands/desktop-host.d.ts.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/exec-flags.d.ts +33 -0
- package/dist/commands/exec-flags.d.ts.map +1 -1
- package/dist/commands/exec-json.d.ts +6 -0
- package/dist/commands/exec-json.d.ts.map +1 -1
- package/dist/commands/exec.d.ts +4 -2
- package/dist/commands/exec.d.ts.map +1 -1
- package/dist/commands/host-queries.d.ts.map +1 -1
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/resident-flags.d.ts.map +1 -1
- package/dist/commands/run-flags.d.ts +32 -0
- package/dist/commands/run-flags.d.ts.map +1 -0
- package/dist/commands/upgrade.d.ts +23 -25
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/config/load.d.ts +20 -1
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/schema.d.ts +36 -1
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/turn-guards.d.ts +3 -0
- package/dist/config/turn-guards.d.ts.map +1 -1
- package/dist/context/instruction-glob.d.ts +5 -0
- package/dist/context/instruction-glob.d.ts.map +1 -0
- package/dist/context/instruction-scope.d.ts +78 -0
- package/dist/context/instruction-scope.d.ts.map +1 -0
- package/dist/context/project-tracker.d.ts +10 -1
- package/dist/context/project-tracker.d.ts.map +1 -1
- package/dist/context/project.d.ts +46 -2
- package/dist/context/project.d.ts.map +1 -1
- package/dist/context/runtime-message.d.ts +8 -1
- package/dist/context/runtime-message.d.ts.map +1 -1
- package/dist/context/turn-snapshot.d.ts +26 -8
- package/dist/context/turn-snapshot.d.ts.map +1 -1
- package/dist/doctor/checks/cache-lifetime.d.ts +19 -0
- package/dist/doctor/checks/cache-lifetime.d.ts.map +1 -0
- package/dist/doctor/checks/index.d.ts +3 -1
- package/dist/doctor/checks/index.d.ts.map +1 -1
- package/dist/doctor/checks/network.d.ts +15 -0
- package/dist/doctor/checks/network.d.ts.map +1 -0
- package/dist/doctor/checks/updates.d.ts +6 -0
- package/dist/doctor/checks/updates.d.ts.map +1 -0
- package/dist/doctor/live.d.ts +15 -0
- package/dist/doctor/live.d.ts.map +1 -0
- package/dist/doctor/plain-report.d.ts +19 -0
- package/dist/doctor/plain-report.d.ts.map +1 -0
- package/dist/index.js +38 -32
- package/dist/integrations/auto-update/apply.d.ts +193 -0
- package/dist/integrations/auto-update/apply.d.ts.map +1 -0
- package/dist/integrations/auto-update/download.d.ts +35 -0
- package/dist/integrations/auto-update/download.d.ts.map +1 -0
- package/dist/integrations/auto-update/install-kind.d.ts +55 -0
- package/dist/integrations/auto-update/install-kind.d.ts.map +1 -0
- package/dist/integrations/auto-update/installed-version.d.ts +3 -0
- package/dist/integrations/auto-update/installed-version.d.ts.map +1 -0
- package/dist/integrations/auto-update/policy.d.ts +28 -0
- package/dist/integrations/auto-update/policy.d.ts.map +1 -0
- package/dist/integrations/auto-update/start-check.d.ts +21 -0
- package/dist/integrations/auto-update/start-check.d.ts.map +1 -0
- package/dist/integrations/auto-update/start.d.ts +25 -0
- package/dist/integrations/auto-update/start.d.ts.map +1 -0
- package/dist/integrations/auto-update/state.d.ts +109 -0
- package/dist/integrations/auto-update/state.d.ts.map +1 -0
- package/dist/integrations/auto-update/status.d.ts +37 -0
- package/dist/integrations/auto-update/status.d.ts.map +1 -0
- package/dist/integrations/auto-update/updater.d.ts +79 -0
- package/dist/integrations/auto-update/updater.d.ts.map +1 -0
- package/dist/integrations/mcp/project-approval.d.ts +41 -0
- package/dist/integrations/mcp/project-approval.d.ts.map +1 -0
- package/dist/integrations/mcp/shared-file.d.ts +36 -0
- package/dist/integrations/mcp/shared-file.d.ts.map +1 -0
- package/dist/integrations/npm-global.d.ts +40 -0
- package/dist/integrations/npm-global.d.ts.map +1 -0
- package/dist/integrations/plugins/hook-host.d.ts +18 -0
- package/dist/integrations/plugins/hook-host.d.ts.map +1 -0
- package/dist/integrations/plugins/runtime.d.ts +4 -2
- package/dist/integrations/plugins/runtime.d.ts.map +1 -1
- package/dist/integrations/providers/fallback-flag.d.ts +29 -0
- package/dist/integrations/providers/fallback-flag.d.ts.map +1 -0
- package/dist/integrations/providers/prompt-cache-ttl.d.ts +3 -0
- package/dist/integrations/providers/prompt-cache-ttl.d.ts.map +1 -1
- package/dist/integrations/resident/runner-worker.js +32 -25
- package/dist/integrations/resident/runner-worker.js.map +1 -1
- package/dist/integrations/sessions/conversation-search.d.ts +1 -1
- package/dist/integrations/sessions/conversation-search.d.ts.map +1 -1
- package/dist/integrations/sessions/evidence-recall.d.ts +1 -1
- package/dist/integrations/sessions/evidence-recall.d.ts.map +1 -1
- package/dist/integrations/sessions/store.d.ts +23 -0
- package/dist/integrations/sessions/store.d.ts.map +1 -1
- package/dist/integrations/subagents/runtime.d.ts +8 -2
- package/dist/integrations/subagents/runtime.d.ts.map +1 -1
- package/dist/integrations/subagents/saved-agents.d.ts +12 -3
- package/dist/integrations/subagents/saved-agents.d.ts.map +1 -1
- package/dist/integrations/trust/folder-grants.d.ts +12 -1
- package/dist/integrations/trust/folder-grants.d.ts.map +1 -1
- package/dist/integrations/updates.d.ts +15 -1
- package/dist/integrations/updates.d.ts.map +1 -1
- package/dist/network/install.d.ts +38 -0
- package/dist/network/install.d.ts.map +1 -0
- package/dist/network/settings.d.ts +50 -0
- package/dist/network/settings.d.ts.map +1 -0
- package/dist/pals/agent-session.d.ts.map +1 -1
- package/dist/permissions/mode.d.ts +3 -1
- package/dist/permissions/mode.d.ts.map +1 -1
- package/dist/permissions/read-only-gate.d.ts +28 -0
- package/dist/permissions/read-only-gate.d.ts.map +1 -0
- package/dist/permissions/sandbox-shell.d.ts +37 -0
- package/dist/permissions/sandbox-shell.d.ts.map +1 -0
- package/dist/permissions/tool-flags.d.ts +36 -0
- package/dist/permissions/tool-flags.d.ts.map +1 -0
- package/dist/plan/approval.d.ts +1 -0
- package/dist/plan/approval.d.ts.map +1 -1
- package/dist/plan/enter-plan-mode-tool.d.ts +28 -0
- package/dist/plan/enter-plan-mode-tool.d.ts.map +1 -0
- package/dist/plan/plan-file.d.ts +8 -0
- package/dist/plan/plan-file.d.ts.map +1 -1
- package/dist/reminders/task-nudge.d.ts +9 -1
- package/dist/reminders/task-nudge.d.ts.map +1 -1
- package/dist/skills/store.d.ts +6 -0
- package/dist/skills/store.d.ts.map +1 -1
- package/dist/tui/App.d.ts +1 -1
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/Checklist.d.ts +2 -0
- package/dist/tui/Checklist.d.ts.map +1 -1
- package/dist/tui/Composer.d.ts +7 -1
- package/dist/tui/Composer.d.ts.map +1 -1
- package/dist/tui/ContextGridRow.d.ts.map +1 -1
- package/dist/tui/LiveActivity.d.ts +2 -0
- package/dist/tui/LiveActivity.d.ts.map +1 -1
- package/dist/tui/ResumePicker.d.ts +10 -1
- package/dist/tui/ResumePicker.d.ts.map +1 -1
- package/dist/tui/StatusBar.d.ts +7 -1
- package/dist/tui/StatusBar.d.ts.map +1 -1
- package/dist/tui/TrustPrompt.d.ts +2 -0
- package/dist/tui/TrustPrompt.d.ts.map +1 -1
- package/dist/tui/agent.d.ts +31 -1
- package/dist/tui/agent.d.ts.map +1 -1
- package/dist/tui/capability-notice.d.ts +11 -1
- package/dist/tui/capability-notice.d.ts.map +1 -1
- package/dist/tui/context-grid.d.ts +7 -0
- package/dist/tui/context-grid.d.ts.map +1 -1
- package/dist/tui/context-usage.d.ts +4 -0
- package/dist/tui/context-usage.d.ts.map +1 -1
- package/dist/tui/conversation-in-use.d.ts +18 -0
- package/dist/tui/conversation-in-use.d.ts.map +1 -0
- package/dist/tui/foreground-handoff.d.ts +15 -0
- package/dist/tui/foreground-handoff.d.ts.map +1 -0
- package/dist/tui/launch-settings.d.ts +6 -3
- package/dist/tui/launch-settings.d.ts.map +1 -1
- package/dist/tui/pause-auto-resume.d.ts +33 -0
- package/dist/tui/pause-auto-resume.d.ts.map +1 -0
- package/dist/tui/permission-review.d.ts.map +1 -1
- package/dist/tui/plain-interruption.d.ts +8 -0
- package/dist/tui/plain-interruption.d.ts.map +1 -1
- package/dist/tui/restored-rows.d.ts +4 -0
- package/dist/tui/restored-rows.d.ts.map +1 -1
- package/dist/tui/resume-picker-state.d.ts +40 -0
- package/dist/tui/resume-picker-state.d.ts.map +1 -0
- package/dist/tui/slashCommands.d.ts +12 -1
- package/dist/tui/slashCommands.d.ts.map +1 -1
- package/dist/tui/system-rows.d.ts +3 -0
- package/dist/tui/system-rows.d.ts.map +1 -1
- package/dist/tui/tidy-tool-output.d.ts +2 -0
- package/dist/tui/tidy-tool-output.d.ts.map +1 -1
- package/dist/tui/turn-interruption.d.ts +2 -0
- package/dist/tui/turn-interruption.d.ts.map +1 -1
- package/dist/tui/types.d.ts +10 -1
- package/dist/tui/types.d.ts.map +1 -1
- package/dist/tui/update-notice.d.ts +13 -0
- package/dist/tui/update-notice.d.ts.map +1 -1
- package/dist/tui/working-label.d.ts +9 -0
- package/dist/tui/working-label.d.ts.map +1 -0
- package/dist/tui/zen-free-refusal.d.ts +12 -0
- package/dist/tui/zen-free-refusal.d.ts.map +1 -1
- package/dist/user-commands/store.d.ts +30 -1
- package/dist/user-commands/store.d.ts.map +1 -1
- package/package.json +11 -10
- package/dist/chunks/activity-command-AYLW5EEX.js.map +0 -6
- package/dist/chunks/agent-session-44AYNTQJ.js +0 -59
- package/dist/chunks/chunk-6FSVNUBA.js.map +0 -6
- package/dist/chunks/chunk-C4CVM56Z.js.map +0 -6
- package/dist/chunks/chunk-CN6EFAK5.js +0 -440
- package/dist/chunks/chunk-CN6EFAK5.js.map +0 -6
- package/dist/chunks/chunk-DAUWDTZI.js.map +0 -6
- package/dist/chunks/chunk-DTNJTMWP.js.map +0 -6
- package/dist/chunks/chunk-EUBCYTOK.js.map +0 -6
- package/dist/chunks/chunk-H6B6AROX.js.map +0 -6
- package/dist/chunks/chunk-HWAPKOAW.js.map +0 -6
- package/dist/chunks/chunk-KTF5NW2V.js.map +0 -6
- package/dist/chunks/chunk-LFI6O7WL.js.map +0 -6
- package/dist/chunks/chunk-O2B3B2TM.js +0 -138
- package/dist/chunks/chunk-O2B3B2TM.js.map +0 -6
- package/dist/chunks/chunk-PWGJB2WA.js.map +0 -6
- package/dist/chunks/chunk-RPKRLR3O.js.map +0 -6
- package/dist/chunks/chunk-TIFSH2BH.js.map +0 -6
- package/dist/chunks/chunk-TSKCIC5T.js.map +0 -6
- package/dist/chunks/chunk-TZDYMWYP.js.map +0 -6
- package/dist/chunks/chunk-VD4D37MT.js.map +0 -6
- package/dist/chunks/chunk-XSCT3DLE.js +0 -161
- package/dist/chunks/chunk-XSCT3DLE.js.map +0 -6
- package/dist/chunks/chunk-Y37JJJVY.js.map +0 -6
- package/dist/chunks/chunk-YZW6H2LD.js.map +0 -6
- package/dist/chunks/chunk-ZPNX25RU.js.map +0 -6
- package/dist/chunks/cli-runtime-Q6BW37I2.js.map +0 -6
- package/dist/chunks/dist-5JM4UMVC.js.map +0 -6
- package/dist/chunks/dist-PRTI23W3.js.map +0 -6
- package/dist/chunks/dist-WO56PFGZ.js.map +0 -6
- package/dist/chunks/drain-MLRRMEGK.js.map +0 -6
- package/dist/chunks/exec-JLB6F5ZR.js.map +0 -6
- package/dist/chunks/host-queries-7LKGEBO5.js.map +0 -6
- package/dist/chunks/learn-NRY6X2K6.js.map +0 -6
- package/dist/chunks/learn-builtin-QOM4KLT2.js.map +0 -6
- package/dist/chunks/mcp-KOZOXU6J.js.map +0 -6
- package/dist/chunks/message-command-7B5OFSGL.js.map +0 -6
- package/dist/chunks/pal-XSD45IR6.js.map +0 -6
- package/dist/chunks/resident-NY7XSEK7.js.map +0 -6
- package/dist/chunks/resume-4FV66TEK.js +0 -23
- package/dist/chunks/service-CLLR5VUD.js.map +0 -6
- package/dist/chunks/session-step-IEMT6LRR.js +0 -30
- package/dist/chunks/skills-OZZLTH6P.js.map +0 -6
- package/dist/chunks/tui-XBQCRSIJ.js.map +0 -6
- package/dist/chunks/upgrade-ZRQZD2N2.js +0 -315
- package/dist/chunks/upgrade-ZRQZD2N2.js.map +0 -6
- /package/dist/chunks/{acp-MCDCWJ45.js.map → acp-ADQ2PRAY.js.map} +0 -0
- /package/dist/chunks/{add-VNM5QPTX.js.map → add-ILLLF6YP.js.map} +0 -0
- /package/dist/chunks/{agent-4IMOBJR5.js.map → agent-YQI5KOPV.js.map} +0 -0
- /package/dist/chunks/{agent-session-44AYNTQJ.js.map → agent-session-3MUZCWQ4.js.map} +0 -0
- /package/dist/chunks/{archive-VXJWPZBA.js.map → archive-55KJKGJB.js.map} +0 -0
- /package/dist/chunks/{browser-7MVCQL2G.js.map → browser-C6AOJ3CH.js.map} +0 -0
- /package/dist/chunks/{chat-M2WFCRYV.js.map → chat-45H5F3KI.js.map} +0 -0
- /package/dist/chunks/{chunk-X4BCXODL.js.map → chunk-23NRJ2RC.js.map} +0 -0
- /package/dist/chunks/{chunk-WYUJ4USW.js.map → chunk-35VTE7V5.js.map} +0 -0
- /package/dist/chunks/{chunk-HV7PRPHJ.js.map → chunk-3LNTQLQ4.js.map} +0 -0
- /package/dist/chunks/{chunk-F2UUHEPY.js.map → chunk-4NO5XFK2.js.map} +0 -0
- /package/dist/chunks/{chunk-DAJBZ4B7.js.map → chunk-6GBZAUYW.js.map} +0 -0
- /package/dist/chunks/{chunk-5LGZUFDJ.js.map → chunk-6PNBIMWH.js.map} +0 -0
- /package/dist/chunks/{chunk-XSAS6TS2.js.map → chunk-6S4R2USK.js.map} +0 -0
- /package/dist/chunks/{chunk-EYBTANG5.js.map → chunk-A3AF5WXZ.js.map} +0 -0
- /package/dist/chunks/{chunk-AGRFKHS2.js.map → chunk-A4CKLHKM.js.map} +0 -0
- /package/dist/chunks/{chunk-MCUV6EI7.js.map → chunk-AZPS37AQ.js.map} +0 -0
- /package/dist/chunks/{chunk-2LLNCAZS.js.map → chunk-BRKD6FMO.js.map} +0 -0
- /package/dist/chunks/{chunk-PXEHKMLO.js.map → chunk-CW2N2QS2.js.map} +0 -0
- /package/dist/chunks/{chunk-2Q6PBTPY.js.map → chunk-DLL2FPUY.js.map} +0 -0
- /package/dist/chunks/{chunk-5XWYY63Z.js.map → chunk-ESZ7X37S.js.map} +0 -0
- /package/dist/chunks/{chunk-VHXXNM6W.js.map → chunk-EWSIGY2A.js.map} +0 -0
- /package/dist/chunks/{chunk-L2MEW4AZ.js.map → chunk-FMEGRBJP.js.map} +0 -0
- /package/dist/chunks/{chunk-IBUFD2HH.js.map → chunk-FSKJ3EZC.js.map} +0 -0
- /package/dist/chunks/{chunk-YBOKKRHB.js.map → chunk-HOIDWHGC.js.map} +0 -0
- /package/dist/chunks/{chunk-IBCA2WDM.js.map → chunk-HOY7BUGW.js.map} +0 -0
- /package/dist/chunks/{chunk-5L7ZQ37R.js.map → chunk-HQZ3GBQI.js.map} +0 -0
- /package/dist/chunks/{chunk-G7JH3PMC.js.map → chunk-HXAWIWOZ.js.map} +0 -0
- /package/dist/chunks/{chunk-Z2WGX7UM.js.map → chunk-IQQ6TY4W.js.map} +0 -0
- /package/dist/chunks/{chunk-N457UJQL.js.map → chunk-JD2HLKFO.js.map} +0 -0
- /package/dist/chunks/{chunk-7A5TVBGS.js.map → chunk-K6LLMOB2.js.map} +0 -0
- /package/dist/chunks/{chunk-KEKFOEEP.js.map → chunk-M46GKTOI.js.map} +0 -0
- /package/dist/chunks/{chunk-O3CIRAYD.js.map → chunk-N3C5X6BW.js.map} +0 -0
- /package/dist/chunks/{chunk-IMFIQJM6.js.map → chunk-QT6KYBCC.js.map} +0 -0
- /package/dist/chunks/{chunk-QYA34YM5.js.map → chunk-QUELENQP.js.map} +0 -0
- /package/dist/chunks/{chunk-RI57PEYF.js.map → chunk-R2LYGFCI.js.map} +0 -0
- /package/dist/chunks/{chunk-AYCKJIVD.js.map → chunk-RGVJHSMU.js.map} +0 -0
- /package/dist/chunks/{chunk-MSKJK6NZ.js.map → chunk-RVSVVL6O.js.map} +0 -0
- /package/dist/chunks/{chunk-H3ALHXFV.js.map → chunk-SIWZZF4M.js.map} +0 -0
- /package/dist/chunks/{chunk-GD6LOX4A.js.map → chunk-SNC5D5UG.js.map} +0 -0
- /package/dist/chunks/{chunk-KDZ6GM2A.js.map → chunk-SRYIMLOK.js.map} +0 -0
- /package/dist/chunks/{chunk-IQBKDY6G.js.map → chunk-TW5BCDA5.js.map} +0 -0
- /package/dist/chunks/{chunk-DVRRRNSA.js.map → chunk-URJ7TITR.js.map} +0 -0
- /package/dist/chunks/{chunk-O7VKAFEU.js.map → chunk-WHOSI6UQ.js.map} +0 -0
- /package/dist/chunks/{chunk-AVSE45ED.js.map → chunk-XCMCPWMB.js.map} +0 -0
- /package/dist/chunks/{chunk-KGKRKFB7.js.map → chunk-XGVCAMNT.js.map} +0 -0
- /package/dist/chunks/{chunk-LETTT4ZZ.js.map → chunk-XXUL6HHM.js.map} +0 -0
- /package/dist/chunks/{chunk-7RBZS3TN.js.map → chunk-Y2DZ27P6.js.map} +0 -0
- /package/dist/chunks/{chunk-QWFD2LFU.js.map → chunk-Y3I7AAD6.js.map} +0 -0
- /package/dist/chunks/{chunk-3ZMECJLN.js.map → chunk-Y74CPWYC.js.map} +0 -0
- /package/dist/chunks/{chunk-LRDLJTYP.js.map → chunk-YP7AINGL.js.map} +0 -0
- /package/dist/chunks/{chunk-YAOKLAUU.js.map → chunk-YPHXWFKQ.js.map} +0 -0
- /package/dist/chunks/{chunk-4I5FGMVR.js.map → chunk-YVIM3MXU.js.map} +0 -0
- /package/dist/chunks/{commands-C5I7PC7W.js.map → commands-JZT6JJY5.js.map} +0 -0
- /package/dist/chunks/{crash-report-DRT5OCHO.js.map → crash-report-TWMWHNKY.js.map} +0 -0
- /package/dist/chunks/{doctor-HXKU6QKJ.js.map → doctor-UVZBNUNF.js.map} +0 -0
- /package/dist/chunks/{eval-ECOECG74.js.map → eval-NRRIWDET.js.map} +0 -0
- /package/dist/chunks/{home-G65CC45B.js.map → home-RT2I6VTQ.js.map} +0 -0
- /package/dist/chunks/{lifecycle-BI2PMV4Q.js.map → install-LVQAT4QP.js.map} +0 -0
- /package/dist/chunks/{login-7LJG7D3F.js.map → lifecycle-TZU6D46R.js.map} +0 -0
- /package/dist/chunks/{list-QTWALT6F.js.map → list-QCWNMQED.js.map} +0 -0
- /package/dist/chunks/{output-schema-QPHXNRKI.js.map → live-V7HRF5KR.js.map} +0 -0
- /package/dist/chunks/{providers-ULPGYRWC.js.map → login-QFP3PIXG.js.map} +0 -0
- /package/dist/chunks/{logs-UGMCEFAZ.js.map → logs-XTXMS4JF.js.map} +0 -0
- /package/dist/chunks/{operator-tools-PWBZHKXO.js.map → operator-tools-2OYRNPCH.js.map} +0 -0
- /package/dist/chunks/{resume-4FV66TEK.js.map → output-schema-ETVPLUXE.js.map} +0 -0
- /package/dist/chunks/{resume-command-DLOW7MYW.js.map → providers-KP5JHTTK.js.map} +0 -0
- /package/dist/chunks/{session-step-IEMT6LRR.js.map → resume-7V44GSEU.js.map} +0 -0
- /package/dist/chunks/{store-C24DXKO4.js.map → resume-command-OKJ2MJPB.js.map} +0 -0
- /package/dist/chunks/{schedule-QR7JOA4F.js.map → schedule-TVR3FE32.js.map} +0 -0
- /package/dist/chunks/{store-ROEYUKBM.js.map → session-step-N4GHA2YE.js.map} +0 -0
- /package/dist/chunks/{store-VDQRT2KF.js.map → start-check-BUCN5MCU.js.map} +0 -0
- /package/dist/chunks/{state-EROTPJRH.js.map → state-PVAVIXHK.js.map} +0 -0
- /package/dist/chunks/{worktree-XMJ355ND.js.map → worktree-MVW62U5G.js.map} +0 -0
|
@@ -2,13 +2,16 @@ import { createRequire as __namzuCreateRequire } from 'node:module';
|
|
|
2
2
|
const require = __namzuCreateRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
openManagedWorktrees
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-Y3I7AAD6.js";
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
} from "./chunk-
|
|
7
|
+
connectMcpServers
|
|
8
|
+
} from "./chunk-A4CKLHKM.js";
|
|
9
|
+
import {
|
|
10
|
+
openInBrowser
|
|
11
|
+
} from "./chunk-4NO5XFK2.js";
|
|
9
12
|
import {
|
|
10
13
|
createSessionSkillCatalog
|
|
11
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-6S4R2USK.js";
|
|
12
15
|
import {
|
|
13
16
|
SAVE_SKILL_TOOL_NAME,
|
|
14
17
|
attachAgentView,
|
|
@@ -24,23 +27,25 @@ import {
|
|
|
24
27
|
settledElapsed,
|
|
25
28
|
theme,
|
|
26
29
|
viewFromJournal,
|
|
30
|
+
withSandboxShell,
|
|
27
31
|
workingDirectoryProblem
|
|
28
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-S4KDR6G5.js";
|
|
29
33
|
import {
|
|
30
34
|
runGeneratorCycle
|
|
31
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-QT6KYBCC.js";
|
|
32
36
|
import {
|
|
33
37
|
createSessionLearningFeed,
|
|
34
38
|
openLearningTarget,
|
|
35
39
|
readProjectGuidance,
|
|
36
40
|
withSessionLearningFeed
|
|
37
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-N3C5X6BW.js";
|
|
38
42
|
import {
|
|
39
|
-
|
|
40
|
-
} from "./chunk-
|
|
43
|
+
createBrowserControl
|
|
44
|
+
} from "./chunk-WHODOMXA.js";
|
|
41
45
|
import {
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
conversationInUseSentence,
|
|
47
|
+
minutesUntilFree
|
|
48
|
+
} from "./chunk-4IIEEOCA.js";
|
|
44
49
|
import {
|
|
45
50
|
CredentialRefreshRejectedError,
|
|
46
51
|
CredentialWithdrawnError,
|
|
@@ -48,7 +53,12 @@ import {
|
|
|
48
53
|
ensureFreshStoredCodexCredential,
|
|
49
54
|
readSubscriptionCredential,
|
|
50
55
|
sameOAuthCredential
|
|
51
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-CW2N2QS2.js";
|
|
57
|
+
import {
|
|
58
|
+
createLazyCodeAnalysis,
|
|
59
|
+
promptCacheTtl,
|
|
60
|
+
setPromptCacheTtl
|
|
61
|
+
} from "./chunk-N56FVHCU.js";
|
|
52
62
|
import {
|
|
53
63
|
debugRequested
|
|
54
64
|
} from "./chunk-GNBMKISG.js";
|
|
@@ -60,19 +70,19 @@ import {
|
|
|
60
70
|
sessionWorkflowSizeAdvice,
|
|
61
71
|
unmatchedPassthroughTools,
|
|
62
72
|
workflowTokenCeiling
|
|
63
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-GOGBOZKO.js";
|
|
74
|
+
import {
|
|
75
|
+
require_dist
|
|
76
|
+
} from "./chunk-KONYGNG6.js";
|
|
77
|
+
import {
|
|
78
|
+
resolveGeneratorSettings
|
|
79
|
+
} from "./chunk-LCGXWCVU.js";
|
|
64
80
|
import {
|
|
65
81
|
formatSize,
|
|
66
82
|
homePath,
|
|
67
83
|
plural,
|
|
68
84
|
productName
|
|
69
85
|
} from "./chunk-XPS3W7FC.js";
|
|
70
|
-
import {
|
|
71
|
-
resolveGeneratorSettings
|
|
72
|
-
} from "./chunk-LCGXWCVU.js";
|
|
73
|
-
import {
|
|
74
|
-
createLazyCodeAnalysis
|
|
75
|
-
} from "./chunk-DAUWDTZI.js";
|
|
76
86
|
import {
|
|
77
87
|
canSelectModel,
|
|
78
88
|
chainCapabilityDisagreements,
|
|
@@ -97,7 +107,7 @@ import {
|
|
|
97
107
|
requiresCredentialForModel,
|
|
98
108
|
resolveChainCapabilities,
|
|
99
109
|
unresolvedMembers
|
|
100
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-Y74CPWYC.js";
|
|
101
111
|
import {
|
|
102
112
|
PROVIDER_REGISTRY,
|
|
103
113
|
missingCredentialMessage,
|
|
@@ -106,48 +116,49 @@ import {
|
|
|
106
116
|
import {
|
|
107
117
|
isPermissionMode,
|
|
108
118
|
permissionModeLabel
|
|
109
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-J4IES4SO.js";
|
|
110
120
|
import {
|
|
111
121
|
conversationLogPath,
|
|
112
122
|
ensureSessionStarted,
|
|
113
123
|
openConversationLog
|
|
114
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-QWBR6FBY.js";
|
|
115
125
|
import {
|
|
116
126
|
readIdentity
|
|
117
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-IQQ6TY4W.js";
|
|
118
128
|
import {
|
|
119
129
|
INSTRUCTIONS_FILENAME,
|
|
120
130
|
MAX_CHARS_PER_FILE,
|
|
121
131
|
cliProjectRoot,
|
|
122
132
|
instructionSearchPath,
|
|
123
|
-
|
|
124
|
-
|
|
133
|
+
isContainedBy,
|
|
134
|
+
readInstructionAt
|
|
135
|
+
} from "./chunk-JQIBPPOL.js";
|
|
136
|
+
import {
|
|
137
|
+
probeCapabilities
|
|
138
|
+
} from "./chunk-OH6TB27S.js";
|
|
125
139
|
import {
|
|
126
140
|
compilePermissions,
|
|
127
141
|
isPermissionEffect
|
|
128
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-HOY7BUGW.js";
|
|
129
143
|
import {
|
|
130
144
|
cliLogger
|
|
131
|
-
} from "./chunk-
|
|
145
|
+
} from "./chunk-JD2HLKFO.js";
|
|
132
146
|
import {
|
|
133
147
|
stringWidth
|
|
134
148
|
} from "./chunk-U5UV2YRE.js";
|
|
135
|
-
import {
|
|
136
|
-
probeCapabilities
|
|
137
|
-
} from "./chunk-OH6TB27S.js";
|
|
138
149
|
import {
|
|
139
150
|
activeZenCatalogue,
|
|
140
151
|
isOfferableModel
|
|
141
152
|
} from "./chunk-IE5XIE4W.js";
|
|
142
153
|
import {
|
|
143
154
|
ensurePrivateStateDirectory
|
|
144
|
-
} from "./chunk-
|
|
155
|
+
} from "./chunk-DLL2FPUY.js";
|
|
145
156
|
import {
|
|
146
157
|
restrictToOwner
|
|
147
|
-
} from "./chunk-
|
|
158
|
+
} from "./chunk-BRKD6FMO.js";
|
|
148
159
|
import {
|
|
149
160
|
namzuHomePath
|
|
150
|
-
} from "./chunk-
|
|
161
|
+
} from "./chunk-YVIM3MXU.js";
|
|
151
162
|
import {
|
|
152
163
|
AgentManager,
|
|
153
164
|
AgentRegistry,
|
|
@@ -186,6 +197,9 @@ import {
|
|
|
186
197
|
MemoryContentRejectedError,
|
|
187
198
|
MemoryNameConflictError,
|
|
188
199
|
NOOP_LOGGER,
|
|
200
|
+
PLAN_AGENT_DESCRIPTION,
|
|
201
|
+
PLAN_AGENT_ID,
|
|
202
|
+
PLAN_AGENT_PROMPT,
|
|
189
203
|
PLAN_MODE_DOCTRINE,
|
|
190
204
|
PluginLifecycleManager,
|
|
191
205
|
PluginRegistry,
|
|
@@ -273,6 +287,7 @@ import {
|
|
|
273
287
|
getMonitorTools,
|
|
274
288
|
isCompactionMessage,
|
|
275
289
|
isEntityId,
|
|
290
|
+
isNamzuError,
|
|
276
291
|
isProjectInstructionMessageSource,
|
|
277
292
|
isReminderMessage,
|
|
278
293
|
isReviewExempt,
|
|
@@ -282,6 +297,7 @@ import {
|
|
|
282
297
|
isTrustedReadOnly,
|
|
283
298
|
isTurnInProgressError,
|
|
284
299
|
isolationOf,
|
|
300
|
+
lastPromptText,
|
|
285
301
|
lexShellCommandLine,
|
|
286
302
|
mapTools,
|
|
287
303
|
mcpJsonSchemaToZod,
|
|
@@ -305,17 +321,20 @@ import {
|
|
|
305
321
|
selectTaskContext,
|
|
306
322
|
slugifyMemoryName,
|
|
307
323
|
structuredPatch,
|
|
324
|
+
toPlatformError,
|
|
308
325
|
toToolSourceRef,
|
|
309
326
|
toolWireSchema,
|
|
310
327
|
toolset,
|
|
328
|
+
turnContextEntries,
|
|
311
329
|
untrustedEnvelopeBody,
|
|
312
330
|
webGuidanceContribution,
|
|
313
331
|
windowsShellNotice,
|
|
314
332
|
withProviderFallback,
|
|
315
333
|
wrapUntrusted
|
|
316
|
-
} from "./chunk-
|
|
334
|
+
} from "./chunk-7E3V7NNN.js";
|
|
317
335
|
import {
|
|
318
|
-
__name
|
|
336
|
+
__name,
|
|
337
|
+
__toESM
|
|
319
338
|
} from "./chunk-76FLAFCG.js";
|
|
320
339
|
|
|
321
340
|
// src/integrations/compaction/idle-compaction.ts
|
|
@@ -531,17 +550,6 @@ var TextOnlyModels = class {
|
|
|
531
550
|
}
|
|
532
551
|
};
|
|
533
552
|
|
|
534
|
-
// src/integrations/providers/prompt-cache-ttl.ts
|
|
535
|
-
var configured;
|
|
536
|
-
function setPromptCacheTtl(ttl) {
|
|
537
|
-
configured = ttl;
|
|
538
|
-
}
|
|
539
|
-
__name(setPromptCacheTtl, "setPromptCacheTtl");
|
|
540
|
-
function promptCacheTtl() {
|
|
541
|
-
return configured;
|
|
542
|
-
}
|
|
543
|
-
__name(promptCacheTtl, "promptCacheTtl");
|
|
544
|
-
|
|
545
553
|
// src/integrations/web/open-url.ts
|
|
546
554
|
var OPEN_URL_TOOL_NAME = "open_url";
|
|
547
555
|
var inputSchema = {
|
|
@@ -606,10 +614,10 @@ var tail = Promise.resolve();
|
|
|
606
614
|
var nextStart = 0;
|
|
607
615
|
function cancelled(promise, signal) {
|
|
608
616
|
signal.throwIfAborted();
|
|
609
|
-
return new Promise((
|
|
617
|
+
return new Promise((resolve15, reject) => {
|
|
610
618
|
const abort = /* @__PURE__ */ __name(() => reject(signal.reason), "abort");
|
|
611
619
|
signal.addEventListener("abort", abort, { once: true });
|
|
612
|
-
promise.then(
|
|
620
|
+
promise.then(resolve15, reject).finally(() => signal.removeEventListener("abort", abort));
|
|
613
621
|
});
|
|
614
622
|
}
|
|
615
623
|
__name(cancelled, "cancelled");
|
|
@@ -650,8 +658,8 @@ async function searchExa(query2, limit, context) {
|
|
|
650
658
|
const deadline = Date.now() + DEADLINE_MS;
|
|
651
659
|
const previous = tail;
|
|
652
660
|
let release;
|
|
653
|
-
tail = new Promise((
|
|
654
|
-
release =
|
|
661
|
+
tail = new Promise((resolve15) => {
|
|
662
|
+
release = resolve15;
|
|
655
663
|
});
|
|
656
664
|
let acquired = false;
|
|
657
665
|
try {
|
|
@@ -836,6 +844,8 @@ function describeHistoryRepairNotice(input) {
|
|
|
836
844
|
return name ? `${name} didn\u2019t accept ${what}. Namzu kept the file but will leave it out of later messages. Attach a corrected copy to try again.` : `${what.charAt(0).toUpperCase()}${what.slice(1)} wasn\u2019t accepted. Namzu kept the file but will leave it out of later messages. Attach a corrected copy to try again.`;
|
|
837
845
|
}
|
|
838
846
|
if ((input.interruptedCalls ?? 0) > 0) {
|
|
847
|
+
if (input.neverRanCalls === input.interruptedCalls)
|
|
848
|
+
return "Some tool calls in this conversation never started, so Namzu marked them as not run. Nothing they asked for happened.";
|
|
839
849
|
return input.source === "abandoned-checkpoint" ? "Your last reply was cut off before its steps finished, so Namzu marked them as unfinished. Check any files or commands they touched before asking again." : "Some steps in this conversation never finished, so Namzu marked them as unfinished. Check any files or commands they touched before asking again.";
|
|
840
850
|
}
|
|
841
851
|
return "Namzu cleaned up some leftover steps from earlier in this conversation. Nothing you need to do.";
|
|
@@ -851,8 +861,17 @@ var FALLBACK_WHY = {
|
|
|
851
861
|
not_found: "does not have that model"
|
|
852
862
|
};
|
|
853
863
|
function describeProviderFallbackNotice(input) {
|
|
854
|
-
const
|
|
855
|
-
|
|
864
|
+
const named = /* @__PURE__ */ __name((id, model, unknown) => {
|
|
865
|
+
const product = productName(id) ?? unknown;
|
|
866
|
+
return model ? `${product} (${model})` : product;
|
|
867
|
+
}, "named");
|
|
868
|
+
const sameProvider = input.fromProviderId === input.toProviderId;
|
|
869
|
+
const from = named(
|
|
870
|
+
input.fromProviderId,
|
|
871
|
+
sameProvider ? input.fromModel : void 0,
|
|
872
|
+
"The first provider"
|
|
873
|
+
);
|
|
874
|
+
const to = named(input.toProviderId, input.toModel, "another provider");
|
|
856
875
|
const why = FALLBACK_WHY[input.reason] ?? "could not answer";
|
|
857
876
|
return `${from} ${why}, so Namzu used ${to} for the rest of that reply.`;
|
|
858
877
|
}
|
|
@@ -1543,6 +1562,7 @@ __name(proposedBody, "proposedBody");
|
|
|
1543
1562
|
// src/tui/tidy-tool-output.ts
|
|
1544
1563
|
import { stripVTControlCharacters } from "node:util";
|
|
1545
1564
|
var BACKGROUND_NOTE = "Running in the background (\u2193 to manage)";
|
|
1565
|
+
var CONTINUED_NOTE = "Continues in the background (\u2193 to manage)";
|
|
1546
1566
|
function looksBinary(text2) {
|
|
1547
1567
|
if (text2.includes("\0")) return true;
|
|
1548
1568
|
if (text2.length === 0) return false;
|
|
@@ -1647,7 +1667,11 @@ function tidyCommandOutput(facts, raw) {
|
|
|
1647
1667
|
}
|
|
1648
1668
|
return withFailure(
|
|
1649
1669
|
tidyTerminalOutput(raw).output,
|
|
1650
|
-
cell(
|
|
1670
|
+
cell(
|
|
1671
|
+
[],
|
|
1672
|
+
[],
|
|
1673
|
+
facts.background ? facts.continued ? CONTINUED_NOTE : BACKGROUND_NOTE : facts.exitNote
|
|
1674
|
+
)
|
|
1651
1675
|
);
|
|
1652
1676
|
}
|
|
1653
1677
|
__name(tidyCommandOutput, "tidyCommandOutput");
|
|
@@ -1720,6 +1744,7 @@ function factsHeadline(facts) {
|
|
|
1720
1744
|
case "read": {
|
|
1721
1745
|
const name = fileName(facts.path);
|
|
1722
1746
|
if (facts.binary) return `Read ${name} \xB7 not text`;
|
|
1747
|
+
if (facts.unchanged) return `Read ${name} \xB7 unchanged`;
|
|
1723
1748
|
if (facts.partial && facts.returnedLines !== void 0 && facts.totalLines !== void 0) {
|
|
1724
1749
|
return `Read ${name} \xB7 ${facts.returnedLines.toLocaleString("en-US")} of ${plural(facts.totalLines, "line")}`;
|
|
1725
1750
|
}
|
|
@@ -1819,7 +1844,7 @@ __name(oneLine, "oneLine");
|
|
|
1819
1844
|
// src/tui/agent.ts
|
|
1820
1845
|
import { SubprocessComputerUseHost } from "@namzu/computer-use";
|
|
1821
1846
|
import { realpath as realpath4, stat as stat4 } from "node:fs/promises";
|
|
1822
|
-
import { join as
|
|
1847
|
+
import { join as join15, parse, resolve as resolve14 } from "node:path";
|
|
1823
1848
|
|
|
1824
1849
|
// src/checkpoints/store.ts
|
|
1825
1850
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
@@ -3331,8 +3356,9 @@ var NAMZU_IDENTITY = [
|
|
|
3331
3356
|
var FOREGROUND_BASH_DESCRIPTION = "Executes one shell command in the foreground and returns stdout/stderr. Calls run one at a time, in order, because shell commands may change the same workspace; independent calls may still share one response.";
|
|
3332
3357
|
|
|
3333
3358
|
// src/context/project-tracker.ts
|
|
3334
|
-
import { realpathSync } from "node:fs";
|
|
3335
|
-
import {
|
|
3359
|
+
import { realpathSync as realpathSync2 } from "node:fs";
|
|
3360
|
+
import { homedir as homedir2 } from "node:os";
|
|
3361
|
+
import { dirname as dirname3, isAbsolute as isAbsolute5, join as join4, relative as relative5, resolve as resolve6, sep as sep3 } from "node:path";
|
|
3336
3362
|
|
|
3337
3363
|
// src/context/project-path.ts
|
|
3338
3364
|
function visibleProjectInstructionPath(path) {
|
|
@@ -3344,42 +3370,326 @@ function visibleProjectInstructionPath(path) {
|
|
|
3344
3370
|
}
|
|
3345
3371
|
__name(visibleProjectInstructionPath, "visibleProjectInstructionPath");
|
|
3346
3372
|
|
|
3373
|
+
// src/context/instruction-scope.ts
|
|
3374
|
+
import { lstatSync, readdirSync, realpathSync } from "node:fs";
|
|
3375
|
+
import { homedir } from "node:os";
|
|
3376
|
+
import { dirname as dirname2, extname, join as join3, relative as relative4, resolve as resolve5, sep as sep2 } from "node:path";
|
|
3377
|
+
var import_yaml = __toESM(require_dist(), 1);
|
|
3378
|
+
|
|
3379
|
+
// src/context/instruction-glob.ts
|
|
3380
|
+
function globToRegExp(glob) {
|
|
3381
|
+
let out = "";
|
|
3382
|
+
let braces = 0;
|
|
3383
|
+
for (let i = 0; i < glob.length; i += 1) {
|
|
3384
|
+
const ch = glob.charAt(i);
|
|
3385
|
+
if (ch === "*") {
|
|
3386
|
+
if (glob.charAt(i + 1) === "*") {
|
|
3387
|
+
if (glob.charAt(i + 2) === "/") {
|
|
3388
|
+
out += "(?:.*/)?";
|
|
3389
|
+
i += 2;
|
|
3390
|
+
} else {
|
|
3391
|
+
out += ".*";
|
|
3392
|
+
i += 1;
|
|
3393
|
+
}
|
|
3394
|
+
} else {
|
|
3395
|
+
out += "[^/]*";
|
|
3396
|
+
}
|
|
3397
|
+
} else if (ch === "?") {
|
|
3398
|
+
out += "[^/]";
|
|
3399
|
+
} else if (ch === "{") {
|
|
3400
|
+
braces += 1;
|
|
3401
|
+
out += "(?:";
|
|
3402
|
+
} else if (ch === "}" && braces > 0) {
|
|
3403
|
+
braces -= 1;
|
|
3404
|
+
out += ")";
|
|
3405
|
+
} else if (ch === "," && braces > 0) {
|
|
3406
|
+
out += "|";
|
|
3407
|
+
} else {
|
|
3408
|
+
out += ch.replace(/[.+^$()|[\]\\]/g, "\\$&");
|
|
3409
|
+
}
|
|
3410
|
+
}
|
|
3411
|
+
out += ")".repeat(braces);
|
|
3412
|
+
return new RegExp(`^${out}$`);
|
|
3413
|
+
}
|
|
3414
|
+
__name(globToRegExp, "globToRegExp");
|
|
3415
|
+
function matchesAnyGlob(relativePath, globs) {
|
|
3416
|
+
return globs.some((glob) => {
|
|
3417
|
+
try {
|
|
3418
|
+
return globToRegExp(glob.replace(/^\.\//, "")).test(relativePath);
|
|
3419
|
+
} catch {
|
|
3420
|
+
return false;
|
|
3421
|
+
}
|
|
3422
|
+
});
|
|
3423
|
+
}
|
|
3424
|
+
__name(matchesAnyGlob, "matchesAnyGlob");
|
|
3425
|
+
|
|
3426
|
+
// src/context/instruction-scope.ts
|
|
3427
|
+
var LOCAL_INSTRUCTIONS_FILENAME = "AGENTS.local.md";
|
|
3428
|
+
var RULES_DIRECTORY = join3(".namzu", "rules");
|
|
3429
|
+
var MAX_IMPORT_DEPTH = 5;
|
|
3430
|
+
var MAX_RULE_FILES = 200;
|
|
3431
|
+
var IMPORTABLE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
3432
|
+
".md",
|
|
3433
|
+
".markdown",
|
|
3434
|
+
".mdx",
|
|
3435
|
+
".txt",
|
|
3436
|
+
".text",
|
|
3437
|
+
".json",
|
|
3438
|
+
".yaml",
|
|
3439
|
+
".yml",
|
|
3440
|
+
".toml"
|
|
3441
|
+
]);
|
|
3442
|
+
function realKey(path) {
|
|
3443
|
+
try {
|
|
3444
|
+
return realpathSync(path);
|
|
3445
|
+
} catch {
|
|
3446
|
+
return resolve5(path);
|
|
3447
|
+
}
|
|
3448
|
+
}
|
|
3449
|
+
__name(realKey, "realKey");
|
|
3450
|
+
function ruleHeader(text2) {
|
|
3451
|
+
const match = /^---\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/.exec(text2);
|
|
3452
|
+
if (!match) return { body: text2, globs: null };
|
|
3453
|
+
let data;
|
|
3454
|
+
try {
|
|
3455
|
+
data = (0, import_yaml.parse)(match[1] ?? "");
|
|
3456
|
+
} catch {
|
|
3457
|
+
return { body: text2, globs: null };
|
|
3458
|
+
}
|
|
3459
|
+
const body2 = text2.slice(match[0].length).trim();
|
|
3460
|
+
const raw = typeof data === "object" && data !== null ? data.paths : null;
|
|
3461
|
+
const list = (typeof raw === "string" ? raw.split(",") : Array.isArray(raw) ? raw : []).filter((entry) => typeof entry === "string").map((entry) => entry.trim()).filter((entry) => entry.length > 0);
|
|
3462
|
+
if (list.length === 0 || list.some((entry) => entry === "**" || entry === "**/*")) {
|
|
3463
|
+
return { body: body2, globs: null };
|
|
3464
|
+
}
|
|
3465
|
+
return { body: body2, globs: list };
|
|
3466
|
+
}
|
|
3467
|
+
__name(ruleHeader, "ruleHeader");
|
|
3468
|
+
function extractImportTokens(text2) {
|
|
3469
|
+
const tokens = [];
|
|
3470
|
+
let fence = null;
|
|
3471
|
+
for (const line of text2.split("\n")) {
|
|
3472
|
+
const marker = /^\s*(```+|~~~+)/.exec(line)?.[1];
|
|
3473
|
+
if (marker) {
|
|
3474
|
+
if (fence === null) fence = marker.charAt(0);
|
|
3475
|
+
else if (marker.startsWith(fence)) fence = null;
|
|
3476
|
+
continue;
|
|
3477
|
+
}
|
|
3478
|
+
if (fence !== null) continue;
|
|
3479
|
+
const plain = line.replace(/`[^`]*`/g, (span) => " ".repeat(span.length));
|
|
3480
|
+
for (const found of plain.matchAll(/(?:^|\s)@((?:\\ |[^\s])+)/g)) {
|
|
3481
|
+
if (found[1]) tokens.push(found[1]);
|
|
3482
|
+
}
|
|
3483
|
+
}
|
|
3484
|
+
return tokens;
|
|
3485
|
+
}
|
|
3486
|
+
__name(extractImportTokens, "extractImportTokens");
|
|
3487
|
+
function resolveImport(token, importer) {
|
|
3488
|
+
const cleaned = token.replace(/\\ /g, " ").replace(/#.*$/, "");
|
|
3489
|
+
if (cleaned.length === 0) return null;
|
|
3490
|
+
let path;
|
|
3491
|
+
if (cleaned.startsWith("~/")) path = join3(homedir(), cleaned.slice(2));
|
|
3492
|
+
else if (cleaned.startsWith("/")) path = cleaned;
|
|
3493
|
+
else path = resolve5(dirname2(importer), cleaned);
|
|
3494
|
+
return IMPORTABLE_EXTENSIONS.has(extname(path).toLowerCase()) ? path : null;
|
|
3495
|
+
}
|
|
3496
|
+
__name(resolveImport, "resolveImport");
|
|
3497
|
+
function followImports(collector, parent, depth) {
|
|
3498
|
+
if (depth > MAX_IMPORT_DEPTH) return;
|
|
3499
|
+
for (const token of extractImportTokens(parent.text)) {
|
|
3500
|
+
const candidate = resolveImport(token, parent.path);
|
|
3501
|
+
if (candidate === null) continue;
|
|
3502
|
+
let target;
|
|
3503
|
+
try {
|
|
3504
|
+
target = realpathSync(candidate);
|
|
3505
|
+
} catch {
|
|
3506
|
+
continue;
|
|
3507
|
+
}
|
|
3508
|
+
let isFile = false;
|
|
3509
|
+
try {
|
|
3510
|
+
isFile = lstatSync(target).isFile();
|
|
3511
|
+
} catch {
|
|
3512
|
+
continue;
|
|
3513
|
+
}
|
|
3514
|
+
if (!isFile) continue;
|
|
3515
|
+
if (!isContainedBy(target, collector.roots)) {
|
|
3516
|
+
collector.skipped.push({
|
|
3517
|
+
path: candidate,
|
|
3518
|
+
reason: `it is included by ${parent.path} but lies outside the folders an instruction file may include from`
|
|
3519
|
+
});
|
|
3520
|
+
continue;
|
|
3521
|
+
}
|
|
3522
|
+
if (collector.processed.has(target)) continue;
|
|
3523
|
+
collector.processed.add(target);
|
|
3524
|
+
const outcome = readInstructionAt(candidate, collector.roots);
|
|
3525
|
+
if (outcome.kind === "skipped") {
|
|
3526
|
+
collector.skipped.push(outcome.file);
|
|
3527
|
+
continue;
|
|
3528
|
+
}
|
|
3529
|
+
if (outcome.kind === "absent") continue;
|
|
3530
|
+
const imported = {
|
|
3531
|
+
...outcome.file,
|
|
3532
|
+
kind: "import",
|
|
3533
|
+
importedBy: parent.path,
|
|
3534
|
+
...parent.scopeDir ? { scopeDir: parent.scopeDir } : {}
|
|
3535
|
+
};
|
|
3536
|
+
collector.files.push(imported);
|
|
3537
|
+
followImports(collector, imported, depth + 1);
|
|
3538
|
+
}
|
|
3539
|
+
}
|
|
3540
|
+
__name(followImports, "followImports");
|
|
3541
|
+
function addTopLevel(collector, path, kind, scopeDir, rule) {
|
|
3542
|
+
const outcome = readInstructionAt(path, collector.roots);
|
|
3543
|
+
if (outcome.kind === "skipped") {
|
|
3544
|
+
collector.skipped.push(outcome.file);
|
|
3545
|
+
return;
|
|
3546
|
+
}
|
|
3547
|
+
if (outcome.kind === "absent") return;
|
|
3548
|
+
const key = realKey(path);
|
|
3549
|
+
if (collector.processed.has(key)) return;
|
|
3550
|
+
let file = {
|
|
3551
|
+
...outcome.file,
|
|
3552
|
+
kind,
|
|
3553
|
+
...scopeDir ? { scopeDir } : {}
|
|
3554
|
+
};
|
|
3555
|
+
if (rule) {
|
|
3556
|
+
const header = ruleHeader(file.text);
|
|
3557
|
+
if (header.globs !== null) {
|
|
3558
|
+
const active = collector.touched.some((touched) => {
|
|
3559
|
+
const rel = relative4(collector.matchBase, touched);
|
|
3560
|
+
return rel !== "" && rel !== ".." && !rel.startsWith(`..${sep2}`) && matchesAnyGlob(rel.split(sep2).join("/"), header.globs ?? []);
|
|
3561
|
+
});
|
|
3562
|
+
if (!active) return;
|
|
3563
|
+
}
|
|
3564
|
+
if (header.body.length === 0) return;
|
|
3565
|
+
file = { ...file, text: header.body };
|
|
3566
|
+
}
|
|
3567
|
+
collector.processed.add(key);
|
|
3568
|
+
collector.files.push(file);
|
|
3569
|
+
followImports(collector, file, 1);
|
|
3570
|
+
}
|
|
3571
|
+
__name(addTopLevel, "addTopLevel");
|
|
3572
|
+
function listRuleFiles(directory, collector) {
|
|
3573
|
+
const found = [];
|
|
3574
|
+
const walk = /* @__PURE__ */ __name((dir, depth) => {
|
|
3575
|
+
if (depth > 8) return;
|
|
3576
|
+
let entries;
|
|
3577
|
+
try {
|
|
3578
|
+
entries = readdirSync(dir);
|
|
3579
|
+
} catch {
|
|
3580
|
+
return;
|
|
3581
|
+
}
|
|
3582
|
+
for (const name of [...entries].sort()) {
|
|
3583
|
+
const path = join3(dir, name);
|
|
3584
|
+
let stat5;
|
|
3585
|
+
try {
|
|
3586
|
+
stat5 = lstatSync(path);
|
|
3587
|
+
} catch {
|
|
3588
|
+
continue;
|
|
3589
|
+
}
|
|
3590
|
+
if (stat5.isDirectory()) walk(path, depth + 1);
|
|
3591
|
+
else if ((stat5.isFile() || stat5.isSymbolicLink()) && name.toLowerCase().endsWith(".md"))
|
|
3592
|
+
found.push(path);
|
|
3593
|
+
}
|
|
3594
|
+
}, "walk");
|
|
3595
|
+
walk(directory, 0);
|
|
3596
|
+
if (found.length > MAX_RULE_FILES) {
|
|
3597
|
+
collector.skipped.push({
|
|
3598
|
+
path: directory,
|
|
3599
|
+
reason: `it holds more than ${MAX_RULE_FILES} rule files, and only the first ${MAX_RULE_FILES} were read`
|
|
3600
|
+
});
|
|
3601
|
+
return found.slice(0, MAX_RULE_FILES);
|
|
3602
|
+
}
|
|
3603
|
+
return found;
|
|
3604
|
+
}
|
|
3605
|
+
__name(listRuleFiles, "listRuleFiles");
|
|
3606
|
+
function newCollector(options, matchBase) {
|
|
3607
|
+
return {
|
|
3608
|
+
roots: options.roots,
|
|
3609
|
+
touched: options.touched ?? [],
|
|
3610
|
+
matchBase,
|
|
3611
|
+
processed: /* @__PURE__ */ new Set(),
|
|
3612
|
+
files: [],
|
|
3613
|
+
skipped: []
|
|
3614
|
+
};
|
|
3615
|
+
}
|
|
3616
|
+
__name(newCollector, "newCollector");
|
|
3617
|
+
function loadScopeInstructions(directory, options) {
|
|
3618
|
+
const collector = newCollector(options, options.matchBase ?? directory);
|
|
3619
|
+
addTopLevel(collector, join3(directory, INSTRUCTIONS_FILENAME), "project", directory, false);
|
|
3620
|
+
for (const rule of listRuleFiles(join3(directory, RULES_DIRECTORY), collector)) {
|
|
3621
|
+
addTopLevel(collector, rule, "rule", directory, true);
|
|
3622
|
+
}
|
|
3623
|
+
addTopLevel(collector, join3(directory, LOCAL_INSTRUCTIONS_FILENAME), "local", directory, false);
|
|
3624
|
+
return { files: collector.files, skipped: collector.skipped };
|
|
3625
|
+
}
|
|
3626
|
+
__name(loadScopeInstructions, "loadScopeInstructions");
|
|
3627
|
+
function loadUserInstructions(namzuHome, options = {}) {
|
|
3628
|
+
const roots = [namzuHome, homedir()];
|
|
3629
|
+
const collector = newCollector({ ...options, roots }, options.matchBase ?? namzuHome);
|
|
3630
|
+
addTopLevel(collector, join3(namzuHome, INSTRUCTIONS_FILENAME), "user", void 0, false);
|
|
3631
|
+
for (const rule of listRuleFiles(join3(namzuHome, "rules"), collector)) {
|
|
3632
|
+
addTopLevel(collector, rule, "user", void 0, true);
|
|
3633
|
+
}
|
|
3634
|
+
return { files: collector.files, skipped: collector.skipped };
|
|
3635
|
+
}
|
|
3636
|
+
__name(loadUserInstructions, "loadUserInstructions");
|
|
3637
|
+
function userInstructionHome() {
|
|
3638
|
+
try {
|
|
3639
|
+
return resolveNamzuHome();
|
|
3640
|
+
} catch {
|
|
3641
|
+
return null;
|
|
3642
|
+
}
|
|
3643
|
+
}
|
|
3644
|
+
__name(userInstructionHome, "userInstructionHome");
|
|
3645
|
+
|
|
3347
3646
|
// src/context/project-tracker.ts
|
|
3348
3647
|
var MAX_TOTAL_PROJECT_INSTRUCTION_CHARS = 256e3;
|
|
3648
|
+
function emptyScope(directory) {
|
|
3649
|
+
return { directory, files: [], skipped: [] };
|
|
3650
|
+
}
|
|
3651
|
+
__name(emptyScope, "emptyScope");
|
|
3349
3652
|
function canonicalRoot(path) {
|
|
3350
3653
|
try {
|
|
3351
|
-
return
|
|
3654
|
+
return realpathSync2(path);
|
|
3352
3655
|
} catch {
|
|
3353
|
-
return
|
|
3656
|
+
return resolve6(path);
|
|
3354
3657
|
}
|
|
3355
3658
|
}
|
|
3356
3659
|
__name(canonicalRoot, "canonicalRoot");
|
|
3357
3660
|
function contained(root, candidate) {
|
|
3358
|
-
const rel =
|
|
3359
|
-
return rel === "" || !isAbsolute5(rel) && rel !== ".." && !rel.startsWith(`..${
|
|
3661
|
+
const rel = relative5(root, candidate);
|
|
3662
|
+
return rel === "" || !isAbsolute5(rel) && rel !== ".." && !rel.startsWith(`..${sep3}`);
|
|
3360
3663
|
}
|
|
3361
3664
|
__name(contained, "contained");
|
|
3362
3665
|
function relativeInstructionPath(root, file) {
|
|
3363
|
-
return
|
|
3666
|
+
return relative5(root, file).split(sep3).join("/");
|
|
3364
3667
|
}
|
|
3365
3668
|
__name(relativeInstructionPath, "relativeInstructionPath");
|
|
3366
|
-
function
|
|
3367
|
-
const rel =
|
|
3368
|
-
return rel === "" ? 0 : rel.split(
|
|
3669
|
+
function directoryDepth(root, directory) {
|
|
3670
|
+
const rel = relative5(root, directory);
|
|
3671
|
+
return rel === "" ? 0 : rel.split(sep3).length;
|
|
3369
3672
|
}
|
|
3370
|
-
__name(
|
|
3673
|
+
__name(directoryDepth, "directoryDepth");
|
|
3674
|
+
function displayPath2(root, path) {
|
|
3675
|
+
if (contained(root, path)) return relativeInstructionPath(root, path);
|
|
3676
|
+
const home = homedir2();
|
|
3677
|
+
return contained(home, path) ? `~/${relativeInstructionPath(home, path)}` : path;
|
|
3678
|
+
}
|
|
3679
|
+
__name(displayPath2, "displayPath");
|
|
3371
3680
|
function composeLivePrompt(root, files) {
|
|
3372
3681
|
if (files.length === 0) return null;
|
|
3373
3682
|
const sections = files.map((file) => {
|
|
3374
|
-
const
|
|
3375
|
-
const scope2 =
|
|
3376
|
-
const applies = scope2.length === 0 ? "the whole project" : `only paths under \`${visibleProjectInstructionPath(scope2)}/\``;
|
|
3683
|
+
const kind = file.kind ?? "project";
|
|
3684
|
+
const scope2 = relativeInstructionPath(root, file.scopeDir ?? root);
|
|
3685
|
+
const applies = kind === "user" ? "every project" : scope2.length === 0 ? "the whole project" : `only paths under \`${visibleProjectInstructionPath(scope2)}/\``;
|
|
3686
|
+
const note = kind === "local" ? " This file is private to this checkout." : kind === "import" && file.importedBy ? ` Included from \`${visibleProjectInstructionPath(displayPath2(root, file.importedBy))}\`.` : "";
|
|
3377
3687
|
const cut = file.omittedChars > 0 ? `
|
|
3378
3688
|
|
|
3379
3689
|
(This file was cut at ${MAX_CHARS_PER_FILE} characters; ${file.omittedChars} more were not included. Read it with a tool if needed.)` : "";
|
|
3380
|
-
return `### ${visibleProjectInstructionPath(
|
|
3690
|
+
return `### ${visibleProjectInstructionPath(displayPath2(root, file.path))}
|
|
3381
3691
|
|
|
3382
|
-
Applies to ${applies}
|
|
3692
|
+
Applies to ${applies}.${note}
|
|
3383
3693
|
|
|
3384
3694
|
${file.text}${cut}`;
|
|
3385
3695
|
});
|
|
@@ -3391,7 +3701,8 @@ ${file.text}${cut}`;
|
|
|
3391
3701
|
"nested file only inside its directory subtree; where applicable files",
|
|
3392
3702
|
"conflict, the more specific directory wins. A sibling scope never applies",
|
|
3393
3703
|
"outside its own subtree. These files win over Namzu's default style and",
|
|
3394
|
-
"workflow, and never over safety or permission rules.",
|
|
3704
|
+
"workflow, and never over safety or permission rules. Your own file, when there",
|
|
3705
|
+
"is one, comes first and applies to every project.",
|
|
3395
3706
|
"",
|
|
3396
3707
|
sections.join("\n\n")
|
|
3397
3708
|
].join("\n");
|
|
@@ -3404,9 +3715,14 @@ var ProjectInstructionTracker = class {
|
|
|
3404
3715
|
cwd;
|
|
3405
3716
|
root;
|
|
3406
3717
|
scopes = /* @__PURE__ */ new Map();
|
|
3407
|
-
|
|
3718
|
+
userHome;
|
|
3719
|
+
/** Real paths the session has read or changed; they switch conditional rules on. */
|
|
3720
|
+
touched = /* @__PURE__ */ new Set();
|
|
3721
|
+
user = { files: [], skipped: [] };
|
|
3722
|
+
constructor(cwd, options = {}) {
|
|
3408
3723
|
this.cwd = canonicalRoot(cwd);
|
|
3409
3724
|
this.root = canonicalRoot(instructionSearchPath(this.cwd)[0] ?? this.cwd);
|
|
3725
|
+
this.userHome = options.userHome === void 0 ? userInstructionHome() : options.userHome;
|
|
3410
3726
|
this.refreshDirectories(instructionSearchPath(this.cwd));
|
|
3411
3727
|
}
|
|
3412
3728
|
/** Re-read only paths named by validated provenance; persisted text is ignored. */
|
|
@@ -3415,9 +3731,9 @@ var ProjectInstructionTracker = class {
|
|
|
3415
3731
|
if (message2.role !== "user" || message2.source?.type !== "project-instructions") continue;
|
|
3416
3732
|
if (!isProjectInstructionMessageSource(message2.source)) continue;
|
|
3417
3733
|
for (const file of message2.source.files) {
|
|
3418
|
-
const absolute =
|
|
3734
|
+
const absolute = resolve6(this.root, file);
|
|
3419
3735
|
if (!contained(this.root, absolute)) continue;
|
|
3420
|
-
this.registerPath(
|
|
3736
|
+
this.registerPath(dirname3(absolute));
|
|
3421
3737
|
}
|
|
3422
3738
|
}
|
|
3423
3739
|
this.refreshDirectories(this.scopes.keys());
|
|
@@ -3438,8 +3754,9 @@ var ProjectInstructionTracker = class {
|
|
|
3438
3754
|
}, "observeToolResult")
|
|
3439
3755
|
};
|
|
3440
3756
|
}
|
|
3757
|
+
/** The files the person can edit; an included file is part of its includer. */
|
|
3441
3758
|
get instructionFiles() {
|
|
3442
|
-
return this.view().files.map((file) => file.path);
|
|
3759
|
+
return this.view().files.filter((file) => file.kind !== "import").map((file) => file.path);
|
|
3443
3760
|
}
|
|
3444
3761
|
get skippedInstructionFiles() {
|
|
3445
3762
|
return this.view().skipped;
|
|
@@ -3452,88 +3769,100 @@ var ProjectInstructionTracker = class {
|
|
|
3452
3769
|
return;
|
|
3453
3770
|
}
|
|
3454
3771
|
const rawPath = observation.input.path;
|
|
3455
|
-
const lexical =
|
|
3772
|
+
const lexical = resolve6(this.cwd, rawPath);
|
|
3456
3773
|
let target;
|
|
3457
3774
|
try {
|
|
3458
|
-
target =
|
|
3775
|
+
target = realpathSync2(lexical);
|
|
3459
3776
|
} catch {
|
|
3460
3777
|
return;
|
|
3461
3778
|
}
|
|
3462
3779
|
if (!contained(this.root, target)) return;
|
|
3463
|
-
this.
|
|
3780
|
+
this.touched.add(target);
|
|
3781
|
+
this.registerPath(dirname3(target));
|
|
3464
3782
|
this.refreshDirectories(this.scopes.keys());
|
|
3465
3783
|
}
|
|
3466
3784
|
registerPath(directory) {
|
|
3467
|
-
const target =
|
|
3785
|
+
const target = resolve6(directory);
|
|
3468
3786
|
if (!contained(this.root, target)) return;
|
|
3469
|
-
const rel =
|
|
3787
|
+
const rel = relative5(this.root, target);
|
|
3470
3788
|
let current = this.root;
|
|
3471
|
-
if (!this.scopes.has(current)) this.scopes.set(current,
|
|
3789
|
+
if (!this.scopes.has(current)) this.scopes.set(current, emptyScope(current));
|
|
3472
3790
|
if (rel === "") return;
|
|
3473
|
-
for (const part of rel.split(
|
|
3474
|
-
current =
|
|
3475
|
-
if (!this.scopes.has(current)) this.scopes.set(current,
|
|
3791
|
+
for (const part of rel.split(sep3)) {
|
|
3792
|
+
current = join4(current, part);
|
|
3793
|
+
if (!this.scopes.has(current)) this.scopes.set(current, emptyScope(current));
|
|
3476
3794
|
}
|
|
3477
3795
|
}
|
|
3478
3796
|
refreshDirectories(directories) {
|
|
3797
|
+
const touched = [...this.touched];
|
|
3798
|
+
this.user = this.userHome === null ? { files: [], skipped: [] } : loadUserInstructions(this.userHome, { touched, matchBase: this.root });
|
|
3479
3799
|
for (const directory of [...directories]) {
|
|
3480
3800
|
this.registerPath(directory);
|
|
3481
|
-
const loaded =
|
|
3482
|
-
const expected = join3(directory, INSTRUCTIONS_FILENAME);
|
|
3483
|
-
const file = loaded.files.find((candidate) => candidate.path === expected);
|
|
3484
|
-
const skipped = loaded.skipped.find((candidate) => candidate.path === expected);
|
|
3801
|
+
const loaded = loadScopeInstructions(directory, { roots: [this.root], touched });
|
|
3485
3802
|
this.scopes.set(directory, {
|
|
3486
3803
|
directory,
|
|
3487
|
-
|
|
3488
|
-
|
|
3804
|
+
files: loaded.files,
|
|
3805
|
+
skipped: loaded.skipped
|
|
3489
3806
|
});
|
|
3490
3807
|
}
|
|
3491
3808
|
}
|
|
3492
3809
|
view() {
|
|
3493
|
-
const
|
|
3494
|
-
const
|
|
3495
|
-
const
|
|
3496
|
-
|
|
3810
|
+
const scopes = [...this.scopes.values()];
|
|
3811
|
+
const bundles = scopes.filter((scope2) => scope2.files.length > 0).map((scope2) => ({ directory: scope2.directory, files: scope2.files }));
|
|
3812
|
+
const userBundle = this.user.files.length > 0 ? { directory: null, files: this.user.files } : null;
|
|
3813
|
+
const rootBundle = bundles.find((bundle) => bundle.directory === this.root);
|
|
3814
|
+
const candidates = bundles.filter((bundle) => bundle !== rootBundle).sort(
|
|
3815
|
+
(a, b) => directoryDepth(this.root, b.directory ?? this.root) - directoryDepth(this.root, a.directory ?? this.root) || (a.directory ?? "").localeCompare(b.directory ?? "")
|
|
3497
3816
|
);
|
|
3498
3817
|
const selected = [];
|
|
3499
3818
|
let used = 0;
|
|
3500
|
-
const skipped = [...
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3819
|
+
const skipped = [...scopes.flatMap((scope2) => scope2.skipped), ...this.user.skipped];
|
|
3820
|
+
const sourcePath = /* @__PURE__ */ __name((bundle) => bundle.directory === null || bundle.directory === this.root ? INSTRUCTIONS_FILENAME : `${relativeInstructionPath(this.root, bundle.directory)}/${INSTRUCTIONS_FILENAME}`, "sourcePath");
|
|
3821
|
+
const order = [
|
|
3822
|
+
...userBundle ? [userBundle] : [],
|
|
3823
|
+
...rootBundle ? [rootBundle] : [],
|
|
3824
|
+
...candidates
|
|
3825
|
+
];
|
|
3826
|
+
for (const bundle of order) {
|
|
3827
|
+
const chars = bundle.files.reduce((sum, file) => sum + file.text.length, 0);
|
|
3828
|
+
const bundleName = sourcePath(bundle);
|
|
3829
|
+
if (!isProjectInstructionMessageSource({
|
|
3830
|
+
type: "project-instructions",
|
|
3831
|
+
files: [bundleName]
|
|
3832
|
+
})) {
|
|
3506
3833
|
skipped.push({
|
|
3507
|
-
path:
|
|
3834
|
+
path: join4(bundle.directory ?? this.root, INSTRUCTIONS_FILENAME),
|
|
3508
3835
|
reason: "its project-relative provenance is not a canonical bounded AGENTS.md path"
|
|
3509
3836
|
});
|
|
3510
3837
|
continue;
|
|
3511
3838
|
}
|
|
3512
|
-
if (selected.length >= MAX_PROJECT_INSTRUCTION_SOURCE_FILES || used +
|
|
3839
|
+
if (selected.length >= MAX_PROJECT_INSTRUCTION_SOURCE_FILES || used + chars > MAX_TOTAL_PROJECT_INSTRUCTION_CHARS) {
|
|
3513
3840
|
skipped.push({
|
|
3514
|
-
path:
|
|
3841
|
+
path: join4(bundle.directory ?? this.root, INSTRUCTIONS_FILENAME),
|
|
3515
3842
|
reason: `the live project-instruction snapshot is limited to ${MAX_TOTAL_PROJECT_INSTRUCTION_CHARS} characters and ${MAX_PROJECT_INSTRUCTION_SOURCE_FILES} files`
|
|
3516
3843
|
});
|
|
3517
3844
|
continue;
|
|
3518
3845
|
}
|
|
3519
|
-
selected.push(
|
|
3520
|
-
used +=
|
|
3846
|
+
selected.push(bundle);
|
|
3847
|
+
used += chars;
|
|
3521
3848
|
}
|
|
3522
|
-
selected.sort(
|
|
3523
|
-
(a
|
|
3524
|
-
|
|
3849
|
+
selected.sort((a, b) => {
|
|
3850
|
+
if (a.directory === null || b.directory === null) {
|
|
3851
|
+
return a.directory === b.directory ? 0 : a.directory === null ? -1 : 1;
|
|
3852
|
+
}
|
|
3853
|
+
return directoryDepth(this.root, a.directory) - directoryDepth(this.root, b.directory) || a.directory.localeCompare(b.directory);
|
|
3854
|
+
});
|
|
3855
|
+
const sources = [...new Set(selected.map(sourcePath))];
|
|
3525
3856
|
return {
|
|
3526
|
-
files: selected,
|
|
3527
|
-
skipped: skipped.sort((a, b) => a.path.localeCompare(b.path))
|
|
3857
|
+
files: selected.flatMap((bundle) => bundle.files),
|
|
3858
|
+
skipped: skipped.sort((a, b) => a.path.localeCompare(b.path)),
|
|
3859
|
+
sources
|
|
3528
3860
|
};
|
|
3529
3861
|
}
|
|
3530
3862
|
snapshot() {
|
|
3531
|
-
const { files } = this.view();
|
|
3863
|
+
const { files, sources } = this.view();
|
|
3532
3864
|
const prompt = composeLivePrompt(this.root, files);
|
|
3533
|
-
return prompt ? createProjectInstructionMessage(
|
|
3534
|
-
prompt,
|
|
3535
|
-
files.map((file) => relativeInstructionPath(this.root, file.path))
|
|
3536
|
-
) : null;
|
|
3865
|
+
return prompt ? createProjectInstructionMessage(prompt, sources) : null;
|
|
3537
3866
|
}
|
|
3538
3867
|
snapshotKey(snapshot) {
|
|
3539
3868
|
return snapshot ? JSON.stringify([
|
|
@@ -3604,7 +3933,7 @@ __name(sandboxResolvedSeverity, "sandboxResolvedSeverity");
|
|
|
3604
3933
|
|
|
3605
3934
|
// src/integrations/sessions/conversation-search.ts
|
|
3606
3935
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
3607
|
-
import { resolve as
|
|
3936
|
+
import { resolve as resolve7 } from "node:path";
|
|
3608
3937
|
|
|
3609
3938
|
// src/integrations/sessions/evidence-page-validation.ts
|
|
3610
3939
|
var integer = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0, "integer");
|
|
@@ -3651,7 +3980,7 @@ __name(assertEvidenceReadPage, "assertEvidenceReadPage");
|
|
|
3651
3980
|
// src/integrations/sessions/conversation-search.ts
|
|
3652
3981
|
var CONVERSATION_RETRIEVAL_TOOLS = ["read_conversation", "search_conversation"];
|
|
3653
3982
|
var CONVERSATION_EVIDENCE_GUIDANCE = `## Conversation evidence
|
|
3654
|
-
When a question asks about an earlier observation, use the evidence already in context. If the detail is missing or clipped, use search_conversation to locate the original recorded output, then read_conversation for exact text beyond an excerpt. Pass a supplied recall continuation's cursor to search_conversation to continue from the scan's existing position. This works before compaction as well as after compaction or restart, within this conversation only. New searches omit successful search_conversation/read_conversation outputs, which repeat earlier records. To inspect those outputs themselves, start a new search with includeRetrievalResults=true. excerptComplete=true means the entire full-retained text part is already shown: reading the same unchanged part adds no text or independent evidence. False or absent means partial or unknown. This does not establish the truth of a prior claim or exhaust the conversation.
|
|
3983
|
+
When a question asks about an earlier observation, use the evidence already in context. Before you investigate an error again, search this conversation for a short phrase from it, because an earlier turn may already hold the cause or the fix and finding it saves repeating the work. If the detail is missing or clipped, use search_conversation to locate the original recorded output, then read_conversation for exact text beyond an excerpt. Pass a supplied recall continuation's cursor to search_conversation to continue from the scan's existing position. This works before compaction as well as after compaction or restart, within this conversation only. New searches omit successful search_conversation/read_conversation outputs, which repeat earlier records. To inspect those outputs themselves, start a new search with includeRetrievalResults=true. excerptComplete=true means the entire full-retained text part is already shown: reading the same unchanged part adds no text or independent evidence. False or absent means partial or unknown. In recalled evidence, each \`visibleEvidence\` item holds a \`textQuote\` (a short exact match from text already in your context), the \`recordKind\` of the record it came from, the \`toolName\` that produced it and \`isError\` (whether that call failed); \`omittedVisibleEvidence\` counts quotes left out, and \`excerptGuidance\`, \`recordKindGuidance\` and \`visibleEvidenceGuidance\` are notes on reading these fields. This does not establish the truth of a prior claim or exhaust the conversation.
|
|
3655
3984
|
A path following "The full output was written to:" is a file of this conversation's own retained output. Open it with the read tool when that tool is available (offset and limit page through it); for anything else from earlier, use search_conversation and read_conversation, which verify ownership and retained-byte integrity. Do not use bash or grep to get around a workspace-path refusal when recovering archived output.
|
|
3656
3985
|
recordedAt is the event recorder\u2019s wall-clock time in Unix milliseconds, not the time its text became true. For compaction_shed it dates the copy, not the original observation. compaction_shed:summary identifies derived summary text, not an independent observation. Missing stamps stay unknown; clocks can move backwards or differ. seq orders the records of this conversation's log; it is not a clock.
|
|
3657
3986
|
For what a file contained earlier, recover its earlier observation; reading or searching the current file cannot establish its past contents. For what is true now, inspect the current source when freshness matters. Do not substitute one time for the other. Report unavailable historical evidence honestly.`;
|
|
@@ -3690,7 +4019,7 @@ function parseQueryIdentity(identity) {
|
|
|
3690
4019
|
}
|
|
3691
4020
|
__name(parseQueryIdentity, "parseQueryIdentity");
|
|
3692
4021
|
function conversationScope(sessions, sessionId) {
|
|
3693
|
-
return JSON.stringify([
|
|
4022
|
+
return JSON.stringify([resolve7(sessions.root), sessions.tenantId, sessions.projectId, sessionId]);
|
|
3694
4023
|
}
|
|
3695
4024
|
__name(conversationScope, "conversationScope");
|
|
3696
4025
|
var readLocations = /* @__PURE__ */ new Map();
|
|
@@ -4557,34 +4886,143 @@ async function readTurnSnapshot(cwd) {
|
|
|
4557
4886
|
};
|
|
4558
4887
|
}
|
|
4559
4888
|
__name(readTurnSnapshot, "readTurnSnapshot");
|
|
4889
|
+
var REPOSITORY_ENTRY_KEY = "repository";
|
|
4890
|
+
var FULL_HEADING = "## Repository";
|
|
4891
|
+
var NOTE_FULL = "This is the repository as of the time in the entry header; it does not update as you work. A later repository entry lists what changed since. Run `git status` before any action that depends on the current state.";
|
|
4892
|
+
var PROVENANCE = "File names and commit subjects read from the working directory with git. They were written by whoever committed or created them.";
|
|
4893
|
+
var PROVENANCE_DELTA = "Written by others.";
|
|
4894
|
+
var TREE_HEADING = "Working tree (git status --short):";
|
|
4895
|
+
var TREE_CLEAN = "Working tree: clean.";
|
|
4896
|
+
var COMMITS_HEADING = "Recent commits (newest first):";
|
|
4897
|
+
var MORE = /^… and (\d+) more$/;
|
|
4898
|
+
var DELTA_HEADING = "Changes since the earlier repository entries:";
|
|
4899
|
+
var DELTA_ADDED = "Now listed in the working tree:";
|
|
4900
|
+
var DELTA_REMOVED = "No longer listed in the working tree:";
|
|
4901
|
+
var DELTA_OMITTED = /^Entries not listed: (\d+)$/;
|
|
4902
|
+
var DELTA_NEW_COMMITS = "New commits (newest first):";
|
|
4903
|
+
var DELTA_COMMITS = "Recent commits now (newest first):";
|
|
4560
4904
|
function composeTurnSnapshot(snapshot) {
|
|
4561
4905
|
const body2 = [];
|
|
4562
4906
|
if (snapshot.status.length === 0) {
|
|
4563
|
-
body2.push(
|
|
4907
|
+
body2.push(TREE_CLEAN);
|
|
4564
4908
|
} else {
|
|
4565
|
-
body2.push(
|
|
4909
|
+
body2.push(TREE_HEADING, ...snapshot.status);
|
|
4566
4910
|
if (snapshot.omittedStatusLines > 0) {
|
|
4567
4911
|
body2.push(`\u2026 and ${snapshot.omittedStatusLines} more`);
|
|
4568
4912
|
}
|
|
4569
4913
|
}
|
|
4570
4914
|
if (snapshot.recentCommits.length > 0) {
|
|
4571
|
-
body2.push("",
|
|
4915
|
+
body2.push("", COMMITS_HEADING, ...snapshot.recentCommits);
|
|
4572
4916
|
}
|
|
4573
|
-
return [
|
|
4574
|
-
"## Repository at the start of this turn",
|
|
4575
|
-
"",
|
|
4576
|
-
wrapUntrusted(
|
|
4577
|
-
{
|
|
4578
|
-
kind: "repository-snapshot",
|
|
4579
|
-
provenance: "File names and commit subjects read from the working directory with git. They were written by whoever committed or created them."
|
|
4580
|
-
},
|
|
4581
|
-
body2.join("\n")
|
|
4582
|
-
),
|
|
4583
|
-
"",
|
|
4584
|
-
"This is a snapshot from when the turn started; it does not update as you work. Run `git status` before any action that depends on the current state."
|
|
4585
|
-
].join("\n");
|
|
4917
|
+
return [FULL_HEADING, "", wrap(body2), "", NOTE_FULL].join("\n");
|
|
4586
4918
|
}
|
|
4587
4919
|
__name(composeTurnSnapshot, "composeTurnSnapshot");
|
|
4920
|
+
function wrap(body2, delta = false) {
|
|
4921
|
+
return wrapUntrusted(
|
|
4922
|
+
{
|
|
4923
|
+
kind: "repository-snapshot",
|
|
4924
|
+
provenance: delta ? PROVENANCE_DELTA : PROVENANCE
|
|
4925
|
+
},
|
|
4926
|
+
body2.join("\n"),
|
|
4927
|
+
{ brief: delta }
|
|
4928
|
+
);
|
|
4929
|
+
}
|
|
4930
|
+
__name(wrap, "wrap");
|
|
4931
|
+
var neutral = /* @__PURE__ */ __name((line) => line.replace(/namzu-untrusted/gi, "namzu_untrusted"), "neutral");
|
|
4932
|
+
function envelopeLines(entry) {
|
|
4933
|
+
const lines = entry.split("\n");
|
|
4934
|
+
const open3 = lines.findIndex(
|
|
4935
|
+
(line) => /^<namzu-untrusted-[0-9a-f]+ kind="repository-snapshot"/.test(line)
|
|
4936
|
+
);
|
|
4937
|
+
if (open3 < 0) return null;
|
|
4938
|
+
const close = lines.findIndex(
|
|
4939
|
+
(line, index) => index > open3 && /^<\/namzu-untrusted-[0-9a-f]+>$/.test(line)
|
|
4940
|
+
);
|
|
4941
|
+
if (close < 0) return null;
|
|
4942
|
+
const blank = lines.findIndex((line, index) => index > open3 && line === "");
|
|
4943
|
+
if (blank < 0 || blank > close) return null;
|
|
4944
|
+
return lines.slice(blank + 1, close);
|
|
4945
|
+
}
|
|
4946
|
+
__name(envelopeLines, "envelopeLines");
|
|
4947
|
+
function apply(known, entry) {
|
|
4948
|
+
const lines = envelopeLines(entry);
|
|
4949
|
+
if (!lines) return null;
|
|
4950
|
+
const whole = !lines.includes(DELTA_HEADING);
|
|
4951
|
+
if (!whole && !known) return null;
|
|
4952
|
+
const next = whole || !known ? { status: /* @__PURE__ */ new Set(), omitted: 0, commits: [] } : { status: new Set(known.status), omitted: known.omitted, commits: [...known.commits] };
|
|
4953
|
+
let section = "none";
|
|
4954
|
+
const newCommits = [];
|
|
4955
|
+
let replaced = null;
|
|
4956
|
+
for (const line of lines) {
|
|
4957
|
+
if (line === "" || line === DELTA_HEADING || line === TREE_CLEAN) section = "none";
|
|
4958
|
+
else if (line === TREE_HEADING) section = "tree";
|
|
4959
|
+
else if (line === DELTA_ADDED) section = "added";
|
|
4960
|
+
else if (line === DELTA_REMOVED) section = "removed";
|
|
4961
|
+
else if (line === COMMITS_HEADING) section = "commits";
|
|
4962
|
+
else if (line === DELTA_COMMITS) {
|
|
4963
|
+
section = "commits";
|
|
4964
|
+
replaced = [];
|
|
4965
|
+
} else if (line === DELTA_NEW_COMMITS) section = "newCommits";
|
|
4966
|
+
else if (MORE.test(line) || DELTA_OMITTED.test(line)) {
|
|
4967
|
+
next.omitted = Number((MORE.exec(line) ?? DELTA_OMITTED.exec(line))?.[1] ?? 0);
|
|
4968
|
+
section = "none";
|
|
4969
|
+
} else if (section === "tree" || section === "added") next.status.add(line);
|
|
4970
|
+
else if (section === "removed") next.status.delete(line);
|
|
4971
|
+
else if (section === "commits") {
|
|
4972
|
+
if (replaced) replaced.push(line);
|
|
4973
|
+
else next.commits.push(line);
|
|
4974
|
+
} else if (section === "newCommits") newCommits.push(line);
|
|
4975
|
+
}
|
|
4976
|
+
if (replaced) next.commits = replaced;
|
|
4977
|
+
else if (newCommits.length > 0) next.commits = [...newCommits, ...next.commits];
|
|
4978
|
+
return next;
|
|
4979
|
+
}
|
|
4980
|
+
__name(apply, "apply");
|
|
4981
|
+
function knownFrom(entries) {
|
|
4982
|
+
let known = null;
|
|
4983
|
+
for (const entry of entries) {
|
|
4984
|
+
known = apply(known, entry);
|
|
4985
|
+
if (known === null) return null;
|
|
4986
|
+
}
|
|
4987
|
+
return known;
|
|
4988
|
+
}
|
|
4989
|
+
__name(knownFrom, "knownFrom");
|
|
4990
|
+
function composeSnapshotEntry(earlier, snapshot) {
|
|
4991
|
+
const full = composeTurnSnapshot(snapshot);
|
|
4992
|
+
const known = knownFrom(earlier);
|
|
4993
|
+
if (!known) return full;
|
|
4994
|
+
const status = snapshot.status.map(neutral);
|
|
4995
|
+
const commits = snapshot.recentCommits.map(neutral);
|
|
4996
|
+
const now = new Set(status);
|
|
4997
|
+
const added = status.filter((line) => !known.status.has(line));
|
|
4998
|
+
const removed = [...known.status].filter((line) => !now.has(line));
|
|
4999
|
+
const omittedChanged = snapshot.omittedStatusLines !== known.omitted;
|
|
5000
|
+
const sameCommits = commits.length === known.commits.length && commits.every((c, i) => c === known.commits[i]);
|
|
5001
|
+
if (added.length === 0 && removed.length === 0 && !omittedChanged && sameCommits) return null;
|
|
5002
|
+
const body2 = [DELTA_HEADING];
|
|
5003
|
+
if (added.length > 0)
|
|
5004
|
+
body2.push(DELTA_ADDED, ...snapshot.status.filter((l) => added.includes(neutral(l))));
|
|
5005
|
+
if (removed.length > 0) body2.push(DELTA_REMOVED, ...removed);
|
|
5006
|
+
if (omittedChanged) body2.push(`Entries not listed: ${snapshot.omittedStatusLines}`);
|
|
5007
|
+
if (!sameCommits) {
|
|
5008
|
+
const fresh = commits.findIndex(
|
|
5009
|
+
(_, i) => known.commits.length >= commits.length - i && known.commits.slice(0, commits.length - i).every((c, j) => c === commits[i + j])
|
|
5010
|
+
);
|
|
5011
|
+
if (fresh > 0) body2.push(DELTA_NEW_COMMITS, ...snapshot.recentCommits.slice(0, fresh));
|
|
5012
|
+
else body2.push(DELTA_COMMITS, ...snapshot.recentCommits);
|
|
5013
|
+
}
|
|
5014
|
+
const delta = wrap(body2, true);
|
|
5015
|
+
return delta.length < full.length ? delta : full;
|
|
5016
|
+
}
|
|
5017
|
+
__name(composeSnapshotEntry, "composeSnapshotEntry");
|
|
5018
|
+
function createRepositorySnapshotStep(snapshot) {
|
|
5019
|
+
return ({ messages }) => {
|
|
5020
|
+
if (!snapshot) return void 0;
|
|
5021
|
+
const text2 = composeSnapshotEntry(turnContextEntries(messages, REPOSITORY_ENTRY_KEY), snapshot);
|
|
5022
|
+
return text2 ? { recordedContext: [{ key: REPOSITORY_ENTRY_KEY, text: text2 }] } : void 0;
|
|
5023
|
+
};
|
|
5024
|
+
}
|
|
5025
|
+
__name(createRepositorySnapshotStep, "createRepositorySnapshotStep");
|
|
4588
5026
|
|
|
4589
5027
|
// ../decision/dist/contract.js
|
|
4590
5028
|
var DecisionError = class extends Error {
|
|
@@ -5110,19 +5548,19 @@ function createBackgroundLearning(options) {
|
|
|
5110
5548
|
const release = /* @__PURE__ */ __name(() => {
|
|
5111
5549
|
const ready = waiters;
|
|
5112
5550
|
waiters = [];
|
|
5113
|
-
for (const
|
|
5551
|
+
for (const resolve15 of ready) resolve15();
|
|
5114
5552
|
}, "release");
|
|
5115
5553
|
const quiet = /* @__PURE__ */ __name(() => active === 0 && !options.questions?.isOpen(), "quiet");
|
|
5116
|
-
const untilIdle = /* @__PURE__ */ __name((signal) => new Promise((
|
|
5554
|
+
const untilIdle = /* @__PURE__ */ __name((signal) => new Promise((resolve15, reject) => {
|
|
5117
5555
|
if (signal.aborted) return reject(signal.reason);
|
|
5118
|
-
if (quiet()) return
|
|
5556
|
+
if (quiet()) return resolve15();
|
|
5119
5557
|
const onAbort = /* @__PURE__ */ __name(() => {
|
|
5120
5558
|
waiters = waiters.filter((w) => w !== done);
|
|
5121
5559
|
reject(signal.reason);
|
|
5122
5560
|
}, "onAbort");
|
|
5123
5561
|
const done = /* @__PURE__ */ __name(() => {
|
|
5124
5562
|
signal.removeEventListener("abort", onAbort);
|
|
5125
|
-
|
|
5563
|
+
resolve15();
|
|
5126
5564
|
}, "done");
|
|
5127
5565
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
5128
5566
|
waiters.push(done);
|
|
@@ -5390,6 +5828,29 @@ __name(createMonitorInbox, "createMonitorInbox");
|
|
|
5390
5828
|
// src/integrations/monitors/web-access-hint.ts
|
|
5391
5829
|
var MONITOR_WEB_ACCESS_HINT = "To allow it, set `web.fetch: true` in the Namzu config file (~/.namzu/config.yaml); it cannot be switched on from the environment.";
|
|
5392
5830
|
|
|
5831
|
+
// src/integrations/plugins/hook-host.ts
|
|
5832
|
+
function hookPermissionMode(mode) {
|
|
5833
|
+
switch (mode) {
|
|
5834
|
+
case "accept-edits":
|
|
5835
|
+
return "acceptEdits";
|
|
5836
|
+
case "plan":
|
|
5837
|
+
return "plan";
|
|
5838
|
+
case "bypass":
|
|
5839
|
+
return "bypassPermissions";
|
|
5840
|
+
case "auto":
|
|
5841
|
+
return "bypassPermissions";
|
|
5842
|
+
case "classify":
|
|
5843
|
+
return "auto";
|
|
5844
|
+
default:
|
|
5845
|
+
return "default";
|
|
5846
|
+
}
|
|
5847
|
+
}
|
|
5848
|
+
__name(hookPermissionMode, "hookPermissionMode");
|
|
5849
|
+
function hookSessionMode(live, configured) {
|
|
5850
|
+
return hookPermissionMode(live ?? configured ?? "prompt");
|
|
5851
|
+
}
|
|
5852
|
+
__name(hookSessionMode, "hookSessionMode");
|
|
5853
|
+
|
|
5393
5854
|
// src/integrations/plugins/settings.ts
|
|
5394
5855
|
import { createHash as createHash3, randomUUID as randomUUID3 } from "node:crypto";
|
|
5395
5856
|
import {
|
|
@@ -5397,19 +5858,19 @@ import {
|
|
|
5397
5858
|
closeSync,
|
|
5398
5859
|
fstatSync,
|
|
5399
5860
|
fsyncSync,
|
|
5400
|
-
lstatSync,
|
|
5861
|
+
lstatSync as lstatSync2,
|
|
5401
5862
|
openSync,
|
|
5402
5863
|
readSync,
|
|
5403
5864
|
renameSync,
|
|
5404
5865
|
unlinkSync,
|
|
5405
5866
|
writeFileSync
|
|
5406
5867
|
} from "node:fs";
|
|
5407
|
-
import { join as
|
|
5868
|
+
import { join as join5 } from "node:path";
|
|
5408
5869
|
var MAX_RECORD_BYTES = 64 * 1024;
|
|
5409
5870
|
var PluginSettingsStore = class {
|
|
5410
5871
|
constructor(home) {
|
|
5411
5872
|
this.home = home;
|
|
5412
|
-
this.directory =
|
|
5873
|
+
this.directory = join5(home, "plugin-settings");
|
|
5413
5874
|
}
|
|
5414
5875
|
home;
|
|
5415
5876
|
static {
|
|
@@ -5418,17 +5879,17 @@ var PluginSettingsStore = class {
|
|
|
5418
5879
|
directory;
|
|
5419
5880
|
path(plugin) {
|
|
5420
5881
|
const key = createHash3("sha256").update(JSON.stringify([plugin.rootDir, plugin.name])).digest("hex");
|
|
5421
|
-
return
|
|
5882
|
+
return join5(this.directory, `${key}.json`);
|
|
5422
5883
|
}
|
|
5423
5884
|
read(plugin) {
|
|
5424
5885
|
const path = this.path(plugin);
|
|
5425
5886
|
try {
|
|
5426
5887
|
try {
|
|
5427
|
-
const directory =
|
|
5888
|
+
const directory = lstatSync2(this.directory);
|
|
5428
5889
|
if (!directory.isDirectory() || directory.isSymbolicLink()) {
|
|
5429
5890
|
throw new Error("settings directory must be a real directory");
|
|
5430
5891
|
}
|
|
5431
|
-
const entry =
|
|
5892
|
+
const entry = lstatSync2(path);
|
|
5432
5893
|
if (!entry.isFile() || entry.isSymbolicLink()) {
|
|
5433
5894
|
throw new Error("setting must be a regular file");
|
|
5434
5895
|
}
|
|
@@ -5494,7 +5955,7 @@ function message(error) {
|
|
|
5494
5955
|
return error instanceof Error ? error.message : String(error);
|
|
5495
5956
|
}
|
|
5496
5957
|
__name(message, "message");
|
|
5497
|
-
async function createCliPluginRuntime(config, cwd, hooks) {
|
|
5958
|
+
async function createCliPluginRuntime(config, cwd, hooks, hookHost) {
|
|
5498
5959
|
const pluginsEnabled = config?.enabled === true;
|
|
5499
5960
|
const hookCount = hooks ? Object.values(hooks).reduce((n, list) => n + (list?.length ?? 0), 0) : 0;
|
|
5500
5961
|
if (!pluginsEnabled && hookCount === 0) return void 0;
|
|
@@ -5510,7 +5971,7 @@ async function createCliPluginRuntime(config, cwd, hooks) {
|
|
|
5510
5971
|
log,
|
|
5511
5972
|
...config?.hookTimeoutMs !== void 0 ? { hookTimeoutMs: config.hookTimeoutMs } : {}
|
|
5512
5973
|
});
|
|
5513
|
-
if (hooks && hookCount > 0) attachShellHooks(manager, hooks, { cwd, log });
|
|
5974
|
+
if (hooks && hookCount > 0) attachShellHooks(manager, hooks, { cwd, log, ...hookHost });
|
|
5514
5975
|
const allowedScopes = config?.allowedScopes ?? ["project", "user"];
|
|
5515
5976
|
const discovered = pluginsEnabled ? await discoverAllPluginDirs(cwd, {
|
|
5516
5977
|
enabled: true,
|
|
@@ -5875,11 +6336,12 @@ function advanceScan(scans, scan3, nextCursor, excerpts, hasDerivedSummaries, ca
|
|
|
5875
6336
|
}
|
|
5876
6337
|
__name(advanceScan, "advanceScan");
|
|
5877
6338
|
var RECALL_PAGES = 4;
|
|
5878
|
-
function createConversationEvidenceRecall(sessions, sessionId, assertOwner, resolveQuery = false) {
|
|
6339
|
+
function createConversationEvidenceRecall(sessions, sessionId, assertOwner, resolveQuery = false, record = false) {
|
|
5879
6340
|
const scope2 = { tenantId: sessions.tenantId, projectId: sessions.projectId, sessionId };
|
|
5880
6341
|
return createEvidenceRecallStep({
|
|
5881
6342
|
scope: scope2,
|
|
5882
6343
|
resolveQuery,
|
|
6344
|
+
record,
|
|
5883
6345
|
async retrieve(request) {
|
|
5884
6346
|
const { turnId, terms, signal, maxReadBytes, maxCandidates, captureSessionEvidence } = request;
|
|
5885
6347
|
assertOwner(turnId);
|
|
@@ -6113,7 +6575,7 @@ function estimateTokens(text2) {
|
|
|
6113
6575
|
__name(estimateTokens, "estimateTokens");
|
|
6114
6576
|
function createSideModel(deps) {
|
|
6115
6577
|
const routes = /* @__PURE__ */ new Map();
|
|
6116
|
-
const
|
|
6578
|
+
const resolve15 = /* @__PURE__ */ __name(async (sessionId, signal) => {
|
|
6117
6579
|
const active = deps.active();
|
|
6118
6580
|
if (deps.configured !== void 0) {
|
|
6119
6581
|
const target = parseSmallModel(deps.configured, active.providerId, deps.isKnownProvider);
|
|
@@ -6150,7 +6612,7 @@ ${active.model}
|
|
|
6150
6612
|
${deps.configured ?? ""}`;
|
|
6151
6613
|
let pending = routes.get(key);
|
|
6152
6614
|
if (pending === void 0) {
|
|
6153
|
-
pending =
|
|
6615
|
+
pending = resolve15(sessionId, signal);
|
|
6154
6616
|
routes.set(key, pending);
|
|
6155
6617
|
void pending.then((value) => {
|
|
6156
6618
|
if (signal.aborted && value.source === "main" && routes.get(key) === pending) {
|
|
@@ -7282,13 +7744,13 @@ function combineBatches(live, finished) {
|
|
|
7282
7744
|
__name(combineBatches, "combineBatches");
|
|
7283
7745
|
|
|
7284
7746
|
// src/integrations/subagents/definitions.ts
|
|
7285
|
-
import { join as
|
|
7747
|
+
import { join as join6 } from "node:path";
|
|
7286
7748
|
function userAgentsDir(home) {
|
|
7287
|
-
return
|
|
7749
|
+
return join6(namzuHomePath(home), "agents");
|
|
7288
7750
|
}
|
|
7289
7751
|
__name(userAgentsDir, "userAgentsDir");
|
|
7290
7752
|
function projectAgentsDir(cwd) {
|
|
7291
|
-
return
|
|
7753
|
+
return join6(cwd, ".namzu", "agents");
|
|
7292
7754
|
}
|
|
7293
7755
|
__name(projectAgentsDir, "projectAgentsDir");
|
|
7294
7756
|
function discoverAgentDefinitions2(opts) {
|
|
@@ -7313,7 +7775,7 @@ __name(prepareDelegatedEffort, "prepareDelegatedEffort");
|
|
|
7313
7775
|
|
|
7314
7776
|
// src/integrations/subagents/operator-journal.ts
|
|
7315
7777
|
import { appendFile, open as open2 } from "node:fs/promises";
|
|
7316
|
-
import { join as
|
|
7778
|
+
import { join as join7 } from "node:path";
|
|
7317
7779
|
var MAX_READ_BYTES = 256 * 1024;
|
|
7318
7780
|
var MAX_CONTEXT_CHARACTERS = 32e3;
|
|
7319
7781
|
function formatChildOperatorAdmission(input) {
|
|
@@ -7323,7 +7785,7 @@ function formatChildOperatorAdmission(input) {
|
|
|
7323
7785
|
}
|
|
7324
7786
|
__name(formatChildOperatorAdmission, "formatChildOperatorAdmission");
|
|
7325
7787
|
async function readChildOperatorNotices(paths, sessionId) {
|
|
7326
|
-
const path =
|
|
7788
|
+
const path = join7(paths.sessionDir({ sessionId }), "child-operator-messages.jsonl");
|
|
7327
7789
|
let file;
|
|
7328
7790
|
try {
|
|
7329
7791
|
file = await open2(path, "r");
|
|
@@ -7394,7 +7856,7 @@ async function acknowledgeChildOperatorNotices(paths, sessionId, notices) {
|
|
|
7394
7856
|
})
|
|
7395
7857
|
).join("\n");
|
|
7396
7858
|
await appendFile(
|
|
7397
|
-
|
|
7859
|
+
join7(paths.sessionDir({ sessionId }), "child-operator-messages.jsonl"),
|
|
7398
7860
|
`${lines}
|
|
7399
7861
|
`,
|
|
7400
7862
|
{ mode: 384 }
|
|
@@ -7403,7 +7865,7 @@ async function acknowledgeChildOperatorNotices(paths, sessionId, notices) {
|
|
|
7403
7865
|
__name(acknowledgeChildOperatorNotices, "acknowledgeChildOperatorNotices");
|
|
7404
7866
|
async function recordChildOperatorReport(paths, sessionId, notice) {
|
|
7405
7867
|
await appendFile(
|
|
7406
|
-
|
|
7868
|
+
join7(paths.sessionDir({ sessionId }), "child-operator-messages.jsonl"),
|
|
7407
7869
|
`${JSON.stringify({ ...notice, status: "child-report", source: "host", at: (/* @__PURE__ */ new Date()).toISOString() })}
|
|
7408
7870
|
`,
|
|
7409
7871
|
{ mode: 384 }
|
|
@@ -7453,80 +7915,80 @@ __name(resolveSubagentParent, "resolveSubagentParent");
|
|
|
7453
7915
|
// src/integrations/subagents/runtime.ts
|
|
7454
7916
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
7455
7917
|
import { appendFile as appendFile2, mkdir as mkdir4 } from "node:fs/promises";
|
|
7456
|
-
import { join as
|
|
7918
|
+
import { join as join11 } from "node:path";
|
|
7457
7919
|
|
|
7458
7920
|
// src/memory/typed.ts
|
|
7459
7921
|
import { createHash as createHash4 } from "node:crypto";
|
|
7460
7922
|
import { access, readFile as readFile3, rename as rename3, writeFile as writeFile2 } from "node:fs/promises";
|
|
7461
|
-
import { join as
|
|
7923
|
+
import { join as join10 } from "node:path";
|
|
7462
7924
|
|
|
7463
7925
|
// src/memory/io.ts
|
|
7464
7926
|
import {
|
|
7465
7927
|
constants as constants2,
|
|
7466
7928
|
closeSync as closeSync2,
|
|
7467
7929
|
fstatSync as fstatSync2,
|
|
7468
|
-
lstatSync as
|
|
7930
|
+
lstatSync as lstatSync3,
|
|
7469
7931
|
mkdirSync,
|
|
7470
7932
|
openSync as openSync2,
|
|
7471
7933
|
readSync as readSync2,
|
|
7472
|
-
realpathSync as
|
|
7934
|
+
realpathSync as realpathSync3,
|
|
7473
7935
|
writeSync
|
|
7474
7936
|
} from "node:fs";
|
|
7475
|
-
import { isAbsolute as isAbsolute6, join as
|
|
7937
|
+
import { isAbsolute as isAbsolute6, join as join8, relative as relative6, resolve as resolve8, sep as sep4 } from "node:path";
|
|
7476
7938
|
var MEMORY_FILE_MAX_BYTES = 1024 * 1024;
|
|
7477
7939
|
function missing(error) {
|
|
7478
7940
|
return error.code === "ENOENT";
|
|
7479
7941
|
}
|
|
7480
7942
|
__name(missing, "missing");
|
|
7481
7943
|
function within(path, root) {
|
|
7482
|
-
const part =
|
|
7483
|
-
return !isAbsolute6(part) && part !== ".." && !part.startsWith(`..${
|
|
7944
|
+
const part = relative6(root, path);
|
|
7945
|
+
return !isAbsolute6(part) && part !== ".." && !part.startsWith(`..${sep4}`);
|
|
7484
7946
|
}
|
|
7485
7947
|
__name(within, "within");
|
|
7486
7948
|
function resolveMemoryPath(location, createParents = false) {
|
|
7487
|
-
const root =
|
|
7488
|
-
const path =
|
|
7949
|
+
const root = resolve8(location.root);
|
|
7950
|
+
const path = resolve8(location.path);
|
|
7489
7951
|
if (!within(path, root)) throw new Error("Memory path is outside its allowed scope.");
|
|
7490
7952
|
let rootStat;
|
|
7491
7953
|
try {
|
|
7492
|
-
rootStat =
|
|
7954
|
+
rootStat = lstatSync3(root);
|
|
7493
7955
|
} catch (error) {
|
|
7494
7956
|
if (!missing(error)) throw error;
|
|
7495
7957
|
if (!createParents) return null;
|
|
7496
7958
|
mkdirSync(root, { recursive: true, mode: 448 });
|
|
7497
|
-
rootStat =
|
|
7959
|
+
rootStat = lstatSync3(root);
|
|
7498
7960
|
}
|
|
7499
7961
|
if (rootStat.isSymbolicLink())
|
|
7500
7962
|
throw new Error("Memory scope root is a symlink outside its allowed scope.");
|
|
7501
7963
|
if (!rootStat.isDirectory()) throw new Error("Memory scope root must be a directory.");
|
|
7502
|
-
const canonicalRoot2 =
|
|
7503
|
-
const parts =
|
|
7964
|
+
const canonicalRoot2 = realpathSync3(root);
|
|
7965
|
+
const parts = relative6(root, path).split(sep4);
|
|
7504
7966
|
let candidate = canonicalRoot2;
|
|
7505
7967
|
for (let i = 0; i < parts.length; i += 1) {
|
|
7506
7968
|
const part = parts[i];
|
|
7507
7969
|
if (part === void 0) throw new Error("Memory path has an invalid segment.");
|
|
7508
|
-
candidate =
|
|
7970
|
+
candidate = join8(candidate, part);
|
|
7509
7971
|
const leaf = i === parts.length - 1;
|
|
7510
7972
|
let stat5;
|
|
7511
7973
|
try {
|
|
7512
|
-
stat5 =
|
|
7974
|
+
stat5 = lstatSync3(candidate);
|
|
7513
7975
|
} catch (error) {
|
|
7514
7976
|
if (!missing(error)) throw error;
|
|
7515
7977
|
if (!createParents) return null;
|
|
7516
7978
|
if (leaf) return candidate;
|
|
7517
7979
|
mkdirSync(candidate, { mode: 448 });
|
|
7518
|
-
stat5 =
|
|
7980
|
+
stat5 = lstatSync3(candidate);
|
|
7519
7981
|
}
|
|
7520
7982
|
if (stat5.isSymbolicLink()) {
|
|
7521
7983
|
try {
|
|
7522
|
-
candidate =
|
|
7984
|
+
candidate = realpathSync3(candidate);
|
|
7523
7985
|
} catch (error) {
|
|
7524
7986
|
if (missing(error)) throw new Error("Memory path contains a broken symlink.");
|
|
7525
7987
|
throw error;
|
|
7526
7988
|
}
|
|
7527
7989
|
if (!within(candidate, canonicalRoot2))
|
|
7528
7990
|
throw new Error("Memory path resolves outside its allowed scope.");
|
|
7529
|
-
stat5 =
|
|
7991
|
+
stat5 = lstatSync3(candidate);
|
|
7530
7992
|
}
|
|
7531
7993
|
if (leaf ? !stat5.isFile() : !stat5.isDirectory()) {
|
|
7532
7994
|
throw new Error(
|
|
@@ -7569,7 +8031,7 @@ function openMemory(location, append) {
|
|
|
7569
8031
|
let existed = true;
|
|
7570
8032
|
let before;
|
|
7571
8033
|
try {
|
|
7572
|
-
before =
|
|
8034
|
+
before = lstatSync3(path);
|
|
7573
8035
|
} catch (error) {
|
|
7574
8036
|
if (!append || !missing(error)) throw error;
|
|
7575
8037
|
existed = false;
|
|
@@ -7582,7 +8044,7 @@ function openMemory(location, append) {
|
|
|
7582
8044
|
if (currentPath !== path || before && (opened.dev !== before.dev || opened.ino !== before.ino)) {
|
|
7583
8045
|
throw new Error("Memory path changed while opening it; no content was read or appended.");
|
|
7584
8046
|
}
|
|
7585
|
-
const current =
|
|
8047
|
+
const current = lstatSync3(path);
|
|
7586
8048
|
if (!opened.isFile() || current.dev !== opened.dev || current.ino !== opened.ino) {
|
|
7587
8049
|
throw new Error("Memory path changed or is not a regular file.");
|
|
7588
8050
|
}
|
|
@@ -7629,32 +8091,32 @@ function appendMemoryFile(location, text2) {
|
|
|
7629
8091
|
__name(appendMemoryFile, "appendMemoryFile");
|
|
7630
8092
|
|
|
7631
8093
|
// src/memory/store.ts
|
|
7632
|
-
import { realpathSync as
|
|
7633
|
-
import { join as
|
|
8094
|
+
import { realpathSync as realpathSync4 } from "node:fs";
|
|
8095
|
+
import { join as join9, resolve as resolve9 } from "node:path";
|
|
7634
8096
|
var MEMORY_SECTION_MAX_CHARS = 8e3;
|
|
7635
8097
|
function memoryDir(home) {
|
|
7636
8098
|
return namzuHomePath(home);
|
|
7637
8099
|
}
|
|
7638
8100
|
__name(memoryDir, "memoryDir");
|
|
7639
8101
|
function userFilePath(home) {
|
|
7640
|
-
return
|
|
8102
|
+
return join9(memoryDir(home), "USER.md");
|
|
7641
8103
|
}
|
|
7642
8104
|
__name(userFilePath, "userFilePath");
|
|
7643
8105
|
function memoryFilePath(home) {
|
|
7644
|
-
return
|
|
8106
|
+
return join9(memoryDir(home), "MEMORY.md");
|
|
7645
8107
|
}
|
|
7646
8108
|
__name(memoryFilePath, "memoryFilePath");
|
|
7647
8109
|
function projectMemoryFilePath(cwd) {
|
|
7648
|
-
let directory =
|
|
8110
|
+
let directory = resolve9(cwd);
|
|
7649
8111
|
try {
|
|
7650
|
-
directory =
|
|
8112
|
+
directory = realpathSync4(directory);
|
|
7651
8113
|
} catch (error) {
|
|
7652
8114
|
if (error.code !== "ENOENT") throw error;
|
|
7653
8115
|
}
|
|
7654
8116
|
const root = cliProjectRoot(directory);
|
|
7655
|
-
const local =
|
|
8117
|
+
const local = join9(directory, ".namzu", "MEMORY.md");
|
|
7656
8118
|
if (resolveMemoryPath({ path: local, root }) !== null) return local;
|
|
7657
|
-
return
|
|
8119
|
+
return join9(root, ".namzu", "MEMORY.md");
|
|
7658
8120
|
}
|
|
7659
8121
|
__name(projectMemoryFilePath, "projectMemoryFilePath");
|
|
7660
8122
|
function projectMemoryLocation(cwd) {
|
|
@@ -7662,7 +8124,7 @@ function projectMemoryLocation(cwd) {
|
|
|
7662
8124
|
}
|
|
7663
8125
|
__name(projectMemoryLocation, "projectMemoryLocation");
|
|
7664
8126
|
function projectLocation(cwd) {
|
|
7665
|
-
const directory =
|
|
8127
|
+
const directory = realpathSync4(resolve9(cwd));
|
|
7666
8128
|
return { path: projectMemoryFilePath(directory), root: cliProjectRoot(directory) };
|
|
7667
8129
|
}
|
|
7668
8130
|
__name(projectLocation, "projectLocation");
|
|
@@ -7684,27 +8146,27 @@ function readMemory(home, cwd) {
|
|
|
7684
8146
|
}
|
|
7685
8147
|
}, "read");
|
|
7686
8148
|
const userRoot = memoryDir(home);
|
|
7687
|
-
const user = read(
|
|
8149
|
+
const user = read(join9(userRoot, "USER.md"), () => ({
|
|
7688
8150
|
root: userRoot,
|
|
7689
|
-
path:
|
|
8151
|
+
path: join9(userRoot, "USER.md")
|
|
7690
8152
|
}));
|
|
7691
|
-
const memory = read(
|
|
8153
|
+
const memory = read(join9(userRoot, "MEMORY.md"), () => ({
|
|
7692
8154
|
root: userRoot,
|
|
7693
|
-
path:
|
|
8155
|
+
path: join9(userRoot, "MEMORY.md")
|
|
7694
8156
|
}));
|
|
7695
|
-
const project = cwd && !isUserMemoryFile(
|
|
8157
|
+
const project = cwd && !isUserMemoryFile(join9(resolve9(cwd), ".namzu", "MEMORY.md"), userRoot) ? read(join9(resolve9(cwd), ".namzu", "MEMORY.md"), () => projectLocation(cwd)) : null;
|
|
7696
8158
|
return { user, memory, project, ...diagnostics.length > 0 ? { diagnostics } : {} };
|
|
7697
8159
|
}
|
|
7698
8160
|
__name(readMemory, "readMemory");
|
|
7699
8161
|
function isUserMemoryFile(projectPath, userRoot) {
|
|
7700
8162
|
const canonical = /* @__PURE__ */ __name((path) => {
|
|
7701
8163
|
try {
|
|
7702
|
-
return
|
|
8164
|
+
return realpathSync4(path);
|
|
7703
8165
|
} catch {
|
|
7704
|
-
return
|
|
8166
|
+
return resolve9(path);
|
|
7705
8167
|
}
|
|
7706
8168
|
}, "canonical");
|
|
7707
|
-
return canonical(projectPath) === canonical(
|
|
8169
|
+
return canonical(projectPath) === canonical(join9(userRoot, "MEMORY.md"));
|
|
7708
8170
|
}
|
|
7709
8171
|
__name(isUserMemoryFile, "isUserMemoryFile");
|
|
7710
8172
|
function capped(text2, file) {
|
|
@@ -7796,7 +8258,7 @@ async function saveTypedNote(store, text2, type = "project") {
|
|
|
7796
8258
|
saved: false,
|
|
7797
8259
|
duplicate: true,
|
|
7798
8260
|
type: record.entry.type ?? type,
|
|
7799
|
-
...record.entry.name ? { name: record.entry.name, path:
|
|
8261
|
+
...record.entry.name ? { name: record.entry.name, path: join10(store.path, `${record.entry.name}.md`) } : {}
|
|
7800
8262
|
};
|
|
7801
8263
|
}
|
|
7802
8264
|
}
|
|
@@ -7811,7 +8273,7 @@ async function saveTypedNote(store, text2, type = "project") {
|
|
|
7811
8273
|
return {
|
|
7812
8274
|
saved: true,
|
|
7813
8275
|
type,
|
|
7814
|
-
...entry.name ? { name: entry.name, path:
|
|
8276
|
+
...entry.name ? { name: entry.name, path: join10(store.path, `${entry.name}.md`) } : {}
|
|
7815
8277
|
};
|
|
7816
8278
|
}
|
|
7817
8279
|
__name(saveTypedNote, "saveTypedNote");
|
|
@@ -7847,14 +8309,14 @@ function composeMemoryGuidance(options) {
|
|
|
7847
8309
|
"- When you find a memory is wrong, correct or remove it, so a later session is not misled.",
|
|
7848
8310
|
"- When the person asks you to remember something, save it. If the repository already records it, save only what was surprising or non-obvious about it. When they ask you to forget something, find it and remove it.",
|
|
7849
8311
|
"",
|
|
7850
|
-
"A recalled memory is a note from the past. Before acting on one that names a file, function, flag or command, check it against the current code, and trust what you observe now over the note."
|
|
8312
|
+
"A recalled memory is a note from the past. Before acting on one that names a file, function, flag or command, check it against the current code, and trust what you observe now over the note. A recalled line gives `updatedAt` (when the memory last changed, as a timestamp in milliseconds) and `sourceTurn` (the turn that saved it, when known)."
|
|
7851
8313
|
].join("\n");
|
|
7852
8314
|
}
|
|
7853
8315
|
__name(composeMemoryGuidance, "composeMemoryGuidance");
|
|
7854
8316
|
var MARKER2 = "migration.json";
|
|
7855
8317
|
async function readMarker(directory) {
|
|
7856
8318
|
try {
|
|
7857
|
-
const parsed = JSON.parse(await readFile3(
|
|
8319
|
+
const parsed = JSON.parse(await readFile3(join10(directory, MARKER2), "utf8"));
|
|
7858
8320
|
return parsed !== null && typeof parsed === "object" ? parsed : {};
|
|
7859
8321
|
} catch (error) {
|
|
7860
8322
|
if (error.code === "ENOENT") return {};
|
|
@@ -7867,7 +8329,7 @@ async function markCuratedFile(directory, path, state) {
|
|
|
7867
8329
|
const files = { ...marker.curatedFiles ?? {} };
|
|
7868
8330
|
files[path] = { ...files[path] ?? {}, ...state };
|
|
7869
8331
|
await writeFile2(
|
|
7870
|
-
|
|
8332
|
+
join10(directory, MARKER2),
|
|
7871
8333
|
`${JSON.stringify({ ...marker, curatedFiles: files }, null, 2)}
|
|
7872
8334
|
`,
|
|
7873
8335
|
{ mode: 384 }
|
|
@@ -7934,7 +8396,7 @@ async function migrateMemoryOnce(options) {
|
|
|
7934
8396
|
const skippedRecords = [];
|
|
7935
8397
|
let importedRecords = 0;
|
|
7936
8398
|
let notesOffer;
|
|
7937
|
-
const indexPath =
|
|
8399
|
+
const indexPath = join10(directory, "index.json");
|
|
7938
8400
|
if (await exists(indexPath)) {
|
|
7939
8401
|
try {
|
|
7940
8402
|
const disk = new DiskMemoryStore({ baseDir: directory, directory });
|
|
@@ -7957,11 +8419,11 @@ async function migrateMemoryOnce(options) {
|
|
|
7957
8419
|
}
|
|
7958
8420
|
}
|
|
7959
8421
|
await retire(indexPath);
|
|
7960
|
-
const content =
|
|
8422
|
+
const content = join10(directory, "content");
|
|
7961
8423
|
const retiredContent = await exists(content) ? await retire(content) : content;
|
|
7962
8424
|
for (const record of refused) {
|
|
7963
8425
|
skippedRecords.push(
|
|
7964
|
-
`"${record.title}" (${record.id}) was not moved: ${record.reason} It is kept in ${
|
|
8426
|
+
`"${record.title}" (${record.id}) was not moved: ${record.reason} It is kept in ${join10(retiredContent, `${record.id}.json`)}.`
|
|
7965
8427
|
);
|
|
7966
8428
|
}
|
|
7967
8429
|
} catch (error) {
|
|
@@ -8246,22 +8708,43 @@ function createSavedAgentHistory(scope2) {
|
|
|
8246
8708
|
};
|
|
8247
8709
|
}
|
|
8248
8710
|
__name(createSavedAgentHistory, "createSavedAgentHistory");
|
|
8711
|
+
var SAVED_AGENTS_KEY = "saved-agents";
|
|
8712
|
+
var SAVED_AGENTS_ROWS = 'The JSON lists the agents under "savedAgents". Each row gives the agent\'s session id (`sessionId`), what it was asked to do (`description`), and its `status`. Rows are listed once, when they are new or their status changed; "omitted" counts older agents that are not listed.';
|
|
8713
|
+
function recordedRows(entries) {
|
|
8714
|
+
const known = /* @__PURE__ */ new Map();
|
|
8715
|
+
for (const entry of entries) {
|
|
8716
|
+
const json = entry.split("\n").filter((line) => line.startsWith("{")).at(-1);
|
|
8717
|
+
if (!json) continue;
|
|
8718
|
+
try {
|
|
8719
|
+
const parsed = JSON.parse(json);
|
|
8720
|
+
for (const row of parsed.savedAgents ?? []) known.set(row.sessionId, row.status);
|
|
8721
|
+
} catch {
|
|
8722
|
+
}
|
|
8723
|
+
}
|
|
8724
|
+
return known;
|
|
8725
|
+
}
|
|
8726
|
+
__name(recordedRows, "recordedRows");
|
|
8249
8727
|
function createSavedAgentsStep(history) {
|
|
8250
8728
|
let snapshot;
|
|
8251
|
-
return async ({
|
|
8729
|
+
return async ({ turnId, contextBudget, messages }) => {
|
|
8252
8730
|
if (contextBudget && contextBudget.remainingTokens < MIN_REMAINING_TOKENS) return void 0;
|
|
8253
8731
|
snapshot ??= history.list();
|
|
8254
8732
|
const { agents, omitted } = await snapshot;
|
|
8255
8733
|
const earlier = agents.filter((agent2) => agent2.parentTurnId !== turnId);
|
|
8256
8734
|
if (earlier.length === 0) return void 0;
|
|
8257
|
-
const
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
|
|
8735
|
+
const held = turnContextEntries(messages, SAVED_AGENTS_KEY);
|
|
8736
|
+
const known = recordedRows(held);
|
|
8737
|
+
const listed = earlier.slice(0, MAX_PROMPTED_SAVED_AGENTS);
|
|
8738
|
+
const rows = listed.map(({ sessionId, description, status }) => ({ sessionId, description, status })).filter((row) => known.get(row.sessionId) !== row.status);
|
|
8739
|
+
if (rows.length === 0) return void 0;
|
|
8740
|
+
const text2 = [
|
|
8741
|
+
held.length === 0 ? `${SAVED_AGENTS_GUIDANCE} ${SAVED_AGENTS_ROWS}` : void 0,
|
|
8742
|
+
JSON.stringify({
|
|
8743
|
+
savedAgents: rows,
|
|
8744
|
+
omitted: omitted + earlier.length - listed.length
|
|
8745
|
+
})
|
|
8746
|
+
].filter(Boolean).join("\n");
|
|
8747
|
+
return { recordedContext: [{ key: SAVED_AGENTS_KEY, text: text2 }] };
|
|
8265
8748
|
};
|
|
8266
8749
|
}
|
|
8267
8750
|
__name(createSavedAgentsStep, "createSavedAgentsStep");
|
|
@@ -8308,7 +8791,7 @@ __name(settledAnswer, "settledAnswer");
|
|
|
8308
8791
|
// src/integrations/subagents/worktree-driver.ts
|
|
8309
8792
|
import { execFile as execFile2 } from "node:child_process";
|
|
8310
8793
|
import { mkdir as mkdir3, realpath as realpath3 } from "node:fs/promises";
|
|
8311
|
-
import { isAbsolute as isAbsolute7, relative as
|
|
8794
|
+
import { isAbsolute as isAbsolute7, relative as relative7, resolve as resolve10, sep as sep5 } from "node:path";
|
|
8312
8795
|
import { promisify as promisify2 } from "node:util";
|
|
8313
8796
|
var runFile = promisify2(execFile2);
|
|
8314
8797
|
var DelegatedWorktreeDriver = class {
|
|
@@ -8327,9 +8810,9 @@ var DelegatedWorktreeDriver = class {
|
|
|
8327
8810
|
this.ready ??= openManagedWorktrees(this.cwd, {
|
|
8328
8811
|
stateRoot: this.stateRoot
|
|
8329
8812
|
}).then(async (managed) => {
|
|
8330
|
-
const selectedDirectory = await realpath3(
|
|
8331
|
-
const subdirectory =
|
|
8332
|
-
if (isAbsolute7(subdirectory) || subdirectory === ".." || subdirectory.startsWith(`..${
|
|
8813
|
+
const selectedDirectory = await realpath3(resolve10(this.cwd));
|
|
8814
|
+
const subdirectory = relative7(managed.sourceRoot, selectedDirectory);
|
|
8815
|
+
if (isAbsolute7(subdirectory) || subdirectory === ".." || subdirectory.startsWith(`..${sep5}`)) {
|
|
8333
8816
|
throw new Error("Selected directory is outside its Git checkout");
|
|
8334
8817
|
}
|
|
8335
8818
|
return {
|
|
@@ -8375,6 +8858,18 @@ var MAX_NARRATION_INPUT_CODE_UNITS = MAX_NARRATION_CODE_UNITS * 2;
|
|
|
8375
8858
|
var GENERAL_PURPOSE_SUBAGENT = "general-purpose";
|
|
8376
8859
|
var EXPLORE_SUBAGENT = EXPLORE_AGENT_ID;
|
|
8377
8860
|
var EXPLORE_PROMPT = [EXPLORE_AGENT_PROMPT, "", NAMZU_CHILD_WORKING_DOCTRINE].join("\n");
|
|
8861
|
+
var PLAN_SUBAGENT = PLAN_AGENT_ID;
|
|
8862
|
+
var PLAN_PROMPT = [PLAN_AGENT_PROMPT, "", NAMZU_CHILD_WORKING_DOCTRINE].join("\n");
|
|
8863
|
+
var READ_ONLY_PROMPTS = /* @__PURE__ */ new Map([
|
|
8864
|
+
[EXPLORE_SUBAGENT, EXPLORE_PROMPT],
|
|
8865
|
+
[PLAN_SUBAGENT, PLAN_PROMPT]
|
|
8866
|
+
]);
|
|
8867
|
+
function readOnlyRoster(opts) {
|
|
8868
|
+
return opts.buildTools().map(
|
|
8869
|
+
(ts) => filtered(ts, (tool) => isTrustedReadOnly(tool, void 0, toToolSourceRef(ts.source)))
|
|
8870
|
+
);
|
|
8871
|
+
}
|
|
8872
|
+
__name(readOnlyRoster, "readOnlyRoster");
|
|
8378
8873
|
function fileAgentTools(definition, opts) {
|
|
8379
8874
|
return () => {
|
|
8380
8875
|
const source = definition.readOnly ? opts.buildTools().map(
|
|
@@ -8473,9 +8968,16 @@ async function createSubagentRuntime(input) {
|
|
|
8473
8968
|
EXPLORE_AGENT_DESCRIPTION,
|
|
8474
8969
|
EXPLORE_PROMPT,
|
|
8475
8970
|
opts,
|
|
8476
|
-
() => opts
|
|
8477
|
-
|
|
8478
|
-
|
|
8971
|
+
() => readOnlyRoster(opts)
|
|
8972
|
+
)
|
|
8973
|
+
);
|
|
8974
|
+
registry.register(
|
|
8975
|
+
buildDefinition(
|
|
8976
|
+
PLAN_SUBAGENT,
|
|
8977
|
+
PLAN_AGENT_DESCRIPTION,
|
|
8978
|
+
PLAN_PROMPT,
|
|
8979
|
+
opts,
|
|
8980
|
+
() => readOnlyRoster(opts)
|
|
8479
8981
|
)
|
|
8480
8982
|
);
|
|
8481
8983
|
const fileAgents = /* @__PURE__ */ new Map();
|
|
@@ -8493,7 +8995,9 @@ async function createSubagentRuntime(input) {
|
|
|
8493
8995
|
)
|
|
8494
8996
|
);
|
|
8495
8997
|
}
|
|
8496
|
-
const agentTypeIds = [
|
|
8998
|
+
const agentTypeIds = [
|
|
8999
|
+
.../* @__PURE__ */ new Set([GENERAL_PURPOSE_SUBAGENT, EXPLORE_SUBAGENT, PLAN_SUBAGENT, ...fileAgents.keys()])
|
|
9000
|
+
];
|
|
8497
9001
|
const fileAgentSummary = [...fileAgents.values()].map((definition) => `"${definition.name}" \u2014 ${definition.description}`).join("; ");
|
|
8498
9002
|
const conversations = /* @__PURE__ */ new Map();
|
|
8499
9003
|
const taskViews = /* @__PURE__ */ new Map();
|
|
@@ -8961,7 +9465,7 @@ async function createSubagentRuntime(input) {
|
|
|
8961
9465
|
} = input2;
|
|
8962
9466
|
if (!requestedModel && (requestedProvider || requestedEffort))
|
|
8963
9467
|
throw new Error("Supply model when selecting a child provider or effort.");
|
|
8964
|
-
const
|
|
9468
|
+
const readOnlyType = subagent_type !== void 0 && READ_ONLY_PROMPTS.has(subagent_type) ? subagent_type : void 0;
|
|
8965
9469
|
const fileAgent = subagent_type !== void 0 ? fileAgents.get(subagent_type) : void 0;
|
|
8966
9470
|
const inherited = opts.resolveTurnModel?.(context.turnId);
|
|
8967
9471
|
const parentModel = inherited?.model ?? opts.model;
|
|
@@ -8980,13 +9484,13 @@ async function createSubagentRuntime(input) {
|
|
|
8980
9484
|
// of a turn on another model than the session's runs on that one.
|
|
8981
9485
|
fileAgent?.model === void 0 ? inherited : void 0
|
|
8982
9486
|
);
|
|
8983
|
-
let agentId = fileAgent?.name ??
|
|
9487
|
+
let agentId = fileAgent?.name ?? readOnlyType ?? GENERAL_PURPOSE_SUBAGENT;
|
|
8984
9488
|
const persona = typeof role === "string" ? role.trim() : "";
|
|
8985
9489
|
const dynamic = persona.length > 0 || selection !== void 0;
|
|
8986
9490
|
if (dynamic) {
|
|
8987
9491
|
agentId = registerSpecialist({
|
|
8988
9492
|
fileAgent,
|
|
8989
|
-
|
|
9493
|
+
readOnlyType,
|
|
8990
9494
|
persona,
|
|
8991
9495
|
selection,
|
|
8992
9496
|
model: selection?.model ?? fileAgent?.model ?? parentModel
|
|
@@ -9089,7 +9593,7 @@ async function createSubagentRuntime(input) {
|
|
|
9089
9593
|
// has one cannot be rebuilt.
|
|
9090
9594
|
...persona.length === 0 ? {
|
|
9091
9595
|
continuationProfile: {
|
|
9092
|
-
agent: fileAgent?.name ??
|
|
9596
|
+
agent: fileAgent?.name ?? readOnlyType ?? GENERAL_PURPOSE_SUBAGENT,
|
|
9093
9597
|
// The short name the operator saw, so a later run shows the same one.
|
|
9094
9598
|
...savedDescription(description) ? { description: savedDescription(description) } : {},
|
|
9095
9599
|
...selection ? {
|
|
@@ -9140,7 +9644,7 @@ async function createSubagentRuntime(input) {
|
|
|
9140
9644
|
}
|
|
9141
9645
|
}, "launchChild");
|
|
9142
9646
|
const registerSpecialist = /* @__PURE__ */ __name((input2) => {
|
|
9143
|
-
const { fileAgent,
|
|
9647
|
+
const { fileAgent, readOnlyType, persona, selection } = input2;
|
|
9144
9648
|
const id = `dyn-${++dynCounter}`;
|
|
9145
9649
|
registry.register(
|
|
9146
9650
|
buildDefinition(
|
|
@@ -9148,14 +9652,9 @@ async function createSubagentRuntime(input) {
|
|
|
9148
9652
|
`Dynamic specialist: ${id}`,
|
|
9149
9653
|
fileAgent ? `${fileAgent.prompt}
|
|
9150
9654
|
|
|
9151
|
-
${persona}` : persona || (
|
|
9655
|
+
${persona}` : persona || (readOnlyType !== void 0 ? READ_ONLY_PROMPTS.get(readOnlyType) ?? SUBAGENT_PROMPT : SUBAGENT_PROMPT),
|
|
9152
9656
|
opts,
|
|
9153
|
-
fileAgent ? fileAgentTools(fileAgent, opts) :
|
|
9154
|
-
(ts) => filtered(
|
|
9155
|
-
ts,
|
|
9156
|
-
(tool) => isTrustedReadOnly(tool, void 0, toToolSourceRef(ts.source))
|
|
9157
|
-
)
|
|
9158
|
-
) : opts.buildTools,
|
|
9657
|
+
fileAgent ? fileAgentTools(fileAgent, opts) : readOnlyType !== void 0 ? () => readOnlyRoster(opts) : opts.buildTools,
|
|
9159
9658
|
input2.model,
|
|
9160
9659
|
selection
|
|
9161
9660
|
)
|
|
@@ -9168,10 +9667,11 @@ ${persona}` : persona || (explore ? EXPLORE_PROMPT : SUBAGENT_PROMPT),
|
|
|
9168
9667
|
opts.backgroundByDefault === true ? "Delegate a self-contained task to a sub-agent. Agents run in the background by default: you get the task ID at once and are notified automatically when one ends, so continue with other work or answer the user instead of sleeping, polling or checking on its progress. Pass run_in_background: false only when your very next action depends on the result and nothing else could usefully happen while it runs. Operator input can also release a blocking wait while the child keeps working; answer the operator first and keep the child work unless they ask to cancel or change it. Use agent_task_list for current agent status (task_list is only the planning list), send_message to correct a running task, cancel_agent to stop only one owned task, and wait_for_task to retrieve its result; launch each piece of work once." : "Delegate a self-contained task to a sub-agent. Set run_in_background: true to receive its task ID immediately and continue independent work; completion arrives as a task notification. Otherwise wait for its result. Operator input can also release a blocking wait while the child keeps working; answer the operator first and keep the child work unless they ask to cancel or change it. Use agent_task_list for current agent status (task_list is only the planning list), send_message to correct a running task, cancel_agent to stop only one owned task, and wait_for_task to retrieve its result; launch each piece of work once.",
|
|
9169
9668
|
opts.backgroundByDefault === true ? "For a request to run multiple independent tasks in parallel, issue all Agent calls together in one response. A blocking Agent call (run_in_background: false) followed by another call runs them sequentially." : "For a request to run multiple independent tasks in parallel, issue all Agent calls together in one response, or set run_in_background: true on each launch before waiting. A single blocking Agent call followed by another call runs them sequentially.",
|
|
9170
9669
|
'Pick `subagent_type: "explore"` for anything that only needs to look \u2014 where is X defined, which files reference Y, how does Z work \u2014 it has reading and searching tools only and never asks for permission.',
|
|
9670
|
+
'Pick `subagent_type: "plan"` when you need a design before changing code \u2014 it reads the code the same way and returns a step plan with the files to change and the risks, and cannot edit anything.',
|
|
9171
9671
|
'Use the default "general-purpose" when the task must change files or run commands.',
|
|
9172
9672
|
'Set `workspace: "worktree"` when the child needs its own Git checkout. It starts from this checkout\'s committed HEAD; uncommitted parent changes are absent. The checkout and its edits remain after the child ends, so report its path and branch to the operator.',
|
|
9173
9673
|
"Define a specialist inline with `role` \u2014 a system prompt describing who the sub-agent is and how to behave (e.g.",
|
|
9174
|
-
'"You are a security auditor; flag vulnerabilities and rate severity"); with `subagent_type: "explore"` the role keeps the read-only roster.',
|
|
9674
|
+
'"You are a security auditor; flag vulnerabilities and rate severity"); with `subagent_type: "explore"` or `"plan"` the role keeps the read-only roster.',
|
|
9175
9675
|
"Omit `role` for the plain sub-agent.",
|
|
9176
9676
|
"The sub-agent runs in its own context with its own tools and cannot see this conversation \u2014 put everything it needs in `prompt`.",
|
|
9177
9677
|
"Call this multiple times in one response to run specialists in parallel. Tasks beyond the project's live-agent capacity wait in a queue and start as slots become available. Queued tasks have not started execution and start by themselves, so launch each once.",
|
|
@@ -9202,7 +9702,7 @@ ${persona}` : persona || (explore ? EXPLORE_PROMPT : SUBAGENT_PROMPT),
|
|
|
9202
9702
|
subagent_type: {
|
|
9203
9703
|
type: "string",
|
|
9204
9704
|
enum: agentTypeIds,
|
|
9205
|
-
description: `"explore" for read-only lookups (find, search, explain); "general-purpose" (default) when the task changes files or runs commands.${fileAgentSummary.length > 0 ? ` This project also defines: ${fileAgentSummary}. Prefer a project-defined type when its description fits the task.` : ""}`
|
|
9705
|
+
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.${fileAgentSummary.length > 0 ? ` This project also defines: ${fileAgentSummary}. Prefer a project-defined type when its description fits the task.` : ""}`
|
|
9206
9706
|
},
|
|
9207
9707
|
model: {
|
|
9208
9708
|
type: "string",
|
|
@@ -9593,7 +10093,7 @@ ${step}`;
|
|
|
9593
10093
|
const fileAgent = fileAgents.get(base);
|
|
9594
10094
|
const id = registerSpecialist({
|
|
9595
10095
|
fileAgent,
|
|
9596
|
-
|
|
10096
|
+
readOnlyType: READ_ONLY_PROMPTS.has(base) ? base : void 0,
|
|
9597
10097
|
persona: "",
|
|
9598
10098
|
selection: {
|
|
9599
10099
|
provider: profile.provider,
|
|
@@ -10004,8 +10504,8 @@ ${step}`;
|
|
|
10004
10504
|
owned.busy = true;
|
|
10005
10505
|
let settleAdmission = /* @__PURE__ */ __name(() => {
|
|
10006
10506
|
}, "settleAdmission");
|
|
10007
|
-
owned.admitting = new Promise((
|
|
10008
|
-
settleAdmission =
|
|
10507
|
+
owned.admitting = new Promise((resolve15) => {
|
|
10508
|
+
settleAdmission = resolve15;
|
|
10009
10509
|
});
|
|
10010
10510
|
const id = randomUUID4();
|
|
10011
10511
|
let journal;
|
|
@@ -10040,7 +10540,7 @@ ${step}`;
|
|
|
10040
10540
|
sessionId: parent.sessionId
|
|
10041
10541
|
});
|
|
10042
10542
|
await mkdir4(directory, { recursive: true, mode: 448 });
|
|
10043
|
-
journal =
|
|
10543
|
+
journal = join11(directory, "child-operator-messages.jsonl");
|
|
10044
10544
|
}
|
|
10045
10545
|
await audit("submitted");
|
|
10046
10546
|
signal.throwIfAborted();
|
|
@@ -10230,7 +10730,7 @@ ${step}`;
|
|
|
10230
10730
|
if (typeof type !== "string") return false;
|
|
10231
10731
|
const fileAgent = fileAgents.get(type);
|
|
10232
10732
|
if (fileAgent) return fileAgent.readOnly && inherits(fileAgent.model);
|
|
10233
|
-
return type
|
|
10733
|
+
return READ_ONLY_PROMPTS.has(type);
|
|
10234
10734
|
},
|
|
10235
10735
|
activity,
|
|
10236
10736
|
launchWorkflowAgent,
|
|
@@ -10472,7 +10972,7 @@ __name(buildDefinition, "buildDefinition");
|
|
|
10472
10972
|
|
|
10473
10973
|
// src/integrations/workflows/history.ts
|
|
10474
10974
|
import { readFile as readFile4, readdir as readdir2 } from "node:fs/promises";
|
|
10475
|
-
import { join as
|
|
10975
|
+
import { join as join12 } from "node:path";
|
|
10476
10976
|
var RUN_ID = /^w[0-9a-z]{8}$/;
|
|
10477
10977
|
async function readWorkflowJournal(file) {
|
|
10478
10978
|
let text2;
|
|
@@ -10498,7 +10998,7 @@ async function readWorkflowJournal(file) {
|
|
|
10498
10998
|
__name(readWorkflowJournal, "readWorkflowJournal");
|
|
10499
10999
|
async function readWorkflowRun(runsDirectory, runId) {
|
|
10500
11000
|
if (!RUN_ID.test(runId)) return void 0;
|
|
10501
|
-
const records = await readWorkflowJournal(
|
|
11001
|
+
const records = await readWorkflowJournal(join12(runsDirectory, runId, "workflow", "journal.jsonl"));
|
|
10502
11002
|
return viewFromJournal(records);
|
|
10503
11003
|
}
|
|
10504
11004
|
__name(readWorkflowRun, "readWorkflowRun");
|
|
@@ -10519,7 +11019,7 @@ __name(listWorkflowRuns, "listWorkflowRuns");
|
|
|
10519
11019
|
|
|
10520
11020
|
// src/integrations/workflows/host.ts
|
|
10521
11021
|
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
10522
|
-
import { join as
|
|
11022
|
+
import { join as join13 } from "node:path";
|
|
10523
11023
|
|
|
10524
11024
|
// src/integrations/workflows/offering.ts
|
|
10525
11025
|
var WORKFLOW_TOOL_NAME = "workflow";
|
|
@@ -10533,7 +11033,7 @@ var WORKFLOW_TOOL_DESCRIPTION = [
|
|
|
10533
11033
|
'export const meta = { name: "audit", description: "One line the operator reads before it starts", phases: [{ title: "Scan" }, { title: "Fix", detail: "safe fixes only" }] }',
|
|
10534
11034
|
"",
|
|
10535
11035
|
"Then plain code. Everything below is a global:",
|
|
10536
|
-
'- agent(prompt, opts?) starts one subagent and resolves to its final text, or to a parsed value when opts.schema (a JSON Schema) is given, or to null when it failed or was skipped. Always handle null. opts: label (a short row title), phase (a phase title), schema, agentType ("general-purpose", "explore", or a project agent), model, effort. The subagent cannot see this conversation or your variables: put everything it needs in the prompt.',
|
|
11036
|
+
'- agent(prompt, opts?) starts one subagent and resolves to its final text, or to a parsed value when opts.schema (a JSON Schema) is given, or to null when it failed or was skipped. Always handle null. opts: label (a short row title), phase (a phase title), schema, agentType ("general-purpose", "explore", "plan", or a project agent), model, effort. The subagent cannot see this conversation or your variables: put everything it needs in the prompt.',
|
|
10537
11037
|
"- parallel([() => agent(...), ...]) starts every thunk now and resolves when all are done. It never rejects: a thunk that throws becomes null in its place and the reason goes through log(), so filter the nulls (.filter(Boolean)).",
|
|
10538
11038
|
"- pipeline(items, stage1, stage2, ...) runs one chain per item with no barrier between stages; a stage gets (prevResult, originalItem, index), where the first stage gets the item as prevResult, and an item whose stage gives null stops there. It never rejects either: a stage that throws drops its item to null and the reason goes through log(), so filter the nulls.",
|
|
10539
11039
|
"- phase(title) names the stage that the following agents belong to; inside parallel() or pipeline() pass opts.phase instead. Use the same titles as in meta.phases.",
|
|
@@ -10653,11 +11153,11 @@ var WorkflowRunRegistry = class {
|
|
|
10653
11153
|
whenIdle(signal) {
|
|
10654
11154
|
const going = /* @__PURE__ */ __name(() => [...this.runs.values()].some((run2) => !run2.finalized), "going");
|
|
10655
11155
|
if (!going() || signal?.aborted) return Promise.resolve();
|
|
10656
|
-
return new Promise((
|
|
11156
|
+
return new Promise((resolve15) => {
|
|
10657
11157
|
const done = /* @__PURE__ */ __name(() => {
|
|
10658
11158
|
off();
|
|
10659
11159
|
signal?.removeEventListener("abort", done);
|
|
10660
|
-
|
|
11160
|
+
resolve15();
|
|
10661
11161
|
}, "done");
|
|
10662
11162
|
const off = this.subscribe(() => {
|
|
10663
11163
|
if (!going()) done();
|
|
@@ -10865,13 +11365,13 @@ function createWorkflowHost(options) {
|
|
|
10865
11365
|
const turn = options.openRunTurn(context.turnId, runId);
|
|
10866
11366
|
const runs = options.runsDirectory(context.turnId);
|
|
10867
11367
|
const limits = options.limitsFor?.(context.turnId);
|
|
10868
|
-
const journal = runs === void 0 ? void 0 : new FileWorkflowJournal(
|
|
11368
|
+
const journal = runs === void 0 ? void 0 : new FileWorkflowJournal(join13(runs, runId, "workflow"));
|
|
10869
11369
|
const phaseDetail = /* @__PURE__ */ __name((title) => title === void 0 ? void 0 : meta.phases.find((phase) => phase.title.trim() === title.trim())?.detail, "phaseDetail");
|
|
10870
11370
|
let launching = true;
|
|
10871
11371
|
let settleLaunch = /* @__PURE__ */ __name(() => {
|
|
10872
11372
|
}, "settleLaunch");
|
|
10873
|
-
const launch = new Promise((
|
|
10874
|
-
settleLaunch =
|
|
11373
|
+
const launch = new Promise((resolve15) => {
|
|
11374
|
+
settleLaunch = resolve15;
|
|
10875
11375
|
});
|
|
10876
11376
|
const detach = /* @__PURE__ */ __name(() => {
|
|
10877
11377
|
if (!launching) return;
|
|
@@ -11197,14 +11697,29 @@ function createLiveModeControl(options) {
|
|
|
11197
11697
|
}
|
|
11198
11698
|
__name(createLiveModeControl, "createLiveModeControl");
|
|
11199
11699
|
|
|
11700
|
+
// src/permissions/read-only-gate.ts
|
|
11701
|
+
var NETWORK_CATEGORY = "network";
|
|
11702
|
+
var SEARCH_ALLOWANCE = { type: "allow_by_name", toolNames: ["web_search"] };
|
|
11703
|
+
function cliGate(rules) {
|
|
11704
|
+
return {
|
|
11705
|
+
enabled: true,
|
|
11706
|
+
allowReadOnlyTools: true,
|
|
11707
|
+
allowReadOnlyExcludeCategories: [NETWORK_CATEGORY],
|
|
11708
|
+
denyDangerousPatterns: true,
|
|
11709
|
+
logDecisions: false,
|
|
11710
|
+
rules: [...rules ?? [], SEARCH_ALLOWANCE]
|
|
11711
|
+
};
|
|
11712
|
+
}
|
|
11713
|
+
__name(cliGate, "cliGate");
|
|
11714
|
+
|
|
11200
11715
|
// src/permissions/local-settings.ts
|
|
11201
11716
|
import { execFile as execFile3 } from "node:child_process";
|
|
11202
11717
|
import { existsSync, readFileSync as readFileSync2, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
11203
11718
|
import { appendFile as appendFile3, mkdir as mkdir5, readFile as readFile5, writeFile as writeFile3 } from "node:fs/promises";
|
|
11204
|
-
import { homedir } from "node:os";
|
|
11205
|
-
import { dirname as
|
|
11719
|
+
import { homedir as homedir3 } from "node:os";
|
|
11720
|
+
import { dirname as dirname4, isAbsolute as isAbsolute8, join as join14, resolve as resolve11 } from "node:path";
|
|
11206
11721
|
function localConfigPath(cwd) {
|
|
11207
|
-
return
|
|
11722
|
+
return resolve11(cwd, LOCAL_CONFIG_FILE);
|
|
11208
11723
|
}
|
|
11209
11724
|
__name(localConfigPath, "localConfigPath");
|
|
11210
11725
|
function isRecord2(value) {
|
|
@@ -11279,14 +11794,14 @@ function git2(args, cwd, env) {
|
|
|
11279
11794
|
});
|
|
11280
11795
|
}
|
|
11281
11796
|
__name(git2, "git");
|
|
11282
|
-
function globalIgnorePath(
|
|
11283
|
-
const home = env.HOME ?? env.USERPROFILE ??
|
|
11284
|
-
const value =
|
|
11285
|
-
if (value === "~" || value.startsWith("~/")) return
|
|
11797
|
+
function globalIgnorePath(configured, env) {
|
|
11798
|
+
const home = env.HOME ?? env.USERPROFILE ?? homedir3();
|
|
11799
|
+
const value = configured.trim();
|
|
11800
|
+
if (value === "~" || value.startsWith("~/")) return join14(home, value.slice(2));
|
|
11286
11801
|
if (value !== "" && isAbsolute8(value)) return value;
|
|
11287
11802
|
const xdg = env.XDG_CONFIG_HOME;
|
|
11288
|
-
if (xdg && isAbsolute8(xdg)) return
|
|
11289
|
-
return
|
|
11803
|
+
if (xdg && isAbsolute8(xdg)) return join14(xdg, "git", "ignore");
|
|
11804
|
+
return join14(home, ".config", "git", "ignore");
|
|
11290
11805
|
}
|
|
11291
11806
|
__name(globalIgnorePath, "globalIgnorePath");
|
|
11292
11807
|
async function ensureLocalConfigIgnored(cwd, env = process.env) {
|
|
@@ -11295,10 +11810,10 @@ async function ensureLocalConfigIgnored(cwd, env = process.env) {
|
|
|
11295
11810
|
if (inside.code !== 0 || inside.stdout.trim() !== "true") return { state: "not-a-repository" };
|
|
11296
11811
|
const ignored = /* @__PURE__ */ __name(async () => (await git2(["check-ignore", "--", LOCAL_CONFIG_FILE], cwd, env)).code === 0, "ignored");
|
|
11297
11812
|
if (await ignored()) return { state: "ignored", written: false };
|
|
11298
|
-
const
|
|
11299
|
-
const file = globalIgnorePath(
|
|
11813
|
+
const configured = await git2(["config", "--global", "--get", "core.excludesfile"], cwd, env);
|
|
11814
|
+
const file = globalIgnorePath(configured.code === 0 ? configured.stdout : "", env);
|
|
11300
11815
|
const line = `**/${LOCAL_CONFIG_FILE}`;
|
|
11301
|
-
await mkdir5(
|
|
11816
|
+
await mkdir5(dirname4(file), { recursive: true });
|
|
11302
11817
|
let existing = "";
|
|
11303
11818
|
try {
|
|
11304
11819
|
existing = await readFile5(file, "utf-8");
|
|
@@ -11604,20 +12119,135 @@ function planApprovalRows(bypassAvailable) {
|
|
|
11604
12119
|
}
|
|
11605
12120
|
__name(planApprovalRows, "planApprovalRows");
|
|
11606
12121
|
var EXIT_PLAN_MODE_TOOL_NAME = "exit_plan_mode";
|
|
12122
|
+
var ENTER_PLAN_MODE_TOOL_NAME = "enter_plan_mode";
|
|
12123
|
+
|
|
12124
|
+
// src/plan/enter-plan-mode-tool.ts
|
|
12125
|
+
var YES = "plan-first";
|
|
12126
|
+
var NO = "go-ahead";
|
|
12127
|
+
function enterPlanModeQuestion() {
|
|
12128
|
+
return {
|
|
12129
|
+
questionId: "enter-plan-mode",
|
|
12130
|
+
question: "Enter plan mode?",
|
|
12131
|
+
header: "Plan first",
|
|
12132
|
+
options: [
|
|
12133
|
+
{
|
|
12134
|
+
id: YES,
|
|
12135
|
+
label: "Yes, plan first",
|
|
12136
|
+
description: "Namzu reads and explores without changing anything, then shows a plan for your approval.",
|
|
12137
|
+
recommended: true
|
|
12138
|
+
},
|
|
12139
|
+
{
|
|
12140
|
+
id: NO,
|
|
12141
|
+
label: "No, go ahead",
|
|
12142
|
+
description: "Namzu carries on with the change as it is."
|
|
12143
|
+
}
|
|
12144
|
+
],
|
|
12145
|
+
multiSelect: false,
|
|
12146
|
+
allowFreeText: false
|
|
12147
|
+
};
|
|
12148
|
+
}
|
|
12149
|
+
__name(enterPlanModeQuestion, "enterPlanModeQuestion");
|
|
12150
|
+
function enteredPlanModeText(planPath) {
|
|
12151
|
+
return [
|
|
12152
|
+
"Plan mode is on. Explore the codebase and design the approach without changing any file except the plan file.",
|
|
12153
|
+
"",
|
|
12154
|
+
"In plan mode:",
|
|
12155
|
+
"1. Read the code that the change touches and the patterns it should follow.",
|
|
12156
|
+
"2. Compare the realistic approaches and their trade-offs.",
|
|
12157
|
+
"3. Ask the user, with ask_user_question, whatever only they can decide.",
|
|
12158
|
+
`4. Write the plan to ${planPath}.`,
|
|
12159
|
+
`5. Present it with ${EXIT_PLAN_MODE_TOOL_NAME}; the user approves it or sends it back with changes.`
|
|
12160
|
+
].join("\n");
|
|
12161
|
+
}
|
|
12162
|
+
__name(enteredPlanModeText, "enteredPlanModeText");
|
|
12163
|
+
var DECLINED_PLAN_MODE_TEXT = "The user chose not to plan first. Carry on with the change directly, and ask when something needs their decision.";
|
|
12164
|
+
var NOBODY_TO_ASK_TEXT = "Nobody can be asked about plan mode in this session. Carry on with the change directly.";
|
|
12165
|
+
function buildEnterPlanModeTool(host) {
|
|
12166
|
+
return defineTool({
|
|
12167
|
+
name: ENTER_PLAN_MODE_TOOL_NAME,
|
|
12168
|
+
description: `Ask the user to switch to plan mode before a change that is not small. In plan mode you explore read-only and present a plan for approval. Use it for a new feature, a change that has several reasonable approaches, an edit that spans several files or alters existing behaviour, an architectural choice, or a task whose scope you must explore first. Skip it for a one-line fix, a single function with clear requirements, a change the user has already specified in detail, and pure research. It takes no arguments and returns whether plan mode is on. Once on, write the plan to the plan file and present it with ${EXIT_PLAN_MODE_TOOL_NAME}.`,
|
|
12169
|
+
inputSchema: mcpJsonSchemaToZod({
|
|
12170
|
+
type: "object",
|
|
12171
|
+
properties: {},
|
|
12172
|
+
additionalProperties: false
|
|
12173
|
+
}),
|
|
12174
|
+
category: "custom",
|
|
12175
|
+
permissions: [],
|
|
12176
|
+
// Asks the person and changes nothing until they agree.
|
|
12177
|
+
readOnly: true,
|
|
12178
|
+
destructive: false,
|
|
12179
|
+
concurrencySafe: false,
|
|
12180
|
+
timeoutMs: 30 * 6e4,
|
|
12181
|
+
presentCall: /* @__PURE__ */ __name(() => ({
|
|
12182
|
+
kind: "generic",
|
|
12183
|
+
label: "Propose planning first",
|
|
12184
|
+
presentation: "activity"
|
|
12185
|
+
}), "presentCall"),
|
|
12186
|
+
presentResult: /* @__PURE__ */ __name((_input, result) => {
|
|
12187
|
+
const outcome = result.data?.outcome;
|
|
12188
|
+
if (outcome === "entered")
|
|
12189
|
+
return { kind: "generic", label: "Plan mode on", visibility: "hidden" };
|
|
12190
|
+
return outcome === "declined" ? { kind: "generic", label: "Going ahead without a plan", outcome: "cancelled" } : void 0;
|
|
12191
|
+
}, "presentResult"),
|
|
12192
|
+
async execute(_input, context) {
|
|
12193
|
+
context.abortSignal?.throwIfAborted();
|
|
12194
|
+
const mode = host.mode();
|
|
12195
|
+
if (mode === "plan") {
|
|
12196
|
+
return {
|
|
12197
|
+
success: true,
|
|
12198
|
+
output: "Plan mode is already on. Keep exploring, then present the plan with exit_plan_mode.",
|
|
12199
|
+
data: { outcome: "already" }
|
|
12200
|
+
};
|
|
12201
|
+
}
|
|
12202
|
+
if (mode !== "classify") {
|
|
12203
|
+
const ask = host.ask();
|
|
12204
|
+
if (!ask) {
|
|
12205
|
+
return {
|
|
12206
|
+
success: true,
|
|
12207
|
+
output: NOBODY_TO_ASK_TEXT,
|
|
12208
|
+
data: { outcome: "declined" }
|
|
12209
|
+
};
|
|
12210
|
+
}
|
|
12211
|
+
let answer;
|
|
12212
|
+
try {
|
|
12213
|
+
answer = await ask(enterPlanModeQuestion(), context.abortSignal);
|
|
12214
|
+
} catch {
|
|
12215
|
+
answer = { kind: "skip" };
|
|
12216
|
+
}
|
|
12217
|
+
context.abortSignal?.throwIfAborted();
|
|
12218
|
+
const chosen = answer.kind === "answer" && answer.selectedOptionIds.includes(YES);
|
|
12219
|
+
if (!chosen) {
|
|
12220
|
+
return {
|
|
12221
|
+
success: true,
|
|
12222
|
+
output: DECLINED_PLAN_MODE_TEXT,
|
|
12223
|
+
data: { outcome: "declined" }
|
|
12224
|
+
};
|
|
12225
|
+
}
|
|
12226
|
+
}
|
|
12227
|
+
await host.enter();
|
|
12228
|
+
return {
|
|
12229
|
+
success: true,
|
|
12230
|
+
output: enteredPlanModeText(host.planPath()),
|
|
12231
|
+
data: { outcome: "entered" }
|
|
12232
|
+
};
|
|
12233
|
+
}
|
|
12234
|
+
});
|
|
12235
|
+
}
|
|
12236
|
+
__name(buildEnterPlanModeTool, "buildEnterPlanModeTool");
|
|
11607
12237
|
|
|
11608
12238
|
// src/plan/plan-file.ts
|
|
11609
12239
|
import { readFile as readFile6 } from "node:fs/promises";
|
|
11610
|
-
import { isAbsolute as isAbsolute9, resolve as
|
|
12240
|
+
import { isAbsolute as isAbsolute9, resolve as resolve12 } from "node:path";
|
|
11611
12241
|
var WRITERS = /* @__PURE__ */ new Set(["write", "edit"]);
|
|
11612
12242
|
function isPlanFileWrite(planPath, cwd) {
|
|
11613
|
-
const target =
|
|
12243
|
+
const target = resolve12(planPath);
|
|
11614
12244
|
return (call) => {
|
|
11615
12245
|
if (!WRITERS.has(call.name)) return false;
|
|
11616
12246
|
const input = call.input;
|
|
11617
12247
|
if (input === null || typeof input !== "object") return false;
|
|
11618
12248
|
const path = input.path;
|
|
11619
12249
|
if (typeof path !== "string" || path.length === 0 || path.includes("\0")) return false;
|
|
11620
|
-
return
|
|
12250
|
+
return resolve12(isAbsolute9(path) ? path : resolve12(cwd, path)) === target;
|
|
11621
12251
|
};
|
|
11622
12252
|
}
|
|
11623
12253
|
__name(isPlanFileWrite, "isPlanFileWrite");
|
|
@@ -11630,6 +12260,23 @@ async function readPlan(planPath) {
|
|
|
11630
12260
|
}
|
|
11631
12261
|
}
|
|
11632
12262
|
__name(readPlan, "readPlan");
|
|
12263
|
+
var MAX_CARRIED_PLAN_CHARS = 2e4;
|
|
12264
|
+
async function planCarriedAcrossCompaction(planPath) {
|
|
12265
|
+
const plan = await readPlan(planPath);
|
|
12266
|
+
if (plan === void 0) return void 0;
|
|
12267
|
+
const text2 = plan.length > MAX_CARRIED_PLAN_CHARS ? `${plan.slice(0, MAX_CARRIED_PLAN_CHARS)}
|
|
12268
|
+
\u2026 [the rest of the plan is in the file]` : plan;
|
|
12269
|
+
return [
|
|
12270
|
+
"### Plan file",
|
|
12271
|
+
"",
|
|
12272
|
+
`A plan from plan mode is saved at ${planPath}. Its current text:`,
|
|
12273
|
+
"",
|
|
12274
|
+
text2.trimEnd(),
|
|
12275
|
+
"",
|
|
12276
|
+
"If this plan is relevant to the work in progress, keep following it."
|
|
12277
|
+
].join("\n");
|
|
12278
|
+
}
|
|
12279
|
+
__name(planCarriedAcrossCompaction, "planCarriedAcrossCompaction");
|
|
11633
12280
|
|
|
11634
12281
|
// src/plan/exit-plan-mode-tool.ts
|
|
11635
12282
|
function approvedPlanText(plan, planPath, answer) {
|
|
@@ -12002,6 +12649,7 @@ __name(planModeReminders, "planModeReminders");
|
|
|
12002
12649
|
// src/reminders/task-nudge.ts
|
|
12003
12650
|
var TASK_NUDGE_AFTER_TURNS = 10;
|
|
12004
12651
|
var TASK_NUDGE_EVERY_TURNS = 10;
|
|
12652
|
+
var TASK_NUDGE_MIN_STEPS = 3;
|
|
12005
12653
|
var TASK_TOOLS = /* @__PURE__ */ new Set(["task_create", "task_update"]);
|
|
12006
12654
|
function taskNudgeCounts(messages) {
|
|
12007
12655
|
let sinceTaskTool = 0;
|
|
@@ -12023,6 +12671,16 @@ function taskNudgeCounts(messages) {
|
|
|
12023
12671
|
return { sinceTaskTool, sinceNudge };
|
|
12024
12672
|
}
|
|
12025
12673
|
__name(taskNudgeCounts, "taskNudgeCounts");
|
|
12674
|
+
function stepsThisRequest(messages) {
|
|
12675
|
+
let steps = 0;
|
|
12676
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
12677
|
+
const message2 = messages[i];
|
|
12678
|
+
if (isOperatorTurn(message2)) break;
|
|
12679
|
+
if (message2.role === "assistant" && (message2.toolCalls?.length ?? 0) > 0) steps++;
|
|
12680
|
+
}
|
|
12681
|
+
return steps;
|
|
12682
|
+
}
|
|
12683
|
+
__name(stepsThisRequest, "stepsThisRequest");
|
|
12026
12684
|
function listText(tasks) {
|
|
12027
12685
|
return tasks.map((task) => `#${task.id}. [${task.status}] ${task.subject}`).join("\n");
|
|
12028
12686
|
}
|
|
@@ -12031,7 +12689,8 @@ function taskNudge(messages, tasks) {
|
|
|
12031
12689
|
if (messages.length === 0) return [];
|
|
12032
12690
|
const { sinceTaskTool, sinceNudge } = taskNudgeCounts(messages);
|
|
12033
12691
|
if (sinceTaskTool < TASK_NUDGE_AFTER_TURNS || sinceNudge < TASK_NUDGE_EVERY_TURNS) return [];
|
|
12034
|
-
|
|
12692
|
+
if (stepsThisRequest(messages) < TASK_NUDGE_MIN_STEPS) return [];
|
|
12693
|
+
const head = "This work has run several steps without the task tools. If it has three or more steps worth tracking, add them with task_create and keep their status current with task_update (in_progress when you start one, completed when it is done); if the list has gone stale, tidy it. Otherwise ignore this note. It is for you alone, so keep it out of your replies to the user.";
|
|
12035
12694
|
return [
|
|
12036
12695
|
frameReminder(
|
|
12037
12696
|
"task-nudge",
|
|
@@ -12231,19 +12890,19 @@ async function resolveModelSwitch(request, options) {
|
|
|
12231
12890
|
listed.set(detected.entry.id, listing);
|
|
12232
12891
|
return listing.kind === "ok" && listing.models.some((candidate) => candidate.id === model);
|
|
12233
12892
|
}, "inspect");
|
|
12234
|
-
const
|
|
12893
|
+
const resolve15 = /* @__PURE__ */ __name((detected) => ({
|
|
12235
12894
|
kind: "resolved",
|
|
12236
12895
|
selection: { id: detected.entry.id, model }
|
|
12237
12896
|
}), "resolve");
|
|
12238
12897
|
const first = selected ?? usable.find(({ entry }) => entry.id === options.currentProvider);
|
|
12239
|
-
if (first && await inspect(first)) return
|
|
12898
|
+
if (first && await inspect(first)) return resolve15(first);
|
|
12240
12899
|
const candidates = selected ? [selected] : usable;
|
|
12241
12900
|
const matches = selected ? [] : (await Promise.all(
|
|
12242
12901
|
candidates.filter((candidate) => candidate !== first).map(async (candidate) => await inspect(candidate) ? candidate : void 0)
|
|
12243
12902
|
)).filter((candidate) => candidate !== void 0);
|
|
12244
12903
|
signal?.throwIfAborted();
|
|
12245
12904
|
const uniqueMatch = matches.length === 1 ? matches[0] : void 0;
|
|
12246
|
-
if (uniqueMatch) return
|
|
12905
|
+
if (uniqueMatch) return resolve15(uniqueMatch);
|
|
12247
12906
|
if (matches.length > 1) {
|
|
12248
12907
|
return {
|
|
12249
12908
|
kind: "rejected",
|
|
@@ -12273,8 +12932,8 @@ async function resolveModelSwitch(request, options) {
|
|
|
12273
12932
|
__name(resolveModelSwitch, "resolveModelSwitch");
|
|
12274
12933
|
|
|
12275
12934
|
// src/tui/read-search-group.ts
|
|
12276
|
-
import { homedir as
|
|
12277
|
-
import { isAbsolute as isAbsolute10, relative as
|
|
12935
|
+
import { homedir as homedir4 } from "node:os";
|
|
12936
|
+
import { isAbsolute as isAbsolute10, relative as relative8, resolve as resolve13, sep as sep6 } from "node:path";
|
|
12278
12937
|
var EMPTY_GROUP = {
|
|
12279
12938
|
readKeys: [],
|
|
12280
12939
|
anonymousReads: 0,
|
|
@@ -12512,17 +13171,17 @@ function classifyShell(command) {
|
|
|
12512
13171
|
return void 0;
|
|
12513
13172
|
}
|
|
12514
13173
|
__name(classifyShell, "classifyShell");
|
|
12515
|
-
function
|
|
12516
|
-
const abs = cwd && !isAbsolute10(path) ?
|
|
13174
|
+
function displayPath3(path, cwd) {
|
|
13175
|
+
const abs = cwd && !isAbsolute10(path) ? resolve13(cwd, path) : path;
|
|
12517
13176
|
if (cwd) {
|
|
12518
|
-
const rel =
|
|
13177
|
+
const rel = relative8(cwd, abs);
|
|
12519
13178
|
if (rel.length > 0 && !rel.startsWith("..") && !isAbsolute10(rel)) return rel;
|
|
12520
13179
|
}
|
|
12521
|
-
const home =
|
|
12522
|
-
if (home && (abs === home || abs.startsWith(home +
|
|
13180
|
+
const home = homedir4();
|
|
13181
|
+
if (home && (abs === home || abs.startsWith(home + sep6))) return `~${abs.slice(home.length)}`;
|
|
12523
13182
|
return abs;
|
|
12524
13183
|
}
|
|
12525
|
-
__name(
|
|
13184
|
+
__name(displayPath3, "displayPath");
|
|
12526
13185
|
function text(value) {
|
|
12527
13186
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
12528
13187
|
}
|
|
@@ -12550,7 +13209,7 @@ function classifyCall(call) {
|
|
|
12550
13209
|
case "view_image": {
|
|
12551
13210
|
const path = text(input.path);
|
|
12552
13211
|
if (!path) return void 0;
|
|
12553
|
-
const shown =
|
|
13212
|
+
const shown = displayPath3(path, call.cwd);
|
|
12554
13213
|
return { kind: "read", key: shown, hint: shown };
|
|
12555
13214
|
}
|
|
12556
13215
|
case "grep":
|
|
@@ -12560,7 +13219,7 @@ function classifyCall(call) {
|
|
|
12560
13219
|
}
|
|
12561
13220
|
case "ls": {
|
|
12562
13221
|
const path = text(input.path);
|
|
12563
|
-
return { kind: "list", ...path ? { hint:
|
|
13222
|
+
return { kind: "list", ...path ? { hint: displayPath3(path, call.cwd) } : {} };
|
|
12564
13223
|
}
|
|
12565
13224
|
case "bash": {
|
|
12566
13225
|
const command = text(input.command);
|
|
@@ -12703,8 +13362,8 @@ var SessionOperationOwner = class {
|
|
|
12703
13362
|
})()[Symbol.asyncIterator]();
|
|
12704
13363
|
let settled = false;
|
|
12705
13364
|
let settle;
|
|
12706
|
-
const settlement = new Promise((
|
|
12707
|
-
settle =
|
|
13365
|
+
const settlement = new Promise((resolve15) => {
|
|
13366
|
+
settle = resolve15;
|
|
12708
13367
|
});
|
|
12709
13368
|
let operationTail = Promise.resolve();
|
|
12710
13369
|
let returnStarted = false;
|
|
@@ -12965,10 +13624,10 @@ function clipRequestContext(prompt, limit, kind) {
|
|
|
12965
13624
|
__name(clipRequestContext, "clipRequestContext");
|
|
12966
13625
|
async function createAgentSession(prefs, detected, options = {}) {
|
|
12967
13626
|
if (options.palEnvironment) {
|
|
12968
|
-
const { createPalAgentSession } = await import("./agent-session-
|
|
13627
|
+
const { createPalAgentSession } = await import("./agent-session-3MUZCWQ4.js");
|
|
12969
13628
|
return createPalAgentSession(prefs, detected, options);
|
|
12970
13629
|
}
|
|
12971
|
-
const { palAtWorkspace } = await import("./store-
|
|
13630
|
+
const { palAtWorkspace } = await import("./store-D3XUEEAF.js");
|
|
12972
13631
|
if (palAtWorkspace(options.cwd ?? process.cwd()))
|
|
12973
13632
|
throw new Error("This Pal requires its owned virtual computer. Open it with namzu pal chat.");
|
|
12974
13633
|
const commandArguments = builtinCommandArguments();
|
|
@@ -12976,7 +13635,7 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
12976
13635
|
const sessionAllows = createSessionAllows(commandArguments, {
|
|
12977
13636
|
cwd: /* @__PURE__ */ __name(() => cwd, "cwd")
|
|
12978
13637
|
});
|
|
12979
|
-
|
|
13638
|
+
let sessionRules = [...options.rules ?? [], sessionAllows.rule];
|
|
12980
13639
|
const fileObservations = /* @__PURE__ */ new Map();
|
|
12981
13640
|
const observationsFor = /* @__PURE__ */ __name((id, prior) => {
|
|
12982
13641
|
let seeded = fileObservations.get(id);
|
|
@@ -13005,7 +13664,7 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
13005
13664
|
}
|
|
13006
13665
|
return seeded;
|
|
13007
13666
|
}, "observationsFor");
|
|
13008
|
-
const requestedCwd =
|
|
13667
|
+
const requestedCwd = resolve14(options.cwd ?? process.cwd());
|
|
13009
13668
|
let cwd;
|
|
13010
13669
|
try {
|
|
13011
13670
|
const entry2 = await stat4(requestedCwd);
|
|
@@ -13037,13 +13696,13 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
13037
13696
|
paths = options.conversationSessions.paths;
|
|
13038
13697
|
projectId = options.conversationSessions.projectId;
|
|
13039
13698
|
} else {
|
|
13040
|
-
const home =
|
|
13699
|
+
const home = resolve14(options.stateRoot ?? resolveNamzuHome());
|
|
13041
13700
|
ensurePrivateStateDirectory(home, "projects");
|
|
13042
13701
|
const project = await ensureProject({ home, cwd: cliProjectRoot(cwd) });
|
|
13043
13702
|
paths = new SessionPaths({ home, slug: project.slug });
|
|
13044
13703
|
projectId = project.projectId;
|
|
13045
13704
|
}
|
|
13046
|
-
ensurePrivateStateDirectory(
|
|
13705
|
+
ensurePrivateStateDirectory(resolve14(paths.projectDir(), ".."), paths.slug);
|
|
13047
13706
|
ensurePrivateStateDirectory(paths.projectDir(), "memory");
|
|
13048
13707
|
} catch (error) {
|
|
13049
13708
|
return emptySession(
|
|
@@ -13295,6 +13954,7 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
13295
13954
|
});
|
|
13296
13955
|
throw err;
|
|
13297
13956
|
}
|
|
13957
|
+
sessionRules = withSandboxShell(sessionRules, sandbox);
|
|
13298
13958
|
cliLogger()[sandboxResolvedSeverity(sandbox)](sandbox.notice, {
|
|
13299
13959
|
[EVENT_NAME_ATTRIBUTE]: BOOT_EVENT_NAMES.SANDBOX_RESOLVED,
|
|
13300
13960
|
"namzu.sandbox.unconfined": sandbox.unconfined
|
|
@@ -13337,8 +13997,8 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
13337
13997
|
}
|
|
13338
13998
|
const directories = [];
|
|
13339
13999
|
for (const dir of options.additionalDirectories ?? []) {
|
|
13340
|
-
const absolute =
|
|
13341
|
-
if (absolute !==
|
|
14000
|
+
const absolute = resolve14(cwd, dir);
|
|
14001
|
+
if (absolute !== resolve14(cwd) && !directories.includes(absolute)) directories.push(absolute);
|
|
13342
14002
|
}
|
|
13343
14003
|
const sessionDirectories = createSessionDirectories(cwd, directories);
|
|
13344
14004
|
const checkpoints = new FileCheckpointStore(
|
|
@@ -13542,7 +14202,7 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
13542
14202
|
}
|
|
13543
14203
|
let sideModel;
|
|
13544
14204
|
let learning;
|
|
13545
|
-
const webCapability = options.web?.fetch ? {
|
|
14205
|
+
const webCapability = options.web?.fetch !== false ? {
|
|
13546
14206
|
// A page may be ten mebibytes; the guard's own
|
|
13547
14207
|
// default is two.
|
|
13548
14208
|
fetch: new GuardedFetchProvider({ maxBytes: WEB_FETCH_MAX_BYTES }),
|
|
@@ -13627,7 +14287,8 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
13627
14287
|
if (!owner || owner.sessionId !== sessionId || owner.tenantId !== sessions.tenantId || owner.projectId !== sessions.projectId)
|
|
13628
14288
|
throw new Error("The requesting turn no longer owns this conversation.");
|
|
13629
14289
|
},
|
|
13630
|
-
options.compaction?.resolveEvidenceQueries !== false
|
|
14290
|
+
options.compaction?.resolveEvidenceQueries !== false,
|
|
14291
|
+
true
|
|
13631
14292
|
);
|
|
13632
14293
|
evidenceRecallSteps.set(sessionId, step);
|
|
13633
14294
|
}
|
|
@@ -13860,7 +14521,7 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
13860
14521
|
runsDirectory: /* @__PURE__ */ __name((turnId) => {
|
|
13861
14522
|
if (options.ephemeral) return void 0;
|
|
13862
14523
|
const owner = delegationScopes.get(turnId) ?? scope2;
|
|
13863
|
-
return
|
|
14524
|
+
return join15(paths.sessionDir({ sessionId: owner.sessionId }), "runs");
|
|
13864
14525
|
}, "runsDirectory"),
|
|
13865
14526
|
refusal: /* @__PURE__ */ __name((turnId) => {
|
|
13866
14527
|
const auth = delegatedWorkflowAuth.get(turnId);
|
|
@@ -14061,6 +14722,20 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
14061
14722
|
})
|
|
14062
14723
|
])
|
|
14063
14724
|
);
|
|
14725
|
+
toolsets.push(
|
|
14726
|
+
deferred(
|
|
14727
|
+
toolset("plan-mode-entry", [
|
|
14728
|
+
buildEnterPlanModeTool({
|
|
14729
|
+
mode: /* @__PURE__ */ __name(() => currentPlanHost?.mode() ?? "prompt", "mode"),
|
|
14730
|
+
planPath: /* @__PURE__ */ __name(() => currentPlanHost?.planPath ?? paths.planFile({ sessionId: scope2.sessionId }), "planPath"),
|
|
14731
|
+
ask: /* @__PURE__ */ __name(() => currentOnQuestion, "ask"),
|
|
14732
|
+
enter: /* @__PURE__ */ __name(async () => {
|
|
14733
|
+
await currentPlanHost?.enter?.();
|
|
14734
|
+
}, "enter")
|
|
14735
|
+
})
|
|
14736
|
+
])
|
|
14737
|
+
)
|
|
14738
|
+
);
|
|
14064
14739
|
}
|
|
14065
14740
|
if (options.extraTools && options.extraTools.length > 0) {
|
|
14066
14741
|
toolsets.push(toolset("extra", options.extraTools));
|
|
@@ -14079,7 +14754,7 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
14079
14754
|
);
|
|
14080
14755
|
toolsets.push(options.toolLoading === "eager" ? monitorToolset : deferred(monitorToolset));
|
|
14081
14756
|
}
|
|
14082
|
-
const operatorPals = await import("./operator-tools-
|
|
14757
|
+
const operatorPals = await import("./operator-tools-2OYRNPCH.js");
|
|
14083
14758
|
toolsets.push(
|
|
14084
14759
|
readyWhen(
|
|
14085
14760
|
toolset(
|
|
@@ -14142,9 +14817,13 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
14142
14817
|
const hasSaveSkillTool = (options.extraTools ?? []).some(
|
|
14143
14818
|
(tool) => tool.name === SAVE_SKILL_TOOL_NAME
|
|
14144
14819
|
);
|
|
14820
|
+
let readHookMode;
|
|
14145
14821
|
let pluginRuntime;
|
|
14146
14822
|
try {
|
|
14147
|
-
pluginRuntime = await createCliPluginRuntime(options.plugins, cwd, options.hooks
|
|
14823
|
+
pluginRuntime = await createCliPluginRuntime(options.plugins, cwd, options.hooks, {
|
|
14824
|
+
permissionMode: /* @__PURE__ */ __name(() => hookSessionMode(readHookMode?.(), options.permissionMode), "permissionMode"),
|
|
14825
|
+
transcriptPath: /* @__PURE__ */ __name((sessionId) => options.ephemeral ? void 0 : paths.sessionLog({ sessionId }), "transcriptPath")
|
|
14826
|
+
});
|
|
14148
14827
|
} catch (error) {
|
|
14149
14828
|
await Promise.allSettled([mcp.close(), computerUseHost?.dispose(), browserControl?.dispose()]);
|
|
14150
14829
|
return emptySession(
|
|
@@ -14287,7 +14966,7 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
14287
14966
|
try {
|
|
14288
14967
|
const routed = await routeModel(
|
|
14289
14968
|
{
|
|
14290
|
-
task:
|
|
14969
|
+
task: lastPromptText(messages),
|
|
14291
14970
|
config: routing,
|
|
14292
14971
|
features: {
|
|
14293
14972
|
conversationLength: messages.length,
|
|
@@ -14484,7 +15163,8 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
14484
15163
|
...options.memory?.recall === false ? [] : [
|
|
14485
15164
|
createMemoryRecallStep({
|
|
14486
15165
|
store: memoryStore,
|
|
14487
|
-
identifierGrounding: options.memory?.identifierGrounding
|
|
15166
|
+
identifierGrounding: options.memory?.identifierGrounding,
|
|
15167
|
+
record: true
|
|
14488
15168
|
})
|
|
14489
15169
|
],
|
|
14490
15170
|
...options.conversationSessions ? [createContextInventoryStep()] : [],
|
|
@@ -14493,6 +15173,7 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
14493
15173
|
],
|
|
14494
15174
|
...options.compaction?.consolidate ? { consolidateInto: memoryStore } : { promoteMemory },
|
|
14495
15175
|
projectInstructionContext: projectInstructions.createTurnContext(),
|
|
15176
|
+
...resumePlanPath ? { postCompactionContext: /* @__PURE__ */ __name(() => planCarriedAcrossCompaction(resumePlanPath), "postCompactionContext") } : {},
|
|
14496
15177
|
paths,
|
|
14497
15178
|
...sandbox.provider ? { sandboxProvider: sandbox.provider } : {},
|
|
14498
15179
|
...options.sandbox?.teardownTimeoutMs !== void 0 ? { sandboxTeardownTimeoutMs: options.sandbox.teardownTimeoutMs } : {},
|
|
@@ -14517,7 +15198,10 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
14517
15198
|
// The gate's deny rules still apply.
|
|
14518
15199
|
resumeHandler,
|
|
14519
15200
|
approvalPolicyName: modeControl.initialName,
|
|
14520
|
-
onApprovalPolicy: /* @__PURE__ */ __name((box) =>
|
|
15201
|
+
onApprovalPolicy: /* @__PURE__ */ __name((box) => {
|
|
15202
|
+
readHookMode = /* @__PURE__ */ __name(() => modeControl.current(), "readHookMode");
|
|
15203
|
+
modeControl.attach(box);
|
|
15204
|
+
}, "onApprovalPolicy"),
|
|
14521
15205
|
reviewAllowedCalls,
|
|
14522
15206
|
signal: ownedSignal,
|
|
14523
15207
|
// Attribution comes from the ENTRY, not from this session: the turn
|
|
@@ -14630,8 +15314,8 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
14630
15314
|
if (mapped) yield mapped;
|
|
14631
15315
|
}
|
|
14632
15316
|
if (settled) break;
|
|
14633
|
-
await new Promise((
|
|
14634
|
-
wake =
|
|
15317
|
+
await new Promise((resolve15) => {
|
|
15318
|
+
wake = resolve15;
|
|
14635
15319
|
});
|
|
14636
15320
|
wake = void 0;
|
|
14637
15321
|
}
|
|
@@ -14684,8 +15368,10 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
14684
15368
|
const sessionId = scope2.sessionId;
|
|
14685
15369
|
const sessions = options.conversationSessions;
|
|
14686
15370
|
await prepareProviderCredential(signal);
|
|
15371
|
+
const planNote = options.planApproval && !options.ephemeral ? await planCarriedAcrossCompaction(paths.planFile({ sessionId })) : void 0;
|
|
14687
15372
|
const common = {
|
|
14688
15373
|
config: compactionConfigFor(options.compaction),
|
|
15374
|
+
...planNote ? { restoreNote: planNote } : {},
|
|
14689
15375
|
provider: providerForSession(sessionId),
|
|
14690
15376
|
model,
|
|
14691
15377
|
signal,
|
|
@@ -14787,6 +15473,15 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
14787
15473
|
currentTaskStore,
|
|
14788
15474
|
resetTaskStore,
|
|
14789
15475
|
jobs: /* @__PURE__ */ __name(() => ownedJobs?.list() ?? [], "jobs"),
|
|
15476
|
+
...jobRegistry ? {
|
|
15477
|
+
foreground: {
|
|
15478
|
+
commands: /* @__PURE__ */ __name(() => jobRegistry.foregroundCommands(jobOwner), "commands"),
|
|
15479
|
+
background: /* @__PURE__ */ __name((reason) => jobRegistry.backgroundForeground(jobOwner, reason), "background"),
|
|
15480
|
+
onChange: /* @__PURE__ */ __name((listener) => jobRegistry.onForegroundChange((owner) => {
|
|
15481
|
+
if (owner === jobOwner) listener();
|
|
15482
|
+
}), "onChange")
|
|
15483
|
+
}
|
|
15484
|
+
} : {},
|
|
14790
15485
|
...ownedJobs ? {
|
|
14791
15486
|
readJob: /* @__PURE__ */ __name((id, fromOffset) => ownedJobs.read(id, fromOffset === void 0 ? {} : { fromOffset }), "readJob"),
|
|
14792
15487
|
stopJob: /* @__PURE__ */ __name((id) => ownedJobs.kill(id), "stopJob")
|
|
@@ -14831,7 +15526,7 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
14831
15526
|
const live = host.registry.list();
|
|
14832
15527
|
const known = new Set(live.map((view) => view.runId));
|
|
14833
15528
|
const saved = options.ephemeral ? [] : await listWorkflowRuns(
|
|
14834
|
-
|
|
15529
|
+
join15(paths.sessionDir({ sessionId: scope2.sessionId }), "runs")
|
|
14835
15530
|
).catch(() => []);
|
|
14836
15531
|
return [
|
|
14837
15532
|
...[...live].sort((a, b) => b.startedAt - a.startedAt),
|
|
@@ -15173,6 +15868,7 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
15173
15868
|
mode: /* @__PURE__ */ __name(() => modeControl.current(), "mode"),
|
|
15174
15869
|
planPath,
|
|
15175
15870
|
approval: opts?.onPlanExit,
|
|
15871
|
+
enter: opts?.onPlanEnter,
|
|
15176
15872
|
bypassAvailable: opts?.bypassAvailable ?? (() => false)
|
|
15177
15873
|
} : void 0;
|
|
15178
15874
|
const [environmentFacts, turnSnapshot] = await Promise.all([
|
|
@@ -15192,11 +15888,16 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
15192
15888
|
},
|
|
15193
15889
|
{ stable: stableEnvironment }
|
|
15194
15890
|
);
|
|
15195
|
-
const turnSnapshotPrompt = turnSnapshot ? composeTurnSnapshot(turnSnapshot) : null;
|
|
15196
15891
|
const promptContributions = new PromptContributionRegistry();
|
|
15197
15892
|
for (const contribution of pluginRuntime?.manager.promptContributions ?? []) {
|
|
15198
15893
|
promptContributions.register(contribution);
|
|
15199
15894
|
}
|
|
15895
|
+
if (options.appendSystem)
|
|
15896
|
+
promptContributions.register({
|
|
15897
|
+
id: "namzu.cli.append-system",
|
|
15898
|
+
placement: "dynamic",
|
|
15899
|
+
render: /* @__PURE__ */ __name(() => options.appendSystem ?? null, "render")
|
|
15900
|
+
});
|
|
15200
15901
|
for (const [serverName, spec] of Object.entries(options.mcpServers ?? {})) {
|
|
15201
15902
|
if (spec?.instructions !== true) continue;
|
|
15202
15903
|
promptContributions.register({
|
|
@@ -15222,11 +15923,6 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
15222
15923
|
placement: "context",
|
|
15223
15924
|
render: /* @__PURE__ */ __name(() => projectGuidance, "render")
|
|
15224
15925
|
});
|
|
15225
|
-
promptContributions.register({
|
|
15226
|
-
id: "namzu.turn-snapshot",
|
|
15227
|
-
placement: "context",
|
|
15228
|
-
render: /* @__PURE__ */ __name(() => turnSnapshotPrompt, "render")
|
|
15229
|
-
});
|
|
15230
15926
|
if (webCapability) promptContributions.register(webGuidanceContribution);
|
|
15231
15927
|
const childOperatorNotices = options.ephemeral ? [] : await readChildOperatorNotices(paths, turnScope.sessionId);
|
|
15232
15928
|
const hostContext = /* @__PURE__ */ __name(() => [
|
|
@@ -15329,7 +16025,7 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
15329
16025
|
);
|
|
15330
16026
|
lastSystemPromptText = systemPrompt;
|
|
15331
16027
|
await announceSessionStart();
|
|
15332
|
-
checkpoints.beginTurn(
|
|
16028
|
+
checkpoints.beginTurn(lastPromptText(messages), turnId, {
|
|
15333
16029
|
promptOrdinal: Math.max(0, messages.filter((m) => m.role === "user").length - 1)
|
|
15334
16030
|
});
|
|
15335
16031
|
if (opts?.goalRound) {
|
|
@@ -15437,6 +16133,7 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
15437
16133
|
promoteMemory: options.compaction?.consolidate ? void 0 : promoteMemory,
|
|
15438
16134
|
prepareStep: [
|
|
15439
16135
|
createTaskContextStep(turnTaskStore, turnScope.tenantId),
|
|
16136
|
+
createRepositorySnapshotStep(turnSnapshot),
|
|
15440
16137
|
...savedAgentsSteps(turnScope.sessionId),
|
|
15441
16138
|
// A host-supplied resident step may select the request model.
|
|
15442
16139
|
// Run it before every budgeted recall and memory admission.
|
|
@@ -15444,8 +16141,9 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
15444
16141
|
...options.memory?.recall === false ? [] : [
|
|
15445
16142
|
createMemoryRecallStep({
|
|
15446
16143
|
store: memoryStore,
|
|
15447
|
-
query:
|
|
15448
|
-
identifierGrounding: options.memory?.identifierGrounding
|
|
16144
|
+
query: lastPromptText(messages),
|
|
16145
|
+
identifierGrounding: options.memory?.identifierGrounding,
|
|
16146
|
+
record: true
|
|
15449
16147
|
})
|
|
15450
16148
|
],
|
|
15451
16149
|
...options.conversationSessions ? [createContextInventoryStep()] : [],
|
|
@@ -15462,10 +16160,14 @@ async function createAgentSession(prefs, detected, options = {}) {
|
|
|
15462
16160
|
systemPrompt,
|
|
15463
16161
|
messages,
|
|
15464
16162
|
projectInstructionContext: projectInstructions.createTurnContext(),
|
|
16163
|
+
...planPath ? { postCompactionContext: /* @__PURE__ */ __name(() => planCarriedAcrossCompaction(planPath), "postCompactionContext") } : {},
|
|
15465
16164
|
opts: turnOpts,
|
|
15466
16165
|
resumeHandler,
|
|
15467
16166
|
approvalPolicyName: modeControl.initialName,
|
|
15468
|
-
onApprovalPolicy: /* @__PURE__ */ __name((box) =>
|
|
16167
|
+
onApprovalPolicy: /* @__PURE__ */ __name((box) => {
|
|
16168
|
+
readHookMode = /* @__PURE__ */ __name(() => modeControl.current(), "readHookMode");
|
|
16169
|
+
modeControl.attach(box);
|
|
16170
|
+
}, "onApprovalPolicy"),
|
|
15469
16171
|
reviewAllowedCalls: modeControl.reviewAllowedCalls,
|
|
15470
16172
|
taskGateway: await subagentRuntime?.gatewayForTurn(turnId),
|
|
15471
16173
|
completionInbox: await subagentRuntime?.completionInboxForTurn(turnId),
|
|
@@ -15903,14 +16605,6 @@ function conversationDrovePc(messages) {
|
|
|
15903
16605
|
return false;
|
|
15904
16606
|
}
|
|
15905
16607
|
__name(conversationDrovePc, "conversationDrovePc");
|
|
15906
|
-
function lastUserText(messages) {
|
|
15907
|
-
for (let i = messages.length - 1; i >= 0; i--) {
|
|
15908
|
-
const m = messages[i];
|
|
15909
|
-
if (m?.role === "user" && typeof m.content === "string") return m.content;
|
|
15910
|
-
}
|
|
15911
|
-
return "";
|
|
15912
|
-
}
|
|
15913
|
-
__name(lastUserText, "lastUserText");
|
|
15914
16608
|
function mintScope(projectId, sessionId) {
|
|
15915
16609
|
return {
|
|
15916
16610
|
sessionId: sessionId ?? generateSessionId(),
|
|
@@ -15920,15 +16614,8 @@ function mintScope(projectId, sessionId) {
|
|
|
15920
16614
|
};
|
|
15921
16615
|
}
|
|
15922
16616
|
__name(mintScope, "mintScope");
|
|
15923
|
-
var VERIFICATION_GATE = {
|
|
15924
|
-
enabled: true,
|
|
15925
|
-
allowReadOnlyTools: true,
|
|
15926
|
-
denyDangerousPatterns: true,
|
|
15927
|
-
logDecisions: false,
|
|
15928
|
-
rules: []
|
|
15929
|
-
};
|
|
15930
16617
|
function gateFor(rules) {
|
|
15931
|
-
return
|
|
16618
|
+
return cliGate(rules);
|
|
15932
16619
|
}
|
|
15933
16620
|
__name(gateFor, "gateFor");
|
|
15934
16621
|
var MAX_OUTPUT_CONTINUATIONS = 3;
|
|
@@ -16169,20 +16856,28 @@ async function* runTurn({
|
|
|
16169
16856
|
}
|
|
16170
16857
|
} catch (err) {
|
|
16171
16858
|
if (isTurnInProgressError(err)) {
|
|
16859
|
+
const freeInMinutes = err.state === "running" ? minutesUntilFree(
|
|
16860
|
+
await (sessionLog ?? DiskSessionLog.at(paths, { sessionId: scope2.sessionId })).lease().catch(() => null),
|
|
16861
|
+
Date.now()
|
|
16862
|
+
) : void 0;
|
|
16172
16863
|
yield {
|
|
16173
16864
|
kind: "error",
|
|
16174
|
-
message: `This conversation already has a ${err.state} reply. ${err.state === "running" ? "Wait for it to finish." : "Resume it with /resume, or close it with /abandon."}`,
|
|
16865
|
+
message: freeInMinutes !== void 0 ? conversationInUseSentence(freeInMinutes) : `This conversation already has a ${err.state} reply. ${err.state === "running" ? "Wait for it to finish." : "Resume it with /resume, or close it with /abandon."}`,
|
|
16175
16866
|
turnInProgress: {
|
|
16176
16867
|
sessionId: String(err.sessionId),
|
|
16177
16868
|
activeTurnId: String(err.activeTurnId),
|
|
16178
|
-
state: err.state
|
|
16869
|
+
state: err.state,
|
|
16870
|
+
...freeInMinutes !== void 0 ? { freeInMinutes } : {}
|
|
16179
16871
|
}
|
|
16180
16872
|
};
|
|
16181
16873
|
return;
|
|
16182
16874
|
}
|
|
16183
16875
|
yield {
|
|
16184
16876
|
kind: "error",
|
|
16185
|
-
message: err instanceof Error ? err.message : String(err)
|
|
16877
|
+
message: err instanceof Error ? err.message : String(err),
|
|
16878
|
+
// A refusal Namzu raised before the turn began carries its facts (which
|
|
16879
|
+
// model, which limit), so a screen can say it in plain words.
|
|
16880
|
+
...isNamzuError(err) ? { failure: toPlatformError(err) } : {}
|
|
16186
16881
|
};
|
|
16187
16882
|
} finally {
|
|
16188
16883
|
turnManager.dispose();
|
|
@@ -16504,7 +17199,11 @@ function toAgentEvent(event, presenter, readsOnly, cwd) {
|
|
|
16504
17199
|
...event.windowSource !== void 0 ? { windowSource: event.windowSource } : {}
|
|
16505
17200
|
};
|
|
16506
17201
|
case "provider_fallback":
|
|
16507
|
-
return {
|
|
17202
|
+
return {
|
|
17203
|
+
kind: "provider-fallback",
|
|
17204
|
+
text: describeFallback(event),
|
|
17205
|
+
...event.restart ? { restart: true } : {}
|
|
17206
|
+
};
|
|
16508
17207
|
case "capability_warning":
|
|
16509
17208
|
return {
|
|
16510
17209
|
kind: "capability-warning",
|
|
@@ -16537,6 +17236,7 @@ function toAgentEvent(event, presenter, readsOnly, cwd) {
|
|
|
16537
17236
|
duplicateResults: event.duplicateToolResultsRemoved,
|
|
16538
17237
|
orphanedResults: event.orphanedToolResultsRemoved,
|
|
16539
17238
|
interruptedCalls: event.syntheticToolResultsInserted,
|
|
17239
|
+
...event.neverRanToolResultsInserted ? { neverRanCalls: event.neverRanToolResultsInserted } : {},
|
|
16540
17240
|
text: `Tool history repaired before the model call: ${changes.join("; ")}. Verify external state before retrying non-idempotent tools.`
|
|
16541
17241
|
};
|
|
16542
17242
|
}
|
|
@@ -16548,6 +17248,7 @@ function toAgentEvent(event, presenter, readsOnly, cwd) {
|
|
|
16548
17248
|
subject: event.subject,
|
|
16549
17249
|
status: event.status,
|
|
16550
17250
|
...event.blockedBy ? { blockedBy: event.blockedBy.map(String) } : {},
|
|
17251
|
+
...event.activeForm ? { activeForm: event.activeForm } : {},
|
|
16551
17252
|
...event.type === "task_updated" && event.deleted ? { removed: true } : {}
|
|
16552
17253
|
};
|
|
16553
17254
|
case "turn_paused":
|
|
@@ -16642,7 +17343,9 @@ function describeFallback(event) {
|
|
|
16642
17343
|
describeProviderFallbackNotice({
|
|
16643
17344
|
fromProviderId: event.fromProviderId,
|
|
16644
17345
|
toProviderId: event.toProviderId,
|
|
16645
|
-
reason: event.code
|
|
17346
|
+
reason: event.code,
|
|
17347
|
+
...event.fromModel ? { fromModel: event.fromModel } : {},
|
|
17348
|
+
...event.toModel ? { toModel: event.toModel } : {}
|
|
16646
17349
|
}),
|
|
16647
17350
|
raw,
|
|
16648
17351
|
debugRequested()
|
|
@@ -16895,6 +17598,7 @@ export {
|
|
|
16895
17598
|
createCurrentCredentialReader,
|
|
16896
17599
|
createTaskContextStep,
|
|
16897
17600
|
createLiveModeControl,
|
|
17601
|
+
cliGate,
|
|
16898
17602
|
IdleCompactor,
|
|
16899
17603
|
IDLE_COMPACTION_NOTICE,
|
|
16900
17604
|
describeCapabilityNotice,
|
|
@@ -16993,4 +17697,4 @@ export {
|
|
|
16993
17697
|
RESULT_SUMMARY_WHOLE_MAX,
|
|
16994
17698
|
resultSummaryLine
|
|
16995
17699
|
};
|
|
16996
|
-
//# sourceMappingURL=chunk-
|
|
17700
|
+
//# sourceMappingURL=chunk-F6WVRMVY.js.map
|