@namzu/cli 45.0.0 → 45.2.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 +55 -0
- package/README.md +1 -1
- package/dist/bin.js +1 -1
- package/dist/chunks/{acp-XSAUUT2D.js → acp-TYPW7WFK.js} +52 -49
- package/dist/chunks/acp-TYPW7WFK.js.map +6 -0
- package/dist/chunks/{activity-command-DB4DREW7.js → activity-command-D744W6SC.js} +13 -13
- package/dist/chunks/{add-NVXRVUGY.js → add-QEKJGVR4.js} +21 -20
- package/dist/chunks/add-QEKJGVR4.js.map +6 -0
- package/dist/chunks/{agent-6TD66IMV.js → agent-JWTNZ4PK.js} +40 -38
- package/dist/chunks/agent-session-OGPKSSKG.js +71 -0
- package/dist/chunks/{archive-A3X7KX2U.js → archive-FLZUJDJZ.js} +11 -11
- package/dist/chunks/{bin-main-5PYV7WYI.js → bin-main-UI3NYIJE.js} +5 -5
- package/dist/chunks/{binding-EMMG5PAE.js → binding-JQUI2CTZ.js} +3 -3
- package/dist/chunks/{browser-FUFFJBRR.js → browser-YZCY2CI6.js} +6 -6
- package/dist/chunks/{chat-M653DEAF.js → chat-F3WXVEDM.js} +16 -16
- package/dist/chunks/{chunk-OMRU22BQ.js → chunk-24NEAMG5.js} +3 -3
- package/dist/chunks/chunk-2IPDTDB3.js +80 -0
- package/dist/chunks/chunk-2IPDTDB3.js.map +6 -0
- package/dist/chunks/{chunk-325X27UO.js → chunk-4E33SWZU.js} +4 -4
- package/dist/chunks/{chunk-MMZHUQZQ.js → chunk-4HL5LUP5.js} +497 -63
- package/dist/chunks/chunk-4HL5LUP5.js.map +6 -0
- package/dist/chunks/{chunk-C4MAQ64X.js → chunk-4WHMQBUC.js} +130 -106
- package/dist/chunks/chunk-4WHMQBUC.js.map +6 -0
- package/dist/chunks/{chunk-4DVCHAWN.js → chunk-4YBTLYYH.js} +83 -54
- package/dist/chunks/chunk-4YBTLYYH.js.map +6 -0
- package/dist/chunks/{chunk-U6U472VN.js → chunk-5DFBOMTX.js} +3 -3
- package/dist/chunks/{chunk-HV2JFRSE.js → chunk-5OGY4CE7.js} +2 -2
- package/dist/chunks/{chunk-IRUDNBAR.js → chunk-5W7CSQXQ.js} +4 -4
- package/dist/chunks/{chunk-H6AUN2YD.js → chunk-6F4PW7TF.js} +5 -5
- package/dist/chunks/{chunk-LHZSSQ6K.js → chunk-6NDJLXKW.js} +4 -4
- package/dist/chunks/{chunk-NXX6C3WS.js → chunk-6OWRRNLC.js} +2 -2
- package/dist/chunks/chunk-6ULKBT6P.js +83 -0
- package/dist/chunks/chunk-6ULKBT6P.js.map +6 -0
- package/dist/chunks/{chunk-FUJSGQYW.js → chunk-6WPKPHE2.js} +10 -10
- package/dist/chunks/{chunk-HFD2VRQP.js → chunk-6XL5ZMAL.js} +7 -5
- package/dist/chunks/chunk-6XL5ZMAL.js.map +6 -0
- package/dist/chunks/{chunk-VHFPIYVY.js → chunk-7BRK6EHB.js} +2 -2
- package/dist/chunks/{chunk-WSIMHBEQ.js → chunk-7HNWFGWD.js} +2 -2
- package/dist/chunks/{chunk-IYEDXZQZ.js → chunk-7XAUAIGO.js} +587 -441
- package/dist/chunks/chunk-7XAUAIGO.js.map +6 -0
- package/dist/chunks/{chunk-THQAGFMO.js → chunk-A72NRUYG.js} +13 -13
- package/dist/chunks/{chunk-U33GIKBK.js → chunk-ADG5OPNS.js} +4 -4
- package/dist/chunks/{chunk-HH3NBBBE.js → chunk-B7QEQ7Y3.js} +2 -2
- package/dist/chunks/{chunk-G5FWVYK2.js → chunk-BWI7L43E.js} +6 -6
- package/dist/chunks/{chunk-2OAD3CZE.js → chunk-CAOGKKB5.js} +3 -3
- package/dist/chunks/{chunk-K5FQ4G64.js → chunk-D7BXM6WW.js} +2 -2
- package/dist/chunks/{chunk-L2WEBN6A.js → chunk-DH4X2E6M.js} +2 -2
- package/dist/chunks/{chunk-L2WEBN6A.js.map → chunk-DH4X2E6M.js.map} +1 -1
- package/dist/chunks/{chunk-RJQ6WQYX.js → chunk-E3OXUQQB.js} +4 -69
- package/dist/chunks/chunk-E3OXUQQB.js.map +6 -0
- package/dist/chunks/{chunk-KZ5WYSA6.js → chunk-EPIIR5CJ.js} +9 -9
- package/dist/chunks/{chunk-M7LCVDP3.js → chunk-EVRWBRUB.js} +2 -2
- package/dist/chunks/{chunk-MYSU54EZ.js → chunk-EVZAGFTY.js} +12 -12
- package/dist/chunks/{chunk-MYSU54EZ.js.map → chunk-EVZAGFTY.js.map} +1 -1
- package/dist/chunks/{chunk-3F3V2PB7.js → chunk-FJONRQQU.js} +3 -1
- package/dist/chunks/{chunk-3F3V2PB7.js.map → chunk-FJONRQQU.js.map} +1 -1
- package/dist/chunks/{chunk-6PDIDZGX.js → chunk-GSAYGBOR.js} +24 -12
- package/dist/chunks/{chunk-6PDIDZGX.js.map → chunk-GSAYGBOR.js.map} +2 -2
- package/dist/chunks/{chunk-BICC735N.js → chunk-GXQ4G3KA.js} +3 -3
- package/dist/chunks/{chunk-THJQXERD.js → chunk-H2JLRNYH.js} +8 -8
- package/dist/chunks/{chunk-S2UDKXWH.js → chunk-H2RDYYTB.js} +2 -2
- package/dist/chunks/{chunk-P6RUYL3F.js → chunk-H5H6HDRA.js} +3 -3
- package/dist/chunks/{chunk-6TT7NXLP.js → chunk-HB4LEJMU.js} +20 -337
- package/dist/chunks/chunk-HB4LEJMU.js.map +6 -0
- package/dist/chunks/{chunk-ADCVLGQO.js → chunk-HIJXUSOS.js} +3 -3
- package/dist/chunks/{chunk-GAEZQRQI.js → chunk-HYPNAC4H.js} +3 -3
- package/dist/chunks/{chunk-OENL667J.js → chunk-I6W3KJR3.js} +2 -2
- package/dist/chunks/{chunk-HGIIAAEG.js → chunk-IFEBBQ2M.js} +3 -3
- package/dist/chunks/{chunk-X7WLWVR7.js → chunk-IPVDXTWF.js} +2 -2
- package/dist/chunks/{chunk-FZR4XULA.js → chunk-IZDYKTPN.js} +6 -6
- package/dist/chunks/{chunk-7TBETDTX.js → chunk-JCLZ5HXI.js} +2 -2
- package/dist/chunks/{chunk-7NJAEWFK.js → chunk-JU7JQ62S.js} +3 -3
- package/dist/chunks/{chunk-JAB62RI5.js → chunk-KY2WSKNM.js} +2 -2
- package/dist/chunks/{chunk-THUX2WOG.js → chunk-L3XUPXPP.js} +12 -12
- package/dist/chunks/{chunk-Y2PZNQH5.js → chunk-LMVXENEF.js} +3 -3
- package/dist/chunks/{chunk-GCFXQSN6.js → chunk-LOKFLXQL.js} +2 -2
- package/dist/chunks/{chunk-BOM64EUQ.js → chunk-NFATUZMX.js} +2 -2
- package/dist/chunks/{chunk-VAP6YMB6.js → chunk-NGMXEU2B.js} +2 -2
- package/dist/chunks/{chunk-J2FGTLZV.js → chunk-NI3LZ6UX.js} +2 -2
- package/dist/chunks/{chunk-TFOIA3U3.js → chunk-NS4PN3SI.js} +2 -2
- package/dist/chunks/{chunk-ANHFJD66.js → chunk-NZ6DX5CL.js} +4 -4
- package/dist/chunks/{chunk-B6INWHLR.js → chunk-PAY5TGHV.js} +3 -3
- package/dist/chunks/{chunk-KVCYYXCS.js → chunk-PFFQOCEI.js} +2 -2
- package/dist/chunks/{chunk-E3FA5H3Q.js → chunk-POKKY7MR.js} +6 -5
- package/dist/chunks/chunk-POKKY7MR.js.map +6 -0
- package/dist/chunks/{chunk-CDDS3UKB.js → chunk-PQTS7XQB.js} +12 -12
- package/dist/chunks/{chunk-6ZEHXLF7.js → chunk-Q6DM2TVI.js} +2 -2
- package/dist/chunks/{chunk-MKRYUMLP.js → chunk-Q6RZ64FS.js} +5 -5
- package/dist/chunks/{chunk-VGUU6E6X.js → chunk-Q7ELMF4C.js} +6 -6
- package/dist/chunks/chunk-QLDUL46Z.js +338 -0
- package/dist/chunks/chunk-QLDUL46Z.js.map +6 -0
- package/dist/chunks/{chunk-TUF4NNJV.js → chunk-QWVWGW6I.js} +2 -2
- package/dist/chunks/{chunk-VY377HAA.js → chunk-QXNROEIH.js} +4 -4
- package/dist/chunks/{chunk-S7WRWA25.js → chunk-RI2KAZJO.js} +2 -2
- package/dist/chunks/{chunk-S7WRWA25.js.map → chunk-RI2KAZJO.js.map} +1 -1
- package/dist/chunks/{chunk-2YCPLLUW.js → chunk-RISNSR62.js} +4 -4
- package/dist/chunks/{chunk-2YCPLLUW.js.map → chunk-RISNSR62.js.map} +1 -1
- package/dist/chunks/{chunk-WG32TSVL.js → chunk-RPCJJZTI.js} +3 -3
- package/dist/chunks/{chunk-P7MNE6YP.js → chunk-T3NLKQO2.js} +4 -4
- package/dist/chunks/{chunk-EFU2OFEK.js → chunk-TCRGKEEX.js} +42 -2
- package/dist/chunks/chunk-TCRGKEEX.js.map +6 -0
- package/dist/chunks/{chunk-43PTHA5N.js → chunk-TGPKTH2S.js} +2 -2
- package/dist/chunks/{chunk-667W6Z5W.js → chunk-TOJSNO4M.js} +5 -5
- package/dist/chunks/{chunk-L6QJZZCJ.js → chunk-U4YXQWPW.js} +6 -6
- package/dist/chunks/{chunk-P6FEQPES.js → chunk-U5BN3L3Y.js} +2 -2
- package/dist/chunks/{chunk-TKIWAXRU.js → chunk-UQJPNUDU.js} +7 -7
- package/dist/chunks/{chunk-S766UWAQ.js → chunk-V26FS5VG.js} +2 -2
- package/dist/chunks/{chunk-LR4QQMJH.js → chunk-V3R3MR7F.js} +4 -4
- package/dist/chunks/chunk-V45XJDX3.js +176 -0
- package/dist/chunks/chunk-V45XJDX3.js.map +6 -0
- package/dist/chunks/{chunk-NUNOIP4Y.js → chunk-VPJG7NQL.js} +2 -2
- package/dist/chunks/{chunk-AHNXQAYZ.js → chunk-VZC7FE4F.js} +91 -100
- package/dist/chunks/chunk-VZC7FE4F.js.map +6 -0
- package/dist/chunks/{chunk-43HR3AF5.js → chunk-W6E3PSFH.js} +2 -2
- package/dist/chunks/{chunk-24FBGXYR.js → chunk-WNOB6C62.js} +2 -2
- package/dist/chunks/{chunk-U3EQTU4G.js → chunk-X2F5ZFBV.js} +4 -4
- package/dist/chunks/{chunk-7DR7EU3J.js → chunk-X4TNXFUB.js} +59 -36
- package/dist/chunks/chunk-X4TNXFUB.js.map +6 -0
- package/dist/chunks/{chunk-YLNQLDMP.js → chunk-XHR3UCKT.js} +4 -4
- package/dist/chunks/{chunk-X4WCRRZV.js → chunk-XK26JNIF.js} +6 -6
- package/dist/chunks/{chunk-JKPUOSDC.js → chunk-XN7C5GWO.js} +2 -2
- package/dist/chunks/{chunk-46OOPRR6.js → chunk-XOIXLN2Y.js} +3 -3
- package/dist/chunks/{chunk-D23EJNO5.js → chunk-ZB45QDNU.js} +3 -3
- package/dist/chunks/{cli-runtime-QWBGE2VF.js → cli-runtime-QOMHGRZL.js} +12 -11
- package/dist/chunks/cli-runtime-QOMHGRZL.js.map +6 -0
- package/dist/chunks/{commands-LVUUZ6LF.js → commands-56WUDKVN.js} +5 -5
- package/dist/chunks/{crash-report-PGXMRS5P.js → crash-report-KHJZ3AKU.js} +6 -6
- package/dist/chunks/{dist-JRBSW53E.js → dist-7UW2VLWO.js} +3 -2
- package/dist/chunks/{dist-JRBSW53E.js.map → dist-7UW2VLWO.js.map} +1 -1
- package/dist/chunks/{dist-VON3NRHE.js → dist-BLC5XSXL.js} +185 -120
- package/dist/chunks/dist-BLC5XSXL.js.map +6 -0
- package/dist/chunks/{dist-NSCNMOX7.js → dist-BLCQRSQS.js} +2 -2
- package/dist/chunks/{dist-V4SNHHMB.js → dist-GUHZ3EE6.js} +5 -2
- package/dist/chunks/dist-GUHZ3EE6.js.map +6 -0
- package/dist/chunks/{dist-6HN2ZMLV.js → dist-L757TGUH.js} +3 -3
- package/dist/chunks/dist-L757TGUH.js.map +6 -0
- package/dist/chunks/{dist-TC6H7TPQ.js → dist-QZPA2XDK.js} +6 -2
- package/dist/chunks/{dist-VV3V36IP.js → dist-SEXSU4PO.js} +4 -2
- package/dist/chunks/{dist-VV3V36IP.js.map → dist-SEXSU4PO.js.map} +1 -1
- package/dist/chunks/{dist-JJANJMY5.js → dist-Y6IO47UU.js} +3 -2
- package/dist/chunks/{dist-JJANJMY5.js.map → dist-Y6IO47UU.js.map} +1 -1
- package/dist/chunks/{doctor-P7L35KGN.js → doctor-LCRG5FBA.js} +16 -16
- package/dist/chunks/{drain-HOHRXIYY.js → drain-47IMDCI5.js} +10 -10
- package/dist/chunks/{entry-L7XZIE7J.js → entry-P6YPWRQW.js} +27 -21
- package/dist/chunks/{entry-L7XZIE7J.js.map → entry-P6YPWRQW.js.map} +1 -1
- package/dist/chunks/{eval-2F473JAC.js → eval-5ZIBALCB.js} +2 -2
- package/dist/chunks/{exec-VCM4AL2S.js → exec-ELIM7XVY.js} +53 -36
- package/dist/chunks/exec-ELIM7XVY.js.map +6 -0
- package/dist/chunks/{home-R6WCBSOT.js → home-DXPCVXZK.js} +3 -3
- package/dist/chunks/host-QE4D3UXC.js +30 -0
- package/dist/chunks/{host-queries-QWV47CFK.js → host-queries-5H765XNX.js} +17 -17
- package/dist/chunks/{learn-3UPHM5OI.js → learn-Y5IBBZDY.js} +13 -13
- package/dist/chunks/{learn-builtin-3Q4BJFCF.js → learn-builtin-ND3T6U5L.js} +16 -16
- package/dist/chunks/{lifecycle-EJLVISCU.js → lifecycle-FJS7LD7B.js} +31 -30
- package/dist/chunks/{list-DQJBF4AB.js → list-6HQMG7TU.js} +12 -11
- package/dist/chunks/list-6HQMG7TU.js.map +6 -0
- package/dist/chunks/{live-IWDOVSLG.js → live-CSA2LX3R.js} +15 -15
- package/dist/chunks/{login-B2PHE6IL.js → login-42ZPPMYK.js} +13 -13
- package/dist/chunks/{logs-5UTV3FMG.js → logs-7MAFXNFR.js} +4 -4
- package/dist/chunks/{mcp-JN36OQLX.js → mcp-5RQSD6QV.js} +22 -21
- package/dist/chunks/mcp-5RQSD6QV.js.map +6 -0
- package/dist/chunks/{message-command-RMLQ2PU5.js → message-command-V3CL4DNT.js} +46 -44
- package/dist/chunks/message-command-V3CL4DNT.js.map +6 -0
- package/dist/chunks/{mouse-WFSJSLQD.js → mouse-EJQML44I.js} +2 -2
- package/dist/chunks/{open-LDBJL43A.js → open-3I5NZTSX.js} +8 -8
- package/dist/chunks/{operator-tools-NA7PLRIP.js → operator-tools-PK2WYSF3.js} +14 -14
- package/dist/chunks/{output-schema-UKYWRZPS.js → output-schema-2UJ7LOOX.js} +3 -3
- package/dist/chunks/{pal-MAVUNYMB.js → pal-WXN4O3DD.js} +16 -16
- package/dist/chunks/{palette-WDPS7W6Q.js → palette-CL5OOYGK.js} +10 -4
- package/dist/chunks/{peers-FBTQW2SY.js → peers-JQOUU3CX.js} +6 -6
- package/dist/chunks/{prefix-MLAG4KTK.js → prefix-3ZNPUSUK.js} +2 -2
- package/dist/chunks/{providers-M75ET3GT.js → providers-SI467SWN.js} +11 -11
- package/dist/chunks/{pty-VMUEEJRN.js → pty-T5LBAATA.js} +3 -3
- package/dist/chunks/{resident-URNRPE2S.js → resident-NGQORA2W.js} +26 -25
- package/dist/chunks/resident-NGQORA2W.js.map +6 -0
- package/dist/chunks/resume-GPXJJXCK.js +24 -0
- package/dist/chunks/{resume-command-5QGHV6WR.js → resume-command-V6ZKY7J6.js} +4 -4
- package/dist/chunks/{schedule-BK3WF2VK.js → schedule-4L4DTRC5.js} +8 -8
- package/dist/chunks/{service-VWASFP3R.js → service-EV6VQYJD.js} +30 -29
- package/dist/chunks/service-EV6VQYJD.js.map +6 -0
- package/dist/chunks/{session-step-DORV5FER.js → session-step-ZCZNC52S.js} +15 -15
- package/dist/chunks/{skills-TDDPMTQI.js → skills-QARQHL6M.js} +8 -8
- package/dist/chunks/{start-check-N4TPV2TM.js → start-check-W72K6M5Q.js} +2 -2
- package/dist/chunks/{state-SHLWYVZU.js → state-ADQWQEYB.js} +2 -2
- package/dist/chunks/store-IVVYIPV2.js +21 -0
- package/dist/chunks/{store-GUSFCKJA.js → store-KOGQWG66.js} +11 -11
- package/dist/chunks/{store-CQVUIU7K.js → store-RF6D7U2T.js} +6 -6
- package/dist/chunks/{store-75YZOOZI.js → store-TFJ73ZAM.js} +4 -4
- package/dist/chunks/{tui-PGHWYFN4.js → tui-CCAGK7BG.js} +464 -161
- package/dist/chunks/tui-CCAGK7BG.js.map +6 -0
- package/dist/chunks/{upgrade-RHPZQ33L.js → upgrade-LN6TFWDW.js} +6 -6
- package/dist/chunks/{spaces-AEOU6MSZ.js → workspaces-5ZKKOX4X.js} +79 -53
- package/dist/chunks/workspaces-5ZKKOX4X.js.map +6 -0
- package/dist/chunks/{worktree-5IYFN33C.js → worktree-5M2XFFJT.js} +13 -13
- package/dist/cli.d.ts.map +1 -1
- package/dist/commands/desktop-host.d.ts.map +1 -1
- package/dist/commands/exec-json.d.ts.map +1 -1
- package/dist/commands/exec.d.ts.map +1 -1
- package/dist/commands/manifest.d.ts +1 -1
- package/dist/commands/manifest.d.ts.map +1 -1
- package/dist/commands/workspaces.d.ts +49 -0
- package/dist/commands/workspaces.d.ts.map +1 -0
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/schema.d.ts +22 -3
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/context/runtime-message.d.ts.map +1 -1
- package/dist/doctor/checks/terminal.d.ts +1 -1
- package/dist/doctor/checks/terminal.d.ts.map +1 -1
- package/dist/index.js +21 -20
- package/dist/integrations/accounts/host-facts.d.ts +1 -1
- package/dist/integrations/learning/session-feed.d.ts.map +1 -1
- package/dist/integrations/peers/runtime.d.ts +1 -1
- package/dist/integrations/peers/runtime.d.ts.map +1 -1
- package/dist/integrations/resident/runner-worker.js +21 -21
- package/dist/rounds/types.d.ts +6 -0
- package/dist/rounds/types.d.ts.map +1 -1
- package/dist/tui/App.d.ts +19 -7
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/Composer.d.ts +10 -4
- package/dist/tui/Composer.d.ts.map +1 -1
- package/dist/tui/agent.d.ts +27 -0
- package/dist/tui/agent.d.ts.map +1 -1
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/live-model-step.d.ts +16 -0
- package/dist/tui/live-model-step.d.ts.map +1 -0
- package/dist/tui/model-refusal.d.ts +36 -0
- package/dist/tui/model-refusal.d.ts.map +1 -0
- package/dist/tui/plain-interruption.d.ts.map +1 -1
- package/dist/tui/slashCommands.d.ts +22 -0
- package/dist/tui/slashCommands.d.ts.map +1 -1
- package/dist/tui/turn-interruption.d.ts.map +1 -1
- package/dist/tui/types.d.ts +2 -0
- package/dist/tui/types.d.ts.map +1 -1
- package/dist/tui/zoom/entry.d.ts +6 -6
- package/dist/tui/zoom/entry.d.ts.map +1 -1
- package/dist/tui/zoom/gesture.d.ts +2 -2
- package/dist/tui/zoom/gesture.d.ts.map +1 -1
- package/dist/tui/zoom/leave.d.ts +2 -2
- package/dist/tui/zoom/leave.d.ts.map +1 -1
- package/dist/tui/zoom/local.d.ts +3 -3
- package/dist/tui/zoom/local.d.ts.map +1 -1
- package/dist/{spaces → workspaces}/git.d.ts +1 -1
- package/dist/workspaces/git.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/goto.d.ts +7 -7
- package/dist/workspaces/goto.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/host.d.ts +61 -52
- package/dist/workspaces/host.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/input.d.ts +1 -1
- package/dist/workspaces/input.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/keymap.d.ts +2 -2
- package/dist/workspaces/keymap.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/layout.d.ts +6 -4
- package/dist/workspaces/layout.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/mouse.d.ts +2 -2
- package/dist/workspaces/mouse.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/overlay.d.ts +0 -1
- package/dist/workspaces/overlay.d.ts.map +1 -0
- package/dist/workspaces/palette.d.ts +75 -0
- package/dist/workspaces/palette.d.ts.map +1 -0
- package/dist/workspaces/peers.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/prefix.d.ts +1 -1
- package/dist/workspaces/prefix.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/roster.d.ts +22 -22
- package/dist/workspaces/roster.d.ts.map +1 -0
- package/dist/workspaces/selection.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/session.d.ts +1 -1
- package/dist/workspaces/session.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/sidebar.d.ts +17 -17
- package/dist/workspaces/sidebar.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/signal.d.ts +5 -3
- package/dist/workspaces/signal.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/status.d.ts +2 -2
- package/dist/workspaces/status.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/store.d.ts +25 -14
- package/dist/workspaces/store.d.ts.map +1 -0
- package/dist/workspaces/tabbar.d.ts +54 -0
- package/dist/workspaces/tabbar.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/tiling.d.ts +7 -4
- package/dist/workspaces/tiling.d.ts.map +1 -0
- package/package.json +11 -11
- package/dist/chunks/acp-XSAUUT2D.js.map +0 -6
- package/dist/chunks/add-NVXRVUGY.js.map +0 -6
- package/dist/chunks/agent-session-3A5K5VK3.js +0 -69
- package/dist/chunks/chunk-4DVCHAWN.js.map +0 -6
- package/dist/chunks/chunk-6TT7NXLP.js.map +0 -6
- package/dist/chunks/chunk-7DR7EU3J.js.map +0 -6
- package/dist/chunks/chunk-AHNXQAYZ.js.map +0 -6
- package/dist/chunks/chunk-C4MAQ64X.js.map +0 -6
- package/dist/chunks/chunk-E3FA5H3Q.js.map +0 -6
- package/dist/chunks/chunk-EFU2OFEK.js.map +0 -6
- package/dist/chunks/chunk-EXFSMYH4.js +0 -83
- package/dist/chunks/chunk-EXFSMYH4.js.map +0 -6
- package/dist/chunks/chunk-HFD2VRQP.js.map +0 -6
- package/dist/chunks/chunk-IYEDXZQZ.js.map +0 -6
- package/dist/chunks/chunk-MMZHUQZQ.js.map +0 -6
- package/dist/chunks/chunk-RJQ6WQYX.js.map +0 -6
- package/dist/chunks/cli-runtime-QWBGE2VF.js.map +0 -6
- package/dist/chunks/dist-6HN2ZMLV.js.map +0 -6
- package/dist/chunks/dist-V4SNHHMB.js.map +0 -6
- package/dist/chunks/dist-VON3NRHE.js.map +0 -6
- package/dist/chunks/exec-VCM4AL2S.js.map +0 -6
- package/dist/chunks/host-JGPJVLTC.js +0 -28
- package/dist/chunks/list-DQJBF4AB.js.map +0 -6
- package/dist/chunks/mcp-JN36OQLX.js.map +0 -6
- package/dist/chunks/message-command-RMLQ2PU5.js.map +0 -6
- package/dist/chunks/resident-URNRPE2S.js.map +0 -6
- package/dist/chunks/resume-7B3EHDJ7.js +0 -24
- package/dist/chunks/service-VWASFP3R.js.map +0 -6
- package/dist/chunks/spaces-AEOU6MSZ.js.map +0 -6
- package/dist/chunks/store-Z5H6LYVE.js +0 -17
- package/dist/chunks/tui-PGHWYFN4.js.map +0 -6
- package/dist/commands/spaces.d.ts +0 -46
- package/dist/commands/spaces.d.ts.map +0 -1
- package/dist/spaces/git.d.ts.map +0 -1
- package/dist/spaces/goto.d.ts.map +0 -1
- package/dist/spaces/host.d.ts.map +0 -1
- package/dist/spaces/input.d.ts.map +0 -1
- package/dist/spaces/keymap.d.ts.map +0 -1
- package/dist/spaces/layout.d.ts.map +0 -1
- package/dist/spaces/mouse.d.ts.map +0 -1
- package/dist/spaces/overlay.d.ts.map +0 -1
- package/dist/spaces/palette.d.ts +0 -35
- package/dist/spaces/palette.d.ts.map +0 -1
- package/dist/spaces/peers.d.ts.map +0 -1
- package/dist/spaces/prefix.d.ts.map +0 -1
- package/dist/spaces/roster.d.ts.map +0 -1
- package/dist/spaces/selection.d.ts.map +0 -1
- package/dist/spaces/session.d.ts.map +0 -1
- package/dist/spaces/sidebar.d.ts.map +0 -1
- package/dist/spaces/signal.d.ts.map +0 -1
- package/dist/spaces/status.d.ts.map +0 -1
- package/dist/spaces/store.d.ts.map +0 -1
- package/dist/spaces/tabbar.d.ts +0 -36
- package/dist/spaces/tabbar.d.ts.map +0 -1
- package/dist/spaces/tiling.d.ts.map +0 -1
- /package/dist/chunks/{activity-command-DB4DREW7.js.map → activity-command-D744W6SC.js.map} +0 -0
- /package/dist/chunks/{agent-6TD66IMV.js.map → agent-JWTNZ4PK.js.map} +0 -0
- /package/dist/chunks/{agent-session-3A5K5VK3.js.map → agent-session-OGPKSSKG.js.map} +0 -0
- /package/dist/chunks/{archive-A3X7KX2U.js.map → archive-FLZUJDJZ.js.map} +0 -0
- /package/dist/chunks/{bin-main-5PYV7WYI.js.map → bin-main-UI3NYIJE.js.map} +0 -0
- /package/dist/chunks/{binding-EMMG5PAE.js.map → binding-JQUI2CTZ.js.map} +0 -0
- /package/dist/chunks/{browser-FUFFJBRR.js.map → browser-YZCY2CI6.js.map} +0 -0
- /package/dist/chunks/{chat-M653DEAF.js.map → chat-F3WXVEDM.js.map} +0 -0
- /package/dist/chunks/{chunk-OMRU22BQ.js.map → chunk-24NEAMG5.js.map} +0 -0
- /package/dist/chunks/{chunk-325X27UO.js.map → chunk-4E33SWZU.js.map} +0 -0
- /package/dist/chunks/{chunk-U6U472VN.js.map → chunk-5DFBOMTX.js.map} +0 -0
- /package/dist/chunks/{chunk-HV2JFRSE.js.map → chunk-5OGY4CE7.js.map} +0 -0
- /package/dist/chunks/{chunk-IRUDNBAR.js.map → chunk-5W7CSQXQ.js.map} +0 -0
- /package/dist/chunks/{chunk-H6AUN2YD.js.map → chunk-6F4PW7TF.js.map} +0 -0
- /package/dist/chunks/{chunk-LHZSSQ6K.js.map → chunk-6NDJLXKW.js.map} +0 -0
- /package/dist/chunks/{chunk-NXX6C3WS.js.map → chunk-6OWRRNLC.js.map} +0 -0
- /package/dist/chunks/{chunk-FUJSGQYW.js.map → chunk-6WPKPHE2.js.map} +0 -0
- /package/dist/chunks/{chunk-VHFPIYVY.js.map → chunk-7BRK6EHB.js.map} +0 -0
- /package/dist/chunks/{chunk-WSIMHBEQ.js.map → chunk-7HNWFGWD.js.map} +0 -0
- /package/dist/chunks/{chunk-THQAGFMO.js.map → chunk-A72NRUYG.js.map} +0 -0
- /package/dist/chunks/{chunk-U33GIKBK.js.map → chunk-ADG5OPNS.js.map} +0 -0
- /package/dist/chunks/{chunk-HH3NBBBE.js.map → chunk-B7QEQ7Y3.js.map} +0 -0
- /package/dist/chunks/{chunk-G5FWVYK2.js.map → chunk-BWI7L43E.js.map} +0 -0
- /package/dist/chunks/{chunk-2OAD3CZE.js.map → chunk-CAOGKKB5.js.map} +0 -0
- /package/dist/chunks/{chunk-K5FQ4G64.js.map → chunk-D7BXM6WW.js.map} +0 -0
- /package/dist/chunks/{chunk-KZ5WYSA6.js.map → chunk-EPIIR5CJ.js.map} +0 -0
- /package/dist/chunks/{chunk-M7LCVDP3.js.map → chunk-EVRWBRUB.js.map} +0 -0
- /package/dist/chunks/{chunk-BICC735N.js.map → chunk-GXQ4G3KA.js.map} +0 -0
- /package/dist/chunks/{chunk-THJQXERD.js.map → chunk-H2JLRNYH.js.map} +0 -0
- /package/dist/chunks/{chunk-S2UDKXWH.js.map → chunk-H2RDYYTB.js.map} +0 -0
- /package/dist/chunks/{chunk-P6RUYL3F.js.map → chunk-H5H6HDRA.js.map} +0 -0
- /package/dist/chunks/{chunk-ADCVLGQO.js.map → chunk-HIJXUSOS.js.map} +0 -0
- /package/dist/chunks/{chunk-GAEZQRQI.js.map → chunk-HYPNAC4H.js.map} +0 -0
- /package/dist/chunks/{chunk-OENL667J.js.map → chunk-I6W3KJR3.js.map} +0 -0
- /package/dist/chunks/{chunk-HGIIAAEG.js.map → chunk-IFEBBQ2M.js.map} +0 -0
- /package/dist/chunks/{chunk-X7WLWVR7.js.map → chunk-IPVDXTWF.js.map} +0 -0
- /package/dist/chunks/{chunk-FZR4XULA.js.map → chunk-IZDYKTPN.js.map} +0 -0
- /package/dist/chunks/{chunk-7TBETDTX.js.map → chunk-JCLZ5HXI.js.map} +0 -0
- /package/dist/chunks/{chunk-7NJAEWFK.js.map → chunk-JU7JQ62S.js.map} +0 -0
- /package/dist/chunks/{chunk-JAB62RI5.js.map → chunk-KY2WSKNM.js.map} +0 -0
- /package/dist/chunks/{chunk-THUX2WOG.js.map → chunk-L3XUPXPP.js.map} +0 -0
- /package/dist/chunks/{chunk-Y2PZNQH5.js.map → chunk-LMVXENEF.js.map} +0 -0
- /package/dist/chunks/{chunk-GCFXQSN6.js.map → chunk-LOKFLXQL.js.map} +0 -0
- /package/dist/chunks/{chunk-BOM64EUQ.js.map → chunk-NFATUZMX.js.map} +0 -0
- /package/dist/chunks/{chunk-VAP6YMB6.js.map → chunk-NGMXEU2B.js.map} +0 -0
- /package/dist/chunks/{chunk-J2FGTLZV.js.map → chunk-NI3LZ6UX.js.map} +0 -0
- /package/dist/chunks/{chunk-TFOIA3U3.js.map → chunk-NS4PN3SI.js.map} +0 -0
- /package/dist/chunks/{chunk-ANHFJD66.js.map → chunk-NZ6DX5CL.js.map} +0 -0
- /package/dist/chunks/{chunk-B6INWHLR.js.map → chunk-PAY5TGHV.js.map} +0 -0
- /package/dist/chunks/{chunk-KVCYYXCS.js.map → chunk-PFFQOCEI.js.map} +0 -0
- /package/dist/chunks/{chunk-CDDS3UKB.js.map → chunk-PQTS7XQB.js.map} +0 -0
- /package/dist/chunks/{chunk-6ZEHXLF7.js.map → chunk-Q6DM2TVI.js.map} +0 -0
- /package/dist/chunks/{chunk-MKRYUMLP.js.map → chunk-Q6RZ64FS.js.map} +0 -0
- /package/dist/chunks/{chunk-VGUU6E6X.js.map → chunk-Q7ELMF4C.js.map} +0 -0
- /package/dist/chunks/{chunk-TUF4NNJV.js.map → chunk-QWVWGW6I.js.map} +0 -0
- /package/dist/chunks/{chunk-VY377HAA.js.map → chunk-QXNROEIH.js.map} +0 -0
- /package/dist/chunks/{chunk-WG32TSVL.js.map → chunk-RPCJJZTI.js.map} +0 -0
- /package/dist/chunks/{chunk-P7MNE6YP.js.map → chunk-T3NLKQO2.js.map} +0 -0
- /package/dist/chunks/{chunk-43PTHA5N.js.map → chunk-TGPKTH2S.js.map} +0 -0
- /package/dist/chunks/{chunk-667W6Z5W.js.map → chunk-TOJSNO4M.js.map} +0 -0
- /package/dist/chunks/{chunk-L6QJZZCJ.js.map → chunk-U4YXQWPW.js.map} +0 -0
- /package/dist/chunks/{chunk-P6FEQPES.js.map → chunk-U5BN3L3Y.js.map} +0 -0
- /package/dist/chunks/{chunk-TKIWAXRU.js.map → chunk-UQJPNUDU.js.map} +0 -0
- /package/dist/chunks/{chunk-S766UWAQ.js.map → chunk-V26FS5VG.js.map} +0 -0
- /package/dist/chunks/{chunk-LR4QQMJH.js.map → chunk-V3R3MR7F.js.map} +0 -0
- /package/dist/chunks/{chunk-NUNOIP4Y.js.map → chunk-VPJG7NQL.js.map} +0 -0
- /package/dist/chunks/{chunk-43HR3AF5.js.map → chunk-W6E3PSFH.js.map} +0 -0
- /package/dist/chunks/{chunk-24FBGXYR.js.map → chunk-WNOB6C62.js.map} +0 -0
- /package/dist/chunks/{chunk-U3EQTU4G.js.map → chunk-X2F5ZFBV.js.map} +0 -0
- /package/dist/chunks/{chunk-YLNQLDMP.js.map → chunk-XHR3UCKT.js.map} +0 -0
- /package/dist/chunks/{chunk-X4WCRRZV.js.map → chunk-XK26JNIF.js.map} +0 -0
- /package/dist/chunks/{chunk-JKPUOSDC.js.map → chunk-XN7C5GWO.js.map} +0 -0
- /package/dist/chunks/{chunk-46OOPRR6.js.map → chunk-XOIXLN2Y.js.map} +0 -0
- /package/dist/chunks/{chunk-D23EJNO5.js.map → chunk-ZB45QDNU.js.map} +0 -0
- /package/dist/chunks/{commands-LVUUZ6LF.js.map → commands-56WUDKVN.js.map} +0 -0
- /package/dist/chunks/{crash-report-PGXMRS5P.js.map → crash-report-KHJZ3AKU.js.map} +0 -0
- /package/dist/chunks/{dist-NSCNMOX7.js.map → dist-BLCQRSQS.js.map} +0 -0
- /package/dist/chunks/{dist-TC6H7TPQ.js.map → dist-QZPA2XDK.js.map} +0 -0
- /package/dist/chunks/{doctor-P7L35KGN.js.map → doctor-LCRG5FBA.js.map} +0 -0
- /package/dist/chunks/{drain-HOHRXIYY.js.map → drain-47IMDCI5.js.map} +0 -0
- /package/dist/chunks/{eval-2F473JAC.js.map → eval-5ZIBALCB.js.map} +0 -0
- /package/dist/chunks/{home-R6WCBSOT.js.map → home-DXPCVXZK.js.map} +0 -0
- /package/dist/chunks/{host-JGPJVLTC.js.map → host-QE4D3UXC.js.map} +0 -0
- /package/dist/chunks/{host-queries-QWV47CFK.js.map → host-queries-5H765XNX.js.map} +0 -0
- /package/dist/chunks/{learn-3UPHM5OI.js.map → learn-Y5IBBZDY.js.map} +0 -0
- /package/dist/chunks/{learn-builtin-3Q4BJFCF.js.map → learn-builtin-ND3T6U5L.js.map} +0 -0
- /package/dist/chunks/{lifecycle-EJLVISCU.js.map → lifecycle-FJS7LD7B.js.map} +0 -0
- /package/dist/chunks/{live-IWDOVSLG.js.map → live-CSA2LX3R.js.map} +0 -0
- /package/dist/chunks/{login-B2PHE6IL.js.map → login-42ZPPMYK.js.map} +0 -0
- /package/dist/chunks/{logs-5UTV3FMG.js.map → logs-7MAFXNFR.js.map} +0 -0
- /package/dist/chunks/{mouse-WFSJSLQD.js.map → mouse-EJQML44I.js.map} +0 -0
- /package/dist/chunks/{open-LDBJL43A.js.map → open-3I5NZTSX.js.map} +0 -0
- /package/dist/chunks/{operator-tools-NA7PLRIP.js.map → operator-tools-PK2WYSF3.js.map} +0 -0
- /package/dist/chunks/{output-schema-UKYWRZPS.js.map → output-schema-2UJ7LOOX.js.map} +0 -0
- /package/dist/chunks/{pal-MAVUNYMB.js.map → pal-WXN4O3DD.js.map} +0 -0
- /package/dist/chunks/{palette-WDPS7W6Q.js.map → palette-CL5OOYGK.js.map} +0 -0
- /package/dist/chunks/{peers-FBTQW2SY.js.map → peers-JQOUU3CX.js.map} +0 -0
- /package/dist/chunks/{prefix-MLAG4KTK.js.map → prefix-3ZNPUSUK.js.map} +0 -0
- /package/dist/chunks/{providers-M75ET3GT.js.map → providers-SI467SWN.js.map} +0 -0
- /package/dist/chunks/{pty-VMUEEJRN.js.map → pty-T5LBAATA.js.map} +0 -0
- /package/dist/chunks/{resume-7B3EHDJ7.js.map → resume-GPXJJXCK.js.map} +0 -0
- /package/dist/chunks/{resume-command-5QGHV6WR.js.map → resume-command-V6ZKY7J6.js.map} +0 -0
- /package/dist/chunks/{schedule-BK3WF2VK.js.map → schedule-4L4DTRC5.js.map} +0 -0
- /package/dist/chunks/{session-step-DORV5FER.js.map → session-step-ZCZNC52S.js.map} +0 -0
- /package/dist/chunks/{skills-TDDPMTQI.js.map → skills-QARQHL6M.js.map} +0 -0
- /package/dist/chunks/{start-check-N4TPV2TM.js.map → start-check-W72K6M5Q.js.map} +0 -0
- /package/dist/chunks/{state-SHLWYVZU.js.map → state-ADQWQEYB.js.map} +0 -0
- /package/dist/chunks/{store-75YZOOZI.js.map → store-IVVYIPV2.js.map} +0 -0
- /package/dist/chunks/{store-CQVUIU7K.js.map → store-KOGQWG66.js.map} +0 -0
- /package/dist/chunks/{store-GUSFCKJA.js.map → store-RF6D7U2T.js.map} +0 -0
- /package/dist/chunks/{store-Z5H6LYVE.js.map → store-TFJ73ZAM.js.map} +0 -0
- /package/dist/chunks/{upgrade-RHPZQ33L.js.map → upgrade-LN6TFWDW.js.map} +0 -0
- /package/dist/chunks/{worktree-5IYFN33C.js.map → worktree-5M2XFFJT.js.map} +0 -0
- /package/dist/{spaces → workspaces}/peers.d.ts +0 -0
- /package/dist/{spaces → workspaces}/selection.d.ts +0 -0
|
@@ -6,21 +6,21 @@ import {
|
|
|
6
6
|
bypassKey,
|
|
7
7
|
createClipboardCopier,
|
|
8
8
|
describeCopy
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-GSAYGBOR.js";
|
|
10
10
|
import {
|
|
11
11
|
LEAVE_SCREEN,
|
|
12
12
|
LEAVE_TO_NATIVE,
|
|
13
13
|
enterScreen,
|
|
14
14
|
mouseOn
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-DH4X2E6M.js";
|
|
16
16
|
import {
|
|
17
|
-
|
|
17
|
+
colorLevel,
|
|
18
18
|
paletteFor
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-V45XJDX3.js";
|
|
20
20
|
import {
|
|
21
21
|
recordForPid,
|
|
22
22
|
recordForSlot
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-RISNSR62.js";
|
|
24
24
|
import {
|
|
25
25
|
HeadlessScreen
|
|
26
26
|
} from "./chunk-GWGIAZLZ.js";
|
|
@@ -37,9 +37,12 @@ import {
|
|
|
37
37
|
import {
|
|
38
38
|
formatResetTime
|
|
39
39
|
} from "./chunk-YOWYTBJS.js";
|
|
40
|
+
import {
|
|
41
|
+
activeThemeName
|
|
42
|
+
} from "./chunk-2IPDTDB3.js";
|
|
40
43
|
import {
|
|
41
44
|
killProcessTree
|
|
42
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-IPVDXTWF.js";
|
|
43
46
|
import {
|
|
44
47
|
stringWidth
|
|
45
48
|
} from "./chunk-U5UV2YRE.js";
|
|
@@ -47,7 +50,7 @@ import {
|
|
|
47
50
|
__name
|
|
48
51
|
} from "./chunk-76FLAFCG.js";
|
|
49
52
|
|
|
50
|
-
// src/
|
|
53
|
+
// src/workspaces/host.ts
|
|
51
54
|
import { randomUUID } from "node:crypto";
|
|
52
55
|
import { existsSync, statSync, writeSync } from "node:fs";
|
|
53
56
|
import { homedir } from "node:os";
|
|
@@ -223,7 +226,7 @@ var DiffWriter = class {
|
|
|
223
226
|
}
|
|
224
227
|
};
|
|
225
228
|
|
|
226
|
-
// src/
|
|
229
|
+
// src/workspaces/git.ts
|
|
227
230
|
import { execFile } from "node:child_process";
|
|
228
231
|
var GIT_TIMEOUT_MS = 2e3;
|
|
229
232
|
function run(cwd, args) {
|
|
@@ -298,7 +301,7 @@ var GitCache = class {
|
|
|
298
301
|
}
|
|
299
302
|
};
|
|
300
303
|
|
|
301
|
-
// src/
|
|
304
|
+
// src/workspaces/status.ts
|
|
302
305
|
var PRIORITY = ["blocked", "done", "working", "idle", "none"];
|
|
303
306
|
function deriveActivity(child, reported) {
|
|
304
307
|
if (child === "none") return "not-started";
|
|
@@ -320,19 +323,19 @@ function aggregateDot(dots) {
|
|
|
320
323
|
return "none";
|
|
321
324
|
}
|
|
322
325
|
__name(aggregateDot, "aggregateDot");
|
|
323
|
-
function
|
|
326
|
+
function workspaceNote(dot) {
|
|
324
327
|
if (dot === "blocked") return "needs approval";
|
|
325
328
|
if (dot === "done") return "finished, not seen";
|
|
326
329
|
return void 0;
|
|
327
330
|
}
|
|
328
|
-
__name(
|
|
331
|
+
__name(workspaceNote, "workspaceNote");
|
|
329
332
|
function limitedNote(until, now) {
|
|
330
333
|
if (until === void 0) return "may be limited";
|
|
331
334
|
return `limited until ${formatResetTime(until, now)}`;
|
|
332
335
|
}
|
|
333
336
|
__name(limitedNote, "limitedNote");
|
|
334
337
|
|
|
335
|
-
// src/
|
|
338
|
+
// src/workspaces/tiling.ts
|
|
336
339
|
var MIN_RATIO = 0.1;
|
|
337
340
|
var MAX_RATIO = 0.9;
|
|
338
341
|
var MIN_PANE_WIDTH = 12;
|
|
@@ -409,6 +412,7 @@ function resizeAt(node, entry, axis, forward, step = RESIZE_STEP) {
|
|
|
409
412
|
return true;
|
|
410
413
|
}
|
|
411
414
|
__name(resizeAt, "resizeAt");
|
|
415
|
+
var SPLIT_GAP = 1;
|
|
412
416
|
function shrink(rect) {
|
|
413
417
|
return {
|
|
414
418
|
x: rect.x + 1,
|
|
@@ -438,15 +442,23 @@ function place(root, area) {
|
|
|
438
442
|
return;
|
|
439
443
|
}
|
|
440
444
|
if (node.dir === "side") {
|
|
441
|
-
const first = firstShare(rect.width, node.ratio, MIN_PANE_WIDTH);
|
|
445
|
+
const first = firstShare(rect.width - SPLIT_GAP, node.ratio, MIN_PANE_WIDTH);
|
|
442
446
|
dividers.push({ split: node, area: rect, at: rect.x + first });
|
|
443
|
-
walk(node.a, { ...rect, width: first });
|
|
444
|
-
walk(node.b, {
|
|
447
|
+
walk(node.a, { ...rect, width: Math.max(1, first) });
|
|
448
|
+
walk(node.b, {
|
|
449
|
+
...rect,
|
|
450
|
+
x: rect.x + first + SPLIT_GAP,
|
|
451
|
+
width: Math.max(1, rect.width - first - SPLIT_GAP)
|
|
452
|
+
});
|
|
445
453
|
} else {
|
|
446
|
-
const first = firstShare(rect.height, node.ratio, MIN_PANE_HEIGHT);
|
|
454
|
+
const first = firstShare(rect.height - SPLIT_GAP, node.ratio, MIN_PANE_HEIGHT);
|
|
447
455
|
dividers.push({ split: node, area: rect, at: rect.y + first });
|
|
448
|
-
walk(node.a, { ...rect, height: first });
|
|
449
|
-
walk(node.b, {
|
|
456
|
+
walk(node.a, { ...rect, height: Math.max(1, first) });
|
|
457
|
+
walk(node.b, {
|
|
458
|
+
...rect,
|
|
459
|
+
y: rect.y + first + SPLIT_GAP,
|
|
460
|
+
height: Math.max(1, rect.height - first - SPLIT_GAP)
|
|
461
|
+
});
|
|
450
462
|
}
|
|
451
463
|
}, "walk");
|
|
452
464
|
walk(root, area);
|
|
@@ -454,7 +466,7 @@ function place(root, area) {
|
|
|
454
466
|
}
|
|
455
467
|
__name(place, "place");
|
|
456
468
|
function ratioFor(divider, at) {
|
|
457
|
-
const total = divider.split.dir === "side" ? divider.area.width : divider.area.height;
|
|
469
|
+
const total = (divider.split.dir === "side" ? divider.area.width : divider.area.height) - SPLIT_GAP;
|
|
458
470
|
const start = divider.split.dir === "side" ? divider.area.x : divider.area.y;
|
|
459
471
|
return clampRatio((at - start) / total);
|
|
460
472
|
}
|
|
@@ -463,8 +475,8 @@ function dividerAt(dividers, x, y) {
|
|
|
463
475
|
return dividers.find((d) => {
|
|
464
476
|
const { area } = d;
|
|
465
477
|
if (d.split.dir === "side")
|
|
466
|
-
return
|
|
467
|
-
return
|
|
478
|
+
return x >= d.at - 1 && x <= d.at + SPLIT_GAP && y >= area.y && y < area.y + area.height;
|
|
479
|
+
return y >= d.at - 1 && y <= d.at + SPLIT_GAP && x >= area.x && x < area.x + area.width;
|
|
468
480
|
});
|
|
469
481
|
}
|
|
470
482
|
__name(dividerAt, "dividerAt");
|
|
@@ -496,7 +508,7 @@ function neighbour(panes, from, direction) {
|
|
|
496
508
|
if (across === 0) continue;
|
|
497
509
|
const start = horizontal ? outer.y : outer.x;
|
|
498
510
|
const length = horizontal ? outer.height : outer.width;
|
|
499
|
-
const covers = middle >= start && middle < start + length;
|
|
511
|
+
const covers = middle >= start - SPLIT_GAP && middle < start + length;
|
|
500
512
|
if (!best || gap < best.gap || gap === best.gap && (Number(covers) > Number(best.covers) || covers === best.covers && across > best.across))
|
|
501
513
|
best = { entry, gap, across, covers };
|
|
502
514
|
}
|
|
@@ -514,23 +526,23 @@ function placeTab(tab, area) {
|
|
|
514
526
|
}
|
|
515
527
|
__name(placeTab, "placeTab");
|
|
516
528
|
|
|
517
|
-
// src/
|
|
529
|
+
// src/workspaces/goto.ts
|
|
518
530
|
function gotoRows(roster) {
|
|
519
531
|
const rows = [];
|
|
520
|
-
for (const
|
|
532
|
+
for (const workspace of roster.workspaces) {
|
|
521
533
|
rows.push({
|
|
522
534
|
depth: 0,
|
|
523
|
-
text:
|
|
524
|
-
dot: roster.
|
|
525
|
-
target: { kind: "
|
|
535
|
+
text: workspace.name,
|
|
536
|
+
dot: roster.workspaceDot(workspace),
|
|
537
|
+
target: { kind: "workspace", workspace }
|
|
526
538
|
});
|
|
527
|
-
|
|
539
|
+
workspace.tabs.forEach((tab, i) => {
|
|
528
540
|
const panes = leaves(tab.root);
|
|
529
541
|
rows.push({
|
|
530
542
|
depth: 1,
|
|
531
543
|
text: tab.name ?? `tab ${i + 1}`,
|
|
532
544
|
dot: aggregateDot(panes.map((p) => p.dot())),
|
|
533
|
-
target: { kind: "tab",
|
|
545
|
+
target: { kind: "tab", workspace, tab }
|
|
534
546
|
});
|
|
535
547
|
for (const entry of panes)
|
|
536
548
|
rows.push({
|
|
@@ -568,7 +580,7 @@ function currentRow(rows, entry) {
|
|
|
568
580
|
}
|
|
569
581
|
__name(currentRow, "currentRow");
|
|
570
582
|
|
|
571
|
-
// src/
|
|
583
|
+
// src/workspaces/input.ts
|
|
572
584
|
var ESC = String.fromCharCode(27);
|
|
573
585
|
var ARROW = new RegExp(`^${ESC}[[O]([ABCD])`, "u");
|
|
574
586
|
var CSI = new RegExp(`^${ESC}\\[[0-9;?]*[ -/]*[@-~]`, "u");
|
|
@@ -758,19 +770,29 @@ function readKey(text) {
|
|
|
758
770
|
}
|
|
759
771
|
__name(readKey, "readKey");
|
|
760
772
|
|
|
761
|
-
// src/
|
|
773
|
+
// src/workspaces/keymap.ts
|
|
762
774
|
var DIGITS = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
|
|
763
775
|
var BINDINGS = [
|
|
764
776
|
{ keys: ["?"], action: "help", group: "General", label: "keybinds" },
|
|
765
|
-
{ keys: ["g"], action: "goto", group: "General", label: "go to a
|
|
777
|
+
{ keys: ["g"], action: "goto", group: "General", label: "go to a workspace, tab or pane" },
|
|
766
778
|
{ keys: ["s"], action: "menu", group: "General", label: "menu" },
|
|
767
779
|
{ keys: ["q"], action: "quit", group: "General", label: "quit" },
|
|
768
|
-
{ keys: ["N"], action: "new-
|
|
769
|
-
{
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
780
|
+
{ keys: ["N"], action: "new-workspace", group: "Workspaces", label: "new workspace" },
|
|
781
|
+
{
|
|
782
|
+
keys: ["O"],
|
|
783
|
+
action: "open-folder",
|
|
784
|
+
group: "Workspaces",
|
|
785
|
+
label: "open a folder as a workspace"
|
|
786
|
+
},
|
|
787
|
+
{ keys: ["W"], action: "rename-workspace", group: "Workspaces", label: "rename workspace" },
|
|
788
|
+
{ keys: ["D"], action: "close-workspace", group: "Workspaces", label: "close workspace" },
|
|
789
|
+
{
|
|
790
|
+
keys: ["w"],
|
|
791
|
+
action: "workspace-mode",
|
|
792
|
+
group: "Workspaces",
|
|
793
|
+
label: "move through the workspaces"
|
|
794
|
+
},
|
|
795
|
+
{ keys: ["b"], action: "sidebar", group: "Workspaces", label: "toggle sidebar" },
|
|
774
796
|
{ keys: ["c"], action: "new-tab", group: "Tabs", label: "new tab" },
|
|
775
797
|
{ keys: ["T"], action: "rename-tab", group: "Tabs", label: "rename tab" },
|
|
776
798
|
{ keys: ["X"], action: "close-tab", group: "Tabs", label: "close tab" },
|
|
@@ -814,7 +836,7 @@ function bindingFor(key) {
|
|
|
814
836
|
__name(bindingFor, "bindingFor");
|
|
815
837
|
function helpRows(prefixName) {
|
|
816
838
|
const rows = [{ heading: `${prefixName} then a key; twice sends it to the pane` }];
|
|
817
|
-
for (const group of ["General", "
|
|
839
|
+
for (const group of ["General", "Workspaces", "Tabs", "Panes"]) {
|
|
818
840
|
rows.push({ heading: group });
|
|
819
841
|
for (const b of BINDINGS)
|
|
820
842
|
if (b.group === group) rows.push({ keys: keysText(b), label: b.label });
|
|
@@ -823,7 +845,8 @@ function helpRows(prefixName) {
|
|
|
823
845
|
}
|
|
824
846
|
__name(helpRows, "helpRows");
|
|
825
847
|
|
|
826
|
-
// src/
|
|
848
|
+
// src/workspaces/layout.ts
|
|
849
|
+
var TAB_BAR_HEIGHT = 2;
|
|
827
850
|
var SIDEBAR_MIN = 18;
|
|
828
851
|
var SIDEBAR_MAX = 36;
|
|
829
852
|
var SIDEBAR_DEFAULT = 26;
|
|
@@ -847,11 +870,11 @@ function computeLayout(cols, rows, sidebar = DEFAULT_SIDEBAR) {
|
|
|
847
870
|
}
|
|
848
871
|
const shown = cols - total >= MAIN_MIN;
|
|
849
872
|
const main = shown ? { x: total, y: 0, width: cols - total, height: rows } : { x: 0, y: 0, width: cols, height: rows };
|
|
850
|
-
const tabBar = { ...main, height: Math.min(
|
|
873
|
+
const tabBar = { ...main, height: Math.min(TAB_BAR_HEIGHT, main.height) };
|
|
851
874
|
const panes = {
|
|
852
875
|
...main,
|
|
853
|
-
y: main.y + 1,
|
|
854
|
-
height: Math.max(1, main.height -
|
|
876
|
+
y: main.y + Math.min(TAB_BAR_HEIGHT, Math.max(0, main.height - 1)),
|
|
877
|
+
height: Math.max(1, main.height - TAB_BAR_HEIGHT)
|
|
855
878
|
};
|
|
856
879
|
if (!shown)
|
|
857
880
|
return {
|
|
@@ -873,7 +896,7 @@ function computeLayout(cols, rows, sidebar = DEFAULT_SIDEBAR) {
|
|
|
873
896
|
}
|
|
874
897
|
__name(computeLayout, "computeLayout");
|
|
875
898
|
|
|
876
|
-
// src/
|
|
899
|
+
// src/workspaces/overlay.ts
|
|
877
900
|
function within(rect, x, y) {
|
|
878
901
|
return x >= rect.x && x < rect.x + rect.width && y >= rect.y && y < rect.y + rect.height;
|
|
879
902
|
}
|
|
@@ -885,14 +908,18 @@ function hitSurface(surface, x, y) {
|
|
|
885
908
|
return within(surface.rect, x, y) ? { kind: "inside" } : { kind: "outside" };
|
|
886
909
|
}
|
|
887
910
|
__name(hitSurface, "hitSurface");
|
|
911
|
+
function caret(palette) {
|
|
912
|
+
return palette.mono ? { attrs: ATTR_INVERSE } : { bg: palette.text };
|
|
913
|
+
}
|
|
914
|
+
__name(caret, "caret");
|
|
888
915
|
function drawBox(frame, rect, fg, bg) {
|
|
889
916
|
if (rect.width < 2 || rect.height < 2) return;
|
|
890
917
|
const style = { fg, ...bg !== void 0 ? { bg } : {} };
|
|
891
918
|
const right = rect.x + rect.width - 1;
|
|
892
919
|
const bottom = rect.y + rect.height - 1;
|
|
893
920
|
const across = "\u2500".repeat(rect.width - 2);
|
|
894
|
-
frame.writeText({ ...rect, height: 1 }, 0, `\
|
|
895
|
-
frame.writeText({ ...rect, y: bottom, height: 1 }, 0, `\
|
|
921
|
+
frame.writeText({ ...rect, height: 1 }, 0, `\u256D${across}\u256E`, style);
|
|
922
|
+
frame.writeText({ ...rect, y: bottom, height: 1 }, 0, `\u2570${across}\u256F`, style);
|
|
896
923
|
for (let y = rect.y + 1; y < bottom; y++) {
|
|
897
924
|
frame.writeText({ x: rect.x, y, width: 1, height: 1 }, 0, "\u2502", style);
|
|
898
925
|
frame.writeText({ x: right, y, width: 1, height: 1 }, 0, "\u2502", style);
|
|
@@ -969,17 +996,17 @@ function layoutModal(screen, fullSpec) {
|
|
|
969
996
|
__name(layoutModal, "layoutModal");
|
|
970
997
|
function drawModal(frame, layout, spec, palette) {
|
|
971
998
|
const { rect } = layout;
|
|
972
|
-
const tone = spec.danger ? palette.
|
|
973
|
-
frame.fillRect(rect, { bg: palette.
|
|
974
|
-
drawBox(frame, rect, tone, palette.
|
|
999
|
+
const tone = spec.danger ? palette.danger : palette.focus;
|
|
1000
|
+
frame.fillRect(rect, { bg: palette.base });
|
|
1001
|
+
drawBox(frame, rect, tone, palette.base);
|
|
975
1002
|
const inner = { x: rect.x + 2, y: rect.y, width: rect.width - 4, height: rect.height };
|
|
976
1003
|
frame.writeText(inner, 1, spec.title, {
|
|
977
|
-
fg: spec.danger ? palette.
|
|
978
|
-
bg: palette.
|
|
1004
|
+
fg: spec.danger ? palette.danger : palette.text,
|
|
1005
|
+
bg: palette.base,
|
|
979
1006
|
attrs: ATTR_BOLD
|
|
980
1007
|
});
|
|
981
1008
|
(spec.lines ?? []).forEach(
|
|
982
|
-
(line, i) => frame.writeText(inner, 2 + i, line, { fg: palette.subtext, bg: palette.
|
|
1009
|
+
(line, i) => frame.writeText(inner, 2 + i, line, { fg: palette.subtext, bg: palette.base })
|
|
983
1010
|
);
|
|
984
1011
|
if (layout.inputRect && spec.input) {
|
|
985
1012
|
const field = layout.inputRect;
|
|
@@ -991,25 +1018,19 @@ function drawModal(frame, layout, spec, palette) {
|
|
|
991
1018
|
fg: palette.text,
|
|
992
1019
|
bg: palette.surface
|
|
993
1020
|
});
|
|
994
|
-
frame.writeText({ ...field, x: field.x + 1 + used, width: 1 }, 0, " ",
|
|
995
|
-
bg: palette.text
|
|
996
|
-
});
|
|
1021
|
+
frame.writeText({ ...field, x: field.x + 1 + used, width: 1 }, 0, " ", caret(palette));
|
|
997
1022
|
if (spec.error)
|
|
998
1023
|
frame.writeText(inner, field.y - rect.y + 1, spec.error, {
|
|
999
|
-
fg: palette.
|
|
1000
|
-
bg: palette.
|
|
1024
|
+
fg: palette.danger,
|
|
1025
|
+
bg: palette.base
|
|
1001
1026
|
});
|
|
1002
1027
|
}
|
|
1003
1028
|
spec.buttons.forEach((b) => {
|
|
1004
1029
|
const at = layout.buttons.find((l) => l.action === b.action)?.rect;
|
|
1005
1030
|
if (!at) return;
|
|
1006
|
-
const
|
|
1007
|
-
frame.fillRect(at,
|
|
1008
|
-
frame.writeText({ ...at, x: at.x + 1, width: at.width - 1 }, 0, b.label,
|
|
1009
|
-
fg: b.primary ? palette.panelBg : palette.text,
|
|
1010
|
-
bg: fill,
|
|
1011
|
-
...b.primary ? { attrs: ATTR_BOLD } : {}
|
|
1012
|
-
});
|
|
1031
|
+
const style = !b.primary ? { fg: palette.text, bg: palette.surface } : palette.mono ? { attrs: ATTR_BOLD | ATTR_INVERSE } : { fg: palette.ink, bg: tone, attrs: ATTR_BOLD };
|
|
1032
|
+
frame.fillRect(at, style);
|
|
1033
|
+
frame.writeText({ ...at, x: at.x + 1, width: at.width - 1 }, 0, b.label, style);
|
|
1013
1034
|
});
|
|
1014
1035
|
}
|
|
1015
1036
|
__name(drawModal, "drawModal");
|
|
@@ -1043,10 +1064,10 @@ function layoutList(screen, spec) {
|
|
|
1043
1064
|
__name(layoutList, "layoutList");
|
|
1044
1065
|
function drawList(frame, layout, spec, palette) {
|
|
1045
1066
|
const { rect } = layout;
|
|
1046
|
-
frame.fillRect(rect, { bg: palette.
|
|
1047
|
-
drawBox(frame, rect, palette.
|
|
1067
|
+
frame.fillRect(rect, { bg: palette.base });
|
|
1068
|
+
drawBox(frame, rect, palette.focus, palette.base);
|
|
1048
1069
|
const inner = { x: rect.x + 2, y: rect.y, width: rect.width - 4, height: rect.height };
|
|
1049
|
-
frame.writeText(inner, 1, spec.title, { fg: palette.text, bg: palette.
|
|
1070
|
+
frame.writeText(inner, 1, spec.title, { fg: palette.text, bg: palette.base, attrs: ATTR_BOLD });
|
|
1050
1071
|
if (layout.inputRect && spec.input) {
|
|
1051
1072
|
const field = layout.inputRect;
|
|
1052
1073
|
frame.fillRect(field, { bg: palette.surface });
|
|
@@ -1057,7 +1078,7 @@ function drawList(frame, layout, spec, palette) {
|
|
|
1057
1078
|
fg: palette.text,
|
|
1058
1079
|
bg: palette.surface
|
|
1059
1080
|
});
|
|
1060
|
-
frame.writeText({ ...field, x: field.x + 1 + used, width: 1 }, 0, " ",
|
|
1081
|
+
frame.writeText({ ...field, x: field.x + 1 + used, width: 1 }, 0, " ", caret(palette));
|
|
1061
1082
|
}
|
|
1062
1083
|
const first = rect.y + (spec.input ? 4 : 3);
|
|
1063
1084
|
for (let i = 0; i < layout.capacity; i++) {
|
|
@@ -1065,8 +1086,9 @@ function drawList(frame, layout, spec, palette) {
|
|
|
1065
1086
|
if (!row) break;
|
|
1066
1087
|
const area = { x: rect.x + 1, y: first + i, width: rect.width - 2, height: 1 };
|
|
1067
1088
|
const chosen = layout.top + i === spec.index;
|
|
1068
|
-
const bg = chosen ? palette.cursorRow : palette.
|
|
1069
|
-
|
|
1089
|
+
const bg = chosen ? palette.cursorRow : palette.base;
|
|
1090
|
+
const mark = chosen && palette.mono ? ATTR_INVERSE : 0;
|
|
1091
|
+
frame.fillRect(area, { bg, ...mark ? { attrs: mark } : {} });
|
|
1070
1092
|
let x = 1 + (row.indent ?? 0);
|
|
1071
1093
|
const put = /* @__PURE__ */ __name((text, style) => {
|
|
1072
1094
|
x += frame.writeText(
|
|
@@ -1075,7 +1097,8 @@ function drawList(frame, layout, spec, palette) {
|
|
|
1075
1097
|
text,
|
|
1076
1098
|
{
|
|
1077
1099
|
...style,
|
|
1078
|
-
bg
|
|
1100
|
+
bg,
|
|
1101
|
+
attrs: (style.attrs ?? 0) | mark
|
|
1079
1102
|
}
|
|
1080
1103
|
);
|
|
1081
1104
|
}, "put");
|
|
@@ -1088,13 +1111,13 @@ function drawList(frame, layout, spec, palette) {
|
|
|
1088
1111
|
x += 1;
|
|
1089
1112
|
}
|
|
1090
1113
|
put(row.text, {
|
|
1091
|
-
fg: row.heading ? palette.
|
|
1114
|
+
fg: row.heading ? palette.dim : row.muted ? palette.dim : chosen ? palette.text : palette.subtext,
|
|
1092
1115
|
...row.heading || chosen ? { attrs: ATTR_BOLD } : {}
|
|
1093
1116
|
});
|
|
1094
1117
|
}
|
|
1095
1118
|
frame.writeText({ ...inner, y: rect.y + rect.height - 2, height: 1 }, 0, spec.footer, {
|
|
1096
1119
|
fg: palette.dim,
|
|
1097
|
-
bg: palette.
|
|
1120
|
+
bg: palette.base
|
|
1098
1121
|
});
|
|
1099
1122
|
}
|
|
1100
1123
|
__name(drawList, "drawList");
|
|
@@ -1118,32 +1141,28 @@ function layoutPopup(screen, at, items, minWidth = 14) {
|
|
|
1118
1141
|
}
|
|
1119
1142
|
__name(layoutPopup, "layoutPopup");
|
|
1120
1143
|
function drawPopup(frame, surface, items, index, palette) {
|
|
1121
|
-
frame.fillRect(surface.rect, { bg: palette.
|
|
1122
|
-
drawBox(frame, surface.rect, palette.
|
|
1144
|
+
frame.fillRect(surface.rect, { bg: palette.base });
|
|
1145
|
+
drawBox(frame, surface.rect, palette.focus, palette.base);
|
|
1123
1146
|
items.forEach((item, i) => {
|
|
1124
1147
|
const row = surface.rows[i]?.rect;
|
|
1125
1148
|
if (!row) return;
|
|
1126
1149
|
const chosen = i === index;
|
|
1127
|
-
const
|
|
1128
|
-
frame.fillRect(row,
|
|
1129
|
-
frame.writeText({ ...row, x: row.x + 1, width: row.width - 1 }, 0, item,
|
|
1130
|
-
fg: chosen ? palette.panelBg : palette.subtext,
|
|
1131
|
-
bg,
|
|
1132
|
-
...chosen ? { attrs: ATTR_BOLD } : {}
|
|
1133
|
-
});
|
|
1150
|
+
const style = !chosen ? { fg: palette.subtext, bg: palette.base } : palette.mono ? { attrs: ATTR_BOLD | ATTR_INVERSE } : { fg: palette.ink, bg: palette.accent, attrs: ATTR_BOLD };
|
|
1151
|
+
frame.fillRect(row, style);
|
|
1152
|
+
frame.writeText({ ...row, x: row.x + 1, width: row.width - 1 }, 0, item, style);
|
|
1134
1153
|
});
|
|
1135
1154
|
}
|
|
1136
1155
|
__name(drawPopup, "drawPopup");
|
|
1137
1156
|
|
|
1138
|
-
// src/
|
|
1157
|
+
// src/workspaces/roster.ts
|
|
1139
1158
|
var Entry = class {
|
|
1140
|
-
constructor(slot,
|
|
1159
|
+
constructor(slot, workspaceId, label) {
|
|
1141
1160
|
this.slot = slot;
|
|
1142
|
-
this.
|
|
1161
|
+
this.workspaceId = workspaceId;
|
|
1143
1162
|
this.label = label;
|
|
1144
1163
|
}
|
|
1145
1164
|
slot;
|
|
1146
|
-
|
|
1165
|
+
workspaceId;
|
|
1147
1166
|
label;
|
|
1148
1167
|
static {
|
|
1149
1168
|
__name(this, "Entry");
|
|
@@ -1195,74 +1214,74 @@ var Roster = class {
|
|
|
1195
1214
|
static {
|
|
1196
1215
|
__name(this, "Roster");
|
|
1197
1216
|
}
|
|
1198
|
-
|
|
1217
|
+
workspaces = [];
|
|
1199
1218
|
entries = [];
|
|
1200
1219
|
current;
|
|
1201
1220
|
counter = 0;
|
|
1202
1221
|
ticks = 0;
|
|
1203
|
-
/** The session with focus: the focused pane of the shown tab of the shown
|
|
1222
|
+
/** The session with focus: the focused pane of the shown tab of the shown workspace. */
|
|
1204
1223
|
get selected() {
|
|
1205
1224
|
return this.current;
|
|
1206
1225
|
}
|
|
1207
|
-
|
|
1208
|
-
return this.
|
|
1226
|
+
workspaceOf(entry) {
|
|
1227
|
+
return this.workspaces.find((s) => s.id === entry.workspaceId);
|
|
1209
1228
|
}
|
|
1210
|
-
entriesOf(
|
|
1211
|
-
return this.entries.filter((e) => e.
|
|
1229
|
+
entriesOf(workspace) {
|
|
1230
|
+
return this.entries.filter((e) => e.workspaceId === workspace.id);
|
|
1212
1231
|
}
|
|
1213
1232
|
tabOf(entry) {
|
|
1214
|
-
return this.
|
|
1233
|
+
return this.workspaceOf(entry)?.tabs.find((t) => contains(t.root, entry));
|
|
1215
1234
|
}
|
|
1216
1235
|
/** The tab being shown. */
|
|
1217
1236
|
get shownTab() {
|
|
1218
1237
|
const entry = this.current;
|
|
1219
1238
|
return entry ? this.tabOf(entry) : void 0;
|
|
1220
1239
|
}
|
|
1221
|
-
|
|
1222
|
-
const
|
|
1223
|
-
id: `
|
|
1240
|
+
addWorkspace(cwd, name) {
|
|
1241
|
+
const workspace = {
|
|
1242
|
+
id: `workspace-${++this.counter}`,
|
|
1224
1243
|
name,
|
|
1225
1244
|
cwd,
|
|
1226
1245
|
tabs: [],
|
|
1227
1246
|
activeTab: void 0
|
|
1228
1247
|
};
|
|
1229
|
-
this.
|
|
1230
|
-
return
|
|
1248
|
+
this.workspaces.push(workspace);
|
|
1249
|
+
return workspace;
|
|
1231
1250
|
}
|
|
1232
|
-
/** Moves a
|
|
1233
|
-
|
|
1234
|
-
const from = this.
|
|
1235
|
-
const target = Math.max(0, Math.min(this.
|
|
1251
|
+
/** Moves a workspace to a place in the list; the others keep their order. False when nothing moved. */
|
|
1252
|
+
moveWorkspace(workspace, to) {
|
|
1253
|
+
const from = this.workspaces.indexOf(workspace);
|
|
1254
|
+
const target = Math.max(0, Math.min(this.workspaces.length - 1, to));
|
|
1236
1255
|
if (from < 0 || from === target) return false;
|
|
1237
|
-
this.
|
|
1238
|
-
this.
|
|
1256
|
+
this.workspaces.splice(from, 1);
|
|
1257
|
+
this.workspaces.splice(target, 0, workspace);
|
|
1239
1258
|
return true;
|
|
1240
1259
|
}
|
|
1241
1260
|
/** A session that is not in any tab yet; give it a place with `addTab` or `splitBeside`. */
|
|
1242
|
-
addSession(
|
|
1243
|
-
const own = this.entriesOf(
|
|
1244
|
-
const entry = new Entry(slot,
|
|
1261
|
+
addSession(workspace, slot, label) {
|
|
1262
|
+
const own = this.entriesOf(workspace);
|
|
1263
|
+
const entry = new Entry(slot, workspace.id, label ?? this.freeLabel(own));
|
|
1245
1264
|
this.entries.push(entry);
|
|
1246
1265
|
this.current ??= entry;
|
|
1247
1266
|
return entry;
|
|
1248
1267
|
}
|
|
1249
|
-
/** A tab holding one pane, after the
|
|
1250
|
-
addTab(
|
|
1268
|
+
/** A tab holding one pane, after the workspace's others. */
|
|
1269
|
+
addTab(workspace, entry, name) {
|
|
1251
1270
|
const tab = {
|
|
1252
1271
|
root: leaf(entry),
|
|
1253
1272
|
focus: entry,
|
|
1254
1273
|
zoomed: false,
|
|
1255
1274
|
...name ? { name } : {}
|
|
1256
1275
|
};
|
|
1257
|
-
|
|
1258
|
-
|
|
1276
|
+
workspace.tabs.push(tab);
|
|
1277
|
+
workspace.activeTab ??= tab;
|
|
1259
1278
|
return tab;
|
|
1260
1279
|
}
|
|
1261
1280
|
/** A tab built from a whole tree, as when a layout is restored. */
|
|
1262
|
-
addTree(
|
|
1281
|
+
addTree(workspace, root, focus, name, zoomed = false) {
|
|
1263
1282
|
const tab = { root, focus, zoomed, ...name ? { name } : {} };
|
|
1264
|
-
|
|
1265
|
-
|
|
1283
|
+
workspace.tabs.push(tab);
|
|
1284
|
+
workspace.activeTab ??= tab;
|
|
1266
1285
|
return tab;
|
|
1267
1286
|
}
|
|
1268
1287
|
/** Splits the pane of `target` and puts `created` in the new half, which takes focus. */
|
|
@@ -1278,7 +1297,7 @@ var Roster = class {
|
|
|
1278
1297
|
const used = new Set(own.map((e) => e.label));
|
|
1279
1298
|
for (let n = own.length + 1; ; n++) if (!used.has(`session ${n}`)) return `session ${n}`;
|
|
1280
1299
|
}
|
|
1281
|
-
/** Whether the entry's pane is on screen: in the shown tab of the shown
|
|
1300
|
+
/** Whether the entry's pane is on screen: in the shown tab of the shown workspace. */
|
|
1282
1301
|
isVisible(entry) {
|
|
1283
1302
|
const tab = this.shownTab;
|
|
1284
1303
|
return tab !== void 0 && contains(tab.root, entry);
|
|
@@ -1286,11 +1305,11 @@ var Roster = class {
|
|
|
1286
1305
|
/** Shows an entry's tab with that pane focused; looking at panes clears their "finished" mark. */
|
|
1287
1306
|
select(entry) {
|
|
1288
1307
|
if (!this.entries.includes(entry)) return;
|
|
1289
|
-
const
|
|
1308
|
+
const workspace = this.workspaceOf(entry);
|
|
1290
1309
|
const tab = this.tabOf(entry);
|
|
1291
1310
|
if (tab) {
|
|
1292
1311
|
tab.focus = entry;
|
|
1293
|
-
|
|
1312
|
+
workspace.activeTab = tab;
|
|
1294
1313
|
}
|
|
1295
1314
|
this.current = entry;
|
|
1296
1315
|
entry.scrollBack = 0;
|
|
@@ -1305,21 +1324,21 @@ var Roster = class {
|
|
|
1305
1324
|
if (!this.isVisible(entry)) entry.unseen = true;
|
|
1306
1325
|
}
|
|
1307
1326
|
}
|
|
1308
|
-
|
|
1309
|
-
return aggregateDot(this.entriesOf(
|
|
1327
|
+
workspaceDot(workspace) {
|
|
1328
|
+
return aggregateDot(this.entriesOf(workspace).map((e) => e.dot()));
|
|
1310
1329
|
}
|
|
1311
1330
|
/**
|
|
1312
1331
|
* Removes a session and its pane: the neighbour takes the room and focus. A tab
|
|
1313
|
-
* left empty goes, and so does a
|
|
1332
|
+
* left empty goes, and so does a workspace left with no tab.
|
|
1314
1333
|
*/
|
|
1315
1334
|
removeEntry(entry) {
|
|
1316
1335
|
const index = this.entries.indexOf(entry);
|
|
1317
1336
|
if (index < 0) return;
|
|
1318
|
-
const
|
|
1319
|
-
const tab =
|
|
1337
|
+
const workspace = this.workspaces.find((s) => s.id === entry.workspaceId);
|
|
1338
|
+
const tab = workspace?.tabs.find((t) => contains(t.root, entry));
|
|
1320
1339
|
let landing;
|
|
1321
1340
|
this.entries.splice(index, 1);
|
|
1322
|
-
if (
|
|
1341
|
+
if (workspace && tab) {
|
|
1323
1342
|
const { root, next } = removeLeaf(tab.root, entry);
|
|
1324
1343
|
if (root) {
|
|
1325
1344
|
tab.root = root;
|
|
@@ -1327,39 +1346,40 @@ var Roster = class {
|
|
|
1327
1346
|
if (tab.focus === entry) tab.focus = next ?? leaves(root)[0];
|
|
1328
1347
|
landing = tab.focus;
|
|
1329
1348
|
} else {
|
|
1330
|
-
const at =
|
|
1331
|
-
|
|
1332
|
-
if (
|
|
1333
|
-
|
|
1334
|
-
landing =
|
|
1349
|
+
const at = workspace.tabs.indexOf(tab);
|
|
1350
|
+
workspace.tabs.splice(at, 1);
|
|
1351
|
+
if (workspace.activeTab === tab)
|
|
1352
|
+
workspace.activeTab = workspace.tabs[Math.min(at, workspace.tabs.length - 1)];
|
|
1353
|
+
landing = workspace.activeTab?.focus;
|
|
1335
1354
|
}
|
|
1336
1355
|
}
|
|
1337
|
-
if (
|
|
1356
|
+
if (workspace && workspace.tabs.length === 0)
|
|
1357
|
+
this.workspaces.splice(this.workspaces.indexOf(workspace), 1);
|
|
1338
1358
|
if (this.current === entry) {
|
|
1339
1359
|
const next = landing ?? this.entries[Math.min(index, this.entries.length - 1)];
|
|
1340
1360
|
this.current = next;
|
|
1341
1361
|
if (next) {
|
|
1342
|
-
const there = this.
|
|
1362
|
+
const there = this.workspaces.find((s) => s.id === next.workspaceId);
|
|
1343
1363
|
const nextTab = there?.tabs.find((t) => contains(t.root, next));
|
|
1344
1364
|
if (there && nextTab) there.activeTab = nextTab;
|
|
1345
1365
|
for (const seen of nextTab ? leaves(nextTab.root) : [next]) seen.unseen = false;
|
|
1346
1366
|
}
|
|
1347
1367
|
}
|
|
1348
1368
|
}
|
|
1349
|
-
|
|
1350
|
-
const gone = this.entriesOf(
|
|
1369
|
+
removeWorkspace(workspace) {
|
|
1370
|
+
const gone = this.entriesOf(workspace);
|
|
1351
1371
|
for (const entry of gone) this.removeEntry(entry);
|
|
1352
1372
|
return gone;
|
|
1353
1373
|
}
|
|
1354
1374
|
/** Takes a tab out with its sessions. */
|
|
1355
|
-
removeTab(
|
|
1375
|
+
removeTab(workspace, tab) {
|
|
1356
1376
|
const gone = leaves(tab.root);
|
|
1357
1377
|
for (const entry of gone) this.removeEntry(entry);
|
|
1358
1378
|
return gone;
|
|
1359
1379
|
}
|
|
1360
1380
|
};
|
|
1361
1381
|
|
|
1362
|
-
// src/
|
|
1382
|
+
// src/workspaces/selection.ts
|
|
1363
1383
|
function orderRange(a, b) {
|
|
1364
1384
|
const forward = a.line < b.line || a.line === b.line && a.col <= b.col;
|
|
1365
1385
|
return forward ? { start: a, end: b } : { start: b, end: a };
|
|
@@ -1464,7 +1484,7 @@ var ClickCounter = class {
|
|
|
1464
1484
|
}
|
|
1465
1485
|
};
|
|
1466
1486
|
|
|
1467
|
-
// src/
|
|
1487
|
+
// src/workspaces/session.ts
|
|
1468
1488
|
var SCROLLBACK = 2e3;
|
|
1469
1489
|
var ChildSession = class {
|
|
1470
1490
|
constructor(label, spec, size, onChange, kill = killProcessTree, onSignal) {
|
|
@@ -1564,24 +1584,24 @@ var ChildSession = class {
|
|
|
1564
1584
|
}
|
|
1565
1585
|
};
|
|
1566
1586
|
|
|
1567
|
-
// src/
|
|
1587
|
+
// src/workspaces/sidebar.ts
|
|
1568
1588
|
var GLYPHS = {
|
|
1569
|
-
blocked: "\u25CF",
|
|
1570
|
-
done: "\u25CF",
|
|
1571
1589
|
working: "\u25CF",
|
|
1572
1590
|
idle: "\u25CB",
|
|
1591
|
+
blocked: "\u25C6",
|
|
1592
|
+
done: "\u2713",
|
|
1573
1593
|
none: "\xB7"
|
|
1574
1594
|
};
|
|
1575
1595
|
function dotColor(dot, palette) {
|
|
1576
1596
|
switch (dot) {
|
|
1577
1597
|
case "blocked":
|
|
1578
|
-
return palette.
|
|
1598
|
+
return palette.blocked;
|
|
1579
1599
|
case "done":
|
|
1580
|
-
return palette.
|
|
1600
|
+
return palette.done;
|
|
1581
1601
|
case "working":
|
|
1582
|
-
return palette.
|
|
1602
|
+
return palette.working;
|
|
1583
1603
|
case "idle":
|
|
1584
|
-
return palette.
|
|
1604
|
+
return palette.idle;
|
|
1585
1605
|
case "none":
|
|
1586
1606
|
return palette.dim;
|
|
1587
1607
|
}
|
|
@@ -1610,9 +1630,9 @@ function geometry(height, footLines, split, rail) {
|
|
|
1610
1630
|
height,
|
|
1611
1631
|
ruleY,
|
|
1612
1632
|
headerY: void 0,
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1633
|
+
workspaceTop: 0,
|
|
1634
|
+
workspaceStep: 1,
|
|
1635
|
+
workspaceCap: Math.max(0, ruleY),
|
|
1616
1636
|
footerY: void 0,
|
|
1617
1637
|
agentHeaderY: void 0,
|
|
1618
1638
|
agentTop: ruleY + 1,
|
|
@@ -1627,9 +1647,9 @@ function geometry(height, footLines, split, rail) {
|
|
|
1627
1647
|
height,
|
|
1628
1648
|
ruleY,
|
|
1629
1649
|
headerY: 0,
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1650
|
+
workspaceTop: 2,
|
|
1651
|
+
workspaceStep: 2,
|
|
1652
|
+
workspaceCap: Math.max(0, Math.floor((footerY - 2) / 2)),
|
|
1633
1653
|
footerY,
|
|
1634
1654
|
agentHeaderY: ruleY + 1,
|
|
1635
1655
|
agentTop,
|
|
@@ -1646,7 +1666,9 @@ var RANK = {
|
|
|
1646
1666
|
none: 4
|
|
1647
1667
|
};
|
|
1648
1668
|
function agentList(roster, order) {
|
|
1649
|
-
const grouped = roster.
|
|
1669
|
+
const grouped = roster.workspaces.flatMap(
|
|
1670
|
+
(workspace) => workspace.tabs.flatMap((tab) => leaves(tab.root))
|
|
1671
|
+
);
|
|
1650
1672
|
if (order === "grouped") return grouped;
|
|
1651
1673
|
return grouped.map((entry, index) => ({ entry, index })).sort(
|
|
1652
1674
|
(a, b) => RANK[a.entry.dot()] - RANK[b.entry.dot()] || b.entry.changedAt - a.entry.changedAt || a.index - b.index
|
|
@@ -1666,14 +1688,14 @@ __name(within2, "within");
|
|
|
1666
1688
|
function clampScroll(scroll, model, height, reveal = false) {
|
|
1667
1689
|
const geo = geometry(height, model.foot.length, model.split, model.rail);
|
|
1668
1690
|
const selected = model.roster.selected;
|
|
1669
|
-
const
|
|
1691
|
+
const workspace = selected ? model.roster.workspaceOf(selected) : void 0;
|
|
1670
1692
|
const agents = agentList(model.roster, model.order);
|
|
1671
1693
|
return {
|
|
1672
|
-
|
|
1673
|
-
scroll.
|
|
1674
|
-
model.roster.
|
|
1675
|
-
geo.
|
|
1676
|
-
reveal &&
|
|
1694
|
+
workspaces: within2(
|
|
1695
|
+
scroll.workspaces,
|
|
1696
|
+
model.roster.workspaces.length,
|
|
1697
|
+
geo.workspaceCap,
|
|
1698
|
+
reveal && workspace ? model.roster.workspaces.indexOf(workspace) : -1
|
|
1677
1699
|
),
|
|
1678
1700
|
agents: within2(
|
|
1679
1701
|
scroll.agents,
|
|
@@ -1686,7 +1708,7 @@ function clampScroll(scroll, model, height, reveal = false) {
|
|
|
1686
1708
|
__name(clampScroll, "clampScroll");
|
|
1687
1709
|
function regionAt(model, height, y) {
|
|
1688
1710
|
const geo = geometry(height, model.foot.length, model.split, model.rail);
|
|
1689
|
-
if (y < geo.ruleY) return "
|
|
1711
|
+
if (y < geo.ruleY) return "workspaces";
|
|
1690
1712
|
if (y > geo.ruleY) return "agents";
|
|
1691
1713
|
return void 0;
|
|
1692
1714
|
}
|
|
@@ -1707,14 +1729,14 @@ function hitTest(model, width, height, x, y) {
|
|
|
1707
1729
|
if (geo.agentHeaderY !== void 0 && y === geo.agentHeaderY) {
|
|
1708
1730
|
return x >= width - orderLabel(model.order).length - 1 ? { kind: "order" } : void 0;
|
|
1709
1731
|
}
|
|
1710
|
-
const
|
|
1711
|
-
if (
|
|
1712
|
-
const
|
|
1713
|
-
return
|
|
1732
|
+
const workspaceLine = y - geo.workspaceTop;
|
|
1733
|
+
if (workspaceLine >= 0 && workspaceLine < geo.workspaceCap * geo.workspaceStep && y < geo.ruleY) {
|
|
1734
|
+
const workspace = model.roster.workspaces[model.scroll.workspaces + Math.floor(workspaceLine / geo.workspaceStep)];
|
|
1735
|
+
return workspace ? { kind: "workspace", workspace } : void 0;
|
|
1714
1736
|
}
|
|
1715
1737
|
const agentLine = y - geo.agentTop;
|
|
1716
|
-
if (agentLine >= 0 && agentLine < geo.agentCap * geo.
|
|
1717
|
-
const entry = agentList(model.roster, model.order)[model.scroll.agents + Math.floor(agentLine / geo.
|
|
1738
|
+
if (agentLine >= 0 && agentLine < geo.agentCap * geo.workspaceStep) {
|
|
1739
|
+
const entry = agentList(model.roster, model.order)[model.scroll.agents + Math.floor(agentLine / geo.workspaceStep)];
|
|
1718
1740
|
return entry ? { kind: "agent", entry } : void 0;
|
|
1719
1741
|
}
|
|
1720
1742
|
return void 0;
|
|
@@ -1735,10 +1757,10 @@ function clip(text, max) {
|
|
|
1735
1757
|
}
|
|
1736
1758
|
__name(clip, "clip");
|
|
1737
1759
|
function agentDetail(roster, entry, width = Number.POSITIVE_INFINITY) {
|
|
1738
|
-
const
|
|
1760
|
+
const workspace = roster.workspaceOf(entry);
|
|
1739
1761
|
const tab = roster.tabOf(entry);
|
|
1740
|
-
const index = tab ?
|
|
1741
|
-
const many =
|
|
1762
|
+
const index = tab ? workspace.tabs.indexOf(tab) + 1 : 0;
|
|
1763
|
+
const many = workspace.tabs.length > 1 && tab !== void 0;
|
|
1742
1764
|
const join2 = /* @__PURE__ */ __name((parts) => parts.join(" \xB7 "), "join");
|
|
1743
1765
|
const account = entry.account ? [entry.account] : [];
|
|
1744
1766
|
const full = join2([...many ? [tab.name ?? `tab ${index}`] : [], entry.label, ...account]);
|
|
@@ -1760,8 +1782,8 @@ function agentWarning(entry) {
|
|
|
1760
1782
|
__name(agentWarning, "agentWarning");
|
|
1761
1783
|
function attention(roster) {
|
|
1762
1784
|
let found;
|
|
1763
|
-
for (const
|
|
1764
|
-
const dot = roster.
|
|
1785
|
+
for (const workspace of roster.workspaces) {
|
|
1786
|
+
const dot = roster.workspaceDot(workspace);
|
|
1765
1787
|
if (dot === "blocked") return dot;
|
|
1766
1788
|
if (dot === "done") found = dot;
|
|
1767
1789
|
}
|
|
@@ -1805,19 +1827,25 @@ function drawSidebar(frame, rect, model) {
|
|
|
1805
1827
|
if (!thumb) return;
|
|
1806
1828
|
for (let i = 0; i < thumb.length; i++) at(x, top2 + thumb.start + i, "\u2503", { fg: palette.dim });
|
|
1807
1829
|
}, "bar");
|
|
1808
|
-
const
|
|
1830
|
+
const workspaceRoom = rect.width - 3 - (roster.workspaces.length > geo.workspaceCap ? 1 : 0);
|
|
1809
1831
|
const agentRoom = rect.width - 3 - (agentList(roster, model.order).length > geo.agentCap ? 1 : 0);
|
|
1810
|
-
const shown = roster.selected ? roster.
|
|
1832
|
+
const shown = roster.selected ? roster.workspaceOf(roster.selected) : void 0;
|
|
1811
1833
|
const agents = agentList(roster, model.order);
|
|
1812
|
-
if (geo.headerY !== void 0)
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1834
|
+
if (geo.headerY !== void 0)
|
|
1835
|
+
at(1, geo.headerY, "workspaces", { fg: palette.text, attrs: ATTR_BOLD });
|
|
1836
|
+
const reversed = [];
|
|
1837
|
+
const workspaces = roster.workspaces.slice(
|
|
1838
|
+
model.scroll.workspaces,
|
|
1839
|
+
model.scroll.workspaces + geo.workspaceCap
|
|
1840
|
+
);
|
|
1841
|
+
workspaces.forEach((workspace, i) => {
|
|
1842
|
+
const y = geo.workspaceTop + i * geo.workspaceStep;
|
|
1843
|
+
const index = model.scroll.workspaces + i;
|
|
1844
|
+
const focused = workspace === shown;
|
|
1845
|
+
const dot = roster.workspaceDot(workspace);
|
|
1819
1846
|
const bg = focused ? navigating ? palette.cursorRow : palette.activeRow : -1;
|
|
1820
|
-
tint(y, geo.
|
|
1847
|
+
tint(y, geo.workspaceStep, bg);
|
|
1848
|
+
if (palette.mono && focused && navigating) reversed.push([y, geo.workspaceStep]);
|
|
1821
1849
|
if (geo.rail) {
|
|
1822
1850
|
at(0, y, railIndex(index), { fg: palette.dim, bg });
|
|
1823
1851
|
at(2, y, GLYPHS[dot], {
|
|
@@ -1828,41 +1856,48 @@ function drawSidebar(frame, rect, model) {
|
|
|
1828
1856
|
return;
|
|
1829
1857
|
}
|
|
1830
1858
|
at(1, y, GLYPHS[dot], { fg: dotColor(dot, palette), bg });
|
|
1831
|
-
at(3, y, clip(
|
|
1859
|
+
at(3, y, clip(workspace.name, workspaceRoom), {
|
|
1832
1860
|
fg: focused ? palette.text : palette.subtext,
|
|
1833
1861
|
bg,
|
|
1834
1862
|
...focused ? { attrs: ATTR_BOLD } : {}
|
|
1835
1863
|
});
|
|
1836
|
-
const note =
|
|
1864
|
+
const note = workspaceNote(dot);
|
|
1837
1865
|
if (note) {
|
|
1838
|
-
at(3, y + 1, clip(note,
|
|
1839
|
-
fg: dot === "blocked" ? palette.
|
|
1866
|
+
at(3, y + 1, clip(note, workspaceRoom), {
|
|
1867
|
+
fg: dot === "blocked" ? palette.blocked : palette.done,
|
|
1840
1868
|
bg
|
|
1841
1869
|
});
|
|
1842
1870
|
return;
|
|
1843
1871
|
}
|
|
1844
|
-
const git = model.git(
|
|
1872
|
+
const git = model.git(workspace.cwd);
|
|
1845
1873
|
if (!git) return;
|
|
1846
1874
|
const counts = [];
|
|
1847
|
-
if (git.ahead > 0) counts.push({ text: `\u2191${git.ahead}`, fg: palette.
|
|
1848
|
-
if (git.behind > 0) counts.push({ text: `\u2193${git.behind}`, fg: palette.
|
|
1875
|
+
if (git.ahead > 0) counts.push({ text: `\u2191${git.ahead}`, fg: palette.ahead });
|
|
1876
|
+
if (git.behind > 0) counts.push({ text: `\u2193${git.behind}`, fg: palette.behind });
|
|
1849
1877
|
const tail = counts.reduce((sum, c) => sum + 1 + c.text.length, 0);
|
|
1850
|
-
const branch = clip(git.branch,
|
|
1851
|
-
at(3, y + 1, branch, { fg:
|
|
1878
|
+
const branch = clip(git.branch, workspaceRoom - tail);
|
|
1879
|
+
at(3, y + 1, branch, { fg: palette.branch, bg });
|
|
1852
1880
|
let x = 3 + stringWidth(branch);
|
|
1853
1881
|
for (const c of counts) {
|
|
1854
1882
|
at(x + 1, y + 1, c.text, { fg: c.fg, bg });
|
|
1855
1883
|
x += 1 + c.text.length;
|
|
1856
1884
|
}
|
|
1857
1885
|
});
|
|
1886
|
+
for (const [top2, rows] of reversed)
|
|
1887
|
+
for (let row = 0; row < rows; row++)
|
|
1888
|
+
for (let x = 0; x < rect.width; x++) {
|
|
1889
|
+
const cell = frame.cellAt(rect.x + x, rect.y + top2 + row);
|
|
1890
|
+
if (cell)
|
|
1891
|
+
frame.set(rect.x + x, rect.y + top2 + row, { ...cell, attrs: cell.attrs | ATTR_INVERSE });
|
|
1892
|
+
}
|
|
1858
1893
|
if (!geo.rail)
|
|
1859
1894
|
bar(
|
|
1860
1895
|
rect.width - 1,
|
|
1861
|
-
geo.
|
|
1862
|
-
geo.
|
|
1863
|
-
roster.
|
|
1864
|
-
geo.
|
|
1865
|
-
model.scroll.
|
|
1896
|
+
geo.workspaceTop,
|
|
1897
|
+
geo.workspaceCap * geo.workspaceStep,
|
|
1898
|
+
roster.workspaces.length,
|
|
1899
|
+
geo.workspaceCap,
|
|
1900
|
+
model.scroll.workspaces
|
|
1866
1901
|
);
|
|
1867
1902
|
if (geo.footerY !== void 0) {
|
|
1868
1903
|
at(1, geo.footerY, "new", { fg: palette.dim });
|
|
@@ -1882,12 +1917,12 @@ function drawSidebar(frame, rect, model) {
|
|
|
1882
1917
|
}
|
|
1883
1918
|
const visible = agents.slice(model.scroll.agents, model.scroll.agents + geo.agentCap);
|
|
1884
1919
|
visible.forEach((entry, i) => {
|
|
1885
|
-
const y = geo.agentTop + i * geo.
|
|
1920
|
+
const y = geo.agentTop + i * geo.workspaceStep;
|
|
1886
1921
|
const index = model.scroll.agents + i;
|
|
1887
1922
|
const focused = entry === roster.selected;
|
|
1888
1923
|
const dot = entry.dot();
|
|
1889
1924
|
const bg = focused ? palette.activeRow : -1;
|
|
1890
|
-
tint(y, geo.
|
|
1925
|
+
tint(y, geo.workspaceStep, bg);
|
|
1891
1926
|
if (geo.rail) {
|
|
1892
1927
|
at(0, y, railIndex(index), { fg: palette.dim, bg });
|
|
1893
1928
|
at(2, y, GLYPHS[dot], {
|
|
@@ -1899,14 +1934,14 @@ function drawSidebar(frame, rect, model) {
|
|
|
1899
1934
|
}
|
|
1900
1935
|
at(1, y, GLYPHS[dot], { fg: dotColor(dot, palette), bg });
|
|
1901
1936
|
const gone = entry.child?.status === "exited";
|
|
1902
|
-
at(3, y, clip(roster.
|
|
1937
|
+
at(3, y, clip(roster.workspaceOf(entry).name, agentRoom), {
|
|
1903
1938
|
fg: gone ? palette.dim : focused ? palette.text : palette.subtext,
|
|
1904
1939
|
bg,
|
|
1905
1940
|
attrs: ATTR_BOLD
|
|
1906
1941
|
});
|
|
1907
1942
|
const warning = agentWarning(entry);
|
|
1908
1943
|
at(3, y + 1, clip(warning ?? agentDetail(roster, entry, agentRoom), agentRoom), {
|
|
1909
|
-
fg: warning ? palette.
|
|
1944
|
+
fg: warning ? palette.warn : palette.dim,
|
|
1910
1945
|
bg
|
|
1911
1946
|
});
|
|
1912
1947
|
});
|
|
@@ -1914,7 +1949,7 @@ function drawSidebar(frame, rect, model) {
|
|
|
1914
1949
|
bar(
|
|
1915
1950
|
rect.width - 1,
|
|
1916
1951
|
geo.agentTop,
|
|
1917
|
-
geo.agentCap * geo.
|
|
1952
|
+
geo.agentCap * geo.workspaceStep,
|
|
1918
1953
|
agents.length,
|
|
1919
1954
|
geo.agentCap,
|
|
1920
1955
|
model.scroll.agents
|
|
@@ -1941,71 +1976,141 @@ function endedMessage(ending, prefixName) {
|
|
|
1941
1976
|
}
|
|
1942
1977
|
__name(endedMessage, "endedMessage");
|
|
1943
1978
|
|
|
1944
|
-
// src/
|
|
1979
|
+
// src/workspaces/tabbar.ts
|
|
1945
1980
|
var MIN_TAB_WIDTH = 8;
|
|
1946
1981
|
var NEW_TAB_WIDTH = 3;
|
|
1982
|
+
var CUE_WIDTH = 2;
|
|
1947
1983
|
function tabLabel(tab, index) {
|
|
1948
1984
|
const base = tab.name ?? String(index + 1);
|
|
1949
1985
|
return tab.zoomed ? `${base} Z` : base;
|
|
1950
1986
|
}
|
|
1951
1987
|
__name(tabLabel, "tabLabel");
|
|
1952
|
-
function
|
|
1953
|
-
|
|
1954
|
-
|
|
1988
|
+
function ellipsize(text, max) {
|
|
1989
|
+
if (max <= 0) return "";
|
|
1990
|
+
if (stringWidth(text) <= max) return text;
|
|
1991
|
+
let out = "";
|
|
1992
|
+
let used = 0;
|
|
1993
|
+
for (const ch of text) {
|
|
1994
|
+
const w = stringWidth(ch);
|
|
1995
|
+
if (used + w > max - 1) break;
|
|
1996
|
+
out += ch;
|
|
1997
|
+
used += w;
|
|
1998
|
+
}
|
|
1999
|
+
return `${out}\u2026`;
|
|
2000
|
+
}
|
|
2001
|
+
__name(ellipsize, "ellipsize");
|
|
2002
|
+
function visibleSpan(widths, active, room) {
|
|
2003
|
+
let first = active;
|
|
2004
|
+
let last = active;
|
|
2005
|
+
let used = Math.min(widths[active], room);
|
|
2006
|
+
for (let grew = true; grew; ) {
|
|
2007
|
+
grew = false;
|
|
2008
|
+
const next = widths[last + 1];
|
|
2009
|
+
if (next !== void 0 && used + 1 + next <= room) {
|
|
2010
|
+
last++;
|
|
2011
|
+
used += 1 + next;
|
|
2012
|
+
grew = true;
|
|
2013
|
+
}
|
|
2014
|
+
const before = widths[first - 1];
|
|
2015
|
+
if (before !== void 0 && used + 1 + before <= room) {
|
|
2016
|
+
first--;
|
|
2017
|
+
used += 1 + before;
|
|
2018
|
+
grew = true;
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
2021
|
+
return { first, last };
|
|
2022
|
+
}
|
|
2023
|
+
__name(visibleSpan, "visibleSpan");
|
|
2024
|
+
function layoutTabBar(workspace, area) {
|
|
2025
|
+
const count = workspace.tabs.length;
|
|
2026
|
+
const widths = workspace.tabs.map(
|
|
2027
|
+
(tab, i) => Math.max(MIN_TAB_WIDTH, stringWidth(tabLabel(tab, i)) + 2)
|
|
1955
2028
|
);
|
|
1956
|
-
const
|
|
1957
|
-
const
|
|
1958
|
-
const
|
|
2029
|
+
const hasPlus = area.width >= NEW_TAB_WIDTH;
|
|
2030
|
+
const room = Math.max(0, area.width - (hasPlus ? NEW_TAB_WIDTH : 0));
|
|
2031
|
+
const activeIndex = workspace.activeTab ? workspace.tabs.indexOf(workspace.activeTab) : -1;
|
|
2032
|
+
const row = /* @__PURE__ */ __name((x2, width) => ({ x: x2, y: area.y, width, height: 1 }), "row");
|
|
2033
|
+
const whole = widths.reduce((sum, w) => sum + w + 1, -1);
|
|
1959
2034
|
let first = 0;
|
|
1960
|
-
|
|
2035
|
+
let last = count - 1;
|
|
2036
|
+
let needLeft = false;
|
|
2037
|
+
let needRight = false;
|
|
2038
|
+
let chipRoom = room;
|
|
2039
|
+
if (whole > room && count > 0) {
|
|
2040
|
+
for (let pass = 0; pass < 3; pass++) {
|
|
2041
|
+
chipRoom = Math.max(0, room - (needLeft ? CUE_WIDTH : 0) - (needRight ? CUE_WIDTH : 0));
|
|
2042
|
+
const span = visibleSpan(widths, Math.max(0, activeIndex), chipRoom);
|
|
2043
|
+
first = span.first;
|
|
2044
|
+
last = span.last;
|
|
2045
|
+
const left = first > 0;
|
|
2046
|
+
const right = last < count - 1;
|
|
2047
|
+
if (left === needLeft && right === needRight) break;
|
|
2048
|
+
needLeft = left;
|
|
2049
|
+
needRight = right;
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
1961
2052
|
const chips = [];
|
|
1962
|
-
let x = area.x;
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
const
|
|
2053
|
+
let x = area.x + (needLeft ? CUE_WIDTH : 0);
|
|
2054
|
+
const stop = x + chipRoom;
|
|
2055
|
+
for (let i = first; i <= last && chipRoom > 0; i++) {
|
|
2056
|
+
const tab = workspace.tabs[i];
|
|
2057
|
+
const width = Math.min(widths[i], stop - x);
|
|
2058
|
+
if (width <= 0) break;
|
|
1967
2059
|
chips.push({
|
|
1968
2060
|
tab,
|
|
1969
|
-
rect:
|
|
1970
|
-
label: tabLabel(tab, i),
|
|
1971
|
-
active: tab ===
|
|
2061
|
+
rect: row(x, width),
|
|
2062
|
+
label: ellipsize(tabLabel(tab, i), width - 2),
|
|
2063
|
+
active: tab === workspace.activeTab
|
|
1972
2064
|
});
|
|
1973
2065
|
x += width + 1;
|
|
1974
2066
|
}
|
|
1975
|
-
const
|
|
1976
|
-
const
|
|
1977
|
-
return {
|
|
2067
|
+
const overflowing = needLeft || needRight;
|
|
2068
|
+
const plusX = overflowing ? area.x + area.width - NEW_TAB_WIDTH : Math.min(x, area.x + area.width - NEW_TAB_WIDTH);
|
|
2069
|
+
return {
|
|
2070
|
+
chips,
|
|
2071
|
+
plus: hasPlus ? row(plusX, NEW_TAB_WIDTH) : void 0,
|
|
2072
|
+
left: needLeft ? row(area.x, CUE_WIDTH) : void 0,
|
|
2073
|
+
right: needRight ? row(plusX - CUE_WIDTH, CUE_WIDTH) : void 0
|
|
2074
|
+
};
|
|
1978
2075
|
}
|
|
1979
2076
|
__name(layoutTabBar, "layoutTabBar");
|
|
1980
|
-
function drawTabBar(frame, area,
|
|
1981
|
-
frame.fillRect(area, { bg: palette.
|
|
1982
|
-
const bar = layoutTabBar(
|
|
2077
|
+
function drawTabBar(frame, area, workspace, palette) {
|
|
2078
|
+
frame.fillRect(area, { bg: palette.base });
|
|
2079
|
+
const bar = layoutTabBar(workspace, area);
|
|
1983
2080
|
for (const chip of bar.chips) {
|
|
1984
|
-
const style = chip.active ? {
|
|
1985
|
-
fg: palette.panelBg,
|
|
1986
|
-
bg: palette.accent,
|
|
1987
|
-
...chip.tab.name ? { attrs: ATTR_BOLD } : {}
|
|
1988
|
-
} : { fg: palette.tabRest, bg: palette.surface };
|
|
2081
|
+
const style = chip.active ? palette.mono ? { attrs: ATTR_BOLD | ATTR_INVERSE } : { fg: palette.ink, bg: palette.accent, attrs: ATTR_BOLD } : { fg: palette.dim };
|
|
1989
2082
|
frame.fillRect(chip.rect, style);
|
|
1990
2083
|
const pad = Math.max(0, chip.rect.width - stringWidth(chip.label));
|
|
1991
2084
|
frame.writeText(chip.rect, 0, `${" ".repeat(Math.floor(pad / 2))}${chip.label}`, style);
|
|
1992
2085
|
}
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
2086
|
+
const cue = { fg: palette.accent, attrs: ATTR_BOLD };
|
|
2087
|
+
if (bar.left) frame.writeText(bar.left, 0, "\u2039", cue);
|
|
2088
|
+
if (bar.right) frame.writeText(bar.right, 0, "\u203A", cue);
|
|
2089
|
+
if (bar.plus) frame.writeText(bar.plus, 0, " + ", { fg: palette.dim });
|
|
2090
|
+
if (area.height < TAB_BAR_HEIGHT) return;
|
|
2091
|
+
const rule = { ...area, y: area.y + 1, height: 1 };
|
|
2092
|
+
frame.writeText(rule, 0, "\u2500".repeat(area.width), { fg: palette.border });
|
|
2093
|
+
const active = bar.chips.find((chip) => chip.active);
|
|
2094
|
+
if (active)
|
|
2095
|
+
frame.writeText(
|
|
2096
|
+
{ ...rule, x: active.rect.x, width: active.rect.width },
|
|
2097
|
+
0,
|
|
2098
|
+
"\u2501".repeat(active.rect.width),
|
|
2099
|
+
{ fg: palette.accent }
|
|
2100
|
+
);
|
|
1998
2101
|
}
|
|
1999
2102
|
__name(drawTabBar, "drawTabBar");
|
|
2000
2103
|
function tabBarTarget(bar, x, y) {
|
|
2001
2104
|
const inside = /* @__PURE__ */ __name((r) => y === r.y && x >= r.x && x < r.x + r.width, "inside");
|
|
2002
2105
|
for (const chip of bar.chips) if (inside(chip.rect)) return { kind: "tab", tab: chip.tab };
|
|
2003
2106
|
if (bar.plus && inside(bar.plus)) return { kind: "new" };
|
|
2107
|
+
if (bar.left && inside(bar.left)) return { kind: "previous" };
|
|
2108
|
+
if (bar.right && inside(bar.right)) return { kind: "next" };
|
|
2004
2109
|
return void 0;
|
|
2005
2110
|
}
|
|
2006
2111
|
__name(tabBarTarget, "tabBarTarget");
|
|
2007
2112
|
|
|
2008
|
-
// src/
|
|
2113
|
+
// src/workspaces/host.ts
|
|
2009
2114
|
var ENDING_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
2010
2115
|
var realSignalHooks = {
|
|
2011
2116
|
on: /* @__PURE__ */ __name((signal, listener) => void process.on(signal, listener), "on"),
|
|
@@ -2033,10 +2138,14 @@ var WHEEL_ROWS = 3;
|
|
|
2033
2138
|
var MAX_PAINT_FAILURES = 3;
|
|
2034
2139
|
var MENU_ITEMS = ["accounts", "add account", "sidebar", "keybinds", "quit"];
|
|
2035
2140
|
var CONTEXT_ITEMS = {
|
|
2036
|
-
|
|
2141
|
+
workspace: ["Rename", "New tab", "Close"],
|
|
2037
2142
|
tab: ["Rename", "Close"],
|
|
2038
2143
|
pane: ["Rename", "Split right", "Split down", "Zoom", "Close"]
|
|
2039
2144
|
};
|
|
2145
|
+
function inRect(rect, x, y) {
|
|
2146
|
+
return x >= rect.x && x < rect.x + rect.width && y >= rect.y && y < rect.y + rect.height;
|
|
2147
|
+
}
|
|
2148
|
+
__name(inRect, "inRect");
|
|
2040
2149
|
function defaultIsDirectory(path) {
|
|
2041
2150
|
try {
|
|
2042
2151
|
return existsSync(path) && statSync(path).isDirectory();
|
|
@@ -2045,13 +2154,12 @@ function defaultIsDirectory(path) {
|
|
|
2045
2154
|
}
|
|
2046
2155
|
}
|
|
2047
2156
|
__name(defaultIsDirectory, "defaultIsDirectory");
|
|
2048
|
-
var
|
|
2157
|
+
var WorkspacesHost = class {
|
|
2049
2158
|
constructor(options) {
|
|
2050
2159
|
this.options = options;
|
|
2051
2160
|
this.router = new InputRouter(options.prefix);
|
|
2052
2161
|
this.schedule = options.schedule ?? realSchedule;
|
|
2053
2162
|
this.clicks = new ClickCounter(options.now ?? Date.now, DOUBLE_CLICK_MS);
|
|
2054
|
-
this.palette = paletteFor(options.truecolor ?? advertisesTruecolor(process.env));
|
|
2055
2163
|
this.git = new GitCache(
|
|
2056
2164
|
options.git ?? gitLookup,
|
|
2057
2165
|
() => this.requestRender(),
|
|
@@ -2070,14 +2178,14 @@ var SpacesHost = class {
|
|
|
2070
2178
|
}
|
|
2071
2179
|
options;
|
|
2072
2180
|
static {
|
|
2073
|
-
__name(this, "
|
|
2181
|
+
__name(this, "WorkspacesHost");
|
|
2074
2182
|
}
|
|
2075
2183
|
roster = new Roster();
|
|
2076
2184
|
sidebar = DEFAULT_SIDEBAR;
|
|
2077
2185
|
split = 0.5;
|
|
2078
2186
|
order = "grouped";
|
|
2079
2187
|
menu;
|
|
2080
|
-
sidebarScroll = {
|
|
2188
|
+
sidebarScroll = { workspaces: 0, agents: 0 };
|
|
2081
2189
|
sidebarDrag;
|
|
2082
2190
|
lastEdgePress;
|
|
2083
2191
|
git;
|
|
@@ -2090,7 +2198,7 @@ var SpacesHost = class {
|
|
|
2090
2198
|
goto;
|
|
2091
2199
|
accountList;
|
|
2092
2200
|
context;
|
|
2093
|
-
/** A
|
|
2201
|
+
/** A workspace being dragged in the sidebar, and the place it would land. */
|
|
2094
2202
|
reorder;
|
|
2095
2203
|
cancelSave;
|
|
2096
2204
|
forgetAll = false;
|
|
@@ -2109,7 +2217,7 @@ var SpacesHost = class {
|
|
|
2109
2217
|
closed = false;
|
|
2110
2218
|
/** True while the real terminal belongs to the local session and nothing of the host is drawn. */
|
|
2111
2219
|
hidden = false;
|
|
2112
|
-
/** `split` is the
|
|
2220
|
+
/** `split` is the workspaces screen; `full` draws the selected child alone on the whole terminal. */
|
|
2113
2221
|
view = "split";
|
|
2114
2222
|
localEntry;
|
|
2115
2223
|
quitting = false;
|
|
@@ -2122,7 +2230,7 @@ var SpacesHost = class {
|
|
|
2122
2230
|
stopWatching;
|
|
2123
2231
|
reconciling = false;
|
|
2124
2232
|
leaving = [];
|
|
2125
|
-
|
|
2233
|
+
paletteCache;
|
|
2126
2234
|
/** A border being dragged: the split it moves and where on the border it was grabbed. */
|
|
2127
2235
|
drag;
|
|
2128
2236
|
router;
|
|
@@ -2189,6 +2297,16 @@ var SpacesHost = class {
|
|
|
2189
2297
|
}
|
|
2190
2298
|
}
|
|
2191
2299
|
}, "onProcessExit");
|
|
2300
|
+
/** The chrome's colours, from the theme showing now: a theme switched in the TUI restyles the screen at its next frame. */
|
|
2301
|
+
get palette() {
|
|
2302
|
+
const level = this.options.colors ?? colorLevel(process.env);
|
|
2303
|
+
const theme = activeThemeName();
|
|
2304
|
+
const cached = this.paletteCache;
|
|
2305
|
+
if (cached && cached.level === level && cached.theme === theme) return cached.palette;
|
|
2306
|
+
const palette = paletteFor(level);
|
|
2307
|
+
this.paletteCache = { level, theme, palette };
|
|
2308
|
+
return palette;
|
|
2309
|
+
}
|
|
2192
2310
|
start() {
|
|
2193
2311
|
const { input, output, local } = this.options;
|
|
2194
2312
|
if (!local) output.write(enterScreen(this.mouseMode));
|
|
@@ -2207,20 +2325,20 @@ var SpacesHost = class {
|
|
|
2207
2325
|
this.requestRender();
|
|
2208
2326
|
}
|
|
2209
2327
|
/**
|
|
2210
|
-
* Brings back the saved
|
|
2328
|
+
* Brings back the saved workspaces and makes the running conversation one of the
|
|
2211
2329
|
* panes: the one that carries its conversation id, or else a new tab in the
|
|
2212
|
-
*
|
|
2330
|
+
* workspace of its folder. Nothing else is started here.
|
|
2213
2331
|
*/
|
|
2214
2332
|
seedLocal(local) {
|
|
2215
2333
|
const layout = this.options.restored;
|
|
2216
|
-
if (layout) this.
|
|
2334
|
+
if (layout) this.restoreWorkspaces(layout);
|
|
2217
2335
|
const id = local.conversationId();
|
|
2218
2336
|
const carried = id ? this.roster.entries.find((e) => (e.conversationId ?? e.resume) === id) : void 0;
|
|
2219
2337
|
let entry = carried;
|
|
2220
2338
|
if (!entry) {
|
|
2221
2339
|
const { cwd, name } = this.options.folder;
|
|
2222
|
-
const
|
|
2223
|
-
entry = this.newTabIn(
|
|
2340
|
+
const workspace = this.roster.workspaces.find((s) => s.cwd === cwd) ?? this.roster.addWorkspace(cwd, name);
|
|
2341
|
+
entry = this.newTabIn(workspace);
|
|
2224
2342
|
}
|
|
2225
2343
|
entry.child = local.session;
|
|
2226
2344
|
this.watchClipboard(local.session.screen);
|
|
@@ -2238,12 +2356,12 @@ var SpacesHost = class {
|
|
|
2238
2356
|
this.roster.update(entry);
|
|
2239
2357
|
this.persist();
|
|
2240
2358
|
}
|
|
2241
|
-
/** True while the
|
|
2359
|
+
/** True while the workspaces screen is on the terminal. */
|
|
2242
2360
|
get visible() {
|
|
2243
2361
|
return !this.hidden && !this.closed;
|
|
2244
2362
|
}
|
|
2245
|
-
/** Puts the
|
|
2246
|
-
|
|
2363
|
+
/** Puts the workspaces screen up, with the running conversation selected and the keyboard on the sidebar. */
|
|
2364
|
+
openWorkspaces() {
|
|
2247
2365
|
const entry = this.localEntry;
|
|
2248
2366
|
if (this.closed || !entry) return;
|
|
2249
2367
|
if (this.hidden) {
|
|
@@ -2283,7 +2401,7 @@ var SpacesHost = class {
|
|
|
2283
2401
|
/**
|
|
2284
2402
|
* The conversation is about to unmount: gives the main screen back and has the conversation print
|
|
2285
2403
|
* its whole history there, so Ink's last frame lands on a screen that is already right. True when
|
|
2286
|
-
* the
|
|
2404
|
+
* the workspaces screen was up and has been left.
|
|
2287
2405
|
*/
|
|
2288
2406
|
releaseTerminal() {
|
|
2289
2407
|
if (this.closed || this.hidden || !this.localEntry || !this.options.local) return false;
|
|
@@ -2292,8 +2410,8 @@ var SpacesHost = class {
|
|
|
2292
2410
|
}
|
|
2293
2411
|
/**
|
|
2294
2412
|
* Runs `run` with the terminal handed back to the real shell (an editor, a pager): the pointer is
|
|
2295
|
-
* switched off and the main screen returns first, and the
|
|
2296
|
-
* even if `run` throws. Nothing happens around `run` when the
|
|
2413
|
+
* switched off and the main screen returns first, and the workspaces screen is entered again afterwards
|
|
2414
|
+
* even if `run` throws. Nothing happens around `run` when the workspaces screen is not on the terminal.
|
|
2297
2415
|
*/
|
|
2298
2416
|
async withTerminalHandoff(run2) {
|
|
2299
2417
|
if (this.closed || this.hidden) return await run2();
|
|
@@ -2309,7 +2427,7 @@ var SpacesHost = class {
|
|
|
2309
2427
|
}
|
|
2310
2428
|
}
|
|
2311
2429
|
}
|
|
2312
|
-
/** Moves the keyboard from a pane to the sidebar of the
|
|
2430
|
+
/** Moves the keyboard from a pane to the sidebar of the workspaces screen. */
|
|
2313
2431
|
focusSidebar() {
|
|
2314
2432
|
if (this.closed || this.hidden || this.view === "full") return;
|
|
2315
2433
|
this.router.enterNavigate();
|
|
@@ -2333,46 +2451,46 @@ var SpacesHost = class {
|
|
|
2333
2451
|
}
|
|
2334
2452
|
}
|
|
2335
2453
|
// --- sessions --------------------------------------------------------------
|
|
2336
|
-
/** The first run: the current folder as a
|
|
2454
|
+
/** The first run: the current folder as a workspace with the session the command started. */
|
|
2337
2455
|
fresh() {
|
|
2338
|
-
const
|
|
2339
|
-
const entry = this.newTabIn(
|
|
2456
|
+
const workspace = this.roster.addWorkspace(this.options.folder.cwd, this.options.folder.name);
|
|
2457
|
+
const entry = this.newTabIn(workspace);
|
|
2340
2458
|
entry.first = true;
|
|
2341
2459
|
for (const listed of this.options.listed ?? []) {
|
|
2342
|
-
const other = this.roster.
|
|
2460
|
+
const other = this.roster.addWorkspace(listed.cwd, listed.name);
|
|
2343
2461
|
for (let i = 0; i < listed.sessions; i++) this.newTabIn(other);
|
|
2344
2462
|
}
|
|
2345
2463
|
return entry;
|
|
2346
2464
|
}
|
|
2347
2465
|
/**
|
|
2348
|
-
* Brings back the previous run's
|
|
2466
|
+
* Brings back the previous run's workspaces, tabs and panes, none of them started.
|
|
2349
2467
|
* The one shown is where focus was, unless the command carries its own options
|
|
2350
2468
|
* or its folder is new, which start a fresh session of their own.
|
|
2351
2469
|
*/
|
|
2352
2470
|
restore(layout) {
|
|
2353
|
-
this.
|
|
2354
|
-
const folder = this.roster.
|
|
2471
|
+
this.restoreWorkspaces(layout);
|
|
2472
|
+
const folder = this.roster.workspaces.find((s) => s.cwd === this.options.folder.cwd);
|
|
2355
2473
|
if (this.options.freshFirst || !folder) {
|
|
2356
|
-
const
|
|
2357
|
-
const entry = this.newTabIn(
|
|
2474
|
+
const workspace = folder ?? this.roster.addWorkspace(this.options.folder.cwd, this.options.folder.name);
|
|
2475
|
+
const entry = this.newTabIn(workspace);
|
|
2358
2476
|
entry.first = true;
|
|
2359
2477
|
return entry;
|
|
2360
2478
|
}
|
|
2361
|
-
const focused = layout.focus !== void 0 ? this.roster.
|
|
2479
|
+
const focused = layout.focus !== void 0 ? this.roster.workspaces[layout.focus.workspace]?.activeTab?.focus : void 0;
|
|
2362
2480
|
return focused ?? folder.activeTab?.focus ?? this.newTabIn(folder);
|
|
2363
2481
|
}
|
|
2364
|
-
|
|
2482
|
+
restoreWorkspaces(layout) {
|
|
2365
2483
|
const isDirectory = this.options.isDirectory ?? defaultIsDirectory;
|
|
2366
|
-
for (const saved of layout.
|
|
2367
|
-
const
|
|
2484
|
+
for (const saved of layout.workspaces) {
|
|
2485
|
+
const workspace = this.roster.addWorkspace(saved.cwd, saved.name);
|
|
2368
2486
|
const found = isDirectory(saved.cwd);
|
|
2369
|
-
if (saved.lastAccount)
|
|
2370
|
-
for (const savedTab of saved.tabs) this.restoreTab(
|
|
2371
|
-
const active = saved.activeTab !== void 0 ?
|
|
2372
|
-
|
|
2487
|
+
if (saved.lastAccount) workspace.lastAccount = saved.lastAccount;
|
|
2488
|
+
for (const savedTab of saved.tabs) this.restoreTab(workspace, savedTab, found);
|
|
2489
|
+
const active = saved.activeTab !== void 0 ? workspace.tabs[saved.activeTab] : void 0;
|
|
2490
|
+
workspace.activeTab = active ?? workspace.tabs[0];
|
|
2373
2491
|
}
|
|
2374
2492
|
}
|
|
2375
|
-
restoreTab(
|
|
2493
|
+
restoreTab(workspace, saved, found) {
|
|
2376
2494
|
const build = /* @__PURE__ */ __name((node) => {
|
|
2377
2495
|
if (!("session" in node))
|
|
2378
2496
|
return {
|
|
@@ -2383,7 +2501,7 @@ var SpacesHost = class {
|
|
|
2383
2501
|
b: build(node.b)
|
|
2384
2502
|
};
|
|
2385
2503
|
const item = node.session;
|
|
2386
|
-
const entry = this.addEntry(
|
|
2504
|
+
const entry = this.addEntry(workspace, item.label);
|
|
2387
2505
|
if (item.conversationId) {
|
|
2388
2506
|
entry.conversationId = item.conversationId;
|
|
2389
2507
|
entry.resume = item.conversationId;
|
|
@@ -2397,22 +2515,22 @@ var SpacesHost = class {
|
|
|
2397
2515
|
const root = build(saved.tree);
|
|
2398
2516
|
const panes = leaves(root);
|
|
2399
2517
|
this.roster.addTree(
|
|
2400
|
-
|
|
2518
|
+
workspace,
|
|
2401
2519
|
root,
|
|
2402
2520
|
panes[saved.focus ?? 0] ?? panes[0],
|
|
2403
2521
|
saved.name,
|
|
2404
2522
|
saved.zoomed === true
|
|
2405
2523
|
);
|
|
2406
2524
|
}
|
|
2407
|
-
addEntry(
|
|
2408
|
-
const entry = this.roster.addSession(
|
|
2525
|
+
addEntry(workspace, label) {
|
|
2526
|
+
const entry = this.roster.addSession(workspace, this.options.newSlot?.() ?? randomUUID(), label);
|
|
2409
2527
|
this.persist();
|
|
2410
2528
|
return entry;
|
|
2411
2529
|
}
|
|
2412
|
-
/** A session in a tab of its own, after the
|
|
2413
|
-
newTabIn(
|
|
2414
|
-
const entry = this.addEntry(
|
|
2415
|
-
this.roster.addTab(
|
|
2530
|
+
/** A session in a tab of its own, after the workspace's other tabs. */
|
|
2531
|
+
newTabIn(workspace) {
|
|
2532
|
+
const entry = this.addEntry(workspace);
|
|
2533
|
+
this.roster.addTab(workspace, entry);
|
|
2416
2534
|
return entry;
|
|
2417
2535
|
}
|
|
2418
2536
|
layout() {
|
|
@@ -2424,7 +2542,7 @@ var SpacesHost = class {
|
|
|
2424
2542
|
rail: false,
|
|
2425
2543
|
rule: void 0,
|
|
2426
2544
|
main: whole,
|
|
2427
|
-
tabBar:
|
|
2545
|
+
tabBar: void 0,
|
|
2428
2546
|
panes: whole
|
|
2429
2547
|
};
|
|
2430
2548
|
}
|
|
@@ -2473,7 +2591,9 @@ var SpacesHost = class {
|
|
|
2473
2591
|
ensureStarted(entry) {
|
|
2474
2592
|
if (entry.child || this.closed || entry.checking) return;
|
|
2475
2593
|
if (entry.verifyFolder) {
|
|
2476
|
-
const found = (this.options.isDirectory ?? defaultIsDirectory)(
|
|
2594
|
+
const found = (this.options.isDirectory ?? defaultIsDirectory)(
|
|
2595
|
+
this.roster.workspaceOf(entry).cwd
|
|
2596
|
+
);
|
|
2477
2597
|
if (entry.folderMissing === found) {
|
|
2478
2598
|
entry.folderMissing = !found;
|
|
2479
2599
|
this.requestRender();
|
|
@@ -2483,8 +2603,8 @@ var SpacesHost = class {
|
|
|
2483
2603
|
const guard = this.options.inUseElsewhere;
|
|
2484
2604
|
if (entry.resume && guard) {
|
|
2485
2605
|
entry.checking = true;
|
|
2486
|
-
const
|
|
2487
|
-
void guard({ cwd:
|
|
2606
|
+
const workspace = this.roster.workspaceOf(entry);
|
|
2607
|
+
void guard({ cwd: workspace.cwd, conversationId: entry.resume }).catch(() => false).then((busy) => {
|
|
2488
2608
|
entry.checking = false;
|
|
2489
2609
|
if (this.closed || !this.roster.entries.includes(entry)) return;
|
|
2490
2610
|
entry.openElsewhere = busy;
|
|
@@ -2498,9 +2618,9 @@ var SpacesHost = class {
|
|
|
2498
2618
|
}
|
|
2499
2619
|
spawn(entry) {
|
|
2500
2620
|
if (entry.child || this.closed) return;
|
|
2501
|
-
const
|
|
2621
|
+
const workspace = this.roster.workspaceOf(entry);
|
|
2502
2622
|
const spec = this.options.spec({
|
|
2503
|
-
cwd:
|
|
2623
|
+
cwd: workspace.cwd,
|
|
2504
2624
|
slot: entry.slot,
|
|
2505
2625
|
first: entry.first,
|
|
2506
2626
|
...entry.pickedAccount ? { account: entry.pickedAccount } : {},
|
|
@@ -2534,7 +2654,7 @@ var SpacesHost = class {
|
|
|
2534
2654
|
show(entry) {
|
|
2535
2655
|
if (this.view === "full" && entry.child?.local) this.view = "split";
|
|
2536
2656
|
this.roster.select(entry);
|
|
2537
|
-
if (this.gitStarted) this.git.refresh(this.roster.
|
|
2657
|
+
if (this.gitStarted) this.git.refresh(this.roster.workspaceOf(entry).cwd, GIT_STALE_MS);
|
|
2538
2658
|
this.fit();
|
|
2539
2659
|
this.revealSelected();
|
|
2540
2660
|
this.persist();
|
|
@@ -2618,14 +2738,14 @@ var SpacesHost = class {
|
|
|
2618
2738
|
this.requestRender();
|
|
2619
2739
|
}
|
|
2620
2740
|
}
|
|
2621
|
-
/** A session that moved to another account makes that account the one its
|
|
2741
|
+
/** A session that moved to another account makes that account the one its workspace offers first. */
|
|
2622
2742
|
rememberAccount(entry, label) {
|
|
2623
|
-
const
|
|
2743
|
+
const workspace = this.roster.workspaceOf(entry);
|
|
2624
2744
|
const matches = (this.options.accounts?.() ?? []).filter((a) => a.label === label);
|
|
2625
2745
|
const found = label !== void 0 && matches.length === 1 ? matches[0] : void 0;
|
|
2626
2746
|
entry.pickedAccount = found?.id;
|
|
2627
|
-
if (label === void 0) delete
|
|
2628
|
-
else if (found)
|
|
2747
|
+
if (label === void 0) delete workspace.lastAccount;
|
|
2748
|
+
else if (found) workspace.lastAccount = found.id;
|
|
2629
2749
|
}
|
|
2630
2750
|
/** Asks each terminal its state directly, so a change that was never written is still seen. */
|
|
2631
2751
|
async reconcile() {
|
|
@@ -2725,20 +2845,20 @@ var SpacesHost = class {
|
|
|
2725
2845
|
case "quit":
|
|
2726
2846
|
this.askQuit();
|
|
2727
2847
|
return;
|
|
2728
|
-
case "new-
|
|
2729
|
-
this.prompt = { kind: "new-
|
|
2848
|
+
case "new-workspace":
|
|
2849
|
+
this.prompt = { kind: "new-workspace", value: this.roster.workspaceOf(entry).cwd };
|
|
2730
2850
|
return;
|
|
2731
2851
|
case "open-folder":
|
|
2732
2852
|
this.askFolder();
|
|
2733
2853
|
return;
|
|
2734
|
-
case "rename-
|
|
2735
|
-
this.askName("rename-
|
|
2854
|
+
case "rename-workspace":
|
|
2855
|
+
this.askName("rename-workspace", this.roster.workspaceOf(entry).name);
|
|
2736
2856
|
return;
|
|
2737
|
-
case "close-
|
|
2738
|
-
this.confirm = "close-
|
|
2857
|
+
case "close-workspace":
|
|
2858
|
+
this.confirm = "close-workspace";
|
|
2739
2859
|
return;
|
|
2740
2860
|
// The router starts these two modes itself; there is nothing more to do.
|
|
2741
|
-
case "
|
|
2861
|
+
case "workspace-mode":
|
|
2742
2862
|
case "resize-mode":
|
|
2743
2863
|
return;
|
|
2744
2864
|
case "sidebar":
|
|
@@ -2819,7 +2939,7 @@ var SpacesHost = class {
|
|
|
2819
2939
|
}
|
|
2820
2940
|
/**
|
|
2821
2941
|
* The running conversation is about to end (`/exit`, ctrl+c twice). With no other session
|
|
2822
|
-
* mid-turn it may go at once; otherwise the
|
|
2942
|
+
* mid-turn it may go at once; otherwise the workspaces screen comes up with the quit question
|
|
2823
2943
|
* and the answer decides.
|
|
2824
2944
|
*/
|
|
2825
2945
|
askLocalExit() {
|
|
@@ -2831,7 +2951,7 @@ var SpacesHost = class {
|
|
|
2831
2951
|
if (this.closed || this.quitting || !this.localEntry || !busy) return Promise.resolve(true);
|
|
2832
2952
|
this.exitGate?.(false);
|
|
2833
2953
|
return new Promise((resolve2) => {
|
|
2834
|
-
if (this.hidden) this.
|
|
2954
|
+
if (this.hidden) this.openWorkspaces();
|
|
2835
2955
|
else this.dismiss();
|
|
2836
2956
|
this.exitGate = resolve2;
|
|
2837
2957
|
this.confirm = "quit";
|
|
@@ -2848,17 +2968,17 @@ var SpacesHost = class {
|
|
|
2848
2968
|
this.relayout();
|
|
2849
2969
|
this.persist();
|
|
2850
2970
|
}
|
|
2851
|
-
/** A
|
|
2852
|
-
|
|
2971
|
+
/** A workspace in the focused pane's folder, started on the same account. */
|
|
2972
|
+
newWorkspaceHere() {
|
|
2853
2973
|
const entry = this.roster.selected;
|
|
2854
|
-
const cwd = entry ? this.roster.
|
|
2855
|
-
this.
|
|
2974
|
+
const cwd = entry ? this.roster.workspaceOf(entry).cwd : this.options.folder.cwd;
|
|
2975
|
+
this.newWorkspaceIn(cwd);
|
|
2856
2976
|
}
|
|
2857
|
-
/** A new
|
|
2858
|
-
|
|
2977
|
+
/** A new workspace in a folder, its first session on the account the focused pane runs on. */
|
|
2978
|
+
newWorkspaceIn(cwd) {
|
|
2859
2979
|
const entry = this.roster.selected;
|
|
2860
|
-
const
|
|
2861
|
-
const created = this.newTabIn(
|
|
2980
|
+
const workspace = this.roster.addWorkspace(cwd, basename(cwd) || cwd);
|
|
2981
|
+
const created = this.newTabIn(workspace);
|
|
2862
2982
|
if (entry?.pickedAccount) created.pickedAccount = entry.pickedAccount;
|
|
2863
2983
|
this.open(created);
|
|
2864
2984
|
}
|
|
@@ -2896,7 +3016,7 @@ var SpacesHost = class {
|
|
|
2896
3016
|
addAccount() {
|
|
2897
3017
|
const entry = this.roster.selected;
|
|
2898
3018
|
if (!entry) return;
|
|
2899
|
-
this.startIn(this.roster.
|
|
3019
|
+
this.startIn(this.roster.workspaceOf(entry), void 0, false);
|
|
2900
3020
|
this.notice = "Type /auth in this session to add an account.";
|
|
2901
3021
|
}
|
|
2902
3022
|
menuKey(key) {
|
|
@@ -2963,7 +3083,7 @@ var SpacesHost = class {
|
|
|
2963
3083
|
if (target.kind === "pane") this.open(target.entry);
|
|
2964
3084
|
else if (target.kind === "tab") this.open(target.tab.focus);
|
|
2965
3085
|
else {
|
|
2966
|
-
const entry = target.
|
|
3086
|
+
const entry = target.workspace.activeTab?.focus ?? this.roster.entriesOf(target.workspace)[0];
|
|
2967
3087
|
if (entry) this.open(entry);
|
|
2968
3088
|
}
|
|
2969
3089
|
}
|
|
@@ -3002,20 +3122,20 @@ var SpacesHost = class {
|
|
|
3002
3122
|
if (!context) return;
|
|
3003
3123
|
const item = CONTEXT_ITEMS[context.target.kind][index];
|
|
3004
3124
|
const { target } = context;
|
|
3005
|
-
const entry = target.kind === "pane" ? target.entry : target.kind === "tab" ? target.tab.focus : target.
|
|
3125
|
+
const entry = target.kind === "pane" ? target.entry : target.kind === "tab" ? target.tab.focus : target.workspace.activeTab?.focus ?? this.roster.entriesOf(target.workspace)[0];
|
|
3006
3126
|
if (!entry || !item) return;
|
|
3007
3127
|
this.show(entry);
|
|
3008
|
-
const shown = this.roster.
|
|
3128
|
+
const shown = this.roster.workspaceOf(entry);
|
|
3009
3129
|
if (item === "Rename") {
|
|
3010
|
-
if (target.kind === "
|
|
3130
|
+
if (target.kind === "workspace") this.askName("rename-workspace", shown.name);
|
|
3011
3131
|
else if (target.kind === "tab") this.askName("rename-tab", this.shownTabLabel());
|
|
3012
3132
|
else this.askName("rename-session", entry.label);
|
|
3013
3133
|
} else if (item === "New tab") this.newTab();
|
|
3014
3134
|
else if (item === "Split right") this.splitFocused("side");
|
|
3015
3135
|
else if (item === "Split down") this.splitFocused("stack");
|
|
3016
3136
|
else if (item === "Zoom") this.toggleZoom();
|
|
3017
|
-
else if (target.kind === "
|
|
3018
|
-
else if (target.kind === "tab") this.
|
|
3137
|
+
else if (target.kind === "workspace") this.confirm = "close-workspace";
|
|
3138
|
+
else if (target.kind === "tab") this.closeTabOrWorkspace();
|
|
3019
3139
|
else this.closePane();
|
|
3020
3140
|
this.router.capture(this.captured());
|
|
3021
3141
|
}
|
|
@@ -3044,7 +3164,7 @@ var SpacesHost = class {
|
|
|
3044
3164
|
else if (key.kind === "backtab") this.cyclePane(-1);
|
|
3045
3165
|
else if (c === CLEAR) this.askQuit();
|
|
3046
3166
|
}
|
|
3047
|
-
/** Moves the selection through the sessions in the order the sidebar lists them; the
|
|
3167
|
+
/** Moves the selection through the sessions in the order the sidebar lists them; the workspace and its tab follow. */
|
|
3048
3168
|
stepSession(delta) {
|
|
3049
3169
|
const entry = this.roster.selected;
|
|
3050
3170
|
if (!entry) return;
|
|
@@ -3085,11 +3205,11 @@ var SpacesHost = class {
|
|
|
3085
3205
|
const outer = this.flatPanes().find((p) => p.entry === entry)?.outer;
|
|
3086
3206
|
const room = dir === "side" ? outer?.width ?? 0 : outer?.height ?? 0;
|
|
3087
3207
|
const least = dir === "side" ? MIN_PANE_WIDTH : MIN_PANE_HEIGHT;
|
|
3088
|
-
if (room < least * 2) {
|
|
3208
|
+
if (room < least * 2 + SPLIT_GAP) {
|
|
3089
3209
|
this.notice = "There is not enough room to split this pane.";
|
|
3090
3210
|
return;
|
|
3091
3211
|
}
|
|
3092
|
-
const created = this.addEntry(this.roster.
|
|
3212
|
+
const created = this.addEntry(this.roster.workspaceOf(entry));
|
|
3093
3213
|
if (entry.pickedAccount) created.pickedAccount = entry.pickedAccount;
|
|
3094
3214
|
this.roster.splitBeside(entry, created, dir);
|
|
3095
3215
|
this.open(created);
|
|
@@ -3128,48 +3248,48 @@ var SpacesHost = class {
|
|
|
3128
3248
|
stepTab(delta) {
|
|
3129
3249
|
const entry = this.roster.selected;
|
|
3130
3250
|
if (!entry) return;
|
|
3131
|
-
const
|
|
3132
|
-
const at =
|
|
3133
|
-
this.gotoTab((at + delta +
|
|
3251
|
+
const workspace = this.roster.workspaceOf(entry);
|
|
3252
|
+
const at = workspace.activeTab ? workspace.tabs.indexOf(workspace.activeTab) : 0;
|
|
3253
|
+
this.gotoTab((at + delta + workspace.tabs.length) % workspace.tabs.length);
|
|
3134
3254
|
}
|
|
3135
3255
|
gotoTab(index) {
|
|
3136
3256
|
const entry = this.roster.selected;
|
|
3137
3257
|
if (!entry) return;
|
|
3138
|
-
const tab = this.roster.
|
|
3258
|
+
const tab = this.roster.workspaceOf(entry).tabs[index];
|
|
3139
3259
|
if (tab) this.open(tab.focus);
|
|
3140
3260
|
}
|
|
3141
|
-
/** Closes the focused pane; the last pane of a tab closes the tab, and of a
|
|
3261
|
+
/** Closes the focused pane; the last pane of a tab closes the tab, and of a workspace's only tab asks to close the workspace. */
|
|
3142
3262
|
closePane() {
|
|
3143
3263
|
const entry = this.roster.selected;
|
|
3144
3264
|
const tab = this.roster.shownTab;
|
|
3145
3265
|
if (!entry || !tab) return;
|
|
3146
|
-
if (leaves(tab.root).length > 1 || this.roster.
|
|
3266
|
+
if (leaves(tab.root).length > 1 || this.roster.workspaceOf(entry).tabs.length > 1) {
|
|
3147
3267
|
this.closeEntries([entry]);
|
|
3148
3268
|
return;
|
|
3149
3269
|
}
|
|
3150
|
-
this.confirm = "close-
|
|
3270
|
+
this.confirm = "close-workspace";
|
|
3151
3271
|
}
|
|
3152
|
-
/** Closes a tab; a
|
|
3153
|
-
|
|
3272
|
+
/** Closes a tab; a workspace's only tab closes the workspace, after asking. */
|
|
3273
|
+
closeTabOrWorkspace() {
|
|
3154
3274
|
const entry = this.roster.selected;
|
|
3155
|
-
if (entry && this.roster.
|
|
3156
|
-
else this.confirm = "close-
|
|
3275
|
+
if (entry && this.roster.workspaceOf(entry).tabs.length > 1) this.closeTab();
|
|
3276
|
+
else this.confirm = "close-workspace";
|
|
3157
3277
|
}
|
|
3158
3278
|
closeTab() {
|
|
3159
3279
|
const entry = this.roster.selected;
|
|
3160
3280
|
const tab = this.roster.shownTab;
|
|
3161
3281
|
if (!entry || !tab) return;
|
|
3162
|
-
if (this.roster.
|
|
3163
|
-
this.notice = "A
|
|
3282
|
+
if (this.roster.workspaceOf(entry).tabs.length <= 1) {
|
|
3283
|
+
this.notice = "A workspace keeps at least one tab.";
|
|
3164
3284
|
return;
|
|
3165
3285
|
}
|
|
3166
3286
|
this.closeEntries(leaves(tab.root));
|
|
3167
3287
|
}
|
|
3168
|
-
/** Starts a session in a new tab of the shown
|
|
3288
|
+
/** Starts a session in a new tab of the shown workspace, asking which account first when there is a choice. */
|
|
3169
3289
|
newTab() {
|
|
3170
3290
|
const entry = this.roster.selected;
|
|
3171
3291
|
if (!entry) return;
|
|
3172
|
-
const
|
|
3292
|
+
const workspace = this.roster.workspaceOf(entry);
|
|
3173
3293
|
let accounts = [];
|
|
3174
3294
|
try {
|
|
3175
3295
|
accounts = (this.options.accounts?.() ?? []).filter((a) => a.label !== "default");
|
|
@@ -3177,7 +3297,7 @@ var SpacesHost = class {
|
|
|
3177
3297
|
accounts = [];
|
|
3178
3298
|
}
|
|
3179
3299
|
if (accounts.length === 0) {
|
|
3180
|
-
this.startIn(
|
|
3300
|
+
this.startIn(workspace, void 0);
|
|
3181
3301
|
return;
|
|
3182
3302
|
}
|
|
3183
3303
|
const choices = [
|
|
@@ -3187,13 +3307,15 @@ var SpacesHost = class {
|
|
|
3187
3307
|
text: `${a.label} ${a.provider}`
|
|
3188
3308
|
}))
|
|
3189
3309
|
];
|
|
3190
|
-
const remembered = choices.findIndex(
|
|
3191
|
-
|
|
3310
|
+
const remembered = choices.findIndex(
|
|
3311
|
+
(c) => c.id !== void 0 && c.id === workspace.lastAccount
|
|
3312
|
+
);
|
|
3313
|
+
this.picker = { workspace, choices, index: Math.max(0, remembered) };
|
|
3192
3314
|
}
|
|
3193
|
-
startIn(
|
|
3194
|
-
if (account === void 0) delete
|
|
3195
|
-
else
|
|
3196
|
-
const created = this.newTabIn(
|
|
3315
|
+
startIn(workspace, account, ask = true) {
|
|
3316
|
+
if (account === void 0) delete workspace.lastAccount;
|
|
3317
|
+
else workspace.lastAccount = account;
|
|
3318
|
+
const created = this.newTabIn(workspace);
|
|
3197
3319
|
if (account !== void 0) created.pickedAccount = account;
|
|
3198
3320
|
this.open(created);
|
|
3199
3321
|
if (ask) {
|
|
@@ -3201,17 +3323,17 @@ var SpacesHost = class {
|
|
|
3201
3323
|
this.router.capture(true);
|
|
3202
3324
|
}
|
|
3203
3325
|
}
|
|
3204
|
-
/** Moves among the
|
|
3205
|
-
|
|
3326
|
+
/** Moves among the workspaces, showing each one's tab without starting what it holds. */
|
|
3327
|
+
stepWorkspace(delta) {
|
|
3206
3328
|
const entry = this.roster.selected;
|
|
3207
3329
|
if (!entry) return;
|
|
3208
|
-
const index = this.roster.
|
|
3209
|
-
const
|
|
3210
|
-
const target =
|
|
3330
|
+
const index = this.roster.workspaces.indexOf(this.roster.workspaceOf(entry)) + delta;
|
|
3331
|
+
const workspace = this.roster.workspaces[index];
|
|
3332
|
+
const target = workspace?.activeTab?.focus;
|
|
3211
3333
|
if (target) this.show(target);
|
|
3212
3334
|
}
|
|
3213
|
-
|
|
3214
|
-
const target = this.roster.
|
|
3335
|
+
gotoWorkspace(index) {
|
|
3336
|
+
const target = this.roster.workspaces[index]?.activeTab?.focus;
|
|
3215
3337
|
if (target) this.show(target);
|
|
3216
3338
|
}
|
|
3217
3339
|
pickerKey(key) {
|
|
@@ -3226,7 +3348,7 @@ var SpacesHost = class {
|
|
|
3226
3348
|
else if (key.kind === "enter") {
|
|
3227
3349
|
this.picker = void 0;
|
|
3228
3350
|
this.router.capture(false);
|
|
3229
|
-
this.startIn(picker.
|
|
3351
|
+
this.startIn(picker.workspace, picker.choices[picker.index]?.id);
|
|
3230
3352
|
}
|
|
3231
3353
|
}
|
|
3232
3354
|
askFolder() {
|
|
@@ -3255,7 +3377,7 @@ var SpacesHost = class {
|
|
|
3255
3377
|
}
|
|
3256
3378
|
if (key.kind !== "enter") return;
|
|
3257
3379
|
const value = prompt.value.trim();
|
|
3258
|
-
if (prompt.kind === "folder" || prompt.kind === "new-
|
|
3380
|
+
if (prompt.kind === "folder" || prompt.kind === "new-workspace") {
|
|
3259
3381
|
if (value === "") {
|
|
3260
3382
|
this.endPrompt();
|
|
3261
3383
|
return;
|
|
@@ -3266,7 +3388,7 @@ var SpacesHost = class {
|
|
|
3266
3388
|
return;
|
|
3267
3389
|
}
|
|
3268
3390
|
this.endPrompt();
|
|
3269
|
-
if (prompt.kind === "new-
|
|
3391
|
+
if (prompt.kind === "new-workspace") this.newWorkspaceIn(path);
|
|
3270
3392
|
else this.openFolder(path);
|
|
3271
3393
|
return;
|
|
3272
3394
|
}
|
|
@@ -3274,8 +3396,8 @@ var SpacesHost = class {
|
|
|
3274
3396
|
const tab = this.roster.shownTab;
|
|
3275
3397
|
if (entry) {
|
|
3276
3398
|
if (prompt.kind === "rename-session" && value !== "") entry.label = value;
|
|
3277
|
-
else if (prompt.kind === "rename-
|
|
3278
|
-
this.roster.
|
|
3399
|
+
else if (prompt.kind === "rename-workspace" && value !== "")
|
|
3400
|
+
this.roster.workspaceOf(entry).name = value;
|
|
3279
3401
|
else if (prompt.kind === "rename-tab" && tab) {
|
|
3280
3402
|
if (value === "") delete tab.name;
|
|
3281
3403
|
else tab.name = value;
|
|
@@ -3291,19 +3413,19 @@ var SpacesHost = class {
|
|
|
3291
3413
|
expand(value) {
|
|
3292
3414
|
const home = this.options.homeDirectory ?? homedir();
|
|
3293
3415
|
const full = value === "~" ? home : value.startsWith("~/") ? join(home, value.slice(2)) : value;
|
|
3294
|
-
const base = this.roster.selected ? this.roster.
|
|
3416
|
+
const base = this.roster.selected ? this.roster.workspaceOf(this.roster.selected).cwd : this.options.folder.cwd;
|
|
3295
3417
|
return isAbsolute(full) ? resolve(full) : resolve(base, full);
|
|
3296
3418
|
}
|
|
3297
|
-
/** Opens a folder as a
|
|
3419
|
+
/** Opens a folder as a workspace, or shows the workspace it already is. */
|
|
3298
3420
|
openFolder(path) {
|
|
3299
|
-
const known = this.roster.
|
|
3421
|
+
const known = this.roster.workspaces.find((s) => s.cwd === path);
|
|
3300
3422
|
if (known) {
|
|
3301
3423
|
const entry = known.activeTab?.focus ?? this.roster.entriesOf(known)[0];
|
|
3302
3424
|
if (entry) this.open(entry);
|
|
3303
3425
|
return;
|
|
3304
3426
|
}
|
|
3305
|
-
const
|
|
3306
|
-
this.open(this.newTabIn(
|
|
3427
|
+
const workspace = this.roster.addWorkspace(path, basename(path) || path);
|
|
3428
|
+
this.open(this.newTabIn(workspace));
|
|
3307
3429
|
}
|
|
3308
3430
|
perform(what) {
|
|
3309
3431
|
const entry = this.roster.selected;
|
|
@@ -3312,7 +3434,7 @@ var SpacesHost = class {
|
|
|
3312
3434
|
return;
|
|
3313
3435
|
}
|
|
3314
3436
|
if (!entry) return;
|
|
3315
|
-
this.closeEntries(this.roster.entriesOf(this.roster.
|
|
3437
|
+
this.closeEntries(this.roster.entriesOf(this.roster.workspaceOf(entry)));
|
|
3316
3438
|
}
|
|
3317
3439
|
/** Ends the sessions and takes their panes away; closing the last one leaves nothing to bring back and quits. */
|
|
3318
3440
|
closeEntries(doomed) {
|
|
@@ -3393,7 +3515,7 @@ var SpacesHost = class {
|
|
|
3393
3515
|
return;
|
|
3394
3516
|
}
|
|
3395
3517
|
if (event.kind === "drag") {
|
|
3396
|
-
if (this.reorder) this.
|
|
3518
|
+
if (this.reorder) this.dragWorkspace(layout, event);
|
|
3397
3519
|
else if (this.sidebarDrag) this.dragSidebar(event);
|
|
3398
3520
|
else this.dragBorder(event);
|
|
3399
3521
|
return;
|
|
@@ -3413,7 +3535,7 @@ var SpacesHost = class {
|
|
|
3413
3535
|
return;
|
|
3414
3536
|
}
|
|
3415
3537
|
if (this.router.current !== "terminal") this.router.focus();
|
|
3416
|
-
this.
|
|
3538
|
+
this.panePress(event);
|
|
3417
3539
|
this.requestRender();
|
|
3418
3540
|
}
|
|
3419
3541
|
/** A press on the line between the sidebar and the session: a second one soon after resets the width. */
|
|
@@ -3447,12 +3569,15 @@ var SpacesHost = class {
|
|
|
3447
3569
|
sidebarPress(sidebar, rail, event) {
|
|
3448
3570
|
const target = hitTest(this.sidebarModel(rail), sidebar.width, sidebar.height, event.x, event.y);
|
|
3449
3571
|
if (target?.kind === "agent") this.open(target.entry);
|
|
3450
|
-
else if (target?.kind === "
|
|
3451
|
-
this.reorder = {
|
|
3452
|
-
|
|
3572
|
+
else if (target?.kind === "workspace") {
|
|
3573
|
+
this.reorder = {
|
|
3574
|
+
workspace: target.workspace,
|
|
3575
|
+
to: this.roster.workspaces.indexOf(target.workspace)
|
|
3576
|
+
};
|
|
3577
|
+
this.gotoWorkspace(this.roster.workspaces.indexOf(target.workspace));
|
|
3453
3578
|
const shown = this.roster.selected;
|
|
3454
3579
|
if (shown) this.open(shown);
|
|
3455
|
-
} else if (target?.kind === "new") this.
|
|
3580
|
+
} else if (target?.kind === "new") this.newWorkspaceHere();
|
|
3456
3581
|
else if (target?.kind === "menu") this.openMenu();
|
|
3457
3582
|
else if (target?.kind === "collapse") this.toggleSidebar();
|
|
3458
3583
|
else if (target?.kind === "split") this.sidebarDrag = "split";
|
|
@@ -3463,10 +3588,10 @@ var SpacesHost = class {
|
|
|
3463
3588
|
}
|
|
3464
3589
|
this.requestRender();
|
|
3465
3590
|
}
|
|
3466
|
-
/** A pointer button went up: a drag of a border, the sidebar or a
|
|
3591
|
+
/** A pointer button went up: a drag of a border, the sidebar or a workspace ends, and a moved workspace lands. */
|
|
3467
3592
|
endDrags() {
|
|
3468
3593
|
const moved = this.reorder;
|
|
3469
|
-
if (moved && this.roster.
|
|
3594
|
+
if (moved && this.roster.moveWorkspace(moved.workspace, moved.to)) {
|
|
3470
3595
|
this.revealSelected();
|
|
3471
3596
|
this.persist();
|
|
3472
3597
|
}
|
|
@@ -3476,8 +3601,8 @@ var SpacesHost = class {
|
|
|
3476
3601
|
this.sidebarDrag = void 0;
|
|
3477
3602
|
this.requestRender();
|
|
3478
3603
|
}
|
|
3479
|
-
/** While a
|
|
3480
|
-
|
|
3604
|
+
/** While a workspace is dragged: the place it would land is the workspace row under the pointer. */
|
|
3605
|
+
dragWorkspace(layout, event) {
|
|
3481
3606
|
const drag = this.reorder;
|
|
3482
3607
|
if (!drag || !layout.sidebar) return;
|
|
3483
3608
|
const target = hitTest(
|
|
@@ -3487,7 +3612,7 @@ var SpacesHost = class {
|
|
|
3487
3612
|
Math.min(event.x, layout.sidebar.width - 1),
|
|
3488
3613
|
event.y
|
|
3489
3614
|
);
|
|
3490
|
-
if (target?.kind === "
|
|
3615
|
+
if (target?.kind === "workspace") drag.to = this.roster.workspaces.indexOf(target.workspace);
|
|
3491
3616
|
else if (!target) {
|
|
3492
3617
|
const geo = geometry(
|
|
3493
3618
|
layout.sidebar.height,
|
|
@@ -3495,13 +3620,13 @@ var SpacesHost = class {
|
|
|
3495
3620
|
this.split,
|
|
3496
3621
|
layout.rail
|
|
3497
3622
|
);
|
|
3498
|
-
const shown = this.roster.
|
|
3499
|
-
if (event.y >= geo.
|
|
3500
|
-
drag.to = this.roster.
|
|
3623
|
+
const shown = this.roster.workspaces.length - this.sidebarScroll.workspaces;
|
|
3624
|
+
if (event.y >= geo.workspaceTop + shown * geo.workspaceStep && event.y < (geo.footerY ?? geo.ruleY))
|
|
3625
|
+
drag.to = this.roster.workspaces.length - 1;
|
|
3501
3626
|
}
|
|
3502
3627
|
this.requestRender();
|
|
3503
3628
|
}
|
|
3504
|
-
/** A right-click: a menu for the
|
|
3629
|
+
/** A right-click: a menu for the workspace, tab or pane under the pointer. */
|
|
3505
3630
|
openContext(layout, event) {
|
|
3506
3631
|
let target;
|
|
3507
3632
|
if (layout.sidebar && event.x < layout.sidebar.width) {
|
|
@@ -3512,11 +3637,15 @@ var SpacesHost = class {
|
|
|
3512
3637
|
event.x,
|
|
3513
3638
|
event.y
|
|
3514
3639
|
);
|
|
3515
|
-
if (hit?.kind === "
|
|
3640
|
+
if (hit?.kind === "workspace") target = { kind: "workspace", workspace: hit.workspace };
|
|
3516
3641
|
else if (hit?.kind === "agent") target = { kind: "pane", entry: hit.entry };
|
|
3517
|
-
} else if (
|
|
3642
|
+
} else if (layout.tabBar && inRect(layout.tabBar, event.x, event.y)) {
|
|
3518
3643
|
const entry = this.roster.selected;
|
|
3519
|
-
const hit = entry ? tabBarTarget(
|
|
3644
|
+
const hit = entry ? tabBarTarget(
|
|
3645
|
+
layoutTabBar(this.roster.workspaceOf(entry), layout.tabBar),
|
|
3646
|
+
event.x,
|
|
3647
|
+
event.y
|
|
3648
|
+
) : void 0;
|
|
3520
3649
|
if (hit?.kind === "tab") target = { kind: "tab", tab: hit.tab };
|
|
3521
3650
|
} else {
|
|
3522
3651
|
const placement = this.placement();
|
|
@@ -3604,16 +3733,18 @@ var SpacesHost = class {
|
|
|
3604
3733
|
else this.dismiss();
|
|
3605
3734
|
}
|
|
3606
3735
|
}
|
|
3607
|
-
/** A press in the
|
|
3608
|
-
|
|
3736
|
+
/** A press in the pane area: a tab, the "+", a border to drag, or a pane to focus. */
|
|
3737
|
+
panePress(event) {
|
|
3609
3738
|
const layout = this.layout();
|
|
3610
3739
|
const entry = this.roster.selected;
|
|
3611
3740
|
if (!entry) return;
|
|
3612
|
-
if (
|
|
3613
|
-
const bar = layoutTabBar(this.roster.
|
|
3741
|
+
if (layout.tabBar && inRect(layout.tabBar, event.x, event.y)) {
|
|
3742
|
+
const bar = layoutTabBar(this.roster.workspaceOf(entry), layout.tabBar);
|
|
3614
3743
|
const target = tabBarTarget(bar, event.x, event.y);
|
|
3615
3744
|
if (target?.kind === "new") this.newTab();
|
|
3616
3745
|
else if (target?.kind === "tab") this.open(target.tab.focus);
|
|
3746
|
+
else if (target?.kind === "previous") this.stepTab(-1);
|
|
3747
|
+
else if (target?.kind === "next") this.stepTab(1);
|
|
3617
3748
|
return;
|
|
3618
3749
|
}
|
|
3619
3750
|
const placement = this.placement();
|
|
@@ -3828,12 +3959,12 @@ var SpacesHost = class {
|
|
|
3828
3959
|
if (prompt) {
|
|
3829
3960
|
const titles = {
|
|
3830
3961
|
folder: "open folder",
|
|
3831
|
-
"new-
|
|
3962
|
+
"new-workspace": "new workspace",
|
|
3832
3963
|
"rename-session": "rename pane",
|
|
3833
|
-
"rename-
|
|
3964
|
+
"rename-workspace": "rename workspace",
|
|
3834
3965
|
"rename-tab": prompt.fresh ? "new tab" : "rename tab"
|
|
3835
3966
|
};
|
|
3836
|
-
const create = prompt.kind === "folder" || prompt.kind === "new-
|
|
3967
|
+
const create = prompt.kind === "folder" || prompt.kind === "new-workspace" || prompt.fresh;
|
|
3837
3968
|
return {
|
|
3838
3969
|
title: titles[prompt.kind],
|
|
3839
3970
|
input: { value: prompt.value },
|
|
@@ -3856,12 +3987,12 @@ var SpacesHost = class {
|
|
|
3856
3987
|
]
|
|
3857
3988
|
};
|
|
3858
3989
|
if (this.confirm && entry) {
|
|
3859
|
-
const
|
|
3860
|
-
const count = this.roster.entriesOf(
|
|
3990
|
+
const workspace = this.roster.workspaceOf(entry);
|
|
3991
|
+
const count = this.roster.entriesOf(workspace).length;
|
|
3861
3992
|
return {
|
|
3862
|
-
title: "Close
|
|
3993
|
+
title: "Close workspace?",
|
|
3863
3994
|
danger: true,
|
|
3864
|
-
lines: [`${
|
|
3995
|
+
lines: [`${workspace.name} \u2014 ${count} ${count === 1 ? "pane" : "panes"}`],
|
|
3865
3996
|
buttons: [
|
|
3866
3997
|
{ label: "\u21B2 confirm", action: "confirm", primary: true },
|
|
3867
3998
|
{ label: "esc cancel", action: "cancel" }
|
|
@@ -3872,7 +4003,7 @@ var SpacesHost = class {
|
|
|
3872
4003
|
}
|
|
3873
4004
|
pickerSpec(picker) {
|
|
3874
4005
|
return {
|
|
3875
|
-
title: `Start a session in ${picker.
|
|
4006
|
+
title: `Start a session in ${picker.workspace.name} on`,
|
|
3876
4007
|
rows: picker.choices.map((c) => ({ text: c.text })),
|
|
3877
4008
|
index: picker.index,
|
|
3878
4009
|
scroll: 0,
|
|
@@ -3950,7 +4081,7 @@ var SpacesHost = class {
|
|
|
3950
4081
|
if (mode === "resize")
|
|
3951
4082
|
return {
|
|
3952
4083
|
chip: "RESIZE",
|
|
3953
|
-
chipBg: this.palette.
|
|
4084
|
+
chipBg: this.palette.resize,
|
|
3954
4085
|
hints: [
|
|
3955
4086
|
["esc", "done"],
|
|
3956
4087
|
["h/l", "width"],
|
|
@@ -3960,7 +4091,7 @@ var SpacesHost = class {
|
|
|
3960
4091
|
if (mode === "navigate")
|
|
3961
4092
|
return {
|
|
3962
4093
|
chip: "NAVIGATE",
|
|
3963
|
-
chipBg: this.palette.
|
|
4094
|
+
chipBg: this.palette.navigate,
|
|
3964
4095
|
hints: [
|
|
3965
4096
|
["\u2191/\u2193", "session"],
|
|
3966
4097
|
["\u2192", "open"],
|
|
@@ -3974,30 +4105,55 @@ var SpacesHost = class {
|
|
|
3974
4105
|
hints: [
|
|
3975
4106
|
["esc", "cancel"],
|
|
3976
4107
|
[prefix, "send prefix"],
|
|
3977
|
-
["w", "
|
|
4108
|
+
["w", "workspace nav"],
|
|
3978
4109
|
["?", "keybinds"]
|
|
3979
4110
|
]
|
|
3980
4111
|
};
|
|
3981
4112
|
}
|
|
4113
|
+
/**
|
|
4114
|
+
* Draws the mode bar at the right end of `area`, a row that holds no pane cells: the tab bar's
|
|
4115
|
+
* rule. Hints that do not fit are left out, the chip never is.
|
|
4116
|
+
*/
|
|
3982
4117
|
drawModeBar(frame, area, mode) {
|
|
3983
4118
|
const { palette } = this;
|
|
3984
4119
|
const bar = this.modeBar(mode);
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
fg: palette.
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
});
|
|
3995
|
-
put(" ", { fg: palette.dim, bg: palette.panelBg });
|
|
4120
|
+
const chip = ` ${bar.chip} `;
|
|
4121
|
+
const pieces = [
|
|
4122
|
+
{
|
|
4123
|
+
text: chip,
|
|
4124
|
+
style: palette.mono ? { attrs: ATTR_BOLD | ATTR_INVERSE } : { fg: palette.ink, bg: bar.chipBg, attrs: ATTR_BOLD }
|
|
4125
|
+
},
|
|
4126
|
+
{ text: " ", style: { fg: palette.dim } }
|
|
4127
|
+
];
|
|
4128
|
+
let width = stringWidth(chip) + 1;
|
|
3996
4129
|
for (const [key, what] of bar.hints) {
|
|
3997
|
-
|
|
3998
|
-
|
|
4130
|
+
const hint = ` ${what} `;
|
|
4131
|
+
if (width + stringWidth(key) + stringWidth(hint) > area.width - 1) break;
|
|
4132
|
+
pieces.push({ text: key, style: { fg: palette.accent, attrs: ATTR_BOLD } });
|
|
4133
|
+
pieces.push({ text: hint, style: { fg: palette.dim } });
|
|
4134
|
+
width += stringWidth(key) + stringWidth(hint);
|
|
4135
|
+
}
|
|
4136
|
+
const used = Math.min(width, area.width);
|
|
4137
|
+
let x = area.x + area.width - used;
|
|
4138
|
+
frame.fillRect({ ...area, x, width: used }, { bg: palette.base });
|
|
4139
|
+
for (const piece of pieces) {
|
|
4140
|
+
if (x >= area.x + area.width) break;
|
|
4141
|
+
x += frame.writeText(
|
|
4142
|
+
{ ...area, x, width: area.x + area.width - x },
|
|
4143
|
+
0,
|
|
4144
|
+
piece.text,
|
|
4145
|
+
piece.style
|
|
4146
|
+
);
|
|
3999
4147
|
}
|
|
4000
4148
|
}
|
|
4149
|
+
/** A line of notice at the right end of `area`, in the warning colour. */
|
|
4150
|
+
drawNotice(frame, area, notice) {
|
|
4151
|
+
const text = ellipsize(` ${notice} `, Math.max(0, area.width - 1));
|
|
4152
|
+
const width = stringWidth(text);
|
|
4153
|
+
const rect = { ...area, x: area.x + area.width - width, width };
|
|
4154
|
+
frame.fillRect(rect, { bg: this.palette.base });
|
|
4155
|
+
frame.writeText(rect, 0, text, { fg: this.palette.warn });
|
|
4156
|
+
}
|
|
4001
4157
|
requestRender() {
|
|
4002
4158
|
if (this.closed || this.hidden || this.pending) return;
|
|
4003
4159
|
const cancel = this.schedule(() => {
|
|
@@ -4052,27 +4208,17 @@ var SpacesHost = class {
|
|
|
4052
4208
|
});
|
|
4053
4209
|
}
|
|
4054
4210
|
if (layout.rule) drawRule(frame, layout.rule, this.palette);
|
|
4055
|
-
if (entry && this.view === "split")
|
|
4056
|
-
drawTabBar(frame, layout.tabBar, this.roster.
|
|
4211
|
+
if (entry && this.view === "split" && layout.tabBar)
|
|
4212
|
+
drawTabBar(frame, layout.tabBar, this.roster.workspaceOf(entry), this.palette);
|
|
4057
4213
|
const ordered = [...panes].sort((a, b) => Number(a.entry === entry) - Number(b.entry === entry));
|
|
4058
4214
|
for (const pane of ordered)
|
|
4059
4215
|
this.drawPane(frame, pane, pane.entry === entry, placement?.bordered ?? false);
|
|
4060
4216
|
if (this.reorder) this.drawDrop(frame, layout);
|
|
4061
|
-
const area = {
|
|
4062
|
-
...layout.main,
|
|
4063
|
-
y: layout.main.y + layout.main.height - 1,
|
|
4064
|
-
height: 1
|
|
4065
|
-
};
|
|
4217
|
+
const area = layout.tabBar && layout.tabBar.height >= TAB_BAR_HEIGHT ? { ...layout.main, y: layout.main.y + 1, height: 1 } : { ...layout.main, y: layout.main.y + layout.main.height - 1, height: 1 };
|
|
4066
4218
|
const mode = this.router.current;
|
|
4067
4219
|
const asking = this.captured();
|
|
4068
4220
|
if (mode !== "terminal" && !asking) this.drawModeBar(frame, area, mode);
|
|
4069
|
-
else if (this.notice && !asking)
|
|
4070
|
-
frame.fillRect(area, { bg: this.palette.panelBg });
|
|
4071
|
-
frame.writeText(area, 0, ` ${this.notice}`, {
|
|
4072
|
-
fg: this.palette.yellow,
|
|
4073
|
-
bg: this.palette.panelBg
|
|
4074
|
-
});
|
|
4075
|
-
}
|
|
4221
|
+
else if (this.notice && !asking) this.drawNotice(frame, area, this.notice);
|
|
4076
4222
|
this.drawOverlay(frame);
|
|
4077
4223
|
if (mode !== "terminal" || asking)
|
|
4078
4224
|
frame.setCursor({ x: frame.cursor.x, y: frame.cursor.y, visible: false });
|
|
@@ -4089,12 +4235,12 @@ var SpacesHost = class {
|
|
|
4089
4235
|
this.armGit(true);
|
|
4090
4236
|
}
|
|
4091
4237
|
}
|
|
4092
|
-
/** Reads every
|
|
4238
|
+
/** Reads every workspace's branch now and then again on a timer. */
|
|
4093
4239
|
armGit(now = false) {
|
|
4094
4240
|
if (this.closed) return;
|
|
4095
|
-
if (now) this.git.refreshAll(this.roster.
|
|
4241
|
+
if (now) this.git.refreshAll(this.roster.workspaces.map((s) => s.cwd));
|
|
4096
4242
|
this.cancelGit = this.schedule(() => {
|
|
4097
|
-
this.git.refreshAll(this.roster.
|
|
4243
|
+
this.git.refreshAll(this.roster.workspaces.map((s) => s.cwd));
|
|
4098
4244
|
this.armGit();
|
|
4099
4245
|
}, GIT_MS);
|
|
4100
4246
|
}
|
|
@@ -4124,18 +4270,18 @@ var SpacesHost = class {
|
|
|
4124
4270
|
if (modal) drawModal(frame, layoutModal(screen, modal), modal, palette);
|
|
4125
4271
|
else if (list) drawList(frame, layoutList(screen, list), list, palette);
|
|
4126
4272
|
}
|
|
4127
|
-
/** The line a dragged
|
|
4273
|
+
/** The line a dragged workspace would land at: under the row above the place it would take. */
|
|
4128
4274
|
drawDrop(frame, layout) {
|
|
4129
4275
|
const drag = this.reorder;
|
|
4130
4276
|
const sidebar = layout.sidebar;
|
|
4131
4277
|
if (!drag || !sidebar) return;
|
|
4132
|
-
const from = this.roster.
|
|
4278
|
+
const from = this.roster.workspaces.indexOf(drag.workspace);
|
|
4133
4279
|
if (drag.to === from) return;
|
|
4134
4280
|
const geo = geometry(sidebar.height, 0, this.split, layout.rail);
|
|
4135
|
-
const shown = drag.to - this.sidebarScroll.
|
|
4136
|
-
if (shown < 0 || shown >= geo.
|
|
4137
|
-
const top = geo.
|
|
4138
|
-
const y = (drag.to < from ? top : top + geo.
|
|
4281
|
+
const shown = drag.to - this.sidebarScroll.workspaces;
|
|
4282
|
+
if (shown < 0 || shown >= geo.workspaceCap) return;
|
|
4283
|
+
const top = geo.workspaceTop + shown * geo.workspaceStep;
|
|
4284
|
+
const y = (drag.to < from ? top : top + geo.workspaceStep) - 1;
|
|
4139
4285
|
for (let x = 0; x < sidebar.width; x++) {
|
|
4140
4286
|
const cell = frame.cellAt(x, y);
|
|
4141
4287
|
if (!cell) continue;
|
|
@@ -4163,7 +4309,7 @@ var SpacesHost = class {
|
|
|
4163
4309
|
/** One pane: its border (the focused one in the accent colour), then its session or what stands in for it. */
|
|
4164
4310
|
drawPane(frame, pane, focused, bordered) {
|
|
4165
4311
|
const { entry, outer, inner } = pane;
|
|
4166
|
-
if (bordered) drawBox(frame, outer, focused ? this.palette.
|
|
4312
|
+
if (bordered) drawBox(frame, outer, focused ? this.palette.focus : this.palette.border);
|
|
4167
4313
|
const child = entry.child;
|
|
4168
4314
|
if (child) {
|
|
4169
4315
|
frame.blit(child.screen.cells(entry.scrollBack), inner);
|
|
@@ -4185,23 +4331,23 @@ var SpacesHost = class {
|
|
|
4185
4331
|
}
|
|
4186
4332
|
return;
|
|
4187
4333
|
}
|
|
4188
|
-
const
|
|
4334
|
+
const workspace = this.roster.workspaceOf(entry);
|
|
4189
4335
|
const say = /* @__PURE__ */ __name((row, text) => void frame.writeText(inner, row, text), "say");
|
|
4190
4336
|
if (entry.folderMissing) {
|
|
4191
4337
|
say(1, ` The folder for "${entry.label}" was not found.`);
|
|
4192
|
-
say(2, ` ${
|
|
4193
|
-
say(3, " Put it back or remove this
|
|
4338
|
+
say(2, ` ${workspace.cwd}`);
|
|
4339
|
+
say(3, " Put it back or remove this workspace, then press enter to try again.");
|
|
4194
4340
|
} else if (entry.openElsewhere) {
|
|
4195
4341
|
say(1, ` "${entry.label}" is open in another terminal.`);
|
|
4196
4342
|
say(2, " Close it there, then press enter to open it here.");
|
|
4197
4343
|
} else if (entry.checking) say(1, ` Opening "${entry.label}"...`);
|
|
4198
4344
|
else {
|
|
4199
|
-
say(1, ` "${entry.label}" in ${
|
|
4345
|
+
say(1, ` "${entry.label}" in ${workspace.name} has not started yet.`);
|
|
4200
4346
|
say(2, " Press enter or click it to open it.");
|
|
4201
4347
|
}
|
|
4202
4348
|
}
|
|
4203
4349
|
// --- remembering the layout ------------------------------------------------
|
|
4204
|
-
/** What is written between runs:
|
|
4350
|
+
/** What is written between runs: workspaces with their tabs and pane trees, and where focus is. */
|
|
4205
4351
|
snapshot() {
|
|
4206
4352
|
const selected = this.roster.selected;
|
|
4207
4353
|
const saveNode = /* @__PURE__ */ __name((node) => {
|
|
@@ -4232,17 +4378,17 @@ var SpacesHost = class {
|
|
|
4232
4378
|
...tab.zoomed ? { zoomed: true } : {}
|
|
4233
4379
|
};
|
|
4234
4380
|
}, "saveTab");
|
|
4235
|
-
const
|
|
4236
|
-
const active =
|
|
4381
|
+
const workspaces = this.roster.workspaces.map((workspace2) => {
|
|
4382
|
+
const active = workspace2.activeTab ? workspace2.tabs.indexOf(workspace2.activeTab) : 0;
|
|
4237
4383
|
return {
|
|
4238
|
-
name:
|
|
4239
|
-
cwd:
|
|
4240
|
-
...
|
|
4241
|
-
tabs:
|
|
4384
|
+
name: workspace2.name,
|
|
4385
|
+
cwd: workspace2.cwd,
|
|
4386
|
+
...workspace2.lastAccount ? { lastAccount: workspace2.lastAccount } : {},
|
|
4387
|
+
tabs: workspace2.tabs.map(saveTab),
|
|
4242
4388
|
...active > 0 ? { activeTab: active } : {}
|
|
4243
4389
|
};
|
|
4244
4390
|
});
|
|
4245
|
-
const
|
|
4391
|
+
const workspace = selected ? this.roster.workspaces.indexOf(this.roster.workspaceOf(selected)) : -1;
|
|
4246
4392
|
const sidebar = {
|
|
4247
4393
|
...this.sidebar.collapsed ? { collapsed: true } : {},
|
|
4248
4394
|
...this.sidebar.width !== SIDEBAR_DEFAULT ? { width: this.sidebar.width } : {},
|
|
@@ -4250,9 +4396,9 @@ var SpacesHost = class {
|
|
|
4250
4396
|
...this.order !== "grouped" ? { order: this.order } : {}
|
|
4251
4397
|
};
|
|
4252
4398
|
return {
|
|
4253
|
-
version:
|
|
4254
|
-
|
|
4255
|
-
...
|
|
4399
|
+
version: 3,
|
|
4400
|
+
workspaces,
|
|
4401
|
+
...workspace >= 0 ? { focus: { workspace } } : {},
|
|
4256
4402
|
...Object.keys(sidebar).length > 0 ? { sidebar } : {}
|
|
4257
4403
|
};
|
|
4258
4404
|
}
|
|
@@ -4268,7 +4414,7 @@ var SpacesHost = class {
|
|
|
4268
4414
|
const store = this.options.store;
|
|
4269
4415
|
if (!store) return;
|
|
4270
4416
|
try {
|
|
4271
|
-
store.save(this.forgetAll ? { version:
|
|
4417
|
+
store.save(this.forgetAll ? { version: 3, workspaces: [] } : this.snapshot());
|
|
4272
4418
|
} catch {
|
|
4273
4419
|
}
|
|
4274
4420
|
}
|
|
@@ -4317,6 +4463,6 @@ var SpacesHost = class {
|
|
|
4317
4463
|
export {
|
|
4318
4464
|
realSignalHooks,
|
|
4319
4465
|
realSchedule,
|
|
4320
|
-
|
|
4466
|
+
WorkspacesHost
|
|
4321
4467
|
};
|
|
4322
|
-
//# sourceMappingURL=chunk-
|
|
4468
|
+
//# sourceMappingURL=chunk-7XAUAIGO.js.map
|