@namzu/cli 40.0.0 → 41.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +77 -0
- package/dist/bin.js +1 -1
- package/dist/chunks/{acp-E7XNZWFV.js → acp-PHHX4X7I.js} +40 -35
- package/dist/chunks/acp-PHHX4X7I.js.map +6 -0
- package/dist/chunks/{activity-command-QANVT2PA.js → activity-command-VZYEOBGH.js} +12 -11
- package/dist/chunks/activity-command-VZYEOBGH.js.map +6 -0
- package/dist/chunks/{add-VDRMBSNZ.js → add-7C455H4M.js} +20 -19
- package/dist/chunks/add-7C455H4M.js.map +6 -0
- package/dist/chunks/{agent-PPQJZWBO.js → agent-DWDNEJ4O.js} +33 -26
- package/dist/chunks/agent-session-6VKAI3MW.js +59 -0
- package/dist/chunks/{archive-SH4IG6KC.js → archive-64TMFN4V.js} +10 -9
- package/dist/chunks/archive-64TMFN4V.js.map +6 -0
- package/dist/chunks/{bin-main-D45Q7FMM.js → bin-main-FHIEKDBH.js} +3 -3
- package/dist/chunks/{browser-EUFWHKYD.js → browser-S5FSWWNV.js} +6 -6
- package/dist/chunks/{chat-QDWGHEEL.js → chat-DNBIXT2D.js} +15 -14
- package/dist/chunks/chat-DNBIXT2D.js.map +6 -0
- package/dist/chunks/{chunk-6UDJ3PVE.js → chunk-3K52E4DA.js} +26 -201
- package/dist/chunks/chunk-3K52E4DA.js.map +6 -0
- package/dist/chunks/{chunk-BZ4U5L7N.js → chunk-3SODK62W.js} +9 -9
- package/dist/chunks/{chunk-C3ZJQLUX.js → chunk-42I6K42A.js} +2 -2
- package/dist/chunks/{chunk-5HSG2XFD.js → chunk-44B2CZ55.js} +2 -2
- package/dist/chunks/{chunk-C723P7SP.js → chunk-52R5A75N.js} +6 -6
- package/dist/chunks/{chunk-ZPIHARMI.js → chunk-57ECSVZJ.js} +4 -4
- package/dist/chunks/{chunk-DWSATEAY.js → chunk-5U7CJV4T.js} +2 -2
- package/dist/chunks/{chunk-T6INV7EZ.js → chunk-6WWEY6KW.js} +19 -19
- package/dist/chunks/{chunk-RAS4ZA5C.js → chunk-75FRF5SV.js} +5 -5
- package/dist/chunks/{chunk-KOYEUNX7.js → chunk-75XGHRMM.js} +4 -4
- package/dist/chunks/{chunk-R7XQP4PZ.js → chunk-76XQC54X.js} +3 -3
- package/dist/chunks/{chunk-BQ7PN64G.js → chunk-7QKWJGLX.js} +9 -50
- package/dist/chunks/chunk-7QKWJGLX.js.map +6 -0
- package/dist/chunks/{chunk-BJNHDKU6.js → chunk-AN5NBDDK.js} +2 -2
- package/dist/chunks/{chunk-YTEGBYGL.js → chunk-ARZVX6H7.js} +4 -4
- package/dist/chunks/{chunk-RVNLS4BN.js → chunk-ATB6MDK6.js} +2 -2
- package/dist/chunks/{chunk-O3L5C2WT.js → chunk-BL6HR7T6.js} +2 -2
- package/dist/chunks/{chunk-XDGIOXTU.js → chunk-CRZSMG4A.js} +5 -5
- package/dist/chunks/{chunk-WYULBUCG.js → chunk-DFBRAOJJ.js} +4 -4
- package/dist/chunks/{chunk-HPLVGTBH.js → chunk-DFOMCWXC.js} +2 -2
- package/dist/chunks/{chunk-AQL5A442.js → chunk-DVAUMW53.js} +3 -3
- package/dist/chunks/{chunk-AHPIP5IE.js → chunk-DZQ5B6TK.js} +2 -2
- package/dist/chunks/{chunk-KWRJTEV5.js → chunk-FFZEVYXE.js} +3 -3
- package/dist/chunks/chunk-GDQZHSMZ.js +403 -0
- package/dist/chunks/chunk-GDQZHSMZ.js.map +6 -0
- package/dist/chunks/{chunk-TTDBVPB2.js → chunk-GZCTJ23H.js} +2625 -1992
- package/dist/chunks/chunk-GZCTJ23H.js.map +6 -0
- package/dist/chunks/{chunk-U5KONGAN.js → chunk-HV4AV3CS.js} +3 -3
- package/dist/chunks/{chunk-GDVYFXOR.js → chunk-HXB37QQT.js} +18 -18
- package/dist/chunks/{chunk-GDVYFXOR.js.map → chunk-HXB37QQT.js.map} +2 -2
- package/dist/chunks/{chunk-RVSGU3JS.js → chunk-IBYZTDHR.js} +2 -2
- package/dist/chunks/{chunk-KKYIGLKI.js → chunk-JBAEWQ5I.js} +4 -4
- package/dist/chunks/{chunk-BZJNXGWW.js → chunk-KHWP5BUX.js} +3 -3
- package/dist/chunks/chunk-KV6EVTR7.js +406 -0
- package/dist/chunks/chunk-KV6EVTR7.js.map +6 -0
- package/dist/chunks/chunk-L7T37IYT.js +197 -0
- package/dist/chunks/chunk-L7T37IYT.js.map +6 -0
- package/dist/chunks/chunk-LCGXWCVU.js +28 -0
- package/dist/chunks/chunk-LCGXWCVU.js.map +6 -0
- package/dist/chunks/{chunk-U5PL5D27.js → chunk-LJIEV5UP.js} +2 -2
- package/dist/chunks/{chunk-XLGTH7JD.js → chunk-LQGQJMT7.js} +4 -4
- package/dist/chunks/{chunk-QPEGCKRA.js → chunk-LZHSDCZS.js} +2 -2
- package/dist/chunks/{chunk-HBDBVQ3R.js → chunk-MCZVTGKV.js} +22 -20
- package/dist/chunks/chunk-MCZVTGKV.js.map +6 -0
- package/dist/chunks/{chunk-I7LUF577.js → chunk-MIKVWIFY.js} +3 -3
- package/dist/chunks/{chunk-2I3Z65TV.js → chunk-NU4R7BC5.js} +60 -22
- package/dist/chunks/chunk-NU4R7BC5.js.map +6 -0
- package/dist/chunks/{chunk-53GEER6F.js → chunk-OP6TJ65Q.js} +3 -3
- package/dist/chunks/{chunk-ILTHOMHL.js → chunk-OZ7SAUC5.js} +7 -7
- package/dist/chunks/{chunk-7M6IZGAK.js → chunk-Q3M7HIXS.js} +77 -6
- package/dist/chunks/chunk-Q3M7HIXS.js.map +6 -0
- package/dist/chunks/{chunk-PXKXXNFU.js → chunk-Q56NJHND.js} +2 -2
- package/dist/chunks/{chunk-G6LK7V7F.js → chunk-QE4S3AAB.js} +2 -2
- package/dist/chunks/{chunk-4HUZHYCY.js → chunk-QW2UWIGL.js} +4 -4
- package/dist/chunks/{chunk-73G5WDGM.js → chunk-S4MAWWPH.js} +3 -3
- package/dist/chunks/{chunk-D63T5UQN.js → chunk-S6DQAA2W.js} +15627 -14034
- package/dist/chunks/chunk-S6DQAA2W.js.map +6 -0
- package/dist/chunks/{chunk-X54VNEWE.js → chunk-SAIL2BFW.js} +2 -2
- package/dist/chunks/chunk-TK24NCDI.js +609 -0
- package/dist/chunks/chunk-TK24NCDI.js.map +6 -0
- package/dist/chunks/{chunk-LM3W6AEK.js → chunk-UAW426OS.js} +2 -2
- package/dist/chunks/chunk-UOM2WQWT.js +56 -0
- package/dist/chunks/chunk-UOM2WQWT.js.map +6 -0
- package/dist/chunks/{chunk-C3APHRQB.js → chunk-VJEJ4MDH.js} +2 -2
- package/dist/chunks/{chunk-HLYTSH5W.js → chunk-VP7VGACS.js} +2 -2
- package/dist/chunks/{chunk-GTWNJ7GL.js → chunk-W7Z6CXGV.js} +4 -4
- package/dist/chunks/{chunk-L2GX4GAQ.js → chunk-X5FPHIJV.js} +2 -2
- package/dist/chunks/{chunk-IAL3F2OI.js → chunk-XD6I2JWS.js} +8 -8
- package/dist/chunks/{chunk-SOE4Q55L.js → chunk-XEAQL6XT.js} +2 -2
- package/dist/chunks/{chunk-JAHVXTO4.js → chunk-XXJTG3PY.js} +2 -2
- package/dist/chunks/{chunk-RLMKDLGK.js → chunk-Y7XE2FKY.js} +7 -7
- package/dist/chunks/{chunk-DGV5W2BU.js → chunk-YCZU2AAH.js} +2 -2
- package/dist/chunks/{chunk-AUFSSABF.js → chunk-YEM2A2EP.js} +3 -3
- package/dist/chunks/{chunk-EKFNDKPO.js → chunk-YGGGLNOK.js} +2 -2
- package/dist/chunks/{chunk-SUDXOGE6.js → chunk-YRYBG2IN.js} +50 -30
- package/dist/chunks/chunk-YRYBG2IN.js.map +6 -0
- package/dist/chunks/{chunk-6PAE7AWD.js → chunk-ZGLV3FQF.js} +2 -2
- package/dist/chunks/{chunk-FBY4LGL7.js → chunk-ZR7NIUZ5.js} +3 -3
- package/dist/chunks/{cli-runtime-YD7OZGEU.js → cli-runtime-TFMBNVCM.js} +11 -10
- package/dist/chunks/cli-runtime-TFMBNVCM.js.map +6 -0
- package/dist/chunks/{commands-5P4RLRXG.js → commands-D63UCDXO.js} +5 -5
- package/dist/chunks/{crash-report-F5G32A7S.js → crash-report-DA6SPZFQ.js} +6 -6
- package/dist/chunks/{dist-WB355CNL.js → dist-2S22UD3L.js} +2 -2
- package/dist/chunks/{dist-ZAGIMP7N.js → dist-BX53YVW2.js} +2 -2
- package/dist/chunks/{dist-SX66KAH4.js → dist-CIOAMQ5V.js} +2 -2
- package/dist/chunks/{dist-6O3HSFZP.js → dist-CS6PGGNY.js} +2 -2
- package/dist/chunks/{dist-DFLFYX3A.js → dist-YMNLOZFF.js} +2 -2
- package/dist/chunks/{dist-7B6PZO7C.js → dist-ZOXEFXEG.js} +2 -2
- package/dist/chunks/{dist-Y6SGSSMO.js → dist-ZQNCDMNT.js} +2 -2
- package/dist/chunks/{doctor-2AOB47IO.js → doctor-NXTO5W7O.js} +9 -9
- package/dist/chunks/{drain-M6AGCMJX.js → drain-AN6TSG5Z.js} +10 -10
- package/dist/chunks/{eval-YHY3VO7B.js → eval-IQVUB53L.js} +2 -2
- package/dist/chunks/{exec-KCISQ4M7.js → exec-A24HU7YF.js} +30 -27
- package/dist/chunks/exec-A24HU7YF.js.map +6 -0
- package/dist/chunks/{home-AC5LQKDR.js → home-OHK7HIRS.js} +3 -3
- package/dist/chunks/{host-queries-YQVRKUWC.js → host-queries-2MVXFXFU.js} +15 -14
- package/dist/chunks/host-queries-2MVXFXFU.js.map +6 -0
- package/dist/chunks/learn-F6SCIXWV.js +92 -0
- package/dist/chunks/learn-F6SCIXWV.js.map +6 -0
- package/dist/chunks/learn-builtin-K6MBTXBD.js +235 -0
- package/dist/chunks/learn-builtin-K6MBTXBD.js.map +6 -0
- package/dist/chunks/{lifecycle-CQXCTLAZ.js → lifecycle-SZCCUZSZ.js} +26 -24
- package/dist/chunks/{list-LNKKJZSZ.js → list-JN6UR3ZE.js} +21 -20
- package/dist/chunks/list-JN6UR3ZE.js.map +6 -0
- package/dist/chunks/{login-YA652CIL.js → login-6OWXZOWM.js} +8 -8
- package/dist/chunks/{logs-2PREHSOD.js → logs-DHUCKQZI.js} +4 -4
- package/dist/chunks/{mcp-WJB2UVQW.js → mcp-RBFXGNP4.js} +17 -16
- package/dist/chunks/mcp-RBFXGNP4.js.map +6 -0
- package/dist/chunks/{message-command-IXUASFZO.js → message-command-N4X3OTTG.js} +37 -32
- package/dist/chunks/message-command-N4X3OTTG.js.map +6 -0
- package/dist/chunks/{operator-tools-QOZZZVEC.js → operator-tools-P6GFP2RK.js} +13 -12
- package/dist/chunks/operator-tools-P6GFP2RK.js.map +6 -0
- package/dist/chunks/{output-schema-JTPOC3NL.js → output-schema-JKO3QUVC.js} +3 -3
- package/dist/chunks/{pal-FNSNP47Q.js → pal-5GFCH4E5.js} +11 -11
- package/dist/chunks/{providers-M5HWW7DH.js → providers-22W6AUTI.js} +6 -6
- package/dist/chunks/{resident-R2RCAHYR.js → resident-G6R4DZLL.js} +50 -335
- package/dist/chunks/resident-G6R4DZLL.js.map +6 -0
- package/dist/chunks/resume-MGFWNJ6Q.js +23 -0
- package/dist/chunks/{resume-command-LPN33FIF.js → resume-command-R6QPISLR.js} +4 -4
- package/dist/chunks/{schedule-J2IY3SVE.js → schedule-QDEIY4QB.js} +8 -8
- package/dist/chunks/{service-LEAVOYGP.js → service-ZF3TPBH5.js} +31 -29
- package/dist/chunks/service-ZF3TPBH5.js.map +6 -0
- package/dist/chunks/session-step-X6LLEFHX.js +30 -0
- package/dist/chunks/{skills-X2V3TNTK.js → skills-YAMIRCHY.js} +8 -8
- package/dist/chunks/{state-VDTYWZ5S.js → state-3ACU54IM.js} +2 -2
- package/dist/chunks/{store-DRPRQLDD.js → store-7RLXPZE2.js} +10 -9
- package/dist/chunks/{store-S4QRR5DH.js → store-AR4ZFSJ4.js} +6 -6
- package/dist/chunks/{store-C27Q22UV.js → store-OXXJMFPP.js} +4 -4
- package/dist/chunks/{tui-RU6CRMLX.js → tui-3NJA6ZKY.js} +1745 -1248
- package/dist/chunks/tui-3NJA6ZKY.js.map +6 -0
- package/dist/chunks/{upgrade-I2GMLDWZ.js → upgrade-IEU2FN3F.js} +2 -2
- package/dist/chunks/{worktree-F632OJNE.js → worktree-R7GZ3TZV.js} +12 -11
- package/dist/chunks/worktree-R7GZ3TZV.js.map +6 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/commands/exec-json.d.ts.map +1 -1
- package/dist/commands/exec.d.ts.map +1 -1
- package/dist/commands/learn-builtin.d.ts +8 -0
- package/dist/commands/learn-builtin.d.ts.map +1 -0
- package/dist/commands/learn.d.ts +9 -0
- package/dist/commands/learn.d.ts.map +1 -0
- package/dist/commands/learning.d.ts +6 -0
- package/dist/commands/learning.d.ts.map +1 -0
- package/dist/commands/manifest.d.ts +2 -0
- package/dist/commands/manifest.d.ts.map +1 -1
- package/dist/commands/resident.d.ts +2 -0
- package/dist/commands/resident.d.ts.map +1 -1
- package/dist/config/learning-generator.d.ts +13 -0
- package/dist/config/learning-generator.d.ts.map +1 -0
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/schema.d.ts +23 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/context/doctrine.d.ts +2 -1
- package/dist/context/doctrine.d.ts.map +1 -1
- package/dist/context/environment.d.ts +37 -1
- package/dist/context/environment.d.ts.map +1 -1
- package/dist/context/identity.d.ts +27 -0
- package/dist/context/identity.d.ts.map +1 -0
- package/dist/context/project-tracker.d.ts.map +1 -1
- package/dist/context/system-prompt.d.ts +99 -0
- package/dist/context/system-prompt.d.ts.map +1 -0
- package/dist/index.js +14 -13
- package/dist/integrations/learning/generator-run.d.ts +43 -0
- package/dist/integrations/learning/generator-run.d.ts.map +1 -0
- package/dist/integrations/learning/generator-settings.d.ts +25 -0
- package/dist/integrations/learning/generator-settings.d.ts.map +1 -0
- package/dist/integrations/learning/generator-state.d.ts +28 -0
- package/dist/integrations/learning/generator-state.d.ts.map +1 -0
- package/dist/integrations/learning/generator-trigger.d.ts +58 -0
- package/dist/integrations/learning/generator-trigger.d.ts.map +1 -0
- package/dist/integrations/learning/guidance-history.d.ts +45 -0
- package/dist/integrations/learning/guidance-history.d.ts.map +1 -0
- package/dist/integrations/learning/learned-notice.d.ts +11 -0
- package/dist/integrations/learning/learned-notice.d.ts.map +1 -0
- package/dist/integrations/learning/learning-model.d.ts +26 -0
- package/dist/integrations/learning/learning-model.d.ts.map +1 -0
- package/dist/integrations/learning/project-guidance.d.ts +11 -0
- package/dist/integrations/learning/project-guidance.d.ts.map +1 -0
- package/dist/integrations/learning/scenario-evaluator.d.ts +84 -0
- package/dist/integrations/learning/scenario-evaluator.d.ts.map +1 -0
- package/dist/integrations/learning/scenarios.d.ts +42 -0
- package/dist/integrations/learning/scenarios.d.ts.map +1 -0
- package/dist/integrations/learning/session-feed.d.ts +110 -0
- package/dist/integrations/learning/session-feed.d.ts.map +1 -0
- package/dist/integrations/learning/session-store.d.ts +22 -0
- package/dist/integrations/learning/session-store.d.ts.map +1 -0
- package/dist/integrations/learning/sources.d.ts +4 -0
- package/dist/integrations/learning/sources.d.ts.map +1 -0
- package/dist/integrations/resident/learning-storage.d.ts +2 -2
- package/dist/integrations/resident/learning-storage.d.ts.map +1 -1
- package/dist/integrations/resident/runner-worker.js +22 -19
- package/dist/integrations/resident/runner-worker.js.map +1 -1
- package/dist/integrations/resident/session-step.d.ts.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/subagents/runtime.d.ts +2 -0
- package/dist/integrations/subagents/runtime.d.ts.map +1 -1
- package/dist/integrations/workflows/doctrine.d.ts.map +1 -1
- package/dist/integrations/workflows/host.d.ts +0 -5
- package/dist/integrations/workflows/host.d.ts.map +1 -1
- package/dist/integrations/workflows/offering.d.ts +0 -2
- package/dist/integrations/workflows/offering.d.ts.map +1 -1
- package/dist/integrations/workflows/size.d.ts +9 -1
- package/dist/integrations/workflows/size.d.ts.map +1 -1
- package/dist/permissions/session-allow.d.ts +10 -0
- package/dist/permissions/session-allow.d.ts.map +1 -1
- package/dist/reminders/environment.d.ts +20 -0
- package/dist/reminders/environment.d.ts.map +1 -0
- package/dist/reminders/frame.d.ts +1 -1
- package/dist/reminders/frame.d.ts.map +1 -1
- package/dist/reminders/index.d.ts +11 -1
- package/dist/reminders/index.d.ts.map +1 -1
- package/dist/reminders/mode.d.ts +11 -0
- package/dist/reminders/mode.d.ts.map +1 -0
- package/dist/tui/App.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/PermissionOverlay.d.ts +25 -4
- package/dist/tui/PermissionOverlay.d.ts.map +1 -1
- package/dist/tui/agent.d.ts +53 -2
- package/dist/tui/agent.d.ts.map +1 -1
- package/dist/tui/connector-label.d.ts +19 -0
- package/dist/tui/connector-label.d.ts.map +1 -0
- package/dist/tui/per-call-review.d.ts +50 -0
- package/dist/tui/per-call-review.d.ts.map +1 -0
- package/dist/tui/permission-asks.d.ts +68 -0
- package/dist/tui/permission-asks.d.ts.map +1 -0
- package/dist/tui/queued-calls.d.ts +47 -0
- package/dist/tui/queued-calls.d.ts.map +1 -0
- package/dist/tui/tidy-tool-output.d.ts +5 -0
- package/dist/tui/tidy-tool-output.d.ts.map +1 -1
- package/dist/tui/tool-end-rows.d.ts.map +1 -1
- package/dist/tui/types.d.ts +5 -0
- package/dist/tui/types.d.ts.map +1 -1
- package/package.json +6 -6
- package/skills/schedule-task/SKILL.md +6 -34
- package/dist/chunks/acp-E7XNZWFV.js.map +0 -6
- package/dist/chunks/activity-command-QANVT2PA.js.map +0 -6
- package/dist/chunks/add-VDRMBSNZ.js.map +0 -6
- package/dist/chunks/agent-session-PISYPFO2.js +0 -54
- package/dist/chunks/archive-SH4IG6KC.js.map +0 -6
- package/dist/chunks/chat-QDWGHEEL.js.map +0 -6
- package/dist/chunks/chunk-2I3Z65TV.js.map +0 -6
- package/dist/chunks/chunk-6UDJ3PVE.js.map +0 -6
- package/dist/chunks/chunk-7M6IZGAK.js.map +0 -6
- package/dist/chunks/chunk-BQ7PN64G.js.map +0 -6
- package/dist/chunks/chunk-D63T5UQN.js.map +0 -6
- package/dist/chunks/chunk-HBDBVQ3R.js.map +0 -6
- package/dist/chunks/chunk-SUDXOGE6.js.map +0 -6
- package/dist/chunks/chunk-TTDBVPB2.js.map +0 -6
- package/dist/chunks/cli-runtime-YD7OZGEU.js.map +0 -6
- package/dist/chunks/exec-KCISQ4M7.js.map +0 -6
- package/dist/chunks/host-queries-YQVRKUWC.js.map +0 -6
- package/dist/chunks/list-LNKKJZSZ.js.map +0 -6
- package/dist/chunks/mcp-WJB2UVQW.js.map +0 -6
- package/dist/chunks/message-command-IXUASFZO.js.map +0 -6
- package/dist/chunks/operator-tools-QOZZZVEC.js.map +0 -6
- package/dist/chunks/resident-R2RCAHYR.js.map +0 -6
- package/dist/chunks/resume-UKK4HVCO.js +0 -22
- package/dist/chunks/service-LEAVOYGP.js.map +0 -6
- package/dist/chunks/session-step-2B46NVE7.js +0 -30
- package/dist/chunks/tui-RU6CRMLX.js.map +0 -6
- package/dist/chunks/worktree-F632OJNE.js.map +0 -6
- package/dist/commands/resident-learning.d.ts +0 -6
- package/dist/commands/resident-learning.d.ts.map +0 -1
- package/dist/integrations/resident/learning-sources.d.ts +0 -4
- package/dist/integrations/resident/learning-sources.d.ts.map +0 -1
- /package/dist/chunks/{agent-PPQJZWBO.js.map → agent-DWDNEJ4O.js.map} +0 -0
- /package/dist/chunks/{agent-session-PISYPFO2.js.map → agent-session-6VKAI3MW.js.map} +0 -0
- /package/dist/chunks/{bin-main-D45Q7FMM.js.map → bin-main-FHIEKDBH.js.map} +0 -0
- /package/dist/chunks/{browser-EUFWHKYD.js.map → browser-S5FSWWNV.js.map} +0 -0
- /package/dist/chunks/{chunk-BZ4U5L7N.js.map → chunk-3SODK62W.js.map} +0 -0
- /package/dist/chunks/{chunk-C3ZJQLUX.js.map → chunk-42I6K42A.js.map} +0 -0
- /package/dist/chunks/{chunk-5HSG2XFD.js.map → chunk-44B2CZ55.js.map} +0 -0
- /package/dist/chunks/{chunk-C723P7SP.js.map → chunk-52R5A75N.js.map} +0 -0
- /package/dist/chunks/{chunk-ZPIHARMI.js.map → chunk-57ECSVZJ.js.map} +0 -0
- /package/dist/chunks/{chunk-DWSATEAY.js.map → chunk-5U7CJV4T.js.map} +0 -0
- /package/dist/chunks/{chunk-T6INV7EZ.js.map → chunk-6WWEY6KW.js.map} +0 -0
- /package/dist/chunks/{chunk-RAS4ZA5C.js.map → chunk-75FRF5SV.js.map} +0 -0
- /package/dist/chunks/{chunk-KOYEUNX7.js.map → chunk-75XGHRMM.js.map} +0 -0
- /package/dist/chunks/{chunk-R7XQP4PZ.js.map → chunk-76XQC54X.js.map} +0 -0
- /package/dist/chunks/{chunk-BJNHDKU6.js.map → chunk-AN5NBDDK.js.map} +0 -0
- /package/dist/chunks/{chunk-YTEGBYGL.js.map → chunk-ARZVX6H7.js.map} +0 -0
- /package/dist/chunks/{chunk-RVNLS4BN.js.map → chunk-ATB6MDK6.js.map} +0 -0
- /package/dist/chunks/{chunk-O3L5C2WT.js.map → chunk-BL6HR7T6.js.map} +0 -0
- /package/dist/chunks/{chunk-XDGIOXTU.js.map → chunk-CRZSMG4A.js.map} +0 -0
- /package/dist/chunks/{chunk-WYULBUCG.js.map → chunk-DFBRAOJJ.js.map} +0 -0
- /package/dist/chunks/{chunk-HPLVGTBH.js.map → chunk-DFOMCWXC.js.map} +0 -0
- /package/dist/chunks/{chunk-AQL5A442.js.map → chunk-DVAUMW53.js.map} +0 -0
- /package/dist/chunks/{chunk-AHPIP5IE.js.map → chunk-DZQ5B6TK.js.map} +0 -0
- /package/dist/chunks/{chunk-KWRJTEV5.js.map → chunk-FFZEVYXE.js.map} +0 -0
- /package/dist/chunks/{chunk-U5KONGAN.js.map → chunk-HV4AV3CS.js.map} +0 -0
- /package/dist/chunks/{chunk-RVSGU3JS.js.map → chunk-IBYZTDHR.js.map} +0 -0
- /package/dist/chunks/{chunk-KKYIGLKI.js.map → chunk-JBAEWQ5I.js.map} +0 -0
- /package/dist/chunks/{chunk-BZJNXGWW.js.map → chunk-KHWP5BUX.js.map} +0 -0
- /package/dist/chunks/{chunk-U5PL5D27.js.map → chunk-LJIEV5UP.js.map} +0 -0
- /package/dist/chunks/{chunk-XLGTH7JD.js.map → chunk-LQGQJMT7.js.map} +0 -0
- /package/dist/chunks/{chunk-QPEGCKRA.js.map → chunk-LZHSDCZS.js.map} +0 -0
- /package/dist/chunks/{chunk-I7LUF577.js.map → chunk-MIKVWIFY.js.map} +0 -0
- /package/dist/chunks/{chunk-53GEER6F.js.map → chunk-OP6TJ65Q.js.map} +0 -0
- /package/dist/chunks/{chunk-ILTHOMHL.js.map → chunk-OZ7SAUC5.js.map} +0 -0
- /package/dist/chunks/{chunk-PXKXXNFU.js.map → chunk-Q56NJHND.js.map} +0 -0
- /package/dist/chunks/{chunk-G6LK7V7F.js.map → chunk-QE4S3AAB.js.map} +0 -0
- /package/dist/chunks/{chunk-4HUZHYCY.js.map → chunk-QW2UWIGL.js.map} +0 -0
- /package/dist/chunks/{chunk-73G5WDGM.js.map → chunk-S4MAWWPH.js.map} +0 -0
- /package/dist/chunks/{chunk-X54VNEWE.js.map → chunk-SAIL2BFW.js.map} +0 -0
- /package/dist/chunks/{chunk-LM3W6AEK.js.map → chunk-UAW426OS.js.map} +0 -0
- /package/dist/chunks/{chunk-C3APHRQB.js.map → chunk-VJEJ4MDH.js.map} +0 -0
- /package/dist/chunks/{chunk-HLYTSH5W.js.map → chunk-VP7VGACS.js.map} +0 -0
- /package/dist/chunks/{chunk-GTWNJ7GL.js.map → chunk-W7Z6CXGV.js.map} +0 -0
- /package/dist/chunks/{chunk-L2GX4GAQ.js.map → chunk-X5FPHIJV.js.map} +0 -0
- /package/dist/chunks/{chunk-IAL3F2OI.js.map → chunk-XD6I2JWS.js.map} +0 -0
- /package/dist/chunks/{chunk-SOE4Q55L.js.map → chunk-XEAQL6XT.js.map} +0 -0
- /package/dist/chunks/{chunk-JAHVXTO4.js.map → chunk-XXJTG3PY.js.map} +0 -0
- /package/dist/chunks/{chunk-RLMKDLGK.js.map → chunk-Y7XE2FKY.js.map} +0 -0
- /package/dist/chunks/{chunk-DGV5W2BU.js.map → chunk-YCZU2AAH.js.map} +0 -0
- /package/dist/chunks/{chunk-AUFSSABF.js.map → chunk-YEM2A2EP.js.map} +0 -0
- /package/dist/chunks/{chunk-EKFNDKPO.js.map → chunk-YGGGLNOK.js.map} +0 -0
- /package/dist/chunks/{chunk-6PAE7AWD.js.map → chunk-ZGLV3FQF.js.map} +0 -0
- /package/dist/chunks/{chunk-FBY4LGL7.js.map → chunk-ZR7NIUZ5.js.map} +0 -0
- /package/dist/chunks/{commands-5P4RLRXG.js.map → commands-D63UCDXO.js.map} +0 -0
- /package/dist/chunks/{crash-report-F5G32A7S.js.map → crash-report-DA6SPZFQ.js.map} +0 -0
- /package/dist/chunks/{dist-WB355CNL.js.map → dist-2S22UD3L.js.map} +0 -0
- /package/dist/chunks/{dist-ZAGIMP7N.js.map → dist-BX53YVW2.js.map} +0 -0
- /package/dist/chunks/{dist-SX66KAH4.js.map → dist-CIOAMQ5V.js.map} +0 -0
- /package/dist/chunks/{dist-6O3HSFZP.js.map → dist-CS6PGGNY.js.map} +0 -0
- /package/dist/chunks/{dist-DFLFYX3A.js.map → dist-YMNLOZFF.js.map} +0 -0
- /package/dist/chunks/{dist-7B6PZO7C.js.map → dist-ZOXEFXEG.js.map} +0 -0
- /package/dist/chunks/{dist-Y6SGSSMO.js.map → dist-ZQNCDMNT.js.map} +0 -0
- /package/dist/chunks/{doctor-2AOB47IO.js.map → doctor-NXTO5W7O.js.map} +0 -0
- /package/dist/chunks/{drain-M6AGCMJX.js.map → drain-AN6TSG5Z.js.map} +0 -0
- /package/dist/chunks/{eval-YHY3VO7B.js.map → eval-IQVUB53L.js.map} +0 -0
- /package/dist/chunks/{home-AC5LQKDR.js.map → home-OHK7HIRS.js.map} +0 -0
- /package/dist/chunks/{lifecycle-CQXCTLAZ.js.map → lifecycle-SZCCUZSZ.js.map} +0 -0
- /package/dist/chunks/{login-YA652CIL.js.map → login-6OWXZOWM.js.map} +0 -0
- /package/dist/chunks/{logs-2PREHSOD.js.map → logs-DHUCKQZI.js.map} +0 -0
- /package/dist/chunks/{output-schema-JTPOC3NL.js.map → output-schema-JKO3QUVC.js.map} +0 -0
- /package/dist/chunks/{pal-FNSNP47Q.js.map → pal-5GFCH4E5.js.map} +0 -0
- /package/dist/chunks/{providers-M5HWW7DH.js.map → providers-22W6AUTI.js.map} +0 -0
- /package/dist/chunks/{resume-UKK4HVCO.js.map → resume-MGFWNJ6Q.js.map} +0 -0
- /package/dist/chunks/{resume-command-LPN33FIF.js.map → resume-command-R6QPISLR.js.map} +0 -0
- /package/dist/chunks/{schedule-J2IY3SVE.js.map → schedule-QDEIY4QB.js.map} +0 -0
- /package/dist/chunks/{session-step-2B46NVE7.js.map → session-step-X6LLEFHX.js.map} +0 -0
- /package/dist/chunks/{skills-X2V3TNTK.js.map → skills-YAMIRCHY.js.map} +0 -0
- /package/dist/chunks/{state-VDTYWZ5S.js.map → state-3ACU54IM.js.map} +0 -0
- /package/dist/chunks/{store-C27Q22UV.js.map → store-7RLXPZE2.js.map} +0 -0
- /package/dist/chunks/{store-DRPRQLDD.js.map → store-AR4ZFSJ4.js.map} +0 -0
- /package/dist/chunks/{store-S4QRR5DH.js.map → store-OXXJMFPP.js.map} +0 -0
- /package/dist/chunks/{upgrade-I2GMLDWZ.js.map → upgrade-IEU2FN3F.js.map} +0 -0
|
@@ -1,47 +1,33 @@
|
|
|
1
1
|
import { createRequire as __namzuCreateRequire } from 'node:module';
|
|
2
2
|
const require = __namzuCreateRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
reportCrash
|
|
5
|
-
} from "./chunk-U5PL5D27.js";
|
|
6
3
|
import {
|
|
7
4
|
BYPASS_CONSENT_BODY,
|
|
8
5
|
BYPASS_CONSENT_TITLE,
|
|
9
6
|
acknowledgeBypass,
|
|
10
7
|
hasAcknowledgedBypass
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import {
|
|
13
|
-
settleAnsweredPark
|
|
14
|
-
} from "./chunk-T6INV7EZ.js";
|
|
15
|
-
import {
|
|
16
|
-
DELIVERY_READ_LIMIT,
|
|
17
|
-
readSourceDeliveryPage,
|
|
18
|
-
takeSuppressedCount
|
|
19
|
-
} from "./chunk-HBDBVQ3R.js";
|
|
8
|
+
} from "./chunk-ATB6MDK6.js";
|
|
20
9
|
import {
|
|
21
|
-
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import {
|
|
24
|
-
callEndpoint,
|
|
25
|
-
readEndpoint
|
|
26
|
-
} from "./chunk-6YG7D7U4.js";
|
|
27
|
-
import {
|
|
28
|
-
NAMZU_COMPACT_WORDMARK,
|
|
29
|
-
NAMZU_WORDMARK,
|
|
30
|
-
NAMZU_WORDMARK_MIN_WIDTH,
|
|
31
|
-
checkUpdates,
|
|
32
|
-
resolveNpmInvocation
|
|
33
|
-
} from "./chunk-O2B3B2TM.js";
|
|
10
|
+
reportCrash
|
|
11
|
+
} from "./chunk-LJIEV5UP.js";
|
|
34
12
|
import {
|
|
35
13
|
changesBlock,
|
|
36
14
|
changesSinceConfirmed,
|
|
37
15
|
confirmationView,
|
|
38
16
|
describeChanges,
|
|
39
17
|
permissionsChanged
|
|
40
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-VJEJ4MDH.js";
|
|
41
19
|
import {
|
|
42
20
|
visibleScheduleMessage
|
|
43
21
|
} from "./chunk-NADQQMMG.js";
|
|
22
|
+
import {
|
|
23
|
+
settleAnsweredPark
|
|
24
|
+
} from "./chunk-6WWEY6KW.js";
|
|
44
25
|
import "./chunk-GWQEMJFS.js";
|
|
26
|
+
import {
|
|
27
|
+
DELIVERY_READ_LIMIT,
|
|
28
|
+
readSourceDeliveryPage,
|
|
29
|
+
takeSuppressedCount
|
|
30
|
+
} from "./chunk-MCZVTGKV.js";
|
|
45
31
|
import {
|
|
46
32
|
DEFAULT_MAX_ITERATIONS,
|
|
47
33
|
DEFAULT_TIMEOUT_MS,
|
|
@@ -54,25 +40,39 @@ import {
|
|
|
54
40
|
runsPerDay,
|
|
55
41
|
scriptShellUnavailableReason,
|
|
56
42
|
verifyScheduledScript
|
|
57
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-LQGQJMT7.js";
|
|
44
|
+
import {
|
|
45
|
+
callsCount
|
|
46
|
+
} from "./chunk-E5VLANCO.js";
|
|
58
47
|
import {
|
|
59
48
|
allowsCommands,
|
|
60
49
|
compileJobPolicy,
|
|
61
50
|
compileScriptCheckPolicy,
|
|
62
51
|
isPresetName
|
|
63
|
-
} from "./chunk-
|
|
64
|
-
import "./chunk-HPLVGTBH.js";
|
|
52
|
+
} from "./chunk-75XGHRMM.js";
|
|
65
53
|
import {
|
|
66
54
|
formatResumeShellCommand,
|
|
67
55
|
parkedRunWords,
|
|
68
56
|
resumeCommand
|
|
69
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-YCZU2AAH.js";
|
|
70
58
|
import {
|
|
71
59
|
appendHistory,
|
|
72
60
|
nextFireOf,
|
|
73
61
|
readHistory,
|
|
74
62
|
readState
|
|
75
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-42I6K42A.js";
|
|
64
|
+
import "./chunk-DFOMCWXC.js";
|
|
65
|
+
import {
|
|
66
|
+
callEndpoint,
|
|
67
|
+
readEndpoint
|
|
68
|
+
} from "./chunk-6YG7D7U4.js";
|
|
69
|
+
import {
|
|
70
|
+
NAMZU_COMPACT_WORDMARK,
|
|
71
|
+
NAMZU_WORDMARK,
|
|
72
|
+
NAMZU_WORDMARK_MIN_WIDTH,
|
|
73
|
+
checkUpdates,
|
|
74
|
+
resolveNpmInvocation
|
|
75
|
+
} from "./chunk-O2B3B2TM.js";
|
|
76
76
|
import {
|
|
77
77
|
TURN_LIMIT_FIELDS,
|
|
78
78
|
ThemeEpochContext,
|
|
@@ -108,7 +108,7 @@ import {
|
|
|
108
108
|
useReducedMotion,
|
|
109
109
|
useThemeEpoch,
|
|
110
110
|
useThemeSubscription
|
|
111
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-Y7XE2FKY.js";
|
|
112
112
|
import {
|
|
113
113
|
capChoiceLines,
|
|
114
114
|
choiceDisplayText,
|
|
@@ -121,12 +121,12 @@ import {
|
|
|
121
121
|
} from "./chunk-LFI6O7WL.js";
|
|
122
122
|
import {
|
|
123
123
|
handleTerminationSignals
|
|
124
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-X5FPHIJV.js";
|
|
125
125
|
import "./chunk-TBIX6JRE.js";
|
|
126
126
|
import {
|
|
127
127
|
deleteUserConfigValue,
|
|
128
128
|
setUserConfigValue
|
|
129
|
-
} from "./chunk-
|
|
129
|
+
} from "./chunk-DVAUMW53.js";
|
|
130
130
|
import {
|
|
131
131
|
describeAllCredentialsLogout,
|
|
132
132
|
describeCodexDeviceLoginStart,
|
|
@@ -148,14 +148,14 @@ import {
|
|
|
148
148
|
sectionHeading,
|
|
149
149
|
withAutoChoice,
|
|
150
150
|
writeConversationExport
|
|
151
|
-
} from "./chunk-
|
|
151
|
+
} from "./chunk-KHWP5BUX.js";
|
|
152
152
|
import {
|
|
153
153
|
tuiPalDefinition,
|
|
154
154
|
tuiPalEnvironment,
|
|
155
155
|
tuiPalOwner,
|
|
156
156
|
tuiPalPreferences
|
|
157
|
-
} from "./chunk-
|
|
158
|
-
import "./chunk-
|
|
157
|
+
} from "./chunk-75FRF5SV.js";
|
|
158
|
+
import "./chunk-XD6I2JWS.js";
|
|
159
159
|
import {
|
|
160
160
|
COMPACTED_HINT,
|
|
161
161
|
COMPACTING_LABEL,
|
|
@@ -177,6 +177,7 @@ import {
|
|
|
177
177
|
WORKFLOW_BACKGROUND_NOTE,
|
|
178
178
|
WORKFLOW_TOOL_NAME,
|
|
179
179
|
WORKSPACE_PREVIEW_ROWS,
|
|
180
|
+
allowsFor,
|
|
180
181
|
allowsForBatch,
|
|
181
182
|
appendMemoryWithStatus,
|
|
182
183
|
assistantTranscriptTexts,
|
|
@@ -184,7 +185,9 @@ import {
|
|
|
184
185
|
clipText,
|
|
185
186
|
combineBatches,
|
|
186
187
|
compactionSummaryLines,
|
|
188
|
+
connectorToolLabel,
|
|
187
189
|
createAgentSession,
|
|
190
|
+
createQuestionGate,
|
|
188
191
|
declinedLine,
|
|
189
192
|
describeAllows,
|
|
190
193
|
describeCapabilityNotice,
|
|
@@ -202,6 +205,8 @@ import {
|
|
|
202
205
|
liveBatches,
|
|
203
206
|
mergeGroups,
|
|
204
207
|
modelListingCause,
|
|
208
|
+
mustAskPerson,
|
|
209
|
+
plainConnectorSummary,
|
|
205
210
|
plainDiffRows,
|
|
206
211
|
planApprovalRows,
|
|
207
212
|
probeAgentSession,
|
|
@@ -215,6 +220,7 @@ import {
|
|
|
215
220
|
renderStoredMemorySection,
|
|
216
221
|
renderTypedNoteResult,
|
|
217
222
|
resolveModelSwitch,
|
|
223
|
+
sameAllow,
|
|
218
224
|
spansText,
|
|
219
225
|
toAgentEvent,
|
|
220
226
|
turnLabel,
|
|
@@ -226,15 +232,15 @@ import {
|
|
|
226
232
|
webLiveStatus,
|
|
227
233
|
webSettledLine,
|
|
228
234
|
withDebugDetail
|
|
229
|
-
} from "./chunk-
|
|
235
|
+
} from "./chunk-GZCTJ23H.js";
|
|
230
236
|
import {
|
|
231
237
|
openManagedWorktrees,
|
|
232
238
|
worktreeOpenHint
|
|
233
|
-
} from "./chunk-
|
|
234
|
-
import "./chunk-U5KONGAN.js";
|
|
239
|
+
} from "./chunk-57ECSVZJ.js";
|
|
235
240
|
import {
|
|
236
241
|
describeBrowserStatus
|
|
237
242
|
} from "./chunk-WHODOMXA.js";
|
|
243
|
+
import "./chunk-HV4AV3CS.js";
|
|
238
244
|
import {
|
|
239
245
|
SAVE_SKILL_TOOL_NAME,
|
|
240
246
|
SKILL_CREATOR_SKILL,
|
|
@@ -258,22 +264,24 @@ import {
|
|
|
258
264
|
settledElapsed,
|
|
259
265
|
theme,
|
|
260
266
|
tokenColor
|
|
261
|
-
} from "./chunk-
|
|
267
|
+
} from "./chunk-CRZSMG4A.js";
|
|
262
268
|
import {
|
|
263
269
|
describePlainInterruption,
|
|
264
270
|
describeProviderWait,
|
|
265
271
|
describeProviderWaitClock
|
|
266
|
-
} from "./chunk-
|
|
267
|
-
import "./chunk-
|
|
272
|
+
} from "./chunk-MIKVWIFY.js";
|
|
273
|
+
import "./chunk-TK24NCDI.js";
|
|
274
|
+
import "./chunk-KV6EVTR7.js";
|
|
275
|
+
import "./chunk-DFBRAOJJ.js";
|
|
268
276
|
import {
|
|
269
277
|
openInBrowser
|
|
270
|
-
} from "./chunk-
|
|
278
|
+
} from "./chunk-VP7VGACS.js";
|
|
271
279
|
import "./chunk-NUGPLXVK.js";
|
|
272
280
|
import {
|
|
273
281
|
beginCodexDeviceLogin,
|
|
274
282
|
beginSubscriptionLogin,
|
|
275
283
|
parsePastedInput
|
|
276
|
-
} from "./chunk-
|
|
284
|
+
} from "./chunk-ARZVX6H7.js";
|
|
277
285
|
import {
|
|
278
286
|
NO_SKILLS_FOUND,
|
|
279
287
|
composeSkillsPrompt,
|
|
@@ -281,13 +289,13 @@ import {
|
|
|
281
289
|
loadSkillBody,
|
|
282
290
|
renderSkillRoster,
|
|
283
291
|
skillTierLabel
|
|
284
|
-
} from "./chunk-
|
|
285
|
-
import "./chunk-
|
|
286
|
-
import "./chunk-
|
|
292
|
+
} from "./chunk-S4MAWWPH.js";
|
|
293
|
+
import "./chunk-FFZEVYXE.js";
|
|
294
|
+
import "./chunk-52R5A75N.js";
|
|
287
295
|
import {
|
|
288
296
|
claimPalConversation,
|
|
289
297
|
listPalConversations
|
|
290
|
-
} from "./chunk-
|
|
298
|
+
} from "./chunk-JBAEWQ5I.js";
|
|
291
299
|
import "./chunk-ZWA2JRJV.js";
|
|
292
300
|
import {
|
|
293
301
|
pinTrustedProjectPath,
|
|
@@ -308,12 +316,12 @@ import {
|
|
|
308
316
|
loadConfigWithProvenance,
|
|
309
317
|
readPermissionLayers,
|
|
310
318
|
resolveComposerTriggers
|
|
311
|
-
} from "./chunk-
|
|
319
|
+
} from "./chunk-Q3M7HIXS.js";
|
|
312
320
|
import "./chunk-XSCT3DLE.js";
|
|
313
321
|
import {
|
|
314
322
|
THEME_CHOICES,
|
|
315
323
|
formatConfigSource
|
|
316
|
-
} from "./chunk-
|
|
324
|
+
} from "./chunk-QE4S3AAB.js";
|
|
317
325
|
import {
|
|
318
326
|
displayPath,
|
|
319
327
|
formatSize,
|
|
@@ -323,6 +331,7 @@ import {
|
|
|
323
331
|
productName
|
|
324
332
|
} from "./chunk-XPS3W7FC.js";
|
|
325
333
|
import "./chunk-EUBCYTOK.js";
|
|
334
|
+
import "./chunk-LCGXWCVU.js";
|
|
326
335
|
import {
|
|
327
336
|
readManifest
|
|
328
337
|
} from "./chunk-AK2U3N2A.js";
|
|
@@ -339,7 +348,7 @@ import {
|
|
|
339
348
|
writeJsonAtomic
|
|
340
349
|
} from "./chunk-OEW7CJKK.js";
|
|
341
350
|
import "./chunk-HE7WUOX2.js";
|
|
342
|
-
import "./chunk-
|
|
351
|
+
import "./chunk-Q56NJHND.js";
|
|
343
352
|
import {
|
|
344
353
|
EXIT_INTERNAL_ERROR
|
|
345
354
|
} from "./chunk-Y7B67G22.js";
|
|
@@ -357,7 +366,7 @@ import {
|
|
|
357
366
|
primaryProvider,
|
|
358
367
|
signedInSubscriptionProviders,
|
|
359
368
|
writePreferences
|
|
360
|
-
} from "./chunk-
|
|
369
|
+
} from "./chunk-NU4R7BC5.js";
|
|
361
370
|
import {
|
|
362
371
|
ALL_PROVIDER_IDS,
|
|
363
372
|
PROVIDER_REGISTRY,
|
|
@@ -367,21 +376,22 @@ import {
|
|
|
367
376
|
} from "./chunk-6LLJQ3KY.js";
|
|
368
377
|
import {
|
|
369
378
|
applyProviderFlags
|
|
370
|
-
} from "./chunk-
|
|
379
|
+
} from "./chunk-ZR7NIUZ5.js";
|
|
371
380
|
import "./chunk-XEUQN4JC.js";
|
|
372
381
|
import {
|
|
373
382
|
PAUSED_TURN_LINES,
|
|
374
383
|
currentTimeLine,
|
|
375
384
|
describeTurnStop,
|
|
376
385
|
handoffContinuationNote
|
|
377
|
-
} from "./chunk-
|
|
386
|
+
} from "./chunk-YGGGLNOK.js";
|
|
378
387
|
import {
|
|
379
388
|
autoAvailable,
|
|
380
389
|
nextCycleMode,
|
|
381
390
|
permissionModeDescription,
|
|
382
391
|
permissionModeLabel,
|
|
383
392
|
permissionModeName
|
|
384
|
-
} from "./chunk-
|
|
393
|
+
} from "./chunk-UAW426OS.js";
|
|
394
|
+
import "./chunk-L7T37IYT.js";
|
|
385
395
|
import {
|
|
386
396
|
expandTabs,
|
|
387
397
|
terminalDisplayText
|
|
@@ -408,21 +418,22 @@ import {
|
|
|
408
418
|
titlesOf,
|
|
409
419
|
typedTextOf,
|
|
410
420
|
unarchiveConversation
|
|
411
|
-
} from "./chunk-
|
|
421
|
+
} from "./chunk-7QKWJGLX.js";
|
|
422
|
+
import "./chunk-UOM2WQWT.js";
|
|
412
423
|
import "./chunk-H6B6AROX.js";
|
|
413
|
-
import "./chunk-
|
|
414
|
-
import "./chunk-
|
|
424
|
+
import "./chunk-BL6HR7T6.js";
|
|
425
|
+
import "./chunk-QW2UWIGL.js";
|
|
415
426
|
import {
|
|
416
427
|
isTrusted,
|
|
417
428
|
trustDir
|
|
418
|
-
} from "./chunk-
|
|
429
|
+
} from "./chunk-LZHSDCZS.js";
|
|
419
430
|
import "./chunk-LXB3S4IC.js";
|
|
420
|
-
import "./chunk-
|
|
431
|
+
import "./chunk-76XQC54X.js";
|
|
421
432
|
import "./chunk-WMEZTDLT.js";
|
|
422
433
|
import {
|
|
423
434
|
contextLogging,
|
|
424
435
|
installCliLogging
|
|
425
|
-
} from "./chunk-
|
|
436
|
+
} from "./chunk-XEAQL6XT.js";
|
|
426
437
|
import {
|
|
427
438
|
isFullWidth,
|
|
428
439
|
isWide,
|
|
@@ -432,7 +443,7 @@ import {
|
|
|
432
443
|
import "./chunk-OH6TB27S.js";
|
|
433
444
|
import "./chunk-IE5XIE4W.js";
|
|
434
445
|
import "./chunk-B73OIFL6.js";
|
|
435
|
-
import "./chunk-
|
|
446
|
+
import "./chunk-ZGLV3FQF.js";
|
|
436
447
|
import "./chunk-JORONMD3.js";
|
|
437
448
|
import {
|
|
438
449
|
clearAllStoredCredentials,
|
|
@@ -446,10 +457,10 @@ import {
|
|
|
446
457
|
readStoredSubscriptionCredential,
|
|
447
458
|
restrictToOwner,
|
|
448
459
|
writeStoredGeminiApiKey
|
|
449
|
-
} from "./chunk-
|
|
460
|
+
} from "./chunk-SAIL2BFW.js";
|
|
450
461
|
import {
|
|
451
462
|
namzuHomePath
|
|
452
|
-
} from "./chunk-
|
|
463
|
+
} from "./chunk-5U7CJV4T.js";
|
|
453
464
|
import {
|
|
454
465
|
ACCEPT_EDITS_TOOLS,
|
|
455
466
|
DECLINED_TOOL_CALL_FEEDBACK,
|
|
@@ -510,7 +521,7 @@ import {
|
|
|
510
521
|
validateTimeZone,
|
|
511
522
|
wrapUntrusted,
|
|
512
523
|
writePeerRecord
|
|
513
|
-
} from "./chunk-
|
|
524
|
+
} from "./chunk-S6DQAA2W.js";
|
|
514
525
|
import {
|
|
515
526
|
__commonJS,
|
|
516
527
|
__export,
|
|
@@ -42912,9 +42923,19 @@ function LiveActivity({
|
|
|
42912
42923
|
});
|
|
42913
42924
|
if (!active) return null;
|
|
42914
42925
|
if (waitingForYou) {
|
|
42915
|
-
|
|
42916
|
-
|
|
42917
|
-
|
|
42926
|
+
const queued = activeTools.filter((tool) => tool.queued === true);
|
|
42927
|
+
const shownQueued = queued.slice(0, MAX_VISIBLE_TOOLS);
|
|
42928
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
|
|
42929
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Box_default, { children: [
|
|
42930
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { color: theme.text.secondary, children: "Waiting for you" }),
|
|
42931
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { color: theme.text.muted, children: " \xB7 the question below" })
|
|
42932
|
+
] }),
|
|
42933
|
+
shownQueued.map((tool) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(QueuedToolRow, { tool }, tool.id)),
|
|
42934
|
+
queued.length > shownQueued.length ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Box_default, { paddingLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Text, { color: theme.text.muted, children: [
|
|
42935
|
+
"+",
|
|
42936
|
+
queued.length - shownQueued.length,
|
|
42937
|
+
" more waiting"
|
|
42938
|
+
] }) }) : null
|
|
42918
42939
|
] });
|
|
42919
42940
|
}
|
|
42920
42941
|
const now = Date.now();
|
|
@@ -42997,7 +43018,7 @@ function LiveActivity({
|
|
|
42997
43018
|
waitingRow,
|
|
42998
43019
|
noticeRow,
|
|
42999
43020
|
visibleTools.map((t, index) => {
|
|
43000
|
-
if (t.command !== void 0) {
|
|
43021
|
+
if (t.command !== void 0 && !t.queued) {
|
|
43001
43022
|
const blink = motion ? Math.floor(tick / 5) % 2 === 0 : true;
|
|
43002
43023
|
const rows = shellRunningRows(t.tail ?? [], formatElapsed(now - t.startedAt));
|
|
43003
43024
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
@@ -43014,6 +43035,7 @@ function LiveActivity({
|
|
|
43014
43035
|
)) })
|
|
43015
43036
|
] }, t.id);
|
|
43016
43037
|
}
|
|
43038
|
+
if (t.queued) return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(QueuedToolRow, { tool: t }, t.id);
|
|
43017
43039
|
const percent = t.fraction === void 0 ? "" : `${Math.round(t.fraction * 100)}% \xB7 `;
|
|
43018
43040
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 2, children: [
|
|
43019
43041
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Box_default, { flexDirection: "row", children: [
|
|
@@ -43045,6 +43067,19 @@ function LiveActivity({
|
|
|
43045
43067
|
] });
|
|
43046
43068
|
}
|
|
43047
43069
|
__name(LiveActivity, "LiveActivity");
|
|
43070
|
+
function QueuedToolRow({ tool }) {
|
|
43071
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
43072
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Box_default, { flexDirection: "row", children: [
|
|
43073
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Box_default, { width: 2, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { color: theme.text.muted, children: "\u25CF" }) }),
|
|
43074
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { color: theme.text.secondary, wrap: "truncate-end", children: terminalDisplayText(tool.label) })
|
|
43075
|
+
] }),
|
|
43076
|
+
tool.command !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Box_default, { paddingLeft: RESULT_GUTTER_INDENT, children: [
|
|
43077
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Box_default, { width: RESULT_GUTTER_WIDTH, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { color: theme.text.muted, children: "\u23BF" }) }),
|
|
43078
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { color: shellToneColor("dim"), children: "Waiting\u2026" })
|
|
43079
|
+
] }) : null
|
|
43080
|
+
] });
|
|
43081
|
+
}
|
|
43082
|
+
__name(QueuedToolRow, "QueuedToolRow");
|
|
43048
43083
|
function waitingLine(tools) {
|
|
43049
43084
|
if (tools.length === 0 || !tools.every((tool) => tool.waitingOn !== void 0)) return void 0;
|
|
43050
43085
|
const names = [...new Set(tools.map((tool) => tool.waitingOn))];
|
|
@@ -43278,7 +43313,7 @@ function permissionTitle(toolCalls) {
|
|
|
43278
43313
|
case "workflow":
|
|
43279
43314
|
return "Start a workflow";
|
|
43280
43315
|
default:
|
|
43281
|
-
return first.name;
|
|
43316
|
+
return connectorToolLabel(first.name);
|
|
43282
43317
|
}
|
|
43283
43318
|
}
|
|
43284
43319
|
if (toolCalls.length > 0 && toolCalls.every((call) => call.name === "Agent")) {
|
|
@@ -43305,7 +43340,7 @@ function permissionQuestion(toolCalls) {
|
|
|
43305
43340
|
case "workflow":
|
|
43306
43341
|
return "Do you want to start this workflow?";
|
|
43307
43342
|
default:
|
|
43308
|
-
return `Do you want to run ${first.name}?`;
|
|
43343
|
+
return `Do you want to run ${connectorToolLabel(first.name)}?`;
|
|
43309
43344
|
}
|
|
43310
43345
|
}
|
|
43311
43346
|
if (toolCalls.length > 0 && toolCalls.every((call) => call.name === "Agent")) {
|
|
@@ -43374,10 +43409,6 @@ function extraAnswer(toolCalls, options) {
|
|
|
43374
43409
|
};
|
|
43375
43410
|
}
|
|
43376
43411
|
__name(extraAnswer, "extraAnswer");
|
|
43377
|
-
function permissionChoices(toolCalls, options = {}) {
|
|
43378
|
-
return permissionAnswers(toolCalls, options).map((answer) => answer.label);
|
|
43379
|
-
}
|
|
43380
|
-
__name(permissionChoices, "permissionChoices");
|
|
43381
43412
|
function readableBody(summaryText, single2) {
|
|
43382
43413
|
if (!single2) return summaryText;
|
|
43383
43414
|
const lines = summaryText.split("\n");
|
|
@@ -43399,8 +43430,9 @@ function PermissionOverlay({
|
|
|
43399
43430
|
detailsOpen,
|
|
43400
43431
|
reviewOffset = 0,
|
|
43401
43432
|
choice: choice2 = 0,
|
|
43402
|
-
|
|
43403
|
-
|
|
43433
|
+
count: count2,
|
|
43434
|
+
from,
|
|
43435
|
+
reason,
|
|
43404
43436
|
columns,
|
|
43405
43437
|
rows: terminalRows,
|
|
43406
43438
|
batchOnly = false,
|
|
@@ -43409,9 +43441,10 @@ function PermissionOverlay({
|
|
|
43409
43441
|
rememberWhere,
|
|
43410
43442
|
siteNotes = [],
|
|
43411
43443
|
screenConsent,
|
|
43412
|
-
withheld = []
|
|
43444
|
+
withheld = [],
|
|
43445
|
+
endsTurn = false
|
|
43413
43446
|
}) {
|
|
43414
|
-
const pageRows = Math.max(1, permissionReviewPageRows(terminalRows)
|
|
43447
|
+
const pageRows = Math.max(1, permissionReviewPageRows(terminalRows));
|
|
43415
43448
|
const single2 = toolCalls.length === 1;
|
|
43416
43449
|
const compact2 = !detailsOpen && summary2.compactText !== void 0;
|
|
43417
43450
|
const source = detailsOpen ? summary2.expandedText !== void 0 ? readableBody(summary2.expandedText, single2) : review : summary2.compactText ?? readableBody(summary2.text, single2);
|
|
@@ -43425,16 +43458,27 @@ function PermissionOverlay({
|
|
|
43425
43458
|
const last = Math.min(rows.length, offset + pageRows);
|
|
43426
43459
|
const destructive = toolCalls.some((call) => call.isDestructive);
|
|
43427
43460
|
const sharing = screenConsent !== void 0;
|
|
43428
|
-
const
|
|
43461
|
+
const answerOptions = {
|
|
43429
43462
|
batchOnly,
|
|
43430
43463
|
screenConsent: sharing,
|
|
43431
43464
|
withheld: withheld.length > 0,
|
|
43465
|
+
endsTurn,
|
|
43432
43466
|
...mode ? { mode } : {},
|
|
43433
43467
|
...commandArguments ? { commandArguments } : {},
|
|
43434
43468
|
...rememberWhere ? { rememberWhere } : {}
|
|
43435
|
-
}
|
|
43469
|
+
};
|
|
43470
|
+
const answers = permissionAnswers(toolCalls, answerOptions);
|
|
43471
|
+
const choices2 = answers.map((answer) => answer.label);
|
|
43472
|
+
const onRefusal = answers[choice2]?.kind === "reject";
|
|
43473
|
+
const offersEdits = answers.some((answer) => answer.kind === "approve-edits");
|
|
43474
|
+
const typing = reason !== void 0;
|
|
43436
43475
|
const escalationNotes = permissionEscalationNotes(toolCalls);
|
|
43437
43476
|
const sharingNotes = sharing ? screenConsentNotes(screenConsent.provider) : [];
|
|
43477
|
+
const titleText = detailsOpen ? scriptView ? "Workflow script" : "Exact prepared input" : sharing ? "Share your screen" : terminalDisplayText(permissionTitle(toolCalls));
|
|
43478
|
+
const destructiveText = destructive ? toolCalls.every((call) => call.name === "write") ? summary2.text.includes("New file") ? " \xB7 new file" : " \xB7 may overwrite" : " \xB7 destructive" : "";
|
|
43479
|
+
const countText = count2 ? `${count2.position} of ${count2.total}` : void 0;
|
|
43480
|
+
const countFits = countText !== void 0 && stringWidth(`${titleText}${destructiveText}${from ? ` \xB7 ${terminalDisplayText(from)}` : ""}`) + 1 + stringWidth(countText) <= boxedHintWidth(columns);
|
|
43481
|
+
const shownCount = countFits ? countText : void 0;
|
|
43438
43482
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
43439
43483
|
Box_default,
|
|
43440
43484
|
{
|
|
@@ -43444,16 +43488,14 @@ function PermissionOverlay({
|
|
|
43444
43488
|
paddingX: 1,
|
|
43445
43489
|
marginTop: 1,
|
|
43446
43490
|
children: [
|
|
43447
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
43448
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
43449
|
-
|
|
43450
|
-
|
|
43451
|
-
|
|
43452
|
-
|
|
43453
|
-
|
|
43454
|
-
destructive ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: theme.status.error, children: toolCalls.every((call) => call.name === "write") ? summary2.text.includes("New file") ? " \xB7 new file" : " \xB7 may overwrite" : " \xB7 destructive" }) : null
|
|
43491
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { flexDirection: "row", children: [
|
|
43492
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Box_default, { flexShrink: 1, flexGrow: 1, minWidth: 0, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Text, { wrap: "truncate-end", children: [
|
|
43493
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: theme.status.warn, bold: true, children: titleText }),
|
|
43494
|
+
destructive ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: theme.status.error, children: destructiveText }) : null,
|
|
43495
|
+
from ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: theme.text.muted, children: ` \xB7 ${terminalDisplayText(from)}` }) : null
|
|
43496
|
+
] }) }),
|
|
43497
|
+
shownCount ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Box_default, { flexShrink: 0, marginLeft: 1, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: theme.text.muted, children: shownCount }) }) : null
|
|
43455
43498
|
] }),
|
|
43456
|
-
sourceLabel3 ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: theme.text.secondary, wrap: "truncate-end", children: terminalDisplayText(sourceLabel3) }) : null,
|
|
43457
43499
|
sharingNotes.map((note) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: theme.text.primary, children: terminalDisplayText(note) }, note)),
|
|
43458
43500
|
escalationNotes.map((note) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: theme.status.error, children: terminalDisplayText(note) }, note)),
|
|
43459
43501
|
withheld.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: theme.text.muted, children: terminalDisplayText(withheldNotice(withheld, toolCalls.length)) }) : null,
|
|
@@ -43468,7 +43510,16 @@ function PermissionOverlay({
|
|
|
43468
43510
|
rows.length,
|
|
43469
43511
|
" \xB7 PgUp/PgDn page \xB7 Home/End"
|
|
43470
43512
|
] }) : null,
|
|
43471
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { flexDirection: "column", paddingTop: 1, children: [
|
|
43513
|
+
typing ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { flexDirection: "column", paddingTop: 1, children: [
|
|
43514
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: theme.text.primary, bold: true, children: "Tell Namzu what to do differently" }),
|
|
43515
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { flexDirection: "row", children: [
|
|
43516
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Box_default, { flexShrink: 0, width: 2, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: theme.accent.user, children: "\u276F " }) }),
|
|
43517
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Box_default, { flexGrow: 1, flexShrink: 1, minWidth: 0, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Text, { color: theme.text.primary, wrap: "wrap", children: [
|
|
43518
|
+
terminalDisplayText(reason),
|
|
43519
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: theme.accent.user, children: "\u258C" })
|
|
43520
|
+
] }) })
|
|
43521
|
+
] })
|
|
43522
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Box_default, { flexDirection: "column", paddingTop: 1, children: [
|
|
43472
43523
|
!compact2 ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: theme.text.primary, bold: true, children: terminalDisplayText(
|
|
43473
43524
|
sharing ? "Let Namzu see your screen for the rest of this conversation?" : permissionQuestion(toolCalls)
|
|
43474
43525
|
) }) : null,
|
|
@@ -43482,10 +43533,14 @@ function PermissionOverlay({
|
|
|
43482
43533
|
})
|
|
43483
43534
|
] }),
|
|
43484
43535
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Box_default, { flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { color: theme.text.muted, children: fitHints(
|
|
43485
|
-
[
|
|
43536
|
+
typing ? [
|
|
43537
|
+
{ text: "enter send", rank: 5 },
|
|
43538
|
+
{ text: "esc back", rank: 5 },
|
|
43539
|
+
{ text: "ctrl+c stop", rank: 4 }
|
|
43540
|
+
] : [
|
|
43486
43541
|
// The arrow keys are the first of the answer keys to go: enter and y / n
|
|
43487
43542
|
// still answer, and the list shows which row is selected.
|
|
43488
|
-
{ text: "\u2191\u2193 select", rank:
|
|
43543
|
+
{ text: "\u2191\u2193 select", rank: 3 },
|
|
43489
43544
|
{ text: "enter confirm", rank: 5 },
|
|
43490
43545
|
{
|
|
43491
43546
|
text: "y / n answer",
|
|
@@ -43495,6 +43550,7 @@ function PermissionOverlay({
|
|
|
43495
43550
|
rank: scriptView ? 4 : 5
|
|
43496
43551
|
},
|
|
43497
43552
|
{ text: "esc cancel", rank: 5 },
|
|
43553
|
+
...offersEdits ? [{ text: "shift+tab accept edits", rank: 3 }] : [],
|
|
43498
43554
|
{
|
|
43499
43555
|
text: "ctrl+c stop",
|
|
43500
43556
|
rank: scriptView ? 3 : 4
|
|
@@ -43505,7 +43561,11 @@ function PermissionOverlay({
|
|
|
43505
43561
|
// The only way to the exact input: it outranks the stop hint,
|
|
43506
43562
|
// whose key works without being shown.
|
|
43507
43563
|
rank: 5
|
|
43508
|
-
}
|
|
43564
|
+
},
|
|
43565
|
+
// On the No row the way to give a reason is the one hint that cannot be
|
|
43566
|
+
// guessed, so it outlasts the arrows and the stop key. Last of its rank,
|
|
43567
|
+
// it gives way first, and says less before it does.
|
|
43568
|
+
...onRefusal ? [{ text: "tab say why", short: "tab why", rank: 5 }] : []
|
|
43509
43569
|
],
|
|
43510
43570
|
boxedHintWidth(columns)
|
|
43511
43571
|
) }) })
|
|
@@ -48392,6 +48452,258 @@ function isRepeatedNotice(last, candidate) {
|
|
|
48392
48452
|
}
|
|
48393
48453
|
__name(isRepeatedNotice, "isRepeatedNotice");
|
|
48394
48454
|
|
|
48455
|
+
// src/tui/per-call-review.ts
|
|
48456
|
+
var REASON_MAX_CHARS = 500;
|
|
48457
|
+
function cleanReason(text) {
|
|
48458
|
+
let out = "";
|
|
48459
|
+
let gap = false;
|
|
48460
|
+
for (const ch of text) {
|
|
48461
|
+
const code = ch.codePointAt(0);
|
|
48462
|
+
const control = code <= 31 || code >= 127 && code <= 159;
|
|
48463
|
+
if (control || ch === " ") {
|
|
48464
|
+
gap = out.length > 0;
|
|
48465
|
+
continue;
|
|
48466
|
+
}
|
|
48467
|
+
if (gap) out += " ";
|
|
48468
|
+
gap = false;
|
|
48469
|
+
out += ch;
|
|
48470
|
+
}
|
|
48471
|
+
return Array.from(out).slice(0, REASON_MAX_CHARS).join("");
|
|
48472
|
+
}
|
|
48473
|
+
__name(cleanReason, "cleanReason");
|
|
48474
|
+
function appendTypedReason(current, typed) {
|
|
48475
|
+
let out = current;
|
|
48476
|
+
let count2 = Array.from(current).length;
|
|
48477
|
+
for (const ch of typed) {
|
|
48478
|
+
if (count2 >= REASON_MAX_CHARS) break;
|
|
48479
|
+
const code = ch.codePointAt(0);
|
|
48480
|
+
const control = code <= 31 || code >= 127 && code <= 159;
|
|
48481
|
+
if (control && ch !== "\n" && ch !== " ") continue;
|
|
48482
|
+
out += control ? " " : ch;
|
|
48483
|
+
count2 += 1;
|
|
48484
|
+
}
|
|
48485
|
+
return out;
|
|
48486
|
+
}
|
|
48487
|
+
__name(appendTypedReason, "appendTypedReason");
|
|
48488
|
+
function plainNo(endsTurn) {
|
|
48489
|
+
return { kind: "reject", declined: {}, ...endsTurn ? { endTurn: true } : {} };
|
|
48490
|
+
}
|
|
48491
|
+
__name(plainNo, "plainNo");
|
|
48492
|
+
function noWithReason(reason) {
|
|
48493
|
+
const note = cleanReason(reason);
|
|
48494
|
+
if (note === "") return void 0;
|
|
48495
|
+
return {
|
|
48496
|
+
kind: "reject",
|
|
48497
|
+
feedback: `The user declined this and said: ${note}`,
|
|
48498
|
+
declined: { note }
|
|
48499
|
+
};
|
|
48500
|
+
}
|
|
48501
|
+
__name(noWithReason, "noWithReason");
|
|
48502
|
+
function notShownInFull(call) {
|
|
48503
|
+
const review = buildPermissionReview([
|
|
48504
|
+
{ id: call.id, name: call.name, input: call.input, isDestructive: false }
|
|
48505
|
+
]);
|
|
48506
|
+
return !review.ok || review.withheld.length > 0;
|
|
48507
|
+
}
|
|
48508
|
+
__name(notShownInFull, "notShownInFull");
|
|
48509
|
+
function createTerminalPerCallReview(host) {
|
|
48510
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
48511
|
+
const held = /* @__PURE__ */ new Map();
|
|
48512
|
+
const modeCovers = /* @__PURE__ */ __name((call) => {
|
|
48513
|
+
if (mustAskPerson(call)) return false;
|
|
48514
|
+
switch (host.mode()) {
|
|
48515
|
+
case "bypass":
|
|
48516
|
+
return true;
|
|
48517
|
+
case "accept-edits":
|
|
48518
|
+
return ACCEPT_EDITS_TOOLS.has(call.name) && call.isDestructive !== true;
|
|
48519
|
+
default:
|
|
48520
|
+
return false;
|
|
48521
|
+
}
|
|
48522
|
+
}, "modeCovers");
|
|
48523
|
+
return {
|
|
48524
|
+
config: {
|
|
48525
|
+
onRulesChanged: /* @__PURE__ */ __name((listener) => {
|
|
48526
|
+
listeners.add(listener);
|
|
48527
|
+
return () => {
|
|
48528
|
+
listeners.delete(listener);
|
|
48529
|
+
};
|
|
48530
|
+
}, "onRulesChanged"),
|
|
48531
|
+
covers: /* @__PURE__ */ __name((call) => modeCovers(call), "covers"),
|
|
48532
|
+
// A call marked as not shown in full stays open. A call the screen has
|
|
48533
|
+
// not reached yet (queued behind another question) is judged by its own
|
|
48534
|
+
// input, the way the screen will judge it when it gets there.
|
|
48535
|
+
neverCover: /* @__PURE__ */ __name((call) => held.get(call.id) ?? notShownInFull(call), "neverCover")
|
|
48536
|
+
},
|
|
48537
|
+
rulesChanged: /* @__PURE__ */ __name(() => {
|
|
48538
|
+
for (const listener of [...listeners]) listener();
|
|
48539
|
+
}, "rulesChanged"),
|
|
48540
|
+
hold: /* @__PURE__ */ __name((callId, notShownInFull2) => {
|
|
48541
|
+
held.set(callId, notShownInFull2);
|
|
48542
|
+
}, "hold"),
|
|
48543
|
+
release: /* @__PURE__ */ __name((callId) => {
|
|
48544
|
+
held.set(callId, true);
|
|
48545
|
+
}, "release"),
|
|
48546
|
+
modeCovers
|
|
48547
|
+
};
|
|
48548
|
+
}
|
|
48549
|
+
__name(createTerminalPerCallReview, "createTerminalPerCallReview");
|
|
48550
|
+
|
|
48551
|
+
// src/tui/permission-asks.ts
|
|
48552
|
+
var CLOSED_QUESTION = {
|
|
48553
|
+
kind: "reject",
|
|
48554
|
+
feedback: "The question was closed."
|
|
48555
|
+
};
|
|
48556
|
+
var AskQueue = class {
|
|
48557
|
+
static {
|
|
48558
|
+
__name(this, "AskQueue");
|
|
48559
|
+
}
|
|
48560
|
+
#shown = null;
|
|
48561
|
+
#waiting = [];
|
|
48562
|
+
#settled = 0;
|
|
48563
|
+
#onShow;
|
|
48564
|
+
#onChange;
|
|
48565
|
+
/**
|
|
48566
|
+
* `onShow` is told which question is on screen whenever that changes (`null`:
|
|
48567
|
+
* none); `onChange` after any change at all, the count behind the title included.
|
|
48568
|
+
*/
|
|
48569
|
+
constructor(onShow, onChange = () => {
|
|
48570
|
+
}) {
|
|
48571
|
+
this.#onShow = onShow;
|
|
48572
|
+
this.#onChange = onChange;
|
|
48573
|
+
}
|
|
48574
|
+
/** The question on screen. */
|
|
48575
|
+
get shown() {
|
|
48576
|
+
return this.#shown?.value ?? null;
|
|
48577
|
+
}
|
|
48578
|
+
/** Questions open now: the one on screen and those waiting. */
|
|
48579
|
+
get open() {
|
|
48580
|
+
return (this.#shown ? 1 : 0) + this.#waiting.length;
|
|
48581
|
+
}
|
|
48582
|
+
/** Questions waiting behind the one on screen. */
|
|
48583
|
+
get waiting() {
|
|
48584
|
+
return this.#waiting.length;
|
|
48585
|
+
}
|
|
48586
|
+
/**
|
|
48587
|
+
* The "k of N" for the question on screen, or none while the set holds fewer
|
|
48588
|
+
* than two questions (those settled since it began and those open now).
|
|
48589
|
+
*/
|
|
48590
|
+
count() {
|
|
48591
|
+
if (this.open === 0) return void 0;
|
|
48592
|
+
const total = this.#settled + this.open;
|
|
48593
|
+
if (total < 2) return void 0;
|
|
48594
|
+
return { position: this.#settled + 1, total };
|
|
48595
|
+
}
|
|
48596
|
+
/** Every open question, the one on screen first. */
|
|
48597
|
+
values() {
|
|
48598
|
+
return [...this.#shown ? [this.#shown.value] : [], ...this.#waiting.map((a) => a.value)];
|
|
48599
|
+
}
|
|
48600
|
+
/**
|
|
48601
|
+
* Put a question to the person. The promise settles with the answer, or with
|
|
48602
|
+
* {@link CLOSED_QUESTION} when `signal` aborts first.
|
|
48603
|
+
*/
|
|
48604
|
+
enqueue(value, options = {}) {
|
|
48605
|
+
const signal = options.signal;
|
|
48606
|
+
if (signal?.aborted) return Promise.resolve(CLOSED_QUESTION);
|
|
48607
|
+
return new Promise((resolve9) => {
|
|
48608
|
+
const onAbort = /* @__PURE__ */ __name(() => this.#close(ask, CLOSED_QUESTION), "onAbort");
|
|
48609
|
+
const ask = {
|
|
48610
|
+
value,
|
|
48611
|
+
resolve: resolve9,
|
|
48612
|
+
background: options.background === true,
|
|
48613
|
+
detach: /* @__PURE__ */ __name(() => signal?.removeEventListener("abort", onAbort), "detach")
|
|
48614
|
+
};
|
|
48615
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
48616
|
+
if (this.#shown === null) {
|
|
48617
|
+
this.#shown = ask;
|
|
48618
|
+
this.#onShow(value);
|
|
48619
|
+
this.#onChange();
|
|
48620
|
+
return;
|
|
48621
|
+
}
|
|
48622
|
+
if (ask.background) {
|
|
48623
|
+
this.#waiting.push(ask);
|
|
48624
|
+
} else {
|
|
48625
|
+
const firstBackground = this.#waiting.findIndex((other) => other.background);
|
|
48626
|
+
if (firstBackground < 0) this.#waiting.push(ask);
|
|
48627
|
+
else this.#waiting.splice(firstBackground, 0, ask);
|
|
48628
|
+
}
|
|
48629
|
+
this.#onChange();
|
|
48630
|
+
});
|
|
48631
|
+
}
|
|
48632
|
+
/** Answer the question on screen. Returns whether there was one. */
|
|
48633
|
+
answer(decision) {
|
|
48634
|
+
const ask = this.#shown;
|
|
48635
|
+
if (!ask) return false;
|
|
48636
|
+
this.#close(ask, decision);
|
|
48637
|
+
return true;
|
|
48638
|
+
}
|
|
48639
|
+
/**
|
|
48640
|
+
* Close every open question the rule decides, shown or waiting, with the
|
|
48641
|
+
* decision it returns. A question the rule leaves (`undefined`) stays open.
|
|
48642
|
+
* Returns how many were closed.
|
|
48643
|
+
*/
|
|
48644
|
+
settleWhere(decide) {
|
|
48645
|
+
const decided = [];
|
|
48646
|
+
if (this.#shown) {
|
|
48647
|
+
const decision = decide(this.#shown.value, true);
|
|
48648
|
+
if (decision) decided.push([this.#shown, decision]);
|
|
48649
|
+
}
|
|
48650
|
+
for (const ask of this.#waiting) {
|
|
48651
|
+
const decision = decide(ask.value, false);
|
|
48652
|
+
if (decision) decided.push([ask, decision]);
|
|
48653
|
+
}
|
|
48654
|
+
if (decided.length === 0) return 0;
|
|
48655
|
+
const closing = new Set(decided.map(([ask]) => ask));
|
|
48656
|
+
const shownClosing = this.#shown !== null && closing.has(this.#shown);
|
|
48657
|
+
this.#waiting = this.#waiting.filter((ask) => !closing.has(ask));
|
|
48658
|
+
this.#settled += decided.length;
|
|
48659
|
+
if (shownClosing) {
|
|
48660
|
+
this.#shown = this.#waiting.shift() ?? null;
|
|
48661
|
+
this.#onShow(this.#shown?.value ?? null);
|
|
48662
|
+
}
|
|
48663
|
+
this.#restartCount();
|
|
48664
|
+
this.#onChange();
|
|
48665
|
+
for (const [ask, decision] of decided) {
|
|
48666
|
+
ask.detach();
|
|
48667
|
+
ask.resolve(decision);
|
|
48668
|
+
}
|
|
48669
|
+
return decided.length;
|
|
48670
|
+
}
|
|
48671
|
+
/** Answer every open question the same way and start the count over. */
|
|
48672
|
+
closeAll(decision) {
|
|
48673
|
+
const all = [...this.#shown ? [this.#shown] : [], ...this.#waiting];
|
|
48674
|
+
this.#shown = null;
|
|
48675
|
+
this.#waiting = [];
|
|
48676
|
+
this.#settled = 0;
|
|
48677
|
+
if (all.length === 0) return;
|
|
48678
|
+
this.#onShow(null);
|
|
48679
|
+
this.#onChange();
|
|
48680
|
+
for (const ask of all) {
|
|
48681
|
+
ask.detach();
|
|
48682
|
+
ask.resolve(decision);
|
|
48683
|
+
}
|
|
48684
|
+
}
|
|
48685
|
+
#close(ask, decision) {
|
|
48686
|
+
if (this.#shown === ask) {
|
|
48687
|
+
this.#settled += 1;
|
|
48688
|
+
this.#shown = this.#waiting.shift() ?? null;
|
|
48689
|
+
this.#restartCount();
|
|
48690
|
+
this.#onShow(this.#shown?.value ?? null);
|
|
48691
|
+
} else {
|
|
48692
|
+
const index = this.#waiting.indexOf(ask);
|
|
48693
|
+
if (index < 0) return;
|
|
48694
|
+
this.#waiting.splice(index, 1);
|
|
48695
|
+
this.#settled += 1;
|
|
48696
|
+
this.#restartCount();
|
|
48697
|
+
}
|
|
48698
|
+
this.#onChange();
|
|
48699
|
+
ask.detach();
|
|
48700
|
+
ask.resolve(decision);
|
|
48701
|
+
}
|
|
48702
|
+
#restartCount() {
|
|
48703
|
+
if (this.open === 0) this.#settled = 0;
|
|
48704
|
+
}
|
|
48705
|
+
};
|
|
48706
|
+
|
|
48395
48707
|
// src/tui/plugin-view.ts
|
|
48396
48708
|
import { join as join4 } from "node:path";
|
|
48397
48709
|
function pluginOption(plugin) {
|
|
@@ -48458,230 +48770,849 @@ function selectPrimaryProvider(previous, selection) {
|
|
|
48458
48770
|
}
|
|
48459
48771
|
__name(selectPrimaryProvider, "selectPrimaryProvider");
|
|
48460
48772
|
|
|
48461
|
-
// src/tui/
|
|
48462
|
-
|
|
48463
|
-
|
|
48464
|
-
|
|
48465
|
-
|
|
48466
|
-
|
|
48467
|
-
|
|
48468
|
-
|
|
48469
|
-
function loopSpec(interval, now) {
|
|
48470
|
-
const text = interval.trim();
|
|
48471
|
-
if (/^\d+\s*[a-z]+$/i.test(text))
|
|
48472
|
-
return parseScheduleSpec(`every ${text}`, { now, tz: hostTimeZone() });
|
|
48473
|
-
return parseScheduleSpec(text, { now, tz: hostTimeZone() });
|
|
48474
|
-
}
|
|
48475
|
-
__name(loopSpec, "loopSpec");
|
|
48476
|
-
var SessionLoopScheduler = class {
|
|
48477
|
-
static {
|
|
48478
|
-
__name(this, "SessionLoopScheduler");
|
|
48479
|
-
}
|
|
48480
|
-
#deps;
|
|
48481
|
-
#file;
|
|
48482
|
-
#loops = [];
|
|
48483
|
-
constructor(deps) {
|
|
48484
|
-
this.#deps = deps;
|
|
48485
|
-
}
|
|
48486
|
-
#now() {
|
|
48487
|
-
return (this.#deps.now ?? Date.now)();
|
|
48488
|
-
}
|
|
48489
|
-
/** Follow the conversation on screen: load its loops when it changes. */
|
|
48490
|
-
#sync() {
|
|
48491
|
-
const file = this.#deps.file();
|
|
48492
|
-
if (file === this.#file) return;
|
|
48493
|
-
const carried = this.#file === void 0 ? this.#loops : [];
|
|
48494
|
-
this.#file = file;
|
|
48495
|
-
this.#loops = [];
|
|
48496
|
-
if (!file) return;
|
|
48497
|
-
try {
|
|
48498
|
-
const parsed = JSON.parse(readFileSync5(file, "utf8"));
|
|
48499
|
-
if (parsed.kind === "session-loops" && Array.isArray(parsed.loops)) {
|
|
48500
|
-
const now = this.#now();
|
|
48501
|
-
this.#loops = parsed.loops.filter(
|
|
48502
|
-
(l) => (!l.expiresAt || Date.parse(l.expiresAt) > now) && // A one-shot whose time passed is not restored.
|
|
48503
|
-
!(l.spec.kind === "at" && Date.parse(l.spec.at) <= now)
|
|
48504
|
-
);
|
|
48505
|
-
}
|
|
48506
|
-
} catch {
|
|
48507
|
-
}
|
|
48508
|
-
if (carried.length > 0) {
|
|
48509
|
-
this.#loops = [...this.#loops, ...carried].slice(0, MAX_LOOPS);
|
|
48510
|
-
this.#save();
|
|
48511
|
-
}
|
|
48512
|
-
}
|
|
48513
|
-
#save() {
|
|
48514
|
-
if (!this.#file) return;
|
|
48515
|
-
try {
|
|
48516
|
-
writeJsonAtomic(this.#file, {
|
|
48517
|
-
v: 1,
|
|
48518
|
-
kind: "session-loops",
|
|
48519
|
-
loops: this.#loops
|
|
48520
|
-
});
|
|
48521
|
-
} catch {
|
|
48522
|
-
}
|
|
48773
|
+
// src/tui/conversation-evidence-view.ts
|
|
48774
|
+
function conversationEvidenceView(toolName, output) {
|
|
48775
|
+
if (toolName !== "search_conversation" && toolName !== "read_conversation") return void 0;
|
|
48776
|
+
let value;
|
|
48777
|
+
try {
|
|
48778
|
+
value = JSON.parse(output);
|
|
48779
|
+
} catch {
|
|
48780
|
+
return void 0;
|
|
48523
48781
|
}
|
|
48524
|
-
|
|
48525
|
-
|
|
48526
|
-
|
|
48527
|
-
|
|
48528
|
-
|
|
48529
|
-
|
|
48530
|
-
|
|
48531
|
-
|
|
48532
|
-
|
|
48533
|
-
|
|
48534
|
-
|
|
48535
|
-
|
|
48536
|
-
|
|
48537
|
-
|
|
48538
|
-
|
|
48539
|
-
|
|
48540
|
-
|
|
48541
|
-
|
|
48782
|
+
if (!record(value)) return void 0;
|
|
48783
|
+
const rows = toolName === "search_conversation" ? searchRows(value) : readRows(value);
|
|
48784
|
+
if (!rows) return void 0;
|
|
48785
|
+
return { content: rows.join("\n"), detail: JSON.stringify(value, null, 2).split("\n") };
|
|
48786
|
+
}
|
|
48787
|
+
__name(conversationEvidenceView, "conversationEvidenceView");
|
|
48788
|
+
function record(value) {
|
|
48789
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
48790
|
+
}
|
|
48791
|
+
__name(record, "record");
|
|
48792
|
+
function count(value) {
|
|
48793
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
48794
|
+
}
|
|
48795
|
+
__name(count, "count");
|
|
48796
|
+
function preview2(text, limit = 96) {
|
|
48797
|
+
const units = Array.from(text.replace(/\s+/gu, " ").trim());
|
|
48798
|
+
return units.length > limit ? `${units.slice(0, limit - 1).join("")}\u2026` : units.join("");
|
|
48799
|
+
}
|
|
48800
|
+
__name(preview2, "preview");
|
|
48801
|
+
function sourceLabel2(value) {
|
|
48802
|
+
switch (value.recordKind) {
|
|
48803
|
+
case "assistant_message":
|
|
48804
|
+
return "Assistant message";
|
|
48805
|
+
case "user_message":
|
|
48806
|
+
return "User message";
|
|
48807
|
+
case "system_message":
|
|
48808
|
+
return "System message";
|
|
48809
|
+
case "derived_summary":
|
|
48810
|
+
return "Derived summary";
|
|
48811
|
+
case "tool_result":
|
|
48812
|
+
return `Tool result${typeof value.toolName === "string" ? ` (${preview2(value.toolName, 48)})` : ""}`;
|
|
48813
|
+
default:
|
|
48814
|
+
return "Source unknown";
|
|
48542
48815
|
}
|
|
48543
|
-
|
|
48544
|
-
|
|
48545
|
-
|
|
48816
|
+
}
|
|
48817
|
+
__name(sourceLabel2, "sourceLabel");
|
|
48818
|
+
function searchRows(value) {
|
|
48819
|
+
if (!Array.isArray(value.matches) || !value.matches.every((match) => record(match) && typeof match.text === "string") || typeof value.incomplete !== "boolean" || !count(value.unavailable))
|
|
48820
|
+
return void 0;
|
|
48821
|
+
const rows = [
|
|
48822
|
+
`Conversation search \xB7 ${plural(value.matches.length, "match", "matches")} on this page`
|
|
48823
|
+
];
|
|
48824
|
+
rows.push(
|
|
48825
|
+
value.incomplete || value.nextCursor ? `Search not finished${value.nextCursor ? " \xB7 more to scan" : ""} \xB7 a missing result may not have been reached yet` : "Search finished"
|
|
48826
|
+
);
|
|
48827
|
+
if (value.unavailable > 0) rows.push(`${plural(value.unavailable, "record")} unavailable`);
|
|
48828
|
+
for (const match of value.matches.slice(0, 3)) {
|
|
48829
|
+
rows.push(
|
|
48830
|
+
`${sourceLabel2(match)}${match.retained === "preview" ? " \xB7 preview flagged" : ""}${match.isError === true ? " \xB7 original reported error" : ""}: ${preview2(match.text)}`
|
|
48831
|
+
);
|
|
48546
48832
|
}
|
|
48547
|
-
|
|
48548
|
-
|
|
48549
|
-
|
|
48550
|
-
|
|
48551
|
-
|
|
48552
|
-
|
|
48833
|
+
if (value.matches.length > 3)
|
|
48834
|
+
rows.push(`+${plural(value.matches.length - 3, "more match", "more matches")} in details`);
|
|
48835
|
+
return rows;
|
|
48836
|
+
}
|
|
48837
|
+
__name(searchRows, "searchRows");
|
|
48838
|
+
function readRows(value) {
|
|
48839
|
+
if (typeof value.text !== "string" || typeof value.complete !== "boolean" || typeof value.retainedPreview !== "boolean" || !count(value.offset))
|
|
48840
|
+
return void 0;
|
|
48841
|
+
const rows = [`Conversation read \xB7 ${sourceLabel2(value)}`];
|
|
48842
|
+
if (value.retainedPreview) rows.push("Preview flagged \xB7 original may be incomplete");
|
|
48843
|
+
if (!value.complete) {
|
|
48844
|
+
rows.push(
|
|
48845
|
+
value.nextCursor ? value.text.length === 0 ? "Locating retained text \xB7 continue scan" : "Partial page \xB7 more retained text available" : "Read incomplete \xB7 no continuation supplied"
|
|
48846
|
+
);
|
|
48847
|
+
} else {
|
|
48848
|
+
rows.push(
|
|
48849
|
+
value.offset > 0 ? "Last page \xB7 earlier text is not on this page" : "Selected retained part returned"
|
|
48850
|
+
);
|
|
48553
48851
|
}
|
|
48554
|
-
|
|
48555
|
-
|
|
48556
|
-
|
|
48557
|
-
|
|
48558
|
-
let changed = false;
|
|
48559
|
-
const kept = [];
|
|
48560
|
-
let fired = false;
|
|
48561
|
-
for (const loop of this.#loops) {
|
|
48562
|
-
if (loop.expiresAt && Date.parse(loop.expiresAt) <= now) {
|
|
48563
|
-
changed = true;
|
|
48564
|
-
continue;
|
|
48565
|
-
}
|
|
48566
|
-
const last = Date.parse(loop.lastFiredAt ?? loop.createdAt);
|
|
48567
|
-
const due = nextFireTime(loop.spec, new Date(last));
|
|
48568
|
-
const isDue = loop.pending || due !== null && due.getTime() <= now;
|
|
48569
|
-
if (!isDue) {
|
|
48570
|
-
kept.push(loop);
|
|
48571
|
-
continue;
|
|
48572
|
-
}
|
|
48573
|
-
if (fired || !this.#deps.isIdle()) {
|
|
48574
|
-
if (!loop.pending) changed = true;
|
|
48575
|
-
kept.push({ ...loop, pending: true });
|
|
48576
|
-
continue;
|
|
48577
|
-
}
|
|
48578
|
-
fired = true;
|
|
48579
|
-
changed = true;
|
|
48580
|
-
const done = loop.spec.kind === "at";
|
|
48581
|
-
const { pending: _pending, ...rest } = loop;
|
|
48582
|
-
if (!done) kept.push({ ...rest, lastFiredAt: new Date(now).toISOString() });
|
|
48583
|
-
this.#deps.fire(loop);
|
|
48584
|
-
}
|
|
48585
|
-
this.#loops = kept;
|
|
48586
|
-
if (changed) this.#save();
|
|
48852
|
+
if (value.recordKind === "tool_result") {
|
|
48853
|
+
rows.push(
|
|
48854
|
+
value.isError === true ? "Original tool reported an error" : value.isError === false ? "Original tool reported no error" : "Original tool status unknown"
|
|
48855
|
+
);
|
|
48587
48856
|
}
|
|
48588
|
-
};
|
|
48589
|
-
|
|
48590
|
-
if (loops.length === 0) return "No loops in this conversation. /loop 5m <prompt> adds one.";
|
|
48591
|
-
return loops.map(
|
|
48592
|
-
(l) => `\u21BB ${l.id} ${l.schedule}${l.createdBy === "model" ? " (created by the model)" : ""}${l.lastFiredAt ? ` last ${new Date(l.lastFiredAt).toLocaleTimeString()}` : ""}
|
|
48593
|
-
${l.prompt.replace(/\s+/g, " ").slice(0, 100)}`
|
|
48594
|
-
).join("\n");
|
|
48857
|
+
if (value.text.length > 0) rows.push(`Excerpt: ${preview2(value.text, 160)}`);
|
|
48858
|
+
return rows;
|
|
48595
48859
|
}
|
|
48596
|
-
__name(
|
|
48860
|
+
__name(readRows, "readRows");
|
|
48597
48861
|
|
|
48598
|
-
// src/tui/
|
|
48599
|
-
|
|
48600
|
-
|
|
48601
|
-
"/schedule confirm <job> confirm a job created without a terminal, or held after an edit",
|
|
48602
|
-
"/schedule pause|resume <job>",
|
|
48603
|
-
"/schedule run <job> run it now through the scheduler",
|
|
48604
|
-
"/schedule remove <job>",
|
|
48605
|
-
'/schedule add <name> "<when>" <read-only|edit-in-folder> <prompt\u2026>',
|
|
48606
|
-
"A run waiting for approval: /resume its conversation (Scheduled: <job> \xB7 <time>) in its folder."
|
|
48607
|
-
].join("\n");
|
|
48608
|
-
async function schedulerLine(home) {
|
|
48609
|
-
const paths = schedulePaths(home);
|
|
48610
|
-
const endpoint = readEndpoint(paths.endpoint);
|
|
48611
|
-
if (endpoint && await callEndpoint(endpoint, "status", {}, 500)) return "Scheduler: running.";
|
|
48612
|
-
let installed = false;
|
|
48862
|
+
// src/tui/model-catalogue-view.ts
|
|
48863
|
+
function modelCatalogueView(output) {
|
|
48864
|
+
let value;
|
|
48613
48865
|
try {
|
|
48614
|
-
|
|
48866
|
+
value = JSON.parse(output);
|
|
48615
48867
|
} catch {
|
|
48868
|
+
return void 0;
|
|
48616
48869
|
}
|
|
48617
|
-
|
|
48870
|
+
if (!record2(value) || !Array.isArray(value.models) || !Number.isSafeInteger(value.omitted) || value.omitted < 0)
|
|
48871
|
+
return void 0;
|
|
48872
|
+
const models = value.models;
|
|
48873
|
+
if (!models.every(
|
|
48874
|
+
(model) => record2(model) && typeof model.provider === "string" && (typeof model.id === "string" && typeof model.name === "string" || model.status === "catalogue unavailable")
|
|
48875
|
+
))
|
|
48876
|
+
return void 0;
|
|
48877
|
+
const rows = ["Available models"];
|
|
48878
|
+
if (models.length === 0) rows.push("No matching models.");
|
|
48879
|
+
for (const model of models.slice(0, 5)) {
|
|
48880
|
+
if (model.status === "catalogue unavailable") {
|
|
48881
|
+
rows.push(`${model.provider} \xB7 catalogue unavailable`);
|
|
48882
|
+
continue;
|
|
48883
|
+
}
|
|
48884
|
+
rows.push(`${model.name} \xB7 ${model.provider}`);
|
|
48885
|
+
rows.push(` ${model.id}`);
|
|
48886
|
+
const facts = [];
|
|
48887
|
+
if (typeof model.contextWindow === "number" && Number.isSafeInteger(model.contextWindow) && model.contextWindow > 0)
|
|
48888
|
+
facts.push(
|
|
48889
|
+
`Context ${new Intl.NumberFormat("en", { notation: "compact", maximumFractionDigits: 1 }).format(model.contextWindow)}`
|
|
48890
|
+
);
|
|
48891
|
+
const effort = model.reasoningEffortLevels ?? model.effortLevels;
|
|
48892
|
+
if (Array.isArray(effort) && effort.every((item) => typeof item === "string"))
|
|
48893
|
+
facts.push(effort.length ? `Effort ${effort.join(" \xB7 ")}` : "Effort not supported");
|
|
48894
|
+
facts.push(priceFact(model));
|
|
48895
|
+
if (facts.length) rows.push(` ${facts.join(" | ")}`);
|
|
48896
|
+
}
|
|
48897
|
+
const omitted = value.omitted + Math.max(0, models.length - 5);
|
|
48898
|
+
if (omitted) rows.push(`+${omitted} more \xB7 narrow the search`);
|
|
48899
|
+
return rows.join("\n");
|
|
48618
48900
|
}
|
|
48619
|
-
__name(
|
|
48620
|
-
function
|
|
48621
|
-
|
|
48622
|
-
return new Intl.DateTimeFormat("en-GB", {
|
|
48623
|
-
dateStyle: "medium",
|
|
48624
|
-
timeStyle: "short",
|
|
48625
|
-
timeZone: tz
|
|
48626
|
-
}).format(new Date(iso));
|
|
48901
|
+
__name(modelCatalogueView, "modelCatalogueView");
|
|
48902
|
+
function record2(value) {
|
|
48903
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
48627
48904
|
}
|
|
48628
|
-
__name(
|
|
48629
|
-
|
|
48630
|
-
const
|
|
48631
|
-
const
|
|
48632
|
-
|
|
48633
|
-
|
|
48634
|
-
|
|
48635
|
-
|
|
48636
|
-
|
|
48637
|
-
|
|
48638
|
-
|
|
48639
|
-
|
|
48640
|
-
|
|
48641
|
-
|
|
48642
|
-
|
|
48643
|
-
|
|
48644
|
-
|
|
48645
|
-
|
|
48646
|
-
|
|
48647
|
-
|
|
48648
|
-
|
|
48649
|
-
|
|
48650
|
-
|
|
48905
|
+
__name(record2, "record");
|
|
48906
|
+
function priceFact(model) {
|
|
48907
|
+
const input = model.inputPrice;
|
|
48908
|
+
const output = model.outputPrice;
|
|
48909
|
+
if (typeof input !== "number" || typeof output !== "number") return "Price unknown";
|
|
48910
|
+
if (input === 0 && output === 0) return "Free";
|
|
48911
|
+
return `$${input}/$${output} per Mtok`;
|
|
48912
|
+
}
|
|
48913
|
+
__name(priceFact, "priceFact");
|
|
48914
|
+
|
|
48915
|
+
// src/tui/task-activity.ts
|
|
48916
|
+
var TASK_TOOLS = /* @__PURE__ */ new Set(["task_create", "task_update", "task_list"]);
|
|
48917
|
+
function isTaskTool(toolName) {
|
|
48918
|
+
return TASK_TOOLS.has(toolName);
|
|
48919
|
+
}
|
|
48920
|
+
__name(isTaskTool, "isTaskTool");
|
|
48921
|
+
function taskOperationFor(previous, next) {
|
|
48922
|
+
const subject = next.subject;
|
|
48923
|
+
if (!previous) return { kind: "added", subject };
|
|
48924
|
+
if (previous.status !== next.status) {
|
|
48925
|
+
switch (next.status) {
|
|
48926
|
+
case "in_progress":
|
|
48927
|
+
return { kind: "started", subject };
|
|
48928
|
+
case "completed":
|
|
48929
|
+
return { kind: "completed", subject };
|
|
48930
|
+
case "failed":
|
|
48931
|
+
return { kind: "failed", subject };
|
|
48932
|
+
case "pending":
|
|
48933
|
+
return { kind: "reopened", subject };
|
|
48651
48934
|
}
|
|
48652
48935
|
}
|
|
48653
|
-
return
|
|
48654
|
-
|
|
48655
|
-
jobs.length === 0 ? errors.length > 0 ? "No readable scheduled jobs." : 'No scheduled jobs. Ask for one ("run this every night at 3"), or /schedule add.' : lines.join("\n"),
|
|
48656
|
-
...errors.length > 0 ? [
|
|
48657
|
-
`${errors.length} job file${errors.length === 1 ? "" : "s"} could not be read; inspect or repair the files under NAMZU_HOME.`
|
|
48658
|
-
] : [],
|
|
48659
|
-
await schedulerLine(ctx.home)
|
|
48660
|
-
].join("\n")
|
|
48661
|
-
);
|
|
48936
|
+
if (previous.subject !== next.subject) return { kind: "renamed", subject };
|
|
48937
|
+
return null;
|
|
48662
48938
|
}
|
|
48663
|
-
__name(
|
|
48664
|
-
|
|
48665
|
-
const
|
|
48666
|
-
|
|
48667
|
-
|
|
48668
|
-
|
|
48669
|
-
|
|
48670
|
-
|
|
48671
|
-
|
|
48672
|
-
|
|
48673
|
-
|
|
48674
|
-
|
|
48675
|
-
|
|
48676
|
-
|
|
48677
|
-
|
|
48678
|
-
|
|
48679
|
-
|
|
48939
|
+
__name(taskOperationFor, "taskOperationFor");
|
|
48940
|
+
function removeTask(tasks, id, subject) {
|
|
48941
|
+
const known = tasks.find((task) => task.id === id);
|
|
48942
|
+
if (!known) return { tasks, operation: null };
|
|
48943
|
+
return {
|
|
48944
|
+
tasks: tasks.filter((task) => task.id !== id),
|
|
48945
|
+
operation: { kind: "removed", subject: subject || known.subject }
|
|
48946
|
+
};
|
|
48947
|
+
}
|
|
48948
|
+
__name(removeTask, "removeTask");
|
|
48949
|
+
function upsertTask(tasks, item) {
|
|
48950
|
+
const index = tasks.findIndex((task) => task.id === item.id);
|
|
48951
|
+
return index < 0 ? [...tasks, item] : tasks.map((task, i) => i === index ? item : task);
|
|
48952
|
+
}
|
|
48953
|
+
__name(upsertTask, "upsertTask");
|
|
48954
|
+
var SINGLE = {
|
|
48955
|
+
added: "Added task",
|
|
48956
|
+
started: "Started",
|
|
48957
|
+
completed: "Completed",
|
|
48958
|
+
failed: "Failed",
|
|
48959
|
+
reopened: "Reopened",
|
|
48960
|
+
renamed: "Renamed task",
|
|
48961
|
+
removed: "Removed task"
|
|
48962
|
+
};
|
|
48963
|
+
var MANY = {
|
|
48964
|
+
added: "Added",
|
|
48965
|
+
started: "Started",
|
|
48966
|
+
completed: "Completed",
|
|
48967
|
+
failed: "Failed",
|
|
48968
|
+
reopened: "Reopened",
|
|
48969
|
+
renamed: "Renamed",
|
|
48970
|
+
removed: "Removed"
|
|
48971
|
+
};
|
|
48972
|
+
function countTasks(count2) {
|
|
48973
|
+
return `${count2} task${count2 === 1 ? "" : "s"}`;
|
|
48974
|
+
}
|
|
48975
|
+
__name(countTasks, "countTasks");
|
|
48976
|
+
function taskBlockHeader(operations, checklist) {
|
|
48977
|
+
const [first] = operations;
|
|
48978
|
+
if (!first) return checklist.length === 0 ? "No tasks yet" : checklistProgress(checklist);
|
|
48979
|
+
if (operations.length === 1)
|
|
48980
|
+
return `${SINGLE[first.kind]} \xB7 ${first.subject.replace(/\s+/g, " ").trim()}`;
|
|
48981
|
+
if (operations.every((operation) => operation.kind === first.kind)) {
|
|
48982
|
+
return `${MANY[first.kind]} ${countTasks(operations.length)}`;
|
|
48680
48983
|
}
|
|
48681
|
-
|
|
48682
|
-
|
|
48683
|
-
|
|
48684
|
-
|
|
48984
|
+
return checklistProgress(checklist);
|
|
48985
|
+
}
|
|
48986
|
+
__name(taskBlockHeader, "taskBlockHeader");
|
|
48987
|
+
function extendable(messages, input) {
|
|
48988
|
+
const last = messages.at(-1);
|
|
48989
|
+
if (!last?.taskBlock || last.taskBlock.key !== input.key || last.pending) return void 0;
|
|
48990
|
+
const finalizedIndex = messages.slice(0, -1).filter((message) => !message.pending).length;
|
|
48991
|
+
return finalizedIndex >= input.settled ? last : void 0;
|
|
48992
|
+
}
|
|
48993
|
+
__name(extendable, "extendable");
|
|
48994
|
+
function applyTaskOperation(messages, input) {
|
|
48995
|
+
const open = extendable(messages, input);
|
|
48996
|
+
const operations = [
|
|
48997
|
+
...open?.taskBlock?.operations ?? [],
|
|
48998
|
+
...input.operation ? [input.operation] : []
|
|
48999
|
+
];
|
|
49000
|
+
if (!open && operations.length === 0 && input.checklist.length === 0) return messages;
|
|
49001
|
+
const row = {
|
|
49002
|
+
id: open?.id ?? input.id,
|
|
49003
|
+
role: "tool",
|
|
49004
|
+
content: taskBlockHeader(operations, input.checklist),
|
|
49005
|
+
glyph: "\u2713",
|
|
49006
|
+
...input.glyphColor ? { glyphColor: input.glyphColor } : {},
|
|
49007
|
+
checklist: input.checklist,
|
|
49008
|
+
taskBlock: { key: input.key, operations }
|
|
49009
|
+
};
|
|
49010
|
+
return open ? [...messages.slice(0, -1), row] : [...messages, row];
|
|
49011
|
+
}
|
|
49012
|
+
__name(applyTaskOperation, "applyTaskOperation");
|
|
49013
|
+
var CHECKLIST_STATUSES = /* @__PURE__ */ new Set([
|
|
49014
|
+
"pending",
|
|
49015
|
+
"in_progress",
|
|
49016
|
+
"completed",
|
|
49017
|
+
"failed"
|
|
49018
|
+
]);
|
|
49019
|
+
function taskReportChecklist(rows) {
|
|
49020
|
+
const items = [];
|
|
49021
|
+
for (const [index, row] of rows.entries()) {
|
|
49022
|
+
const { subject, status, id } = row;
|
|
49023
|
+
if (typeof subject !== "string" || typeof status !== "string") return void 0;
|
|
49024
|
+
if (!CHECKLIST_STATUSES.has(status)) return void 0;
|
|
49025
|
+
items.push({
|
|
49026
|
+
id: typeof id === "string" ? id : String(index),
|
|
49027
|
+
subject,
|
|
49028
|
+
status
|
|
49029
|
+
});
|
|
49030
|
+
}
|
|
49031
|
+
return items;
|
|
49032
|
+
}
|
|
49033
|
+
__name(taskReportChecklist, "taskReportChecklist");
|
|
49034
|
+
|
|
49035
|
+
// src/tui/tool-failure-text.ts
|
|
49036
|
+
var WHOLE_TOOL_ERROR = /^\s*<tool_use_error>([\s\S]*)<\/tool_use_error>\s*$/i;
|
|
49037
|
+
var NESTED_TOOL_ERROR = /<\/?tool_use_error\b/i;
|
|
49038
|
+
var BAD_ARGUMENTS = /^(?:InputValidationError: |Validation failed for "|Tool "[^"]+" was called with no arguments\.)/;
|
|
49039
|
+
function toolFailureText(output, expanded) {
|
|
49040
|
+
if (output === void 0) return "Tool execution failed";
|
|
49041
|
+
const inner = WHOLE_TOOL_ERROR.exec(output)?.[1];
|
|
49042
|
+
const unwrapped = inner !== void 0 && !NESTED_TOOL_ERROR.test(inner) ? inner : output;
|
|
49043
|
+
const text = unwrapped.replace(/<sandbox_violations>[\s\S]*?<\/sandbox_violations>/g, "").replace(/<\/?error>/g, "").trim();
|
|
49044
|
+
if (!expanded && BAD_ARGUMENTS.test(text)) return "Invalid tool parameters";
|
|
49045
|
+
return text.startsWith("Error: ") || text.startsWith("Cancelled: ") ? text : `Error: ${text}`;
|
|
49046
|
+
}
|
|
49047
|
+
__name(toolFailureText, "toolFailureText");
|
|
49048
|
+
function firstLineOf(text) {
|
|
49049
|
+
return text.split("\n", 1)[0] ?? "";
|
|
49050
|
+
}
|
|
49051
|
+
__name(firstLineOf, "firstLineOf");
|
|
49052
|
+
|
|
49053
|
+
// src/tui/tool-end-rows.ts
|
|
49054
|
+
var DISPLAY_NAMES = { edit: "Update" };
|
|
49055
|
+
function formatToolCall(toolName, summary2, standalone = false) {
|
|
49056
|
+
if (standalone) return summary2;
|
|
49057
|
+
if (toolName.startsWith("mcp__")) {
|
|
49058
|
+
const label = connectorToolLabel(toolName);
|
|
49059
|
+
const plain = plainConnectorSummary(summary2);
|
|
49060
|
+
return plain.length > 0 ? `${label}(${plain})` : label;
|
|
49061
|
+
}
|
|
49062
|
+
const words = toolName.replace(/[_-]+/g, " ");
|
|
49063
|
+
const display = DISPLAY_NAMES[toolName.toLowerCase()] ?? (words.length > 0 ? words[0]?.toUpperCase() + words.slice(1) : words);
|
|
49064
|
+
return summary2.length > 0 ? `${display}(${summary2})` : display;
|
|
49065
|
+
}
|
|
49066
|
+
__name(formatToolCall, "formatToolCall");
|
|
49067
|
+
function failureBody(lines, folded) {
|
|
49068
|
+
return { stdout: [], stderr: lines, failed: true, byLine: true, ...folded ? { folded } : {} };
|
|
49069
|
+
}
|
|
49070
|
+
__name(failureBody, "failureBody");
|
|
49071
|
+
function foldOf(start) {
|
|
49072
|
+
if (start?.fold) return start.fold;
|
|
49073
|
+
return start?.activity === "exploration" ? { kind: "read", key: start.label } : void 0;
|
|
49074
|
+
}
|
|
49075
|
+
__name(foldOf, "foldOf");
|
|
49076
|
+
function failedCallRows(event, start) {
|
|
49077
|
+
const head = {
|
|
49078
|
+
role: "tool",
|
|
49079
|
+
content: headOf(event, start),
|
|
49080
|
+
glyph: "\u25CF",
|
|
49081
|
+
glyphColor: tokenColor("status.error")
|
|
49082
|
+
};
|
|
49083
|
+
const said = event.output ?? (event.summary.length > 0 ? event.summary : void 0);
|
|
49084
|
+
const full = toolFailureText(said, true).split("\n");
|
|
49085
|
+
if (event.plainFailure !== void 0) {
|
|
49086
|
+
return [
|
|
49087
|
+
head,
|
|
49088
|
+
{
|
|
49089
|
+
role: "tool",
|
|
49090
|
+
content: event.plainFailure,
|
|
49091
|
+
glyph: "\u23BF",
|
|
49092
|
+
contentColor: event.plainFailureTone === "muted" ? tokenColor("text.muted") : tokenColor("status.error"),
|
|
49093
|
+
...said !== void 0 && said.trim().length > 0 ? { detail: full, meta: EXPAND_HINT, activity: "agent-result" } : {}
|
|
49094
|
+
}
|
|
49095
|
+
];
|
|
49096
|
+
}
|
|
49097
|
+
const text = toolFailureText(said, false);
|
|
49098
|
+
const lines = text.split("\n");
|
|
49099
|
+
return [
|
|
49100
|
+
{
|
|
49101
|
+
...head,
|
|
49102
|
+
detail: full,
|
|
49103
|
+
shell: failureBody(full, text !== full.join("\n") ? lines : void 0)
|
|
49104
|
+
}
|
|
49105
|
+
];
|
|
49106
|
+
}
|
|
49107
|
+
__name(failedCallRows, "failedCallRows");
|
|
49108
|
+
function headOf(event, start) {
|
|
49109
|
+
return start?.label ?? formatToolCall(event.toolName, event.summary);
|
|
49110
|
+
}
|
|
49111
|
+
__name(headOf, "headOf");
|
|
49112
|
+
function toolEndRows(event, start, ctx) {
|
|
49113
|
+
const rows = /* @__PURE__ */ __name((list2) => ({ kind: "rows", rows: list2 }), "rows");
|
|
49114
|
+
const fold2 = foldOf(start);
|
|
49115
|
+
if (!event.isError && !event.declined && fold2) {
|
|
49116
|
+
const raw = event.output !== void 0 ? event.output.split("\n") : [...event.summary ? [event.summary] : [], ...event.detail ?? []];
|
|
49117
|
+
const answer = event.shell?.note;
|
|
49118
|
+
const output = answer !== void 0 && raw.join("").trim().toLowerCase() === "(no output)" ? [answer] : raw;
|
|
49119
|
+
const state = foldOp(EMPTY_GROUP, { ...fold2, hint: void 0 }, 0);
|
|
49120
|
+
const headline = event.headline ?? start?.label ?? headOf(event, start);
|
|
49121
|
+
return rows([
|
|
49122
|
+
{
|
|
49123
|
+
role: "tool",
|
|
49124
|
+
content: groupText(state, false),
|
|
49125
|
+
detail: [headline, ...output],
|
|
49126
|
+
glyph: " ",
|
|
49127
|
+
glyphColor: tokenColor("text.muted"),
|
|
49128
|
+
meta: EXPAND_HINT,
|
|
49129
|
+
activity: "exploration",
|
|
49130
|
+
group: state
|
|
49131
|
+
}
|
|
49132
|
+
]);
|
|
49133
|
+
}
|
|
49134
|
+
if (event.isError && !event.declined && !event.cancelled && fold2) {
|
|
49135
|
+
const said = event.output ?? (event.summary.length > 0 ? event.summary : void 0);
|
|
49136
|
+
const state = foldOp(EMPTY_GROUP, { ...fold2, hint: void 0 }, 0);
|
|
49137
|
+
return rows([
|
|
49138
|
+
{
|
|
49139
|
+
role: "tool",
|
|
49140
|
+
content: groupText(state, false),
|
|
49141
|
+
detail: [start?.label ?? headOf(event, start), ...toolFailureText(said, true).split("\n")],
|
|
49142
|
+
glyph: " ",
|
|
49143
|
+
glyphColor: tokenColor("text.muted"),
|
|
49144
|
+
meta: EXPAND_HINT,
|
|
49145
|
+
activity: "exploration",
|
|
49146
|
+
group: state
|
|
49147
|
+
}
|
|
49148
|
+
]);
|
|
49149
|
+
}
|
|
49150
|
+
const web = event.web ?? start?.web;
|
|
49151
|
+
if (web && !event.isError) {
|
|
49152
|
+
const activity = {
|
|
49153
|
+
...web,
|
|
49154
|
+
...event.web?.target ?? start?.web?.target ? { target: event.web?.target ?? start?.web?.target } : {}
|
|
49155
|
+
};
|
|
49156
|
+
const durationMs = event.durationMs ?? ctx.elapsedMs;
|
|
49157
|
+
const output = web.hosted ? void 0 : event.output;
|
|
49158
|
+
const outputLines = output !== void 0 ? output.split("\n") : void 0;
|
|
49159
|
+
return rows([
|
|
49160
|
+
{
|
|
49161
|
+
role: "tool",
|
|
49162
|
+
content: webCallTitle(activity),
|
|
49163
|
+
glyph: "\u25CF",
|
|
49164
|
+
glyphColor: tokenColor("status.ok"),
|
|
49165
|
+
activity: "web"
|
|
49166
|
+
},
|
|
49167
|
+
{
|
|
49168
|
+
role: "tool",
|
|
49169
|
+
content: webSettledLine(activity, {
|
|
49170
|
+
...durationMs !== void 0 ? { durationMs } : {},
|
|
49171
|
+
...activity.kind === "fetch" && output !== void 0 ? { bytes: Buffer.byteLength(output, "utf8") } : {}
|
|
49172
|
+
}),
|
|
49173
|
+
glyph: "\u23BF",
|
|
49174
|
+
...outputLines ? { detail: outputLines } : {},
|
|
49175
|
+
...outputLines && outputLines.length > 0 ? { meta: EXPAND_HINT } : {},
|
|
49176
|
+
activity: "web"
|
|
49177
|
+
}
|
|
49178
|
+
]);
|
|
49179
|
+
}
|
|
49180
|
+
if (isTaskTool(event.toolName) && !event.isError) {
|
|
49181
|
+
if (event.toolName !== "task_list") return { kind: "none" };
|
|
49182
|
+
if (ctx.hasPlan) return { kind: "task-block" };
|
|
49183
|
+
const said = event.resultLabel ?? "";
|
|
49184
|
+
return rows([
|
|
49185
|
+
{
|
|
49186
|
+
role: "tool",
|
|
49187
|
+
content: start?.label ?? formatToolCall(event.toolName, event.summary, true),
|
|
49188
|
+
glyph: "\u25CF",
|
|
49189
|
+
glyphColor: tokenColor("status.ok")
|
|
49190
|
+
},
|
|
49191
|
+
...said.length > 0 ? [
|
|
49192
|
+
{
|
|
49193
|
+
role: "tool",
|
|
49194
|
+
content: said,
|
|
49195
|
+
glyph: "\u23BF"
|
|
49196
|
+
}
|
|
49197
|
+
] : []
|
|
49198
|
+
]);
|
|
49199
|
+
}
|
|
49200
|
+
if (event.declined) {
|
|
49201
|
+
const refused = proposedBody(start?.proposed, ctx.cwd);
|
|
49202
|
+
return rows([
|
|
49203
|
+
{
|
|
49204
|
+
role: "tool",
|
|
49205
|
+
content: headOf(event, start),
|
|
49206
|
+
glyph: "\u25CF",
|
|
49207
|
+
glyphColor: tokenColor("status.error")
|
|
49208
|
+
},
|
|
49209
|
+
{
|
|
49210
|
+
role: "tool",
|
|
49211
|
+
content: declinedLine(event.declined.note),
|
|
49212
|
+
glyph: "\u23BF",
|
|
49213
|
+
...refused ? { detail: refused.rows, diff: refused.diff } : {}
|
|
49214
|
+
}
|
|
49215
|
+
]);
|
|
49216
|
+
}
|
|
49217
|
+
if (event.cancelled) {
|
|
49218
|
+
return rows([
|
|
49219
|
+
{
|
|
49220
|
+
role: "tool",
|
|
49221
|
+
content: headOf(event, start),
|
|
49222
|
+
glyph: "\u25CF",
|
|
49223
|
+
glyphColor: tokenColor("text.muted"),
|
|
49224
|
+
...settledElapsed(event.durationMs) !== void 0 ? { meta: settledElapsed(event.durationMs) } : {}
|
|
49225
|
+
},
|
|
49226
|
+
{ role: "tool", content: event.resultLabel ?? "Cancelled", glyph: "\u23BF" }
|
|
49227
|
+
]);
|
|
49228
|
+
}
|
|
49229
|
+
if (!event.isError && event.toolName === WORKFLOW_TOOL_NAME && isBackgroundLaunch(event.output ?? "")) {
|
|
49230
|
+
return rows([
|
|
49231
|
+
{
|
|
49232
|
+
role: "tool",
|
|
49233
|
+
content: headOf(event, start),
|
|
49234
|
+
glyph: "\u25CF",
|
|
49235
|
+
glyphColor: tokenColor("accent.assistant")
|
|
49236
|
+
},
|
|
49237
|
+
{ role: "tool", content: WORKFLOW_BACKGROUND_NOTE, glyph: "\u23BF" }
|
|
49238
|
+
]);
|
|
49239
|
+
}
|
|
49240
|
+
if (event.isError && event.toolName === WORKFLOW_TOOL_NAME && event.output !== void 0) {
|
|
49241
|
+
const said = [`\u2718 ${firstLineOf(event.output)}`];
|
|
49242
|
+
return rows([
|
|
49243
|
+
{
|
|
49244
|
+
role: "tool",
|
|
49245
|
+
content: headOf(event, start),
|
|
49246
|
+
glyph: "\u25CF",
|
|
49247
|
+
glyphColor: tokenColor("status.error"),
|
|
49248
|
+
detail: said,
|
|
49249
|
+
shell: failureBody(said)
|
|
49250
|
+
}
|
|
49251
|
+
]);
|
|
49252
|
+
}
|
|
49253
|
+
if (event.isError && event.toolName.toLowerCase() === "agent") {
|
|
49254
|
+
const text = toolFailureText(event.output, false);
|
|
49255
|
+
const full = toolFailureText(event.output, true).split("\n");
|
|
49256
|
+
const lines = text.split("\n");
|
|
49257
|
+
return rows([
|
|
49258
|
+
{
|
|
49259
|
+
role: "tool",
|
|
49260
|
+
content: headOf(event, start),
|
|
49261
|
+
glyph: "\u25CF",
|
|
49262
|
+
glyphColor: tokenColor("status.error"),
|
|
49263
|
+
detail: full,
|
|
49264
|
+
shell: failureBody(full, text !== full.join("\n") ? lines : void 0)
|
|
49265
|
+
}
|
|
49266
|
+
]);
|
|
49267
|
+
}
|
|
49268
|
+
const catalogue = !event.isError && event.toolName === "agent_models" && event.output !== void 0 ? modelCatalogueView(event.output) : void 0;
|
|
49269
|
+
if (catalogue !== void 0) {
|
|
49270
|
+
return rows([
|
|
49271
|
+
{
|
|
49272
|
+
role: "tool",
|
|
49273
|
+
content: catalogue,
|
|
49274
|
+
glyph: "\u25CF",
|
|
49275
|
+
detail: event.output?.split("\n"),
|
|
49276
|
+
glyphColor: tokenColor("status.ok"),
|
|
49277
|
+
meta: EXPAND_HINT,
|
|
49278
|
+
activity: "catalogue"
|
|
49279
|
+
}
|
|
49280
|
+
]);
|
|
49281
|
+
}
|
|
49282
|
+
const evidence = !event.isError && event.output !== void 0 ? conversationEvidenceView(event.toolName, event.output) : void 0;
|
|
49283
|
+
if (evidence !== void 0) {
|
|
49284
|
+
return rows([
|
|
49285
|
+
{
|
|
49286
|
+
role: "tool",
|
|
49287
|
+
content: evidence.content,
|
|
49288
|
+
glyph: "\u25CF",
|
|
49289
|
+
detail: evidence.detail,
|
|
49290
|
+
glyphColor: tokenColor("status.ok"),
|
|
49291
|
+
meta: EXPAND_HINT,
|
|
49292
|
+
activity: "evidence"
|
|
49293
|
+
}
|
|
49294
|
+
]);
|
|
49295
|
+
}
|
|
49296
|
+
if (event.shell && start?.command !== void 0) {
|
|
49297
|
+
const failed = event.isError || event.shell.failed;
|
|
49298
|
+
const command = start.command;
|
|
49299
|
+
const header = command ? formatToolCall(event.toolName, shellCommandHeader(command)) : start.label;
|
|
49300
|
+
const full = command ? formatToolCall(event.toolName, shellCommandFull(command)) : void 0;
|
|
49301
|
+
const settled2 = event.isError && event.shell.stderr.length === 0 ? { ...event.shell, stdout: [], stderr: event.shell.stdout, failed: true } : { ...event.shell, failed };
|
|
49302
|
+
return rows([
|
|
49303
|
+
{
|
|
49304
|
+
role: "tool",
|
|
49305
|
+
content: header,
|
|
49306
|
+
glyph: "\u25CF",
|
|
49307
|
+
detail: [...settled2.stdout, ...settled2.stderr],
|
|
49308
|
+
glyphColor: failed ? tokenColor("status.error") : tokenColor("status.ok"),
|
|
49309
|
+
shell: full !== void 0 && full !== header ? { ...settled2, fullHeader: full } : settled2
|
|
49310
|
+
}
|
|
49311
|
+
]);
|
|
49312
|
+
}
|
|
49313
|
+
if (event.isError) return rows(failedCallRows(event, start));
|
|
49314
|
+
const elapsed2 = settledElapsed(event.durationMs ?? ctx.elapsedMs);
|
|
49315
|
+
const list = [
|
|
49316
|
+
{
|
|
49317
|
+
role: "tool",
|
|
49318
|
+
content: headOf(event, start),
|
|
49319
|
+
glyph: "\u25CF",
|
|
49320
|
+
// The change to a file is drawn once, under its result.
|
|
49321
|
+
detail: event.diff ? void 0 : start?.detail,
|
|
49322
|
+
glyphColor: tokenColor("status.ok"),
|
|
49323
|
+
...elapsed2 !== void 0 ? { meta: elapsed2 } : {}
|
|
49324
|
+
}
|
|
49325
|
+
];
|
|
49326
|
+
if (!event.hidden && (event.summary.length > 0 || (event.detail?.length ?? 0) > 0)) {
|
|
49327
|
+
list.push({
|
|
49328
|
+
role: "tool",
|
|
49329
|
+
content: event.diff?.summary ? spansText(event.diff.summary) : event.summary,
|
|
49330
|
+
glyph: "\u23BF",
|
|
49331
|
+
detail: event.detail,
|
|
49332
|
+
...event.diff ? { diff: event.diff } : {}
|
|
49333
|
+
});
|
|
49334
|
+
}
|
|
49335
|
+
return rows(list);
|
|
49336
|
+
}
|
|
49337
|
+
__name(toolEndRows, "toolEndRows");
|
|
49338
|
+
|
|
49339
|
+
// src/tui/queued-calls.ts
|
|
49340
|
+
function queuedToolRow(call, turnId, presenter, cwd2, now) {
|
|
49341
|
+
const event = toAgentEvent(
|
|
49342
|
+
{
|
|
49343
|
+
type: "tool_executing",
|
|
49344
|
+
...turnId ? { turnId } : {},
|
|
49345
|
+
toolUseId: call.id,
|
|
49346
|
+
toolName: call.name,
|
|
49347
|
+
input: call.input
|
|
49348
|
+
},
|
|
49349
|
+
presenter,
|
|
49350
|
+
void 0,
|
|
49351
|
+
cwd2
|
|
49352
|
+
);
|
|
49353
|
+
if (event?.kind !== "tool-start") return void 0;
|
|
49354
|
+
return {
|
|
49355
|
+
id: event.toolUseId,
|
|
49356
|
+
...event.turnId ? { turnId: event.turnId } : {},
|
|
49357
|
+
toolName: event.toolName,
|
|
49358
|
+
...event.activity ? { activity: event.activity } : {},
|
|
49359
|
+
label: event.web ? webCallTitle(event.web) : formatToolCall(event.toolName, event.summary, event.standalone),
|
|
49360
|
+
startedAt: now,
|
|
49361
|
+
queued: true,
|
|
49362
|
+
detail: event.detail,
|
|
49363
|
+
...event.command ? { command: event.command } : {},
|
|
49364
|
+
...event.web ? { web: event.web } : {}
|
|
49365
|
+
};
|
|
49366
|
+
}
|
|
49367
|
+
__name(queuedToolRow, "queuedToolRow");
|
|
49368
|
+
function withQueuedRow(rows, row) {
|
|
49369
|
+
return rows.some((other) => other.id === row.id && other.turnId === row.turnId) ? rows : [...rows, row];
|
|
49370
|
+
}
|
|
49371
|
+
__name(withQueuedRow, "withQueuedRow");
|
|
49372
|
+
function withoutQueuedRow(rows, callId) {
|
|
49373
|
+
return rows.filter((row) => !(row.id === callId && row.queued === true));
|
|
49374
|
+
}
|
|
49375
|
+
__name(withoutQueuedRow, "withoutQueuedRow");
|
|
49376
|
+
function withStartedRow(rows, callId, now) {
|
|
49377
|
+
return rows.map((row) => {
|
|
49378
|
+
if (row.id !== callId || row.queued !== true) return row;
|
|
49379
|
+
const { queued: _queued, ...running } = row;
|
|
49380
|
+
return { ...running, startedAt: now };
|
|
49381
|
+
});
|
|
49382
|
+
}
|
|
49383
|
+
__name(withStartedRow, "withStartedRow");
|
|
49384
|
+
function withTakenOverRow(rows, started) {
|
|
49385
|
+
const at = rows.findIndex(
|
|
49386
|
+
(row) => row.id === started.id && (started.turnId === void 0 || row.turnId === void 0 || row.turnId === started.turnId)
|
|
49387
|
+
);
|
|
49388
|
+
return at < 0 ? [...rows, started] : [...rows.slice(0, at), started, ...rows.slice(at + 1)];
|
|
49389
|
+
}
|
|
49390
|
+
__name(withTakenOverRow, "withTakenOverRow");
|
|
49391
|
+
|
|
49392
|
+
// src/tui/schedule/host-commands.ts
|
|
49393
|
+
import { isAbsolute, relative, resolve as resolve3 } from "node:path";
|
|
49394
|
+
|
|
49395
|
+
// src/tui/schedule/loop-host.ts
|
|
49396
|
+
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
49397
|
+
import { readFileSync as readFileSync5 } from "node:fs";
|
|
49398
|
+
var MAX_LOOPS = 20;
|
|
49399
|
+
var LOOP_LIFETIME_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
49400
|
+
function loopSpec(interval, now) {
|
|
49401
|
+
const text = interval.trim();
|
|
49402
|
+
if (/^\d+\s*[a-z]+$/i.test(text))
|
|
49403
|
+
return parseScheduleSpec(`every ${text}`, { now, tz: hostTimeZone() });
|
|
49404
|
+
return parseScheduleSpec(text, { now, tz: hostTimeZone() });
|
|
49405
|
+
}
|
|
49406
|
+
__name(loopSpec, "loopSpec");
|
|
49407
|
+
var SessionLoopScheduler = class {
|
|
49408
|
+
static {
|
|
49409
|
+
__name(this, "SessionLoopScheduler");
|
|
49410
|
+
}
|
|
49411
|
+
#deps;
|
|
49412
|
+
#file;
|
|
49413
|
+
#loops = [];
|
|
49414
|
+
constructor(deps) {
|
|
49415
|
+
this.#deps = deps;
|
|
49416
|
+
}
|
|
49417
|
+
#now() {
|
|
49418
|
+
return (this.#deps.now ?? Date.now)();
|
|
49419
|
+
}
|
|
49420
|
+
/** Follow the conversation on screen: load its loops when it changes. */
|
|
49421
|
+
#sync() {
|
|
49422
|
+
const file = this.#deps.file();
|
|
49423
|
+
if (file === this.#file) return;
|
|
49424
|
+
const carried = this.#file === void 0 ? this.#loops : [];
|
|
49425
|
+
this.#file = file;
|
|
49426
|
+
this.#loops = [];
|
|
49427
|
+
if (!file) return;
|
|
49428
|
+
try {
|
|
49429
|
+
const parsed = JSON.parse(readFileSync5(file, "utf8"));
|
|
49430
|
+
if (parsed.kind === "session-loops" && Array.isArray(parsed.loops)) {
|
|
49431
|
+
const now = this.#now();
|
|
49432
|
+
this.#loops = parsed.loops.filter(
|
|
49433
|
+
(l) => (!l.expiresAt || Date.parse(l.expiresAt) > now) && // A one-shot whose time passed is not restored.
|
|
49434
|
+
!(l.spec.kind === "at" && Date.parse(l.spec.at) <= now)
|
|
49435
|
+
);
|
|
49436
|
+
}
|
|
49437
|
+
} catch {
|
|
49438
|
+
}
|
|
49439
|
+
if (carried.length > 0) {
|
|
49440
|
+
this.#loops = [...this.#loops, ...carried].slice(0, MAX_LOOPS);
|
|
49441
|
+
this.#save();
|
|
49442
|
+
}
|
|
49443
|
+
}
|
|
49444
|
+
#save() {
|
|
49445
|
+
if (!this.#file) return;
|
|
49446
|
+
try {
|
|
49447
|
+
writeJsonAtomic(this.#file, {
|
|
49448
|
+
v: 1,
|
|
49449
|
+
kind: "session-loops",
|
|
49450
|
+
loops: this.#loops
|
|
49451
|
+
});
|
|
49452
|
+
} catch {
|
|
49453
|
+
}
|
|
49454
|
+
}
|
|
49455
|
+
async create(request) {
|
|
49456
|
+
this.#sync();
|
|
49457
|
+
if (this.#loops.length >= MAX_LOOPS)
|
|
49458
|
+
throw new Error(`A conversation holds at most ${MAX_LOOPS} loops.`);
|
|
49459
|
+
const now = new Date(this.#now());
|
|
49460
|
+
const spec = loopSpec(request.interval, now);
|
|
49461
|
+
const loop = {
|
|
49462
|
+
id: randomBytes2(3).toString("hex"),
|
|
49463
|
+
schedule: describeSchedule(spec, { tz: hostTimeZone() }),
|
|
49464
|
+
prompt: request.prompt,
|
|
49465
|
+
createdAt: now.toISOString(),
|
|
49466
|
+
expiresAt: new Date(now.getTime() + LOOP_LIFETIME_MS).toISOString(),
|
|
49467
|
+
createdBy: request.createdBy,
|
|
49468
|
+
spec
|
|
49469
|
+
};
|
|
49470
|
+
this.#loops.push(loop);
|
|
49471
|
+
this.#save();
|
|
49472
|
+
return loop;
|
|
49473
|
+
}
|
|
49474
|
+
list() {
|
|
49475
|
+
this.#sync();
|
|
49476
|
+
return this.#loops;
|
|
49477
|
+
}
|
|
49478
|
+
async delete(id) {
|
|
49479
|
+
this.#sync();
|
|
49480
|
+
const before = this.#loops.length;
|
|
49481
|
+
this.#loops = id === "all" ? [] : this.#loops.filter((l) => l.id !== id);
|
|
49482
|
+
this.#save();
|
|
49483
|
+
return before - this.#loops.length;
|
|
49484
|
+
}
|
|
49485
|
+
/** Fire what is due, when idle. Called on a timer and when a turn ends. */
|
|
49486
|
+
tick() {
|
|
49487
|
+
this.#sync();
|
|
49488
|
+
const now = this.#now();
|
|
49489
|
+
let changed = false;
|
|
49490
|
+
const kept = [];
|
|
49491
|
+
let fired = false;
|
|
49492
|
+
for (const loop of this.#loops) {
|
|
49493
|
+
if (loop.expiresAt && Date.parse(loop.expiresAt) <= now) {
|
|
49494
|
+
changed = true;
|
|
49495
|
+
continue;
|
|
49496
|
+
}
|
|
49497
|
+
const last = Date.parse(loop.lastFiredAt ?? loop.createdAt);
|
|
49498
|
+
const due = nextFireTime(loop.spec, new Date(last));
|
|
49499
|
+
const isDue = loop.pending || due !== null && due.getTime() <= now;
|
|
49500
|
+
if (!isDue) {
|
|
49501
|
+
kept.push(loop);
|
|
49502
|
+
continue;
|
|
49503
|
+
}
|
|
49504
|
+
if (fired || !this.#deps.isIdle()) {
|
|
49505
|
+
if (!loop.pending) changed = true;
|
|
49506
|
+
kept.push({ ...loop, pending: true });
|
|
49507
|
+
continue;
|
|
49508
|
+
}
|
|
49509
|
+
fired = true;
|
|
49510
|
+
changed = true;
|
|
49511
|
+
const done = loop.spec.kind === "at";
|
|
49512
|
+
const { pending: _pending, ...rest } = loop;
|
|
49513
|
+
if (!done) kept.push({ ...rest, lastFiredAt: new Date(now).toISOString() });
|
|
49514
|
+
this.#deps.fire(loop);
|
|
49515
|
+
}
|
|
49516
|
+
this.#loops = kept;
|
|
49517
|
+
if (changed) this.#save();
|
|
49518
|
+
}
|
|
49519
|
+
};
|
|
49520
|
+
function describeLoops(loops) {
|
|
49521
|
+
if (loops.length === 0) return "No loops in this conversation. /loop 5m <prompt> adds one.";
|
|
49522
|
+
return loops.map(
|
|
49523
|
+
(l) => `\u21BB ${l.id} ${l.schedule}${l.createdBy === "model" ? " (created by the model)" : ""}${l.lastFiredAt ? ` last ${new Date(l.lastFiredAt).toLocaleTimeString()}` : ""}
|
|
49524
|
+
${l.prompt.replace(/\s+/g, " ").slice(0, 100)}`
|
|
49525
|
+
).join("\n");
|
|
49526
|
+
}
|
|
49527
|
+
__name(describeLoops, "describeLoops");
|
|
49528
|
+
|
|
49529
|
+
// src/tui/schedule/host-commands.ts
|
|
49530
|
+
var USAGE = [
|
|
49531
|
+
"/schedule jobs, and what needs you",
|
|
49532
|
+
"/schedule confirm <job> confirm a job created without a terminal, or held after an edit",
|
|
49533
|
+
"/schedule pause|resume <job>",
|
|
49534
|
+
"/schedule run <job> run it now through the scheduler",
|
|
49535
|
+
"/schedule remove <job>",
|
|
49536
|
+
'/schedule add <name> "<when>" <read-only|edit-in-folder> <prompt\u2026>',
|
|
49537
|
+
"A run waiting for approval: /resume its conversation (Scheduled: <job> \xB7 <time>) in its folder."
|
|
49538
|
+
].join("\n");
|
|
49539
|
+
async function schedulerLine(home) {
|
|
49540
|
+
const paths = schedulePaths(home);
|
|
49541
|
+
const endpoint = readEndpoint(paths.endpoint);
|
|
49542
|
+
if (endpoint && await callEndpoint(endpoint, "status", {}, 500)) return "Scheduler: running.";
|
|
49543
|
+
let installed = false;
|
|
49544
|
+
try {
|
|
49545
|
+
installed = readManifest(paths) !== void 0;
|
|
49546
|
+
} catch {
|
|
49547
|
+
}
|
|
49548
|
+
return installed ? "Scheduler: installed but not answering \u2014 namzu schedule status." : "Scheduler: not installed \u2014 namzu schedule install. Jobs do not run until it is.";
|
|
49549
|
+
}
|
|
49550
|
+
__name(schedulerLine, "schedulerLine");
|
|
49551
|
+
function when(iso, tz) {
|
|
49552
|
+
if (!iso) return "\u2014";
|
|
49553
|
+
return new Intl.DateTimeFormat("en-GB", {
|
|
49554
|
+
dateStyle: "medium",
|
|
49555
|
+
timeStyle: "short",
|
|
49556
|
+
timeZone: tz
|
|
49557
|
+
}).format(new Date(iso));
|
|
49558
|
+
}
|
|
49559
|
+
__name(when, "when");
|
|
49560
|
+
async function listScheduleJobs(ctx) {
|
|
49561
|
+
const paths = schedulePaths(ctx.home);
|
|
49562
|
+
const { jobs, errors } = listJobs(paths);
|
|
49563
|
+
const lines = [];
|
|
49564
|
+
for (const job of jobs) {
|
|
49565
|
+
const tz = job.schedule.kind === "cron" ? job.schedule.tz : hostTimeZone();
|
|
49566
|
+
const state = readState(paths, job.id);
|
|
49567
|
+
const mark = state.activeRun?.status === "awaiting-approval" ? state.activeRun.handoff ? ` [${parkedRunWords(state.activeRun)}]` : " [waiting for your approval]" : job.state === "pending-confirmation" ? " [needs confirmation]" : job.state === "active" && !confirmationHolds(job) ? " [on hold: changed outside namzu]" : state.activeRun?.status === "running" ? " [running]" : "";
|
|
49568
|
+
const kind = job.runKind === "script" ? " [script, 0 tokens]" : job.runKind === "script+agent" ? " [script+agent]" : "";
|
|
49569
|
+
lines.push(
|
|
49570
|
+
`${job.name} [${job.state}]${kind}${mark}
|
|
49571
|
+
${describeSchedule(job.schedule, { tz })} \xB7 next ${when(nextFireOf(job, state), tz)}${state.lastRun ? ` \xB7 last ${state.lastRun.status}${callsCount(state.lastRun) ? ` (${callsCount(state.lastRun)})` : ""} ${when(state.lastRun.endedAt, tz)}` : ""}
|
|
49572
|
+
${job.workspace === "none" ? "Private scheduler workspace (no project)" : job.folder.canonical}`
|
|
49573
|
+
);
|
|
49574
|
+
if (job.delivery?.kind === "source-conversation")
|
|
49575
|
+
lines.push(` Results return to source conversation ${job.delivery.sessionId}`);
|
|
49576
|
+
if (state.activeRun?.status === "awaiting-approval" && state.activeRun.sessionId) {
|
|
49577
|
+
const command = resumeCommand(job, state.activeRun.sessionId);
|
|
49578
|
+
const verb = state.activeRun.handoff ? "when that is done, continue it" : "answer it";
|
|
49579
|
+
lines.push(
|
|
49580
|
+
job.folder.canonical === ctx.cwd ? ` ${verb}: /resume and pick "Scheduled: ${job.name}", or ${command}` : ` ${verb}: ${command}`
|
|
49581
|
+
);
|
|
49582
|
+
}
|
|
49583
|
+
}
|
|
49584
|
+
return visibleScheduleMessage(
|
|
49585
|
+
[
|
|
49586
|
+
jobs.length === 0 ? errors.length > 0 ? "No readable scheduled jobs." : 'No scheduled jobs. Ask for one ("run this every night at 3"), or /schedule add.' : lines.join("\n"),
|
|
49587
|
+
...errors.length > 0 ? [
|
|
49588
|
+
`${errors.length} job file${errors.length === 1 ? "" : "s"} could not be read; inspect or repair the files under NAMZU_HOME.`
|
|
49589
|
+
] : [],
|
|
49590
|
+
await schedulerLine(ctx.home)
|
|
49591
|
+
].join("\n")
|
|
49592
|
+
);
|
|
49593
|
+
}
|
|
49594
|
+
__name(listScheduleJobs, "listScheduleJobs");
|
|
49595
|
+
async function confirmInTui(ctx, job, verb) {
|
|
49596
|
+
const say = /* @__PURE__ */ __name((message) => ctx.say(visibleScheduleMessage(message)), "say");
|
|
49597
|
+
const paths = schedulePaths(ctx.home);
|
|
49598
|
+
const layers = readPermissionLayers({
|
|
49599
|
+
cwd: job.folder.canonical,
|
|
49600
|
+
home: ctx.home,
|
|
49601
|
+
...job.workspace === "none" ? { includeProject: false } : {}
|
|
49602
|
+
});
|
|
49603
|
+
const policy = compileJobPolicy(job.permissions, {
|
|
49604
|
+
layers,
|
|
49605
|
+
namzuHome: paths.home,
|
|
49606
|
+
folder: job.folder
|
|
49607
|
+
});
|
|
49608
|
+
if (policy.diagnostics.length > 0) {
|
|
49609
|
+
say(`The rules do not compile: ${policy.diagnostics.join("; ")}`);
|
|
49610
|
+
return "cancel";
|
|
49611
|
+
}
|
|
49612
|
+
const runKind = job.runKind ?? "agent";
|
|
49613
|
+
if (runKind !== "agent" && runKind !== "script" && runKind !== "script+agent") {
|
|
49614
|
+
say(`The job has an unknown run kind: ${String(runKind)}`);
|
|
49615
|
+
return "cancel";
|
|
48685
49616
|
}
|
|
48686
49617
|
if (runKind !== "agent") {
|
|
48687
49618
|
if (!job.script) {
|
|
@@ -50389,198 +51320,78 @@ function readSuggestionLedger(namzuHome) {
|
|
|
50389
51320
|
const unanswered = typeof raw.unanswered === "number" && Number.isInteger(raw.unanswered) && raw.unanswered >= 0 ? raw.unanswered : 0;
|
|
50390
51321
|
return { v: 1, unanswered, stopped: raw.stopped === true };
|
|
50391
51322
|
} catch {
|
|
50392
|
-
return FRESH_LEDGER;
|
|
50393
|
-
}
|
|
50394
|
-
}
|
|
50395
|
-
__name(readSuggestionLedger, "readSuggestionLedger");
|
|
50396
|
-
function writeSuggestionLedger(namzuHome, ledger) {
|
|
50397
|
-
const path = suggestionLedgerPath(namzuHome);
|
|
50398
|
-
try {
|
|
50399
|
-
mkdirSync(dirname(path), { recursive: true });
|
|
50400
|
-
const temp = `${path}.${process.pid}.tmp`;
|
|
50401
|
-
writeFileSync(temp, `${JSON.stringify(ledger)}
|
|
50402
|
-
`, { mode: 384 });
|
|
50403
|
-
renameSync(temp, path);
|
|
50404
|
-
} catch {
|
|
50405
|
-
}
|
|
50406
|
-
}
|
|
50407
|
-
__name(writeSuggestionLedger, "writeSuggestionLedger");
|
|
50408
|
-
function admitSuggestion(ledger) {
|
|
50409
|
-
if (ledger.stopped) return { show: "nothing" };
|
|
50410
|
-
if (ledger.unanswered >= SUGGESTION_IGNORE_LIMIT) {
|
|
50411
|
-
return { show: "stopped-notice", next: { ...ledger, stopped: true } };
|
|
50412
|
-
}
|
|
50413
|
-
return { show: "proposal", next: { ...ledger, unanswered: ledger.unanswered + 1 } };
|
|
50414
|
-
}
|
|
50415
|
-
__name(admitSuggestion, "admitSuggestion");
|
|
50416
|
-
|
|
50417
|
-
// src/tui/spinner-tips-setting.ts
|
|
50418
|
-
function setSpinnerTips(on, opts = {}) {
|
|
50419
|
-
try {
|
|
50420
|
-
setUserConfigValue(["tui", "spinnerTips"], on, {
|
|
50421
|
-
...opts.home ? { home: opts.home } : {},
|
|
50422
|
-
...opts.env ? { env: opts.env } : {}
|
|
50423
|
-
});
|
|
50424
|
-
} catch (error) {
|
|
50425
|
-
return `${explainFailure(error, "Could not save that setting.")} This conversation ${on ? "shows" : "hides"} tips until it ends.`;
|
|
50426
|
-
}
|
|
50427
|
-
const saved = on ? "Tips are on: one short tip shows under the working row." : "Tips are off. /config tips on turns them back on. The next task still shows under the working row.";
|
|
50428
|
-
let resolved;
|
|
50429
|
-
try {
|
|
50430
|
-
resolved = loadConfigWithProvenance(opts);
|
|
50431
|
-
} catch (error) {
|
|
50432
|
-
return `${saved} ${explainFailure(error, "Could not check the other config files.")} This conversation follows your choice.`;
|
|
50433
|
-
}
|
|
50434
|
-
const effective = resolved.config.tui?.spinnerTips !== false;
|
|
50435
|
-
if (effective === on) return saved;
|
|
50436
|
-
const source = resolved.provenance.tui;
|
|
50437
|
-
const winner = source ? formatConfigSource(source) : "another config layer";
|
|
50438
|
-
return `${saved} But ${winner} turns them ${effective ? "on" : "off"}, so from the next start they will be ${effective ? "on" : "off"}; this conversation follows your choice.`;
|
|
50439
|
-
}
|
|
50440
|
-
__name(setSpinnerTips, "setSpinnerTips");
|
|
50441
|
-
|
|
50442
|
-
// src/tui/stale-history-retry.ts
|
|
50443
|
-
async function* sendWithRebuiltHistory(send, input) {
|
|
50444
|
-
let prior = [...input.history, ...input.tail];
|
|
50445
|
-
for (let attempt = 0; ; attempt += 1) {
|
|
50446
|
-
let refused;
|
|
50447
|
-
for await (const event of send(prior)) {
|
|
50448
|
-
if (attempt === 0 && event.kind === "error" && event.failure?.code === "stale_cached_history") {
|
|
50449
|
-
refused = event;
|
|
50450
|
-
break;
|
|
50451
|
-
}
|
|
50452
|
-
yield event;
|
|
50453
|
-
}
|
|
50454
|
-
if (!refused) return;
|
|
50455
|
-
const fresh = await input.rebuild().catch(() => void 0);
|
|
50456
|
-
if (!fresh) {
|
|
50457
|
-
yield refused;
|
|
50458
|
-
return;
|
|
50459
|
-
}
|
|
50460
|
-
prior = [...fresh, ...input.tail];
|
|
50461
|
-
}
|
|
50462
|
-
}
|
|
50463
|
-
__name(sendWithRebuiltHistory, "sendWithRebuiltHistory");
|
|
50464
|
-
|
|
50465
|
-
// src/tui/task-activity.ts
|
|
50466
|
-
var TASK_TOOLS = /* @__PURE__ */ new Set(["task_create", "task_update", "task_list"]);
|
|
50467
|
-
function isTaskTool(toolName) {
|
|
50468
|
-
return TASK_TOOLS.has(toolName);
|
|
50469
|
-
}
|
|
50470
|
-
__name(isTaskTool, "isTaskTool");
|
|
50471
|
-
function taskOperationFor(previous, next) {
|
|
50472
|
-
const subject = next.subject;
|
|
50473
|
-
if (!previous) return { kind: "added", subject };
|
|
50474
|
-
if (previous.status !== next.status) {
|
|
50475
|
-
switch (next.status) {
|
|
50476
|
-
case "in_progress":
|
|
50477
|
-
return { kind: "started", subject };
|
|
50478
|
-
case "completed":
|
|
50479
|
-
return { kind: "completed", subject };
|
|
50480
|
-
case "failed":
|
|
50481
|
-
return { kind: "failed", subject };
|
|
50482
|
-
case "pending":
|
|
50483
|
-
return { kind: "reopened", subject };
|
|
50484
|
-
}
|
|
50485
|
-
}
|
|
50486
|
-
if (previous.subject !== next.subject) return { kind: "renamed", subject };
|
|
50487
|
-
return null;
|
|
50488
|
-
}
|
|
50489
|
-
__name(taskOperationFor, "taskOperationFor");
|
|
50490
|
-
function removeTask(tasks, id, subject) {
|
|
50491
|
-
const known = tasks.find((task) => task.id === id);
|
|
50492
|
-
if (!known) return { tasks, operation: null };
|
|
50493
|
-
return {
|
|
50494
|
-
tasks: tasks.filter((task) => task.id !== id),
|
|
50495
|
-
operation: { kind: "removed", subject: subject || known.subject }
|
|
50496
|
-
};
|
|
50497
|
-
}
|
|
50498
|
-
__name(removeTask, "removeTask");
|
|
50499
|
-
function upsertTask(tasks, item) {
|
|
50500
|
-
const index = tasks.findIndex((task) => task.id === item.id);
|
|
50501
|
-
return index < 0 ? [...tasks, item] : tasks.map((task, i) => i === index ? item : task);
|
|
50502
|
-
}
|
|
50503
|
-
__name(upsertTask, "upsertTask");
|
|
50504
|
-
var SINGLE = {
|
|
50505
|
-
added: "Added task",
|
|
50506
|
-
started: "Started",
|
|
50507
|
-
completed: "Completed",
|
|
50508
|
-
failed: "Failed",
|
|
50509
|
-
reopened: "Reopened",
|
|
50510
|
-
renamed: "Renamed task",
|
|
50511
|
-
removed: "Removed task"
|
|
50512
|
-
};
|
|
50513
|
-
var MANY = {
|
|
50514
|
-
added: "Added",
|
|
50515
|
-
started: "Started",
|
|
50516
|
-
completed: "Completed",
|
|
50517
|
-
failed: "Failed",
|
|
50518
|
-
reopened: "Reopened",
|
|
50519
|
-
renamed: "Renamed",
|
|
50520
|
-
removed: "Removed"
|
|
50521
|
-
};
|
|
50522
|
-
function countTasks(count2) {
|
|
50523
|
-
return `${count2} task${count2 === 1 ? "" : "s"}`;
|
|
50524
|
-
}
|
|
50525
|
-
__name(countTasks, "countTasks");
|
|
50526
|
-
function taskBlockHeader(operations, checklist) {
|
|
50527
|
-
const [first] = operations;
|
|
50528
|
-
if (!first) return checklist.length === 0 ? "No tasks yet" : checklistProgress(checklist);
|
|
50529
|
-
if (operations.length === 1)
|
|
50530
|
-
return `${SINGLE[first.kind]} \xB7 ${first.subject.replace(/\s+/g, " ").trim()}`;
|
|
50531
|
-
if (operations.every((operation) => operation.kind === first.kind)) {
|
|
50532
|
-
return `${MANY[first.kind]} ${countTasks(operations.length)}`;
|
|
50533
|
-
}
|
|
50534
|
-
return checklistProgress(checklist);
|
|
50535
|
-
}
|
|
50536
|
-
__name(taskBlockHeader, "taskBlockHeader");
|
|
50537
|
-
function extendable(messages, input) {
|
|
50538
|
-
const last = messages.at(-1);
|
|
50539
|
-
if (!last?.taskBlock || last.taskBlock.key !== input.key || last.pending) return void 0;
|
|
50540
|
-
const finalizedIndex = messages.slice(0, -1).filter((message) => !message.pending).length;
|
|
50541
|
-
return finalizedIndex >= input.settled ? last : void 0;
|
|
50542
|
-
}
|
|
50543
|
-
__name(extendable, "extendable");
|
|
50544
|
-
function applyTaskOperation(messages, input) {
|
|
50545
|
-
const open = extendable(messages, input);
|
|
50546
|
-
const operations = [
|
|
50547
|
-
...open?.taskBlock?.operations ?? [],
|
|
50548
|
-
...input.operation ? [input.operation] : []
|
|
50549
|
-
];
|
|
50550
|
-
if (!open && operations.length === 0 && input.checklist.length === 0) return messages;
|
|
50551
|
-
const row = {
|
|
50552
|
-
id: open?.id ?? input.id,
|
|
50553
|
-
role: "tool",
|
|
50554
|
-
content: taskBlockHeader(operations, input.checklist),
|
|
50555
|
-
glyph: "\u2713",
|
|
50556
|
-
...input.glyphColor ? { glyphColor: input.glyphColor } : {},
|
|
50557
|
-
checklist: input.checklist,
|
|
50558
|
-
taskBlock: { key: input.key, operations }
|
|
50559
|
-
};
|
|
50560
|
-
return open ? [...messages.slice(0, -1), row] : [...messages, row];
|
|
51323
|
+
return FRESH_LEDGER;
|
|
51324
|
+
}
|
|
50561
51325
|
}
|
|
50562
|
-
__name(
|
|
50563
|
-
|
|
50564
|
-
|
|
50565
|
-
|
|
50566
|
-
|
|
50567
|
-
|
|
50568
|
-
|
|
50569
|
-
|
|
50570
|
-
|
|
50571
|
-
|
|
50572
|
-
|
|
50573
|
-
|
|
50574
|
-
|
|
50575
|
-
|
|
50576
|
-
|
|
50577
|
-
|
|
50578
|
-
|
|
51326
|
+
__name(readSuggestionLedger, "readSuggestionLedger");
|
|
51327
|
+
function writeSuggestionLedger(namzuHome, ledger) {
|
|
51328
|
+
const path = suggestionLedgerPath(namzuHome);
|
|
51329
|
+
try {
|
|
51330
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
51331
|
+
const temp = `${path}.${process.pid}.tmp`;
|
|
51332
|
+
writeFileSync(temp, `${JSON.stringify(ledger)}
|
|
51333
|
+
`, { mode: 384 });
|
|
51334
|
+
renameSync(temp, path);
|
|
51335
|
+
} catch {
|
|
51336
|
+
}
|
|
51337
|
+
}
|
|
51338
|
+
__name(writeSuggestionLedger, "writeSuggestionLedger");
|
|
51339
|
+
function admitSuggestion(ledger) {
|
|
51340
|
+
if (ledger.stopped) return { show: "nothing" };
|
|
51341
|
+
if (ledger.unanswered >= SUGGESTION_IGNORE_LIMIT) {
|
|
51342
|
+
return { show: "stopped-notice", next: { ...ledger, stopped: true } };
|
|
51343
|
+
}
|
|
51344
|
+
return { show: "proposal", next: { ...ledger, unanswered: ledger.unanswered + 1 } };
|
|
51345
|
+
}
|
|
51346
|
+
__name(admitSuggestion, "admitSuggestion");
|
|
51347
|
+
|
|
51348
|
+
// src/tui/spinner-tips-setting.ts
|
|
51349
|
+
function setSpinnerTips(on, opts = {}) {
|
|
51350
|
+
try {
|
|
51351
|
+
setUserConfigValue(["tui", "spinnerTips"], on, {
|
|
51352
|
+
...opts.home ? { home: opts.home } : {},
|
|
51353
|
+
...opts.env ? { env: opts.env } : {}
|
|
50579
51354
|
});
|
|
51355
|
+
} catch (error) {
|
|
51356
|
+
return `${explainFailure(error, "Could not save that setting.")} This conversation ${on ? "shows" : "hides"} tips until it ends.`;
|
|
50580
51357
|
}
|
|
50581
|
-
|
|
51358
|
+
const saved = on ? "Tips are on: one short tip shows under the working row." : "Tips are off. /config tips on turns them back on. The next task still shows under the working row.";
|
|
51359
|
+
let resolved;
|
|
51360
|
+
try {
|
|
51361
|
+
resolved = loadConfigWithProvenance(opts);
|
|
51362
|
+
} catch (error) {
|
|
51363
|
+
return `${saved} ${explainFailure(error, "Could not check the other config files.")} This conversation follows your choice.`;
|
|
51364
|
+
}
|
|
51365
|
+
const effective = resolved.config.tui?.spinnerTips !== false;
|
|
51366
|
+
if (effective === on) return saved;
|
|
51367
|
+
const source = resolved.provenance.tui;
|
|
51368
|
+
const winner = source ? formatConfigSource(source) : "another config layer";
|
|
51369
|
+
return `${saved} But ${winner} turns them ${effective ? "on" : "off"}, so from the next start they will be ${effective ? "on" : "off"}; this conversation follows your choice.`;
|
|
50582
51370
|
}
|
|
50583
|
-
__name(
|
|
51371
|
+
__name(setSpinnerTips, "setSpinnerTips");
|
|
51372
|
+
|
|
51373
|
+
// src/tui/stale-history-retry.ts
|
|
51374
|
+
async function* sendWithRebuiltHistory(send, input) {
|
|
51375
|
+
let prior = [...input.history, ...input.tail];
|
|
51376
|
+
for (let attempt = 0; ; attempt += 1) {
|
|
51377
|
+
let refused;
|
|
51378
|
+
for await (const event of send(prior)) {
|
|
51379
|
+
if (attempt === 0 && event.kind === "error" && event.failure?.code === "stale_cached_history") {
|
|
51380
|
+
refused = event;
|
|
51381
|
+
break;
|
|
51382
|
+
}
|
|
51383
|
+
yield event;
|
|
51384
|
+
}
|
|
51385
|
+
if (!refused) return;
|
|
51386
|
+
const fresh = await input.rebuild().catch(() => void 0);
|
|
51387
|
+
if (!fresh) {
|
|
51388
|
+
yield refused;
|
|
51389
|
+
return;
|
|
51390
|
+
}
|
|
51391
|
+
prior = [...fresh, ...input.tail];
|
|
51392
|
+
}
|
|
51393
|
+
}
|
|
51394
|
+
__name(sendWithRebuiltHistory, "sendWithRebuiltHistory");
|
|
50584
51395
|
|
|
50585
51396
|
// src/tui/triggers/registry.ts
|
|
50586
51397
|
var both = /* @__PURE__ */ __name((pattern) => ({ pattern, edges: "both" }), "both");
|
|
@@ -50754,7 +51565,7 @@ __name(triggerDefinition, "triggerDefinition");
|
|
|
50754
51565
|
// src/tui/triggers/context-text.ts
|
|
50755
51566
|
var TEXTS = {
|
|
50756
51567
|
hypermode: HYPERMODE_KEYWORD_TEXT,
|
|
50757
|
-
workflow: "The operator asked for a workflow for
|
|
51568
|
+
workflow: "The operator asked for a workflow for this turn only: their message named it, and it is not on for the session. This opts the turn into the `workflow` tool. When the work is large enough to split into phases of agents, write one workflow script for it; the operator reads the script and approves it before anything starts. For a small piece of work, answer or use the Agent tool as usual.",
|
|
50758
51569
|
"save-skill": "The operator asked namzu to save this work as a skill after this turn. namzu runs /skills save itself once the turn ends, and that ends on the operator's own confirmation screen. Finish the task; do not call save_skill in this turn.",
|
|
50759
51570
|
schedule: "The operator asked for this to run on a schedule. When the task is clear, propose a job with the `schedule` tool; the operator confirms it on screen. Do not create a `session_loop`; if a repeat inside this open session fits better, tell the operator to use /loop."
|
|
50760
51571
|
};
|
|
@@ -51372,665 +52183,224 @@ async function runBrowserSlash(control, args, options) {
|
|
|
51372
52183
|
if (verb === void 0 || verb === "status" && name === void 0) {
|
|
51373
52184
|
return { text: describeBrowserStatus(control.status()) };
|
|
51374
52185
|
}
|
|
51375
|
-
if (verb === "profile" && rest.length === 0) {
|
|
51376
|
-
if (name === void 0) {
|
|
51377
|
-
return {
|
|
51378
|
-
text: `Profile: ${control.status().profile}. Switch with /browser profile <name>; list profiles with \`namzu browser list\`.`
|
|
51379
|
-
};
|
|
51380
|
-
}
|
|
51381
|
-
if (options.busy) {
|
|
51382
|
-
return {
|
|
51383
|
-
text: "The profile cannot change while a reply is running. Try again when it ends."
|
|
51384
|
-
};
|
|
51385
|
-
}
|
|
51386
|
-
try {
|
|
51387
|
-
const status = await control.switchProfile(name);
|
|
51388
|
-
return {
|
|
51389
|
-
text: `The browser uses profile ${status.profile} from the next browser call on, in this conversation. Sign in to a site once with \`namzu browser login ${status.profile} <url>\`.`,
|
|
51390
|
-
profile: status.profile
|
|
51391
|
-
};
|
|
51392
|
-
} catch (error) {
|
|
51393
|
-
return {
|
|
51394
|
-
text: error instanceof Error && error.message ? error.message : explainFailure(error, "Could not switch the browser profile.")
|
|
51395
|
-
};
|
|
51396
|
-
}
|
|
51397
|
-
}
|
|
51398
|
-
return { text: `Usage:
|
|
51399
|
-
${BROWSER_SLASH_USAGE}` };
|
|
51400
|
-
}
|
|
51401
|
-
__name(runBrowserSlash, "runBrowserSlash");
|
|
51402
|
-
|
|
51403
|
-
// src/tui/exit-hint.ts
|
|
51404
|
-
var EXIT_HINT_MS = 800;
|
|
51405
|
-
|
|
51406
|
-
// src/tui/group-rows.ts
|
|
51407
|
-
function joinSections(body, section) {
|
|
51408
|
-
if (section.length === 0) return body ?? [];
|
|
51409
|
-
return body && body.length > 0 ? [...body, "", ...section] : section;
|
|
51410
|
-
}
|
|
51411
|
-
__name(joinSections, "joinSections");
|
|
51412
|
-
function mergeGroupRows(rows) {
|
|
51413
|
-
const out = [];
|
|
51414
|
-
for (const row of rows) {
|
|
51415
|
-
const last = out.at(-1);
|
|
51416
|
-
if (row.group && !row.pending && last?.group && !last.pending) {
|
|
51417
|
-
const group = mergeGroups(last.group, row.group);
|
|
51418
|
-
out[out.length - 1] = {
|
|
51419
|
-
...last,
|
|
51420
|
-
group,
|
|
51421
|
-
content: groupText(group, false),
|
|
51422
|
-
detail: joinSections(last.detail, row.detail ?? [])
|
|
51423
|
-
};
|
|
51424
|
-
continue;
|
|
51425
|
-
}
|
|
51426
|
-
out.push(row);
|
|
51427
|
-
}
|
|
51428
|
-
return out;
|
|
51429
|
-
}
|
|
51430
|
-
__name(mergeGroupRows, "mergeGroupRows");
|
|
51431
|
-
|
|
51432
|
-
// src/tui/pause-clock.ts
|
|
51433
|
-
var PauseClock = class {
|
|
51434
|
-
static {
|
|
51435
|
-
__name(this, "PauseClock");
|
|
51436
|
-
}
|
|
51437
|
-
#total = 0;
|
|
51438
|
-
#since = null;
|
|
51439
|
-
/** The person is now being waited on. A second call while waiting changes nothing. */
|
|
51440
|
-
begin(now) {
|
|
51441
|
-
if (this.#since === null) this.#since = now;
|
|
51442
|
-
}
|
|
51443
|
-
/** The wait is over. */
|
|
51444
|
-
end(now) {
|
|
51445
|
-
if (this.#since === null) return;
|
|
51446
|
-
this.#total += Math.max(0, now - this.#since);
|
|
51447
|
-
this.#since = null;
|
|
51448
|
-
}
|
|
51449
|
-
/** Milliseconds waited so far, counting a wait that is still open. */
|
|
51450
|
-
total(now) {
|
|
51451
|
-
return this.#total + (this.#since === null ? 0 : Math.max(0, now - this.#since));
|
|
51452
|
-
}
|
|
51453
|
-
};
|
|
51454
|
-
|
|
51455
|
-
// src/tui/placeholder-examples.ts
|
|
51456
|
-
import { execFile as execFile3 } from "node:child_process";
|
|
51457
|
-
var PLAIN_EXAMPLES = [
|
|
51458
|
-
"fix lint errors",
|
|
51459
|
-
"fix typecheck errors",
|
|
51460
|
-
"how do I log an error?",
|
|
51461
|
-
"create a util logging.py that..."
|
|
51462
|
-
];
|
|
51463
|
-
var FILE_EXAMPLES = [
|
|
51464
|
-
(file) => `how does ${file} work?`,
|
|
51465
|
-
(file) => `refactor ${file}`,
|
|
51466
|
-
(file) => `edit ${file} to...`,
|
|
51467
|
-
(file) => `write a test for ${file}`
|
|
51468
|
-
];
|
|
51469
|
-
function examplePlaceholder(file, seed) {
|
|
51470
|
-
const pool = [
|
|
51471
|
-
...PLAIN_EXAMPLES,
|
|
51472
|
-
...file ? FILE_EXAMPLES.map((make) => make(file)) : []
|
|
51473
|
-
];
|
|
51474
|
-
const at = Math.min(pool.length - 1, Math.floor(Math.max(0, seed) * pool.length));
|
|
51475
|
-
return `Try "${pool[at]}"`;
|
|
51476
|
-
}
|
|
51477
|
-
__name(examplePlaceholder, "examplePlaceholder");
|
|
51478
|
-
function isExampleFile(path) {
|
|
51479
|
-
if (/(^|\/)(node_modules|dist|build|\.changeset|docs)\//.test(path)) return false;
|
|
51480
|
-
if (/(^|\/)(package-lock\.json|pnpm-lock\.yaml|yarn\.lock|CHANGELOG\.md|log\.md)$/.test(path))
|
|
51481
|
-
return false;
|
|
51482
|
-
return /\.(ts|tsx|js|jsx|mjs|cjs|py|rs|go|java|rb|c|cc|cpp|h|cs|swift|kt)$/.test(path);
|
|
51483
|
-
}
|
|
51484
|
-
__name(isExampleFile, "isExampleFile");
|
|
51485
|
-
function frequentlyModifiedFile(cwd2, signal) {
|
|
51486
|
-
return new Promise((resolve9) => {
|
|
51487
|
-
execFile3(
|
|
51488
|
-
"git",
|
|
51489
|
-
["log", "--name-only", "--pretty=format:", "-n", "200"],
|
|
51490
|
-
{ cwd: cwd2, signal, maxBuffer: 4 * 1024 * 1024, timeout: 5e3 },
|
|
51491
|
-
(error, stdout) => {
|
|
51492
|
-
if (error) return resolve9(void 0);
|
|
51493
|
-
const counts2 = /* @__PURE__ */ new Map();
|
|
51494
|
-
for (const line of stdout.split("\n")) {
|
|
51495
|
-
const path = line.trim();
|
|
51496
|
-
if (path && isExampleFile(path)) counts2.set(path, (counts2.get(path) ?? 0) + 1);
|
|
51497
|
-
}
|
|
51498
|
-
let best;
|
|
51499
|
-
let bestCount = 0;
|
|
51500
|
-
for (const [path, count2] of counts2) {
|
|
51501
|
-
if (count2 > bestCount) {
|
|
51502
|
-
best = path;
|
|
51503
|
-
bestCount = count2;
|
|
51504
|
-
}
|
|
51505
|
-
}
|
|
51506
|
-
resolve9(best);
|
|
51507
|
-
}
|
|
51508
|
-
);
|
|
51509
|
-
});
|
|
51510
|
-
}
|
|
51511
|
-
__name(frequentlyModifiedFile, "frequentlyModifiedFile");
|
|
51512
|
-
|
|
51513
|
-
// src/tui/recap-setting.ts
|
|
51514
|
-
var OFF_WORDS = /* @__PURE__ */ new Set(["0", "false", "no", "off"]);
|
|
51515
|
-
var ON_WORDS = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
|
|
51516
|
-
function recapEnabled(input) {
|
|
51517
|
-
const word = input.env.NAMZU_RECAP?.trim().toLowerCase();
|
|
51518
|
-
if (word !== void 0 && OFF_WORDS.has(word)) return false;
|
|
51519
|
-
if (word !== void 0 && ON_WORDS.has(word)) return true;
|
|
51520
|
-
if (!input.interactive) return false;
|
|
51521
|
-
return input.tui?.recap !== false;
|
|
51522
|
-
}
|
|
51523
|
-
__name(recapEnabled, "recapEnabled");
|
|
51524
|
-
function recapWaitMs(env3) {
|
|
51525
|
-
const raw = env3.NAMZU_RECAP_WAIT_MS?.trim();
|
|
51526
|
-
if (raw === void 0 || !/^\d{1,9}$/u.test(raw)) return RECAP_WAIT_MS;
|
|
51527
|
-
return Number(raw);
|
|
51528
|
-
}
|
|
51529
|
-
__name(recapWaitMs, "recapWaitMs");
|
|
51530
|
-
function setRecapSetting(on, opts = {}) {
|
|
51531
|
-
const env3 = opts.env ?? process.env;
|
|
51532
|
-
try {
|
|
51533
|
-
const target = { ...opts.home ? { home: opts.home } : {}, env: env3 };
|
|
51534
|
-
if (on) deleteUserConfigValue(["tui", "recap"], target);
|
|
51535
|
-
else setUserConfigValue(["tui", "recap"], false, target);
|
|
51536
|
-
} catch (error) {
|
|
51537
|
-
return `${explainFailure(error, "Could not save that setting.")} This conversation ${on ? "shows" : "skips"} recaps until it ends.`;
|
|
51538
|
-
}
|
|
51539
|
-
const saved = on ? "Recaps are on: after a few minutes away, a one-line recap of where things stand is shown when you come back." : "Recaps are off. /config recap on turns them back on; /recap still writes one on request.";
|
|
51540
|
-
const word = env3.NAMZU_RECAP?.trim().toLowerCase();
|
|
51541
|
-
if (word !== void 0 && (OFF_WORDS.has(word) || ON_WORDS.has(word))) {
|
|
51542
|
-
const forced = ON_WORDS.has(word);
|
|
51543
|
-
if (forced !== on) {
|
|
51544
|
-
return `${saved} But NAMZU_RECAP is set in the environment and turns them ${forced ? "on" : "off"} on the next start; this conversation follows your choice.`;
|
|
51545
|
-
}
|
|
51546
|
-
}
|
|
51547
|
-
return saved;
|
|
51548
|
-
}
|
|
51549
|
-
__name(setRecapSetting, "setRecapSetting");
|
|
51550
|
-
function describeRecapSetting(input) {
|
|
51551
|
-
const fromFiles = input.tui?.recap !== false;
|
|
51552
|
-
const word = input.env.NAMZU_RECAP?.trim().toLowerCase();
|
|
51553
|
-
const lines = [`Recaps: ${input.enabledNow ? "on" : "off"} in this conversation.`];
|
|
51554
|
-
lines.push(`Config files: ${fromFiles ? "on (the default)" : "off"}.`);
|
|
51555
|
-
if (word !== void 0 && (OFF_WORDS.has(word) || ON_WORDS.has(word))) {
|
|
51556
|
-
lines.push(`NAMZU_RECAP is set and turns them ${ON_WORDS.has(word) ? "on" : "off"}.`);
|
|
51557
|
-
}
|
|
51558
|
-
lines.push("/config recap on|off changes it; /recap writes one now.");
|
|
51559
|
-
return lines.join("\n");
|
|
51560
|
-
}
|
|
51561
|
-
__name(describeRecapSetting, "describeRecapSetting");
|
|
51562
|
-
|
|
51563
|
-
// src/tui/recap-turns.ts
|
|
51564
|
-
function kindOf(message) {
|
|
51565
|
-
if (message.kind === "recap") return "recap";
|
|
51566
|
-
if (message.pending) return void 0;
|
|
51567
|
-
if (message.role === "user" && !message.sourceDelivery && message.content.trim().length > 0) {
|
|
51568
|
-
return "prompt";
|
|
51569
|
-
}
|
|
51570
|
-
if (message.role === "assistant" && message.content.trim().length > 0) return "reply";
|
|
51571
|
-
return void 0;
|
|
51572
|
-
}
|
|
51573
|
-
__name(kindOf, "kindOf");
|
|
51574
|
-
function recapRows(messages) {
|
|
51575
|
-
const rows = [];
|
|
51576
|
-
for (const message of messages) {
|
|
51577
|
-
const kind = kindOf(message);
|
|
51578
|
-
if (kind !== void 0) rows.push(kind);
|
|
51579
|
-
}
|
|
51580
|
-
return rows;
|
|
51581
|
-
}
|
|
51582
|
-
__name(recapRows, "recapRows");
|
|
51583
|
-
function recapTurns(messages) {
|
|
51584
|
-
const turns = [];
|
|
51585
|
-
for (const message of messages) {
|
|
51586
|
-
const kind = kindOf(message);
|
|
51587
|
-
if (kind === "prompt") turns.push({ role: "user", text: message.content });
|
|
51588
|
-
else if (kind === "reply") turns.push({ role: "assistant", text: message.content });
|
|
51589
|
-
}
|
|
51590
|
-
return turns;
|
|
51591
|
-
}
|
|
51592
|
-
__name(recapTurns, "recapTurns");
|
|
51593
|
-
|
|
51594
|
-
// src/tui/conversation-evidence-view.ts
|
|
51595
|
-
function conversationEvidenceView(toolName, output) {
|
|
51596
|
-
if (toolName !== "search_conversation" && toolName !== "read_conversation") return void 0;
|
|
51597
|
-
let value;
|
|
51598
|
-
try {
|
|
51599
|
-
value = JSON.parse(output);
|
|
51600
|
-
} catch {
|
|
51601
|
-
return void 0;
|
|
51602
|
-
}
|
|
51603
|
-
if (!record(value)) return void 0;
|
|
51604
|
-
const rows = toolName === "search_conversation" ? searchRows(value) : readRows(value);
|
|
51605
|
-
if (!rows) return void 0;
|
|
51606
|
-
return { content: rows.join("\n"), detail: JSON.stringify(value, null, 2).split("\n") };
|
|
51607
|
-
}
|
|
51608
|
-
__name(conversationEvidenceView, "conversationEvidenceView");
|
|
51609
|
-
function record(value) {
|
|
51610
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
51611
|
-
}
|
|
51612
|
-
__name(record, "record");
|
|
51613
|
-
function count(value) {
|
|
51614
|
-
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
51615
|
-
}
|
|
51616
|
-
__name(count, "count");
|
|
51617
|
-
function preview2(text, limit = 96) {
|
|
51618
|
-
const units = Array.from(text.replace(/\s+/gu, " ").trim());
|
|
51619
|
-
return units.length > limit ? `${units.slice(0, limit - 1).join("")}\u2026` : units.join("");
|
|
51620
|
-
}
|
|
51621
|
-
__name(preview2, "preview");
|
|
51622
|
-
function sourceLabel2(value) {
|
|
51623
|
-
switch (value.recordKind) {
|
|
51624
|
-
case "assistant_message":
|
|
51625
|
-
return "Assistant message";
|
|
51626
|
-
case "user_message":
|
|
51627
|
-
return "User message";
|
|
51628
|
-
case "system_message":
|
|
51629
|
-
return "System message";
|
|
51630
|
-
case "derived_summary":
|
|
51631
|
-
return "Derived summary";
|
|
51632
|
-
case "tool_result":
|
|
51633
|
-
return `Tool result${typeof value.toolName === "string" ? ` (${preview2(value.toolName, 48)})` : ""}`;
|
|
51634
|
-
default:
|
|
51635
|
-
return "Source unknown";
|
|
51636
|
-
}
|
|
51637
|
-
}
|
|
51638
|
-
__name(sourceLabel2, "sourceLabel");
|
|
51639
|
-
function searchRows(value) {
|
|
51640
|
-
if (!Array.isArray(value.matches) || !value.matches.every((match) => record(match) && typeof match.text === "string") || typeof value.incomplete !== "boolean" || !count(value.unavailable))
|
|
51641
|
-
return void 0;
|
|
51642
|
-
const rows = [
|
|
51643
|
-
`Conversation search \xB7 ${plural(value.matches.length, "match", "matches")} on this page`
|
|
51644
|
-
];
|
|
51645
|
-
rows.push(
|
|
51646
|
-
value.incomplete || value.nextCursor ? `Search not finished${value.nextCursor ? " \xB7 more to scan" : ""} \xB7 a missing result may not have been reached yet` : "Search finished"
|
|
51647
|
-
);
|
|
51648
|
-
if (value.unavailable > 0) rows.push(`${plural(value.unavailable, "record")} unavailable`);
|
|
51649
|
-
for (const match of value.matches.slice(0, 3)) {
|
|
51650
|
-
rows.push(
|
|
51651
|
-
`${sourceLabel2(match)}${match.retained === "preview" ? " \xB7 preview flagged" : ""}${match.isError === true ? " \xB7 original reported error" : ""}: ${preview2(match.text)}`
|
|
51652
|
-
);
|
|
51653
|
-
}
|
|
51654
|
-
if (value.matches.length > 3)
|
|
51655
|
-
rows.push(`+${plural(value.matches.length - 3, "more match", "more matches")} in details`);
|
|
51656
|
-
return rows;
|
|
51657
|
-
}
|
|
51658
|
-
__name(searchRows, "searchRows");
|
|
51659
|
-
function readRows(value) {
|
|
51660
|
-
if (typeof value.text !== "string" || typeof value.complete !== "boolean" || typeof value.retainedPreview !== "boolean" || !count(value.offset))
|
|
51661
|
-
return void 0;
|
|
51662
|
-
const rows = [`Conversation read \xB7 ${sourceLabel2(value)}`];
|
|
51663
|
-
if (value.retainedPreview) rows.push("Preview flagged \xB7 original may be incomplete");
|
|
51664
|
-
if (!value.complete) {
|
|
51665
|
-
rows.push(
|
|
51666
|
-
value.nextCursor ? value.text.length === 0 ? "Locating retained text \xB7 continue scan" : "Partial page \xB7 more retained text available" : "Read incomplete \xB7 no continuation supplied"
|
|
51667
|
-
);
|
|
51668
|
-
} else {
|
|
51669
|
-
rows.push(
|
|
51670
|
-
value.offset > 0 ? "Last page \xB7 earlier text is not on this page" : "Selected retained part returned"
|
|
51671
|
-
);
|
|
51672
|
-
}
|
|
51673
|
-
if (value.recordKind === "tool_result") {
|
|
51674
|
-
rows.push(
|
|
51675
|
-
value.isError === true ? "Original tool reported an error" : value.isError === false ? "Original tool reported no error" : "Original tool status unknown"
|
|
51676
|
-
);
|
|
51677
|
-
}
|
|
51678
|
-
if (value.text.length > 0) rows.push(`Excerpt: ${preview2(value.text, 160)}`);
|
|
51679
|
-
return rows;
|
|
51680
|
-
}
|
|
51681
|
-
__name(readRows, "readRows");
|
|
51682
|
-
|
|
51683
|
-
// src/tui/model-catalogue-view.ts
|
|
51684
|
-
function modelCatalogueView(output) {
|
|
51685
|
-
let value;
|
|
51686
|
-
try {
|
|
51687
|
-
value = JSON.parse(output);
|
|
51688
|
-
} catch {
|
|
51689
|
-
return void 0;
|
|
51690
|
-
}
|
|
51691
|
-
if (!record2(value) || !Array.isArray(value.models) || !Number.isSafeInteger(value.omitted) || value.omitted < 0)
|
|
51692
|
-
return void 0;
|
|
51693
|
-
const models = value.models;
|
|
51694
|
-
if (!models.every(
|
|
51695
|
-
(model) => record2(model) && typeof model.provider === "string" && (typeof model.id === "string" && typeof model.name === "string" || model.status === "catalogue unavailable")
|
|
51696
|
-
))
|
|
51697
|
-
return void 0;
|
|
51698
|
-
const rows = ["Available models"];
|
|
51699
|
-
if (models.length === 0) rows.push("No matching models.");
|
|
51700
|
-
for (const model of models.slice(0, 5)) {
|
|
51701
|
-
if (model.status === "catalogue unavailable") {
|
|
51702
|
-
rows.push(`${model.provider} \xB7 catalogue unavailable`);
|
|
51703
|
-
continue;
|
|
51704
|
-
}
|
|
51705
|
-
rows.push(`${model.name} \xB7 ${model.provider}`);
|
|
51706
|
-
rows.push(` ${model.id}`);
|
|
51707
|
-
const facts = [];
|
|
51708
|
-
if (typeof model.contextWindow === "number" && Number.isSafeInteger(model.contextWindow) && model.contextWindow > 0)
|
|
51709
|
-
facts.push(
|
|
51710
|
-
`Context ${new Intl.NumberFormat("en", { notation: "compact", maximumFractionDigits: 1 }).format(model.contextWindow)}`
|
|
51711
|
-
);
|
|
51712
|
-
const effort = model.reasoningEffortLevels ?? model.effortLevels;
|
|
51713
|
-
if (Array.isArray(effort) && effort.every((item) => typeof item === "string"))
|
|
51714
|
-
facts.push(effort.length ? `Effort ${effort.join(" \xB7 ")}` : "Effort not supported");
|
|
51715
|
-
facts.push(priceFact(model));
|
|
51716
|
-
if (facts.length) rows.push(` ${facts.join(" | ")}`);
|
|
51717
|
-
}
|
|
51718
|
-
const omitted = value.omitted + Math.max(0, models.length - 5);
|
|
51719
|
-
if (omitted) rows.push(`+${omitted} more \xB7 narrow the search`);
|
|
51720
|
-
return rows.join("\n");
|
|
51721
|
-
}
|
|
51722
|
-
__name(modelCatalogueView, "modelCatalogueView");
|
|
51723
|
-
function record2(value) {
|
|
51724
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
51725
|
-
}
|
|
51726
|
-
__name(record2, "record");
|
|
51727
|
-
function priceFact(model) {
|
|
51728
|
-
const input = model.inputPrice;
|
|
51729
|
-
const output = model.outputPrice;
|
|
51730
|
-
if (typeof input !== "number" || typeof output !== "number") return "Price unknown";
|
|
51731
|
-
if (input === 0 && output === 0) return "Free";
|
|
51732
|
-
return `$${input}/$${output} per Mtok`;
|
|
51733
|
-
}
|
|
51734
|
-
__name(priceFact, "priceFact");
|
|
51735
|
-
|
|
51736
|
-
// src/tui/tool-failure-text.ts
|
|
51737
|
-
var WHOLE_TOOL_ERROR = /^\s*<tool_use_error>([\s\S]*)<\/tool_use_error>\s*$/i;
|
|
51738
|
-
var NESTED_TOOL_ERROR = /<\/?tool_use_error\b/i;
|
|
51739
|
-
var BAD_ARGUMENTS = /^(?:InputValidationError: |Validation failed for "|Tool "[^"]+" was called with no arguments\.)/;
|
|
51740
|
-
function toolFailureText(output, expanded) {
|
|
51741
|
-
if (output === void 0) return "Tool execution failed";
|
|
51742
|
-
const inner = WHOLE_TOOL_ERROR.exec(output)?.[1];
|
|
51743
|
-
const unwrapped = inner !== void 0 && !NESTED_TOOL_ERROR.test(inner) ? inner : output;
|
|
51744
|
-
const text = unwrapped.replace(/<sandbox_violations>[\s\S]*?<\/sandbox_violations>/g, "").replace(/<\/?error>/g, "").trim();
|
|
51745
|
-
if (!expanded && BAD_ARGUMENTS.test(text)) return "Invalid tool parameters";
|
|
51746
|
-
return text.startsWith("Error: ") || text.startsWith("Cancelled: ") ? text : `Error: ${text}`;
|
|
51747
|
-
}
|
|
51748
|
-
__name(toolFailureText, "toolFailureText");
|
|
51749
|
-
function firstLineOf(text) {
|
|
51750
|
-
return text.split("\n", 1)[0] ?? "";
|
|
51751
|
-
}
|
|
51752
|
-
__name(firstLineOf, "firstLineOf");
|
|
51753
|
-
|
|
51754
|
-
// src/tui/tool-end-rows.ts
|
|
51755
|
-
var DISPLAY_NAMES = { edit: "Update" };
|
|
51756
|
-
function formatToolCall(toolName, summary2, standalone = false) {
|
|
51757
|
-
if (standalone) return summary2;
|
|
51758
|
-
const words = toolName.replace(/[_-]+/g, " ");
|
|
51759
|
-
const display = DISPLAY_NAMES[toolName.toLowerCase()] ?? (words.length > 0 ? words[0]?.toUpperCase() + words.slice(1) : words);
|
|
51760
|
-
return summary2.length > 0 ? `${display}(${summary2})` : display;
|
|
51761
|
-
}
|
|
51762
|
-
__name(formatToolCall, "formatToolCall");
|
|
51763
|
-
function failureBody(lines, folded) {
|
|
51764
|
-
return { stdout: [], stderr: lines, failed: true, byLine: true, ...folded ? { folded } : {} };
|
|
51765
|
-
}
|
|
51766
|
-
__name(failureBody, "failureBody");
|
|
51767
|
-
function foldOf(start) {
|
|
51768
|
-
if (start?.fold) return start.fold;
|
|
51769
|
-
return start?.activity === "exploration" ? { kind: "read", key: start.label } : void 0;
|
|
51770
|
-
}
|
|
51771
|
-
__name(foldOf, "foldOf");
|
|
51772
|
-
function failedCallRows(event, start) {
|
|
51773
|
-
const head = {
|
|
51774
|
-
role: "tool",
|
|
51775
|
-
content: headOf(event, start),
|
|
51776
|
-
glyph: "\u25CF",
|
|
51777
|
-
glyphColor: tokenColor("status.error")
|
|
51778
|
-
};
|
|
51779
|
-
const said = event.output ?? (event.summary.length > 0 ? event.summary : void 0);
|
|
51780
|
-
const full = toolFailureText(said, true).split("\n");
|
|
51781
|
-
if (event.plainFailure !== void 0) {
|
|
51782
|
-
return [
|
|
51783
|
-
head,
|
|
51784
|
-
{
|
|
51785
|
-
role: "tool",
|
|
51786
|
-
content: event.plainFailure,
|
|
51787
|
-
glyph: "\u23BF",
|
|
51788
|
-
contentColor: event.plainFailureTone === "muted" ? tokenColor("text.muted") : tokenColor("status.error"),
|
|
51789
|
-
...said !== void 0 && said.trim().length > 0 ? { detail: full, meta: EXPAND_HINT, activity: "agent-result" } : {}
|
|
51790
|
-
}
|
|
51791
|
-
];
|
|
51792
|
-
}
|
|
51793
|
-
const text = toolFailureText(said, false);
|
|
51794
|
-
const lines = text.split("\n");
|
|
51795
|
-
return [
|
|
51796
|
-
{
|
|
51797
|
-
...head,
|
|
51798
|
-
detail: full,
|
|
51799
|
-
shell: failureBody(full, text !== full.join("\n") ? lines : void 0)
|
|
52186
|
+
if (verb === "profile" && rest.length === 0) {
|
|
52187
|
+
if (name === void 0) {
|
|
52188
|
+
return {
|
|
52189
|
+
text: `Profile: ${control.status().profile}. Switch with /browser profile <name>; list profiles with \`namzu browser list\`.`
|
|
52190
|
+
};
|
|
51800
52191
|
}
|
|
51801
|
-
|
|
52192
|
+
if (options.busy) {
|
|
52193
|
+
return {
|
|
52194
|
+
text: "The profile cannot change while a reply is running. Try again when it ends."
|
|
52195
|
+
};
|
|
52196
|
+
}
|
|
52197
|
+
try {
|
|
52198
|
+
const status = await control.switchProfile(name);
|
|
52199
|
+
return {
|
|
52200
|
+
text: `The browser uses profile ${status.profile} from the next browser call on, in this conversation. Sign in to a site once with \`namzu browser login ${status.profile} <url>\`.`,
|
|
52201
|
+
profile: status.profile
|
|
52202
|
+
};
|
|
52203
|
+
} catch (error) {
|
|
52204
|
+
return {
|
|
52205
|
+
text: error instanceof Error && error.message ? error.message : explainFailure(error, "Could not switch the browser profile.")
|
|
52206
|
+
};
|
|
52207
|
+
}
|
|
52208
|
+
}
|
|
52209
|
+
return { text: `Usage:
|
|
52210
|
+
${BROWSER_SLASH_USAGE}` };
|
|
51802
52211
|
}
|
|
51803
|
-
__name(
|
|
51804
|
-
|
|
51805
|
-
|
|
52212
|
+
__name(runBrowserSlash, "runBrowserSlash");
|
|
52213
|
+
|
|
52214
|
+
// src/tui/exit-hint.ts
|
|
52215
|
+
var EXIT_HINT_MS = 800;
|
|
52216
|
+
|
|
52217
|
+
// src/tui/group-rows.ts
|
|
52218
|
+
function joinSections(body, section) {
|
|
52219
|
+
if (section.length === 0) return body ?? [];
|
|
52220
|
+
return body && body.length > 0 ? [...body, "", ...section] : section;
|
|
51806
52221
|
}
|
|
51807
|
-
__name(
|
|
51808
|
-
function
|
|
51809
|
-
const
|
|
51810
|
-
const
|
|
51811
|
-
|
|
51812
|
-
|
|
51813
|
-
|
|
51814
|
-
|
|
51815
|
-
|
|
51816
|
-
|
|
51817
|
-
|
|
51818
|
-
|
|
51819
|
-
|
|
51820
|
-
|
|
51821
|
-
|
|
51822
|
-
|
|
51823
|
-
glyphColor: tokenColor("text.muted"),
|
|
51824
|
-
meta: EXPAND_HINT,
|
|
51825
|
-
activity: "exploration",
|
|
51826
|
-
group: state
|
|
51827
|
-
}
|
|
51828
|
-
]);
|
|
51829
|
-
}
|
|
51830
|
-
if (event.isError && !event.declined && !event.cancelled && fold2) {
|
|
51831
|
-
const said = event.output ?? (event.summary.length > 0 ? event.summary : void 0);
|
|
51832
|
-
const state = foldOp(EMPTY_GROUP, { ...fold2, hint: void 0 }, 0);
|
|
51833
|
-
return rows([
|
|
51834
|
-
{
|
|
51835
|
-
role: "tool",
|
|
51836
|
-
content: groupText(state, false),
|
|
51837
|
-
detail: [start?.label ?? headOf(event, start), ...toolFailureText(said, true).split("\n")],
|
|
51838
|
-
glyph: " ",
|
|
51839
|
-
glyphColor: tokenColor("text.muted"),
|
|
51840
|
-
meta: EXPAND_HINT,
|
|
51841
|
-
activity: "exploration",
|
|
51842
|
-
group: state
|
|
51843
|
-
}
|
|
51844
|
-
]);
|
|
51845
|
-
}
|
|
51846
|
-
const web = event.web ?? start?.web;
|
|
51847
|
-
if (web && !event.isError) {
|
|
51848
|
-
const activity = {
|
|
51849
|
-
...web,
|
|
51850
|
-
...event.web?.target ?? start?.web?.target ? { target: event.web?.target ?? start?.web?.target } : {}
|
|
51851
|
-
};
|
|
51852
|
-
const durationMs = event.durationMs ?? ctx.elapsedMs;
|
|
51853
|
-
const output = web.hosted ? void 0 : event.output;
|
|
51854
|
-
const outputLines = output !== void 0 ? output.split("\n") : void 0;
|
|
51855
|
-
return rows([
|
|
51856
|
-
{
|
|
51857
|
-
role: "tool",
|
|
51858
|
-
content: webCallTitle(activity),
|
|
51859
|
-
glyph: "\u25CF",
|
|
51860
|
-
glyphColor: tokenColor("status.ok"),
|
|
51861
|
-
activity: "web"
|
|
51862
|
-
},
|
|
51863
|
-
{
|
|
51864
|
-
role: "tool",
|
|
51865
|
-
content: webSettledLine(activity, {
|
|
51866
|
-
...durationMs !== void 0 ? { durationMs } : {},
|
|
51867
|
-
...activity.kind === "fetch" && output !== void 0 ? { bytes: Buffer.byteLength(output, "utf8") } : {}
|
|
51868
|
-
}),
|
|
51869
|
-
glyph: "\u23BF",
|
|
51870
|
-
...outputLines ? { detail: outputLines } : {},
|
|
51871
|
-
...outputLines && outputLines.length > 0 ? { meta: EXPAND_HINT } : {},
|
|
51872
|
-
activity: "web"
|
|
51873
|
-
}
|
|
51874
|
-
]);
|
|
52222
|
+
__name(joinSections, "joinSections");
|
|
52223
|
+
function mergeGroupRows(rows) {
|
|
52224
|
+
const out = [];
|
|
52225
|
+
for (const row of rows) {
|
|
52226
|
+
const last = out.at(-1);
|
|
52227
|
+
if (row.group && !row.pending && last?.group && !last.pending) {
|
|
52228
|
+
const group = mergeGroups(last.group, row.group);
|
|
52229
|
+
out[out.length - 1] = {
|
|
52230
|
+
...last,
|
|
52231
|
+
group,
|
|
52232
|
+
content: groupText(group, false),
|
|
52233
|
+
detail: joinSections(last.detail, row.detail ?? [])
|
|
52234
|
+
};
|
|
52235
|
+
continue;
|
|
52236
|
+
}
|
|
52237
|
+
out.push(row);
|
|
51875
52238
|
}
|
|
51876
|
-
|
|
51877
|
-
|
|
51878
|
-
|
|
51879
|
-
|
|
51880
|
-
|
|
51881
|
-
|
|
51882
|
-
|
|
51883
|
-
|
|
51884
|
-
glyph: "\u25CF",
|
|
51885
|
-
glyphColor: tokenColor("status.ok")
|
|
51886
|
-
},
|
|
51887
|
-
...said.length > 0 ? [
|
|
51888
|
-
{
|
|
51889
|
-
role: "tool",
|
|
51890
|
-
content: said,
|
|
51891
|
-
glyph: "\u23BF"
|
|
51892
|
-
}
|
|
51893
|
-
] : []
|
|
51894
|
-
]);
|
|
52239
|
+
return out;
|
|
52240
|
+
}
|
|
52241
|
+
__name(mergeGroupRows, "mergeGroupRows");
|
|
52242
|
+
|
|
52243
|
+
// src/tui/pause-clock.ts
|
|
52244
|
+
var PauseClock = class {
|
|
52245
|
+
static {
|
|
52246
|
+
__name(this, "PauseClock");
|
|
51895
52247
|
}
|
|
51896
|
-
|
|
51897
|
-
|
|
51898
|
-
|
|
51899
|
-
|
|
51900
|
-
|
|
51901
|
-
content: headOf(event, start),
|
|
51902
|
-
glyph: "\u25CF",
|
|
51903
|
-
glyphColor: tokenColor("text.muted")
|
|
51904
|
-
},
|
|
51905
|
-
{
|
|
51906
|
-
role: "tool",
|
|
51907
|
-
content: declinedLine(event.declined.note),
|
|
51908
|
-
glyph: "\u23BF",
|
|
51909
|
-
...refused ? { detail: refused.rows, diff: refused.diff } : {}
|
|
51910
|
-
}
|
|
51911
|
-
]);
|
|
52248
|
+
#total = 0;
|
|
52249
|
+
#since = null;
|
|
52250
|
+
/** The person is now being waited on. A second call while waiting changes nothing. */
|
|
52251
|
+
begin(now) {
|
|
52252
|
+
if (this.#since === null) this.#since = now;
|
|
51912
52253
|
}
|
|
51913
|
-
|
|
51914
|
-
|
|
51915
|
-
|
|
51916
|
-
|
|
51917
|
-
|
|
51918
|
-
glyph: "\u25CF",
|
|
51919
|
-
glyphColor: tokenColor("text.muted"),
|
|
51920
|
-
...settledElapsed(event.durationMs) !== void 0 ? { meta: settledElapsed(event.durationMs) } : {}
|
|
51921
|
-
},
|
|
51922
|
-
{ role: "tool", content: event.resultLabel ?? "Cancelled", glyph: "\u23BF" }
|
|
51923
|
-
]);
|
|
52254
|
+
/** The wait is over. */
|
|
52255
|
+
end(now) {
|
|
52256
|
+
if (this.#since === null) return;
|
|
52257
|
+
this.#total += Math.max(0, now - this.#since);
|
|
52258
|
+
this.#since = null;
|
|
51924
52259
|
}
|
|
51925
|
-
|
|
51926
|
-
|
|
51927
|
-
|
|
51928
|
-
role: "tool",
|
|
51929
|
-
content: headOf(event, start),
|
|
51930
|
-
glyph: "\u25CF",
|
|
51931
|
-
glyphColor: tokenColor("accent.assistant")
|
|
51932
|
-
},
|
|
51933
|
-
{ role: "tool", content: WORKFLOW_BACKGROUND_NOTE, glyph: "\u23BF" }
|
|
51934
|
-
]);
|
|
52260
|
+
/** Milliseconds waited so far, counting a wait that is still open. */
|
|
52261
|
+
total(now) {
|
|
52262
|
+
return this.#total + (this.#since === null ? 0 : Math.max(0, now - this.#since));
|
|
51935
52263
|
}
|
|
51936
|
-
|
|
51937
|
-
|
|
51938
|
-
|
|
51939
|
-
|
|
51940
|
-
|
|
51941
|
-
|
|
51942
|
-
|
|
51943
|
-
|
|
51944
|
-
|
|
51945
|
-
|
|
52264
|
+
};
|
|
52265
|
+
|
|
52266
|
+
// src/tui/placeholder-examples.ts
|
|
52267
|
+
import { execFile as execFile3 } from "node:child_process";
|
|
52268
|
+
var PLAIN_EXAMPLES = [
|
|
52269
|
+
"fix lint errors",
|
|
52270
|
+
"fix typecheck errors",
|
|
52271
|
+
"how do I log an error?",
|
|
52272
|
+
"create a util logging.py that..."
|
|
52273
|
+
];
|
|
52274
|
+
var FILE_EXAMPLES = [
|
|
52275
|
+
(file) => `how does ${file} work?`,
|
|
52276
|
+
(file) => `refactor ${file}`,
|
|
52277
|
+
(file) => `edit ${file} to...`,
|
|
52278
|
+
(file) => `write a test for ${file}`
|
|
52279
|
+
];
|
|
52280
|
+
function examplePlaceholder(file, seed) {
|
|
52281
|
+
const pool = [
|
|
52282
|
+
...PLAIN_EXAMPLES,
|
|
52283
|
+
...file ? FILE_EXAMPLES.map((make) => make(file)) : []
|
|
52284
|
+
];
|
|
52285
|
+
const at = Math.min(pool.length - 1, Math.floor(Math.max(0, seed) * pool.length));
|
|
52286
|
+
return `Try "${pool[at]}"`;
|
|
52287
|
+
}
|
|
52288
|
+
__name(examplePlaceholder, "examplePlaceholder");
|
|
52289
|
+
function isExampleFile(path) {
|
|
52290
|
+
if (/(^|\/)(node_modules|dist|build|\.changeset|docs)\//.test(path)) return false;
|
|
52291
|
+
if (/(^|\/)(package-lock\.json|pnpm-lock\.yaml|yarn\.lock|CHANGELOG\.md|log\.md)$/.test(path))
|
|
52292
|
+
return false;
|
|
52293
|
+
return /\.(ts|tsx|js|jsx|mjs|cjs|py|rs|go|java|rb|c|cc|cpp|h|cs|swift|kt)$/.test(path);
|
|
52294
|
+
}
|
|
52295
|
+
__name(isExampleFile, "isExampleFile");
|
|
52296
|
+
function frequentlyModifiedFile(cwd2, signal) {
|
|
52297
|
+
return new Promise((resolve9) => {
|
|
52298
|
+
execFile3(
|
|
52299
|
+
"git",
|
|
52300
|
+
["log", "--name-only", "--pretty=format:", "-n", "200"],
|
|
52301
|
+
{ cwd: cwd2, signal, maxBuffer: 4 * 1024 * 1024, timeout: 5e3 },
|
|
52302
|
+
(error, stdout) => {
|
|
52303
|
+
if (error) return resolve9(void 0);
|
|
52304
|
+
const counts2 = /* @__PURE__ */ new Map();
|
|
52305
|
+
for (const line of stdout.split("\n")) {
|
|
52306
|
+
const path = line.trim();
|
|
52307
|
+
if (path && isExampleFile(path)) counts2.set(path, (counts2.get(path) ?? 0) + 1);
|
|
52308
|
+
}
|
|
52309
|
+
let best;
|
|
52310
|
+
let bestCount = 0;
|
|
52311
|
+
for (const [path, count2] of counts2) {
|
|
52312
|
+
if (count2 > bestCount) {
|
|
52313
|
+
best = path;
|
|
52314
|
+
bestCount = count2;
|
|
52315
|
+
}
|
|
52316
|
+
}
|
|
52317
|
+
resolve9(best);
|
|
51946
52318
|
}
|
|
51947
|
-
|
|
52319
|
+
);
|
|
52320
|
+
});
|
|
52321
|
+
}
|
|
52322
|
+
__name(frequentlyModifiedFile, "frequentlyModifiedFile");
|
|
52323
|
+
|
|
52324
|
+
// src/tui/recap-setting.ts
|
|
52325
|
+
var OFF_WORDS = /* @__PURE__ */ new Set(["0", "false", "no", "off"]);
|
|
52326
|
+
var ON_WORDS = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
|
|
52327
|
+
function recapEnabled(input) {
|
|
52328
|
+
const word = input.env.NAMZU_RECAP?.trim().toLowerCase();
|
|
52329
|
+
if (word !== void 0 && OFF_WORDS.has(word)) return false;
|
|
52330
|
+
if (word !== void 0 && ON_WORDS.has(word)) return true;
|
|
52331
|
+
if (!input.interactive) return false;
|
|
52332
|
+
return input.tui?.recap !== false;
|
|
52333
|
+
}
|
|
52334
|
+
__name(recapEnabled, "recapEnabled");
|
|
52335
|
+
function recapWaitMs(env3) {
|
|
52336
|
+
const raw = env3.NAMZU_RECAP_WAIT_MS?.trim();
|
|
52337
|
+
if (raw === void 0 || !/^\d{1,9}$/u.test(raw)) return RECAP_WAIT_MS;
|
|
52338
|
+
return Number(raw);
|
|
52339
|
+
}
|
|
52340
|
+
__name(recapWaitMs, "recapWaitMs");
|
|
52341
|
+
function setRecapSetting(on, opts = {}) {
|
|
52342
|
+
const env3 = opts.env ?? process.env;
|
|
52343
|
+
try {
|
|
52344
|
+
const target = { ...opts.home ? { home: opts.home } : {}, env: env3 };
|
|
52345
|
+
if (on) deleteUserConfigValue(["tui", "recap"], target);
|
|
52346
|
+
else setUserConfigValue(["tui", "recap"], false, target);
|
|
52347
|
+
} catch (error) {
|
|
52348
|
+
return `${explainFailure(error, "Could not save that setting.")} This conversation ${on ? "shows" : "skips"} recaps until it ends.`;
|
|
51948
52349
|
}
|
|
51949
|
-
|
|
51950
|
-
|
|
51951
|
-
|
|
51952
|
-
const
|
|
51953
|
-
|
|
51954
|
-
{
|
|
51955
|
-
|
|
51956
|
-
content: headOf(event, start),
|
|
51957
|
-
glyph: "\u25CF",
|
|
51958
|
-
glyphColor: tokenColor("status.error"),
|
|
51959
|
-
detail: full,
|
|
51960
|
-
shell: failureBody(full, text !== full.join("\n") ? lines : void 0)
|
|
51961
|
-
}
|
|
51962
|
-
]);
|
|
52350
|
+
const saved = on ? "Recaps are on: after a few minutes away, a one-line recap of where things stand is shown when you come back." : "Recaps are off. /config recap on turns them back on; /recap still writes one on request.";
|
|
52351
|
+
const word = env3.NAMZU_RECAP?.trim().toLowerCase();
|
|
52352
|
+
if (word !== void 0 && (OFF_WORDS.has(word) || ON_WORDS.has(word))) {
|
|
52353
|
+
const forced = ON_WORDS.has(word);
|
|
52354
|
+
if (forced !== on) {
|
|
52355
|
+
return `${saved} But NAMZU_RECAP is set in the environment and turns them ${forced ? "on" : "off"} on the next start; this conversation follows your choice.`;
|
|
52356
|
+
}
|
|
51963
52357
|
}
|
|
51964
|
-
|
|
51965
|
-
|
|
51966
|
-
|
|
51967
|
-
|
|
51968
|
-
|
|
51969
|
-
|
|
51970
|
-
|
|
51971
|
-
|
|
51972
|
-
|
|
51973
|
-
|
|
51974
|
-
activity: "catalogue"
|
|
51975
|
-
}
|
|
51976
|
-
]);
|
|
52358
|
+
return saved;
|
|
52359
|
+
}
|
|
52360
|
+
__name(setRecapSetting, "setRecapSetting");
|
|
52361
|
+
function describeRecapSetting(input) {
|
|
52362
|
+
const fromFiles = input.tui?.recap !== false;
|
|
52363
|
+
const word = input.env.NAMZU_RECAP?.trim().toLowerCase();
|
|
52364
|
+
const lines = [`Recaps: ${input.enabledNow ? "on" : "off"} in this conversation.`];
|
|
52365
|
+
lines.push(`Config files: ${fromFiles ? "on (the default)" : "off"}.`);
|
|
52366
|
+
if (word !== void 0 && (OFF_WORDS.has(word) || ON_WORDS.has(word))) {
|
|
52367
|
+
lines.push(`NAMZU_RECAP is set and turns them ${ON_WORDS.has(word) ? "on" : "off"}.`);
|
|
51977
52368
|
}
|
|
51978
|
-
|
|
51979
|
-
|
|
51980
|
-
|
|
51981
|
-
|
|
51982
|
-
|
|
51983
|
-
|
|
51984
|
-
|
|
51985
|
-
|
|
51986
|
-
|
|
51987
|
-
|
|
51988
|
-
|
|
51989
|
-
}
|
|
51990
|
-
]);
|
|
52369
|
+
lines.push("/config recap on|off changes it; /recap writes one now.");
|
|
52370
|
+
return lines.join("\n");
|
|
52371
|
+
}
|
|
52372
|
+
__name(describeRecapSetting, "describeRecapSetting");
|
|
52373
|
+
|
|
52374
|
+
// src/tui/recap-turns.ts
|
|
52375
|
+
function kindOf(message) {
|
|
52376
|
+
if (message.kind === "recap") return "recap";
|
|
52377
|
+
if (message.pending) return void 0;
|
|
52378
|
+
if (message.role === "user" && !message.sourceDelivery && message.content.trim().length > 0) {
|
|
52379
|
+
return "prompt";
|
|
51991
52380
|
}
|
|
51992
|
-
if (
|
|
51993
|
-
|
|
51994
|
-
|
|
51995
|
-
|
|
51996
|
-
|
|
51997
|
-
|
|
51998
|
-
|
|
51999
|
-
|
|
52000
|
-
|
|
52001
|
-
content: header,
|
|
52002
|
-
glyph: "\u25CF",
|
|
52003
|
-
detail: [...settled2.stdout, ...settled2.stderr],
|
|
52004
|
-
glyphColor: failed ? tokenColor("status.error") : tokenColor("status.ok"),
|
|
52005
|
-
shell: full !== void 0 && full !== header ? { ...settled2, fullHeader: full } : settled2
|
|
52006
|
-
}
|
|
52007
|
-
]);
|
|
52381
|
+
if (message.role === "assistant" && message.content.trim().length > 0) return "reply";
|
|
52382
|
+
return void 0;
|
|
52383
|
+
}
|
|
52384
|
+
__name(kindOf, "kindOf");
|
|
52385
|
+
function recapRows(messages) {
|
|
52386
|
+
const rows = [];
|
|
52387
|
+
for (const message of messages) {
|
|
52388
|
+
const kind = kindOf(message);
|
|
52389
|
+
if (kind !== void 0) rows.push(kind);
|
|
52008
52390
|
}
|
|
52009
|
-
|
|
52010
|
-
|
|
52011
|
-
|
|
52012
|
-
|
|
52013
|
-
|
|
52014
|
-
|
|
52015
|
-
|
|
52016
|
-
|
|
52017
|
-
|
|
52018
|
-
glyphColor: tokenColor("status.ok"),
|
|
52019
|
-
...elapsed2 !== void 0 ? { meta: elapsed2 } : {}
|
|
52020
|
-
}
|
|
52021
|
-
];
|
|
52022
|
-
if (!event.hidden && (event.summary.length > 0 || (event.detail?.length ?? 0) > 0)) {
|
|
52023
|
-
list.push({
|
|
52024
|
-
role: "tool",
|
|
52025
|
-
content: event.diff?.summary ? spansText(event.diff.summary) : event.summary,
|
|
52026
|
-
glyph: "\u23BF",
|
|
52027
|
-
detail: event.detail,
|
|
52028
|
-
...event.diff ? { diff: event.diff } : {}
|
|
52029
|
-
});
|
|
52391
|
+
return rows;
|
|
52392
|
+
}
|
|
52393
|
+
__name(recapRows, "recapRows");
|
|
52394
|
+
function recapTurns(messages) {
|
|
52395
|
+
const turns = [];
|
|
52396
|
+
for (const message of messages) {
|
|
52397
|
+
const kind = kindOf(message);
|
|
52398
|
+
if (kind === "prompt") turns.push({ role: "user", text: message.content });
|
|
52399
|
+
else if (kind === "reply") turns.push({ role: "assistant", text: message.content });
|
|
52030
52400
|
}
|
|
52031
|
-
return
|
|
52401
|
+
return turns;
|
|
52032
52402
|
}
|
|
52033
|
-
__name(
|
|
52403
|
+
__name(recapTurns, "recapTurns");
|
|
52034
52404
|
|
|
52035
52405
|
// src/tui/restored-rows.ts
|
|
52036
52406
|
var NO_TRAIL = {
|
|
@@ -53737,6 +54107,27 @@ function AppBody({
|
|
|
53737
54107
|
const [state, setState] = (0, import_react59.useState)("idle");
|
|
53738
54108
|
const stateRef = (0, import_react59.useRef)(state);
|
|
53739
54109
|
stateRef.current = state;
|
|
54110
|
+
const learnedQueueRef = (0, import_react59.useRef)([]);
|
|
54111
|
+
const flushLearnedRef = (0, import_react59.useRef)(() => {
|
|
54112
|
+
});
|
|
54113
|
+
flushLearnedRef.current = () => {
|
|
54114
|
+
if (stateRef.current !== "idle" || abortRef.current !== null) return;
|
|
54115
|
+
const lines = learnedQueueRef.current.splice(0);
|
|
54116
|
+
if (lines.length === 0) return;
|
|
54117
|
+
setMessages((prev) => [
|
|
54118
|
+
...prev,
|
|
54119
|
+
...lines.map((content) => ({
|
|
54120
|
+
id: nextId(),
|
|
54121
|
+
role: "system",
|
|
54122
|
+
content,
|
|
54123
|
+
glyph: systemRowStyle("notice").glyph,
|
|
54124
|
+
glyphColor: systemRowStyle("notice").color
|
|
54125
|
+
}))
|
|
54126
|
+
]);
|
|
54127
|
+
};
|
|
54128
|
+
(0, import_react59.useEffect)(() => {
|
|
54129
|
+
if (state === "idle") flushLearnedRef.current();
|
|
54130
|
+
}, [state]);
|
|
53740
54131
|
const [phase, setPhase] = (0, import_react59.useState)("probing");
|
|
53741
54132
|
const [startupExplained, setStartupExplained] = (0, import_react59.useState)(false);
|
|
53742
54133
|
const phaseRef = (0, import_react59.useRef)(phase);
|
|
@@ -54410,20 +54801,79 @@ ${blocks.join("\n\n")}`;
|
|
|
54410
54801
|
setActiveTools([]);
|
|
54411
54802
|
}, []);
|
|
54412
54803
|
const permissionResolveRef = (0, import_react59.useRef)(null);
|
|
54413
|
-
const permissionQueueRef = (0, import_react59.useRef)([]);
|
|
54414
54804
|
const permissionShownRef = (0, import_react59.useRef)(null);
|
|
54415
|
-
const [
|
|
54805
|
+
const [permissionReason, setPermissionReasonState] = (0, import_react59.useState)(null);
|
|
54806
|
+
const permissionReasonRef = (0, import_react59.useRef)(null);
|
|
54807
|
+
const setPermissionReason = (0, import_react59.useCallback)((next) => {
|
|
54808
|
+
permissionReasonRef.current = next;
|
|
54809
|
+
setPermissionReasonState(next);
|
|
54810
|
+
}, []);
|
|
54811
|
+
const [permissionCount, setPermissionCount] = (0, import_react59.useState)(void 0);
|
|
54812
|
+
const perCallReviewRef = (0, import_react59.useRef)(null);
|
|
54813
|
+
if (perCallReviewRef.current === null) {
|
|
54814
|
+
perCallReviewRef.current = createTerminalPerCallReview({
|
|
54815
|
+
mode: /* @__PURE__ */ __name(() => permissionModeRef.current, "mode")
|
|
54816
|
+
});
|
|
54817
|
+
}
|
|
54818
|
+
const refusalEndedTurnRef = (0, import_react59.useRef)(false);
|
|
54819
|
+
const learningQuestionsRef = (0, import_react59.useRef)(null);
|
|
54820
|
+
if (learningQuestionsRef.current === null) learningQuestionsRef.current = createQuestionGate();
|
|
54821
|
+
const learningQuestions = learningQuestionsRef.current;
|
|
54822
|
+
const permissionAsksRef = (0, import_react59.useRef)(null);
|
|
54823
|
+
if (permissionAsksRef.current === null) {
|
|
54824
|
+
permissionAsksRef.current = new AskQueue(
|
|
54825
|
+
(pending) => {
|
|
54826
|
+
setPermissionReviewOffset(0);
|
|
54827
|
+
setPermissionChoice(0);
|
|
54828
|
+
setPermissionReason(null);
|
|
54829
|
+
permissionShownRef.current = pending;
|
|
54830
|
+
if (pending) {
|
|
54831
|
+
permissionOpenedAtRef.current = Date.now();
|
|
54832
|
+
permissionResolveRef.current = (decision) => permissionAsksRef.current?.answer(decision);
|
|
54833
|
+
setPermissionDetailsOpen(!pending.summary.complete);
|
|
54834
|
+
setPermission(pending);
|
|
54835
|
+
setState("awaiting-permission");
|
|
54836
|
+
} else {
|
|
54837
|
+
permissionOpenedAtRef.current = null;
|
|
54838
|
+
permissionResolveRef.current = null;
|
|
54839
|
+
setPermissionDetailsOpen(false);
|
|
54840
|
+
setPermission(null);
|
|
54841
|
+
setState((current) => current === "awaiting-permission" ? "thinking" : current);
|
|
54842
|
+
}
|
|
54843
|
+
},
|
|
54844
|
+
() => {
|
|
54845
|
+
setPermissionCount(permissionAsksRef.current?.count());
|
|
54846
|
+
learningQuestions.set((permissionAsksRef.current?.open ?? 0) > 0);
|
|
54847
|
+
}
|
|
54848
|
+
);
|
|
54849
|
+
}
|
|
54850
|
+
const permissionAsks = permissionAsksRef.current;
|
|
54851
|
+
const rulesChanged = (0, import_react59.useCallback)(
|
|
54852
|
+
(newAllows) => {
|
|
54853
|
+
queueMicrotask(() => {
|
|
54854
|
+
const perCallReview = perCallReviewRef.current;
|
|
54855
|
+
perCallReview?.rulesChanged();
|
|
54856
|
+
const commands = session?.commandArguments;
|
|
54857
|
+
permissionAsks.settleWhere((pending) => {
|
|
54858
|
+
if (pending.perCall || pending.batchOnly || pending.screenConsent) return void 0;
|
|
54859
|
+
if (pending.withheld.length > 0 || pending.toolCalls.length === 0) return void 0;
|
|
54860
|
+
const covered = pending.toolCalls.every((call) => {
|
|
54861
|
+
if (perCallReview?.modeCovers(call)) return true;
|
|
54862
|
+
if (!newAllows || !commands) return false;
|
|
54863
|
+
const allows = allowsFor(call, commands);
|
|
54864
|
+
return allows?.every((allow) => newAllows.some((added) => sameAllow(added, allow))) === true;
|
|
54865
|
+
});
|
|
54866
|
+
return covered ? { kind: "approve" } : void 0;
|
|
54867
|
+
});
|
|
54868
|
+
});
|
|
54869
|
+
},
|
|
54870
|
+
[permissionAsks, session]
|
|
54871
|
+
);
|
|
54416
54872
|
(0, import_react59.useEffect)(
|
|
54417
54873
|
() => () => {
|
|
54418
|
-
|
|
54419
|
-
kind: "reject",
|
|
54420
|
-
feedback: "The approval screen closed."
|
|
54421
|
-
};
|
|
54422
|
-
permissionResolveRef.current?.(decision);
|
|
54423
|
-
permissionResolveRef.current = null;
|
|
54424
|
-
for (const pending of permissionQueueRef.current.splice(0)) pending.resolve(decision);
|
|
54874
|
+
permissionAsks.closeAll({ kind: "reject", feedback: "The approval screen closed." });
|
|
54425
54875
|
},
|
|
54426
|
-
[]
|
|
54876
|
+
[permissionAsks]
|
|
54427
54877
|
);
|
|
54428
54878
|
const permissionOpenedAtRef = (0, import_react59.useRef)(null);
|
|
54429
54879
|
const trustShownAtRef = (0, import_react59.useRef)(null);
|
|
@@ -55380,6 +55830,7 @@ ${blocks.join("\n\n")}`;
|
|
|
55380
55830
|
permissionModeSourceRef.current = "session";
|
|
55381
55831
|
setPermissionModeState(mode);
|
|
55382
55832
|
void session.setPermissionMode?.(mode);
|
|
55833
|
+
rulesChanged();
|
|
55383
55834
|
if (announce) {
|
|
55384
55835
|
pushMessage(
|
|
55385
55836
|
"system",
|
|
@@ -55393,7 +55844,7 @@ ${blocks.join("\n\n")}`;
|
|
|
55393
55844
|
);
|
|
55394
55845
|
}
|
|
55395
55846
|
},
|
|
55396
|
-
[pushMessage, session]
|
|
55847
|
+
[pushMessage, rulesChanged, session]
|
|
55397
55848
|
);
|
|
55398
55849
|
const applyPermissionMode = (0, import_react59.useCallback)(
|
|
55399
55850
|
(mode, announce = true) => {
|
|
@@ -56448,6 +56899,20 @@ ${blocks.join("\n\n")}`;
|
|
|
56448
56899
|
...activeCtx.structuredOutput ? { structuredOutput: activeCtx.structuredOutput } : {},
|
|
56449
56900
|
...activeCtx.additionalDirectories ? { additionalDirectories: activeCtx.additionalDirectories } : {},
|
|
56450
56901
|
...sessionsRef.current ? { stateRoot: sessionsRef.current.root } : {},
|
|
56902
|
+
learningObservations: activeCtx.learningObservations !== false,
|
|
56903
|
+
// Learn by itself in the background of this conversation, unless the
|
|
56904
|
+
// config key turned it off.
|
|
56905
|
+
backgroundLearning: {
|
|
56906
|
+
config: activeCtx.learningGenerator,
|
|
56907
|
+
questions: learningQuestions,
|
|
56908
|
+
// One dim row when a revision was activated; the cycle never
|
|
56909
|
+
// asks, and the row names how to undo it.
|
|
56910
|
+
// Held until no turn is streaming, so the row never lands mid-turn.
|
|
56911
|
+
onLearned: /* @__PURE__ */ __name((line) => {
|
|
56912
|
+
learnedQueueRef.current.push(line);
|
|
56913
|
+
flushLearnedRef.current();
|
|
56914
|
+
}, "onLearned")
|
|
56915
|
+
},
|
|
56451
56916
|
enableComputerUse: true,
|
|
56452
56917
|
// The browser tools, when the config did not switch them off. The
|
|
56453
56918
|
// profile is the one `/browser profile` chose, else the config's.
|
|
@@ -57268,6 +57733,8 @@ ${blocks.join("\n\n")}`;
|
|
|
57268
57733
|
permissionMode: permissionModeRef.current,
|
|
57269
57734
|
currentPermissionMode: /* @__PURE__ */ __name(() => permissionModeRef.current, "currentPermissionMode"),
|
|
57270
57735
|
onAutoModeLimit: handleAutoModeLimit,
|
|
57736
|
+
// The skills the operator has on, as a new turn carries them.
|
|
57737
|
+
extraSystem: composeSkillsPrompt(activeSkills) || void 0,
|
|
57271
57738
|
...resume?.handoffReason ? {
|
|
57272
57739
|
systemNote: handoffContinuationNote(resume.handoffReason)
|
|
57273
57740
|
} : {}
|
|
@@ -57292,6 +57759,7 @@ ${blocks.join("\n\n")}`;
|
|
|
57292
57759
|
return true;
|
|
57293
57760
|
},
|
|
57294
57761
|
[
|
|
57762
|
+
activeSkills,
|
|
57295
57763
|
advanceQueueContinuation,
|
|
57296
57764
|
detected,
|
|
57297
57765
|
finalizeMessage,
|
|
@@ -57390,58 +57858,33 @@ ${blocks.join("\n\n")}`;
|
|
|
57390
57858
|
batchOnly: pending.batchOnly === true,
|
|
57391
57859
|
screenConsent: pending.screenConsent === true,
|
|
57392
57860
|
withheld: pending.withheld.length > 0,
|
|
57861
|
+
endsTurn: endsTurnOnNo(pending),
|
|
57393
57862
|
mode: permissionModeRef.current,
|
|
57394
57863
|
...session?.allowForSession && session.commandArguments ? {
|
|
57395
57864
|
commandArguments: session.commandArguments,
|
|
57396
57865
|
rememberWhere: displayPath(ctx.cwd, 28)
|
|
57397
57866
|
} : {}
|
|
57398
57867
|
}), "permissionAnswerOptions");
|
|
57399
|
-
const resolvePermission = (0, import_react59.useCallback)(
|
|
57400
|
-
|
|
57401
|
-
|
|
57402
|
-
|
|
57403
|
-
|
|
57404
|
-
|
|
57405
|
-
if (
|
|
57406
|
-
|
|
57407
|
-
|
|
57408
|
-
|
|
57409
|
-
|
|
57410
|
-
|
|
57411
|
-
|
|
57412
|
-
|
|
57413
|
-
|
|
57414
|
-
|
|
57415
|
-
setPermissionReviewOffset(0);
|
|
57416
|
-
setPermissionDetailsOpen(false);
|
|
57417
|
-
setPermissionChoice(0);
|
|
57418
|
-
setPermission(null);
|
|
57419
|
-
if (resolve9) {
|
|
57420
|
-
setState("thinking");
|
|
57421
|
-
resolve9(decision);
|
|
57422
|
-
}
|
|
57423
|
-
const next = permissionQueueRef.current.shift();
|
|
57424
|
-
setQueuedPermissionCount(permissionQueueRef.current.length);
|
|
57425
|
-
if (next) {
|
|
57426
|
-
permissionResolveRef.current = next.resolve;
|
|
57427
|
-
permissionOpenedAtRef.current = Date.now();
|
|
57428
|
-
setPermissionDetailsOpen(!next.permission.summary.complete);
|
|
57429
|
-
permissionShownRef.current = next.permission;
|
|
57430
|
-
setPermission(next.permission);
|
|
57431
|
-
setState("awaiting-permission");
|
|
57432
|
-
}
|
|
57433
|
-
},
|
|
57434
|
-
[setPermissionDetailsOpen, setPermissionReviewOffset]
|
|
57435
|
-
);
|
|
57868
|
+
const resolvePermission = (0, import_react59.useCallback)((requested) => {
|
|
57869
|
+
const shown = permissionShownRef.current;
|
|
57870
|
+
if (!shown) return;
|
|
57871
|
+
let decision = requested;
|
|
57872
|
+
if (requested.kind === "approve") {
|
|
57873
|
+
const again = buildPermissionReview(shown.source.toolCalls);
|
|
57874
|
+
if (!again.ok || again.envelopeHash !== shown.envelopeHash)
|
|
57875
|
+
decision = {
|
|
57876
|
+
kind: "reject",
|
|
57877
|
+
feedback: "Refused: the tool input changed after it was shown for approval."
|
|
57878
|
+
};
|
|
57879
|
+
}
|
|
57880
|
+
setState("thinking");
|
|
57881
|
+
if (decision.kind === "reject" && decision.endTurn === true) refusalEndedTurnRef.current = true;
|
|
57882
|
+
permissionAsksRef.current?.answer(decision);
|
|
57883
|
+
}, []);
|
|
57436
57884
|
const interruptTurn = (0, import_react59.useCallback)(
|
|
57437
57885
|
(recoverInput = false) => {
|
|
57438
57886
|
const cancelledSwitch = cancelPendingModelSwitch();
|
|
57439
|
-
|
|
57440
|
-
pending.resolve({ kind: "reject", feedback: "User interrupted." });
|
|
57441
|
-
}
|
|
57442
|
-
setQueuedPermissionCount(0);
|
|
57443
|
-
if (permissionResolveRef.current)
|
|
57444
|
-
resolvePermission({ kind: "reject", feedback: "User interrupted." });
|
|
57887
|
+
permissionAsksRef.current?.closeAll({ kind: "reject", feedback: "User interrupted." });
|
|
57445
57888
|
const ac = abortRef.current;
|
|
57446
57889
|
if (!ac) {
|
|
57447
57890
|
if (admissionRef.current) {
|
|
@@ -57488,7 +57931,6 @@ ${blocks.join("\n\n")}`;
|
|
|
57488
57931
|
discardQueued,
|
|
57489
57932
|
goalActivation,
|
|
57490
57933
|
replaceQueued,
|
|
57491
|
-
resolvePermission,
|
|
57492
57934
|
setQueuePause,
|
|
57493
57935
|
wakeGoalDriver
|
|
57494
57936
|
]
|
|
@@ -58376,43 +58818,60 @@ ${plain(err)}`
|
|
|
58376
58818
|
withheld: review.withheld
|
|
58377
58819
|
});
|
|
58378
58820
|
const siteNotes = browserSiteNotes(req.toolCalls, browserControlRef.current?.status());
|
|
58379
|
-
|
|
58380
|
-
|
|
58381
|
-
|
|
58382
|
-
|
|
58383
|
-
|
|
58384
|
-
|
|
58385
|
-
|
|
58386
|
-
|
|
58387
|
-
|
|
58388
|
-
|
|
58389
|
-
|
|
58390
|
-
|
|
58391
|
-
|
|
58392
|
-
|
|
58393
|
-
|
|
58394
|
-
|
|
58821
|
+
const pending = {
|
|
58822
|
+
...req,
|
|
58823
|
+
review: review.text,
|
|
58824
|
+
summary: summary2,
|
|
58825
|
+
siteNotes,
|
|
58826
|
+
withheld: review.withheld,
|
|
58827
|
+
source: req,
|
|
58828
|
+
envelopeHash: review.envelopeHash
|
|
58829
|
+
};
|
|
58830
|
+
const asks = permissionAsksRef.current;
|
|
58831
|
+
const perCallReview = perCallReviewRef.current;
|
|
58832
|
+
if (!asks || !perCallReview) {
|
|
58833
|
+
return Promise.resolve({
|
|
58834
|
+
kind: "reject",
|
|
58835
|
+
feedback: "The approval screen closed."
|
|
58836
|
+
});
|
|
58837
|
+
}
|
|
58838
|
+
if (req.perCall) {
|
|
58839
|
+
const presenter = reviewSessionRef.current?.presenter;
|
|
58840
|
+
for (const [index, call] of req.toolCalls.entries()) {
|
|
58841
|
+
perCallReview.hold(
|
|
58842
|
+
call.id,
|
|
58843
|
+
review.withheld.some((held) => held.index === index)
|
|
58844
|
+
);
|
|
58845
|
+
const row = presenter ? queuedToolRow(call, req.turnId, presenter, ctxRef.current.cwd, Date.now()) : void 0;
|
|
58846
|
+
if (row) {
|
|
58847
|
+
activeToolsRef.current = withQueuedRow(activeToolsRef.current, row);
|
|
58848
|
+
setActiveTools(activeToolsRef.current);
|
|
58849
|
+
}
|
|
58395
58850
|
}
|
|
58396
|
-
|
|
58397
|
-
|
|
58398
|
-
|
|
58399
|
-
|
|
58400
|
-
|
|
58401
|
-
|
|
58402
|
-
|
|
58403
|
-
|
|
58404
|
-
|
|
58405
|
-
|
|
58406
|
-
|
|
58407
|
-
|
|
58408
|
-
|
|
58409
|
-
|
|
58410
|
-
|
|
58411
|
-
|
|
58412
|
-
|
|
58851
|
+
}
|
|
58852
|
+
const background = reviewSource(req, scopeRef.current?.sessionId) !== void 0;
|
|
58853
|
+
const answered = asks.enqueue(pending, {
|
|
58854
|
+
background,
|
|
58855
|
+
...req.signal ? { signal: req.signal } : {}
|
|
58856
|
+
});
|
|
58857
|
+
if (asks.shown === pending) announceApproval();
|
|
58858
|
+
return answered.then((decision) => {
|
|
58859
|
+
if (req.perCall) {
|
|
58860
|
+
for (const call of req.toolCalls) {
|
|
58861
|
+
perCallReview.release(call.id);
|
|
58862
|
+
if (decision === CLOSED_QUESTION) continue;
|
|
58863
|
+
activeToolsRef.current = decision.kind === "approve" ? withStartedRow(
|
|
58864
|
+
activeToolsRef.current,
|
|
58865
|
+
call.id,
|
|
58866
|
+
Date.now()
|
|
58867
|
+
) : withoutQueuedRow(activeToolsRef.current, call.id);
|
|
58868
|
+
}
|
|
58869
|
+
setActiveTools(activeToolsRef.current);
|
|
58870
|
+
}
|
|
58871
|
+
return decision;
|
|
58413
58872
|
});
|
|
58414
58873
|
},
|
|
58415
|
-
[announceApproval
|
|
58874
|
+
[announceApproval]
|
|
58416
58875
|
);
|
|
58417
58876
|
const askQuestion = (0, import_react59.useCallback)(
|
|
58418
58877
|
(question, signal) => new Promise((resolve9) => {
|
|
@@ -58769,7 +59228,7 @@ ${plain(err)}`
|
|
|
58769
59228
|
...event.proposed ? { proposed: event.proposed } : {},
|
|
58770
59229
|
...event.web ? { web: event.web, progress: webLiveStatus(event.web) } : {}
|
|
58771
59230
|
};
|
|
58772
|
-
activeToolsRef.current =
|
|
59231
|
+
activeToolsRef.current = withTakenOverRow(activeToolsRef.current, tool);
|
|
58773
59232
|
setActiveTools(activeToolsRef.current);
|
|
58774
59233
|
break;
|
|
58775
59234
|
}
|
|
@@ -58985,6 +59444,13 @@ ${plain(err)}`
|
|
|
58985
59444
|
outcome: st.completed ? "completed" : "stopped"
|
|
58986
59445
|
};
|
|
58987
59446
|
closeAssistant();
|
|
59447
|
+
if (refusalEndedTurnRef.current) {
|
|
59448
|
+
refusalEndedTurnRef.current = false;
|
|
59449
|
+
if (event.stopReason === "cancelled") {
|
|
59450
|
+
const row = interruptionRow({ callRunning: false });
|
|
59451
|
+
pushMessage("system", row.content, false, row.glyph, void 0, row.color);
|
|
59452
|
+
}
|
|
59453
|
+
}
|
|
58988
59454
|
const stopNotice = describeTurnStop(event.stopReason, event.budget);
|
|
58989
59455
|
if (stopNotice) pushSystem("warning", stopNotice);
|
|
58990
59456
|
if (st.startedAt !== void 0) {
|
|
@@ -59266,6 +59732,7 @@ ${jobLines.map(([, line]) => `- ${line}`).join("\n")}`] : []
|
|
|
59266
59732
|
};
|
|
59267
59733
|
}, "markNonGoalAbnormal");
|
|
59268
59734
|
abortRef.current = ac;
|
|
59735
|
+
refusalEndedTurnRef.current = false;
|
|
59269
59736
|
activeTurnTokenRef.current = turnToken;
|
|
59270
59737
|
const turnGeneration = conversationGenRef.current;
|
|
59271
59738
|
unsettledTurnGenerationsRef.current.set(turnToken, turnGeneration);
|
|
@@ -59481,6 +59948,8 @@ ${[...workflowNoticeSnapshot.values()].join("\n\n")}` : void 0,
|
|
|
59481
59948
|
...goalRound ? { goalRound } : {},
|
|
59482
59949
|
// The mode above decides whether this callback is consulted.
|
|
59483
59950
|
onPermission: askPermission,
|
|
59951
|
+
// The terminal asks about one call at a time while the batch runs.
|
|
59952
|
+
...perCallReviewRef.current ? { perCallReview: perCallReviewRef.current.config } : {},
|
|
59484
59953
|
// A workflow this turn starts outlives it, so its agents cannot borrow
|
|
59485
59954
|
// `askPermission`, which belongs to this turn. They ask through the
|
|
59486
59955
|
// conversation instead, for as long as it is the one on screen.
|
|
@@ -59646,19 +60115,10 @@ ${[...workflowNoticeSnapshot.values()].join("\n\n")}` : void 0,
|
|
|
59646
60115
|
}
|
|
59647
60116
|
abortRef.current = null;
|
|
59648
60117
|
if (ownsTurn) activeTurnTokenRef.current = null;
|
|
59649
|
-
|
|
60118
|
+
permissionAsksRef.current?.closeAll({
|
|
59650
60119
|
kind: "reject",
|
|
59651
60120
|
feedback: "The owning turn ended."
|
|
59652
60121
|
});
|
|
59653
|
-
for (const pending2 of permissionQueueRef.current.splice(0))
|
|
59654
|
-
pending2.resolve({
|
|
59655
|
-
kind: "reject",
|
|
59656
|
-
feedback: "The owning turn ended."
|
|
59657
|
-
});
|
|
59658
|
-
setQueuedPermissionCount(0);
|
|
59659
|
-
permissionResolveRef.current = null;
|
|
59660
|
-
permissionOpenedAtRef.current = null;
|
|
59661
|
-
setPermission(null);
|
|
59662
60122
|
clearActiveTools();
|
|
59663
60123
|
setState("idle");
|
|
59664
60124
|
if (ownsTurn) {
|
|
@@ -62118,6 +62578,30 @@ ${plugins.map((plugin) => {
|
|
|
62118
62578
|
}
|
|
62119
62579
|
if (permissionResolveRef.current) {
|
|
62120
62580
|
const ch = input.toLowerCase();
|
|
62581
|
+
const typing = permissionReasonRef.current;
|
|
62582
|
+
if (typing !== null) {
|
|
62583
|
+
if (key.ctrl && input === "c") {
|
|
62584
|
+
interruptTurn();
|
|
62585
|
+
return;
|
|
62586
|
+
}
|
|
62587
|
+
if (key.escape) {
|
|
62588
|
+
setPermissionReason(null);
|
|
62589
|
+
return;
|
|
62590
|
+
}
|
|
62591
|
+
if (key.return) {
|
|
62592
|
+
const refusal = noWithReason(typing);
|
|
62593
|
+
if (refusal) resolvePermission(refusal);
|
|
62594
|
+
return;
|
|
62595
|
+
}
|
|
62596
|
+
if (key.backspace || key.delete) {
|
|
62597
|
+
setPermissionReason(Array.from(typing).slice(0, -1).join(""));
|
|
62598
|
+
return;
|
|
62599
|
+
}
|
|
62600
|
+
if (!key.ctrl && !key.meta && !key.tab && !key.upArrow && !key.downArrow) {
|
|
62601
|
+
setPermissionReason(appendTypedReason(typing, input));
|
|
62602
|
+
}
|
|
62603
|
+
return;
|
|
62604
|
+
}
|
|
62121
62605
|
if (permission && ch === "d") {
|
|
62122
62606
|
setPermissionReviewOffset(0);
|
|
62123
62607
|
setPermissionDetailsOpen(!permissionDetailsOpenRef.current);
|
|
@@ -62133,10 +62617,7 @@ ${plugins.map((plugin) => {
|
|
|
62133
62617
|
if (permission && (key.pageUp || key.pageDown || key.home || key.end)) {
|
|
62134
62618
|
const source = permissionDetailsOpenRef.current ? permission.review : permission.summary.compactText ?? permission.summary.text;
|
|
62135
62619
|
const count2 = permissionReviewRows(source, terminal.columns).length;
|
|
62136
|
-
const pageRows = Math.max(
|
|
62137
|
-
1,
|
|
62138
|
-
permissionReviewPageRows(terminal.rows) - (reviewSource(permission, scopeRef.current?.sessionId) ? 1 : 0)
|
|
62139
|
-
);
|
|
62620
|
+
const pageRows = Math.max(1, permissionReviewPageRows(terminal.rows));
|
|
62140
62621
|
const maxOffset = Math.max(0, count2 - pageRows);
|
|
62141
62622
|
const current = Math.min(permissionReviewOffsetRef.current, maxOffset);
|
|
62142
62623
|
const next = key.home ? 0 : key.end ? maxOffset : key.pageUp ? Math.max(0, current - pageRows) : Math.min(maxOffset, current + pageRows);
|
|
@@ -62144,21 +62625,30 @@ ${plugins.map((plugin) => {
|
|
|
62144
62625
|
return;
|
|
62145
62626
|
}
|
|
62146
62627
|
if (key.ctrl && input === "c") {
|
|
62147
|
-
|
|
62628
|
+
if (permission && endsTurnOnNo(permission)) {
|
|
62629
|
+
resolvePermission(plainNo(true));
|
|
62630
|
+
return;
|
|
62631
|
+
}
|
|
62632
|
+
interruptWithRow(false);
|
|
62148
62633
|
return;
|
|
62149
62634
|
}
|
|
62635
|
+
const noDecision = permission ? plainNo(endsTurnOnNo(permission)) : plainNo(false);
|
|
62150
62636
|
if (ch === "n" || key.escape) {
|
|
62151
|
-
resolvePermission(
|
|
62637
|
+
resolvePermission(noDecision);
|
|
62152
62638
|
return;
|
|
62153
62639
|
}
|
|
62154
|
-
if (!approvalIsDeliberate(permissionOpenedAtRef.current, Date.now())) return;
|
|
62155
62640
|
const answers = permission ? permissionAnswers(permission.toolCalls, permissionAnswerOptions(permission)) : [];
|
|
62641
|
+
if (key.tab && !key.shift) {
|
|
62642
|
+
if (answers[permissionChoiceRef.current]?.kind === "reject") setPermissionReason("");
|
|
62643
|
+
return;
|
|
62644
|
+
}
|
|
62645
|
+
if (!approvalIsDeliberate(permissionOpenedAtRef.current, Date.now())) return;
|
|
62156
62646
|
const numbered = /^[1-9]$/.test(ch) ? Number(ch) - 1 : null;
|
|
62157
62647
|
const chosen = key.return ? permissionChoiceRef.current : numbered;
|
|
62158
|
-
const answer = ch === "y" ? answers[0] : chosen !== null ? answers[chosen] : void 0;
|
|
62648
|
+
const answer = key.tab && key.shift ? answers.find((candidate) => candidate.kind === "approve-edits") : ch === "y" ? answers[0] : chosen !== null ? answers[chosen] : void 0;
|
|
62159
62649
|
if (!answer) return;
|
|
62160
62650
|
if (answer.kind === "reject") {
|
|
62161
|
-
resolvePermission(
|
|
62651
|
+
resolvePermission(noDecision);
|
|
62162
62652
|
return;
|
|
62163
62653
|
}
|
|
62164
62654
|
if (answer.kind === "approve-edits") applyPermissionMode("accept-edits", false);
|
|
@@ -62167,6 +62657,7 @@ ${plugins.map((plugin) => {
|
|
|
62167
62657
|
if (notice) pushMessage("system", notice);
|
|
62168
62658
|
}
|
|
62169
62659
|
resolvePermission({ kind: "approve" });
|
|
62660
|
+
if (answer.kind === "approve-rule") rulesChanged(answer.allows);
|
|
62170
62661
|
return;
|
|
62171
62662
|
}
|
|
62172
62663
|
const shellView = jobSurfaceRef.current;
|
|
@@ -62800,7 +63291,7 @@ ${plugins.map((plugin) => {
|
|
|
62800
63291
|
const statusHint = exitHint ? `Press ${exitHint} again to exit` : noticeIsImmediate ? void 0 : conversationMutation === "fork" ? "forking conversation \u2014 input is paused" : conversationMutation === "edit" ? "branching before prompt \u2014 input is paused" : conversationMutation === "archive" ? "archiving conversation \u2014 input is paused" : conversationMutation === "new" ? "starting a fresh conversation \u2014 input is paused" : compacting ? "compacting conversation \u2014 input is paused" : boxOwnsKeys ? void 0 : handoffPark && phase === "ready" && state === "idle" && !composerHasDraft ? "enter continue \xB7 esc stop" : goalStatus && phase === "ready" && state === "idle" ? void 0 : hintForPhase(phase, state, composerHasDraft);
|
|
62801
63292
|
const permissionSource = reviewSource(permission, scopeRef.current?.sessionId);
|
|
62802
63293
|
const permissionOwner = permissionSource ? subagents.find((agent) => agent.sessionId === permissionSource) : void 0;
|
|
62803
|
-
const permissionSourceLabel = permissionSource ? permissionOwner ? `
|
|
63294
|
+
const permissionSourceLabel = permissionSource ? permissionOwner ? `from the ${permissionOwner.description} agent` : "from another agent" : void 0;
|
|
62804
63295
|
const displayedPermissionMode = permissionMode;
|
|
62805
63296
|
const highestEffort = highestReasoningEffort(session?.reasoningEffortLevels);
|
|
62806
63297
|
const composerTriggers = composerTriggersOn ? {
|
|
@@ -62974,8 +63465,10 @@ ${plugins.map((plugin) => {
|
|
|
62974
63465
|
detailsOpen: permissionDetailsOpen,
|
|
62975
63466
|
reviewOffset: permissionReviewOffset,
|
|
62976
63467
|
choice: permissionChoice,
|
|
62977
|
-
|
|
62978
|
-
|
|
63468
|
+
...permissionCount ? { count: permissionCount } : {},
|
|
63469
|
+
...permissionSourceLabel ? { from: permissionSourceLabel } : {},
|
|
63470
|
+
...permissionReason !== null ? { reason: permissionReason } : {},
|
|
63471
|
+
endsTurn: endsTurnOnNo(permission),
|
|
62979
63472
|
columns: terminal.columns,
|
|
62980
63473
|
rows: terminal.rows,
|
|
62981
63474
|
batchOnly: permission.batchOnly === true,
|
|
@@ -63311,6 +63804,10 @@ function reviewSource(request, currentSessionId) {
|
|
|
63311
63804
|
return typeof sessionId === "string" && sessionId !== currentSessionId ? sessionId : void 0;
|
|
63312
63805
|
}
|
|
63313
63806
|
__name(reviewSource, "reviewSource");
|
|
63807
|
+
function endsTurnOnNo(pending) {
|
|
63808
|
+
return pending.perCall === true && pending.batchOnly !== true && pending.screenConsent !== true;
|
|
63809
|
+
}
|
|
63810
|
+
__name(endsTurnOnNo, "endsTurnOnNo");
|
|
63314
63811
|
function labelOfOption(question, optionId) {
|
|
63315
63812
|
return question.options.find((option) => option.id === optionId)?.label ?? optionId;
|
|
63316
63813
|
}
|
|
@@ -64072,4 +64569,4 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
64072
64569
|
* LICENSE file in the root directory of this source tree.
|
|
64073
64570
|
*)
|
|
64074
64571
|
*/
|
|
64075
|
-
//# sourceMappingURL=tui-
|
|
64572
|
+
//# sourceMappingURL=tui-3NJA6ZKY.js.map
|